@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
|
@@ -28,7 +28,7 @@ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
|
28
28
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
29
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
30
30
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
-
var
|
|
31
|
+
var _field_core = require("../../shared/types/field_core");
|
|
32
32
|
var _error_utils = require("../../shared/error_utils");
|
|
33
33
|
var _record_query_result = _interopRequireDefault(require("./record_query_result"));
|
|
34
34
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
@@ -622,7 +622,7 @@ var LinkedRecordsQueryResult = /*#__PURE__*/function (_RecordQueryResult) {
|
|
|
622
622
|
value: function _onOriginFieldConfigChange() {
|
|
623
623
|
(0, _error_utils.invariant)(this.isValid, 'watch key change event whilst invalid');
|
|
624
624
|
var type = this._field.type;
|
|
625
|
-
if (type !==
|
|
625
|
+
if (type !== _field_core.FieldType.MULTIPLE_RECORD_LINKS) {
|
|
626
626
|
this._invalidateQueryResult();
|
|
627
627
|
return;
|
|
628
628
|
}
|
|
@@ -23,19 +23,19 @@ Object.defineProperty(exports, "Cursor", {
|
|
|
23
23
|
Object.defineProperty(exports, "Field", {
|
|
24
24
|
enumerable: true,
|
|
25
25
|
get: function get() {
|
|
26
|
-
return
|
|
26
|
+
return _field.default;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "FieldConfig", {
|
|
30
30
|
enumerable: true,
|
|
31
31
|
get: function get() {
|
|
32
|
-
return
|
|
32
|
+
return _field_core.FieldConfig;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "FieldType", {
|
|
36
36
|
enumerable: true,
|
|
37
37
|
get: function get() {
|
|
38
|
-
return
|
|
38
|
+
return _field_core.FieldType;
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "GroupedRecordQueryResult", {
|
|
@@ -102,11 +102,11 @@ exports.recordColoring = void 0;
|
|
|
102
102
|
var recordColoring = _interopRequireWildcard(require("./record_coloring"));
|
|
103
103
|
exports.recordColoring = recordColoring;
|
|
104
104
|
var _create_aggregators = _interopRequireDefault(require("./create_aggregators"));
|
|
105
|
-
var
|
|
105
|
+
var _field_core = require("../../shared/types/field_core");
|
|
106
106
|
var _view = require("../types/view");
|
|
107
107
|
var _base = _interopRequireDefault(require("./base"));
|
|
108
108
|
var _table = _interopRequireDefault(require("./table"));
|
|
109
|
-
var
|
|
109
|
+
var _field = _interopRequireDefault(require("./field"));
|
|
110
110
|
var _view2 = _interopRequireDefault(require("./view"));
|
|
111
111
|
var _record = _interopRequireDefault(require("./record"));
|
|
112
112
|
var _record_query_result = _interopRequireDefault(require("./record_query_result"));
|
|
@@ -11,7 +11,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
11
11
|
exports.default = void 0;
|
|
12
12
|
require("core-js/modules/es.symbol.js");
|
|
13
13
|
require("core-js/modules/es.symbol.description.js");
|
|
14
|
-
require("core-js/modules/es.array.filter.js");
|
|
15
14
|
require("core-js/modules/es.array.flat-map.js");
|
|
16
15
|
require("core-js/modules/es.array.includes.js");
|
|
17
16
|
require("core-js/modules/es.array.iterator.js");
|
|
@@ -21,15 +20,14 @@ require("core-js/modules/es.object.to-string.js");
|
|
|
21
20
|
require("core-js/modules/es.set.js");
|
|
22
21
|
require("core-js/modules/es.string.includes.js");
|
|
23
22
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
24
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
25
23
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
26
24
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
27
25
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
26
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
28
27
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
28
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
30
29
|
var _airtable_interface = require("../types/airtable_interface");
|
|
31
30
|
var _mutations = require("../types/mutations");
|
|
32
|
-
var _private_utils = require("../../shared/private_utils");
|
|
33
31
|
var _error_utils = require("../../shared/error_utils");
|
|
34
32
|
var _mutation_constants = require("../../shared/types/mutation_constants");
|
|
35
33
|
var _mutations_core = require("../../shared/models/mutations_core");
|
|
@@ -46,23 +44,17 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
46
44
|
}
|
|
47
45
|
(0, _inherits2.default)(Mutations, _MutationsCore);
|
|
48
46
|
return (0, _createClass2.default)(Mutations, [{
|
|
49
|
-
key: "
|
|
47
|
+
key: "_isRecordStoreReadyForMutations",
|
|
50
48
|
value: /** @internal */
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// The "default" case cannot be reached because this method is only
|
|
61
|
-
// invoked after the mutation type has been validated.
|
|
62
|
-
// istanbul ignore next
|
|
63
|
-
default:
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
49
|
+
function _isRecordStoreReadyForMutations(recordStore) {
|
|
50
|
+
return recordStore.isRecordMetadataLoaded;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** @internal */
|
|
54
|
+
}, {
|
|
55
|
+
key: "_isFieldAvailableForMutation",
|
|
56
|
+
value: function _isFieldAvailableForMutation(recordStore, fieldId) {
|
|
57
|
+
return recordStore.areCellValuesLoadedForFieldId(fieldId);
|
|
66
58
|
}
|
|
67
59
|
|
|
68
60
|
/** @internal */
|
|
@@ -81,150 +73,33 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
81
73
|
var appInterface = this._sdk.__appInterface;
|
|
82
74
|
var billingPlanGrouping = this._base.__billingPlanGrouping;
|
|
83
75
|
switch (mutation.type) {
|
|
76
|
+
case _mutations.MutationTypes.SET_MULTIPLE_GLOBAL_CONFIG_PATHS:
|
|
84
77
|
case _mutations.MutationTypes.SET_MULTIPLE_RECORDS_CELL_VALUES:
|
|
85
|
-
{
|
|
86
|
-
var tableId = mutation.tableId,
|
|
87
|
-
records = mutation.records;
|
|
88
|
-
var table = this._base.getTableByIdIfExists(tableId);
|
|
89
|
-
if (!table) {
|
|
90
|
-
throw (0, _error_utils.spawnError)("Can't set cell values: No table with id %s exists", tableId);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// For every mutation, we check that we're not trying to set fields that we don't support
|
|
94
|
-
// mutations for yet. When record data is loaded, we also check that the record we're
|
|
95
|
-
// updating actually exists and that the cell values are valid.
|
|
96
|
-
var recordStore = this._base.__getRecordStore(tableId);
|
|
97
|
-
var checkedFieldIds = new Set();
|
|
98
|
-
var _iterator = _createForOfIteratorHelper(records),
|
|
99
|
-
_step;
|
|
100
|
-
try {
|
|
101
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
102
|
-
var record = _step.value;
|
|
103
|
-
var existingRecord = null;
|
|
104
|
-
if (recordStore.isRecordMetadataLoaded) {
|
|
105
|
-
existingRecord = recordStore.getRecordByIdIfExists(record.id);
|
|
106
|
-
if (!existingRecord) {
|
|
107
|
-
throw (0, _error_utils.spawnError)("Can't set cell values: No record with id %s exists", record.id);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
for (var _i = 0, _Object$keys = Object.keys(record.cellValuesByFieldId); _i < _Object$keys.length; _i++) {
|
|
111
|
-
var fieldId = _Object$keys[_i];
|
|
112
|
-
var field = table.getFieldByIdIfExists(fieldId);
|
|
113
|
-
if (!field) {
|
|
114
|
-
throw (0, _error_utils.spawnError)("Can't set cell values: No field with id %s exists in table '%s'", fieldId, table.name);
|
|
115
|
-
}
|
|
116
|
-
if (!checkedFieldIds.has(fieldId)) {
|
|
117
|
-
this._assertFieldIsValidForMutation(field);
|
|
118
|
-
checkedFieldIds.add(fieldId);
|
|
119
|
-
}
|
|
120
|
-
if (existingRecord && recordStore.areCellValuesLoadedForFieldId(fieldId)) {
|
|
121
|
-
var validationResult = this._airtableInterface.fieldTypeProvider.validateCellValueForUpdate(appInterface, record.cellValuesByFieldId[fieldId], existingRecord._getRawCellValue(field), field._data);
|
|
122
|
-
if (!validationResult.isValid) {
|
|
123
|
-
throw (0, _error_utils.spawnError)("Can't set cell values: invalid cell value for field '%s'.\n%s", field.name, validationResult.reason);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
} catch (err) {
|
|
129
|
-
_iterator.e(err);
|
|
130
|
-
} finally {
|
|
131
|
-
_iterator.f();
|
|
132
|
-
}
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
case _mutations.MutationTypes.DELETE_MULTIPLE_RECORDS:
|
|
136
|
-
{
|
|
137
|
-
var _tableId = mutation.tableId,
|
|
138
|
-
recordIds = mutation.recordIds;
|
|
139
|
-
var _table = this._base.getTableByIdIfExists(_tableId);
|
|
140
|
-
if (!_table) {
|
|
141
|
-
throw (0, _error_utils.spawnError)("Can't delete records: No table with id %s exists", _tableId);
|
|
142
|
-
}
|
|
143
|
-
var _recordStore = this._base.__getRecordStore(_tableId);
|
|
144
|
-
if (_recordStore.isRecordMetadataLoaded) {
|
|
145
|
-
var _iterator2 = _createForOfIteratorHelper(recordIds),
|
|
146
|
-
_step2;
|
|
147
|
-
try {
|
|
148
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
149
|
-
var recordId = _step2.value;
|
|
150
|
-
var _record = _recordStore.getRecordByIdIfExists(recordId);
|
|
151
|
-
if (!_record) {
|
|
152
|
-
throw (0, _error_utils.spawnError)("Can't delete records: No record with id %s exists in table '%s'", recordId, _table.name);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
} catch (err) {
|
|
156
|
-
_iterator2.e(err);
|
|
157
|
-
} finally {
|
|
158
|
-
_iterator2.f();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
78
|
case _mutations.MutationTypes.CREATE_MULTIPLE_RECORDS:
|
|
79
|
+
case _mutations.MutationTypes.DELETE_MULTIPLE_RECORDS:
|
|
164
80
|
{
|
|
165
|
-
|
|
166
|
-
_records = mutation.records;
|
|
167
|
-
var _checkedFieldIds = new Set();
|
|
168
|
-
var _table2 = this._base.getTableByIdIfExists(_tableId2);
|
|
169
|
-
if (!_table2) {
|
|
170
|
-
throw (0, _error_utils.spawnError)("Can't create records: No table with id %s exists", _tableId2);
|
|
171
|
-
}
|
|
172
|
-
var _iterator3 = _createForOfIteratorHelper(_records),
|
|
173
|
-
_step3;
|
|
174
|
-
try {
|
|
175
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
176
|
-
var _record2 = _step3.value;
|
|
177
|
-
for (var _i2 = 0, _Object$keys2 = Object.keys(_record2.cellValuesByFieldId); _i2 < _Object$keys2.length; _i2++) {
|
|
178
|
-
var _fieldId = _Object$keys2[_i2];
|
|
179
|
-
var _field = _table2.getFieldByIdIfExists(_fieldId);
|
|
180
|
-
if (!_field) {
|
|
181
|
-
throw (0, _error_utils.spawnError)("Can't create records: No field with id %s exists in table '%s'", _fieldId, _table2.name);
|
|
182
|
-
}
|
|
183
|
-
if (!_checkedFieldIds.has(_fieldId)) {
|
|
184
|
-
this._assertFieldIsValidForMutation(_field);
|
|
185
|
-
_checkedFieldIds.add(_fieldId);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Current cell value is null since the record doesn't exist.
|
|
189
|
-
var _validationResult = this._airtableInterface.fieldTypeProvider.validateCellValueForUpdate(appInterface, _record2.cellValuesByFieldId[_fieldId], null, _field._data);
|
|
190
|
-
if (!_validationResult.isValid) {
|
|
191
|
-
throw (0, _error_utils.spawnError)("Can't create records: invalid cell value for field '%s'.\n%s", _field.name, _validationResult.reason);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
} catch (err) {
|
|
196
|
-
_iterator3.e(err);
|
|
197
|
-
} finally {
|
|
198
|
-
_iterator3.f();
|
|
199
|
-
}
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
case _mutations.MutationTypes.SET_MULTIPLE_GLOBAL_CONFIG_PATHS:
|
|
203
|
-
{
|
|
204
|
-
// globalConfig update is a special case: globalConfig handles validation before
|
|
205
|
-
// invoking this mutation, since it relies on internal state to validate the
|
|
206
|
-
// paths being set.
|
|
81
|
+
(0, _get2.default)((0, _getPrototypeOf2.default)(Mutations.prototype), "_assertMutationIsValid", this).call(this, mutation);
|
|
207
82
|
return;
|
|
208
83
|
}
|
|
209
84
|
case _mutations.MutationTypes.CREATE_SINGLE_FIELD:
|
|
210
85
|
{
|
|
211
|
-
var
|
|
86
|
+
var tableId = mutation.tableId,
|
|
212
87
|
name = mutation.name,
|
|
213
88
|
config = mutation.config,
|
|
214
89
|
description = mutation.description;
|
|
215
|
-
var
|
|
216
|
-
if (!
|
|
217
|
-
throw (0, _error_utils.spawnError)("Can't create field: No table with id %s exists",
|
|
90
|
+
var table = this._base.getTableByIdIfExists(tableId);
|
|
91
|
+
if (!table) {
|
|
92
|
+
throw (0, _error_utils.spawnError)("Can't create field: No table with id %s exists", tableId);
|
|
218
93
|
}
|
|
219
|
-
if (
|
|
94
|
+
if (table.fields.length >= _mutation_constants.MAX_NUM_FIELDS_PER_TABLE) {
|
|
220
95
|
throw (0, _error_utils.spawnError)("Can't create field: table already has the maximum of %s fields", _mutation_constants.MAX_NUM_FIELDS_PER_TABLE);
|
|
221
96
|
}
|
|
222
|
-
this._assertFieldNameIsValidForMutation(name,
|
|
97
|
+
this._assertFieldNameIsValidForMutation(name, table);
|
|
223
98
|
|
|
224
99
|
// Current config / field data is null since the field doesn't exist.
|
|
225
|
-
var
|
|
226
|
-
if (!
|
|
227
|
-
throw (0, _error_utils.spawnError)("Can't create field: invalid field config.\n%s",
|
|
100
|
+
var validationResult = this._airtableInterface.fieldTypeProvider.validateConfigForUpdate(appInterface, config, null, null, billingPlanGrouping);
|
|
101
|
+
if (!validationResult.isValid) {
|
|
102
|
+
throw (0, _error_utils.spawnError)("Can't create field: invalid field config.\n%s", validationResult.reason);
|
|
228
103
|
}
|
|
229
104
|
if (description && description.length > _mutation_constants.MAX_FIELD_DESCRIPTION_LENGTH) {
|
|
230
105
|
throw (0, _error_utils.spawnError)("Can't create field: description exceeds maximum length of %s characters", _mutation_constants.MAX_FIELD_DESCRIPTION_LENGTH);
|
|
@@ -233,40 +108,40 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
233
108
|
}
|
|
234
109
|
case _mutations.MutationTypes.UPDATE_SINGLE_FIELD_CONFIG:
|
|
235
110
|
{
|
|
236
|
-
var
|
|
111
|
+
var _tableId = mutation.tableId,
|
|
237
112
|
id = mutation.id,
|
|
238
113
|
_config = mutation.config,
|
|
239
114
|
opts = mutation.opts;
|
|
240
|
-
var
|
|
241
|
-
if (!
|
|
242
|
-
throw (0, _error_utils.spawnError)("Can't update field: No table with id %s exists",
|
|
115
|
+
var _table = this._base.getTableByIdIfExists(_tableId);
|
|
116
|
+
if (!_table) {
|
|
117
|
+
throw (0, _error_utils.spawnError)("Can't update field: No table with id %s exists", _tableId);
|
|
243
118
|
}
|
|
244
|
-
var
|
|
245
|
-
if (!
|
|
119
|
+
var field = _table.getFieldByIdIfExists(id);
|
|
120
|
+
if (!field) {
|
|
246
121
|
throw (0, _error_utils.spawnError)("Can't update field: No field with id %s exists", id);
|
|
247
122
|
}
|
|
248
123
|
|
|
249
124
|
// we get the config directly instead of using field.type/field.options to get it
|
|
250
125
|
// in one call and because field.options returns null instead of undefined when
|
|
251
126
|
// a field does not have options, whilst we need to pass undefined
|
|
252
|
-
var currentConfig = this._airtableInterface.fieldTypeProvider.getConfig(appInterface,
|
|
253
|
-
var
|
|
254
|
-
if (!
|
|
255
|
-
throw (0, _error_utils.spawnError)("Can't update field: invalid field config.\n%s",
|
|
127
|
+
var currentConfig = this._airtableInterface.fieldTypeProvider.getConfig(appInterface, field._data, field.parentTable.__getFieldNamesById());
|
|
128
|
+
var _validationResult = this._airtableInterface.fieldTypeProvider.validateConfigForUpdate(appInterface, _config, currentConfig, field._data, billingPlanGrouping, opts);
|
|
129
|
+
if (!_validationResult.isValid) {
|
|
130
|
+
throw (0, _error_utils.spawnError)("Can't update field: invalid field config.\n%s", _validationResult.reason);
|
|
256
131
|
}
|
|
257
132
|
return;
|
|
258
133
|
}
|
|
259
134
|
case _mutations.MutationTypes.UPDATE_SINGLE_FIELD_DESCRIPTION:
|
|
260
135
|
{
|
|
261
|
-
var
|
|
136
|
+
var _tableId2 = mutation.tableId,
|
|
262
137
|
_id = mutation.id,
|
|
263
138
|
_description = mutation.description;
|
|
264
|
-
var
|
|
265
|
-
if (!
|
|
266
|
-
throw (0, _error_utils.spawnError)("Can't update field: No table with id %s exists",
|
|
139
|
+
var _table2 = this._base.getTableByIdIfExists(_tableId2);
|
|
140
|
+
if (!_table2) {
|
|
141
|
+
throw (0, _error_utils.spawnError)("Can't update field: No table with id %s exists", _tableId2);
|
|
267
142
|
}
|
|
268
|
-
var
|
|
269
|
-
if (!
|
|
143
|
+
var _field = _table2.getFieldByIdIfExists(_id);
|
|
144
|
+
if (!_field) {
|
|
270
145
|
throw (0, _error_utils.spawnError)("Can't update field: No field with id %s exists", _id);
|
|
271
146
|
}
|
|
272
147
|
if (_description && _description.length > _mutation_constants.MAX_FIELD_DESCRIPTION_LENGTH) {
|
|
@@ -276,23 +151,23 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
276
151
|
}
|
|
277
152
|
case _mutations.MutationTypes.UPDATE_SINGLE_FIELD_NAME:
|
|
278
153
|
{
|
|
279
|
-
var
|
|
154
|
+
var _tableId3 = mutation.tableId,
|
|
280
155
|
_id2 = mutation.id,
|
|
281
156
|
_name = mutation.name;
|
|
282
|
-
var
|
|
283
|
-
if (!
|
|
284
|
-
throw (0, _error_utils.spawnError)("Can't update field: No table with id %s exists",
|
|
157
|
+
var _table3 = this._base.getTableByIdIfExists(_tableId3);
|
|
158
|
+
if (!_table3) {
|
|
159
|
+
throw (0, _error_utils.spawnError)("Can't update field: No table with id %s exists", _tableId3);
|
|
285
160
|
}
|
|
286
|
-
var
|
|
287
|
-
if (!
|
|
161
|
+
var _field2 = _table3.getFieldByIdIfExists(_id2);
|
|
162
|
+
if (!_field2) {
|
|
288
163
|
throw (0, _error_utils.spawnError)("Can't update field: No field with id %s exists", _id2);
|
|
289
164
|
}
|
|
290
165
|
|
|
291
166
|
// We skip name validation if it's the same name:
|
|
292
167
|
// If it's exactly same name, this will result in no-op;
|
|
293
168
|
// If it's only case change, we allow update and we know this name is already validated before;
|
|
294
|
-
if (
|
|
295
|
-
this._assertFieldNameIsValidForMutation(_name,
|
|
169
|
+
if (_field2.name.toLowerCase() !== _name.toLowerCase()) {
|
|
170
|
+
this._assertFieldNameIsValidForMutation(_name, _table3);
|
|
296
171
|
}
|
|
297
172
|
return;
|
|
298
173
|
}
|
|
@@ -317,36 +192,36 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
317
192
|
throw (0, _error_utils.spawnError)("Can't create table: number of fields exceeds maximum of %s", _mutation_constants.MAX_NUM_FIELDS_PER_TABLE);
|
|
318
193
|
}
|
|
319
194
|
var lowercaseFieldNames = new Set();
|
|
320
|
-
var
|
|
321
|
-
|
|
195
|
+
var _iterator = _createForOfIteratorHelper(fields),
|
|
196
|
+
_step;
|
|
322
197
|
try {
|
|
323
|
-
for (
|
|
324
|
-
var
|
|
325
|
-
if (!
|
|
198
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
199
|
+
var _field3 = _step.value;
|
|
200
|
+
if (!_field3.name) {
|
|
326
201
|
throw (0, _error_utils.spawnError)("Can't create table: must provide non-empty name for every field");
|
|
327
202
|
}
|
|
328
|
-
if (
|
|
329
|
-
throw (0, _error_utils.spawnError)("Can't create table: field name '%s' exceeds maximum length of %s characters",
|
|
203
|
+
if (_field3.name.length > _mutation_constants.MAX_FIELD_NAME_LENGTH) {
|
|
204
|
+
throw (0, _error_utils.spawnError)("Can't create table: field name '%s' exceeds maximum length of %s characters", _field3.name, _mutation_constants.MAX_FIELD_NAME_LENGTH);
|
|
330
205
|
}
|
|
331
|
-
var lowercaseFieldName =
|
|
206
|
+
var lowercaseFieldName = _field3.name.toLowerCase();
|
|
332
207
|
if (lowercaseFieldNames.has(lowercaseFieldName)) {
|
|
333
|
-
throw (0, _error_utils.spawnError)("Can't create table: duplicate field name '%s'",
|
|
208
|
+
throw (0, _error_utils.spawnError)("Can't create table: duplicate field name '%s'", _field3.name);
|
|
334
209
|
}
|
|
335
210
|
lowercaseFieldNames.add(lowercaseFieldName);
|
|
336
211
|
|
|
337
212
|
// Current config / field data is null since the field doesn't exist.
|
|
338
|
-
var
|
|
339
|
-
if (!
|
|
340
|
-
throw (0, _error_utils.spawnError)("Can't create table: invalid field config for field '%s'.\n%s",
|
|
213
|
+
var _validationResult2 = this._airtableInterface.fieldTypeProvider.validateConfigForUpdate(appInterface, _field3.config, null, null, billingPlanGrouping);
|
|
214
|
+
if (!_validationResult2.isValid) {
|
|
215
|
+
throw (0, _error_utils.spawnError)("Can't create table: invalid field config for field '%s'.\n%s", _field3.name, _validationResult2.reason);
|
|
341
216
|
}
|
|
342
|
-
if (
|
|
343
|
-
throw (0, _error_utils.spawnError)("Can't create table: description for field '%s' exceeds maximum length of %s characters",
|
|
217
|
+
if (_field3.description && _field3.description.length > _mutation_constants.MAX_FIELD_DESCRIPTION_LENGTH) {
|
|
218
|
+
throw (0, _error_utils.spawnError)("Can't create table: description for field '%s' exceeds maximum length of %s characters", _field3.name, _mutation_constants.MAX_FIELD_DESCRIPTION_LENGTH);
|
|
344
219
|
}
|
|
345
220
|
}
|
|
346
221
|
} catch (err) {
|
|
347
|
-
|
|
222
|
+
_iterator.e(err);
|
|
348
223
|
} finally {
|
|
349
|
-
|
|
224
|
+
_iterator.f();
|
|
350
225
|
}
|
|
351
226
|
var primaryField = fields[0];
|
|
352
227
|
if (!this._airtableInterface.fieldTypeProvider.canBePrimary(appInterface, primaryField.config, billingPlanGrouping)) {
|
|
@@ -356,20 +231,20 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
356
231
|
}
|
|
357
232
|
case _mutations.MutationTypes.UPDATE_VIEW_METADATA:
|
|
358
233
|
{
|
|
359
|
-
var
|
|
234
|
+
var _tableId4 = mutation.tableId,
|
|
360
235
|
viewId = mutation.viewId;
|
|
361
236
|
var runContext = this._airtableInterface.sdkInitData.runContext;
|
|
362
237
|
if (runContext.type !== _airtable_interface.BlockRunContextType.VIEW) {
|
|
363
238
|
throw (0, _error_utils.spawnError)('Setting view metadata is only valid for views');
|
|
364
239
|
}
|
|
365
|
-
if (runContext.viewId !== viewId || runContext.tableId !==
|
|
240
|
+
if (runContext.viewId !== viewId || runContext.tableId !== _tableId4) {
|
|
366
241
|
throw (0, _error_utils.spawnError)('Custom views can only set view metadata on themselves');
|
|
367
242
|
}
|
|
368
|
-
var
|
|
369
|
-
if (!
|
|
370
|
-
throw (0, _error_utils.spawnError)("Can't update metadata: No table with id %s exists",
|
|
243
|
+
var _table4 = this._base.getTableByIdIfExists(_tableId4);
|
|
244
|
+
if (!_table4) {
|
|
245
|
+
throw (0, _error_utils.spawnError)("Can't update metadata: No table with id %s exists", _tableId4);
|
|
371
246
|
}
|
|
372
|
-
var view =
|
|
247
|
+
var view = _table4.getViewByIdIfExists(viewId);
|
|
373
248
|
if (!view) {
|
|
374
249
|
throw (0, _error_utils.spawnError)("Can't update metadata: No view with id %s exists", viewId);
|
|
375
250
|
}
|
|
@@ -380,15 +255,6 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
380
255
|
}
|
|
381
256
|
}
|
|
382
257
|
|
|
383
|
-
/** @internal */
|
|
384
|
-
}, {
|
|
385
|
-
key: "_assertFieldIsValidForMutation",
|
|
386
|
-
value: function _assertFieldIsValidForMutation(field) {
|
|
387
|
-
if (field.isComputed) {
|
|
388
|
-
throw (0, _error_utils.spawnError)("Can't set cell values: Field '%s' is computed and cannot be set", field.name);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
258
|
/** @internal */
|
|
393
259
|
}, {
|
|
394
260
|
key: "_assertFieldNameIsValidForMutation",
|
|
@@ -412,87 +278,43 @@ var Mutations = /*#__PURE__*/function (_MutationsCore) {
|
|
|
412
278
|
key: "_getOptimisticModelChangesForMutation",
|
|
413
279
|
value: function _getOptimisticModelChangesForMutation(mutation) {
|
|
414
280
|
switch (mutation.type) {
|
|
281
|
+
case _mutations.MutationTypes.SET_MULTIPLE_GLOBAL_CONFIG_PATHS:
|
|
415
282
|
case _mutations.MutationTypes.SET_MULTIPLE_RECORDS_CELL_VALUES:
|
|
283
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(Mutations.prototype), "_getOptimisticModelChangesForMutation", this).call(this, mutation);
|
|
284
|
+
case _mutations.MutationTypes.CREATE_MULTIPLE_RECORDS:
|
|
416
285
|
{
|
|
417
286
|
var tableId = mutation.tableId,
|
|
418
287
|
records = mutation.records;
|
|
419
288
|
var recordStore = this._base.__getRecordStore(tableId);
|
|
420
|
-
|
|
421
|
-
path: ['tablesById', tableId, 'recordsById', record.id, 'cellValuesByFieldId', fieldId],
|
|
422
|
-
value: record.cellValuesByFieldId[fieldId]
|
|
423
|
-
})));
|
|
424
|
-
}
|
|
425
|
-
case _mutations.MutationTypes.DELETE_MULTIPLE_RECORDS:
|
|
426
|
-
{
|
|
427
|
-
var _tableId8 = mutation.tableId,
|
|
428
|
-
recordIds = mutation.recordIds;
|
|
429
|
-
var _recordStore2 = this._base.__getRecordStore(_tableId8);
|
|
430
|
-
if (!_recordStore2.isRecordMetadataLoaded) {
|
|
289
|
+
if (!recordStore.isRecordMetadataLoaded) {
|
|
431
290
|
return [];
|
|
432
291
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
})), ...this._base.getTableById(_tableId8).views.flatMap(view => {
|
|
437
|
-
var viewDataStore = _recordStore2.getViewDataStore(view.id);
|
|
292
|
+
var superChanges = (0, _get2.default)((0, _getPrototypeOf2.default)(Mutations.prototype), "_getOptimisticModelChangesForMutation", this).call(this, mutation);
|
|
293
|
+
return [...superChanges, ...this._base.getTableById(tableId).views.flatMap(view => {
|
|
294
|
+
var viewDataStore = recordStore.getViewDataStore(view.id);
|
|
438
295
|
if (!viewDataStore.isDataLoaded) {
|
|
439
296
|
return [];
|
|
440
297
|
}
|
|
441
|
-
return viewDataStore.
|
|
298
|
+
return viewDataStore.__generateChangesForParentTableAddMultipleRecords(records.map(record => record.id));
|
|
442
299
|
})];
|
|
443
300
|
}
|
|
444
|
-
case _mutations.MutationTypes.
|
|
301
|
+
case _mutations.MutationTypes.DELETE_MULTIPLE_RECORDS:
|
|
445
302
|
{
|
|
446
|
-
var
|
|
447
|
-
|
|
448
|
-
var
|
|
449
|
-
if (!
|
|
303
|
+
var _tableId5 = mutation.tableId,
|
|
304
|
+
recordIds = mutation.recordIds;
|
|
305
|
+
var _recordStore = this._base.__getRecordStore(_tableId5);
|
|
306
|
+
if (!_recordStore.isRecordMetadataLoaded) {
|
|
450
307
|
return [];
|
|
451
308
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
var
|
|
455
|
-
var _iterator5 = _createForOfIteratorHelper((0, _private_utils.entries)(record.cellValuesByFieldId)),
|
|
456
|
-
_step5;
|
|
457
|
-
try {
|
|
458
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
459
|
-
var _step5$value = (0, _slicedToArray2.default)(_step5.value, 2),
|
|
460
|
-
fieldId = _step5$value[0],
|
|
461
|
-
cellValue = _step5$value[1];
|
|
462
|
-
if (_recordStore3.areCellValuesLoadedForFieldId(fieldId)) {
|
|
463
|
-
filteredCellValuesByFieldId[fieldId] = cellValue;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
} catch (err) {
|
|
467
|
-
_iterator5.e(err);
|
|
468
|
-
} finally {
|
|
469
|
-
_iterator5.f();
|
|
470
|
-
}
|
|
471
|
-
return {
|
|
472
|
-
path: ['tablesById', _tableId9, 'recordsById', record.id],
|
|
473
|
-
value: {
|
|
474
|
-
id: record.id,
|
|
475
|
-
cellValuesByFieldId: filteredCellValuesByFieldId,
|
|
476
|
-
commentCount: 0,
|
|
477
|
-
createdTime: new Date().toJSON()
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
}), ...this._base.getTableById(_tableId9).views.flatMap(view => {
|
|
481
|
-
var viewDataStore = _recordStore3.getViewDataStore(view.id);
|
|
309
|
+
var _superChanges = (0, _get2.default)((0, _getPrototypeOf2.default)(Mutations.prototype), "_getOptimisticModelChangesForMutation", this).call(this, mutation);
|
|
310
|
+
return [..._superChanges, ...this._base.getTableById(_tableId5).views.flatMap(view => {
|
|
311
|
+
var viewDataStore = _recordStore.getViewDataStore(view.id);
|
|
482
312
|
if (!viewDataStore.isDataLoaded) {
|
|
483
313
|
return [];
|
|
484
314
|
}
|
|
485
|
-
return viewDataStore.
|
|
315
|
+
return viewDataStore.__generateChangesForParentTableDeleteMultipleRecords(recordIds);
|
|
486
316
|
})];
|
|
487
317
|
}
|
|
488
|
-
|
|
489
|
-
// The following branch is unreachable because this method's only
|
|
490
|
-
// call site is preceded by an explicit guard for this condition.
|
|
491
|
-
// istanbul ignore next
|
|
492
|
-
case _mutations.MutationTypes.SET_MULTIPLE_GLOBAL_CONFIG_PATHS:
|
|
493
|
-
{
|
|
494
|
-
throw (0, _error_utils.spawnError)('attempting to generate model updates for SET_MULTIPLE_GLOBAL_CONFIG_PATH');
|
|
495
|
-
}
|
|
496
318
|
case _mutations.MutationTypes.CREATE_SINGLE_FIELD:
|
|
497
319
|
case _mutations.MutationTypes.UPDATE_SINGLE_FIELD_CONFIG:
|
|
498
320
|
case _mutations.MutationTypes.UPDATE_SINGLE_FIELD_DESCRIPTION:
|
|
@@ -28,11 +28,11 @@ require("core-js/modules/es.array.concat.js");
|
|
|
28
28
|
require("core-js/modules/es.array.map.js");
|
|
29
29
|
require("core-js/modules/es.string.starts-with.js");
|
|
30
30
|
var _colors = _interopRequireDefault(require("../../shared/colors"));
|
|
31
|
-
var
|
|
31
|
+
var _field_core = require("../../shared/types/field_core");
|
|
32
32
|
var _private_utils = require("../../shared/private_utils");
|
|
33
33
|
var _error_utils = require("../../shared/error_utils");
|
|
34
34
|
var _abstract_model_with_async_data = _interopRequireDefault(require("./abstract_model_with_async_data"));
|
|
35
|
-
var
|
|
35
|
+
var _field = _interopRequireDefault(require("./field"));
|
|
36
36
|
var _record_coloring = require("./record_coloring");
|
|
37
37
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
38
38
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -406,7 +406,7 @@ var RecordQueryResult = /*#__PURE__*/function (_AbstractModelWithAsy) {
|
|
|
406
406
|
return null;
|
|
407
407
|
case _record_coloring.ModeTypes.BY_SELECT_FIELD:
|
|
408
408
|
{
|
|
409
|
-
if (recordColorMode.selectField.type !==
|
|
409
|
+
if (recordColorMode.selectField.type !== _field_core.FieldType.SINGLE_SELECT) {
|
|
410
410
|
return null;
|
|
411
411
|
}
|
|
412
412
|
var value = record.getCellValue(recordColorMode.selectField);
|
|
@@ -690,7 +690,7 @@ var RecordQueryResult = /*#__PURE__*/function (_AbstractModelWithAsy) {
|
|
|
690
690
|
// can conveniently list conditional fields, e.g. [field1, isFoo && field2]
|
|
691
691
|
continue;
|
|
692
692
|
}
|
|
693
|
-
if (typeof fieldOrFieldIdOrFieldName !== 'string' && !(fieldOrFieldIdOrFieldName instanceof
|
|
693
|
+
if (typeof fieldOrFieldIdOrFieldName !== 'string' && !(fieldOrFieldIdOrFieldName instanceof _field.default)) {
|
|
694
694
|
throw (0, _error_utils.spawnError)('Invalid value for field, expected a field, id, or name but got: %s', fieldOrFieldIdOrFieldName);
|
|
695
695
|
}
|
|
696
696
|
var field = table.__getFieldMatching(fieldOrFieldIdOrFieldName);
|
|
@@ -707,7 +707,7 @@ var RecordQueryResult = /*#__PURE__*/function (_AbstractModelWithAsy) {
|
|
|
707
707
|
case _record_coloring.ModeTypes.NONE:
|
|
708
708
|
break;
|
|
709
709
|
case _record_coloring.ModeTypes.BY_SELECT_FIELD:
|
|
710
|
-
(0, _error_utils.invariant)(recordColorMode.selectField.type ===
|
|
710
|
+
(0, _error_utils.invariant)(recordColorMode.selectField.type === _field_core.FieldType.SINGLE_SELECT, 'Invalid field for coloring records by select field: expected a %s, but got a %s', _field_core.FieldType.SINGLE_SELECT, recordColorMode.selectField.type);
|
|
711
711
|
(0, _error_utils.invariant)(recordColorMode.selectField.parentTable === table, 'Invalid field for coloring records by select field: the single select field is not in the same table as the records');
|
|
712
712
|
if (fieldIdsOrNullIfAllFields) {
|
|
713
713
|
fieldIdsOrNullIfAllFields.push(recordColorMode.selectField.id);
|