@airtable/blocks 0.0.0-experimental-d5ee5e823-20250501 → 0.0.0-experimental-15dc8a3ea-20250616
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/dist/cjs/base/models/linked_records_query_result.js +2 -2
- package/dist/cjs/base/models/models.js +5 -5
- package/dist/cjs/base/models/mutations.js +86 -264
- package/dist/cjs/base/models/record_query_result.js +5 -5
- package/dist/cjs/base/models/table.js +1 -1070
- package/dist/cjs/base/types/field.js +1 -0
- package/dist/cjs/base/types/mutations.js +0 -27
- package/dist/cjs/base/ui/cell_renderer.js +2 -2
- package/dist/cjs/base/ui/field_picker.js +2 -2
- package/dist/cjs/base/ui/initialize_block.js +2 -0
- package/dist/cjs/base/ui/record_card.js +13 -13
- package/dist/cjs/base/ui/select_and_select_buttons_helpers.js +2 -0
- package/dist/cjs/base/ui/system/utils/ensure_numbers_are_within_scale.js +2 -0
- package/dist/cjs/base/ui/ui.js +8 -0
- package/dist/cjs/base/unstable_testing_utils.js +3 -2
- package/dist/cjs/interface/models/models.js +5 -5
- package/dist/cjs/interface/models/mutations.js +40 -26
- package/dist/cjs/interface/models/record.js +27 -2
- package/dist/cjs/interface/models/table.js +45 -0
- package/dist/cjs/interface/types/airtable_interface.js +1 -0
- package/dist/cjs/interface/types/field.js +1 -0
- package/dist/cjs/interface/ui/initialize_block.js +2 -0
- package/dist/cjs/interface/ui/ui.js +7 -0
- package/dist/cjs/shared/models/field_core.js +3 -3
- package/dist/cjs/shared/models/mutations_core.js +268 -0
- package/dist/cjs/shared/models/record_core.js +4 -4
- package/dist/cjs/shared/models/table_core.js +1070 -0
- package/dist/cjs/shared/sdk_core.js +1 -1
- package/dist/cjs/shared/types/mutations_core.js +28 -1
- package/dist/cjs/shared/ui/use_color_scheme.js +60 -0
- package/dist/types/src/base/models/base.d.ts +1 -1
- package/dist/types/src/base/models/base.d.ts.map +1 -1
- package/dist/types/src/base/models/field.d.ts +1 -1
- package/dist/types/src/base/models/field.d.ts.map +1 -1
- package/dist/types/src/base/models/models.d.ts +1 -1
- package/dist/types/src/base/models/models.d.ts.map +1 -1
- package/dist/types/src/base/models/mutations.d.ts.map +1 -1
- package/dist/types/src/base/models/record.d.ts +5 -1
- package/dist/types/src/base/models/record.d.ts.map +1 -1
- package/dist/types/src/base/models/table.d.ts +3 -836
- package/dist/types/src/base/models/table.d.ts.map +1 -1
- package/dist/types/src/base/types/airtable_interface.d.ts +1 -1
- package/dist/types/src/base/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/base/types/base.d.ts +5 -2
- package/dist/types/src/base/types/base.d.ts.map +1 -1
- package/dist/types/src/base/types/field.d.ts +8 -0
- package/dist/types/src/base/types/field.d.ts.map +1 -0
- package/dist/types/src/base/types/mutations.d.ts +7 -90
- package/dist/types/src/base/types/mutations.d.ts.map +1 -1
- package/dist/types/src/base/types/table.d.ts +8 -2
- package/dist/types/src/base/types/table.d.ts.map +1 -1
- package/dist/types/src/base/ui/field_picker.d.ts +1 -1
- package/dist/types/src/base/ui/field_picker.d.ts.map +1 -1
- package/dist/types/src/base/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/base/ui/ui.d.ts +1 -0
- package/dist/types/src/base/ui/ui.d.ts.map +1 -1
- package/dist/types/src/base/unstable_testing_utils.d.ts +2 -1
- package/dist/types/src/base/unstable_testing_utils.d.ts.map +1 -1
- package/dist/types/src/interface/models/models.d.ts +1 -1
- package/dist/types/src/interface/models/models.d.ts.map +1 -1
- package/dist/types/src/interface/models/mutations.d.ts.map +1 -1
- package/dist/types/src/interface/models/record.d.ts +17 -0
- package/dist/types/src/interface/models/record.d.ts.map +1 -1
- package/dist/types/src/interface/models/table.d.ts +30 -0
- package/dist/types/src/interface/models/table.d.ts.map +1 -1
- package/dist/types/src/interface/types/airtable_interface.d.ts +12 -2
- package/dist/types/src/interface/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/interface/types/base.d.ts +5 -2
- package/dist/types/src/interface/types/base.d.ts.map +1 -1
- package/dist/types/src/interface/types/field.d.ts +10 -0
- package/dist/types/src/interface/types/field.d.ts.map +1 -0
- package/dist/types/src/interface/types/mutations.d.ts +3 -0
- package/dist/types/src/interface/types/mutations.d.ts.map +1 -1
- package/dist/types/src/interface/types/table.d.ts +15 -2
- package/dist/types/src/interface/types/table.d.ts.map +1 -1
- package/dist/types/src/interface/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/interface/ui/ui.d.ts +1 -0
- package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
- package/dist/types/src/sdk_mode.d.ts +8 -2
- package/dist/types/src/sdk_mode.d.ts.map +1 -1
- package/dist/types/src/shared/models/field_core.d.ts +2 -2
- package/dist/types/src/shared/models/field_core.d.ts.map +1 -1
- package/dist/types/src/shared/models/mutations_core.d.ts.map +1 -1
- package/dist/types/src/shared/models/table_core.d.ts +835 -2
- package/dist/types/src/shared/models/table_core.d.ts.map +1 -1
- package/dist/types/src/shared/types/airtable_interface_core.d.ts +9 -9
- package/dist/types/src/shared/types/airtable_interface_core.d.ts.map +1 -1
- package/dist/types/src/shared/types/base_core.d.ts +3 -3
- package/dist/types/src/shared/types/base_core.d.ts.map +1 -1
- package/dist/types/src/shared/types/{field.d.ts → field_core.d.ts} +3 -3
- package/dist/types/src/shared/types/field_core.d.ts.map +1 -0
- package/dist/types/src/shared/types/mutations_core.d.ts +90 -2
- package/dist/types/src/shared/types/mutations_core.d.ts.map +1 -1
- package/dist/types/src/shared/types/table_core.d.ts +3 -8
- package/dist/types/src/shared/types/table_core.d.ts.map +1 -1
- package/dist/types/src/shared/ui/use_color_scheme.d.ts +28 -0
- package/dist/types/src/shared/ui/use_color_scheme.d.ts.map +1 -0
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts +1 -1
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +1 -1
- package/package.json +2 -16
- package/dist/types/src/shared/types/field.d.ts.map +0 -1
- package/dist/types/stories/all_controls.stories.d.ts +0 -10
- package/dist/types/stories/all_controls.stories.d.ts.map +0 -1
- package/dist/types/stories/box/appearance.stories.d.ts +0 -21
- package/dist/types/stories/box/appearance.stories.d.ts.map +0 -1
- package/dist/types/stories/box/box.stories.d.ts +0 -45
- package/dist/types/stories/box/box.stories.d.ts.map +0 -1
- package/dist/types/stories/box/dimensions.stories.d.ts +0 -24
- package/dist/types/stories/box/dimensions.stories.d.ts.map +0 -1
- package/dist/types/stories/box/flex_container.stories.d.ts +0 -24
- package/dist/types/stories/box/flex_container.stories.d.ts.map +0 -1
- package/dist/types/stories/box/flex_item.stories.d.ts +0 -25
- package/dist/types/stories/box/flex_item.stories.d.ts.map +0 -1
- package/dist/types/stories/box/position.stories.d.ts +0 -25
- package/dist/types/stories/box/position.stories.d.ts.map +0 -1
- package/dist/types/stories/box/spacing.stories.d.ts +0 -39
- package/dist/types/stories/box/spacing.stories.d.ts.map +0 -1
- package/dist/types/stories/box/typography.stories.d.ts +0 -33
- package/dist/types/stories/box/typography.stories.d.ts.map +0 -1
- package/dist/types/stories/button.stories.d.ts +0 -48
- package/dist/types/stories/button.stories.d.ts.map +0 -1
- package/dist/types/stories/cell_renderer.stories.d.ts +0 -11
- package/dist/types/stories/cell_renderer.stories.d.ts.map +0 -1
- package/dist/types/stories/choice_token.stories.d.ts +0 -24
- package/dist/types/stories/choice_token.stories.d.ts.map +0 -1
- package/dist/types/stories/collaborator_token.stories.d.ts +0 -29
- package/dist/types/stories/collaborator_token.stories.d.ts.map +0 -1
- package/dist/types/stories/color_palette.stories.d.ts +0 -12
- package/dist/types/stories/color_palette.stories.d.ts.map +0 -1
- package/dist/types/stories/confirmation_dialog.stories.d.ts +0 -10
- package/dist/types/stories/confirmation_dialog.stories.d.ts.map +0 -1
- package/dist/types/stories/dialog.stories.d.ts +0 -10
- package/dist/types/stories/dialog.stories.d.ts.map +0 -1
- package/dist/types/stories/field_icon.stories.d.ts +0 -10
- package/dist/types/stories/field_icon.stories.d.ts.map +0 -1
- package/dist/types/stories/field_picker.stories.d.ts +0 -12
- package/dist/types/stories/field_picker.stories.d.ts.map +0 -1
- package/dist/types/stories/form_field.stories.d.ts +0 -33
- package/dist/types/stories/form_field.stories.d.ts.map +0 -1
- package/dist/types/stories/heading.size.stories.d.ts +0 -19
- package/dist/types/stories/heading.size.stories.d.ts.map +0 -1
- package/dist/types/stories/heading.stories.d.ts +0 -33
- package/dist/types/stories/heading.stories.d.ts.map +0 -1
- package/dist/types/stories/helpers/attachments.d.ts +0 -4
- package/dist/types/stories/helpers/attachments.d.ts.map +0 -1
- package/dist/types/stories/helpers/categorize_style_props.d.ts +0 -14
- package/dist/types/stories/helpers/categorize_style_props.d.ts.map +0 -1
- package/dist/types/stories/helpers/choice_options.d.ts +0 -7
- package/dist/types/stories/helpers/choice_options.d.ts.map +0 -1
- package/dist/types/stories/helpers/code_block.d.ts +0 -5
- package/dist/types/stories/helpers/code_block.d.ts.map +0 -1
- package/dist/types/stories/helpers/code_utils.d.ts +0 -32
- package/dist/types/stories/helpers/code_utils.d.ts.map +0 -1
- package/dist/types/stories/helpers/collaborator_options.d.ts +0 -7
- package/dist/types/stories/helpers/collaborator_options.d.ts.map +0 -1
- package/dist/types/stories/helpers/example.d.ts +0 -39
- package/dist/types/stories/helpers/example.d.ts.map +0 -1
- package/dist/types/stories/helpers/example_code_panel.d.ts +0 -10
- package/dist/types/stories/helpers/example_code_panel.d.ts.map +0 -1
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts +0 -7
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +0 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts +0 -5
- package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +0 -1
- package/dist/types/stories/helpers/fake_record_card.d.ts +0 -13
- package/dist/types/stories/helpers/fake_record_card.d.ts.map +0 -1
- package/dist/types/stories/helpers/field_type.d.ts +0 -6
- package/dist/types/stories/helpers/field_type.d.ts.map +0 -1
- package/dist/types/stories/helpers/raf_throttle.d.ts +0 -5
- package/dist/types/stories/helpers/raf_throttle.d.ts.map +0 -1
- package/dist/types/stories/helpers/style_prop_list.d.ts +0 -9
- package/dist/types/stories/helpers/style_prop_list.d.ts.map +0 -1
- package/dist/types/stories/helpers/sync_source_options.d.ts +0 -7
- package/dist/types/stories/helpers/sync_source_options.d.ts.map +0 -1
- package/dist/types/stories/helpers/use_resizable_panel.d.ts +0 -27
- package/dist/types/stories/helpers/use_resizable_panel.d.ts.map +0 -1
- package/dist/types/stories/icon.stories.d.ts +0 -18
- package/dist/types/stories/icon.stories.d.ts.map +0 -1
- package/dist/types/stories/icon_example.d.ts +0 -3
- package/dist/types/stories/icon_example.d.ts.map +0 -1
- package/dist/types/stories/input.stories.d.ts +0 -27
- package/dist/types/stories/input.stories.d.ts.map +0 -1
- package/dist/types/stories/label.stories.d.ts +0 -36
- package/dist/types/stories/label.stories.d.ts.map +0 -1
- package/dist/types/stories/link.stories.d.ts +0 -45
- package/dist/types/stories/link.stories.d.ts.map +0 -1
- package/dist/types/stories/loader.stories.d.ts +0 -21
- package/dist/types/stories/loader.stories.d.ts.map +0 -1
- package/dist/types/stories/progress_bar.stories.d.ts +0 -27
- package/dist/types/stories/progress_bar.stories.d.ts.map +0 -1
- package/dist/types/stories/record_card.stories.d.ts +0 -9
- package/dist/types/stories/record_card.stories.d.ts.map +0 -1
- package/dist/types/stories/record_card_list.stories.d.ts +0 -9
- package/dist/types/stories/record_card_list.stories.d.ts.map +0 -1
- package/dist/types/stories/select.stories.d.ts +0 -30
- package/dist/types/stories/select.stories.d.ts.map +0 -1
- package/dist/types/stories/select_buttons.stories.d.ts +0 -30
- package/dist/types/stories/select_buttons.stories.d.ts.map +0 -1
- package/dist/types/stories/switch.stories.d.ts +0 -48
- package/dist/types/stories/switch.stories.d.ts.map +0 -1
- package/dist/types/stories/table_picker.stories.d.ts +0 -12
- package/dist/types/stories/table_picker.stories.d.ts.map +0 -1
- package/dist/types/stories/text.size.stories.d.ts +0 -16
- package/dist/types/stories/text.size.stories.d.ts.map +0 -1
- package/dist/types/stories/text.stories.d.ts +0 -36
- package/dist/types/stories/text.stories.d.ts.map +0 -1
- package/dist/types/stories/text_button.stories.d.ts +0 -45
- package/dist/types/stories/text_button.stories.d.ts.map +0 -1
- package/dist/types/stories/tooltip.stories.d.ts +0 -10
- package/dist/types/stories/tooltip.stories.d.ts.map +0 -1
- package/dist/types/stories/view_picker.stories.d.ts +0 -12
- package/dist/types/stories/view_picker.stories.d.ts.map +0 -1
- package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts +0 -122
- package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts.map +0 -1
- package/dist/types/test/airtable_interface_mocks/linked_records.d.ts +0 -4
- package/dist/types/test/airtable_interface_mocks/linked_records.d.ts.map +0 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -60
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +0 -1
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts +0 -4
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts.map +0 -1
- package/dist/types/test/error_utils.test.d.ts +0 -2
- package/dist/types/test/error_utils.test.d.ts.map +0 -1
- package/dist/types/test/get_style_props_for_responsive_prop.test.d.ts +0 -2
- package/dist/types/test/get_style_props_for_responsive_prop.test.d.ts.map +0 -1
- package/dist/types/test/index.test.d.ts +0 -2
- package/dist/types/test/index.test.d.ts.map +0 -1
- package/dist/types/test/models/base.test.d.ts +0 -2
- package/dist/types/test/models/base.test.d.ts.map +0 -1
- package/dist/types/test/models/cursor.test.d.ts +0 -2
- package/dist/types/test/models/cursor.test.d.ts.map +0 -1
- package/dist/types/test/models/field.test.d.ts +0 -2
- package/dist/types/test/models/field.test.d.ts.map +0 -1
- package/dist/types/test/models/linked_records_query_result.test.d.ts +0 -2
- package/dist/types/test/models/linked_records_query_result.test.d.ts.map +0 -1
- package/dist/types/test/models/mutations.test.d.ts +0 -2
- package/dist/types/test/models/mutations.test.d.ts.map +0 -1
- package/dist/types/test/models/object_pool.test.d.ts +0 -2
- package/dist/types/test/models/object_pool.test.d.ts.map +0 -1
- package/dist/types/test/models/record.test.d.ts +0 -2
- package/dist/types/test/models/record.test.d.ts.map +0 -1
- package/dist/types/test/models/session.test.d.ts +0 -2
- package/dist/types/test/models/session.test.d.ts.map +0 -1
- package/dist/types/test/models/table.test.d.ts +0 -2
- package/dist/types/test/models/table.test.d.ts.map +0 -1
- package/dist/types/test/models/table_mutations.test.d.ts +0 -2
- package/dist/types/test/models/table_mutations.test.d.ts.map +0 -1
- package/dist/types/test/models/table_or_view_query_result.test.d.ts +0 -2
- package/dist/types/test/models/table_or_view_query_result.test.d.ts.map +0 -1
- package/dist/types/test/models/view.test.d.ts +0 -2
- package/dist/types/test/models/view.test.d.ts.map +0 -1
- package/dist/types/test/models/view_metadata_query_result.test.d.ts +0 -2
- package/dist/types/test/models/view_metadata_query_result.test.d.ts.map +0 -1
- package/dist/types/test/private_utils.test.d.ts +0 -2
- package/dist/types/test/private_utils.test.d.ts.map +0 -1
- package/dist/types/test/sdk.test.d.ts +0 -2
- package/dist/types/test/sdk.test.d.ts.map +0 -1
- package/dist/types/test/setup_enzyme.d.ts +0 -2
- package/dist/types/test/setup_enzyme.d.ts.map +0 -1
- package/dist/types/test/test_helpers.d.ts +0 -11
- package/dist/types/test/test_helpers.d.ts.map +0 -1
- package/dist/types/test/ui/base_provider.test.d.ts +0 -2
- package/dist/types/test/ui/base_provider.test.d.ts.map +0 -1
- package/dist/types/test/ui/block_wrapper.test.d.ts +0 -2
- package/dist/types/test/ui/block_wrapper.test.d.ts.map +0 -1
- package/dist/types/test/ui/box.test.d.ts +0 -2
- package/dist/types/test/ui/box.test.d.ts.map +0 -1
- package/dist/types/test/ui/button.test.d.ts +0 -2
- package/dist/types/test/ui/button.test.d.ts.map +0 -1
- package/dist/types/test/ui/cell_renderer.test.d.ts +0 -2
- package/dist/types/test/ui/cell_renderer.test.d.ts.map +0 -1
- package/dist/types/test/ui/choice_token.test.d.ts +0 -2
- package/dist/types/test/ui/choice_token.test.d.ts.map +0 -1
- package/dist/types/test/ui/collaborator_token.test.d.ts +0 -2
- package/dist/types/test/ui/collaborator_token.test.d.ts.map +0 -1
- package/dist/types/test/ui/color_palette.test.d.ts +0 -2
- package/dist/types/test/ui/color_palette.test.d.ts.map +0 -1
- package/dist/types/test/ui/color_palette_synced.test.d.ts +0 -2
- package/dist/types/test/ui/color_palette_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/confirmation_dialog.test.d.ts +0 -2
- package/dist/types/test/ui/confirmation_dialog.test.d.ts.map +0 -1
- package/dist/types/test/ui/dialog.test.d.ts +0 -2
- package/dist/types/test/ui/dialog.test.d.ts.map +0 -1
- package/dist/types/test/ui/expand_record.test.d.ts +0 -2
- package/dist/types/test/ui/expand_record.test.d.ts.map +0 -1
- package/dist/types/test/ui/expand_record_list.test.d.ts +0 -2
- package/dist/types/test/ui/expand_record_list.test.d.ts.map +0 -1
- package/dist/types/test/ui/expand_record_picker_async.test.d.ts +0 -2
- package/dist/types/test/ui/expand_record_picker_async.test.d.ts.map +0 -1
- package/dist/types/test/ui/field_icon.test.d.ts +0 -2
- package/dist/types/test/ui/field_icon.test.d.ts.map +0 -1
- package/dist/types/test/ui/field_picker.test.d.ts +0 -2
- package/dist/types/test/ui/field_picker.test.d.ts.map +0 -1
- package/dist/types/test/ui/field_picker_synced.test.d.ts +0 -2
- package/dist/types/test/ui/field_picker_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/form_field.test.d.ts +0 -2
- package/dist/types/test/ui/form_field.test.d.ts.map +0 -1
- package/dist/types/test/ui/global_alert.test.d.ts +0 -2
- package/dist/types/test/ui/global_alert.test.d.ts.map +0 -1
- package/dist/types/test/ui/heading.test.d.ts +0 -2
- package/dist/types/test/ui/heading.test.d.ts.map +0 -1
- package/dist/types/test/ui/icon.test.d.ts +0 -2
- package/dist/types/test/ui/icon.test.d.ts.map +0 -1
- package/dist/types/test/ui/initialize_block.test.d.ts +0 -2
- package/dist/types/test/ui/initialize_block.test.d.ts.map +0 -1
- package/dist/types/test/ui/input.test.d.ts +0 -2
- package/dist/types/test/ui/input.test.d.ts.map +0 -1
- package/dist/types/test/ui/input_synced.test.d.ts +0 -2
- package/dist/types/test/ui/input_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/label.test.d.ts +0 -2
- package/dist/types/test/ui/label.test.d.ts.map +0 -1
- package/dist/types/test/ui/link.test.d.ts +0 -2
- package/dist/types/test/ui/link.test.d.ts.map +0 -1
- package/dist/types/test/ui/loader.test.d.ts +0 -2
- package/dist/types/test/ui/loader.test.d.ts.map +0 -1
- package/dist/types/test/ui/modal.test.d.ts +0 -2
- package/dist/types/test/ui/modal.test.d.ts.map +0 -1
- package/dist/types/test/ui/popover.test.d.ts +0 -2
- package/dist/types/test/ui/popover.test.d.ts.map +0 -1
- package/dist/types/test/ui/progress_bar.test.d.ts +0 -2
- package/dist/types/test/ui/progress_bar.test.d.ts.map +0 -1
- package/dist/types/test/ui/record_card.test.d.ts +0 -2
- package/dist/types/test/ui/record_card.test.d.ts.map +0 -1
- package/dist/types/test/ui/record_card_list.test.d.ts +0 -2
- package/dist/types/test/ui/record_card_list.test.d.ts.map +0 -1
- package/dist/types/test/ui/remote_utils.test.d.ts +0 -2
- package/dist/types/test/ui/remote_utils.test.d.ts.map +0 -1
- package/dist/types/test/ui/select.test.d.ts +0 -2
- package/dist/types/test/ui/select.test.d.ts.map +0 -1
- package/dist/types/test/ui/select_buttons.test.d.ts +0 -2
- package/dist/types/test/ui/select_buttons.test.d.ts.map +0 -1
- package/dist/types/test/ui/select_buttons_synced.test.d.ts +0 -2
- package/dist/types/test/ui/select_buttons_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/select_synced.test.d.ts +0 -2
- package/dist/types/test/ui/select_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/switch.test.d.ts +0 -2
- package/dist/types/test/ui/switch.test.d.ts.map +0 -1
- package/dist/types/test/ui/switch_synced.test.d.ts +0 -2
- package/dist/types/test/ui/switch_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/synced.test.d.ts +0 -2
- package/dist/types/test/ui/synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/table_picker.test.d.ts +0 -2
- package/dist/types/test/ui/table_picker.test.d.ts.map +0 -1
- package/dist/types/test/ui/table_picker_synced.test.d.ts +0 -2
- package/dist/types/test/ui/table_picker_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/text.test.d.ts +0 -2
- package/dist/types/test/ui/text.test.d.ts.map +0 -1
- package/dist/types/test/ui/text_button.test.d.ts +0 -2
- package/dist/types/test/ui/text_button.test.d.ts.map +0 -1
- package/dist/types/test/ui/tooltip.test.d.ts +0 -2
- package/dist/types/test/ui/tooltip.test.d.ts.map +0 -1
- package/dist/types/test/ui/ui.test.d.ts +0 -2
- package/dist/types/test/ui/ui.test.d.ts.map +0 -1
- package/dist/types/test/ui/unstable_standalone_ui.test.d.ts +0 -1
- package/dist/types/test/ui/unstable_standalone_ui.test.d.ts.map +0 -1
- package/dist/types/test/ui/use_array_identity.test.d.ts +0 -2
- package/dist/types/test/ui/use_array_identity.test.d.ts.map +0 -1
- package/dist/types/test/ui/use_loadable.test.d.ts +0 -2
- package/dist/types/test/ui/use_loadable.test.d.ts.map +0 -1
- package/dist/types/test/ui/use_record_action_data.test.d.ts +0 -2
- package/dist/types/test/ui/use_record_action_data.test.d.ts.map +0 -1
- package/dist/types/test/ui/use_records.test.d.ts +0 -2
- package/dist/types/test/ui/use_records.test.d.ts.map +0 -1
- package/dist/types/test/ui/use_view_metadata.test.d.ts +0 -2
- package/dist/types/test/ui/use_view_metadata.test.d.ts.map +0 -1
- package/dist/types/test/ui/use_watchable.test.d.ts +0 -2
- package/dist/types/test/ui/use_watchable.test.d.ts.map +0 -1
- package/dist/types/test/ui/view_picker.test.d.ts +0 -2
- package/dist/types/test/ui/view_picker.test.d.ts.map +0 -1
- package/dist/types/test/ui/view_picker_synced.test.d.ts +0 -2
- package/dist/types/test/ui/view_picker_synced.test.d.ts.map +0 -1
- package/dist/types/test/ui/viewport_constraint.test.d.ts +0 -2
- package/dist/types/test/ui/viewport_constraint.test.d.ts.map +0 -1
- package/dist/types/test/unstable_private_utils.test.d.ts +0 -1
- package/dist/types/test/unstable_private_utils.test.d.ts.map +0 -1
- /package/dist/cjs/shared/types/{field.js → field_core.js} +0 -0
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/** @module @airtable/blocks/models: Table */ /** */
|
|
2
2
|
import { TableCore } from '../../shared/models/table_core';
|
|
3
3
|
import { ViewType } from '../types/view';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { FieldType, FieldOptions } from '../../shared/types/
|
|
4
|
+
import { ObjectValues } from '../../shared/private_utils';
|
|
5
|
+
import { ViewId } from '../../shared/types/hyper_ids';
|
|
6
|
+
import { FieldType, FieldOptions } from '../../shared/types/field_core';
|
|
7
7
|
import { BaseSdkMode } from '../../sdk_mode';
|
|
8
8
|
import { PermissionCheckResult } from '../../shared/types/mutations_core';
|
|
9
9
|
import { RecordQueryResultOpts } from './record_query_result';
|
|
10
10
|
import Field from './field';
|
|
11
11
|
import TableOrViewQueryResult from './table_or_view_query_result';
|
|
12
12
|
import View from './view';
|
|
13
|
-
import Record from './record';
|
|
14
13
|
export declare const WatchableTableKeys: Readonly<{
|
|
15
14
|
views: "views";
|
|
16
15
|
name: "name";
|
|
@@ -309,838 +308,6 @@ declare class Table extends TableCore<BaseSdkMode, WatchableTableKey> {
|
|
|
309
308
|
* ```
|
|
310
309
|
*/
|
|
311
310
|
createFieldAsync(name: string, type: FieldType, options?: FieldOptions | null, description?: string | null): Promise<Field>;
|
|
312
|
-
/**
|
|
313
|
-
* Updates cell values for a record.
|
|
314
|
-
*
|
|
315
|
-
* Throws an error if the user does not have permission to update the given cell values in
|
|
316
|
-
* the record, or if invalid input is provided (eg. invalid cell values).
|
|
317
|
-
*
|
|
318
|
-
* Refer to {@link FieldType} for cell value write formats.
|
|
319
|
-
*
|
|
320
|
-
* This action is asynchronous: `await` the returned promise if you wish to wait for the updated
|
|
321
|
-
* cell values to be persisted to Airtable servers.
|
|
322
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
323
|
-
* before the promise resolves.
|
|
324
|
-
*
|
|
325
|
-
* @param recordOrRecordId the record to update
|
|
326
|
-
* @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
|
|
327
|
-
* @example
|
|
328
|
-
* ```js
|
|
329
|
-
* function updateRecord(record, recordFields) {
|
|
330
|
-
* if (table.hasPermissionToUpdateRecord(record, recordFields)) {
|
|
331
|
-
* table.updateRecordAsync(record, recordFields);
|
|
332
|
-
* }
|
|
333
|
-
* // The updated values will now show in your extension (eg in
|
|
334
|
-
* // `table.selectRecords()` result) but are still being saved to Airtable
|
|
335
|
-
* // servers (e.g. other users may not be able to see them yet).
|
|
336
|
-
* }
|
|
337
|
-
*
|
|
338
|
-
* async function updateRecordAsync(record, recordFields) {
|
|
339
|
-
* if (table.hasPermissionToUpdateRecord(record, recordFields)) {
|
|
340
|
-
* await table.updateRecordAsync(record, recordFields);
|
|
341
|
-
* }
|
|
342
|
-
* // New record has been saved to Airtable servers.
|
|
343
|
-
* alert(`record with ID ${record.id} has been updated`);
|
|
344
|
-
* }
|
|
345
|
-
*
|
|
346
|
-
* // Fields can be specified by name or ID
|
|
347
|
-
* updateRecord(record1, {
|
|
348
|
-
* 'Post Title': 'How to make: orange-mango pound cake',
|
|
349
|
-
* 'Publication Date': '2020-01-01',
|
|
350
|
-
* });
|
|
351
|
-
* updateRecord(record2, {
|
|
352
|
-
* [postTitleField.id]: 'Cake decorating tips & tricks',
|
|
353
|
-
* [publicationDateField.id]: '2020-02-02',
|
|
354
|
-
* });
|
|
355
|
-
*
|
|
356
|
-
* // Cell values should generally have format matching the output of
|
|
357
|
-
* // record.getCellValue() for the field being updated
|
|
358
|
-
* updateRecord(record1, {
|
|
359
|
-
* 'Category (single select)': {name: 'Recipe'},
|
|
360
|
-
* 'Tags (multiple select)': [{name: 'Desserts'}, {id: 'someChoiceId'}],
|
|
361
|
-
* 'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
|
|
362
|
-
* 'Related posts (linked records)': [{id: 'someRecordId'}],
|
|
363
|
-
* });
|
|
364
|
-
* ```
|
|
365
|
-
*/
|
|
366
|
-
updateRecordAsync(recordOrRecordId: Record | RecordId, fields: ObjectMap<FieldId | string, unknown>): Promise<void>;
|
|
367
|
-
/**
|
|
368
|
-
* Checks whether the current user has permission to perform the given record update.
|
|
369
|
-
*
|
|
370
|
-
* Accepts partial input, in the same format as {@link updateRecordAsync}.
|
|
371
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
372
|
-
*
|
|
373
|
-
* Returns `{hasPermission: true}` if the current user can update the specified record,
|
|
374
|
-
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
375
|
-
* used to display an error message to the user.
|
|
376
|
-
*
|
|
377
|
-
* @param recordOrRecordId the record to update
|
|
378
|
-
* @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
|
|
379
|
-
* @example
|
|
380
|
-
* ```js
|
|
381
|
-
* // Check if user can update specific fields for a specific record.
|
|
382
|
-
* const updateRecordCheckResult =
|
|
383
|
-
* table.checkPermissionsForUpdateRecord(record, {
|
|
384
|
-
* 'Post Title': 'How to make: orange-mango pound cake',
|
|
385
|
-
* 'Publication Date': '2020-01-01',
|
|
386
|
-
* });
|
|
387
|
-
* if (!updateRecordCheckResult.hasPermission) {
|
|
388
|
-
* alert(updateRecordCheckResult.reasonDisplayString);
|
|
389
|
-
* }
|
|
390
|
-
*
|
|
391
|
-
* // Like updateRecordAsync, you can use either field names or field IDs.
|
|
392
|
-
* const updateRecordCheckResultWithFieldIds =
|
|
393
|
-
* table.checkPermissionsForUpdateRecord(record, {
|
|
394
|
-
* [postTitleField.id]: 'Cake decorating tips & tricks',
|
|
395
|
-
* [publicationDateField.id]: '2020-02-02',
|
|
396
|
-
* });
|
|
397
|
-
*
|
|
398
|
-
* // Check if user could update a given record, when you don't know the
|
|
399
|
-
* // specific fields that will be updated yet (e.g. to check whether you should
|
|
400
|
-
* // allow a user to select a certain record to update).
|
|
401
|
-
* const updateUnknownFieldsCheckResult =
|
|
402
|
-
* table.checkPermissionsForUpdateRecord(record);
|
|
403
|
-
*
|
|
404
|
-
* // Check if user could update specific fields, when you don't know the
|
|
405
|
-
* // specific record that will be updated yet. (for example, if the field is
|
|
406
|
-
* // selected by the user and you want to check if your extension can write to it).
|
|
407
|
-
* const updateUnknownRecordCheckResult =
|
|
408
|
-
* table.checkPermissionsForUpdateRecord(undefined, {
|
|
409
|
-
* 'My field name': 'updated value',
|
|
410
|
-
* // You can use undefined if you know you're going to update a field,
|
|
411
|
-
* // but don't know the new cell value yet.
|
|
412
|
-
* 'Another field name': undefined,
|
|
413
|
-
* });
|
|
414
|
-
*
|
|
415
|
-
* // Check if user could perform updates within the table, without knowing the
|
|
416
|
-
* // specific record or fields that will be updated yet (e.g., to render your
|
|
417
|
-
* // extension in "read only" mode).
|
|
418
|
-
* const updateUnknownRecordAndFieldsCheckResult =
|
|
419
|
-
* table.checkPermissionsForUpdateRecord();
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
422
|
-
checkPermissionsForUpdateRecord(recordOrRecordId?: Record | RecordId, fields?: ObjectMap<FieldId | string, unknown | void>): PermissionCheckResult;
|
|
423
|
-
/**
|
|
424
|
-
* An alias for `checkPermissionsForUpdateRecord(recordOrRecordId, fields).hasPermission`.
|
|
425
|
-
*
|
|
426
|
-
* Checks whether the current user has permission to perform the given record update.
|
|
427
|
-
*
|
|
428
|
-
* Accepts partial input, in the same format as {@link updateRecordAsync}.
|
|
429
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
430
|
-
*
|
|
431
|
-
* @param recordOrRecordId the record to update
|
|
432
|
-
* @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
|
|
433
|
-
* @example
|
|
434
|
-
* ```js
|
|
435
|
-
* // Check if user can update specific fields for a specific record.
|
|
436
|
-
* const canUpdateRecord = table.hasPermissionToUpdateRecord(record, {
|
|
437
|
-
* 'Post Title': 'How to make: orange-mango pound cake',
|
|
438
|
-
* 'Publication Date': '2020-01-01',
|
|
439
|
-
* });
|
|
440
|
-
* if (!canUpdateRecord) {
|
|
441
|
-
* alert('not allowed!');
|
|
442
|
-
* }
|
|
443
|
-
*
|
|
444
|
-
* // Like updateRecordAsync, you can use either field names or field IDs.
|
|
445
|
-
* const canUpdateRecordWithFieldIds =
|
|
446
|
-
* table.hasPermissionToUpdateRecord(record, {
|
|
447
|
-
* [postTitleField.id]: 'Cake decorating tips & tricks',
|
|
448
|
-
* [publicationDateField.id]: '2020-02-02',
|
|
449
|
-
* });
|
|
450
|
-
*
|
|
451
|
-
* // Check if user could update a given record, when you don't know the
|
|
452
|
-
* // specific fields that will be updated yet (e.g. to check whether you should
|
|
453
|
-
* // allow a user to select a certain record to update).
|
|
454
|
-
* const canUpdateUnknownFields = table.hasPermissionToUpdateRecord(record);
|
|
455
|
-
*
|
|
456
|
-
* // Check if user could update specific fields, when you don't know the
|
|
457
|
-
* // specific record that will be updated yet (e.g. if the field is selected
|
|
458
|
-
* // by the user and you want to check if your extension can write to it).
|
|
459
|
-
* const canUpdateUnknownRecord =
|
|
460
|
-
* table.hasPermissionToUpdateRecord(undefined, {
|
|
461
|
-
* 'My field name': 'updated value',
|
|
462
|
-
* // You can use undefined if you know you're going to update a field,
|
|
463
|
-
* // but don't know the new cell value yet.
|
|
464
|
-
* 'Another field name': undefined,
|
|
465
|
-
* });
|
|
466
|
-
*
|
|
467
|
-
* // Check if user could perform updates within the table, without knowing the
|
|
468
|
-
* // specific record or fields that will be updated yet. (for example, to
|
|
469
|
-
* // render your extension in "read only" mode)
|
|
470
|
-
* const canUpdateUnknownRecordAndFields = table.hasPermissionToUpdateRecord();
|
|
471
|
-
* ```
|
|
472
|
-
*/
|
|
473
|
-
hasPermissionToUpdateRecord(recordOrRecordId?: Record | RecordId, fields?: ObjectMap<FieldId | string, unknown | void>): boolean;
|
|
474
|
-
/**
|
|
475
|
-
* Updates cell values for records.
|
|
476
|
-
*
|
|
477
|
-
* Throws an error if the user does not have permission to update the given cell values in
|
|
478
|
-
* the records, or if invalid input is provided (eg. invalid cell values).
|
|
479
|
-
*
|
|
480
|
-
* Refer to {@link FieldType} for cell value write formats.
|
|
481
|
-
*
|
|
482
|
-
* You may only update up to 50 records in one call to `updateRecordsAsync`.
|
|
483
|
-
* See [Write back to Airtable](/guides/write-back-to-airtable) for more information
|
|
484
|
-
* about write limits.
|
|
485
|
-
*
|
|
486
|
-
* This action is asynchronous: `await` the returned promise if you wish to wait for the
|
|
487
|
-
* updates to be persisted to Airtable servers.
|
|
488
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
489
|
-
* before the promise resolves.
|
|
490
|
-
*
|
|
491
|
-
* @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)
|
|
492
|
-
* @example
|
|
493
|
-
* ```js
|
|
494
|
-
* const recordsToUpdate = [
|
|
495
|
-
* // Fields can be specified by name or ID
|
|
496
|
-
* {
|
|
497
|
-
* id: record1.id,
|
|
498
|
-
* fields: {
|
|
499
|
-
* 'Post Title': 'How to make: orange-mango pound cake',
|
|
500
|
-
* 'Publication Date': '2020-01-01',
|
|
501
|
-
* },
|
|
502
|
-
* },
|
|
503
|
-
* {
|
|
504
|
-
* id: record2.id,
|
|
505
|
-
* fields: {
|
|
506
|
-
* // Sets the cell values to be empty.
|
|
507
|
-
* 'Post Title': '',
|
|
508
|
-
* 'Publication Date': '',
|
|
509
|
-
* },
|
|
510
|
-
* },
|
|
511
|
-
* {
|
|
512
|
-
* id: record3.id,
|
|
513
|
-
* fields: {
|
|
514
|
-
* [postTitleField.id]: 'Cake decorating tips & tricks',
|
|
515
|
-
* [publicationDateField.id]: '2020-02-02',
|
|
516
|
-
* },
|
|
517
|
-
* },
|
|
518
|
-
* // Cell values should generally have format matching the output of
|
|
519
|
-
* // record.getCellValue() for the field being updated
|
|
520
|
-
* {
|
|
521
|
-
* id: record4.id,
|
|
522
|
-
* fields: {
|
|
523
|
-
* 'Category (single select)': {name: 'Recipe'},
|
|
524
|
-
* 'Tags (multiple select)': [{name: 'Desserts'}, {id: 'choiceId'}],
|
|
525
|
-
* 'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
|
|
526
|
-
* 'Related posts (linked records)': [{id: 'someRecordId'}],
|
|
527
|
-
* },
|
|
528
|
-
* },
|
|
529
|
-
* ];
|
|
530
|
-
*
|
|
531
|
-
* function updateRecords() {
|
|
532
|
-
* if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
|
|
533
|
-
* table.updateRecordsAsync(recordsToUpdate);
|
|
534
|
-
* }
|
|
535
|
-
* // The records are now updated within your extension (eg will be reflected in
|
|
536
|
-
* // `table.selectRecords()`) but are still being saved to Airtable servers
|
|
537
|
-
* // (e.g. they may not be updated for other users yet).
|
|
538
|
-
* }
|
|
539
|
-
*
|
|
540
|
-
* async function updateRecordsAsync() {
|
|
541
|
-
* if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
|
|
542
|
-
* await table.updateRecordsAsync(recordsToUpdate);
|
|
543
|
-
* }
|
|
544
|
-
* // Record updates have been saved to Airtable servers.
|
|
545
|
-
* alert('records have been updated');
|
|
546
|
-
* }
|
|
547
|
-
* ```
|
|
548
|
-
*/
|
|
549
|
-
updateRecordsAsync(records: ReadonlyArray<{
|
|
550
|
-
readonly id: RecordId;
|
|
551
|
-
readonly fields: ObjectMap<FieldId | string, unknown>;
|
|
552
|
-
}>): Promise<void>;
|
|
553
|
-
/**
|
|
554
|
-
* Checks whether the current user has permission to perform the given record updates.
|
|
555
|
-
*
|
|
556
|
-
* Accepts partial input, in the same format as {@link updateRecordsAsync}.
|
|
557
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
558
|
-
*
|
|
559
|
-
* Returns `{hasPermission: true}` if the current user can update the specified records,
|
|
560
|
-
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
561
|
-
* used to display an error message to the user.
|
|
562
|
-
*
|
|
563
|
-
* @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)
|
|
564
|
-
* @example
|
|
565
|
-
* ```js
|
|
566
|
-
* const recordsToUpdate = [
|
|
567
|
-
* {
|
|
568
|
-
* // Validating a complete record update
|
|
569
|
-
* id: record1.id,
|
|
570
|
-
* fields: {
|
|
571
|
-
* 'Post Title': 'How to make: orange-mango pound cake',
|
|
572
|
-
* 'Publication Date': '2020-01-01',
|
|
573
|
-
* },
|
|
574
|
-
* },
|
|
575
|
-
* {
|
|
576
|
-
* // Like updateRecordsAsync, fields can be specified by name or ID
|
|
577
|
-
* id: record2.id,
|
|
578
|
-
* fields: {
|
|
579
|
-
* [postTitleField.id]: 'Cake decorating tips & tricks',
|
|
580
|
-
* [publicationDateField.id]: '2020-02-02',
|
|
581
|
-
* },
|
|
582
|
-
* },
|
|
583
|
-
* {
|
|
584
|
-
* // Validating an update to a specific record, not knowing what
|
|
585
|
-
* // fields will be updated
|
|
586
|
-
* id: record3.id,
|
|
587
|
-
* },
|
|
588
|
-
* {
|
|
589
|
-
* // Validating an update to specific cell values, not knowing what
|
|
590
|
-
* // record will be updated
|
|
591
|
-
* fields: {
|
|
592
|
-
* 'My field name': 'updated value for unknown record',
|
|
593
|
-
* // You can use undefined if you know you're going to update a
|
|
594
|
-
* // field, but don't know the new cell value yet.
|
|
595
|
-
* 'Another field name': undefined,
|
|
596
|
-
* },
|
|
597
|
-
* },
|
|
598
|
-
* ];
|
|
599
|
-
*
|
|
600
|
-
* const updateRecordsCheckResult =
|
|
601
|
-
* table.checkPermissionsForUpdateRecords(recordsToUpdate);
|
|
602
|
-
* if (!updateRecordsCheckResult.hasPermission) {
|
|
603
|
-
* alert(updateRecordsCheckResult.reasonDisplayString);
|
|
604
|
-
* }
|
|
605
|
-
*
|
|
606
|
-
* // Check if user could potentially update records.
|
|
607
|
-
* // Equivalent to table.checkPermissionsForUpdateRecord()
|
|
608
|
-
* const updateUnknownRecordAndFieldsCheckResult =
|
|
609
|
-
* table.checkPermissionsForUpdateRecords();
|
|
610
|
-
* ```
|
|
611
|
-
*/
|
|
612
|
-
checkPermissionsForUpdateRecords(records?: ReadonlyArray<{
|
|
613
|
-
readonly id?: RecordId | void;
|
|
614
|
-
readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
|
|
615
|
-
}>): PermissionCheckResult;
|
|
616
|
-
/**
|
|
617
|
-
* An alias for `checkPermissionsForUpdateRecords(records).hasPermission`.
|
|
618
|
-
*
|
|
619
|
-
* Checks whether the current user has permission to perform the given record updates.
|
|
620
|
-
*
|
|
621
|
-
* Accepts partial input, in the same format as {@link updateRecordsAsync}.
|
|
622
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
623
|
-
*
|
|
624
|
-
* @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)
|
|
625
|
-
* @example
|
|
626
|
-
* ```js
|
|
627
|
-
* const recordsToUpdate = [
|
|
628
|
-
* {
|
|
629
|
-
* // Validating a complete record update
|
|
630
|
-
* id: record1.id,
|
|
631
|
-
* fields: {
|
|
632
|
-
* 'Post Title': 'How to make: orange-mango pound cake',
|
|
633
|
-
* 'Publication Date': '2020-01-01',
|
|
634
|
-
* },
|
|
635
|
-
* },
|
|
636
|
-
* {
|
|
637
|
-
* // Like updateRecordsAsync, fields can be specified by name or ID
|
|
638
|
-
* id: record2.id,
|
|
639
|
-
* fields: {
|
|
640
|
-
* [postTitleField.id]: 'Cake decorating tips & tricks',
|
|
641
|
-
* [publicationDateField.id]: '2020-02-02',
|
|
642
|
-
* },
|
|
643
|
-
* },
|
|
644
|
-
* {
|
|
645
|
-
* // Validating an update to a specific record, not knowing what
|
|
646
|
-
* // fields will be updated
|
|
647
|
-
* id: record3.id,
|
|
648
|
-
* },
|
|
649
|
-
* {
|
|
650
|
-
* // Validating an update to specific cell values, not knowing what
|
|
651
|
-
* // record will be updated
|
|
652
|
-
* fields: {
|
|
653
|
-
* 'My field name': 'updated value for unknown record',
|
|
654
|
-
* // You can use undefined if you know you're going to update a
|
|
655
|
-
* // field, but don't know the new cell value yet.
|
|
656
|
-
* 'Another field name': undefined,
|
|
657
|
-
* },
|
|
658
|
-
* },
|
|
659
|
-
* ];
|
|
660
|
-
*
|
|
661
|
-
* const canUpdateRecords = table.hasPermissionToUpdateRecords(recordsToUpdate);
|
|
662
|
-
* if (!canUpdateRecords) {
|
|
663
|
-
* alert('not allowed');
|
|
664
|
-
* }
|
|
665
|
-
*
|
|
666
|
-
* // Check if user could potentially update records.
|
|
667
|
-
* // Equivalent to table.hasPermissionToUpdateRecord()
|
|
668
|
-
* const canUpdateUnknownRecordsAndFields =
|
|
669
|
-
* table.hasPermissionToUpdateRecords();
|
|
670
|
-
* ```
|
|
671
|
-
*/
|
|
672
|
-
hasPermissionToUpdateRecords(records?: ReadonlyArray<{
|
|
673
|
-
readonly id?: RecordId | void;
|
|
674
|
-
readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
|
|
675
|
-
}>): boolean;
|
|
676
|
-
/**
|
|
677
|
-
* Delete the given record.
|
|
678
|
-
*
|
|
679
|
-
* Throws an error if the user does not have permission to delete the given record.
|
|
680
|
-
*
|
|
681
|
-
* This action is asynchronous: `await` the returned promise if you wish to wait for the
|
|
682
|
-
* delete to be persisted to Airtable servers.
|
|
683
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
684
|
-
* before the promise resolves.
|
|
685
|
-
*
|
|
686
|
-
* @param recordOrRecordId the record to be deleted
|
|
687
|
-
* @example
|
|
688
|
-
* ```js
|
|
689
|
-
* function deleteRecord(record) {
|
|
690
|
-
* if (table.hasPermissionToDeleteRecord(record)) {
|
|
691
|
-
* table.deleteRecordAsync(record);
|
|
692
|
-
* }
|
|
693
|
-
* // The record is now deleted within your extension (eg will not be returned
|
|
694
|
-
* // in `table.selectRecords`) but it is still being saved to Airtable
|
|
695
|
-
* // servers (e.g. it may not look deleted to other users yet).
|
|
696
|
-
* }
|
|
697
|
-
*
|
|
698
|
-
* async function deleteRecordAsync(record) {
|
|
699
|
-
* if (table.hasPermissionToDeleteRecord(record)) {
|
|
700
|
-
* await table.deleteRecordAsync(record);
|
|
701
|
-
* }
|
|
702
|
-
* // Record deletion has been saved to Airtable servers.
|
|
703
|
-
* alert('record has been deleted');
|
|
704
|
-
* }
|
|
705
|
-
* ```
|
|
706
|
-
*/
|
|
707
|
-
deleteRecordAsync(recordOrRecordId: Record | RecordId): Promise<void>;
|
|
708
|
-
/**
|
|
709
|
-
* Checks whether the current user has permission to delete the specified record.
|
|
710
|
-
*
|
|
711
|
-
* Accepts optional input, in the same format as {@link deleteRecordAsync}.
|
|
712
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
713
|
-
*
|
|
714
|
-
* Returns `{hasPermission: true}` if the current user can delete the specified record,
|
|
715
|
-
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
716
|
-
* used to display an error message to the user.
|
|
717
|
-
*
|
|
718
|
-
* @param recordOrRecordId the record to be deleted
|
|
719
|
-
* @example
|
|
720
|
-
* ```js
|
|
721
|
-
* // Check if user can delete a specific record
|
|
722
|
-
* const deleteRecordCheckResult =
|
|
723
|
-
* table.checkPermissionsForDeleteRecord(record);
|
|
724
|
-
* if (!deleteRecordCheckResult.hasPermission) {
|
|
725
|
-
* alert(deleteRecordCheckResult.reasonDisplayString);
|
|
726
|
-
* }
|
|
727
|
-
*
|
|
728
|
-
* // Check if user could potentially delete a record.
|
|
729
|
-
* // Use when you don't know the specific record you want to delete yet (for
|
|
730
|
-
* // example, to show/hide UI controls that let you select a record to delete).
|
|
731
|
-
* const deleteUnknownRecordCheckResult =
|
|
732
|
-
* table.checkPermissionsForDeleteRecord();
|
|
733
|
-
* ```
|
|
734
|
-
*/
|
|
735
|
-
checkPermissionsForDeleteRecord(recordOrRecordId?: Record | RecordId): PermissionCheckResult;
|
|
736
|
-
/**
|
|
737
|
-
* An alias for `checkPermissionsForDeleteRecord(recordOrRecordId).hasPermission`.
|
|
738
|
-
*
|
|
739
|
-
* Checks whether the current user has permission to delete the specified record.
|
|
740
|
-
*
|
|
741
|
-
* Accepts optional input, in the same format as {@link deleteRecordAsync}.
|
|
742
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
743
|
-
*
|
|
744
|
-
* @param recordOrRecordId the record to be deleted
|
|
745
|
-
* @example
|
|
746
|
-
* ```js
|
|
747
|
-
* // Check if user can delete a specific record
|
|
748
|
-
* const canDeleteRecord = table.hasPermissionToDeleteRecord(record);
|
|
749
|
-
* if (!canDeleteRecord) {
|
|
750
|
-
* alert('not allowed');
|
|
751
|
-
* }
|
|
752
|
-
*
|
|
753
|
-
* // Check if user could potentially delete a record.
|
|
754
|
-
* // Use when you don't know the specific record you want to delete yet (for
|
|
755
|
-
* // example, to show/hide UI controls that let you select a record to delete).
|
|
756
|
-
* const canDeleteUnknownRecord = table.hasPermissionToDeleteRecord();
|
|
757
|
-
* ```
|
|
758
|
-
*/
|
|
759
|
-
hasPermissionToDeleteRecord(recordOrRecordId?: Record | RecordId): boolean;
|
|
760
|
-
/**
|
|
761
|
-
* Delete the given records.
|
|
762
|
-
*
|
|
763
|
-
* Throws an error if the user does not have permission to delete the given records.
|
|
764
|
-
*
|
|
765
|
-
* You may only delete up to 50 records in one call to `deleteRecordsAsync`.
|
|
766
|
-
* See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
|
|
767
|
-
* more information about write limits.
|
|
768
|
-
*
|
|
769
|
-
* This action is asynchronous: `await` the returned promise if you wish to wait for the
|
|
770
|
-
* delete to be persisted to Airtable servers.
|
|
771
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
772
|
-
* before the promise resolves.
|
|
773
|
-
*
|
|
774
|
-
* @param recordsOrRecordIds Array of Records and RecordIds
|
|
775
|
-
* @example
|
|
776
|
-
* ```js
|
|
777
|
-
*
|
|
778
|
-
* function deleteRecords(records) {
|
|
779
|
-
* if (table.hasPermissionToDeleteRecords(records)) {
|
|
780
|
-
* table.deleteRecordsAsync(records);
|
|
781
|
-
* }
|
|
782
|
-
* // The records are now deleted within your extension (eg will not be
|
|
783
|
-
* // returned in `table.selectRecords()`) but are still being saved to
|
|
784
|
-
* // Airtable servers (e.g. they may not look deleted to other users yet).
|
|
785
|
-
* }
|
|
786
|
-
*
|
|
787
|
-
* async function deleteRecordsAsync(records) {
|
|
788
|
-
* if (table.hasPermissionToDeleteRecords(records)) {
|
|
789
|
-
* await table.deleteRecordsAsync(records);
|
|
790
|
-
* }
|
|
791
|
-
* // Record deletions have been saved to Airtable servers.
|
|
792
|
-
* alert('records have been deleted');
|
|
793
|
-
* }
|
|
794
|
-
* ```
|
|
795
|
-
*/
|
|
796
|
-
deleteRecordsAsync(recordsOrRecordIds: ReadonlyArray<Record | RecordId>): Promise<void>;
|
|
797
|
-
/**
|
|
798
|
-
* Checks whether the current user has permission to delete the specified records.
|
|
799
|
-
*
|
|
800
|
-
* Accepts optional input, in the same format as {@link deleteRecordsAsync}.
|
|
801
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
802
|
-
*
|
|
803
|
-
* Returns `{hasPermission: true}` if the current user can delete the specified records,
|
|
804
|
-
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
805
|
-
* used to display an error message to the user.
|
|
806
|
-
*
|
|
807
|
-
* @param recordsOrRecordIds the records to be deleted
|
|
808
|
-
* @example
|
|
809
|
-
* ```js
|
|
810
|
-
* // Check if user can delete specific records
|
|
811
|
-
* const deleteRecordsCheckResult =
|
|
812
|
-
* table.checkPermissionsForDeleteRecords([record1, record2]);
|
|
813
|
-
* if (!deleteRecordsCheckResult.hasPermission) {
|
|
814
|
-
* alert(deleteRecordsCheckResult.reasonDisplayString);
|
|
815
|
-
* }
|
|
816
|
-
*
|
|
817
|
-
* // Check if user could potentially delete records.
|
|
818
|
-
* // Use when you don't know the specific records you want to delete yet (for
|
|
819
|
-
* // example, to show/hide UI controls that let you select records to delete).
|
|
820
|
-
* // Equivalent to table.hasPermissionToDeleteRecord()
|
|
821
|
-
* const deleteUnknownRecordsCheckResult =
|
|
822
|
-
* table.checkPermissionsForDeleteRecords();
|
|
823
|
-
* ```
|
|
824
|
-
*/
|
|
825
|
-
checkPermissionsForDeleteRecords(recordsOrRecordIds?: ReadonlyArray<Record | RecordId>): PermissionCheckResult;
|
|
826
|
-
/**
|
|
827
|
-
* An alias for `checkPermissionsForDeleteRecords(recordsOrRecordIds).hasPermission`.
|
|
828
|
-
*
|
|
829
|
-
* Checks whether the current user has permission to delete the specified records.
|
|
830
|
-
*
|
|
831
|
-
* Accepts optional input, in the same format as {@link deleteRecordsAsync}.
|
|
832
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
833
|
-
*
|
|
834
|
-
* @param recordsOrRecordIds the records to be deleted
|
|
835
|
-
* @example
|
|
836
|
-
* ```js
|
|
837
|
-
* // Check if user can delete specific records
|
|
838
|
-
* const canDeleteRecords =
|
|
839
|
-
* table.hasPermissionToDeleteRecords([record1, record2]);
|
|
840
|
-
* if (!canDeleteRecords) {
|
|
841
|
-
* alert('not allowed!');
|
|
842
|
-
* }
|
|
843
|
-
*
|
|
844
|
-
* // Check if user could potentially delete records.
|
|
845
|
-
* // Use when you don't know the specific records you want to delete yet (for
|
|
846
|
-
* // example, to show/hide UI controls that let you select records to delete).
|
|
847
|
-
* // Equivalent to table.hasPermissionToDeleteRecord()
|
|
848
|
-
* const canDeleteUnknownRecords = table.hasPermissionToDeleteRecords();
|
|
849
|
-
* ```
|
|
850
|
-
*/
|
|
851
|
-
hasPermissionToDeleteRecords(recordsOrRecordIds?: ReadonlyArray<Record | RecordId>): boolean;
|
|
852
|
-
/**
|
|
853
|
-
* Creates a new record with the specified cell values.
|
|
854
|
-
*
|
|
855
|
-
* Throws an error if the user does not have permission to create the given records, or
|
|
856
|
-
* if invalid input is provided (eg. invalid cell values).
|
|
857
|
-
*
|
|
858
|
-
* Refer to {@link FieldType} for cell value write formats.
|
|
859
|
-
*
|
|
860
|
-
* This action is asynchronous: `await` the returned promise if you wish to wait for the new
|
|
861
|
-
* record to be persisted to Airtable servers.
|
|
862
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
863
|
-
* before the promise resolves.
|
|
864
|
-
*
|
|
865
|
-
* The returned promise will resolve to the RecordId of the new record once it is persisted.
|
|
866
|
-
*
|
|
867
|
-
* @param fields object mapping `FieldId` or field name to value for that field.
|
|
868
|
-
* @example
|
|
869
|
-
* ```js
|
|
870
|
-
* function createNewRecord(recordFields) {
|
|
871
|
-
* if (table.hasPermissionToCreateRecord(recordFields)) {
|
|
872
|
-
* table.createRecordAsync(recordFields);
|
|
873
|
-
* }
|
|
874
|
-
* // You can now access the new record in your extension (eg
|
|
875
|
-
* // `table.selectRecords()`) but it is still being saved to Airtable
|
|
876
|
-
* // servers (e.g. other users may not be able to see it yet).
|
|
877
|
-
* }
|
|
878
|
-
*
|
|
879
|
-
* async function createNewRecordAsync(recordFields) {
|
|
880
|
-
* if (table.hasPermissionToCreateRecord(recordFields)) {
|
|
881
|
-
* const newRecordId = await table.createRecordAsync(recordFields);
|
|
882
|
-
* }
|
|
883
|
-
* // New record has been saved to Airtable servers.
|
|
884
|
-
* alert(`new record with ID ${newRecordId} has been created`);
|
|
885
|
-
* }
|
|
886
|
-
*
|
|
887
|
-
* // Fields can be specified by name or ID
|
|
888
|
-
* createNewRecord({
|
|
889
|
-
* 'Project Name': 'Advertising campaign',
|
|
890
|
-
* 'Budget': 100,
|
|
891
|
-
* });
|
|
892
|
-
* createNewRecord({
|
|
893
|
-
* [projectNameField.id]: 'Cat video',
|
|
894
|
-
* [budgetField.id]: 200,
|
|
895
|
-
* });
|
|
896
|
-
*
|
|
897
|
-
* // Cell values should generally have format matching the output of
|
|
898
|
-
* // record.getCellValue() for the field being updated
|
|
899
|
-
* createNewRecord({
|
|
900
|
-
* 'Project Name': 'Cat video 2'
|
|
901
|
-
* 'Category (single select)': {name: 'Video'},
|
|
902
|
-
* 'Tags (multiple select)': [{name: 'Cats'}, {id: 'someChoiceId'}],
|
|
903
|
-
* 'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
|
|
904
|
-
* 'Related projects (linked records)': [{id: 'someRecordId'}],
|
|
905
|
-
* });
|
|
906
|
-
* ```
|
|
907
|
-
*/
|
|
908
|
-
createRecordAsync(fields?: ObjectMap<FieldId | string, unknown>): Promise<RecordId>;
|
|
909
|
-
/**
|
|
910
|
-
* Checks whether the current user has permission to create the specified record.
|
|
911
|
-
*
|
|
912
|
-
* Accepts partial input, in the same format as {@link createRecordAsync}.
|
|
913
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
914
|
-
*
|
|
915
|
-
* Returns `{hasPermission: true}` if the current user can create the specified record,
|
|
916
|
-
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
917
|
-
* used to display an error message to the user.
|
|
918
|
-
*
|
|
919
|
-
* @param fields object mapping `FieldId` or field name to value for that field.
|
|
920
|
-
* @example
|
|
921
|
-
* ```js
|
|
922
|
-
* // Check if user can create a specific record, when you already know what
|
|
923
|
-
* // fields/cell values will be set for the record.
|
|
924
|
-
* const createRecordCheckResult = table.checkPermissionsForCreateRecord({
|
|
925
|
-
* 'Project Name': 'Advertising campaign',
|
|
926
|
-
* 'Budget': 100,
|
|
927
|
-
* });
|
|
928
|
-
* if (!createRecordCheckResult.hasPermission) {
|
|
929
|
-
* alert(createRecordCheckResult.reasonDisplayString);
|
|
930
|
-
* }
|
|
931
|
-
*
|
|
932
|
-
* // Like createRecordAsync, you can use either field names or field IDs.
|
|
933
|
-
* const checkResultWithFieldIds = table.checkPermissionsForCreateRecord({
|
|
934
|
-
* [projectNameField.id]: 'Cat video',
|
|
935
|
-
* [budgetField.id]: 200,
|
|
936
|
-
* });
|
|
937
|
-
*
|
|
938
|
-
* // Check if user could potentially create a record.
|
|
939
|
-
* // Use when you don't know the specific fields/cell values yet (for example,
|
|
940
|
-
* // to show or hide UI controls that let you start creating a record.)
|
|
941
|
-
* const createUnknownRecordCheckResult =
|
|
942
|
-
* table.checkPermissionsForCreateRecord();
|
|
943
|
-
* ```
|
|
944
|
-
*/
|
|
945
|
-
checkPermissionsForCreateRecord(fields?: ObjectMap<FieldId | string, unknown | void>): PermissionCheckResult;
|
|
946
|
-
/**
|
|
947
|
-
* An alias for `checkPermissionsForCreateRecord(fields).hasPermission`.
|
|
948
|
-
*
|
|
949
|
-
* Checks whether the current user has permission to create the specified record.
|
|
950
|
-
*
|
|
951
|
-
* Accepts partial input, in the same format as {@link createRecordAsync}.
|
|
952
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
953
|
-
*
|
|
954
|
-
* @param fields object mapping `FieldId` or field name to value for that field.
|
|
955
|
-
* @example
|
|
956
|
-
* ```js
|
|
957
|
-
* // Check if user can create a specific record, when you already know what
|
|
958
|
-
* // fields/cell values will be set for the record.
|
|
959
|
-
* const canCreateRecord = table.hasPermissionToCreateRecord({
|
|
960
|
-
* 'Project Name': 'Advertising campaign',
|
|
961
|
-
* 'Budget': 100,
|
|
962
|
-
* });
|
|
963
|
-
* if (!canCreateRecord) {
|
|
964
|
-
* alert('not allowed!');
|
|
965
|
-
* }
|
|
966
|
-
*
|
|
967
|
-
* // Like createRecordAsync, you can use either field names or field IDs.
|
|
968
|
-
* const canCreateRecordWithFieldIds = table.hasPermissionToCreateRecord({
|
|
969
|
-
* [projectNameField.id]: 'Cat video',
|
|
970
|
-
* [budgetField.id]: 200,
|
|
971
|
-
* });
|
|
972
|
-
*
|
|
973
|
-
* // Check if user could potentially create a record.
|
|
974
|
-
* // Use when you don't know the specific fields/cell values yet (for example,
|
|
975
|
-
* // to show or hide UI controls that let you start creating a record.)
|
|
976
|
-
* const canCreateUnknownRecord = table.hasPermissionToCreateRecord();
|
|
977
|
-
* ```
|
|
978
|
-
*/
|
|
979
|
-
hasPermissionToCreateRecord(fields?: ObjectMap<FieldId | string, unknown | void>): boolean;
|
|
980
|
-
/**
|
|
981
|
-
* Creates new records with the specified cell values.
|
|
982
|
-
*
|
|
983
|
-
* Throws an error if the user does not have permission to create the given records, or
|
|
984
|
-
* if invalid input is provided (eg. invalid cell values).
|
|
985
|
-
*
|
|
986
|
-
* Refer to {@link FieldType} for cell value write formats.
|
|
987
|
-
*
|
|
988
|
-
* You may only create up to 50 records in one call to `createRecordsAsync`.
|
|
989
|
-
* See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
|
|
990
|
-
* more information about write limits.
|
|
991
|
-
*
|
|
992
|
-
* This action is asynchronous: `await` the returned promise if you wish to wait for the new
|
|
993
|
-
* record to be persisted to Airtable servers.
|
|
994
|
-
* Updates are applied optimistically locally, so your changes will be reflected in your extension
|
|
995
|
-
* before the promise resolves.
|
|
996
|
-
*
|
|
997
|
-
* The returned promise will resolve to an array of RecordIds of the new records once the new
|
|
998
|
-
* records are persisted.
|
|
999
|
-
*
|
|
1000
|
-
* @param records Array of objects with a `fields` key mapping `FieldId` or field name to value for that field.
|
|
1001
|
-
* @example
|
|
1002
|
-
* ```js
|
|
1003
|
-
* const recordDefs = [
|
|
1004
|
-
* // Fields can be specified by name or ID
|
|
1005
|
-
* {
|
|
1006
|
-
* fields: {
|
|
1007
|
-
* 'Project Name': 'Advertising campaign',
|
|
1008
|
-
* 'Budget': 100,
|
|
1009
|
-
* },
|
|
1010
|
-
* },
|
|
1011
|
-
* {
|
|
1012
|
-
* fields: {
|
|
1013
|
-
* [projectNameField.id]: 'Cat video',
|
|
1014
|
-
* [budgetField.id]: 200,
|
|
1015
|
-
* },
|
|
1016
|
-
* },
|
|
1017
|
-
* // Specifying no fields will create a new record with no cell values set
|
|
1018
|
-
* {
|
|
1019
|
-
* fields: {},
|
|
1020
|
-
* },
|
|
1021
|
-
* // Cell values should generally have format matching the output of
|
|
1022
|
-
* // record.getCellValue() for the field being updated
|
|
1023
|
-
* {
|
|
1024
|
-
* fields: {
|
|
1025
|
-
* 'Project Name': 'Cat video 2'
|
|
1026
|
-
* 'Category (single select)': {name: 'Video'},
|
|
1027
|
-
* 'Tags (multiple select)': [{name: 'Cats'}, {id: 'choiceId'}],
|
|
1028
|
-
* 'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
|
|
1029
|
-
* 'Related projects (linked records)': [{id: 'someRecordId'}],
|
|
1030
|
-
* },
|
|
1031
|
-
* },
|
|
1032
|
-
* ];
|
|
1033
|
-
*
|
|
1034
|
-
* function createNewRecords() {
|
|
1035
|
-
* if (table.hasPermissionToCreateRecords(recordDefs)) {
|
|
1036
|
-
* table.createRecordsAsync(recordDefs);
|
|
1037
|
-
* }
|
|
1038
|
-
* // You can now access the new records in your extension (e.g.
|
|
1039
|
-
* // `table.selectRecords()`) but they are still being saved to Airtable
|
|
1040
|
-
* // servers (e.g. other users may not be able to see them yet.)
|
|
1041
|
-
* }
|
|
1042
|
-
*
|
|
1043
|
-
* async function createNewRecordsAsync() {
|
|
1044
|
-
* if (table.hasPermissionToCreateRecords(recordDefs)) {
|
|
1045
|
-
* const newRecordIds = await table.createRecordsAsync(recordDefs);
|
|
1046
|
-
* }
|
|
1047
|
-
* // New records have been saved to Airtable servers.
|
|
1048
|
-
* alert(`new records with IDs ${newRecordIds} have been created`);
|
|
1049
|
-
* }
|
|
1050
|
-
* ```
|
|
1051
|
-
*/
|
|
1052
|
-
createRecordsAsync(records: ReadonlyArray<{
|
|
1053
|
-
fields: ObjectMap<FieldId | string, unknown>;
|
|
1054
|
-
}>): Promise<Array<RecordId>>;
|
|
1055
|
-
/**
|
|
1056
|
-
* Checks whether the current user has permission to create the specified records.
|
|
1057
|
-
*
|
|
1058
|
-
* Accepts partial input, in the same format as {@link createRecordsAsync}.
|
|
1059
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
1060
|
-
*
|
|
1061
|
-
* Returns `{hasPermission: true}` if the current user can create the specified records,
|
|
1062
|
-
* `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
|
|
1063
|
-
* used to display an error message to the user.
|
|
1064
|
-
*
|
|
1065
|
-
* @param records Array of objects mapping `FieldId` or field name to value for that field.
|
|
1066
|
-
* @example
|
|
1067
|
-
* ```js
|
|
1068
|
-
* // Check if user can create specific records, when you already know what
|
|
1069
|
-
* // fields/cell values will be set for the records.
|
|
1070
|
-
* const createRecordsCheckResult = table.checkPermissionsForCreateRecords([
|
|
1071
|
-
* // Like createRecordsAsync, fields can be specified by name or ID
|
|
1072
|
-
* {
|
|
1073
|
-
* fields: {
|
|
1074
|
-
* 'Project Name': 'Advertising campaign',
|
|
1075
|
-
* 'Budget': 100,
|
|
1076
|
-
* },
|
|
1077
|
-
* },
|
|
1078
|
-
* {
|
|
1079
|
-
* fields: {
|
|
1080
|
-
* [projectNameField.id]: 'Cat video',
|
|
1081
|
-
* [budgetField.id]: 200,
|
|
1082
|
-
* },
|
|
1083
|
-
* },
|
|
1084
|
-
* {},
|
|
1085
|
-
* ]);
|
|
1086
|
-
* if (!createRecordsCheckResult.hasPermission) {
|
|
1087
|
-
* alert(createRecordsCheckResult.reasonDisplayString);
|
|
1088
|
-
* }
|
|
1089
|
-
*
|
|
1090
|
-
* // Check if user could potentially create records.
|
|
1091
|
-
* // Use when you don't know the specific fields/cell values yet (for example,
|
|
1092
|
-
* // to show or hide UI controls that let you start creating records.)
|
|
1093
|
-
* // Equivalent to table.checkPermissionsForCreateRecord()
|
|
1094
|
-
* const createUnknownRecordCheckResult =
|
|
1095
|
-
* table.checkPermissionsForCreateRecords();
|
|
1096
|
-
* ```
|
|
1097
|
-
*/
|
|
1098
|
-
checkPermissionsForCreateRecords(records?: ReadonlyArray<{
|
|
1099
|
-
readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
|
|
1100
|
-
}>): PermissionCheckResult;
|
|
1101
|
-
/**
|
|
1102
|
-
* An alias for `checkPermissionsForCreateRecords(records).hasPermission`.
|
|
1103
|
-
*
|
|
1104
|
-
* Checks whether the current user has permission to create the specified records.
|
|
1105
|
-
*
|
|
1106
|
-
* Accepts partial input, in the same format as {@link createRecordsAsync}.
|
|
1107
|
-
* The more information provided, the more accurate the permissions check will be.
|
|
1108
|
-
*
|
|
1109
|
-
* @param records Array of objects mapping `FieldId` or field name to value for that field.
|
|
1110
|
-
* @example
|
|
1111
|
-
* ```js
|
|
1112
|
-
* // Check if user can create specific records, when you already know what fields/cell values
|
|
1113
|
-
* // will be set for the records.
|
|
1114
|
-
* const canCreateRecords = table.hasPermissionToCreateRecords([
|
|
1115
|
-
* // Like createRecordsAsync, fields can be specified by name or ID
|
|
1116
|
-
* {
|
|
1117
|
-
* fields: {
|
|
1118
|
-
* 'Project Name': 'Advertising campaign',
|
|
1119
|
-
* 'Budget': 100,
|
|
1120
|
-
* }
|
|
1121
|
-
* },
|
|
1122
|
-
* {
|
|
1123
|
-
* fields: {
|
|
1124
|
-
* [projectNameField.id]: 'Cat video',
|
|
1125
|
-
* [budgetField.id]: 200,
|
|
1126
|
-
* }
|
|
1127
|
-
* },
|
|
1128
|
-
* {},
|
|
1129
|
-
* ]);
|
|
1130
|
-
* if (!canCreateRecords) {
|
|
1131
|
-
* alert('not allowed');
|
|
1132
|
-
* }
|
|
1133
|
-
*
|
|
1134
|
-
* // Check if user could potentially create records.
|
|
1135
|
-
* // Use when you don't know the specific fields/cell values yet (for example,
|
|
1136
|
-
* // to show or hide UI controls that let you start creating records).
|
|
1137
|
-
* // Equivalent to table.hasPermissionToCreateRecord()
|
|
1138
|
-
* const canCreateUnknownRecords = table.hasPermissionToCreateRecords();
|
|
1139
|
-
* ```
|
|
1140
|
-
*/
|
|
1141
|
-
hasPermissionToCreateRecords(records?: ReadonlyArray<{
|
|
1142
|
-
readonly fields?: ObjectMap<FieldId | string, unknown | void> | void;
|
|
1143
|
-
}>): boolean;
|
|
1144
311
|
}
|
|
1145
312
|
export default Table;
|
|
1146
313
|
//# sourceMappingURL=table.d.ts.map
|