@univerjs-pro/bases 0.25.0-insiders.20260608-e4336f7

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.
Files changed (157) hide show
  1. package/README.md +42 -0
  2. package/lib/cjs/facade.js +1 -0
  3. package/lib/cjs/index.js +1 -0
  4. package/lib/cjs/locale/ar-SA.js +1 -0
  5. package/lib/cjs/locale/ca-ES.js +1 -0
  6. package/lib/cjs/locale/de-DE.js +1 -0
  7. package/lib/cjs/locale/en-US.js +1 -0
  8. package/lib/cjs/locale/es-ES.js +1 -0
  9. package/lib/cjs/locale/fa-IR.js +1 -0
  10. package/lib/cjs/locale/fr-FR.js +1 -0
  11. package/lib/cjs/locale/id-ID.js +1 -0
  12. package/lib/cjs/locale/it-IT.js +1 -0
  13. package/lib/cjs/locale/ja-JP.js +1 -0
  14. package/lib/cjs/locale/ko-KR.js +1 -0
  15. package/lib/cjs/locale/pl-PL.js +1 -0
  16. package/lib/cjs/locale/pt-BR.js +1 -0
  17. package/lib/cjs/locale/ru-RU.js +1 -0
  18. package/lib/cjs/locale/sk-SK.js +1 -0
  19. package/lib/cjs/locale/vi-VN.js +1 -0
  20. package/lib/cjs/locale/zh-CN.js +1 -0
  21. package/lib/cjs/locale/zh-HK.js +1 -0
  22. package/lib/cjs/locale/zh-TW.js +1 -0
  23. package/lib/es/facade.js +1 -0
  24. package/lib/es/index.js +1 -0
  25. package/lib/es/locale/ar-SA.js +1 -0
  26. package/lib/es/locale/ca-ES.js +1 -0
  27. package/lib/es/locale/de-DE.js +1 -0
  28. package/lib/es/locale/en-US.js +1 -0
  29. package/lib/es/locale/es-ES.js +1 -0
  30. package/lib/es/locale/fa-IR.js +1 -0
  31. package/lib/es/locale/fr-FR.js +1 -0
  32. package/lib/es/locale/id-ID.js +1 -0
  33. package/lib/es/locale/it-IT.js +1 -0
  34. package/lib/es/locale/ja-JP.js +1 -0
  35. package/lib/es/locale/ko-KR.js +1 -0
  36. package/lib/es/locale/pl-PL.js +1 -0
  37. package/lib/es/locale/pt-BR.js +1 -0
  38. package/lib/es/locale/ru-RU.js +1 -0
  39. package/lib/es/locale/sk-SK.js +1 -0
  40. package/lib/es/locale/vi-VN.js +1 -0
  41. package/lib/es/locale/zh-CN.js +1 -0
  42. package/lib/es/locale/zh-HK.js +1 -0
  43. package/lib/es/locale/zh-TW.js +1 -0
  44. package/lib/facade.js +1 -0
  45. package/lib/index.js +1 -0
  46. package/lib/locale/ar-SA.js +1 -0
  47. package/lib/locale/ca-ES.js +1 -0
  48. package/lib/locale/de-DE.js +1 -0
  49. package/lib/locale/en-US.js +1 -0
  50. package/lib/locale/es-ES.js +1 -0
  51. package/lib/locale/fa-IR.js +1 -0
  52. package/lib/locale/fr-FR.js +1 -0
  53. package/lib/locale/id-ID.js +1 -0
  54. package/lib/locale/it-IT.js +1 -0
  55. package/lib/locale/ja-JP.js +1 -0
  56. package/lib/locale/ko-KR.js +1 -0
  57. package/lib/locale/pl-PL.js +1 -0
  58. package/lib/locale/pt-BR.js +1 -0
  59. package/lib/locale/ru-RU.js +1 -0
  60. package/lib/locale/sk-SK.js +1 -0
  61. package/lib/locale/vi-VN.js +1 -0
  62. package/lib/locale/zh-CN.js +1 -0
  63. package/lib/locale/zh-HK.js +1 -0
  64. package/lib/locale/zh-TW.js +1 -0
  65. package/lib/types/commands/cell.command.d.ts +32 -0
  66. package/lib/types/commands/field.command.d.ts +53 -0
  67. package/lib/types/commands/record.command.d.ts +39 -0
  68. package/lib/types/commands/table.command.d.ts +18 -0
  69. package/lib/types/commands/undo-redo.d.ts +2 -0
  70. package/lib/types/commands/view.command.d.ts +107 -0
  71. package/lib/types/controllers/base-active-dirty.controller.d.ts +16 -0
  72. package/lib/types/controllers/base-formula-calculation.controller.d.ts +23 -0
  73. package/lib/types/controllers/base-formula-optional-identifier.d.ts +1 -0
  74. package/lib/types/controllers/base-remote-formula.controller.d.ts +13 -0
  75. package/lib/types/facade/f-base.d.ts +362 -0
  76. package/lib/types/facade/f-event.d.ts +61 -0
  77. package/lib/types/facade/f-field.d.ts +191 -0
  78. package/lib/types/facade/f-permission.d.ts +299 -0
  79. package/lib/types/facade/f-range.d.ts +179 -0
  80. package/lib/types/facade/f-record.d.ts +137 -0
  81. package/lib/types/facade/f-table.d.ts +769 -0
  82. package/lib/types/facade/f-univer.d.ts +148 -0
  83. package/lib/types/facade/f-view.d.ts +275 -0
  84. package/lib/types/facade/index.d.ts +10 -0
  85. package/lib/types/fields/date-format.d.ts +6 -0
  86. package/lib/types/fields/field-core-plugin.d.ts +21 -0
  87. package/lib/types/fields/number-format.d.ts +15 -0
  88. package/lib/types/index.d.ts +48 -0
  89. package/lib/types/locale/ar-SA.d.ts +3 -0
  90. package/lib/types/locale/ca-ES.d.ts +3 -0
  91. package/lib/types/locale/de-DE.d.ts +3 -0
  92. package/lib/types/locale/en-US.d.ts +59 -0
  93. package/lib/types/locale/es-ES.d.ts +3 -0
  94. package/lib/types/locale/fa-IR.d.ts +3 -0
  95. package/lib/types/locale/fr-FR.d.ts +3 -0
  96. package/lib/types/locale/id-ID.d.ts +3 -0
  97. package/lib/types/locale/it-IT.d.ts +3 -0
  98. package/lib/types/locale/ja-JP.d.ts +3 -0
  99. package/lib/types/locale/ko-KR.d.ts +3 -0
  100. package/lib/types/locale/pl-PL.d.ts +3 -0
  101. package/lib/types/locale/pt-BR.d.ts +3 -0
  102. package/lib/types/locale/ru-RU.d.ts +3 -0
  103. package/lib/types/locale/sk-SK.d.ts +3 -0
  104. package/lib/types/locale/vi-VN.d.ts +3 -0
  105. package/lib/types/locale/zh-CN.d.ts +3 -0
  106. package/lib/types/locale/zh-HK.d.ts +3 -0
  107. package/lib/types/locale/zh-TW.d.ts +3 -0
  108. package/lib/types/models/base-cell-data.d.ts +14 -0
  109. package/lib/types/models/base-snapshot.d.ts +1 -0
  110. package/lib/types/models/default-table.d.ts +12 -0
  111. package/lib/types/models/field-snapshot.d.ts +1 -0
  112. package/lib/types/models/record-snapshot.d.ts +1 -0
  113. package/lib/types/models/table-snapshot.d.ts +1 -0
  114. package/lib/types/models/value.d.ts +1 -0
  115. package/lib/types/models/view-snapshot.d.ts +1 -0
  116. package/lib/types/mutations/json1.mutation.d.ts +7 -0
  117. package/lib/types/mutations/utils.d.ts +2 -0
  118. package/lib/types/ot/json1-adapter.d.ts +103 -0
  119. package/lib/types/ot/json1-invalidation.d.ts +2 -0
  120. package/lib/types/ot/json1-op-applier.d.ts +6 -0
  121. package/lib/types/ot/json1-op-factory.d.ts +64 -0
  122. package/lib/types/ot/json1-path.d.ts +13 -0
  123. package/lib/types/plugin.d.ts +35 -0
  124. package/lib/types/search/base-search.d.ts +24 -0
  125. package/lib/types/services/base-active-dirty.service.d.ts +24 -0
  126. package/lib/types/services/base-command.service.d.ts +122 -0
  127. package/lib/types/services/base-compression.service.d.ts +46 -0
  128. package/lib/types/services/base-field-registry.service.d.ts +17 -0
  129. package/lib/types/services/base-formula.service.d.ts +71 -0
  130. package/lib/types/services/base-performance.service.d.ts +5 -0
  131. package/lib/types/services/base-permission.service.d.ts +76 -0
  132. package/lib/types/services/base-projection.service.d.ts +97 -0
  133. package/lib/types/services/base-resource.service.d.ts +15 -0
  134. package/lib/types/services/base-view-registry.service.d.ts +15 -0
  135. package/lib/types/views/view-core-plugin.d.ts +21 -0
  136. package/lib/umd/facade.js +1 -0
  137. package/lib/umd/index.js +1 -0
  138. package/lib/umd/locale/ar-SA.js +1 -0
  139. package/lib/umd/locale/ca-ES.js +1 -0
  140. package/lib/umd/locale/de-DE.js +1 -0
  141. package/lib/umd/locale/en-US.js +1 -0
  142. package/lib/umd/locale/es-ES.js +1 -0
  143. package/lib/umd/locale/fa-IR.js +1 -0
  144. package/lib/umd/locale/fr-FR.js +1 -0
  145. package/lib/umd/locale/id-ID.js +1 -0
  146. package/lib/umd/locale/it-IT.js +1 -0
  147. package/lib/umd/locale/ja-JP.js +1 -0
  148. package/lib/umd/locale/ko-KR.js +1 -0
  149. package/lib/umd/locale/pl-PL.js +1 -0
  150. package/lib/umd/locale/pt-BR.js +1 -0
  151. package/lib/umd/locale/ru-RU.js +1 -0
  152. package/lib/umd/locale/sk-SK.js +1 -0
  153. package/lib/umd/locale/vi-VN.js +1 -0
  154. package/lib/umd/locale/zh-CN.js +1 -0
  155. package/lib/umd/locale/zh-HK.js +1 -0
  156. package/lib/umd/locale/zh-TW.js +1 -0
  157. package/package.json +86 -0
@@ -0,0 +1,769 @@
1
+ import type { BaseCellValue, BaseDataModel, ICommandService, IFieldSnapshot, ITableSnapshot, IViewSnapshot, SortConfig, ViewType } from '@univerjs/core';
2
+ import type { IBasePermissionService } from '../services/base-permission.service';
3
+ import type { IBaseProjectionService } from '../services/base-projection.service';
4
+ import { FField } from './f-field';
5
+ import { FTablePermission } from './f-permission';
6
+ import { FBaseRange } from './f-range';
7
+ import { FRecord } from './f-record';
8
+ import { FView } from './f-view';
9
+ export interface IAddFieldInput {
10
+ /** Field display name. */
11
+ name: string;
12
+ /** Field type, such as `text`, `number`, `singleSelect`, or `formula`. */
13
+ type: IFieldSnapshot['type'];
14
+ /** Field type configuration. Formula fields use `config.formula`. */
15
+ config?: IFieldSnapshot['config'];
16
+ /** Default value applied to new records when supported by the field type. */
17
+ defaultValue?: IFieldSnapshot['defaultValue'];
18
+ /** Optional field description. */
19
+ description?: string;
20
+ /** Optional field id. A random id is generated when omitted. */
21
+ id?: string;
22
+ /** Optional insertion index in the table field order. */
23
+ index?: number;
24
+ /** Whether this field should be readonly. Formula fields are usually readonly. */
25
+ readonly?: boolean;
26
+ }
27
+ export interface IAddRecordInput {
28
+ /** Optional record id. A random id is generated when omitted. */
29
+ id?: string;
30
+ /** Initial field-id keyed values. */
31
+ values?: Record<string, BaseCellValue>;
32
+ /** Optional order key used to position the record. */
33
+ orderKey?: string;
34
+ /** Optional creation timestamp. */
35
+ createdAt?: number;
36
+ /** Optional update timestamp. */
37
+ updatedAt?: number;
38
+ /** Optional creator user id. */
39
+ createdBy?: string;
40
+ /** Optional updater user id. */
41
+ updatedBy?: string;
42
+ }
43
+ export interface ICreateViewInput {
44
+ /** Optional view id. A random id is generated when omitted. */
45
+ id?: string;
46
+ /** View display name. */
47
+ name: string;
48
+ /** View type, such as `grid`, `kanban`, `calendar`, `gantt`, or `gallery`. */
49
+ type: ViewType;
50
+ /** View-specific configuration. */
51
+ config?: IViewSnapshot['config'];
52
+ /** Optional insertion index in the table view order. */
53
+ index?: number;
54
+ }
55
+ export interface IListRecordOptions {
56
+ /** Optional view id. When provided, records are returned in the view projection order. */
57
+ viewId?: string;
58
+ /** Optional field filter. */
59
+ filter?: IBaseRecordFilter;
60
+ /** Optional sort rules applied after view ordering. */
61
+ sort?: SortConfig[];
62
+ /** Optional zero-based offset. */
63
+ offset?: number;
64
+ /** Optional maximum number of records to return. */
65
+ limit?: number;
66
+ }
67
+ export interface IBaseRecordFilter {
68
+ fieldId?: string;
69
+ operator?: 'is' | 'isNot' | 'contains' | 'doesNotContain' | 'isEmpty' | 'isNotEmpty' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual';
70
+ value?: BaseCellValue;
71
+ conjunction?: 'and' | 'or';
72
+ conditions?: IBaseRecordFilter[];
73
+ }
74
+ export interface IQueryRecordsResult {
75
+ records: FRecord[];
76
+ total: number;
77
+ offset: number;
78
+ limit: number | null;
79
+ hasMore: boolean;
80
+ }
81
+ export interface IBaseTableSchemaSnapshot {
82
+ id: string;
83
+ name: string;
84
+ primaryFieldId: string;
85
+ fieldIds: string[];
86
+ viewIds: string[];
87
+ recordCount: number;
88
+ fields: Array<Pick<IFieldSnapshot, 'id' | 'name' | 'type' | 'config' | 'readonly' | 'description'>>;
89
+ views: Array<Pick<IViewSnapshot, 'id' | 'name' | 'type'>>;
90
+ }
91
+ /**
92
+ * Facade API object bound to a Base table.
93
+ *
94
+ * A Base table is similar to a worksheet: fields are columns, records are rows,
95
+ * and ranges address rectangular record-field regions.
96
+ *
97
+ * Use table methods for field, record, cell, range, view, schema, and table
98
+ * permission operations. The table facade always resolves the latest table
99
+ * snapshot from the Base model, so a previously created `FTable` remains usable
100
+ * after other facade commands mutate the table.
101
+ *
102
+ * @example Create fields, records, a view, and a query
103
+ * ```ts
104
+ * const table = await base.createTable({ id: 'tasks', name: 'Tasks', primaryFieldName: 'Title' });
105
+ * const status = await table.addField({
106
+ * id: 'status',
107
+ * name: 'Status',
108
+ * type: 'singleSelect',
109
+ * config: { options: [{ id: 'todo', name: 'Todo', color: 'blue' }, { id: 'done', name: 'Done', color: 'green' }] },
110
+ * });
111
+ * const progress = await table.addField({ id: 'progress', name: 'Progress', type: 'progress', config: {} });
112
+ * await table.addRecords([
113
+ * { id: 'task-1', values: { [table.getPrimaryFieldId()]: 'Design protocol', [status.getId()]: 'todo', [progress.getId()]: 20 } },
114
+ * { id: 'task-2', values: { [table.getPrimaryFieldId()]: 'Wire server load', [status.getId()]: 'done', [progress.getId()]: 100 } },
115
+ * ]);
116
+ * const grid = await table.createView({ id: 'grid-main', name: 'Main Grid', type: 'grid' });
117
+ * await grid.setSort([{ fieldId: progress.getId(), direction: 'desc' }]);
118
+ * const done = table.queryRecords({ filter: { fieldId: status.getId(), operator: 'is', value: 'done' } });
119
+ * ```
120
+ */
121
+ export declare class FTable {
122
+ private readonly _base;
123
+ private readonly _tableId;
124
+ private readonly _commandService;
125
+ private readonly _projectionService;
126
+ private readonly _permissionService;
127
+ constructor(_base: BaseDataModel, _tableId: string, _commandService: ICommandService, _projectionService: IBaseProjectionService, _permissionService: IBasePermissionService);
128
+ /**
129
+ * Get the underlying Base data model.
130
+ * @returns The Base data model.
131
+ * @example
132
+ * ```ts
133
+ * const baseModel = table.getBase();
134
+ * ```
135
+ */
136
+ getBase(): BaseDataModel;
137
+ /**
138
+ * Get the table snapshot.
139
+ * @returns The table snapshot.
140
+ * @example
141
+ * ```ts
142
+ * const rawTable = table.getTable();
143
+ * ```
144
+ */
145
+ getTable(): ITableSnapshot;
146
+ /**
147
+ * Get the table snapshot.
148
+ * @returns The table snapshot.
149
+ * @example
150
+ * ```ts
151
+ * const snapshot = table.getSnapshot();
152
+ * ```
153
+ */
154
+ getSnapshot(): ITableSnapshot;
155
+ /**
156
+ * Get the table id.
157
+ * @returns The table id.
158
+ * @example
159
+ * ```ts
160
+ * console.log(table.getId());
161
+ * ```
162
+ */
163
+ getId(): string;
164
+ /**
165
+ * Get the table name.
166
+ * @returns The table name.
167
+ * @example
168
+ * ```ts
169
+ * console.log(table.getName());
170
+ * ```
171
+ */
172
+ getName(): string;
173
+ /**
174
+ * Get the primary field id.
175
+ * @returns The primary field id.
176
+ * @example
177
+ * ```ts
178
+ * const primaryFieldId = table.getPrimaryFieldId();
179
+ * ```
180
+ */
181
+ getPrimaryFieldId(): string;
182
+ /**
183
+ * Rename this table.
184
+ * @param name The new table name.
185
+ * @example
186
+ * ```ts
187
+ * await table.setName('Roadmap');
188
+ * ```
189
+ */
190
+ setName(name: string): Promise<void>;
191
+ /**
192
+ * Get all non-deleted fields in this table.
193
+ * @returns Field facades ordered by the table field order.
194
+ * @example
195
+ * ```ts
196
+ * const fields = table.getFields();
197
+ * fields.forEach((field) => console.log(field.getName()));
198
+ * ```
199
+ */
200
+ getFields(): FField[];
201
+ /**
202
+ * List all non-deleted fields in this table.
203
+ * @returns Field facades ordered by the table field order.
204
+ * @example
205
+ * ```ts
206
+ * const fields = table.listFields();
207
+ * ```
208
+ */
209
+ listFields(): FField[];
210
+ /**
211
+ * Get a field by id.
212
+ * @param fieldId The field id.
213
+ * @returns The field facade, or null if the field does not exist.
214
+ * @example
215
+ * ```ts
216
+ * const field = table.getField('status');
217
+ * ```
218
+ */
219
+ getField(fieldId: string): FField | null;
220
+ /**
221
+ * Get a field by id.
222
+ * @param fieldId The field id.
223
+ * @returns The field facade, or null if the field does not exist.
224
+ * @example
225
+ * ```ts
226
+ * const field = table.getFieldById('status');
227
+ * ```
228
+ */
229
+ getFieldById(fieldId: string): FField | null;
230
+ /**
231
+ * Get the first field matching a field name.
232
+ * @param name The field name.
233
+ * @returns The field facade, or null if no field matches.
234
+ * @example
235
+ * ```ts
236
+ * const field = table.getFieldByName('Status');
237
+ * ```
238
+ */
239
+ getFieldByName(name: string): FField | null;
240
+ /**
241
+ * Get the primary field.
242
+ * @returns The primary field facade.
243
+ * @example
244
+ * ```ts
245
+ * const titleField = table.getPrimaryField();
246
+ * ```
247
+ */
248
+ getPrimaryField(): FField;
249
+ /**
250
+ * Add a field to this table.
251
+ *
252
+ * Field type belongs to the field snapshot, not to each cell. Cell payloads
253
+ * may carry typed metadata for compact storage, but formula calculation and
254
+ * value interpretation should read the field definition from the table.
255
+ *
256
+ * @param input Field creation options. `name` and `type` are required.
257
+ * `config` is type-specific and is where options, attachment settings,
258
+ * formula expressions, number/date formatting, and view-specific field
259
+ * metadata should live. `defaultValue` is applied by callers when creating
260
+ * records. `readonly` is appropriate for calculated fields.
261
+ * @returns The created field facade.
262
+ * @example
263
+ * ```ts
264
+ * const status = await table.addField({
265
+ * id: 'status',
266
+ * name: 'Status',
267
+ * type: 'singleSelect',
268
+ * config: {
269
+ * options: [
270
+ * { id: 'todo', name: 'Todo', color: 'blue' },
271
+ * { id: 'done', name: 'Done', color: 'green' },
272
+ * ],
273
+ * },
274
+ * });
275
+ * ```
276
+ * @example Formula field
277
+ * ```ts
278
+ * const amount = await table.addField({ id: 'amount', name: 'Amount', type: 'number', config: { decimalPlaces: 2 } });
279
+ * const tax = await table.addField({ id: 'tax', name: 'Tax', type: 'number', config: { decimalPlaces: 2 } });
280
+ * const total = await table.addField({
281
+ * id: 'total',
282
+ * name: 'Total',
283
+ * type: 'formula',
284
+ * readonly: true,
285
+ * config: { formula: '=SUM(table[Amount], table[Tax])' },
286
+ * });
287
+ * ```
288
+ * @example
289
+ * ```ts
290
+ * const total = await table.addField({
291
+ * id: 'total',
292
+ * name: 'Total',
293
+ * type: 'formula',
294
+ * readonly: true,
295
+ * config: {
296
+ * formula: '=SUM(table[Progress], Pricing[Amount])',
297
+ * numberFormat: { type: 'currency', pattern: '"$"#,##0.00' },
298
+ * },
299
+ * });
300
+ * ```
301
+ */
302
+ addField(input: IAddFieldInput): Promise<FField>;
303
+ /**
304
+ * Create a field in this table.
305
+ * @param input Field creation options.
306
+ * @returns The created field facade.
307
+ * @example
308
+ * ```ts
309
+ * const numberField = await table.createField({
310
+ * name: 'Cost',
311
+ * type: 'number',
312
+ * config: { decimalPlaces: 2 },
313
+ * });
314
+ * ```
315
+ */
316
+ createField(input: IAddFieldInput): Promise<FField>;
317
+ /**
318
+ * Update a field by id.
319
+ * @param fieldId The field id.
320
+ * @param patch Partial field snapshot to merge into the field.
321
+ * @example
322
+ * ```ts
323
+ * await table.updateField('total', {
324
+ * config: { formula: '=SUM(table[Amount], table[Tax])' },
325
+ * });
326
+ * ```
327
+ */
328
+ updateField(fieldId: string, patch: Partial<IFieldSnapshot>): Promise<void>;
329
+ /**
330
+ * Change a field type.
331
+ * @param fieldId The field id.
332
+ * @param input The target type and config.
333
+ * @example
334
+ * ```ts
335
+ * await table.changeFieldType('score', { type: 'number', config: { decimalPlaces: 0 } });
336
+ * ```
337
+ */
338
+ changeFieldType(fieldId: string, input: Pick<IFieldSnapshot, 'type' | 'config'>): Promise<void>;
339
+ /**
340
+ * Delete a field by id.
341
+ * @param fieldId The field id.
342
+ * @example
343
+ * ```ts
344
+ * await table.deleteField('deprecated');
345
+ * ```
346
+ */
347
+ deleteField(fieldId: string): Promise<void>;
348
+ /**
349
+ * Move a field relative to another field.
350
+ * @param fieldId The field id.
351
+ * @param target Target position descriptor.
352
+ * @param target.beforeFieldId Optional field id to move this field before.
353
+ * @param target.afterFieldId Optional field id to move this field after.
354
+ * @example
355
+ * ```ts
356
+ * await table.moveField('status', { afterFieldId: 'title' });
357
+ * ```
358
+ */
359
+ moveField(fieldId: string, target: {
360
+ beforeFieldId?: string;
361
+ afterFieldId?: string;
362
+ }): Promise<void>;
363
+ /**
364
+ * Get a record by id.
365
+ * @param recordId The record id.
366
+ * @returns The record facade, or null if the record does not exist.
367
+ * @example
368
+ * ```ts
369
+ * const record = table.getRecord('record-1');
370
+ * ```
371
+ */
372
+ getRecord(recordId: string): FRecord | null;
373
+ /**
374
+ * Get a record by id.
375
+ * @param recordId The record id.
376
+ * @returns The record facade, or null if the record does not exist.
377
+ * @example
378
+ * ```ts
379
+ * const record = table.getRecordById('record-1');
380
+ * ```
381
+ */
382
+ getRecordById(recordId: string): FRecord | null;
383
+ /**
384
+ * Get records in this table.
385
+ *
386
+ * Records are returned in table order by default. Passing `viewId` first
387
+ * projects the records through the view, then optional filter, sort,
388
+ * offset, and limit are applied.
389
+ *
390
+ * @param options Optional list options. `viewId` selects a view projection.
391
+ * `filter` supports simple and nested conditions. `sort` applies field-id
392
+ * keyed sort rules. `offset` and `limit` page the returned facade objects.
393
+ * @returns Record facades.
394
+ * @example
395
+ * ```ts
396
+ * const records = table.getRecords();
397
+ * const visibleRecords = table.getRecords({ viewId: 'grid' });
398
+ * ```
399
+ */
400
+ getRecords(options?: IListRecordOptions): FRecord[];
401
+ /**
402
+ * Query records with filter, sort, and pagination metadata.
403
+ *
404
+ * Prefer this over `getRecords()` when an API response needs `total`,
405
+ * `offset`, `limit`, or `hasMore`.
406
+ *
407
+ * @param options Query options. `filter` uses field ids and operators such
408
+ * as `is`, `contains`, `isEmpty`, and numeric comparisons. `sort` is applied
409
+ * after filtering. `offset` is zero-based and `limit` is nullable.
410
+ * @returns Records and pagination metadata.
411
+ * @example
412
+ * ```ts
413
+ * const page = table.queryRecords({
414
+ * filter: { fieldId: 'status', operator: 'is', value: 'done' },
415
+ * sort: [{ fieldId: 'progress', direction: 'desc' }],
416
+ * limit: 20,
417
+ * });
418
+ * ```
419
+ */
420
+ queryRecords(options?: IListRecordOptions): IQueryRecordsResult;
421
+ private _resolveRecordIds;
422
+ /**
423
+ * List records in this table.
424
+ * @param options Optional list options. Use `viewId` to return records in view projection order.
425
+ * @returns Record facades.
426
+ * @example
427
+ * ```ts
428
+ * const records = table.listRecords({ viewId: 'grid' });
429
+ * ```
430
+ */
431
+ listRecords(options?: IListRecordOptions): FRecord[];
432
+ /**
433
+ * Add a record to this table.
434
+ *
435
+ * Values are keyed by field id, not by field name. Use
436
+ * `table.getPrimaryFieldId()` or field facade ids to avoid name collisions
437
+ * and localization issues.
438
+ *
439
+ * @param input Record creation options. `id` is optional and should be
440
+ * supplied when the server owns ids. `values` is a field-id keyed map.
441
+ * `orderKey` controls row order and the command keeps the table
442
+ * `recordOrder` in sync. `createdAt`, `updatedAt`, `createdBy`, and
443
+ * `updatedBy` are optional metadata.
444
+ * @returns The created record facade.
445
+ * @example
446
+ * ```ts
447
+ * const record = await table.addRecord({
448
+ * id: 'record-1',
449
+ * values: { title: 'Ship beta', status: 'todo' },
450
+ * });
451
+ * ```
452
+ * @example Using field ids from facades
453
+ * ```ts
454
+ * const record = await table.addRecord({
455
+ * id: 'task-1',
456
+ * values: {
457
+ * [table.getPrimaryFieldId()]: 'Ship Base adapter',
458
+ * [statusField.getId()]: 'todo',
459
+ * },
460
+ * });
461
+ * ```
462
+ */
463
+ addRecord(input?: IAddRecordInput): Promise<FRecord>;
464
+ /**
465
+ * Create a record in this table.
466
+ * @param input Record creation options.
467
+ * @returns The created record facade.
468
+ * @example
469
+ * ```ts
470
+ * const record = await table.createRecord({ values: { title: 'New task' } });
471
+ * ```
472
+ */
473
+ createRecord(input?: IAddRecordInput): Promise<FRecord>;
474
+ /**
475
+ * Add multiple records to this table.
476
+ *
477
+ * This executes one batch command, so undo/redo, collaboration,
478
+ * `recordOrder`, and events see a single multi-record operation.
479
+ *
480
+ * @param inputs Record creation options. Each input has the same shape as
481
+ * `addRecord()`. Empty arrays are ignored and return `[]`.
482
+ * @returns Created record facades.
483
+ * @example
484
+ * ```ts
485
+ * const records = await table.addRecords([
486
+ * { values: { title: 'Task A' } },
487
+ * { values: { title: 'Task B' } },
488
+ * ]);
489
+ * ```
490
+ */
491
+ addRecords(inputs: IAddRecordInput[]): Promise<FRecord[]>;
492
+ /**
493
+ * Set values for multiple records.
494
+ *
495
+ * This is the preferred API for server-side or agent-side bulk updates
496
+ * where each record may update different fields.
497
+ *
498
+ * @param patches Record value patches. `recordId` identifies the target row
499
+ * and `values` is a field-id keyed partial value map.
500
+ * @example
501
+ * ```ts
502
+ * await table.setRecordValues([
503
+ * { recordId: 'record-1', values: { status: 'done' } },
504
+ * { recordId: 'record-2', values: { status: 'todo' } },
505
+ * ]);
506
+ * ```
507
+ */
508
+ setRecordValues(patches: Array<{
509
+ recordId: string;
510
+ values: Record<string, BaseCellValue>;
511
+ }>): Promise<void>;
512
+ /**
513
+ * Update one record by id.
514
+ * @param recordId The record id.
515
+ * @param values Field-id keyed values to write.
516
+ * @example
517
+ * ```ts
518
+ * await table.updateRecord('record-1', { title: 'Updated task', status: 'done' });
519
+ * ```
520
+ */
521
+ updateRecord(recordId: string, values: Record<string, BaseCellValue>): Promise<void>;
522
+ /**
523
+ * Delete a record by id.
524
+ * @param recordId The record id.
525
+ * @example
526
+ * ```ts
527
+ * await table.deleteRecord('record-1');
528
+ * ```
529
+ */
530
+ deleteRecord(recordId: string): Promise<void>;
531
+ /**
532
+ * Delete multiple records as one undoable command.
533
+ * @param recordIds Record ids to delete.
534
+ * @example
535
+ * ```ts
536
+ * await table.deleteRecords(['record-1', 'record-2']);
537
+ * ```
538
+ */
539
+ deleteRecords(recordIds: string[]): Promise<void>;
540
+ /**
541
+ * Duplicate a record by id.
542
+ * @param recordId The source record id.
543
+ * The duplicated record starts with the source record values, then applies
544
+ * `input.values` as field-id keyed overrides.
545
+ *
546
+ * @param input Optional record id, values, and metadata overrides.
547
+ * @param input.id Optional id for the duplicated record.
548
+ * @param input.values Optional field-id keyed values for the duplicated record.
549
+ * @param input.orderKey Optional order key for the duplicated record.
550
+ * @param input.createdAt Optional creation timestamp override.
551
+ * @param input.updatedAt Optional update timestamp override.
552
+ * @param input.createdBy Optional creator user id override.
553
+ * @param input.updatedBy Optional updater user id override.
554
+ * @returns The duplicated record facade.
555
+ * @example
556
+ * ```ts
557
+ * const copy = await table.duplicateRecord('record-1', {
558
+ * values: { title: 'Copied task' },
559
+ * });
560
+ * ```
561
+ */
562
+ duplicateRecord(recordId: string, input?: IAddRecordInput): Promise<FRecord>;
563
+ /**
564
+ * Update one cell value.
565
+ * @param recordId The record id.
566
+ * @param fieldId The field id.
567
+ * @param value The new cell value.
568
+ * @example
569
+ * ```ts
570
+ * await table.updateCell('record-1', 'status', 'done');
571
+ * ```
572
+ */
573
+ updateCell(recordId: string, fieldId: string, value: BaseCellValue): Promise<void>;
574
+ /**
575
+ * Set one cell value.
576
+ * @param recordId The record id.
577
+ * @param fieldId The field id.
578
+ * @param value The new cell value.
579
+ * @example
580
+ * ```ts
581
+ * await table.setCellValue('record-1', 'status', 'done');
582
+ * ```
583
+ */
584
+ setCellValue(recordId: string, fieldId: string, value: BaseCellValue): Promise<void>;
585
+ /**
586
+ * Get one cell value.
587
+ * @param recordId The record id.
588
+ * @param fieldId The field id.
589
+ * @returns The cell value, or null when empty.
590
+ * @example
591
+ * ```ts
592
+ * const value = table.getCellValue('record-1', 'status');
593
+ * ```
594
+ */
595
+ getCellValue(recordId: string, fieldId: string): BaseCellValue;
596
+ /**
597
+ * Update a record order key.
598
+ * @param recordId The record id.
599
+ * @param target The target order key.
600
+ * @param target.orderKey Optional replacement order key. Existing order key
601
+ * is kept when omitted.
602
+ * @example
603
+ * ```ts
604
+ * await table.updateRecordOrder('record-1', { orderKey: 'a1' });
605
+ * ```
606
+ */
607
+ updateRecordOrder(recordId: string, target: {
608
+ orderKey?: string;
609
+ }): Promise<void>;
610
+ /**
611
+ * Get a rectangular range by row and column indexes.
612
+ *
613
+ * Range indexes use the table's current `recordOrder` and `fieldOrder`.
614
+ * This mirrors Sheet-style row/column addressing while still writing Base
615
+ * record/field values under the hood.
616
+ *
617
+ * @param row The zero-based start row index.
618
+ * @param column The zero-based start column index.
619
+ * @param numRows Number of rows. Defaults to `1`.
620
+ * @param numColumns Number of columns. Defaults to `1`.
621
+ * @returns A Base range facade.
622
+ * @example
623
+ * ```ts
624
+ * const range = table.getRange(0, 0, 2, 3);
625
+ * const values = range.getValues();
626
+ * ```
627
+ * @example Write a 2 by 2 block
628
+ * ```ts
629
+ * await table.getRange(0, 0, 2, 2).setValues([
630
+ * ['Task A', 'todo'],
631
+ * ['Task B', 'done'],
632
+ * ]);
633
+ * ```
634
+ */
635
+ getRange(row: number, column: number, numRows?: number, numColumns?: number): FBaseRange;
636
+ /**
637
+ * Get a range that covers the current table data area.
638
+ * @returns The data range facade.
639
+ * @example
640
+ * ```ts
641
+ * const values = table.getDataRange().getValues();
642
+ * ```
643
+ */
644
+ getDataRange(): FBaseRange;
645
+ /**
646
+ * Get all non-deleted views in this table.
647
+ * @returns View facades ordered by the table view order.
648
+ * @example
649
+ * ```ts
650
+ * const views = table.getViews();
651
+ * ```
652
+ */
653
+ getViews(): FView[];
654
+ /**
655
+ * List all non-deleted views in this table.
656
+ * @returns View facades ordered by the table view order.
657
+ * @example
658
+ * ```ts
659
+ * const views = table.listViews();
660
+ * ```
661
+ */
662
+ listViews(): FView[];
663
+ /**
664
+ * Get a view by id.
665
+ * @param viewId The view id.
666
+ * @returns The view facade, or null if the view does not exist.
667
+ * @example
668
+ * ```ts
669
+ * const view = table.getView('grid');
670
+ * ```
671
+ */
672
+ getView(viewId: string): FView | null;
673
+ /**
674
+ * Get a view by id.
675
+ * @param viewId The view id.
676
+ * @returns The view facade, or null if the view does not exist.
677
+ * @example
678
+ * ```ts
679
+ * const view = table.getViewById('grid');
680
+ * ```
681
+ */
682
+ getViewById(viewId: string): FView | null;
683
+ /**
684
+ * Get the first view matching a view name.
685
+ * @param name The view name.
686
+ * @returns The view facade, or null if no view matches.
687
+ * @example
688
+ * ```ts
689
+ * const view = table.getViewByName('Grid');
690
+ * ```
691
+ */
692
+ getViewByName(name: string): FView | null;
693
+ /**
694
+ * Create a view in this table.
695
+ *
696
+ * The view starts with the table's current field order and empty field
697
+ * settings. Configure filters, sort, grouping, field visibility, and field
698
+ * widths through the returned `FView`.
699
+ *
700
+ * @param input View creation options. `name` and `type` are required.
701
+ * `config` is view-type specific, for example grid frozen fields, calendar
702
+ * date fields, or gantt start/end/progress fields. `index` controls view
703
+ * order.
704
+ * @returns The created view facade.
705
+ * @example
706
+ * ```ts
707
+ * const view = await table.createView({
708
+ * id: 'grid-api',
709
+ * name: 'API Grid',
710
+ * type: 'grid',
711
+ * config: { frozenFieldCount: 1 },
712
+ * });
713
+ * ```
714
+ * @example Calendar and gantt views
715
+ * ```ts
716
+ * const calendar = await table.createView({
717
+ * id: 'calendar-main',
718
+ * name: 'Calendar',
719
+ * type: 'calendar',
720
+ * config: { startFieldId: 'start', endFieldId: 'end' },
721
+ * });
722
+ * const gantt = await table.createView({
723
+ * id: 'gantt-main',
724
+ * name: 'Gantt',
725
+ * type: 'gantt',
726
+ * config: { startFieldId: 'start', endFieldId: 'end', progressFieldId: 'progress' },
727
+ * });
728
+ * ```
729
+ */
730
+ createView(input: ICreateViewInput): Promise<FView>;
731
+ /**
732
+ * Delete a view by id.
733
+ * @param viewId The view id.
734
+ * @example
735
+ * ```ts
736
+ * await table.deleteView('grid-api');
737
+ * ```
738
+ */
739
+ deleteView(viewId: string): Promise<void>;
740
+ /**
741
+ * Get a compact schema snapshot for this table.
742
+ * @returns Table schema without row values.
743
+ * @example
744
+ * ```ts
745
+ * console.log(table.getSchema().fields.map((field) => field.name));
746
+ * ```
747
+ */
748
+ getSchema(): IBaseTableSchemaSnapshot;
749
+ /**
750
+ * Get the table permission facade.
751
+ * @returns Table permission facade.
752
+ * @example
753
+ * ```ts
754
+ * table.getPermission().setPermission({ createRecord: false });
755
+ * ```
756
+ */
757
+ getPermission(): FTablePermission;
758
+ private _getTable;
759
+ private _wrapField;
760
+ private _wrapRecord;
761
+ private _wrapView;
762
+ }
763
+ export type AddFieldInput = IAddFieldInput;
764
+ export type AddRecordInput = IAddRecordInput;
765
+ export type CreateViewInput = ICreateViewInput;
766
+ export type ListRecordOptions = IListRecordOptions;
767
+ export type BaseRecordFilter = IBaseRecordFilter;
768
+ export type QueryRecordsResult = IQueryRecordsResult;
769
+ export type BaseTableSchemaSnapshot = IBaseTableSchemaSnapshot;