@airtable/blocks 1.11.1-experimental-68738f2-20220526 → 1.13.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.
- package/README.md +2 -2
- package/dist/cjs/error_utils.js +1 -19
- package/dist/cjs/global_config.js +3 -3
- package/dist/cjs/injected/airtable_interface.js +1 -1
- package/dist/cjs/models/base.js +9 -9
- package/dist/cjs/models/cursor.js +3 -3
- package/dist/cjs/models/field.js +3 -3
- package/dist/cjs/models/grouped_record_query_result.js +14 -5
- package/dist/cjs/models/linked_records_query_result.js +27 -78
- package/dist/cjs/models/mutations.js +163 -18
- package/dist/cjs/models/record.js +55 -310
- package/dist/cjs/models/record_query_result.js +2 -5
- package/dist/cjs/models/record_store.js +829 -555
- package/dist/cjs/models/session.js +3 -3
- package/dist/cjs/models/table.js +31 -31
- package/dist/cjs/models/table_or_view_query_result.js +419 -526
- package/dist/cjs/models/view.js +23 -1
- package/dist/cjs/models/view_data_store.js +295 -255
- package/dist/cjs/private_utils.js +0 -40
- package/dist/cjs/sdk.js +9 -12
- package/dist/cjs/settings_button.js +1 -1
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +11 -57
- package/dist/cjs/types/airtable_interface.js +2 -17
- package/dist/cjs/ui/block_wrapper.js +2 -5
- package/dist/cjs/ui/expand_record_picker_async.js +1 -1
- package/dist/cjs/ui/global_config_synced_component_helpers.js +6 -0
- package/dist/cjs/ui/initialize_block.js +3 -3
- package/dist/cjs/ui/use_global_config.js +1 -1
- package/dist/cjs/ui/use_loadable.js +3 -3
- package/dist/cjs/ui/use_record_action_data.js +11 -11
- package/dist/cjs/ui/use_records.js +1 -5
- package/dist/cjs/ui/use_settings_button.js +1 -1
- package/dist/cjs/ui/viewport_constraint.js +1 -1
- package/dist/cjs/unstable_testing_utils.js +1 -61
- package/dist/cjs/viewport.js +9 -9
- package/dist/cjs/watchable.js +1 -15
- package/dist/types/src/error_utils.d.ts +1 -2
- package/dist/types/src/error_utils.d.ts.map +1 -1
- package/dist/types/src/global_config.d.ts +3 -3
- package/dist/types/src/models/base.d.ts +9 -9
- package/dist/types/src/models/cursor.d.ts +3 -3
- package/dist/types/src/models/field.d.ts +3 -3
- 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/mutations.d.ts.map +1 -1
- package/dist/types/src/models/record.d.ts +3 -12
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +4 -5
- 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/session.d.ts +3 -3
- package/dist/types/src/models/table.d.ts +25 -25
- package/dist/types/src/models/table_or_view_query_result.d.ts +5 -3
- package/dist/types/src/models/table_or_view_query_result.d.ts.map +1 -1
- package/dist/types/src/models/view.d.ts +11 -0
- package/dist/types/src/models/view.d.ts.map +1 -1
- package/dist/types/src/models/view_data_store.d.ts +1 -0
- 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 +1 -24
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +3 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/settings_button.d.ts +1 -1
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts +11 -11
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/airtable_interface.d.ts +20 -59
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/field.d.ts +10 -5
- package/dist/types/src/types/field.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +2 -0
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +9 -3
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/block_wrapper.d.ts.map +1 -1
- package/dist/types/src/ui/expand_record_picker_async.d.ts +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/initialize_block.d.ts +1 -1
- package/dist/types/src/ui/record_card.d.ts +1 -1
- package/dist/types/src/ui/use_global_config.d.ts +1 -1
- package/dist/types/src/ui/use_loadable.d.ts +2 -2
- package/dist/types/src/ui/use_record_action_data.d.ts +11 -11
- package/dist/types/src/ui/use_settings_button.d.ts +1 -1
- package/dist/types/src/ui/viewport_constraint.d.ts +3 -3
- package/dist/types/src/ui/viewport_constraint.d.ts.map +1 -1
- package/dist/types/src/unstable_testing_utils.d.ts +1 -4
- package/dist/types/src/unstable_testing_utils.d.ts.map +1 -1
- package/dist/types/src/viewport.d.ts +9 -9
- package/dist/types/src/watchable.d.ts.map +1 -1
- package/dist/types/{src/testing → test/airtable_interface_mocks}/fixture_data.d.ts +25 -44
- 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 +1 -1
- package/dist/types/test/airtable_interface_mocks/linked_records.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +12 -19
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts +1 -1
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts.map +1 -1
- package/dist/types/test/test_helpers.d.ts +0 -2
- package/dist/types/test/test_helpers.d.ts.map +1 -1
- package/package.json +2 -3
- package/dist/cjs/models/query_manager.js +0 -328
- package/dist/cjs/testing/fixture_data.js +0 -271
- package/dist/cjs/testing/mock_base_data_stores.js +0 -891
- package/dist/cjs/types/block_query_spec.js +0 -85
- package/dist/types/src/models/query_manager.d.ts +0 -2
- package/dist/types/src/models/query_manager.d.ts.map +0 -1
- package/dist/types/src/testing/fixture_data.d.ts.map +0 -1
- package/dist/types/src/testing/mock_base_data_stores.d.ts +0 -59
- package/dist/types/src/testing/mock_base_data_stores.d.ts.map +0 -1
- package/dist/types/src/types/block_query_spec.d.ts +0 -139
- package/dist/types/src/types/block_query_spec.d.ts.map +0 -1
- package/dist/types/test/testing/fixture_data.test.d.ts +0 -2
- package/dist/types/test/testing/fixture_data.test.d.ts.map +0 -1
|
@@ -72,7 +72,7 @@ var WatchableSessionKeys = Object.freeze({
|
|
|
72
72
|
* if (session.currentUser !== null) {
|
|
73
73
|
* return <span>The current user's name is {session.currentUser.name}</span>;
|
|
74
74
|
* } else {
|
|
75
|
-
* return <span>This
|
|
75
|
+
* return <span>This extension is being viewed in a public share</span>;
|
|
76
76
|
* }
|
|
77
77
|
* }
|
|
78
78
|
* ```
|
|
@@ -384,7 +384,7 @@ function (_AbstractModel) {
|
|
|
384
384
|
return this._sessionData;
|
|
385
385
|
}
|
|
386
386
|
/**
|
|
387
|
-
* The current user, or `null` if the
|
|
387
|
+
* The current user, or `null` if the extension is running in a publicly shared base.
|
|
388
388
|
*
|
|
389
389
|
* @example
|
|
390
390
|
* ```js
|
|
@@ -394,7 +394,7 @@ function (_AbstractModel) {
|
|
|
394
394
|
* const session = useSession();
|
|
395
395
|
*
|
|
396
396
|
* if (!session.currentUser) {
|
|
397
|
-
* return <div>This
|
|
397
|
+
* return <div>This extension is being used in a public share.</div>;
|
|
398
398
|
* }
|
|
399
399
|
*
|
|
400
400
|
* return <ul>
|
package/dist/cjs/models/table.js
CHANGED
|
@@ -279,8 +279,8 @@ function (_AbstractModel) {
|
|
|
279
279
|
* The field matching the given ID or name. Returns `null` if no matching field exists within
|
|
280
280
|
* this table.
|
|
281
281
|
*
|
|
282
|
-
* This method is convenient when building an
|
|
283
|
-
*
|
|
282
|
+
* This method is convenient when building an extension for a specific base, but for more generic
|
|
283
|
+
* extensions the best practice is to use the {@link getFieldByIdIfExists} or
|
|
284
284
|
* {@link getFieldByNameIfExists} methods instead.
|
|
285
285
|
*
|
|
286
286
|
* @param fieldIdOrName The ID or name of the field you're looking for.
|
|
@@ -298,8 +298,8 @@ function (_AbstractModel) {
|
|
|
298
298
|
* Use {@link getFieldIfExists} instead if you are unsure whether a field exists with the given
|
|
299
299
|
* name/ID.
|
|
300
300
|
*
|
|
301
|
-
* This method is convenient when building an
|
|
302
|
-
*
|
|
301
|
+
* This method is convenient when building an extension for a specific base, but for more generic
|
|
302
|
+
* extensions the best practice is to use the {@link getFieldById} or {@link getFieldByName} methods
|
|
303
303
|
* instead.
|
|
304
304
|
*
|
|
305
305
|
* @param fieldIdOrName The ID or name of the field you're looking for.
|
|
@@ -460,8 +460,8 @@ function (_AbstractModel) {
|
|
|
460
460
|
* The view matching the given ID or name. Returns `null` if no matching view exists within
|
|
461
461
|
* this table.
|
|
462
462
|
*
|
|
463
|
-
* This method is convenient when building an
|
|
464
|
-
*
|
|
463
|
+
* This method is convenient when building an extension for a specific base, but for more generic
|
|
464
|
+
* extensions the best practice is to use the {@link getViewByIdIfExists} or
|
|
465
465
|
* {@link getViewByNameIfExists} methods instead.
|
|
466
466
|
*
|
|
467
467
|
* @param viewIdOrName The ID or name of the view you're looking for.
|
|
@@ -479,8 +479,8 @@ function (_AbstractModel) {
|
|
|
479
479
|
* Use {@link getViewIfExists} instead if you are unsure whether a view exists with the given
|
|
480
480
|
* name/ID.
|
|
481
481
|
*
|
|
482
|
-
* This method is convenient when building an
|
|
483
|
-
*
|
|
482
|
+
* This method is convenient when building an extension for a specific base, but for more generic
|
|
483
|
+
* extensions the best practice is to use the {@link getViewById} or {@link getViewByName} methods
|
|
484
484
|
* instead.
|
|
485
485
|
*
|
|
486
486
|
* @param viewIdOrName The ID or name of the view you're looking for.
|
|
@@ -662,7 +662,7 @@ function (_AbstractModel) {
|
|
|
662
662
|
*
|
|
663
663
|
* This action is asynchronous: `await` the returned promise if you wish to wait for the updated
|
|
664
664
|
* cell values to be persisted to Airtable servers.
|
|
665
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your
|
|
665
|
+
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
666
666
|
* before the promise resolves.
|
|
667
667
|
*
|
|
668
668
|
* @param recordOrRecordId the record to update
|
|
@@ -673,7 +673,7 @@ function (_AbstractModel) {
|
|
|
673
673
|
* if (table.hasPermissionToUpdateRecord(record, recordFields)) {
|
|
674
674
|
* table.updateRecordAsync(record, recordFields);
|
|
675
675
|
* }
|
|
676
|
-
* // The updated values will now show in your
|
|
676
|
+
* // The updated values will now show in your extension (eg in
|
|
677
677
|
* // `table.selectRecords()` result) but are still being saved to Airtable
|
|
678
678
|
* // servers (e.g. other users may not be able to see them yet).
|
|
679
679
|
* }
|
|
@@ -768,7 +768,7 @@ function (_AbstractModel) {
|
|
|
768
768
|
*
|
|
769
769
|
* // Check if user could update specific fields, when you don't know the
|
|
770
770
|
* // specific record that will be updated yet. (for example, if the field is
|
|
771
|
-
* // selected by the user and you want to check if your
|
|
771
|
+
* // selected by the user and you want to check if your extension can write to it).
|
|
772
772
|
* const updateUnknownRecordCheckResult =
|
|
773
773
|
* table.checkPermissionsForUpdateRecord(undefined, {
|
|
774
774
|
* 'My field name': 'updated value',
|
|
@@ -779,7 +779,7 @@ function (_AbstractModel) {
|
|
|
779
779
|
*
|
|
780
780
|
* // Check if user could perform updates within the table, without knowing the
|
|
781
781
|
* // specific record or fields that will be updated yet (e.g., to render your
|
|
782
|
-
* //
|
|
782
|
+
* // extension in "read only" mode).
|
|
783
783
|
* const updateUnknownRecordAndFieldsCheckResult =
|
|
784
784
|
* table.checkPermissionsForUpdateRecord();
|
|
785
785
|
* ```
|
|
@@ -829,7 +829,7 @@ function (_AbstractModel) {
|
|
|
829
829
|
*
|
|
830
830
|
* // Check if user could update specific fields, when you don't know the
|
|
831
831
|
* // specific record that will be updated yet (e.g. if the field is selected
|
|
832
|
-
* // by the user and you want to check if your
|
|
832
|
+
* // by the user and you want to check if your extension can write to it).
|
|
833
833
|
* const canUpdateUnknownRecord =
|
|
834
834
|
* table.hasPermissionToUpdateRecord(undefined, {
|
|
835
835
|
* 'My field name': 'updated value',
|
|
@@ -840,7 +840,7 @@ function (_AbstractModel) {
|
|
|
840
840
|
*
|
|
841
841
|
* // Check if user could perform updates within the table, without knowing the
|
|
842
842
|
* // specific record or fields that will be updated yet. (for example, to
|
|
843
|
-
* // render your
|
|
843
|
+
* // render your extension in "read only" mode)
|
|
844
844
|
* const canUpdateUnknownRecordAndFields = table.hasPermissionToUpdateRecord();
|
|
845
845
|
* ```
|
|
846
846
|
*/
|
|
@@ -864,7 +864,7 @@ function (_AbstractModel) {
|
|
|
864
864
|
*
|
|
865
865
|
* This action is asynchronous: `await` the returned promise if you wish to wait for the
|
|
866
866
|
* updates to be persisted to Airtable servers.
|
|
867
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your
|
|
867
|
+
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
868
868
|
* before the promise resolves.
|
|
869
869
|
*
|
|
870
870
|
* @param records Array of objects containing recordId and fields/cellValues to update for that record (specified as an object mapping `FieldId` or field name to cell value)
|
|
@@ -911,7 +911,7 @@ function (_AbstractModel) {
|
|
|
911
911
|
* if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
|
|
912
912
|
* table.updateRecordsAsync(recordsToUpdate);
|
|
913
913
|
* }
|
|
914
|
-
* // The records are now updated within your
|
|
914
|
+
* // The records are now updated within your extension (eg will be reflected in
|
|
915
915
|
* // `table.selectRecords()`) but are still being saved to Airtable servers
|
|
916
916
|
* // (e.g. they may not be updated for other users yet).
|
|
917
917
|
* }
|
|
@@ -1093,7 +1093,7 @@ function (_AbstractModel) {
|
|
|
1093
1093
|
*
|
|
1094
1094
|
* This action is asynchronous: `await` the returned promise if you wish to wait for the
|
|
1095
1095
|
* delete to be persisted to Airtable servers.
|
|
1096
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your
|
|
1096
|
+
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
1097
1097
|
* before the promise resolves.
|
|
1098
1098
|
*
|
|
1099
1099
|
* @param recordOrRecordId the record to be deleted
|
|
@@ -1103,7 +1103,7 @@ function (_AbstractModel) {
|
|
|
1103
1103
|
* if (table.hasPermissionToDeleteRecord(record)) {
|
|
1104
1104
|
* table.deleteRecordAsync(record);
|
|
1105
1105
|
* }
|
|
1106
|
-
* // The record is now deleted within your
|
|
1106
|
+
* // The record is now deleted within your extension (eg will not be returned
|
|
1107
1107
|
* // in `table.selectRecords`) but it is still being saved to Airtable
|
|
1108
1108
|
* // servers (e.g. it may not look deleted to other users yet).
|
|
1109
1109
|
* }
|
|
@@ -1208,7 +1208,7 @@ function (_AbstractModel) {
|
|
|
1208
1208
|
*
|
|
1209
1209
|
* This action is asynchronous: `await` the returned promise if you wish to wait for the
|
|
1210
1210
|
* delete to be persisted to Airtable servers.
|
|
1211
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your
|
|
1211
|
+
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
1212
1212
|
* before the promise resolves.
|
|
1213
1213
|
*
|
|
1214
1214
|
* @param recordsOrRecordIds Array of Records and RecordIds
|
|
@@ -1219,7 +1219,7 @@ function (_AbstractModel) {
|
|
|
1219
1219
|
* if (table.hasPermissionToDeleteRecords(records)) {
|
|
1220
1220
|
* table.deleteRecordsAsync(records);
|
|
1221
1221
|
* }
|
|
1222
|
-
* // The records are now deleted within your
|
|
1222
|
+
* // The records are now deleted within your extension (eg will not be
|
|
1223
1223
|
* // returned in `table.selectRecords()`) but are still being saved to
|
|
1224
1224
|
* // Airtable servers (e.g. they may not look deleted to other users yet).
|
|
1225
1225
|
* }
|
|
@@ -1336,7 +1336,7 @@ function (_AbstractModel) {
|
|
|
1336
1336
|
*
|
|
1337
1337
|
* This action is asynchronous: `await` the returned promise if you wish to wait for the new
|
|
1338
1338
|
* record to be persisted to Airtable servers.
|
|
1339
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your
|
|
1339
|
+
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
1340
1340
|
* before the promise resolves.
|
|
1341
1341
|
*
|
|
1342
1342
|
* The returned promise will resolve to the RecordId of the new record once it is persisted.
|
|
@@ -1348,7 +1348,7 @@ function (_AbstractModel) {
|
|
|
1348
1348
|
* if (table.hasPermissionToCreateRecord(recordFields)) {
|
|
1349
1349
|
* table.createRecordAsync(recordFields);
|
|
1350
1350
|
* }
|
|
1351
|
-
* // You can now access the new record in your
|
|
1351
|
+
* // You can now access the new record in your extension (eg
|
|
1352
1352
|
* // `table.selectRecords()`) but it is still being saved to Airtable
|
|
1353
1353
|
* // servers (e.g. other users may not be able to see it yet).
|
|
1354
1354
|
* }
|
|
@@ -1507,7 +1507,7 @@ function (_AbstractModel) {
|
|
|
1507
1507
|
*
|
|
1508
1508
|
* This action is asynchronous: `await` the returned promise if you wish to wait for the new
|
|
1509
1509
|
* record to be persisted to Airtable servers.
|
|
1510
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your
|
|
1510
|
+
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
1511
1511
|
* before the promise resolves.
|
|
1512
1512
|
*
|
|
1513
1513
|
* The returned promise will resolve to an array of RecordIds of the new records once the new
|
|
@@ -1551,7 +1551,7 @@ function (_AbstractModel) {
|
|
|
1551
1551
|
* if (table.hasPermissionToCreateRecords(recordDefs)) {
|
|
1552
1552
|
* table.createRecordsAsync(recordDefs);
|
|
1553
1553
|
* }
|
|
1554
|
-
* // You can now access the new records in your
|
|
1554
|
+
* // You can now access the new records in your extension (e.g.
|
|
1555
1555
|
* // `table.selectRecords()`) but they are still being saved to Airtable
|
|
1556
1556
|
* // servers (e.g. other users may not be able to see them yet.)
|
|
1557
1557
|
* }
|
|
@@ -1805,7 +1805,7 @@ function (_AbstractModel) {
|
|
|
1805
1805
|
*
|
|
1806
1806
|
* This action is asynchronous. Unlike new records, new fields are **not** created
|
|
1807
1807
|
* optimistically locally. You must `await` the returned promise before using the new
|
|
1808
|
-
* field in your
|
|
1808
|
+
* field in your extension.
|
|
1809
1809
|
*
|
|
1810
1810
|
* @param name name for the field. must be case-insensitive unique
|
|
1811
1811
|
* @param type type for the field
|
|
@@ -2024,11 +2024,7 @@ function (_AbstractModel) {
|
|
|
2024
2024
|
if (didViewSchemaChange) {
|
|
2025
2025
|
didTableSchemaChange = true;
|
|
2026
2026
|
}
|
|
2027
|
-
}
|
|
2028
|
-
// because the viewModel might not have been created. (See above comment)
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
this._recordStore.sendViewDataDeletionIfViewIsDeleted(_viewId);
|
|
2027
|
+
}
|
|
2032
2028
|
}
|
|
2033
2029
|
} catch (err) {
|
|
2034
2030
|
_didIteratorError4 = true;
|
|
@@ -2113,7 +2109,11 @@ function (_AbstractModel) {
|
|
|
2113
2109
|
|
|
2114
2110
|
|
|
2115
2111
|
this._cachedFieldNamesById = null;
|
|
2116
|
-
}
|
|
2112
|
+
} // NOTE: Record store onChange triggers must be performed AFTER field onChange triggers to
|
|
2113
|
+
// ensure the column type providers are not stale.
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
this._recordStore.triggerOnChangeForDirtyPaths(dirtyPaths);
|
|
2117
2117
|
|
|
2118
2118
|
return didTableSchemaChange;
|
|
2119
2119
|
}
|