@airtable/blocks 1.18.1 → 1.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/dist/cjs/color_utils.js +21 -23
- package/dist/cjs/colors.js +4 -60
- package/dist/cjs/error_utils.js +15 -25
- package/dist/cjs/event_tracker.js +5 -11
- package/dist/cjs/global_config.js +107 -188
- package/dist/cjs/index.js +16 -40
- package/dist/cjs/injected/airtable_interface.js +1 -6
- package/dist/cjs/models/abstract_model.js +50 -81
- package/dist/cjs/models/abstract_model_with_async_data.js +102 -177
- package/dist/cjs/models/base.js +211 -374
- package/dist/cjs/models/create_aggregators.js +53 -47
- package/dist/cjs/models/cursor.js +125 -201
- package/dist/cjs/models/field.js +256 -303
- package/dist/cjs/models/grouped_record_query_result.js +210 -286
- package/dist/cjs/models/linked_records_query_result.js +276 -454
- package/dist/cjs/models/models.js +36 -50
- package/dist/cjs/models/mutation_constants.js +5 -9
- package/dist/cjs/models/mutations.js +125 -338
- package/dist/cjs/models/object_pool.js +37 -94
- package/dist/cjs/models/record.js +132 -226
- package/dist/cjs/models/record_coloring.js +14 -19
- package/dist/cjs/models/record_query_result.js +323 -282
- package/dist/cjs/models/record_store.js +355 -688
- package/dist/cjs/models/session.js +99 -158
- package/dist/cjs/models/table.js +361 -549
- package/dist/cjs/models/table_or_view_query_result.js +410 -765
- package/dist/cjs/models/view.js +161 -204
- package/dist/cjs/models/view_data_store.js +177 -282
- package/dist/cjs/models/view_metadata_query_result.js +96 -127
- package/dist/cjs/perform_record_action.js +69 -103
- package/dist/cjs/private_utils.js +133 -223
- package/dist/cjs/sdk.js +97 -142
- package/dist/cjs/settings_button.js +30 -57
- package/dist/cjs/stats/block_stats.js +3 -15
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +53 -97
- package/dist/cjs/types/airtable_interface.js +36 -8
- package/dist/cjs/types/field.js +66 -12
- package/dist/cjs/types/mutations.js +99 -6
- package/dist/cjs/types/permission_levels.js +2 -4
- package/dist/cjs/types/undo_redo.js +2 -3
- package/dist/cjs/types/view.js +16 -11
- package/dist/cjs/ui/base_provider.js +14 -9
- package/dist/cjs/ui/baymax_utils.js +107 -1102
- package/dist/cjs/ui/block_wrapper.js +30 -68
- package/dist/cjs/ui/box.js +52 -56
- package/dist/cjs/ui/button.js +60 -77
- package/dist/cjs/ui/cell_renderer.js +78 -139
- package/dist/cjs/ui/choice_token.js +45 -47
- package/dist/cjs/ui/collaborator_token.js +33 -54
- package/dist/cjs/ui/color_palette.js +58 -106
- package/dist/cjs/ui/color_palette_synced.js +41 -52
- package/dist/cjs/ui/confirmation_dialog.js +53 -69
- package/dist/cjs/ui/control_sizes.js +21 -46
- package/dist/cjs/ui/create_detect_element_resize.js +16 -50
- package/dist/cjs/ui/css_helpers.js +3 -10
- package/dist/cjs/ui/dialog.js +44 -71
- package/dist/cjs/ui/dialog_close_button.js +52 -72
- package/dist/cjs/ui/expand_record.js +4 -11
- package/dist/cjs/ui/expand_record_list.js +6 -11
- package/dist/cjs/ui/expand_record_picker_async.js +18 -35
- package/dist/cjs/ui/field_icon.js +25 -28
- package/dist/cjs/ui/field_picker.js +47 -81
- package/dist/cjs/ui/field_picker_synced.js +33 -44
- package/dist/cjs/ui/form_field.js +45 -64
- package/dist/cjs/ui/geometry/geometry.js +6 -10
- package/dist/cjs/ui/geometry/point.js +5 -13
- package/dist/cjs/ui/geometry/rect.js +7 -29
- package/dist/cjs/ui/geometry/size.js +5 -13
- package/dist/cjs/ui/global_alert.js +35 -61
- package/dist/cjs/ui/global_config_synced_component_helpers.js +4 -13
- package/dist/cjs/ui/heading.js +63 -92
- package/dist/cjs/ui/icon.js +44 -66
- package/dist/cjs/ui/icon_config.js +13 -24
- package/dist/cjs/ui/initialize_block.js +23 -36
- package/dist/cjs/ui/input.js +74 -87
- package/dist/cjs/ui/input_synced.js +34 -43
- package/dist/cjs/ui/key_codes.js +4 -9
- package/dist/cjs/ui/label.js +45 -50
- package/dist/cjs/ui/link.js +74 -89
- package/dist/cjs/ui/loader.js +26 -42
- package/dist/cjs/ui/modal.js +63 -89
- package/dist/cjs/ui/model_picker_select.js +29 -47
- package/dist/cjs/ui/popover.js +98 -180
- package/dist/cjs/ui/progress_bar.js +45 -51
- package/dist/cjs/ui/record_card.js +143 -278
- package/dist/cjs/ui/record_card_list.js +117 -165
- package/dist/cjs/ui/remote_utils.js +5 -13
- package/dist/cjs/ui/sdk_context.js +7 -9
- package/dist/cjs/ui/select.js +84 -118
- package/dist/cjs/ui/select_and_select_buttons_helpers.js +27 -45
- package/dist/cjs/ui/select_buttons.js +54 -90
- package/dist/cjs/ui/select_buttons_synced.js +32 -41
- package/dist/cjs/ui/select_synced.js +32 -42
- package/dist/cjs/ui/switch.js +66 -84
- package/dist/cjs/ui/switch_synced.js +32 -38
- package/dist/cjs/ui/synced.js +16 -43
- package/dist/cjs/ui/system/all_styles_set.js +89 -22
- package/dist/cjs/ui/system/appearance/appearance_set.js +15 -26
- package/dist/cjs/ui/system/appearance/background_color.js +6 -12
- package/dist/cjs/ui/system/appearance/border.js +6 -12
- package/dist/cjs/ui/system/appearance/border_radius.js +6 -12
- package/dist/cjs/ui/system/appearance/box_shadow.js +6 -12
- package/dist/cjs/ui/system/appearance/opacity.js +5 -11
- package/dist/cjs/ui/system/dimensions/dimensions_set.js +15 -27
- package/dist/cjs/ui/system/dimensions/height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/width.js +5 -11
- package/dist/cjs/ui/system/display.js +8 -9
- package/dist/cjs/ui/system/flex_container/align_content.js +6 -12
- package/dist/cjs/ui/system/flex_container/align_items.js +6 -12
- package/dist/cjs/ui/system/flex_container/flex_container_set.js +15 -27
- package/dist/cjs/ui/system/flex_container/flex_direction.js +5 -11
- package/dist/cjs/ui/system/flex_container/flex_wrap.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_content.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_items.js +5 -11
- package/dist/cjs/ui/system/flex_item/align_self.js +6 -12
- package/dist/cjs/ui/system/flex_item/flex.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_basis.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_grow.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_item_set.js +15 -28
- package/dist/cjs/ui/system/flex_item/flex_shrink.js +5 -11
- package/dist/cjs/ui/system/flex_item/justify_self.js +5 -11
- package/dist/cjs/ui/system/flex_item/order.js +5 -11
- package/dist/cjs/ui/system/index.js +310 -362
- package/dist/cjs/ui/system/overflow.js +8 -9
- package/dist/cjs/ui/system/position/bottom.js +6 -13
- package/dist/cjs/ui/system/position/left.js +5 -12
- package/dist/cjs/ui/system/position/position.js +5 -11
- package/dist/cjs/ui/system/position/position_set.js +15 -27
- package/dist/cjs/ui/system/position/right.js +5 -12
- package/dist/cjs/ui/system/position/top.js +5 -12
- package/dist/cjs/ui/system/position/z_index.js +5 -11
- package/dist/cjs/ui/system/spacing/margin.js +5 -12
- package/dist/cjs/ui/system/spacing/padding.js +5 -12
- package/dist/cjs/ui/system/spacing/spacing_set.js +15 -23
- package/dist/cjs/ui/system/typography/font_family.js +5 -11
- package/dist/cjs/ui/system/typography/font_size.js +5 -11
- package/dist/cjs/ui/system/typography/font_style.js +5 -11
- package/dist/cjs/ui/system/typography/font_weight.js +5 -11
- package/dist/cjs/ui/system/typography/letter_spacing.js +5 -11
- package/dist/cjs/ui/system/typography/line_height.js +5 -11
- package/dist/cjs/ui/system/typography/text_align.js +5 -11
- package/dist/cjs/ui/system/typography/text_color.js +5 -11
- package/dist/cjs/ui/system/typography/text_decoration.js +5 -11
- package/dist/cjs/ui/system/typography/text_transform.js +5 -11
- package/dist/cjs/ui/system/typography/typography_set.js +15 -31
- package/dist/cjs/ui/system/utils/create_responsive_prop_type.js +2 -4
- package/dist/cjs/ui/system/utils/create_style_prop_types.js +5 -13
- package/dist/cjs/ui/system/utils/ensure_numbers_are_within_scale.js +2 -14
- package/dist/cjs/ui/system/utils/get_style_props_for_responsive_prop.js +30 -70
- package/dist/cjs/ui/table_picker.js +26 -43
- package/dist/cjs/ui/table_picker_synced.js +33 -42
- package/dist/cjs/ui/text.js +59 -71
- package/dist/cjs/ui/text_button.js +80 -97
- package/dist/cjs/ui/theme/default_theme/button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/control_sizes.js +29 -42
- package/dist/cjs/ui/theme/default_theme/heading_styles.js +4 -5
- package/dist/cjs/ui/theme/default_theme/index.js +15 -32
- package/dist/cjs/ui/theme/default_theme/input_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/link_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_buttons_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_variants.js +10 -21
- package/dist/cjs/ui/theme/default_theme/switch_variants.js +8 -20
- package/dist/cjs/ui/theme/default_theme/text_button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/text_styles.js +1 -2
- package/dist/cjs/ui/theme/default_theme/tokens.js +33 -35
- package/dist/cjs/ui/theme/theme_context.js +3 -6
- package/dist/cjs/ui/theme/use_theme.js +1 -7
- package/dist/cjs/ui/tooltip.js +38 -79
- package/dist/cjs/ui/types/aria_props.js +3 -7
- package/dist/cjs/ui/types/data_attributes_prop.js +8 -6
- package/dist/cjs/ui/types/tooltip_anchor_props.js +4 -5
- package/dist/cjs/ui/ui.js +89 -130
- package/dist/cjs/ui/unstable_standalone_ui.js +18 -42
- package/dist/cjs/ui/use_array_identity.js +0 -4
- package/dist/cjs/ui/use_base.js +4 -13
- package/dist/cjs/ui/use_cursor.js +3 -12
- package/dist/cjs/ui/use_form_field.js +4 -6
- package/dist/cjs/ui/use_global_config.js +3 -10
- package/dist/cjs/ui/use_loadable.js +59 -132
- package/dist/cjs/ui/use_record_action_data.js +6 -12
- package/dist/cjs/ui/use_records.js +23 -24
- package/dist/cjs/ui/use_session.js +6 -15
- package/dist/cjs/ui/use_settings_button.js +4 -11
- package/dist/cjs/ui/use_styled_system.js +12 -21
- package/dist/cjs/ui/use_synced.js +0 -7
- package/dist/cjs/ui/use_text_color_for_background_color.js +1 -5
- package/dist/cjs/ui/use_view_metadata.js +5 -8
- package/dist/cjs/ui/use_viewport.js +1 -7
- package/dist/cjs/ui/use_watchable.js +36 -74
- package/dist/cjs/ui/view_picker.js +44 -78
- package/dist/cjs/ui/view_picker_synced.js +33 -44
- package/dist/cjs/ui/viewport_constraint.js +37 -64
- package/dist/cjs/ui/with_hooks.js +17 -22
- package/dist/cjs/ui/with_styled_system.js +33 -60
- package/dist/cjs/undo_redo.js +12 -32
- package/dist/cjs/unstable_private_utils.js +6 -8
- package/dist/cjs/unstable_testing_utils.js +44 -57
- package/dist/cjs/viewport.js +127 -189
- package/dist/cjs/warning.js +5 -6
- package/dist/cjs/watchable.js +66 -148
- package/dist/types/src/colors.d.ts +1 -1
- package/dist/types/src/colors.d.ts.map +1 -1
- package/dist/types/src/global_config.d.ts +1 -1
- package/dist/types/src/global_config.d.ts.map +1 -1
- package/dist/types/src/models/base.d.ts +1 -1
- package/dist/types/src/models/base.d.ts.map +1 -1
- package/dist/types/src/models/cursor.d.ts +1 -1
- package/dist/types/src/models/cursor.d.ts.map +1 -1
- package/dist/types/src/models/field.d.ts +1 -1
- package/dist/types/src/models/field.d.ts.map +1 -1
- package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
- package/dist/types/src/models/models.d.ts.map +1 -1
- package/dist/types/src/models/record.d.ts +1 -1
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_coloring.d.ts +2 -2
- package/dist/types/src/models/record_coloring.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +3 -3
- package/dist/types/src/models/record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/session.d.ts +1 -1
- package/dist/types/src/models/session.d.ts.map +1 -1
- package/dist/types/src/models/table.d.ts +1 -1
- package/dist/types/src/models/table.d.ts.map +1 -1
- package/dist/types/src/models/view.d.ts +1 -1
- package/dist/types/src/models/view.d.ts.map +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts +2 -2
- package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
- package/dist/types/src/perform_record_action.d.ts +1 -1
- package/dist/types/src/perform_record_action.d.ts.map +1 -1
- package/dist/types/src/private_utils.d.ts +8 -8
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +1 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/settings_button.d.ts +1 -1
- package/dist/types/src/settings_button.d.ts.map +1 -1
- package/dist/types/src/types/aggregators.d.ts +1 -1
- package/dist/types/src/types/aggregators.d.ts.map +1 -1
- package/dist/types/src/types/airtable_interface.d.ts +6 -6
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/attachment.d.ts +1 -1
- package/dist/types/src/types/attachment.d.ts.map +1 -1
- package/dist/types/src/types/base.d.ts +1 -1
- package/dist/types/src/types/base.d.ts.map +1 -1
- package/dist/types/src/types/block.d.ts +1 -1
- package/dist/types/src/types/block.d.ts.map +1 -1
- package/dist/types/src/types/collaborator.d.ts +1 -1
- package/dist/types/src/types/collaborator.d.ts.map +1 -1
- package/dist/types/src/types/field.d.ts +5 -5
- package/dist/types/src/types/field.d.ts.map +1 -1
- package/dist/types/src/types/global_config.d.ts +6 -6
- package/dist/types/src/types/global_config.d.ts.map +1 -1
- package/dist/types/src/types/mutations.d.ts +4 -4
- package/dist/types/src/types/mutations.d.ts.map +1 -1
- package/dist/types/src/types/permission_levels.d.ts +1 -1
- package/dist/types/src/types/permission_levels.d.ts.map +1 -1
- package/dist/types/src/types/record.d.ts +2 -2
- package/dist/types/src/types/record.d.ts.map +1 -1
- package/dist/types/src/types/record_action_data.d.ts +1 -1
- package/dist/types/src/types/record_action_data.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +3 -3
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/undo_redo.d.ts +1 -1
- package/dist/types/src/types/undo_redo.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +4 -4
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/base_provider.d.ts +1 -1
- package/dist/types/src/ui/base_provider.d.ts.map +1 -1
- package/dist/types/src/ui/block_wrapper.d.ts +2 -2
- package/dist/types/src/ui/button.d.ts +1 -1
- package/dist/types/src/ui/button.d.ts.map +1 -1
- package/dist/types/src/ui/cell_renderer.d.ts +2 -2
- package/dist/types/src/ui/choice_token.d.ts +3 -3
- package/dist/types/src/ui/choice_token.d.ts.map +1 -1
- package/dist/types/src/ui/collaborator_token.d.ts +5 -5
- package/dist/types/src/ui/collaborator_token.d.ts.map +1 -1
- package/dist/types/src/ui/color_palette.d.ts +2 -2
- package/dist/types/src/ui/color_palette_synced.d.ts +2 -2
- package/dist/types/src/ui/confirmation_dialog.d.ts +1 -1
- package/dist/types/src/ui/control_sizes.d.ts +2 -2
- package/dist/types/src/ui/control_sizes.d.ts.map +1 -1
- package/dist/types/src/ui/dialog.d.ts +2 -2
- package/dist/types/src/ui/dialog.d.ts.map +1 -1
- package/dist/types/src/ui/dialog_close_button.d.ts +1 -1
- package/dist/types/src/ui/field_icon.d.ts +3 -3
- package/dist/types/src/ui/field_icon.d.ts.map +1 -1
- package/dist/types/src/ui/field_picker.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts.map +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/heading.d.ts +3 -3
- package/dist/types/src/ui/heading.d.ts.map +1 -1
- package/dist/types/src/ui/icon.d.ts +1 -1
- package/dist/types/src/ui/icon_config.d.ts +39 -39
- package/dist/types/src/ui/icon_config.d.ts.map +1 -1
- package/dist/types/src/ui/initialize_block.d.ts +3 -3
- package/dist/types/src/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/ui/input.d.ts +15 -15
- package/dist/types/src/ui/input.d.ts.map +1 -1
- package/dist/types/src/ui/link.d.ts +1 -1
- package/dist/types/src/ui/link.d.ts.map +1 -1
- package/dist/types/src/ui/loader.d.ts +1 -1
- package/dist/types/src/ui/loader.d.ts.map +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts.map +1 -1
- package/dist/types/src/ui/popover.d.ts +5 -5
- package/dist/types/src/ui/popover.d.ts.map +1 -1
- package/dist/types/src/ui/progress_bar.d.ts +1 -1
- package/dist/types/src/ui/progress_bar.d.ts.map +1 -1
- package/dist/types/src/ui/record_card.d.ts +2 -2
- package/dist/types/src/ui/record_card.d.ts.map +1 -1
- package/dist/types/src/ui/record_card_list.d.ts +1 -1
- package/dist/types/src/ui/select.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/select_buttons.d.ts +4 -4
- package/dist/types/src/ui/switch.d.ts +1 -1
- package/dist/types/src/ui/switch.d.ts.map +1 -1
- package/dist/types/src/ui/synced.d.ts +3 -3
- package/dist/types/src/ui/system/all_styles_set.d.ts +0 -1
- package/dist/types/src/ui/system/all_styles_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts.map +1 -1
- package/dist/types/src/ui/system/display.d.ts +0 -1
- package/dist/types/src/ui/system/display.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts.map +1 -1
- package/dist/types/src/ui/system/overflow.d.ts +0 -1
- package/dist/types/src/ui/system/overflow.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/bottom.d.ts +0 -1
- package/dist/types/src/ui/system/position/bottom.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/left.d.ts +0 -1
- package/dist/types/src/ui/system/position/left.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position.d.ts +0 -1
- package/dist/types/src/ui/system/position/position.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position_set.d.ts +0 -1
- package/dist/types/src/ui/system/position/position_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/right.d.ts +0 -1
- package/dist/types/src/ui/system/position/right.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/top.d.ts +0 -1
- package/dist/types/src/ui/system/position/top.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/z_index.d.ts +0 -1
- package/dist/types/src/ui/system/position/z_index.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts +0 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts +0 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts +0 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/csstype.d.ts +578 -578
- package/dist/types/src/ui/system/utils/csstype.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/types.d.ts +4 -4
- package/dist/types/src/ui/system/utils/types.d.ts.map +1 -1
- package/dist/types/src/ui/text.d.ts +3 -3
- package/dist/types/src/ui/text.d.ts.map +1 -1
- package/dist/types/src/ui/text_button.d.ts +1 -1
- package/dist/types/src/ui/text_button.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts +2 -2
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/index.d.ts +1 -1
- package/dist/types/src/ui/theme/theme_context.d.ts +1 -3
- package/dist/types/src/ui/theme/theme_context.d.ts.map +1 -1
- package/dist/types/src/ui/theme/use_theme.d.ts +1 -1
- package/dist/types/src/ui/tooltip.d.ts +3 -3
- package/dist/types/src/ui/types/data_attributes_prop.d.ts.map +1 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts +0 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts.map +1 -1
- package/dist/types/src/ui/use_base.d.ts.map +1 -1
- package/dist/types/src/ui/use_cursor.d.ts.map +1 -1
- package/dist/types/src/ui/use_form_field.d.ts +0 -2
- package/dist/types/src/ui/use_form_field.d.ts.map +1 -1
- package/dist/types/src/ui/use_records.d.ts +2 -2
- package/dist/types/src/ui/use_records.d.ts.map +1 -1
- package/dist/types/src/ui/use_session.d.ts.map +1 -1
- package/dist/types/src/ui/view_picker.d.ts +2 -2
- package/dist/types/src/ui/view_picker.d.ts.map +1 -1
- package/dist/types/src/ui/viewport_constraint.d.ts +3 -3
- package/dist/types/src/ui/viewport_constraint.d.ts.map +1 -1
- package/dist/types/src/viewport.d.ts +2 -2
- package/dist/types/src/viewport.d.ts.map +1 -1
- package/dist/types/src/warning.d.ts +1 -1
- package/dist/types/src/warning.d.ts.map +1 -1
- package/dist/types/stories/helpers/code_block.d.ts +2 -2
- package/dist/types/stories/helpers/code_block.d.ts.map +1 -1
- package/dist/types/stories/helpers/example.d.ts +5 -5
- package/dist/types/stories/helpers/example.d.ts.map +1 -1
- package/dist/types/stories/helpers/example_code_panel.d.ts +2 -2
- package/dist/types/stories/helpers/example_code_panel.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts +2 -2
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_record_card.d.ts +2 -2
- package/dist/types/stories/helpers/fake_record_card.d.ts.map +1 -1
- package/dist/types/stories/helpers/style_prop_list.d.ts +2 -2
- package/dist/types/stories/helpers/style_prop_list.d.ts.map +1 -1
- package/dist/types/stories/icon_example.d.ts +2 -2
- package/dist/types/stories/icon_example.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
- package/package.json +26 -25
package/dist/cjs/models/base.js
CHANGED
|
@@ -1,70 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.array.filter.js");
|
|
4
|
+
require("core-js/modules/es.array.from.js");
|
|
5
|
+
require("core-js/modules/es.array.slice.js");
|
|
6
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
7
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
8
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
3
9
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.filter");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.iterator");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.array.map");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.map");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.object.to-string");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.promise");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
26
|
-
|
|
27
10
|
Object.defineProperty(exports, "__esModule", {
|
|
28
11
|
value: true
|
|
29
12
|
});
|
|
30
13
|
exports.default = void 0;
|
|
31
|
-
|
|
32
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
33
|
-
|
|
34
|
-
require("
|
|
35
|
-
|
|
15
|
+
require("core-js/modules/es.symbol.js");
|
|
16
|
+
require("core-js/modules/es.symbol.description.js");
|
|
17
|
+
require("core-js/modules/es.array.iterator.js");
|
|
18
|
+
require("core-js/modules/es.array.map.js");
|
|
19
|
+
require("core-js/modules/es.map.js");
|
|
20
|
+
require("core-js/modules/es.object.to-string.js");
|
|
21
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
22
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
23
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
36
24
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
37
|
-
|
|
38
25
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
39
|
-
|
|
26
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
40
27
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
41
|
-
|
|
42
28
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
43
|
-
|
|
44
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
45
|
-
|
|
46
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
47
|
-
|
|
48
29
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
49
|
-
|
|
50
30
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
51
|
-
|
|
52
31
|
var _mutations = require("../types/mutations");
|
|
53
|
-
|
|
54
32
|
var _private_utils = require("../private_utils");
|
|
55
|
-
|
|
56
33
|
var _error_utils = require("../error_utils");
|
|
57
|
-
|
|
58
34
|
var _table = _interopRequireDefault(require("./table"));
|
|
59
|
-
|
|
60
35
|
var _record_store = _interopRequireDefault(require("./record_store"));
|
|
61
|
-
|
|
62
36
|
var _abstract_model = _interopRequireDefault(require("./abstract_model"));
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
function
|
|
67
|
-
|
|
37
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
38
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
39
|
+
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; } } }; }
|
|
40
|
+
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; } }
|
|
41
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
42
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
43
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @module @airtable/blocks/models: Base */ /** */
|
|
68
44
|
// How these model classes work:
|
|
69
45
|
//
|
|
70
46
|
// The single instance of the Base class maintains a reference to a plain JS
|
|
@@ -78,6 +54,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
78
54
|
// Be careful not to return a reference to any non-primitive subtree of baseData,
|
|
79
55
|
// since the block developer could mutate it and we'll end up out of sync with
|
|
80
56
|
// liveapp.
|
|
57
|
+
|
|
81
58
|
var WatchableBaseKeys = Object.freeze({
|
|
82
59
|
name: 'name',
|
|
83
60
|
tables: 'tables',
|
|
@@ -85,6 +62,7 @@ var WatchableBaseKeys = Object.freeze({
|
|
|
85
62
|
schema: 'schema',
|
|
86
63
|
color: 'color'
|
|
87
64
|
});
|
|
65
|
+
|
|
88
66
|
/**
|
|
89
67
|
* Any key in base that can be watched:
|
|
90
68
|
* - `name`: the name of the base
|
|
@@ -93,6 +71,9 @@ var WatchableBaseKeys = Object.freeze({
|
|
|
93
71
|
* - `schema`: the base schema (essentially everything except for record data)
|
|
94
72
|
*/
|
|
95
73
|
|
|
74
|
+
/** @internal */
|
|
75
|
+
|
|
76
|
+
/** @internal */
|
|
96
77
|
/**
|
|
97
78
|
* Model class representing a base.
|
|
98
79
|
*
|
|
@@ -108,56 +89,141 @@ var WatchableBaseKeys = Object.freeze({
|
|
|
108
89
|
* ```
|
|
109
90
|
* @docsPath models/Base
|
|
110
91
|
*/
|
|
111
|
-
var Base =
|
|
112
|
-
/*#__PURE__*/
|
|
113
|
-
function (_AbstractModel) {
|
|
114
|
-
(0, _inherits2.default)(Base, _AbstractModel);
|
|
115
|
-
(0, _createClass2.default)(Base, null, [{
|
|
116
|
-
key: "_isWatchableKey",
|
|
117
|
-
|
|
118
|
-
/** @internal */
|
|
119
|
-
|
|
120
|
-
/** @internal */
|
|
121
|
-
value: function _isWatchableKey(key) {
|
|
122
|
-
return (0, _private_utils.isEnumValue)(WatchableBaseKeys, key);
|
|
123
|
-
}
|
|
124
|
-
/** @internal */
|
|
125
|
-
|
|
126
|
-
}]);
|
|
127
|
-
|
|
92
|
+
var Base = /*#__PURE__*/function (_AbstractModel) {
|
|
128
93
|
/**
|
|
129
94
|
* @internal
|
|
130
95
|
*/
|
|
131
96
|
function Base(sdk) {
|
|
132
97
|
var _this;
|
|
133
|
-
|
|
134
98
|
(0, _classCallCheck2.default)(this, Base);
|
|
135
|
-
_this = (
|
|
136
|
-
|
|
137
|
-
(0, _defineProperty2.default)(
|
|
138
|
-
|
|
139
|
-
(0, _defineProperty2.default)(
|
|
99
|
+
_this = _callSuper(this, Base, [sdk, sdk.__airtableInterface.sdkInitData.baseData.id]);
|
|
100
|
+
/** @internal */
|
|
101
|
+
(0, _defineProperty2.default)(_this, "_tableModelsById", void 0);
|
|
102
|
+
/** @internal */
|
|
103
|
+
(0, _defineProperty2.default)(_this, "_tableRecordStoresByTableId", {});
|
|
104
|
+
/** @internal */
|
|
105
|
+
(0, _defineProperty2.default)(_this, "__billingPlanGrouping", void 0);
|
|
106
|
+
/** @internal */
|
|
107
|
+
(0, _defineProperty2.default)(_this, "_collaboratorIdsByNameAndEmail", null);
|
|
140
108
|
_this._tableModelsById = {}; // Table instances are lazily created by getTableById.
|
|
141
|
-
|
|
142
109
|
_this.__billingPlanGrouping = sdk.__airtableInterface.sdkInitData.baseData.billingPlanGrouping;
|
|
143
110
|
return _this;
|
|
144
111
|
}
|
|
112
|
+
|
|
145
113
|
/**
|
|
146
114
|
* Aliased to communicate stability for internal use by Sdk code.
|
|
147
115
|
*
|
|
148
116
|
* @internal
|
|
149
117
|
*/
|
|
118
|
+
(0, _inherits2.default)(Base, _AbstractModel);
|
|
119
|
+
return (0, _createClass2.default)(Base, [{
|
|
120
|
+
key: "__sdk",
|
|
121
|
+
get: function get() {
|
|
122
|
+
return this._sdk;
|
|
123
|
+
}
|
|
150
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
}, {
|
|
129
|
+
key: "_dataOrNullIfDeleted",
|
|
130
|
+
get: function get() {
|
|
131
|
+
return this._baseData;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The name of the base.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```js
|
|
138
|
+
* import {base} from '@airtable/blocks';
|
|
139
|
+
* console.log('The name of your base is', base.name);
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
}, {
|
|
143
|
+
key: "name",
|
|
144
|
+
get: function get() {
|
|
145
|
+
return this._data.name;
|
|
146
|
+
}
|
|
151
147
|
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
/**
|
|
149
|
+
* The workspace id of the base.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```js
|
|
153
|
+
* import {base} from '@airtable/blocks';
|
|
154
|
+
* console.log('The workspace id of your base is', base.workspaceId);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
}, {
|
|
158
|
+
key: "workspaceId",
|
|
159
|
+
get: function get() {
|
|
160
|
+
return this._data.workspaceId;
|
|
161
|
+
}
|
|
154
162
|
|
|
163
|
+
/**
|
|
164
|
+
* The color of the base.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```js
|
|
168
|
+
* import {base} from '@airtable/blocks';
|
|
169
|
+
* import {Box} from '@airtable/blocks/ui';
|
|
170
|
+
* const exampleBox = <Box backgroundColor={base.color}> This box's background is the same color as the base background</Box>
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
}, {
|
|
174
|
+
key: "color",
|
|
175
|
+
get: function get() {
|
|
176
|
+
return this._data.color;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The tables in this base. Can be watched to know when tables are created, deleted, or reordered in the base.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```js
|
|
184
|
+
* import {base} from '@airtable/blocks';
|
|
185
|
+
* console.log(`You have ${base.tables.length} tables`);
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
}, {
|
|
189
|
+
key: "tables",
|
|
190
|
+
get: function get() {
|
|
191
|
+
// TODO(kasra): cache and freeze this so it isn't O(n)
|
|
192
|
+
var tables = [];
|
|
193
|
+
this._data.tableOrder.forEach(tableId => {
|
|
194
|
+
var table = this.getTableByIdIfExists(tableId);
|
|
195
|
+
// NOTE: A table's ID may be in tableOrder without the table appearing
|
|
196
|
+
// in tablesById, in which case getTableById will return null. This
|
|
197
|
+
// happens if table was just created by the user, since we
|
|
198
|
+
// wait for the push payload to deliver the table schema.
|
|
199
|
+
if (table) {
|
|
200
|
+
tables.push(table);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
return tables;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The users who have access to this base.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```js
|
|
210
|
+
* import {base} from '@airtable/blocks';
|
|
211
|
+
* console.log(base.activeCollaborators[0].email);
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
}, {
|
|
215
|
+
key: "activeCollaborators",
|
|
216
|
+
get: function get() {
|
|
217
|
+
return this._data.activeCollaboratorIds.map(collaboratorId => this.getCollaboratorById(collaboratorId));
|
|
218
|
+
}
|
|
155
219
|
/**
|
|
156
220
|
* The user matching the given ID, or `null` if that user does not exist or does not have access
|
|
157
221
|
* to this base.
|
|
158
222
|
*
|
|
159
223
|
* @param collaboratorId The ID of the user.
|
|
160
224
|
*/
|
|
225
|
+
}, {
|
|
226
|
+
key: "getCollaboratorByIdIfExists",
|
|
161
227
|
value: function getCollaboratorByIdIfExists(collaboratorId) {
|
|
162
228
|
var collaboratorsById = this._data.collaboratorsById;
|
|
163
229
|
return (0, _private_utils.has)(collaboratorsById, collaboratorId) ? collaboratorsById[collaboratorId] : null;
|
|
@@ -170,16 +236,13 @@ function (_AbstractModel) {
|
|
|
170
236
|
*
|
|
171
237
|
* @param collaboratorId The ID of the user.
|
|
172
238
|
*/
|
|
173
|
-
|
|
174
239
|
}, {
|
|
175
240
|
key: "getCollaboratorById",
|
|
176
241
|
value: function getCollaboratorById(collaboratorId) {
|
|
177
242
|
var collaborator = this.getCollaboratorByIdIfExists(collaboratorId);
|
|
178
|
-
|
|
179
243
|
if (!collaborator) {
|
|
180
244
|
throw (0, _error_utils.spawnError)("No collaborator with ID %s has access to base '%s'", collaboratorId, this.name);
|
|
181
245
|
}
|
|
182
|
-
|
|
183
246
|
return collaborator;
|
|
184
247
|
}
|
|
185
248
|
/**
|
|
@@ -191,62 +254,43 @@ function (_AbstractModel) {
|
|
|
191
254
|
*
|
|
192
255
|
* @param collaboratorIdOrNameOrEmail The ID of the user.
|
|
193
256
|
*/
|
|
194
|
-
|
|
195
257
|
}, {
|
|
196
258
|
key: "getCollaboratorIfExists",
|
|
197
259
|
value: function getCollaboratorIfExists(idOrNameOrEmail) {
|
|
198
260
|
var collaboratorById = this.getCollaboratorByIdIfExists(idOrNameOrEmail);
|
|
199
|
-
|
|
200
261
|
if (collaboratorById) {
|
|
201
262
|
return collaboratorById;
|
|
202
263
|
}
|
|
203
|
-
|
|
204
264
|
if (!this._collaboratorIdsByNameAndEmail) {
|
|
205
265
|
this._collaboratorIdsByNameAndEmail = new Map();
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
var _iteratorError = undefined;
|
|
209
|
-
|
|
266
|
+
var _iterator = _createForOfIteratorHelper((0, _private_utils.entries)(this._data.collaboratorsById)),
|
|
267
|
+
_step;
|
|
210
268
|
try {
|
|
211
|
-
for (
|
|
269
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
212
270
|
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
271
|
+
id = _step$value[0],
|
|
272
|
+
_step$value$ = _step$value[1],
|
|
273
|
+
email = _step$value$.email,
|
|
274
|
+
name = _step$value$.name;
|
|
275
|
+
this._collaboratorIdsByNameAndEmail.set(email, id);
|
|
276
|
+
// we prevent `@` in names so theoretically we shouldn't encounter any collisions
|
|
219
277
|
// between names and emails, but names themselves may not be unique. as we build the
|
|
220
278
|
// name hash, we only add new values rather than overwrite existing ones. this means
|
|
221
279
|
// that we'll prefer emails to names in the event of a collision.
|
|
222
|
-
|
|
223
|
-
|
|
224
280
|
if (name && !this._collaboratorIdsByNameAndEmail.has(name)) {
|
|
225
281
|
this._collaboratorIdsByNameAndEmail.set(name, id);
|
|
226
282
|
}
|
|
227
283
|
}
|
|
228
284
|
} catch (err) {
|
|
229
|
-
|
|
230
|
-
_iteratorError = err;
|
|
285
|
+
_iterator.e(err);
|
|
231
286
|
} finally {
|
|
232
|
-
|
|
233
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
234
|
-
_iterator.return();
|
|
235
|
-
}
|
|
236
|
-
} finally {
|
|
237
|
-
if (_didIteratorError) {
|
|
238
|
-
throw _iteratorError;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
287
|
+
_iterator.f();
|
|
241
288
|
}
|
|
242
289
|
}
|
|
243
|
-
|
|
244
290
|
var idForNameOrEmail = this._collaboratorIdsByNameAndEmail.get(idOrNameOrEmail);
|
|
245
|
-
|
|
246
291
|
if (idForNameOrEmail !== undefined) {
|
|
247
292
|
return this.getCollaboratorById(idForNameOrEmail);
|
|
248
293
|
}
|
|
249
|
-
|
|
250
294
|
return null;
|
|
251
295
|
}
|
|
252
296
|
/**
|
|
@@ -259,29 +303,24 @@ function (_AbstractModel) {
|
|
|
259
303
|
*
|
|
260
304
|
* @param collaboratorIdOrNameOrEmail The ID of the user.
|
|
261
305
|
*/
|
|
262
|
-
|
|
263
306
|
}, {
|
|
264
307
|
key: "getCollaborator",
|
|
265
308
|
value: function getCollaborator(idOrNameOrEmail) {
|
|
266
309
|
var collaborator = this.getCollaboratorIfExists(idOrNameOrEmail);
|
|
267
|
-
|
|
268
310
|
if (!collaborator) {
|
|
269
311
|
throw (0, _error_utils.spawnError)("No collaborator with ID, name, or email of '%s' is in base '%s'", idOrNameOrEmail, this.name);
|
|
270
312
|
}
|
|
271
|
-
|
|
272
313
|
return collaborator;
|
|
273
314
|
}
|
|
274
315
|
/**
|
|
275
316
|
* @internal
|
|
276
317
|
*/
|
|
277
|
-
|
|
278
318
|
}, {
|
|
279
319
|
key: "__getRecordStore",
|
|
280
320
|
value: function __getRecordStore(tableId) {
|
|
281
321
|
if ((0, _private_utils.has)(this._tableRecordStoresByTableId, tableId)) {
|
|
282
322
|
return this._tableRecordStoresByTableId[tableId];
|
|
283
323
|
}
|
|
284
|
-
|
|
285
324
|
(0, _error_utils.invariant)(this._data.tablesById[tableId], 'table must exist');
|
|
286
325
|
var newRecordStore = new _record_store.default(this._sdk, tableId);
|
|
287
326
|
this._tableRecordStoresByTableId[tableId] = newRecordStore;
|
|
@@ -290,7 +329,6 @@ function (_AbstractModel) {
|
|
|
290
329
|
/**
|
|
291
330
|
* @internal
|
|
292
331
|
*/
|
|
293
|
-
|
|
294
332
|
}, {
|
|
295
333
|
key: "__getBaseData",
|
|
296
334
|
value: function __getBaseData() {
|
|
@@ -301,7 +339,6 @@ function (_AbstractModel) {
|
|
|
301
339
|
*
|
|
302
340
|
* @param tableId The ID of the table.
|
|
303
341
|
*/
|
|
304
|
-
|
|
305
342
|
}, {
|
|
306
343
|
key: "getTableByIdIfExists",
|
|
307
344
|
value: function getTableByIdIfExists(tableId) {
|
|
@@ -311,7 +348,6 @@ function (_AbstractModel) {
|
|
|
311
348
|
if (!this._tableModelsById[tableId]) {
|
|
312
349
|
this._tableModelsById[tableId] = new _table.default(this, this.__getRecordStore(tableId), tableId, this._sdk);
|
|
313
350
|
}
|
|
314
|
-
|
|
315
351
|
return this._tableModelsById[tableId];
|
|
316
352
|
}
|
|
317
353
|
}
|
|
@@ -322,16 +358,13 @@ function (_AbstractModel) {
|
|
|
322
358
|
*
|
|
323
359
|
* @param tableId The ID of the table.
|
|
324
360
|
*/
|
|
325
|
-
|
|
326
361
|
}, {
|
|
327
362
|
key: "getTableById",
|
|
328
363
|
value: function getTableById(tableId) {
|
|
329
364
|
var table = this.getTableByIdIfExists(tableId);
|
|
330
|
-
|
|
331
365
|
if (!table) {
|
|
332
366
|
throw (0, _error_utils.spawnError)("No table with ID %s in base '%s'", tableId, this.name);
|
|
333
367
|
}
|
|
334
|
-
|
|
335
368
|
return table;
|
|
336
369
|
}
|
|
337
370
|
/**
|
|
@@ -339,39 +372,25 @@ function (_AbstractModel) {
|
|
|
339
372
|
*
|
|
340
373
|
* @param tableName The name of the table you're looking for.
|
|
341
374
|
*/
|
|
342
|
-
|
|
343
375
|
}, {
|
|
344
376
|
key: "getTableByNameIfExists",
|
|
345
377
|
value: function getTableByNameIfExists(tableName) {
|
|
346
|
-
var
|
|
347
|
-
|
|
348
|
-
var _iteratorError2 = undefined;
|
|
349
|
-
|
|
378
|
+
var _iterator2 = _createForOfIteratorHelper((0, _private_utils.entries)(this._data.tablesById)),
|
|
379
|
+
_step2;
|
|
350
380
|
try {
|
|
351
|
-
for (
|
|
381
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
352
382
|
var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
383
|
+
tableId = _step2$value[0],
|
|
384
|
+
tableData = _step2$value[1];
|
|
356
385
|
if (tableData.name === tableName) {
|
|
357
386
|
return this.getTableByIdIfExists(tableId);
|
|
358
387
|
}
|
|
359
388
|
}
|
|
360
389
|
} catch (err) {
|
|
361
|
-
|
|
362
|
-
_iteratorError2 = err;
|
|
390
|
+
_iterator2.e(err);
|
|
363
391
|
} finally {
|
|
364
|
-
|
|
365
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
366
|
-
_iterator2.return();
|
|
367
|
-
}
|
|
368
|
-
} finally {
|
|
369
|
-
if (_didIteratorError2) {
|
|
370
|
-
throw _iteratorError2;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
392
|
+
_iterator2.f();
|
|
373
393
|
}
|
|
374
|
-
|
|
375
394
|
return null;
|
|
376
395
|
}
|
|
377
396
|
/**
|
|
@@ -381,16 +400,13 @@ function (_AbstractModel) {
|
|
|
381
400
|
*
|
|
382
401
|
* @param tableName The name of the table you're looking for.
|
|
383
402
|
*/
|
|
384
|
-
|
|
385
403
|
}, {
|
|
386
404
|
key: "getTableByName",
|
|
387
405
|
value: function getTableByName(tableName) {
|
|
388
406
|
var table = this.getTableByNameIfExists(tableName);
|
|
389
|
-
|
|
390
407
|
if (!table) {
|
|
391
408
|
throw (0, _error_utils.spawnError)("No table named '%s' in base '%s'", tableName, this.name);
|
|
392
409
|
}
|
|
393
|
-
|
|
394
410
|
return table;
|
|
395
411
|
}
|
|
396
412
|
/**
|
|
@@ -403,12 +419,10 @@ function (_AbstractModel) {
|
|
|
403
419
|
*
|
|
404
420
|
* @param tableIdOrName The ID or name of the table you're looking for.
|
|
405
421
|
*/
|
|
406
|
-
|
|
407
422
|
}, {
|
|
408
423
|
key: "getTableIfExists",
|
|
409
424
|
value: function getTableIfExists(tableIdOrName) {
|
|
410
425
|
var _this$getTableByIdIfE;
|
|
411
|
-
|
|
412
426
|
return (_this$getTableByIdIfE = this.getTableByIdIfExists(tableIdOrName)) !== null && _this$getTableByIdIfE !== void 0 ? _this$getTableByIdIfE : this.getTableByNameIfExists(tableIdOrName);
|
|
413
427
|
}
|
|
414
428
|
/**
|
|
@@ -422,18 +436,16 @@ function (_AbstractModel) {
|
|
|
422
436
|
*
|
|
423
437
|
* @param tableIdOrName The ID or name of the table you're looking for.
|
|
424
438
|
*/
|
|
425
|
-
|
|
426
439
|
}, {
|
|
427
440
|
key: "getTable",
|
|
428
441
|
value: function getTable(tableIdOrName) {
|
|
429
442
|
var table = this.getTableIfExists(tableIdOrName);
|
|
430
|
-
|
|
431
443
|
if (!table) {
|
|
432
444
|
throw (0, _error_utils.spawnError)("No table with ID or name '%s' in base '%s'", tableIdOrName, this.name);
|
|
433
445
|
}
|
|
434
|
-
|
|
435
446
|
return table;
|
|
436
447
|
}
|
|
448
|
+
|
|
437
449
|
/**
|
|
438
450
|
* Checks whether the current user has permission to create a table.
|
|
439
451
|
*
|
|
@@ -455,7 +467,6 @@ function (_AbstractModel) {
|
|
|
455
467
|
* }
|
|
456
468
|
* ```
|
|
457
469
|
*/
|
|
458
|
-
|
|
459
470
|
}, {
|
|
460
471
|
key: "checkPermissionsForCreateTable",
|
|
461
472
|
value: function checkPermissionsForCreateTable(name, fields) {
|
|
@@ -477,6 +488,7 @@ function (_AbstractModel) {
|
|
|
477
488
|
})
|
|
478
489
|
});
|
|
479
490
|
}
|
|
491
|
+
|
|
480
492
|
/**
|
|
481
493
|
* An alias for `checkPermissionsForCreateTable(name, fields).hasPermission`.
|
|
482
494
|
*
|
|
@@ -496,12 +508,12 @@ function (_AbstractModel) {
|
|
|
496
508
|
* }
|
|
497
509
|
* ```
|
|
498
510
|
*/
|
|
499
|
-
|
|
500
511
|
}, {
|
|
501
512
|
key: "hasPermissionToCreateTable",
|
|
502
513
|
value: function hasPermissionToCreateTable(name, fields) {
|
|
503
514
|
return this.checkPermissionsForCreateTable(name, fields).hasPermission;
|
|
504
515
|
}
|
|
516
|
+
|
|
505
517
|
/**
|
|
506
518
|
* Creates a new table.
|
|
507
519
|
*
|
|
@@ -555,24 +567,22 @@ function (_AbstractModel) {
|
|
|
555
567
|
* }
|
|
556
568
|
* ```
|
|
557
569
|
*/
|
|
558
|
-
|
|
559
570
|
}, {
|
|
560
571
|
key: "createTableAsync",
|
|
561
|
-
value: function
|
|
562
|
-
var
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
switch (_context.prev = _context.next) {
|
|
572
|
+
value: (function () {
|
|
573
|
+
var _createTableAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, fields) {
|
|
574
|
+
var tableId;
|
|
575
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
576
|
+
while (1) switch (_context.prev = _context.next) {
|
|
566
577
|
case 0:
|
|
567
578
|
tableId = this._sdk.__airtableInterface.idGenerator.generateTableId();
|
|
568
579
|
_context.next = 3;
|
|
569
|
-
return
|
|
580
|
+
return this._sdk.__mutations.applyMutationAsync({
|
|
570
581
|
id: tableId,
|
|
571
582
|
type: _mutations.MutationTypes.CREATE_SINGLE_TABLE,
|
|
572
583
|
name,
|
|
573
584
|
fields: fields.map(field => {
|
|
574
585
|
var _field$description;
|
|
575
|
-
|
|
576
586
|
return {
|
|
577
587
|
name: field.name,
|
|
578
588
|
config: _objectSpread({
|
|
@@ -586,163 +596,114 @@ function (_AbstractModel) {
|
|
|
586
596
|
description: (_field$description = field.description) !== null && _field$description !== void 0 ? _field$description : null
|
|
587
597
|
};
|
|
588
598
|
})
|
|
589
|
-
})
|
|
590
|
-
|
|
599
|
+
});
|
|
591
600
|
case 3:
|
|
592
601
|
return _context.abrupt("return", this.getTableById(tableId));
|
|
593
|
-
|
|
594
602
|
case 4:
|
|
595
603
|
case "end":
|
|
596
604
|
return _context.stop();
|
|
597
605
|
}
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
|
|
606
|
+
}, _callee, this);
|
|
607
|
+
}));
|
|
608
|
+
function createTableAsync(_x, _x2) {
|
|
609
|
+
return _createTableAsync.apply(this, arguments);
|
|
610
|
+
}
|
|
611
|
+
return createTableAsync;
|
|
612
|
+
}()
|
|
601
613
|
/**
|
|
602
614
|
* Returns the maximum number of records allowed in each table of this base.
|
|
603
615
|
*/
|
|
604
|
-
|
|
616
|
+
)
|
|
605
617
|
}, {
|
|
606
618
|
key: "getMaxRecordsPerTable",
|
|
607
619
|
value: function getMaxRecordsPerTable() {
|
|
608
620
|
var _this$_data$maxRowsPe;
|
|
609
|
-
|
|
610
621
|
return (_this$_data$maxRowsPe = this._data.maxRowsPerTable) !== null && _this$_data$maxRowsPe !== void 0 ? _this$_data$maxRowsPe : 100000;
|
|
611
622
|
}
|
|
623
|
+
|
|
612
624
|
/**
|
|
613
625
|
* @internal
|
|
614
626
|
*/
|
|
615
|
-
|
|
616
627
|
}, {
|
|
617
628
|
key: "__triggerOnChangeForChangedPaths",
|
|
618
629
|
value: function __triggerOnChangeForChangedPaths(changedPaths) {
|
|
619
630
|
var didSchemaChange = false;
|
|
620
|
-
|
|
621
631
|
if (changedPaths.name) {
|
|
622
632
|
this._onChange(WatchableBaseKeys.name);
|
|
623
|
-
|
|
624
633
|
didSchemaChange = true;
|
|
625
634
|
}
|
|
626
|
-
|
|
627
635
|
if (changedPaths.color) {
|
|
628
636
|
this._onChange(WatchableBaseKeys.color);
|
|
629
|
-
|
|
630
637
|
didSchemaChange = true;
|
|
631
638
|
}
|
|
632
|
-
|
|
633
639
|
if (changedPaths.tableOrder) {
|
|
634
640
|
this._onChange(WatchableBaseKeys.tables);
|
|
641
|
+
didSchemaChange = true;
|
|
635
642
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
var _didIteratorError3 = false;
|
|
640
|
-
var _iteratorError3 = undefined;
|
|
641
|
-
|
|
643
|
+
// Clean up deleted tables
|
|
644
|
+
var _iterator3 = _createForOfIteratorHelper((0, _private_utils.entries)(this._tableModelsById)),
|
|
645
|
+
_step3;
|
|
642
646
|
try {
|
|
643
|
-
for (
|
|
647
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
644
648
|
var _step3$value = (0, _slicedToArray2.default)(_step3.value, 2),
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
649
|
+
tableId = _step3$value[0],
|
|
650
|
+
tableModel = _step3$value[1];
|
|
648
651
|
if (tableModel.isDeleted) {
|
|
649
652
|
delete this._tableModelsById[tableId];
|
|
650
653
|
}
|
|
651
654
|
}
|
|
652
655
|
} catch (err) {
|
|
653
|
-
|
|
654
|
-
_iteratorError3 = err;
|
|
656
|
+
_iterator3.e(err);
|
|
655
657
|
} finally {
|
|
656
|
-
|
|
657
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
658
|
-
_iterator3.return();
|
|
659
|
-
}
|
|
660
|
-
} finally {
|
|
661
|
-
if (_didIteratorError3) {
|
|
662
|
-
throw _iteratorError3;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
658
|
+
_iterator3.f();
|
|
665
659
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
var _didIteratorError4 = false;
|
|
669
|
-
var _iteratorError4 = undefined;
|
|
670
|
-
|
|
660
|
+
var _iterator4 = _createForOfIteratorHelper((0, _private_utils.entries)(this._tableRecordStoresByTableId)),
|
|
661
|
+
_step4;
|
|
671
662
|
try {
|
|
672
|
-
for (
|
|
663
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
673
664
|
var _step4$value = (0, _slicedToArray2.default)(_step4.value, 2),
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
665
|
+
_tableId = _step4$value[0],
|
|
666
|
+
recordStore = _step4$value[1];
|
|
677
667
|
if (recordStore && recordStore.isDeleted) {
|
|
678
668
|
recordStore.__onDataDeletion();
|
|
679
|
-
|
|
680
669
|
delete this._tableRecordStoresByTableId[_tableId];
|
|
681
670
|
}
|
|
682
671
|
}
|
|
683
672
|
} catch (err) {
|
|
684
|
-
|
|
685
|
-
_iteratorError4 = err;
|
|
673
|
+
_iterator4.e(err);
|
|
686
674
|
} finally {
|
|
687
|
-
|
|
688
|
-
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
689
|
-
_iterator4.return();
|
|
690
|
-
}
|
|
691
|
-
} finally {
|
|
692
|
-
if (_didIteratorError4) {
|
|
693
|
-
throw _iteratorError4;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
675
|
+
_iterator4.f();
|
|
696
676
|
}
|
|
697
677
|
}
|
|
698
|
-
|
|
699
678
|
var tablesById = changedPaths.tablesById;
|
|
700
|
-
|
|
701
679
|
if (tablesById) {
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
var _iteratorError5 = undefined;
|
|
705
|
-
|
|
680
|
+
var _iterator5 = _createForOfIteratorHelper((0, _private_utils.entries)(tablesById)),
|
|
681
|
+
_step5;
|
|
706
682
|
try {
|
|
707
|
-
for (
|
|
683
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
708
684
|
var _step5$value = (0, _slicedToArray2.default)(_step5.value, 2),
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
685
|
+
_tableId2 = _step5$value[0],
|
|
686
|
+
dirtyTablePaths = _step5$value[1];
|
|
712
687
|
var table = this.getTableByIdIfExists(_tableId2);
|
|
713
|
-
|
|
714
688
|
if (table && dirtyTablePaths) {
|
|
715
689
|
var didTableSchemaChange = table.__triggerOnChangeForDirtyPaths(dirtyTablePaths);
|
|
716
|
-
|
|
717
690
|
if (didTableSchemaChange) {
|
|
718
691
|
didSchemaChange = true;
|
|
719
692
|
}
|
|
720
693
|
}
|
|
721
694
|
}
|
|
722
695
|
} catch (err) {
|
|
723
|
-
|
|
724
|
-
_iteratorError5 = err;
|
|
696
|
+
_iterator5.e(err);
|
|
725
697
|
} finally {
|
|
726
|
-
|
|
727
|
-
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
728
|
-
_iterator5.return();
|
|
729
|
-
}
|
|
730
|
-
} finally {
|
|
731
|
-
if (_didIteratorError5) {
|
|
732
|
-
throw _iteratorError5;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
698
|
+
_iterator5.f();
|
|
735
699
|
}
|
|
736
700
|
}
|
|
737
|
-
|
|
738
701
|
if (changedPaths.collaboratorsById || changedPaths.activeCollaboratorIds) {
|
|
739
702
|
this._onChange(WatchableBaseKeys.collaborators);
|
|
740
703
|
}
|
|
741
|
-
|
|
742
704
|
if (changedPaths.appInterface) {
|
|
743
705
|
didSchemaChange = true;
|
|
744
706
|
}
|
|
745
|
-
|
|
746
707
|
if (didSchemaChange) {
|
|
747
708
|
this._onChange(WatchableBaseKeys.schema);
|
|
748
709
|
}
|
|
@@ -750,7 +711,6 @@ function (_AbstractModel) {
|
|
|
750
711
|
/**
|
|
751
712
|
* @internal
|
|
752
713
|
*/
|
|
753
|
-
|
|
754
714
|
}, {
|
|
755
715
|
key: "__applyChangesWithoutTriggeringEvents",
|
|
756
716
|
value: function __applyChangesWithoutTriggeringEvents(changes) {
|
|
@@ -761,188 +721,65 @@ function (_AbstractModel) {
|
|
|
761
721
|
// Use it to call __triggerOnChangeForChangedPaths to trigger change events for
|
|
762
722
|
// effected models
|
|
763
723
|
var changedPaths = {};
|
|
764
|
-
var
|
|
765
|
-
|
|
766
|
-
var _iteratorError6 = undefined;
|
|
767
|
-
|
|
724
|
+
var _iterator6 = _createForOfIteratorHelper(changes),
|
|
725
|
+
_step6;
|
|
768
726
|
try {
|
|
769
|
-
for (
|
|
727
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
770
728
|
var change = _step6.value;
|
|
771
|
-
|
|
772
729
|
this._applyChange(change.path, change.value, changedPaths);
|
|
773
730
|
}
|
|
774
731
|
} catch (err) {
|
|
775
|
-
|
|
776
|
-
_iteratorError6 = err;
|
|
732
|
+
_iterator6.e(err);
|
|
777
733
|
} finally {
|
|
778
|
-
|
|
779
|
-
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
|
780
|
-
_iterator6.return();
|
|
781
|
-
}
|
|
782
|
-
} finally {
|
|
783
|
-
if (_didIteratorError6) {
|
|
784
|
-
throw _iteratorError6;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
734
|
+
_iterator6.f();
|
|
787
735
|
}
|
|
788
|
-
|
|
789
736
|
return changedPaths;
|
|
790
737
|
}
|
|
791
738
|
/**
|
|
792
739
|
* @internal
|
|
793
740
|
*/
|
|
794
|
-
|
|
795
741
|
}, {
|
|
796
742
|
key: "_applyChange",
|
|
797
743
|
value: function _applyChange(path, value, changedPathsByRef) {
|
|
798
744
|
var dataSubtree = this._data;
|
|
799
745
|
var dirtySubtree = changedPathsByRef;
|
|
800
|
-
|
|
801
746
|
for (var i = 0; i < path.length - 1; i++) {
|
|
802
747
|
var part = path[i];
|
|
803
|
-
|
|
804
748
|
if (!dataSubtree[part]) {
|
|
805
749
|
// Certain fields are stored sparsely (e.g. cellValuesByFieldId),
|
|
806
750
|
// so create an object on demand if needed.
|
|
807
751
|
dataSubtree[part] = {};
|
|
808
752
|
}
|
|
809
|
-
|
|
810
753
|
dataSubtree = dataSubtree[part];
|
|
811
|
-
|
|
812
754
|
if (!dirtySubtree[part]) {
|
|
813
755
|
dirtySubtree[part] = {};
|
|
814
756
|
}
|
|
815
|
-
|
|
816
757
|
(0, _error_utils.invariant)(dirtySubtree[part], 'dirtySubtree');
|
|
817
758
|
dirtySubtree = dirtySubtree[part];
|
|
818
759
|
}
|
|
819
|
-
|
|
820
760
|
var lastPathPart = path[path.length - 1];
|
|
821
761
|
var didChange = !(0, _private_utils.isDeepEqual)(dataSubtree[lastPathPart], value);
|
|
822
|
-
|
|
823
762
|
if (value === undefined) {
|
|
824
763
|
delete dataSubtree[lastPathPart];
|
|
825
764
|
} else {
|
|
826
765
|
dataSubtree[lastPathPart] = value;
|
|
827
766
|
}
|
|
828
|
-
|
|
829
767
|
if (didChange) {
|
|
830
768
|
if (!dirtySubtree[lastPathPart]) {
|
|
831
769
|
dirtySubtree[lastPathPart] = {};
|
|
832
770
|
}
|
|
833
|
-
|
|
834
771
|
(0, _error_utils.invariant)(dirtySubtree[lastPathPart], 'dirtySubtree');
|
|
835
772
|
dirtySubtree[lastPathPart]._isDirty = true;
|
|
836
773
|
}
|
|
837
774
|
}
|
|
838
|
-
}, {
|
|
839
|
-
key: "
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* @internal
|
|
845
|
-
*/
|
|
846
|
-
|
|
847
|
-
}, {
|
|
848
|
-
key: "_dataOrNullIfDeleted",
|
|
849
|
-
get: function get() {
|
|
850
|
-
return this._baseData;
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* The name of the base.
|
|
854
|
-
*
|
|
855
|
-
* @example
|
|
856
|
-
* ```js
|
|
857
|
-
* import {base} from '@airtable/blocks';
|
|
858
|
-
* console.log('The name of your base is', base.name);
|
|
859
|
-
* ```
|
|
860
|
-
*/
|
|
861
|
-
|
|
862
|
-
}, {
|
|
863
|
-
key: "name",
|
|
864
|
-
get: function get() {
|
|
865
|
-
return this._data.name;
|
|
866
|
-
}
|
|
867
|
-
/**
|
|
868
|
-
* The workspace id of the base.
|
|
869
|
-
*
|
|
870
|
-
* @example
|
|
871
|
-
* ```js
|
|
872
|
-
* import {base} from '@airtable/blocks';
|
|
873
|
-
* console.log('The workspace id of your base is', base.workspaceId);
|
|
874
|
-
* ```
|
|
875
|
-
*/
|
|
876
|
-
|
|
877
|
-
}, {
|
|
878
|
-
key: "workspaceId",
|
|
879
|
-
get: function get() {
|
|
880
|
-
return this._data.workspaceId;
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* The color of the base.
|
|
884
|
-
*
|
|
885
|
-
* @example
|
|
886
|
-
* ```js
|
|
887
|
-
* import {base} from '@airtable/blocks';
|
|
888
|
-
* import {Box} from '@airtable/blocks/ui';
|
|
889
|
-
* const exampleBox = <Box backgroundColor={base.color}> This box's background is the same color as the base background</Box>
|
|
890
|
-
* ```
|
|
891
|
-
*/
|
|
892
|
-
|
|
893
|
-
}, {
|
|
894
|
-
key: "color",
|
|
895
|
-
get: function get() {
|
|
896
|
-
return this._data.color;
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* The tables in this base. Can be watched to know when tables are created, deleted, or reordered in the base.
|
|
900
|
-
*
|
|
901
|
-
* @example
|
|
902
|
-
* ```js
|
|
903
|
-
* import {base} from '@airtable/blocks';
|
|
904
|
-
* console.log(`You have ${base.tables.length} tables`);
|
|
905
|
-
* ```
|
|
906
|
-
*/
|
|
907
|
-
|
|
908
|
-
}, {
|
|
909
|
-
key: "tables",
|
|
910
|
-
get: function get() {
|
|
911
|
-
// TODO(kasra): cache and freeze this so it isn't O(n)
|
|
912
|
-
var tables = [];
|
|
913
|
-
|
|
914
|
-
this._data.tableOrder.forEach(tableId => {
|
|
915
|
-
var table = this.getTableByIdIfExists(tableId); // NOTE: A table's ID may be in tableOrder without the table appearing
|
|
916
|
-
// in tablesById, in which case getTableById will return null. This
|
|
917
|
-
// happens if table was just created by the user, since we
|
|
918
|
-
// wait for the push payload to deliver the table schema.
|
|
919
|
-
|
|
920
|
-
if (table) {
|
|
921
|
-
tables.push(table);
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
|
|
925
|
-
return tables;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* The users who have access to this base.
|
|
929
|
-
*
|
|
930
|
-
* @example
|
|
931
|
-
* ```js
|
|
932
|
-
* import {base} from '@airtable/blocks';
|
|
933
|
-
* console.log(base.activeCollaborators[0].email);
|
|
934
|
-
* ```
|
|
935
|
-
*/
|
|
936
|
-
|
|
937
|
-
}, {
|
|
938
|
-
key: "activeCollaborators",
|
|
939
|
-
get: function get() {
|
|
940
|
-
return this._data.activeCollaboratorIds.map(collaboratorId => this.getCollaboratorById(collaboratorId));
|
|
775
|
+
}], [{
|
|
776
|
+
key: "_isWatchableKey",
|
|
777
|
+
value: /** @internal */
|
|
778
|
+
function _isWatchableKey(key) {
|
|
779
|
+
return (0, _private_utils.isEnumValue)(WatchableBaseKeys, key);
|
|
941
780
|
}
|
|
942
781
|
}]);
|
|
943
|
-
return Base;
|
|
944
782
|
}(_abstract_model.default);
|
|
945
|
-
|
|
783
|
+
/** @internal */
|
|
946
784
|
(0, _defineProperty2.default)(Base, "_className", 'Base');
|
|
947
|
-
var _default = Base;
|
|
948
|
-
exports.default = _default;
|
|
785
|
+
var _default = exports.default = Base;
|