@airtable/blocks 1.7.0 → 1.9.0-experimental
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -3
- package/dist/cjs/error_utils.js +17 -0
- package/dist/cjs/models/base.js +16 -11
- package/dist/cjs/models/cursor.js +2 -0
- package/dist/cjs/models/field.js +157 -36
- package/dist/cjs/models/grouped_record_query_result.js +5 -14
- package/dist/cjs/models/linked_records_query_result.js +75 -27
- package/dist/cjs/models/mutation_constants.js +3 -1
- package/dist/cjs/models/mutations.js +70 -178
- package/dist/cjs/models/query_manager.js +327 -0
- package/dist/cjs/models/record.js +308 -55
- package/dist/cjs/models/record_query_result.js +4 -1
- package/dist/cjs/models/record_store.js +554 -765
- package/dist/cjs/models/table.js +22 -19
- package/dist/cjs/models/table_or_view_query_result.js +480 -414
- package/dist/cjs/models/view_data_store.js +243 -269
- package/dist/cjs/private_utils.js +50 -0
- package/dist/cjs/sdk.js +12 -2
- package/dist/cjs/testing/{mock_airtable_interface.js → abstract_mock_airtable_interface.js} +71 -22
- package/dist/cjs/types/block_query_spec.js +85 -0
- package/dist/cjs/types/field.js +1 -0
- package/dist/cjs/types/mutations.js +1 -0
- package/dist/cjs/ui/icon_config.js +6 -2
- package/dist/cjs/ui/use_global_config.js +1 -1
- package/dist/cjs/ui/use_records.js +5 -1
- package/dist/cjs/unstable_testing_utils.js +2 -2
- package/dist/cjs/watchable.js +123 -71
- package/dist/types/src/models/base.d.ts +10 -9
- package/dist/types/src/models/base.d.ts.map +1 -1
- package/dist/types/src/models/cursor.d.ts +2 -0
- package/dist/types/src/models/cursor.d.ts.map +1 -1
- package/dist/types/src/models/field.d.ts +71 -9
- package/dist/types/src/models/field.d.ts.map +1 -1
- package/dist/types/src/models/grouped_record_query_result.d.ts +3 -3
- package/dist/types/src/models/grouped_record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
- package/dist/types/src/models/mutation_constants.d.ts +1 -0
- package/dist/types/src/models/mutation_constants.d.ts.map +1 -1
- package/dist/types/src/models/mutations.d.ts.map +1 -1
- package/dist/types/src/models/query_manager.d.ts +2 -0
- package/dist/types/src/models/query_manager.d.ts.map +1 -0
- package/dist/types/src/models/record.d.ts +12 -3
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +3 -2
- package/dist/types/src/models/record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/record_store.d.ts.map +1 -1
- package/dist/types/src/models/table.d.ts +8 -10
- package/dist/types/src/models/table.d.ts.map +1 -1
- package/dist/types/src/models/table_or_view_query_result.d.ts +3 -5
- package/dist/types/src/models/table_or_view_query_result.d.ts.map +1 -1
- package/dist/types/src/models/view_data_store.d.ts +0 -1
- package/dist/types/src/models/view_data_store.d.ts.map +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
- package/dist/types/src/private_utils.d.ts +30 -1
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/testing/{mock_airtable_interface.d.ts → abstract_mock_airtable_interface.d.ts} +20 -15
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +1 -0
- package/dist/types/src/types/airtable_interface.d.ts +45 -21
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/block_query_spec.d.ts +139 -0
- package/dist/types/src/types/block_query_spec.d.ts.map +1 -0
- package/dist/types/src/types/field.d.ts +167 -51
- package/dist/types/src/types/field.d.ts.map +1 -1
- package/dist/types/src/types/mutations.d.ts +46 -3
- package/dist/types/src/types/mutations.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +0 -2
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +3 -8
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/icon_config.d.ts +7 -3
- package/dist/types/src/ui/icon_config.d.ts.map +1 -1
- package/dist/types/src/ui/link.d.ts +1 -1
- package/dist/types/src/ui/link.d.ts.map +1 -1
- package/dist/types/src/ui/use_global_config.d.ts +1 -1
- package/dist/types/src/unstable_testing_utils.d.ts +1 -1
- package/dist/types/src/unstable_testing_utils.d.ts.map +1 -1
- package/dist/types/src/watchable.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +1 -1
- package/dist/types/stories/helpers/field_type.d.ts.map +1 -1
- package/dist/types/stories/helpers/sync_source_options.d.ts +7 -0
- package/dist/types/stories/helpers/sync_source_options.d.ts.map +1 -0
- package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts +121 -0
- package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts.map +1 -0
- package/dist/types/test/airtable_interface_mocks/linked_records.d.ts +2 -2
- package/dist/types/test/airtable_interface_mocks/linked_records.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/{mock_airtable_interface_internal.d.ts → mock_airtable_interface.d.ts} +26 -18
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -0
- package/dist/types/test/airtable_interface_mocks/mock_base_data_stores.d.ts +51 -0
- package/dist/types/test/airtable_interface_mocks/mock_base_data_stores.d.ts.map +1 -0
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts +2 -2
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts.map +1 -1
- package/dist/types/test/test_helpers.d.ts +2 -0
- package/dist/types/test/test_helpers.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/types/src/testing/mock_airtable_interface.d.ts.map +0 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface_internal.d.ts.map +0 -1
package/dist/cjs/watchable.js
CHANGED
|
@@ -84,22 +84,28 @@ function () {
|
|
|
84
84
|
key: "__getWatchableKey",
|
|
85
85
|
value: function __getWatchableKey() {
|
|
86
86
|
return "".concat(this._watchableId, " ").concat(this._changeCount);
|
|
87
|
+
} // See above comment as to why changeCount needs to change when a mutation occurs (useSubscription)
|
|
88
|
+
// So this should be called whenever the model mutably changes
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
}, {
|
|
95
|
+
key: "__incrementOnChangeCount",
|
|
96
|
+
value: function __incrementOnChangeCount() {
|
|
97
|
+
this._changeCount += 1;
|
|
87
98
|
}
|
|
88
99
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* Every call to `.watch` should have a matching call to `.unwatch`.
|
|
100
|
+
* Helper method to get only the valid watchable keys - or throw if a key is invalid
|
|
92
101
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* @param keys the keys to watch
|
|
96
|
-
* @param callback a function to call when those keys change
|
|
97
|
-
* @param context an optional context for `this` in `callback`.
|
|
102
|
+
* @param keys
|
|
103
|
+
* @internal
|
|
98
104
|
*/
|
|
99
105
|
|
|
100
106
|
}, {
|
|
101
|
-
key: "
|
|
102
|
-
value: function
|
|
107
|
+
key: "_getWatchableValidKeysOrThrow",
|
|
108
|
+
value: function _getWatchableValidKeysOrThrow(keys, errorMethodName, shouldWarnInsteadOfThrow) {
|
|
103
109
|
var arrayKeys = Array.isArray(keys) ? keys : [keys];
|
|
104
110
|
var validKeys = [];
|
|
105
111
|
var _iteratorNormalCompletion = true;
|
|
@@ -112,24 +118,16 @@ function () {
|
|
|
112
118
|
|
|
113
119
|
if (this.constructor._isWatchableKey(_key2)) {
|
|
114
120
|
validKeys.push(_key2);
|
|
115
|
-
|
|
116
|
-
if (!this._changeWatchersByKey[_key2]) {
|
|
117
|
-
this._changeWatchersByKey[_key2] = [];
|
|
118
|
-
} // Rather than pushing onto this array, we initialize a new array.
|
|
119
|
-
// This is necessary since watches can change as a result of an
|
|
120
|
-
// event getting triggered. It would be bad if as we iterate over
|
|
121
|
-
// our watchers, new watchers get pushed onto the array that we
|
|
122
|
-
// are iterating over.
|
|
123
|
-
// TODO(jb): as a perf optimization, we *could* push onto this array
|
|
124
|
-
// as long as we are not in the middle of iterating over it.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this._changeWatchersByKey[_key2] = [...this._changeWatchersByKey[_key2], {
|
|
128
|
-
callback,
|
|
129
|
-
context
|
|
130
|
-
}];
|
|
131
121
|
} else {
|
|
132
|
-
|
|
122
|
+
var className = this.constructor._className;
|
|
123
|
+
var errorString = "Invalid key to ".concat(errorMethodName, " for ").concat(className, ": ").concat(_key2);
|
|
124
|
+
|
|
125
|
+
if (shouldWarnInsteadOfThrow) {
|
|
126
|
+
// eslint-disable-next-line no-console
|
|
127
|
+
console.warn(errorString);
|
|
128
|
+
} else {
|
|
129
|
+
throw (0, _error_utils.spawnError)(errorString);
|
|
130
|
+
}
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
} catch (err) {
|
|
@@ -150,49 +148,45 @@ function () {
|
|
|
150
148
|
return validKeys;
|
|
151
149
|
}
|
|
152
150
|
/**
|
|
153
|
-
*
|
|
151
|
+
* Get notified of changes to the model.
|
|
154
152
|
*
|
|
155
|
-
*
|
|
153
|
+
* Every call to `.watch` should have a matching call to `.unwatch`.
|
|
156
154
|
*
|
|
157
|
-
* Returns the array of keys that were
|
|
155
|
+
* Returns the array of keys that were watched.
|
|
158
156
|
*
|
|
159
|
-
* @param keys the keys to
|
|
160
|
-
* @param callback
|
|
161
|
-
* @param context
|
|
157
|
+
* @param keys the keys to watch
|
|
158
|
+
* @param callback a function to call when those keys change
|
|
159
|
+
* @param context an optional context for `this` in `callback`.
|
|
162
160
|
*/
|
|
163
161
|
|
|
164
162
|
}, {
|
|
165
|
-
key: "
|
|
166
|
-
value: function
|
|
167
|
-
var
|
|
168
|
-
|
|
163
|
+
key: "watch",
|
|
164
|
+
value: function watch(keys, callback, context) {
|
|
165
|
+
var validKeys = this._getWatchableValidKeysOrThrow(keys, 'watch');
|
|
166
|
+
|
|
169
167
|
var _iteratorNormalCompletion2 = true;
|
|
170
168
|
var _didIteratorError2 = false;
|
|
171
169
|
var _iteratorError2 = undefined;
|
|
172
170
|
|
|
173
171
|
try {
|
|
174
|
-
for (var _iterator2 =
|
|
172
|
+
for (var _iterator2 = validKeys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
175
173
|
var _key3 = _step2.value;
|
|
176
174
|
|
|
177
|
-
if (this.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
} else {
|
|
193
|
-
// eslint-disable-next-line no-console
|
|
194
|
-
console.warn("Invalid key to unwatch for ".concat(this.constructor._className, ": ").concat(_key3));
|
|
195
|
-
}
|
|
175
|
+
if (!this._changeWatchersByKey[_key3]) {
|
|
176
|
+
this._changeWatchersByKey[_key3] = [];
|
|
177
|
+
} // Rather than pushing onto this array, we initialize a new array.
|
|
178
|
+
// This is necessary since watches can change as a result of an
|
|
179
|
+
// event getting triggered. It would be bad if as we iterate over
|
|
180
|
+
// our watchers, new watchers get pushed onto the array that we
|
|
181
|
+
// are iterating over.
|
|
182
|
+
// TODO(jb): as a perf optimization, we *could* push onto this array
|
|
183
|
+
// as long as we are not in the middle of iterating over it.
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
this._changeWatchersByKey[_key3] = [...this._changeWatchersByKey[_key3], {
|
|
187
|
+
callback,
|
|
188
|
+
context
|
|
189
|
+
}];
|
|
196
190
|
}
|
|
197
191
|
} catch (err) {
|
|
198
192
|
_didIteratorError2 = true;
|
|
@@ -211,6 +205,63 @@ function () {
|
|
|
211
205
|
|
|
212
206
|
return validKeys;
|
|
213
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Unwatch keys watched with `.watch`.
|
|
210
|
+
*
|
|
211
|
+
* Should be called with the same arguments given to `.watch`.
|
|
212
|
+
*
|
|
213
|
+
* Returns the array of keys that were unwatched.
|
|
214
|
+
*
|
|
215
|
+
* @param keys the keys to unwatch
|
|
216
|
+
* @param callback the function passed to `.watch` for these keys
|
|
217
|
+
* @param context the context that was passed to `.watch` for this `callback`
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
}, {
|
|
221
|
+
key: "unwatch",
|
|
222
|
+
value: function unwatch(keys, callback, context) {
|
|
223
|
+
// We warn instead of throw here because we used to warn instead of throw and don't
|
|
224
|
+
// want to make a breaking change.
|
|
225
|
+
var validKeys = this._getWatchableValidKeysOrThrow(keys, 'unwatch', true);
|
|
226
|
+
|
|
227
|
+
var _iteratorNormalCompletion3 = true;
|
|
228
|
+
var _didIteratorError3 = false;
|
|
229
|
+
var _iteratorError3 = undefined;
|
|
230
|
+
|
|
231
|
+
try {
|
|
232
|
+
for (var _iterator3 = validKeys[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
233
|
+
var _key4 = _step3.value;
|
|
234
|
+
var watchers = this._changeWatchersByKey[_key4];
|
|
235
|
+
|
|
236
|
+
if (watchers) {
|
|
237
|
+
var filteredWatchers = watchers.filter(watcher => {
|
|
238
|
+
return watcher.callback !== callback || watcher.context !== context;
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
if (filteredWatchers.length > 0) {
|
|
242
|
+
this._changeWatchersByKey[_key4] = filteredWatchers;
|
|
243
|
+
} else {
|
|
244
|
+
delete this._changeWatchersByKey[_key4];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
} catch (err) {
|
|
249
|
+
_didIteratorError3 = true;
|
|
250
|
+
_iteratorError3 = err;
|
|
251
|
+
} finally {
|
|
252
|
+
try {
|
|
253
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
254
|
+
_iterator3.return();
|
|
255
|
+
}
|
|
256
|
+
} finally {
|
|
257
|
+
if (_didIteratorError3) {
|
|
258
|
+
throw _iteratorError3;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return validKeys;
|
|
264
|
+
}
|
|
214
265
|
/**
|
|
215
266
|
* @internal
|
|
216
267
|
*/
|
|
@@ -218,34 +269,35 @@ function () {
|
|
|
218
269
|
}, {
|
|
219
270
|
key: "_onChange",
|
|
220
271
|
value: function _onChange(key) {
|
|
221
|
-
this.
|
|
272
|
+
this.__incrementOnChangeCount();
|
|
273
|
+
|
|
222
274
|
var watchers = this._changeWatchersByKey[key];
|
|
223
275
|
|
|
224
276
|
if (watchers) {
|
|
225
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0),
|
|
226
|
-
args[
|
|
277
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key5 = 1; _key5 < _len; _key5++) {
|
|
278
|
+
args[_key5 - 1] = arguments[_key5];
|
|
227
279
|
}
|
|
228
280
|
|
|
229
|
-
var
|
|
230
|
-
var
|
|
231
|
-
var
|
|
281
|
+
var _iteratorNormalCompletion4 = true;
|
|
282
|
+
var _didIteratorError4 = false;
|
|
283
|
+
var _iteratorError4 = undefined;
|
|
232
284
|
|
|
233
285
|
try {
|
|
234
|
-
for (var
|
|
235
|
-
var watcher =
|
|
286
|
+
for (var _iterator4 = watchers[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
287
|
+
var watcher = _step4.value;
|
|
236
288
|
watcher.callback.call(watcher.context, this, key, ...args);
|
|
237
289
|
}
|
|
238
290
|
} catch (err) {
|
|
239
|
-
|
|
240
|
-
|
|
291
|
+
_didIteratorError4 = true;
|
|
292
|
+
_iteratorError4 = err;
|
|
241
293
|
} finally {
|
|
242
294
|
try {
|
|
243
|
-
if (!
|
|
244
|
-
|
|
295
|
+
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
296
|
+
_iterator4.return();
|
|
245
297
|
}
|
|
246
298
|
} finally {
|
|
247
|
-
if (
|
|
248
|
-
throw
|
|
299
|
+
if (_didIteratorError4) {
|
|
300
|
+
throw _iteratorError4;
|
|
249
301
|
}
|
|
250
302
|
}
|
|
251
303
|
}
|
|
@@ -168,8 +168,6 @@ declare class Base extends AbstractModel<BaseData, WatchableBaseKey> {
|
|
|
168
168
|
*/
|
|
169
169
|
getTable(tableIdOrName: TableId | string): Table;
|
|
170
170
|
/**
|
|
171
|
-
* _Beta feature with unstable API. May have breaking changes before release._
|
|
172
|
-
*
|
|
173
171
|
* Checks whether the current user has permission to create a table.
|
|
174
172
|
*
|
|
175
173
|
* Accepts partial input, in the same format as {@link createTableAsync}.
|
|
@@ -196,10 +194,9 @@ declare class Base extends AbstractModel<BaseData, WatchableBaseKey> {
|
|
|
196
194
|
options?: {
|
|
197
195
|
[key: string]: unknown;
|
|
198
196
|
} | null;
|
|
197
|
+
description?: string | null;
|
|
199
198
|
}>): PermissionCheckResult;
|
|
200
199
|
/**
|
|
201
|
-
* _Beta feature with unstable API. May have breaking changes before release._
|
|
202
|
-
*
|
|
203
200
|
* An alias for `checkPermissionsForCreateTable(name, fields).hasPermission`.
|
|
204
201
|
*
|
|
205
202
|
* Checks whether the current user has permission to create a table.
|
|
@@ -224,14 +221,14 @@ declare class Base extends AbstractModel<BaseData, WatchableBaseKey> {
|
|
|
224
221
|
options?: {
|
|
225
222
|
[key: string]: unknown;
|
|
226
223
|
} | null;
|
|
224
|
+
description?: string | null;
|
|
227
225
|
}>): boolean;
|
|
228
226
|
/**
|
|
229
|
-
* _Beta feature with unstable API. May have breaking changes before release._
|
|
230
|
-
*
|
|
231
227
|
* Creates a new table.
|
|
232
228
|
*
|
|
233
229
|
* Throws an error if the user does not have permission to create a table, if an invalid
|
|
234
|
-
* table name is provided, or if invalid fields are provided (invalid name, type or
|
|
230
|
+
* table name is provided, or if invalid fields are provided (invalid name, type, options or
|
|
231
|
+
* description).
|
|
235
232
|
*
|
|
236
233
|
* Refer to {@link FieldType} for supported field types, the write format for field options, and
|
|
237
234
|
* other specifics for certain field types.
|
|
@@ -248,7 +245,10 @@ declare class Base extends AbstractModel<BaseData, WatchableBaseKey> {
|
|
|
248
245
|
* table in your app.
|
|
249
246
|
*
|
|
250
247
|
* @param name name for the table. must be case-insensitive unique
|
|
251
|
-
* @param fields array of fields to create in the table: see below for
|
|
248
|
+
* @param fields array of fields to create in the table: see below for an example. `name` and
|
|
249
|
+
* `type` must be specified for all fields, while `options` is only required for fields that
|
|
250
|
+
* have field options. `description` is optional and will be `''` if not specified or if
|
|
251
|
+
* specified as `null`.
|
|
252
252
|
*
|
|
253
253
|
* @example
|
|
254
254
|
* ```js
|
|
@@ -256,7 +256,7 @@ declare class Base extends AbstractModel<BaseData, WatchableBaseKey> {
|
|
|
256
256
|
* const name = 'My new table';
|
|
257
257
|
* const fields = [
|
|
258
258
|
* // Name will be the primary field of the table.
|
|
259
|
-
* {name: 'Name', type: FieldType.SINGLE_LINE_TEXT},
|
|
259
|
+
* {name: 'Name', type: FieldType.SINGLE_LINE_TEXT, description: 'This is the primary field'},
|
|
260
260
|
* {name: 'Notes', type: FieldType.RICH_TEXT},
|
|
261
261
|
* {name: 'Attachments', type: FieldType.MULTIPLE_ATTACHMENTS},
|
|
262
262
|
* {name: 'Number', type: FieldType.NUMBER, options: {
|
|
@@ -282,6 +282,7 @@ declare class Base extends AbstractModel<BaseData, WatchableBaseKey> {
|
|
|
282
282
|
options?: {
|
|
283
283
|
[key: string]: unknown;
|
|
284
284
|
} | null;
|
|
285
|
+
description?: string | null;
|
|
285
286
|
}>): Promise<Table>;
|
|
286
287
|
/**
|
|
287
288
|
* Returns the maximum number of records allowed in each table of this base.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/models/base.ts"],"names":[],"mappings":"AAAA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CAAC,EAAE,SAAS,CAAC;QACjB,OAAO,CAAC,EAAE;YAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAC,GAAG,IAAI,CAAC;QAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC,GACH,qBAAqB;IAuBxB;;;;;;;;;;;;;;;;;;OAkBG;IACH,0BAA0B,CACtB,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,KAAK,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,OAAO,CAAC,EAAE;YAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAC,GAAG,IAAI,CAAC;QAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC,GACH,OAAO;IAIV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACG,gBAAgB,CAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,KAAK,CAAC;QACV,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,SAAS,CAAC;QAChB,OAAO,CAAC,EAAE;YAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAC,GAAG,IAAI,CAAC;QAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC,GACH,OAAO,CAAC,KAAK,CAAC;IA4BjB;;OAEG;IACH,qBAAqB,IAAI,MAAM;CAsHlC;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -47,6 +47,7 @@ interface CursorData {
|
|
|
47
47
|
* return (
|
|
48
48
|
* <div>
|
|
49
49
|
* Active table: {cursor.activeTableId}
|
|
50
|
+
* <br />
|
|
50
51
|
* Active view: {cursor.activeViewId}
|
|
51
52
|
* </div>
|
|
52
53
|
* );
|
|
@@ -67,6 +68,7 @@ interface CursorData {
|
|
|
67
68
|
* return (
|
|
68
69
|
* <div>
|
|
69
70
|
* Selected records: {cursor.selectedRecordIds.join(', ')}
|
|
71
|
+
* <br />
|
|
70
72
|
* Selected fields: {cursor.selectedFieldIds.join(', ')}
|
|
71
73
|
* </div>
|
|
72
74
|
* );
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../src/models/cursor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAuB,YAAY,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAE/E,OAAO,0BAA0B,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,QAAA,MAAM,mBAAmB;;;;;;EAMvB,CAAC;AAEH;;;;;;;GAOG;AACH,aAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEnE,cAAc;AACd,UAAU,UAAU;IAChB,mBAAmB,EAAE,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,kBAAkB,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvD,aAAa,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAGD
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../src/models/cursor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,QAAQ,EAAC,MAA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;;;;;;;OASG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IACD;;;;;;OAMG;IACH,cAAc,CAAC,cAAc,EAAE,KAAK,GAAG,OAAO,GAAG,IAAI;IAIrD;;;;;;;OAOG;IACH,aAAa,CAAC,cAAc,EAAE,KAAK,GAAG,OAAO,EAAE,YAAY,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI;CA+EpF;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/** @module @airtable/blocks/models: Field */ /** */
|
|
2
2
|
import { AggregatorKey } from '../types/aggregators';
|
|
3
|
-
import { PermissionCheckResult } from '../types/mutations';
|
|
3
|
+
import { PermissionCheckResult, UpdateFieldOptionsOpts } from '../types/mutations';
|
|
4
4
|
import { FieldData, FieldType, FieldOptions, FieldConfig } from '../types/field';
|
|
5
5
|
import { ObjectValues } from '../private_utils';
|
|
6
|
+
import { FieldTypeConfig } from '../types/airtable_interface';
|
|
6
7
|
import AbstractModel from './abstract_model';
|
|
7
8
|
import { Aggregator } from './create_aggregators';
|
|
8
9
|
declare const WatchableFieldKeys: Readonly<{
|
|
@@ -72,6 +73,8 @@ declare class Field extends AbstractModel<FieldData, WatchableFieldKey> {
|
|
|
72
73
|
* ```
|
|
73
74
|
*/
|
|
74
75
|
get options(): FieldOptions | null;
|
|
76
|
+
_getCachedConfigFromFieldTypeProvider(): FieldTypeConfig;
|
|
77
|
+
_clearCachedConfig(): void;
|
|
75
78
|
/**
|
|
76
79
|
* The type and options of the field to make type narrowing `FieldOptions` easier.
|
|
77
80
|
*
|
|
@@ -89,13 +92,11 @@ declare class Field extends AbstractModel<FieldData, WatchableFieldKey> {
|
|
|
89
92
|
*/
|
|
90
93
|
get config(): FieldConfig;
|
|
91
94
|
/**
|
|
92
|
-
* _Beta feature with unstable API. May have breaking changes before release._
|
|
93
|
-
*
|
|
94
95
|
* Checks whether the current user has permission to perform the given options update.
|
|
95
96
|
*
|
|
96
97
|
* Accepts partial input, in the same format as {@link updateOptionsAsync}.
|
|
97
98
|
*
|
|
98
|
-
* Returns `{hasPermission: true}` if the current user can update the specified
|
|
99
|
+
* Returns `{hasPermission: true}` if the current user can update the specified field,
|
|
99
100
|
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
100
101
|
* used to display an error message to the user.
|
|
101
102
|
*
|
|
@@ -112,8 +113,6 @@ declare class Field extends AbstractModel<FieldData, WatchableFieldKey> {
|
|
|
112
113
|
*/
|
|
113
114
|
checkPermissionsForUpdateOptions(options?: FieldOptions): PermissionCheckResult;
|
|
114
115
|
/**
|
|
115
|
-
* _Beta feature with unstable API. May have breaking changes before release._
|
|
116
|
-
*
|
|
117
116
|
* An alias for `checkPermissionsForUpdateOptions(options).hasPermission`.
|
|
118
117
|
*
|
|
119
118
|
* Checks whether the current user has permission to perform the options update.
|
|
@@ -133,8 +132,6 @@ declare class Field extends AbstractModel<FieldData, WatchableFieldKey> {
|
|
|
133
132
|
*/
|
|
134
133
|
hasPermissionToUpdateOptions(options?: FieldOptions): boolean;
|
|
135
134
|
/**
|
|
136
|
-
* _Beta feature with unstable API. May have breaking changes before release._
|
|
137
|
-
*
|
|
138
135
|
* Updates the options for this field.
|
|
139
136
|
*
|
|
140
137
|
* Throws an error if the user does not have permission to update the field, if invalid
|
|
@@ -148,7 +145,11 @@ declare class Field extends AbstractModel<FieldData, WatchableFieldKey> {
|
|
|
148
145
|
* **not** applied optimistically locally. You must `await` the returned promise before
|
|
149
146
|
* relying on the change in your app.
|
|
150
147
|
*
|
|
148
|
+
* Optionally, you can pass an `opts` object as the second argument. See {@link UpdateFieldOptionsOpts}
|
|
149
|
+
* for available options.
|
|
150
|
+
*
|
|
151
151
|
* @param options new options for the field
|
|
152
|
+
* @param opts optional options to affect the behavior of the update
|
|
152
153
|
*
|
|
153
154
|
* @example
|
|
154
155
|
* ```js
|
|
@@ -166,7 +167,68 @@ declare class Field extends AbstractModel<FieldData, WatchableFieldKey> {
|
|
|
166
167
|
* }
|
|
167
168
|
* ```
|
|
168
169
|
*/
|
|
169
|
-
updateOptionsAsync(options: FieldOptions): Promise<void>;
|
|
170
|
+
updateOptionsAsync(options: FieldOptions, opts?: UpdateFieldOptionsOpts): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Checks whether the current user has permission to perform the given description update.
|
|
173
|
+
*
|
|
174
|
+
* Accepts partial input, in the same format as {@link updateDescriptionAsync}.
|
|
175
|
+
*
|
|
176
|
+
* Returns `{hasPermission: true}` if the current user can update the specified field,
|
|
177
|
+
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
178
|
+
* used to display an error message to the user.
|
|
179
|
+
*
|
|
180
|
+
* @param description new description for the field
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```js
|
|
184
|
+
* const updateFieldCheckResult = field.checkPermissionsForUpdateDescription();
|
|
185
|
+
*
|
|
186
|
+
* if (!updateFieldCheckResult.hasPermission) {
|
|
187
|
+
* alert(updateFieldCheckResult.reasonDisplayString);
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
checkPermissionsForUpdateDescription(description?: string | null): PermissionCheckResult;
|
|
192
|
+
/**
|
|
193
|
+
* An alias for `checkPermissionsForUpdateDescription(options).hasPermission`.
|
|
194
|
+
*
|
|
195
|
+
* Checks whether the current user has permission to perform the description update.
|
|
196
|
+
*
|
|
197
|
+
* Accepts partial input, in the same format as {@link updateDescriptionAsync}.
|
|
198
|
+
*
|
|
199
|
+
* @param description new description for the field
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```js
|
|
203
|
+
* const canUpdateField = field.hasPermissionToUpdateDescription();
|
|
204
|
+
*
|
|
205
|
+
* if (!canUpdateField) {
|
|
206
|
+
* alert('not allowed!');
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
hasPermissionToUpdateDescription(description?: string | null): boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Updates the description for this field.
|
|
213
|
+
*
|
|
214
|
+
* To remove an existing description, pass `''` as the new description.
|
|
215
|
+
* `null` is also accepted and will be coerced to `''` for consistency with field creation.
|
|
216
|
+
*
|
|
217
|
+
* Throws an error if the user does not have permission to update the field, or if an invalid
|
|
218
|
+
* description is provided.
|
|
219
|
+
*
|
|
220
|
+
* This action is asynchronous. Unlike updates to cell values, updates to field descriptions are
|
|
221
|
+
* **not** applied optimistically locally. You must `await` the returned promise before
|
|
222
|
+
* relying on the change in your app.
|
|
223
|
+
*
|
|
224
|
+
* @param description new description for the field
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```js
|
|
228
|
+
* await myTextField.updateDescriptionAsync('This is a text field');
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
updateDescriptionAsync(description: string | null): Promise<void>;
|
|
170
232
|
/**
|
|
171
233
|
* `true` if this field is computed, `false` otherwise. A field is
|
|
172
234
|
* "computed" if it's value is not set by user input (e.g. autoNumber, formula,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/models/field.ts"],"names":[],"mappings":"AAAA,6CAA6C,CAAC,MAAM;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAgB,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/models/field.ts"],"names":[],"mappings":"AAAA,6CAA6C,CAAC,MAAM;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAgB,qBAAqB,EAAE,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAiC,YA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AO;IAItE;;;;;;;;;;;;;;;;;;;OAmBG;IACG,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IASvE;;;;;;;;;;;;OAYG;IACH,IAAI,UAAU,IAAI,OAAO,CAGxB;IACD;;;OAGG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;;;;;;;OAQG;IACH,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAE/B;IAID;;;;;;;OAOG;IACH,IAAI,oBAAoB,IAAI,KAAK,CAAC,UAAU,CAAC,CAU5C;IAID;;;;;;;;;;;;;;;;;OAiBG;IACH,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO;IAUtE;;;;;;;;;;;;OAYG;IACH,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAwDpD;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -9,7 +9,7 @@ import Field from './field';
|
|
|
9
9
|
/** @hidden */
|
|
10
10
|
interface GroupedRecordQueryResultData {
|
|
11
11
|
groupData: GroupData;
|
|
12
|
-
groupLevels:
|
|
12
|
+
groupLevels: ReadonlyArray<NormalizedGroupLevel>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Represents a group of records returned from a group query. See {@link RecordQueryResult} for main
|
|
@@ -22,7 +22,7 @@ interface GroupedRecordQueryResultData {
|
|
|
22
22
|
* @hidden
|
|
23
23
|
*/
|
|
24
24
|
declare class GroupedRecordQueryResult extends RecordQueryResult<GroupedRecordQueryResultData> {
|
|
25
|
-
_orderedRecordIds:
|
|
25
|
+
_orderedRecordIds: ReadonlyArray<RecordId> | null;
|
|
26
26
|
/**
|
|
27
27
|
* Gets children groups of this group (if any exist)
|
|
28
28
|
*/
|
|
@@ -40,7 +40,7 @@ declare class GroupedRecordQueryResult extends RecordQueryResult<GroupedRecordQu
|
|
|
40
40
|
* This returns all recordIds of all children groups (in grouped order).
|
|
41
41
|
* Watchable.
|
|
42
42
|
*/
|
|
43
|
-
get recordIds():
|
|
43
|
+
get recordIds(): ReadonlyArray<RecordId>;
|
|
44
44
|
/**
|
|
45
45
|
* The fields that were used to create the parent RecordQueryResult that created this GroupedRecordQueryResult.
|
|
46
46
|
* This is separate from the field/fieldId property - which is the field this grouping is based upon.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouped_record_query_result.d.ts","sourceRoot":"","sources":["../../../../src/models/grouped_record_query_result.ts"],"names":[],"mappings":"AAAA,yDAAyD,CAAC,MAAM;AAChE,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAE,aAAa,EAAY,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,iBAAiB,EAAE,EACtB,6BAA6B,EAEhC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,MAAM,SAAS,CAAC;AAI5B,cAAc;AAGd,UAAU,4BAA4B;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"grouped_record_query_result.d.ts","sourceRoot":"","sources":["../../../../src/models/grouped_record_query_result.ts"],"names":[],"mappings":"AAAA,yDAAyD,CAAC,MAAM;AAChE,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAE,aAAa,EAAY,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,iBAAiB,EAAE,EACtB,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":"linked_records_query_result.d.ts","sourceRoot":"","sources":["../../../../src/models/linked_records_query_result.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAY,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"linked_records_query_result.d.ts","sourceRoot":"","sources":["../../../../src/models/linked_records_query_result.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAY,MAAM,kBAAkB,CAAC;AAS3E,OAAO,iBAAiB,EAAE,EACtB,6BAA6B,EAEhC,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,eAAO,MAAM,gBAAgB,0BAM5B,CAAC;AAEF,eAAe;AACf,UAAU,4BAA4B;CAAG;AAEzC;;;;;;;;GAQG;AACH,cAAM,wBAAyB,SAAQ,iBAAiB,CAAC,4BAA4B,CAAC;IA6ElF;;;;;;;;OAQG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAYD;;OAEG;IACH,IAAI,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,CAS7B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAQ3B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAIhC;IAED,kBAAkB;IAClB,KAAK,CACD,IAAI,EAAE,6BAA6B,GAAG,aAAa,CAAC,6BAA6B,CAAC,EAClF,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,GAC/B,KAAK,CAAC,6BAA6B,CAAC;IAmBvC,kBAAkB;IAClB,OAAO,CACH,IAAI,EAAE,6BAA6B,GAAG,aAAa,CAAC,6BAA6B,CAAC,EAClF,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,GAC/B,KAAK,CAAC,6BAA6B,CAAC;IAqBvC,kBAAkB;IACZ,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAoFpC;;;;OAIG;IACH,IAAI,SAAS,WAEZ;CAqYJ;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation_constants.d.ts","sourceRoot":"","sources":["../../../../src/models/mutation_constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,wBAAwB,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"mutation_constants.d.ts","sourceRoot":"","sources":["../../../../src/models/mutation_constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,4BAA4B,QAAQ,CAAC;AAClD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,wBAAwB,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../../src/models/mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../../src/models/mutations.ts"],"names":[],"mappings":"AAilBA,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query_manager.d.ts","sourceRoot":"","sources":["../../../../src/models/query_manager.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @module @airtable/blocks/models: Record */ /** */
|
|
2
2
|
import { Color } from '../colors';
|
|
3
|
-
import { RecordData } from '../types/record';
|
|
4
3
|
import { FieldId } from '../types/field';
|
|
5
4
|
import { ViewId } from '../types/view';
|
|
6
|
-
import { ObjectValues } from '../private_utils';
|
|
5
|
+
import { ObjectValues, FlowAnyObject, FlowAnyFunction } from '../private_utils';
|
|
7
6
|
import AbstractModel from './abstract_model';
|
|
8
7
|
import Field from './field';
|
|
9
8
|
import View from './view';
|
|
@@ -23,6 +22,12 @@ declare const WatchableRecordKeys: Readonly<{
|
|
|
23
22
|
* - `'colorInView:' + someViewId`
|
|
24
23
|
*/
|
|
25
24
|
declare type WatchableRecordKey = ObjectValues<typeof WatchableRecordKeys> | string;
|
|
25
|
+
/**
|
|
26
|
+
* TODO: (#proj-blocks-sdk-record-limits) Record should probably not be an AbstractModel,
|
|
27
|
+
* in the meantime it will return true if it's loaded, throwing/returning null
|
|
28
|
+
* if it's not loaded (returning null / throwing is how AbstractModel works).
|
|
29
|
+
*/
|
|
30
|
+
declare type RecordStoreIsLoaded = true;
|
|
26
31
|
/**
|
|
27
32
|
* Model class representing a record in a table.
|
|
28
33
|
*
|
|
@@ -31,7 +36,7 @@ declare type WatchableRecordKey = ObjectValues<typeof WatchableRecordKeys> | str
|
|
|
31
36
|
*
|
|
32
37
|
* @docsPath models/Record
|
|
33
38
|
*/
|
|
34
|
-
declare class Record extends AbstractModel<
|
|
39
|
+
declare class Record extends AbstractModel<RecordStoreIsLoaded, WatchableRecordKey> {
|
|
35
40
|
/**
|
|
36
41
|
* Gets the cell value of the given field for this record.
|
|
37
42
|
*
|
|
@@ -172,6 +177,10 @@ declare class Record extends AbstractModel<RecordData, WatchableRecordKey> {
|
|
|
172
177
|
* ```
|
|
173
178
|
*/
|
|
174
179
|
get createdTime(): Date;
|
|
180
|
+
/** @inheritdoc */
|
|
181
|
+
watch(keys: WatchableRecordKey | ReadonlyArray<WatchableRecordKey>, callbackForRegistration: FlowAnyFunction, context?: FlowAnyObject | null): Array<WatchableRecordKey>;
|
|
182
|
+
/** @inheritdoc */
|
|
183
|
+
unwatch(keys: WatchableRecordKey | ReadonlyArray<WatchableRecordKey>, callbackForRegistration: FlowAnyFunction, context?: FlowAnyObject | null): Array<WatchableRecordKey>;
|
|
175
184
|
}
|
|
176
185
|
export default Record;
|
|
177
186
|
//# sourceMappingURL=record.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../../src/models/record.ts"],"names":[],"mappings":"AAAA,8CAA8C,CAAC,MAAM;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../../src/models/record.ts"],"names":[],"mappings":"AAAA,8CAA8C,CAAC,MAAM;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAGhC,OAAO,EAAY,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,EAGH,YAAY,EACZ,aAAa,EACb,eAAe,EAElB,MAAM,kBAAkB,CAAC;AAY1B,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAA0B,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAC/E,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAKrE,QAAA,MAAM,mBAAmB;;;;EAMvB,CAAC;AAOH;;;;;;;GAOG;AACH,aAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,mBAAmB,CAAC,GAAG,MAAM,CAAC;AAE5E;;;;GAIG;AACH,aAAK,mBAAmB,GAAG,IAAI,CAAC;AAiBhC;;;;;;;GAOG;AACH,cAAM,MAAO,SAAQ,aAAa,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;IA2HvE;;;;;;;;;;OAUG;IACH,YAAY,CAAC,yBAAyB,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO;IAoC1E;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,yBAAyB,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM;IAkBjF;;;;;;;;;;;;;;;;;;;;;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