@airtable/blocks 1.18.0 → 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.
Files changed (481) hide show
  1. package/CHANGELOG.md +552 -0
  2. package/dist/cjs/color_utils.js +21 -23
  3. package/dist/cjs/colors.js +4 -60
  4. package/dist/cjs/error_utils.js +15 -25
  5. package/dist/cjs/event_tracker.js +5 -11
  6. package/dist/cjs/global_config.js +107 -188
  7. package/dist/cjs/index.js +16 -40
  8. package/dist/cjs/injected/airtable_interface.js +1 -6
  9. package/dist/cjs/models/abstract_model.js +50 -81
  10. package/dist/cjs/models/abstract_model_with_async_data.js +102 -177
  11. package/dist/cjs/models/base.js +211 -374
  12. package/dist/cjs/models/create_aggregators.js +53 -47
  13. package/dist/cjs/models/cursor.js +125 -201
  14. package/dist/cjs/models/field.js +256 -303
  15. package/dist/cjs/models/grouped_record_query_result.js +210 -286
  16. package/dist/cjs/models/linked_records_query_result.js +276 -454
  17. package/dist/cjs/models/models.js +36 -50
  18. package/dist/cjs/models/mutation_constants.js +5 -9
  19. package/dist/cjs/models/mutations.js +125 -338
  20. package/dist/cjs/models/object_pool.js +37 -94
  21. package/dist/cjs/models/record.js +132 -226
  22. package/dist/cjs/models/record_coloring.js +14 -19
  23. package/dist/cjs/models/record_query_result.js +323 -282
  24. package/dist/cjs/models/record_store.js +355 -688
  25. package/dist/cjs/models/session.js +99 -158
  26. package/dist/cjs/models/table.js +361 -549
  27. package/dist/cjs/models/table_or_view_query_result.js +410 -765
  28. package/dist/cjs/models/view.js +161 -204
  29. package/dist/cjs/models/view_data_store.js +177 -282
  30. package/dist/cjs/models/view_metadata_query_result.js +96 -127
  31. package/dist/cjs/perform_record_action.js +69 -103
  32. package/dist/cjs/private_utils.js +133 -223
  33. package/dist/cjs/sdk.js +97 -142
  34. package/dist/cjs/settings_button.js +30 -57
  35. package/dist/cjs/stats/block_stats.js +3 -15
  36. package/dist/cjs/testing/abstract_mock_airtable_interface.js +53 -97
  37. package/dist/cjs/types/airtable_interface.js +36 -8
  38. package/dist/cjs/types/field.js +66 -12
  39. package/dist/cjs/types/mutations.js +99 -6
  40. package/dist/cjs/types/permission_levels.js +2 -4
  41. package/dist/cjs/types/undo_redo.js +2 -3
  42. package/dist/cjs/types/view.js +16 -11
  43. package/dist/cjs/ui/base_provider.js +14 -9
  44. package/dist/cjs/ui/baymax_utils.js +107 -1102
  45. package/dist/cjs/ui/block_wrapper.js +30 -68
  46. package/dist/cjs/ui/box.js +52 -56
  47. package/dist/cjs/ui/button.js +60 -77
  48. package/dist/cjs/ui/cell_renderer.js +78 -139
  49. package/dist/cjs/ui/choice_token.js +45 -47
  50. package/dist/cjs/ui/collaborator_token.js +33 -54
  51. package/dist/cjs/ui/color_palette.js +58 -106
  52. package/dist/cjs/ui/color_palette_synced.js +41 -52
  53. package/dist/cjs/ui/confirmation_dialog.js +53 -69
  54. package/dist/cjs/ui/control_sizes.js +21 -46
  55. package/dist/cjs/ui/create_detect_element_resize.js +16 -50
  56. package/dist/cjs/ui/css_helpers.js +3 -10
  57. package/dist/cjs/ui/dialog.js +44 -71
  58. package/dist/cjs/ui/dialog_close_button.js +52 -72
  59. package/dist/cjs/ui/expand_record.js +4 -11
  60. package/dist/cjs/ui/expand_record_list.js +6 -11
  61. package/dist/cjs/ui/expand_record_picker_async.js +18 -35
  62. package/dist/cjs/ui/field_icon.js +25 -28
  63. package/dist/cjs/ui/field_picker.js +47 -81
  64. package/dist/cjs/ui/field_picker_synced.js +33 -44
  65. package/dist/cjs/ui/form_field.js +45 -64
  66. package/dist/cjs/ui/geometry/geometry.js +6 -10
  67. package/dist/cjs/ui/geometry/point.js +5 -13
  68. package/dist/cjs/ui/geometry/rect.js +7 -29
  69. package/dist/cjs/ui/geometry/size.js +5 -13
  70. package/dist/cjs/ui/global_alert.js +35 -61
  71. package/dist/cjs/ui/global_config_synced_component_helpers.js +4 -13
  72. package/dist/cjs/ui/heading.js +63 -92
  73. package/dist/cjs/ui/icon.js +44 -66
  74. package/dist/cjs/ui/icon_config.js +13 -24
  75. package/dist/cjs/ui/initialize_block.js +23 -36
  76. package/dist/cjs/ui/input.js +74 -87
  77. package/dist/cjs/ui/input_synced.js +34 -43
  78. package/dist/cjs/ui/key_codes.js +4 -9
  79. package/dist/cjs/ui/label.js +45 -50
  80. package/dist/cjs/ui/link.js +74 -89
  81. package/dist/cjs/ui/loader.js +26 -42
  82. package/dist/cjs/ui/modal.js +63 -89
  83. package/dist/cjs/ui/model_picker_select.js +29 -47
  84. package/dist/cjs/ui/popover.js +98 -180
  85. package/dist/cjs/ui/progress_bar.js +45 -51
  86. package/dist/cjs/ui/record_card.js +143 -278
  87. package/dist/cjs/ui/record_card_list.js +117 -165
  88. package/dist/cjs/ui/remote_utils.js +5 -13
  89. package/dist/cjs/ui/sdk_context.js +7 -9
  90. package/dist/cjs/ui/select.js +84 -118
  91. package/dist/cjs/ui/select_and_select_buttons_helpers.js +27 -45
  92. package/dist/cjs/ui/select_buttons.js +54 -90
  93. package/dist/cjs/ui/select_buttons_synced.js +32 -41
  94. package/dist/cjs/ui/select_synced.js +32 -42
  95. package/dist/cjs/ui/switch.js +66 -84
  96. package/dist/cjs/ui/switch_synced.js +32 -38
  97. package/dist/cjs/ui/synced.js +16 -43
  98. package/dist/cjs/ui/system/all_styles_set.js +89 -22
  99. package/dist/cjs/ui/system/appearance/appearance_set.js +15 -26
  100. package/dist/cjs/ui/system/appearance/background_color.js +6 -12
  101. package/dist/cjs/ui/system/appearance/border.js +6 -12
  102. package/dist/cjs/ui/system/appearance/border_radius.js +6 -12
  103. package/dist/cjs/ui/system/appearance/box_shadow.js +6 -12
  104. package/dist/cjs/ui/system/appearance/opacity.js +5 -11
  105. package/dist/cjs/ui/system/dimensions/dimensions_set.js +15 -27
  106. package/dist/cjs/ui/system/dimensions/height.js +5 -11
  107. package/dist/cjs/ui/system/dimensions/max_height.js +5 -11
  108. package/dist/cjs/ui/system/dimensions/max_width.js +5 -11
  109. package/dist/cjs/ui/system/dimensions/min_height.js +5 -11
  110. package/dist/cjs/ui/system/dimensions/min_width.js +5 -11
  111. package/dist/cjs/ui/system/dimensions/width.js +5 -11
  112. package/dist/cjs/ui/system/display.js +8 -9
  113. package/dist/cjs/ui/system/flex_container/align_content.js +6 -12
  114. package/dist/cjs/ui/system/flex_container/align_items.js +6 -12
  115. package/dist/cjs/ui/system/flex_container/flex_container_set.js +15 -27
  116. package/dist/cjs/ui/system/flex_container/flex_direction.js +5 -11
  117. package/dist/cjs/ui/system/flex_container/flex_wrap.js +5 -11
  118. package/dist/cjs/ui/system/flex_container/justify_content.js +5 -11
  119. package/dist/cjs/ui/system/flex_container/justify_items.js +5 -11
  120. package/dist/cjs/ui/system/flex_item/align_self.js +6 -12
  121. package/dist/cjs/ui/system/flex_item/flex.js +5 -11
  122. package/dist/cjs/ui/system/flex_item/flex_basis.js +5 -11
  123. package/dist/cjs/ui/system/flex_item/flex_grow.js +5 -11
  124. package/dist/cjs/ui/system/flex_item/flex_item_set.js +15 -28
  125. package/dist/cjs/ui/system/flex_item/flex_shrink.js +5 -11
  126. package/dist/cjs/ui/system/flex_item/justify_self.js +5 -11
  127. package/dist/cjs/ui/system/flex_item/order.js +5 -11
  128. package/dist/cjs/ui/system/index.js +310 -362
  129. package/dist/cjs/ui/system/overflow.js +8 -9
  130. package/dist/cjs/ui/system/position/bottom.js +6 -13
  131. package/dist/cjs/ui/system/position/left.js +5 -12
  132. package/dist/cjs/ui/system/position/position.js +5 -11
  133. package/dist/cjs/ui/system/position/position_set.js +15 -27
  134. package/dist/cjs/ui/system/position/right.js +5 -12
  135. package/dist/cjs/ui/system/position/top.js +5 -12
  136. package/dist/cjs/ui/system/position/z_index.js +5 -11
  137. package/dist/cjs/ui/system/spacing/margin.js +5 -12
  138. package/dist/cjs/ui/system/spacing/padding.js +5 -12
  139. package/dist/cjs/ui/system/spacing/spacing_set.js +15 -23
  140. package/dist/cjs/ui/system/typography/font_family.js +5 -11
  141. package/dist/cjs/ui/system/typography/font_size.js +5 -11
  142. package/dist/cjs/ui/system/typography/font_style.js +5 -11
  143. package/dist/cjs/ui/system/typography/font_weight.js +5 -11
  144. package/dist/cjs/ui/system/typography/letter_spacing.js +5 -11
  145. package/dist/cjs/ui/system/typography/line_height.js +5 -11
  146. package/dist/cjs/ui/system/typography/text_align.js +5 -11
  147. package/dist/cjs/ui/system/typography/text_color.js +5 -11
  148. package/dist/cjs/ui/system/typography/text_decoration.js +5 -11
  149. package/dist/cjs/ui/system/typography/text_transform.js +5 -11
  150. package/dist/cjs/ui/system/typography/typography_set.js +15 -31
  151. package/dist/cjs/ui/system/utils/create_responsive_prop_type.js +2 -4
  152. package/dist/cjs/ui/system/utils/create_style_prop_types.js +5 -13
  153. package/dist/cjs/ui/system/utils/ensure_numbers_are_within_scale.js +2 -14
  154. package/dist/cjs/ui/system/utils/get_style_props_for_responsive_prop.js +30 -70
  155. package/dist/cjs/ui/table_picker.js +26 -43
  156. package/dist/cjs/ui/table_picker_synced.js +33 -42
  157. package/dist/cjs/ui/text.js +59 -71
  158. package/dist/cjs/ui/text_button.js +80 -97
  159. package/dist/cjs/ui/theme/default_theme/button_variants.js +1 -5
  160. package/dist/cjs/ui/theme/default_theme/control_sizes.js +29 -42
  161. package/dist/cjs/ui/theme/default_theme/heading_styles.js +4 -5
  162. package/dist/cjs/ui/theme/default_theme/index.js +15 -32
  163. package/dist/cjs/ui/theme/default_theme/input_variants.js +1 -5
  164. package/dist/cjs/ui/theme/default_theme/link_variants.js +1 -5
  165. package/dist/cjs/ui/theme/default_theme/select_buttons_variants.js +1 -5
  166. package/dist/cjs/ui/theme/default_theme/select_variants.js +10 -21
  167. package/dist/cjs/ui/theme/default_theme/switch_variants.js +8 -20
  168. package/dist/cjs/ui/theme/default_theme/text_button_variants.js +1 -5
  169. package/dist/cjs/ui/theme/default_theme/text_styles.js +1 -2
  170. package/dist/cjs/ui/theme/default_theme/tokens.js +33 -35
  171. package/dist/cjs/ui/theme/theme_context.js +3 -6
  172. package/dist/cjs/ui/theme/use_theme.js +1 -7
  173. package/dist/cjs/ui/tooltip.js +38 -79
  174. package/dist/cjs/ui/types/aria_props.js +3 -7
  175. package/dist/cjs/ui/types/data_attributes_prop.js +8 -6
  176. package/dist/cjs/ui/types/tooltip_anchor_props.js +4 -5
  177. package/dist/cjs/ui/ui.js +89 -130
  178. package/dist/cjs/ui/unstable_standalone_ui.js +18 -42
  179. package/dist/cjs/ui/use_array_identity.js +0 -4
  180. package/dist/cjs/ui/use_base.js +4 -13
  181. package/dist/cjs/ui/use_cursor.js +3 -12
  182. package/dist/cjs/ui/use_form_field.js +4 -6
  183. package/dist/cjs/ui/use_global_config.js +3 -10
  184. package/dist/cjs/ui/use_loadable.js +59 -132
  185. package/dist/cjs/ui/use_record_action_data.js +6 -12
  186. package/dist/cjs/ui/use_records.js +23 -24
  187. package/dist/cjs/ui/use_session.js +6 -15
  188. package/dist/cjs/ui/use_settings_button.js +4 -11
  189. package/dist/cjs/ui/use_styled_system.js +12 -21
  190. package/dist/cjs/ui/use_synced.js +0 -7
  191. package/dist/cjs/ui/use_text_color_for_background_color.js +1 -5
  192. package/dist/cjs/ui/use_view_metadata.js +5 -8
  193. package/dist/cjs/ui/use_viewport.js +1 -7
  194. package/dist/cjs/ui/use_watchable.js +36 -74
  195. package/dist/cjs/ui/view_picker.js +44 -78
  196. package/dist/cjs/ui/view_picker_synced.js +33 -44
  197. package/dist/cjs/ui/viewport_constraint.js +37 -64
  198. package/dist/cjs/ui/with_hooks.js +17 -22
  199. package/dist/cjs/ui/with_styled_system.js +33 -60
  200. package/dist/cjs/undo_redo.js +12 -32
  201. package/dist/cjs/unstable_private_utils.js +6 -8
  202. package/dist/cjs/unstable_testing_utils.js +44 -57
  203. package/dist/cjs/viewport.js +127 -189
  204. package/dist/cjs/warning.js +5 -6
  205. package/dist/cjs/watchable.js +66 -148
  206. package/dist/types/src/colors.d.ts +1 -1
  207. package/dist/types/src/colors.d.ts.map +1 -1
  208. package/dist/types/src/global_config.d.ts +1 -1
  209. package/dist/types/src/global_config.d.ts.map +1 -1
  210. package/dist/types/src/models/base.d.ts +1 -1
  211. package/dist/types/src/models/base.d.ts.map +1 -1
  212. package/dist/types/src/models/cursor.d.ts +1 -1
  213. package/dist/types/src/models/cursor.d.ts.map +1 -1
  214. package/dist/types/src/models/field.d.ts +1 -1
  215. package/dist/types/src/models/field.d.ts.map +1 -1
  216. package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
  217. package/dist/types/src/models/models.d.ts.map +1 -1
  218. package/dist/types/src/models/record.d.ts +1 -1
  219. package/dist/types/src/models/record.d.ts.map +1 -1
  220. package/dist/types/src/models/record_coloring.d.ts +2 -2
  221. package/dist/types/src/models/record_coloring.d.ts.map +1 -1
  222. package/dist/types/src/models/record_query_result.d.ts +3 -3
  223. package/dist/types/src/models/record_query_result.d.ts.map +1 -1
  224. package/dist/types/src/models/session.d.ts +1 -1
  225. package/dist/types/src/models/session.d.ts.map +1 -1
  226. package/dist/types/src/models/table.d.ts +1 -1
  227. package/dist/types/src/models/table.d.ts.map +1 -1
  228. package/dist/types/src/models/view.d.ts +1 -1
  229. package/dist/types/src/models/view.d.ts.map +1 -1
  230. package/dist/types/src/models/view_metadata_query_result.d.ts +2 -2
  231. package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
  232. package/dist/types/src/perform_record_action.d.ts +1 -1
  233. package/dist/types/src/perform_record_action.d.ts.map +1 -1
  234. package/dist/types/src/private_utils.d.ts +8 -8
  235. package/dist/types/src/private_utils.d.ts.map +1 -1
  236. package/dist/types/src/sdk.d.ts +1 -1
  237. package/dist/types/src/sdk.d.ts.map +1 -1
  238. package/dist/types/src/settings_button.d.ts +1 -1
  239. package/dist/types/src/settings_button.d.ts.map +1 -1
  240. package/dist/types/src/types/aggregators.d.ts +1 -1
  241. package/dist/types/src/types/aggregators.d.ts.map +1 -1
  242. package/dist/types/src/types/airtable_interface.d.ts +6 -6
  243. package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
  244. package/dist/types/src/types/attachment.d.ts +1 -1
  245. package/dist/types/src/types/attachment.d.ts.map +1 -1
  246. package/dist/types/src/types/base.d.ts +1 -1
  247. package/dist/types/src/types/base.d.ts.map +1 -1
  248. package/dist/types/src/types/block.d.ts +1 -1
  249. package/dist/types/src/types/block.d.ts.map +1 -1
  250. package/dist/types/src/types/collaborator.d.ts +1 -1
  251. package/dist/types/src/types/collaborator.d.ts.map +1 -1
  252. package/dist/types/src/types/field.d.ts +5 -5
  253. package/dist/types/src/types/field.d.ts.map +1 -1
  254. package/dist/types/src/types/global_config.d.ts +6 -6
  255. package/dist/types/src/types/global_config.d.ts.map +1 -1
  256. package/dist/types/src/types/mutations.d.ts +4 -4
  257. package/dist/types/src/types/mutations.d.ts.map +1 -1
  258. package/dist/types/src/types/permission_levels.d.ts +1 -1
  259. package/dist/types/src/types/permission_levels.d.ts.map +1 -1
  260. package/dist/types/src/types/record.d.ts +2 -2
  261. package/dist/types/src/types/record.d.ts.map +1 -1
  262. package/dist/types/src/types/record_action_data.d.ts +1 -1
  263. package/dist/types/src/types/record_action_data.d.ts.map +1 -1
  264. package/dist/types/src/types/table.d.ts +3 -3
  265. package/dist/types/src/types/table.d.ts.map +1 -1
  266. package/dist/types/src/types/undo_redo.d.ts +1 -1
  267. package/dist/types/src/types/undo_redo.d.ts.map +1 -1
  268. package/dist/types/src/types/view.d.ts +4 -4
  269. package/dist/types/src/types/view.d.ts.map +1 -1
  270. package/dist/types/src/ui/base_provider.d.ts +1 -1
  271. package/dist/types/src/ui/base_provider.d.ts.map +1 -1
  272. package/dist/types/src/ui/block_wrapper.d.ts +2 -2
  273. package/dist/types/src/ui/button.d.ts +1 -1
  274. package/dist/types/src/ui/button.d.ts.map +1 -1
  275. package/dist/types/src/ui/cell_renderer.d.ts +2 -2
  276. package/dist/types/src/ui/choice_token.d.ts +3 -3
  277. package/dist/types/src/ui/choice_token.d.ts.map +1 -1
  278. package/dist/types/src/ui/collaborator_token.d.ts +5 -5
  279. package/dist/types/src/ui/collaborator_token.d.ts.map +1 -1
  280. package/dist/types/src/ui/color_palette.d.ts +2 -2
  281. package/dist/types/src/ui/color_palette_synced.d.ts +2 -2
  282. package/dist/types/src/ui/confirmation_dialog.d.ts +1 -1
  283. package/dist/types/src/ui/control_sizes.d.ts +2 -2
  284. package/dist/types/src/ui/control_sizes.d.ts.map +1 -1
  285. package/dist/types/src/ui/dialog.d.ts +2 -2
  286. package/dist/types/src/ui/dialog.d.ts.map +1 -1
  287. package/dist/types/src/ui/dialog_close_button.d.ts +1 -1
  288. package/dist/types/src/ui/field_icon.d.ts +3 -3
  289. package/dist/types/src/ui/field_icon.d.ts.map +1 -1
  290. package/dist/types/src/ui/field_picker.d.ts +1 -1
  291. package/dist/types/src/ui/global_alert.d.ts +1 -1
  292. package/dist/types/src/ui/global_alert.d.ts.map +1 -1
  293. package/dist/types/src/ui/global_config_synced_component_helpers.d.ts +1 -1
  294. package/dist/types/src/ui/global_config_synced_component_helpers.d.ts.map +1 -1
  295. package/dist/types/src/ui/heading.d.ts +3 -3
  296. package/dist/types/src/ui/heading.d.ts.map +1 -1
  297. package/dist/types/src/ui/icon.d.ts +1 -1
  298. package/dist/types/src/ui/icon_config.d.ts +39 -39
  299. package/dist/types/src/ui/icon_config.d.ts.map +1 -1
  300. package/dist/types/src/ui/initialize_block.d.ts +3 -3
  301. package/dist/types/src/ui/initialize_block.d.ts.map +1 -1
  302. package/dist/types/src/ui/input.d.ts +15 -15
  303. package/dist/types/src/ui/input.d.ts.map +1 -1
  304. package/dist/types/src/ui/link.d.ts +1 -1
  305. package/dist/types/src/ui/link.d.ts.map +1 -1
  306. package/dist/types/src/ui/loader.d.ts +1 -1
  307. package/dist/types/src/ui/loader.d.ts.map +1 -1
  308. package/dist/types/src/ui/model_picker_select.d.ts +1 -1
  309. package/dist/types/src/ui/model_picker_select.d.ts.map +1 -1
  310. package/dist/types/src/ui/popover.d.ts +5 -5
  311. package/dist/types/src/ui/popover.d.ts.map +1 -1
  312. package/dist/types/src/ui/progress_bar.d.ts +1 -1
  313. package/dist/types/src/ui/progress_bar.d.ts.map +1 -1
  314. package/dist/types/src/ui/record_card.d.ts +2 -2
  315. package/dist/types/src/ui/record_card.d.ts.map +1 -1
  316. package/dist/types/src/ui/record_card_list.d.ts +1 -1
  317. package/dist/types/src/ui/select.d.ts +4 -4
  318. package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts +4 -4
  319. package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
  320. package/dist/types/src/ui/select_buttons.d.ts +4 -4
  321. package/dist/types/src/ui/switch.d.ts +1 -1
  322. package/dist/types/src/ui/switch.d.ts.map +1 -1
  323. package/dist/types/src/ui/synced.d.ts +3 -3
  324. package/dist/types/src/ui/system/all_styles_set.d.ts +0 -1
  325. package/dist/types/src/ui/system/all_styles_set.d.ts.map +1 -1
  326. package/dist/types/src/ui/system/appearance/appearance_set.d.ts +0 -1
  327. package/dist/types/src/ui/system/appearance/appearance_set.d.ts.map +1 -1
  328. package/dist/types/src/ui/system/appearance/background_color.d.ts +0 -1
  329. package/dist/types/src/ui/system/appearance/background_color.d.ts.map +1 -1
  330. package/dist/types/src/ui/system/appearance/border.d.ts +0 -1
  331. package/dist/types/src/ui/system/appearance/border.d.ts.map +1 -1
  332. package/dist/types/src/ui/system/appearance/border_radius.d.ts +0 -1
  333. package/dist/types/src/ui/system/appearance/border_radius.d.ts.map +1 -1
  334. package/dist/types/src/ui/system/appearance/box_shadow.d.ts +0 -1
  335. package/dist/types/src/ui/system/appearance/box_shadow.d.ts.map +1 -1
  336. package/dist/types/src/ui/system/appearance/opacity.d.ts +0 -1
  337. package/dist/types/src/ui/system/appearance/opacity.d.ts.map +1 -1
  338. package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts +0 -1
  339. package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
  340. package/dist/types/src/ui/system/dimensions/height.d.ts +0 -1
  341. package/dist/types/src/ui/system/dimensions/height.d.ts.map +1 -1
  342. package/dist/types/src/ui/system/dimensions/max_height.d.ts +0 -1
  343. package/dist/types/src/ui/system/dimensions/max_height.d.ts.map +1 -1
  344. package/dist/types/src/ui/system/dimensions/max_width.d.ts +0 -1
  345. package/dist/types/src/ui/system/dimensions/max_width.d.ts.map +1 -1
  346. package/dist/types/src/ui/system/dimensions/min_height.d.ts +0 -1
  347. package/dist/types/src/ui/system/dimensions/min_height.d.ts.map +1 -1
  348. package/dist/types/src/ui/system/dimensions/min_width.d.ts +0 -1
  349. package/dist/types/src/ui/system/dimensions/min_width.d.ts.map +1 -1
  350. package/dist/types/src/ui/system/dimensions/width.d.ts +0 -1
  351. package/dist/types/src/ui/system/dimensions/width.d.ts.map +1 -1
  352. package/dist/types/src/ui/system/display.d.ts +0 -1
  353. package/dist/types/src/ui/system/display.d.ts.map +1 -1
  354. package/dist/types/src/ui/system/flex_container/align_content.d.ts +0 -1
  355. package/dist/types/src/ui/system/flex_container/align_content.d.ts.map +1 -1
  356. package/dist/types/src/ui/system/flex_container/align_items.d.ts +0 -1
  357. package/dist/types/src/ui/system/flex_container/align_items.d.ts.map +1 -1
  358. package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts +0 -1
  359. package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
  360. package/dist/types/src/ui/system/flex_container/flex_direction.d.ts +0 -1
  361. package/dist/types/src/ui/system/flex_container/flex_direction.d.ts.map +1 -1
  362. package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts +0 -1
  363. package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
  364. package/dist/types/src/ui/system/flex_container/justify_content.d.ts +0 -1
  365. package/dist/types/src/ui/system/flex_container/justify_content.d.ts.map +1 -1
  366. package/dist/types/src/ui/system/flex_container/justify_items.d.ts +0 -1
  367. package/dist/types/src/ui/system/flex_container/justify_items.d.ts.map +1 -1
  368. package/dist/types/src/ui/system/flex_item/align_self.d.ts +0 -1
  369. package/dist/types/src/ui/system/flex_item/align_self.d.ts.map +1 -1
  370. package/dist/types/src/ui/system/flex_item/flex.d.ts +0 -1
  371. package/dist/types/src/ui/system/flex_item/flex.d.ts.map +1 -1
  372. package/dist/types/src/ui/system/flex_item/flex_basis.d.ts +0 -1
  373. package/dist/types/src/ui/system/flex_item/flex_basis.d.ts.map +1 -1
  374. package/dist/types/src/ui/system/flex_item/flex_grow.d.ts +0 -1
  375. package/dist/types/src/ui/system/flex_item/flex_grow.d.ts.map +1 -1
  376. package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts +0 -1
  377. package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
  378. package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts +0 -1
  379. package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
  380. package/dist/types/src/ui/system/flex_item/justify_self.d.ts +0 -1
  381. package/dist/types/src/ui/system/flex_item/justify_self.d.ts.map +1 -1
  382. package/dist/types/src/ui/system/flex_item/order.d.ts +0 -1
  383. package/dist/types/src/ui/system/flex_item/order.d.ts.map +1 -1
  384. package/dist/types/src/ui/system/overflow.d.ts +0 -1
  385. package/dist/types/src/ui/system/overflow.d.ts.map +1 -1
  386. package/dist/types/src/ui/system/position/bottom.d.ts +0 -1
  387. package/dist/types/src/ui/system/position/bottom.d.ts.map +1 -1
  388. package/dist/types/src/ui/system/position/left.d.ts +0 -1
  389. package/dist/types/src/ui/system/position/left.d.ts.map +1 -1
  390. package/dist/types/src/ui/system/position/position.d.ts +0 -1
  391. package/dist/types/src/ui/system/position/position.d.ts.map +1 -1
  392. package/dist/types/src/ui/system/position/position_set.d.ts +0 -1
  393. package/dist/types/src/ui/system/position/position_set.d.ts.map +1 -1
  394. package/dist/types/src/ui/system/position/right.d.ts +0 -1
  395. package/dist/types/src/ui/system/position/right.d.ts.map +1 -1
  396. package/dist/types/src/ui/system/position/top.d.ts +0 -1
  397. package/dist/types/src/ui/system/position/top.d.ts.map +1 -1
  398. package/dist/types/src/ui/system/position/z_index.d.ts +0 -1
  399. package/dist/types/src/ui/system/position/z_index.d.ts.map +1 -1
  400. package/dist/types/src/ui/system/spacing/margin.d.ts +0 -1
  401. package/dist/types/src/ui/system/spacing/margin.d.ts.map +1 -1
  402. package/dist/types/src/ui/system/spacing/padding.d.ts +0 -1
  403. package/dist/types/src/ui/system/spacing/padding.d.ts.map +1 -1
  404. package/dist/types/src/ui/system/spacing/spacing_set.d.ts +0 -1
  405. package/dist/types/src/ui/system/spacing/spacing_set.d.ts.map +1 -1
  406. package/dist/types/src/ui/system/typography/font_family.d.ts +0 -1
  407. package/dist/types/src/ui/system/typography/font_family.d.ts.map +1 -1
  408. package/dist/types/src/ui/system/typography/font_size.d.ts +0 -1
  409. package/dist/types/src/ui/system/typography/font_size.d.ts.map +1 -1
  410. package/dist/types/src/ui/system/typography/font_style.d.ts +0 -1
  411. package/dist/types/src/ui/system/typography/font_style.d.ts.map +1 -1
  412. package/dist/types/src/ui/system/typography/font_weight.d.ts +0 -1
  413. package/dist/types/src/ui/system/typography/font_weight.d.ts.map +1 -1
  414. package/dist/types/src/ui/system/typography/letter_spacing.d.ts +0 -1
  415. package/dist/types/src/ui/system/typography/letter_spacing.d.ts.map +1 -1
  416. package/dist/types/src/ui/system/typography/line_height.d.ts +0 -1
  417. package/dist/types/src/ui/system/typography/line_height.d.ts.map +1 -1
  418. package/dist/types/src/ui/system/typography/text_align.d.ts +0 -1
  419. package/dist/types/src/ui/system/typography/text_align.d.ts.map +1 -1
  420. package/dist/types/src/ui/system/typography/text_color.d.ts +0 -1
  421. package/dist/types/src/ui/system/typography/text_color.d.ts.map +1 -1
  422. package/dist/types/src/ui/system/typography/text_decoration.d.ts +0 -1
  423. package/dist/types/src/ui/system/typography/text_decoration.d.ts.map +1 -1
  424. package/dist/types/src/ui/system/typography/text_transform.d.ts +0 -1
  425. package/dist/types/src/ui/system/typography/text_transform.d.ts.map +1 -1
  426. package/dist/types/src/ui/system/typography/typography_set.d.ts +0 -1
  427. package/dist/types/src/ui/system/typography/typography_set.d.ts.map +1 -1
  428. package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts +1 -1
  429. package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts.map +1 -1
  430. package/dist/types/src/ui/system/utils/csstype.d.ts +578 -578
  431. package/dist/types/src/ui/system/utils/csstype.d.ts.map +1 -1
  432. package/dist/types/src/ui/system/utils/types.d.ts +4 -4
  433. package/dist/types/src/ui/system/utils/types.d.ts.map +1 -1
  434. package/dist/types/src/ui/text.d.ts +3 -3
  435. package/dist/types/src/ui/text.d.ts.map +1 -1
  436. package/dist/types/src/ui/text_button.d.ts +1 -1
  437. package/dist/types/src/ui/text_button.d.ts.map +1 -1
  438. package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts +2 -2
  439. package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts.map +1 -1
  440. package/dist/types/src/ui/theme/default_theme/index.d.ts +1 -1
  441. package/dist/types/src/ui/theme/theme_context.d.ts +1 -3
  442. package/dist/types/src/ui/theme/theme_context.d.ts.map +1 -1
  443. package/dist/types/src/ui/theme/use_theme.d.ts +1 -1
  444. package/dist/types/src/ui/tooltip.d.ts +3 -3
  445. package/dist/types/src/ui/types/data_attributes_prop.d.ts.map +1 -1
  446. package/dist/types/src/ui/types/tooltip_anchor_props.d.ts +0 -1
  447. package/dist/types/src/ui/types/tooltip_anchor_props.d.ts.map +1 -1
  448. package/dist/types/src/ui/use_base.d.ts.map +1 -1
  449. package/dist/types/src/ui/use_cursor.d.ts.map +1 -1
  450. package/dist/types/src/ui/use_form_field.d.ts +0 -2
  451. package/dist/types/src/ui/use_form_field.d.ts.map +1 -1
  452. package/dist/types/src/ui/use_records.d.ts +2 -2
  453. package/dist/types/src/ui/use_records.d.ts.map +1 -1
  454. package/dist/types/src/ui/use_session.d.ts.map +1 -1
  455. package/dist/types/src/ui/view_picker.d.ts +2 -2
  456. package/dist/types/src/ui/view_picker.d.ts.map +1 -1
  457. package/dist/types/src/ui/viewport_constraint.d.ts +3 -3
  458. package/dist/types/src/ui/viewport_constraint.d.ts.map +1 -1
  459. package/dist/types/src/viewport.d.ts +2 -2
  460. package/dist/types/src/viewport.d.ts.map +1 -1
  461. package/dist/types/src/warning.d.ts +1 -1
  462. package/dist/types/src/warning.d.ts.map +1 -1
  463. package/dist/types/stories/helpers/code_block.d.ts +2 -2
  464. package/dist/types/stories/helpers/code_block.d.ts.map +1 -1
  465. package/dist/types/stories/helpers/example.d.ts +5 -5
  466. package/dist/types/stories/helpers/example.d.ts.map +1 -1
  467. package/dist/types/stories/helpers/example_code_panel.d.ts +2 -2
  468. package/dist/types/stories/helpers/example_code_panel.d.ts.map +1 -1
  469. package/dist/types/stories/helpers/fake_cell_renderer.d.ts +2 -2
  470. package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +1 -1
  471. package/dist/types/stories/helpers/fake_foreign_record.d.ts +1 -1
  472. package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +1 -1
  473. package/dist/types/stories/helpers/fake_record_card.d.ts +2 -2
  474. package/dist/types/stories/helpers/fake_record_card.d.ts.map +1 -1
  475. package/dist/types/stories/helpers/style_prop_list.d.ts +2 -2
  476. package/dist/types/stories/helpers/style_prop_list.d.ts.map +1 -1
  477. package/dist/types/stories/icon_example.d.ts +2 -2
  478. package/dist/types/stories/icon_example.d.ts.map +1 -1
  479. package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -1
  480. package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
  481. package/package.json +26 -25
@@ -1,90 +1,61 @@
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");
9
+ require("core-js/modules/web.dom-collections.iterator.js");
3
10
  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.find");
12
-
13
- require("core-js/modules/es.array.includes");
14
-
15
- require("core-js/modules/es.array.iterator");
16
-
17
- require("core-js/modules/es.array.map");
18
-
19
- require("core-js/modules/es.object.from-entries");
20
-
21
- require("core-js/modules/es.object.get-own-property-descriptors");
22
-
23
- require("core-js/modules/es.object.to-string");
24
-
25
- require("core-js/modules/es.promise");
26
-
27
- require("core-js/modules/es.string.includes");
28
-
29
- require("core-js/modules/web.dom-collections.for-each");
30
-
31
- require("core-js/modules/web.dom-collections.iterator");
32
-
33
11
  Object.defineProperty(exports, "__esModule", {
34
12
  value: true
35
13
  });
36
14
  exports.default = exports.WatchableTableKeys = void 0;
37
-
38
15
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
39
-
40
- require("regenerator-runtime/runtime");
41
-
16
+ require("core-js/modules/es.symbol.js");
17
+ require("core-js/modules/es.symbol.description.js");
18
+ require("core-js/modules/es.array.find.js");
19
+ require("core-js/modules/es.array.includes.js");
20
+ require("core-js/modules/es.array.iterator.js");
21
+ require("core-js/modules/es.array.map.js");
22
+ require("core-js/modules/es.object.from-entries.js");
23
+ require("core-js/modules/es.object.to-string.js");
24
+ require("core-js/modules/es.string.includes.js");
25
+ require("core-js/modules/web.dom-collections.for-each.js");
26
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
42
27
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
43
-
44
28
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
45
-
29
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
46
30
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
47
-
48
31
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
49
-
50
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
51
-
52
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
53
-
54
32
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
55
-
56
33
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
57
-
58
34
  var _mutations = require("../types/mutations");
59
-
60
35
  var _private_utils = require("../private_utils");
61
-
62
36
  var _error_utils = require("../error_utils");
63
-
64
37
  var _abstract_model = _interopRequireDefault(require("./abstract_model"));
65
-
66
38
  var _view = _interopRequireDefault(require("./view"));
67
-
68
39
  var _field = _interopRequireDefault(require("./field"));
69
-
70
40
  var _object_pool = _interopRequireDefault(require("./object_pool"));
71
-
72
41
  var _record_query_result = _interopRequireDefault(require("./record_query_result"));
73
-
74
42
  var _table_or_view_query_result = _interopRequireDefault(require("./table_or_view_query_result"));
75
-
76
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
77
-
78
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
79
-
43
+ 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; }
44
+ 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; }
45
+ 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; } } }; }
46
+ 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; } }
47
+ 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; }
48
+ 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)); }
49
+ 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: Table */ /** */
80
50
  // This doesn't follow our enum naming conventions because we want the keys
81
51
  // to mirror the method/getter names on the model class.
82
- var WatchableTableKeys = Object.freeze({
52
+ var WatchableTableKeys = exports.WatchableTableKeys = Object.freeze({
83
53
  name: 'name',
84
54
  description: 'description',
85
55
  views: 'views',
86
56
  fields: 'fields'
87
57
  });
58
+
88
59
  /**
89
60
  * A key in {@link Table} that can be watched.
90
61
  * - `name`
@@ -92,63 +63,150 @@ var WatchableTableKeys = Object.freeze({
92
63
  * - `views`
93
64
  * - `fields`
94
65
  */
95
-
96
- exports.WatchableTableKeys = WatchableTableKeys;
97
-
98
66
  /**
99
67
  * Model class representing a table. Every {@link Base} has one or more tables.
100
68
  *
101
69
  * @docsPath models/Table
102
70
  */
103
- var Table =
104
- /*#__PURE__*/
105
- function (_AbstractModel) {
106
- (0, _inherits2.default)(Table, _AbstractModel);
107
- (0, _createClass2.default)(Table, null, [{
108
- key: "_isWatchableKey",
109
-
110
- /** @internal */
111
-
112
- /** @internal */
113
- value: function _isWatchableKey(key) {
114
- return (0, _private_utils.isEnumValue)(WatchableTableKeys, key);
115
- }
116
- /** @internal */
117
-
118
- }]);
119
-
71
+ var Table = /*#__PURE__*/function (_AbstractModel) {
120
72
  /**
121
73
  * @internal
122
74
  */
123
75
  function Table(parentBase, recordStore, tableId, sdk) {
124
76
  var _this;
125
-
126
77
  (0, _classCallCheck2.default)(this, Table);
127
- _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(Table).call(this, sdk, tableId));
128
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_parentBase", void 0);
129
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_viewModelsById", void 0);
130
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_fieldModelsById", void 0);
131
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_cachedFieldNamesById", void 0);
132
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_recordStore", void 0);
133
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "__tableOrViewQueryResultPool", void 0);
78
+ _this = _callSuper(this, Table, [sdk, tableId]);
79
+ /** @internal */
80
+ (0, _defineProperty2.default)(_this, "_parentBase", void 0);
81
+ /** @internal */
82
+ (0, _defineProperty2.default)(_this, "_viewModelsById", void 0);
83
+ /** @internal */
84
+ (0, _defineProperty2.default)(_this, "_fieldModelsById", void 0);
85
+ /** @internal */
86
+ (0, _defineProperty2.default)(_this, "_cachedFieldNamesById", void 0);
87
+ /** @internal */
88
+ (0, _defineProperty2.default)(_this, "_recordStore", void 0);
89
+ /** @internal */
90
+ (0, _defineProperty2.default)(_this, "__tableOrViewQueryResultPool", void 0);
134
91
  _this._parentBase = parentBase;
135
92
  _this._recordStore = recordStore;
136
93
  _this._viewModelsById = {}; // View instances are lazily created by getViewById.
137
-
138
94
  _this._fieldModelsById = {}; // Field instances are lazily created by getFieldById.
139
-
140
95
  _this._cachedFieldNamesById = null;
141
96
  _this.__tableOrViewQueryResultPool = new _object_pool.default(_table_or_view_query_result.default);
142
97
  return _this;
143
98
  }
99
+
144
100
  /**
145
101
  * @internal
146
102
  */
147
-
148
-
149
- (0, _createClass2.default)(Table, [{
150
- key: "getFieldByIdIfExists",
151
-
103
+ (0, _inherits2.default)(Table, _AbstractModel);
104
+ return (0, _createClass2.default)(Table, [{
105
+ key: "_dataOrNullIfDeleted",
106
+ get: function get() {
107
+ var _this$_baseData$table;
108
+ return (_this$_baseData$table = this._baseData.tablesById[this._id]) !== null && _this$_baseData$table !== void 0 ? _this$_baseData$table : null;
109
+ }
110
+ /**
111
+ * The base that this table belongs to.
112
+ *
113
+ * @internal (since we may not be able to return parent model instances in the immutable models world)
114
+ * @example
115
+ * ```js
116
+ * import {base} from '@airtable/blocks';
117
+ * const table = base.getTableByName('Table 1');
118
+ * console.log(table.parentBase.id === base.id);
119
+ * // => true
120
+ * ```
121
+ */
122
+ }, {
123
+ key: "parentBase",
124
+ get: function get() {
125
+ return this._parentBase;
126
+ }
127
+ /**
128
+ * The name of the table. Can be watched.
129
+ *
130
+ * @example
131
+ * ```js
132
+ * console.log(myTable.name);
133
+ * // => 'Table 1'
134
+ * ```
135
+ */
136
+ }, {
137
+ key: "name",
138
+ get: function get() {
139
+ return this._data.name;
140
+ }
141
+ /**
142
+ * The description of the table, if it has one. Can be watched.
143
+ *
144
+ * @example
145
+ * ```js
146
+ * console.log(myTable.description);
147
+ * // => 'This is my table'
148
+ * ```
149
+ */
150
+ }, {
151
+ key: "description",
152
+ get: function get() {
153
+ return this._data.description;
154
+ }
155
+ /**
156
+ * The URL for the table. You can visit this URL in the browser to be taken to the table in the Airtable UI.
157
+ *
158
+ * @example
159
+ * ```js
160
+ * console.log(myTable.url);
161
+ * // => 'https://airtable.com/appxxxxxxxxxxxxxx/tblxxxxxxxxxxxxxx'
162
+ * ```
163
+ */
164
+ }, {
165
+ key: "url",
166
+ get: function get() {
167
+ return this._sdk.__airtableInterface.urlConstructor.getTableUrl(this.id);
168
+ }
169
+ /**
170
+ * The table's primary field. Every table has exactly one primary
171
+ * field. The primary field of a table will not change.
172
+ *
173
+ * @example
174
+ * ```js
175
+ * console.log(myTable.primaryField.name);
176
+ * // => 'Name'
177
+ * ```
178
+ */
179
+ }, {
180
+ key: "primaryField",
181
+ get: function get() {
182
+ var primaryField = this.getFieldById(this._data.primaryFieldId);
183
+ return primaryField;
184
+ }
185
+ /**
186
+ * The fields in this table. The order is arbitrary, since fields are
187
+ * only ordered in the context of a specific view.
188
+ *
189
+ * Can be watched to know when fields are created or deleted.
190
+ *
191
+ * @example
192
+ * ```js
193
+ * console.log(`This table has ${myTable.fields.length} fields`);
194
+ * ```
195
+ */
196
+ }, {
197
+ key: "fields",
198
+ get: function get() {
199
+ // TODO(kasra): is it confusing that this returns an array, since the order
200
+ // is arbitrary?
201
+ // TODO(kasra): cache and freeze this so it isn't O(n)
202
+ var fields = [];
203
+ for (var _i = 0, _Object$keys = Object.keys(this._data.fieldsById); _i < _Object$keys.length; _i++) {
204
+ var fieldId = _Object$keys[_i];
205
+ var field = this.getFieldById(fieldId);
206
+ fields.push(field);
207
+ }
208
+ return fields;
209
+ }
152
210
  /**
153
211
  * Gets the field matching the given ID, or `null` if that field does not exist in this table.
154
212
  * @param fieldId The ID of the field.
@@ -163,6 +221,8 @@ function (_AbstractModel) {
163
221
  * }
164
222
  * ```
165
223
  */
224
+ }, {
225
+ key: "getFieldByIdIfExists",
166
226
  value: function getFieldByIdIfExists(fieldId) {
167
227
  if (!this._data.fieldsById[fieldId]) {
168
228
  return null;
@@ -170,7 +230,6 @@ function (_AbstractModel) {
170
230
  if (!this._fieldModelsById[fieldId]) {
171
231
  this._fieldModelsById[fieldId] = new _field.default(this._sdk, this, fieldId);
172
232
  }
173
-
174
233
  return this._fieldModelsById[fieldId];
175
234
  }
176
235
  }
@@ -188,16 +247,13 @@ function (_AbstractModel) {
188
247
  * // => 'Name'
189
248
  * ```
190
249
  */
191
-
192
250
  }, {
193
251
  key: "getFieldById",
194
252
  value: function getFieldById(fieldId) {
195
253
  var field = this.getFieldByIdIfExists(fieldId);
196
-
197
254
  if (!field) {
198
255
  throw (0, _error_utils.spawnError)("No field with ID %s in table '%s'", fieldId, this.name);
199
256
  }
200
-
201
257
  return field;
202
258
  }
203
259
  /**
@@ -215,39 +271,25 @@ function (_AbstractModel) {
215
271
  * }
216
272
  * ```
217
273
  */
218
-
219
274
  }, {
220
275
  key: "getFieldByNameIfExists",
221
276
  value: function getFieldByNameIfExists(fieldName) {
222
- var _iteratorNormalCompletion = true;
223
- var _didIteratorError = false;
224
- var _iteratorError = undefined;
225
-
277
+ var _iterator = _createForOfIteratorHelper((0, _private_utils.entries)(this._data.fieldsById)),
278
+ _step;
226
279
  try {
227
- for (var _iterator = (0, _private_utils.entries)(this._data.fieldsById)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
280
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
228
281
  var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
229
- fieldId = _step$value[0],
230
- fieldData = _step$value[1];
231
-
282
+ fieldId = _step$value[0],
283
+ fieldData = _step$value[1];
232
284
  if (fieldData.name === fieldName) {
233
285
  return this.getFieldByIdIfExists(fieldId);
234
286
  }
235
287
  }
236
288
  } catch (err) {
237
- _didIteratorError = true;
238
- _iteratorError = err;
289
+ _iterator.e(err);
239
290
  } finally {
240
- try {
241
- if (!_iteratorNormalCompletion && _iterator.return != null) {
242
- _iterator.return();
243
- }
244
- } finally {
245
- if (_didIteratorError) {
246
- throw _iteratorError;
247
- }
248
- }
291
+ _iterator.f();
249
292
  }
250
-
251
293
  return null;
252
294
  }
253
295
  /**
@@ -263,16 +305,13 @@ function (_AbstractModel) {
263
305
  * // => 'fldxxxxxxxxxxxxxx'
264
306
  * ```
265
307
  */
266
-
267
308
  }, {
268
309
  key: "getFieldByName",
269
310
  value: function getFieldByName(fieldName) {
270
311
  var field = this.getFieldByNameIfExists(fieldName);
271
-
272
312
  if (!field) {
273
313
  throw (0, _error_utils.spawnError)("No field named '%s' in table '%s'", fieldName, this.name);
274
314
  }
275
-
276
315
  return field;
277
316
  }
278
317
  /**
@@ -285,12 +324,10 @@ function (_AbstractModel) {
285
324
  *
286
325
  * @param fieldIdOrName The ID or name of the field you're looking for.
287
326
  */
288
-
289
327
  }, {
290
328
  key: "getFieldIfExists",
291
329
  value: function getFieldIfExists(fieldIdOrName) {
292
330
  var _this$getFieldByIdIfE;
293
-
294
331
  return (_this$getFieldByIdIfE = this.getFieldByIdIfExists(fieldIdOrName)) !== null && _this$getFieldByIdIfE !== void 0 ? _this$getFieldByIdIfE : this.getFieldByNameIfExists(fieldIdOrName);
295
332
  }
296
333
  /**
@@ -304,16 +341,13 @@ function (_AbstractModel) {
304
341
  *
305
342
  * @param fieldIdOrName The ID or name of the field you're looking for.
306
343
  */
307
-
308
344
  }, {
309
345
  key: "getField",
310
346
  value: function getField(fieldIdOrName) {
311
347
  var field = this.getFieldIfExists(fieldIdOrName);
312
-
313
348
  if (!field) {
314
349
  throw (0, _error_utils.spawnError)("No field with ID or name '%s' in table '%s'", fieldIdOrName, this.name);
315
350
  }
316
-
317
351
  return field;
318
352
  }
319
353
  /**
@@ -325,10 +359,17 @@ function (_AbstractModel) {
325
359
  * console.log(`This table has ${myTable.views.length} views`);
326
360
  * ```
327
361
  */
328
-
329
362
  }, {
330
- key: "getViewByIdIfExists",
331
-
363
+ key: "views",
364
+ get: function get() {
365
+ // TODO(kasra): cache and freeze this so it isn't O(n)
366
+ var views = [];
367
+ this._data.viewOrder.forEach(viewId => {
368
+ var view = this.getViewById(viewId);
369
+ views.push(view);
370
+ });
371
+ return views;
372
+ }
332
373
  /**
333
374
  * Gets the view matching the given ID, or `null` if that view does not exist in this table.
334
375
  *
@@ -344,6 +385,8 @@ function (_AbstractModel) {
344
385
  * }
345
386
  * ```
346
387
  */
388
+ }, {
389
+ key: "getViewByIdIfExists",
347
390
  value: function getViewByIdIfExists(viewId) {
348
391
  if (!this._data.viewsById[viewId]) {
349
392
  return null;
@@ -351,7 +394,6 @@ function (_AbstractModel) {
351
394
  if (!this._viewModelsById[viewId]) {
352
395
  this._viewModelsById[viewId] = new _view.default(this._sdk, this, this._recordStore.getViewDataStore(viewId), viewId);
353
396
  }
354
-
355
397
  return this._viewModelsById[viewId];
356
398
  }
357
399
  }
@@ -369,16 +411,13 @@ function (_AbstractModel) {
369
411
  * // => 'Grid view'
370
412
  * ```
371
413
  */
372
-
373
414
  }, {
374
415
  key: "getViewById",
375
416
  value: function getViewById(viewId) {
376
417
  var view = this.getViewByIdIfExists(viewId);
377
-
378
418
  if (!view) {
379
419
  throw (0, _error_utils.spawnError)("No view with ID %s in table '%s'", viewId, this.name);
380
420
  }
381
-
382
421
  return view;
383
422
  }
384
423
  /**
@@ -396,39 +435,25 @@ function (_AbstractModel) {
396
435
  * }
397
436
  * ```
398
437
  */
399
-
400
438
  }, {
401
439
  key: "getViewByNameIfExists",
402
440
  value: function getViewByNameIfExists(viewName) {
403
- var _iteratorNormalCompletion2 = true;
404
- var _didIteratorError2 = false;
405
- var _iteratorError2 = undefined;
406
-
441
+ var _iterator2 = _createForOfIteratorHelper((0, _private_utils.entries)(this._data.viewsById)),
442
+ _step2;
407
443
  try {
408
- for (var _iterator2 = (0, _private_utils.entries)(this._data.viewsById)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
444
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
409
445
  var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
410
- viewId = _step2$value[0],
411
- viewData = _step2$value[1];
412
-
446
+ viewId = _step2$value[0],
447
+ viewData = _step2$value[1];
413
448
  if (viewData.name === viewName) {
414
449
  return this.getViewByIdIfExists(viewId);
415
450
  }
416
451
  }
417
452
  } catch (err) {
418
- _didIteratorError2 = true;
419
- _iteratorError2 = err;
453
+ _iterator2.e(err);
420
454
  } finally {
421
- try {
422
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
423
- _iterator2.return();
424
- }
425
- } finally {
426
- if (_didIteratorError2) {
427
- throw _iteratorError2;
428
- }
429
- }
455
+ _iterator2.f();
430
456
  }
431
-
432
457
  return null;
433
458
  }
434
459
  /**
@@ -444,16 +469,13 @@ function (_AbstractModel) {
444
469
  * // => 'viwxxxxxxxxxxxxxx'
445
470
  * ```
446
471
  */
447
-
448
472
  }, {
449
473
  key: "getViewByName",
450
474
  value: function getViewByName(viewName) {
451
475
  var view = this.getViewByNameIfExists(viewName);
452
-
453
476
  if (!view) {
454
477
  throw (0, _error_utils.spawnError)("No view named '%s' in table '%s'", viewName, this.name);
455
478
  }
456
-
457
479
  return view;
458
480
  }
459
481
  /**
@@ -466,12 +488,10 @@ function (_AbstractModel) {
466
488
  *
467
489
  * @param viewIdOrName The ID or name of the view you're looking for.
468
490
  */
469
-
470
491
  }, {
471
492
  key: "getViewIfExists",
472
493
  value: function getViewIfExists(viewIdOrName) {
473
494
  var _this$getViewByIdIfEx;
474
-
475
495
  return (_this$getViewByIdIfEx = this.getViewByIdIfExists(viewIdOrName)) !== null && _this$getViewByIdIfEx !== void 0 ? _this$getViewByIdIfEx : this.getViewByNameIfExists(viewIdOrName);
476
496
  }
477
497
  /**
@@ -485,16 +505,13 @@ function (_AbstractModel) {
485
505
  *
486
506
  * @param viewIdOrName The ID or name of the view you're looking for.
487
507
  */
488
-
489
508
  }, {
490
509
  key: "getView",
491
510
  value: function getView(viewIdOrName) {
492
511
  var view = this.getViewIfExists(viewIdOrName);
493
-
494
512
  if (!view) {
495
513
  throw (0, _error_utils.spawnError)("No view with ID or name '%s' in table '%s'", viewIdOrName, this.name);
496
514
  }
497
-
498
515
  return view;
499
516
  }
500
517
  /**
@@ -530,12 +547,10 @@ function (_AbstractModel) {
530
547
  * }
531
548
  * ```
532
549
  */
533
-
534
550
  }, {
535
551
  key: "selectRecords",
536
552
  value: function selectRecords(opts) {
537
553
  var normalizedOpts = _record_query_result.default._normalizeOpts(this, this._recordStore, opts || {});
538
-
539
554
  return this.__tableOrViewQueryResultPool.getObjectForReuse(this._sdk, this, normalizedOpts);
540
555
  }
541
556
  /**
@@ -559,29 +574,30 @@ function (_AbstractModel) {
559
574
  * }
560
575
  * ```
561
576
  */
562
-
563
577
  }, {
564
578
  key: "selectRecordsAsync",
565
- value: function selectRecordsAsync(opts) {
566
- var queryResult;
567
- return _regenerator.default.async(function selectRecordsAsync$(_context) {
568
- while (1) {
569
- switch (_context.prev = _context.next) {
579
+ value: (function () {
580
+ var _selectRecordsAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(opts) {
581
+ var queryResult;
582
+ return _regenerator.default.wrap(function _callee$(_context) {
583
+ while (1) switch (_context.prev = _context.next) {
570
584
  case 0:
571
585
  queryResult = this.selectRecords(opts);
572
586
  _context.next = 3;
573
- return _regenerator.default.awrap(queryResult.loadDataAsync());
574
-
587
+ return queryResult.loadDataAsync();
575
588
  case 3:
576
589
  return _context.abrupt("return", queryResult);
577
-
578
590
  case 4:
579
591
  case "end":
580
592
  return _context.stop();
581
593
  }
582
- }
583
- }, null, this);
584
- }
594
+ }, _callee, this);
595
+ }));
596
+ function selectRecordsAsync(_x) {
597
+ return _selectRecordsAsync.apply(this, arguments);
598
+ }
599
+ return selectRecordsAsync;
600
+ }()
585
601
  /**
586
602
  * Returns the first view in the table where the type is one of `allowedViewTypes`, or `null` if
587
603
  * no such view exists in the table.
@@ -600,58 +616,55 @@ function (_AbstractModel) {
600
616
  * }
601
617
  * ```
602
618
  */
603
-
619
+ )
604
620
  }, {
605
621
  key: "getFirstViewOfType",
606
622
  value: function getFirstViewOfType(allowedViewTypes, preferredViewOrViewId) {
607
623
  var _this$views$find;
608
-
609
624
  if (!Array.isArray(allowedViewTypes)) {
610
625
  allowedViewTypes = (0, _private_utils.cast)([allowedViewTypes]);
611
626
  }
612
-
613
627
  if (preferredViewOrViewId) {
614
628
  var preferredView = this.getViewByIdIfExists(typeof preferredViewOrViewId === 'string' ? preferredViewOrViewId : preferredViewOrViewId.id);
615
-
616
629
  if (preferredView && allowedViewTypes.includes(preferredView.type)) {
617
630
  return preferredView;
618
631
  }
619
632
  }
620
-
621
633
  return (_this$views$find = this.views.find(view => {
622
634
  return allowedViewTypes.includes(view.type);
623
635
  })) !== null && _this$views$find !== void 0 ? _this$views$find : null;
624
- } // Experimental, do not document yet. Allows fetching default cell values for
636
+ }
637
+ // Experimental, do not document yet. Allows fetching default cell values for
625
638
  // a table or view. Before documenting, we should explore making this synchronous.
626
-
627
639
  /**
628
640
  * @internal
629
641
  */
630
642
  // istanbul ignore next
631
-
632
643
  }, {
633
644
  key: "getDefaultCellValuesByFieldIdAsync",
634
- value: function getDefaultCellValuesByFieldIdAsync(opts) {
635
- var viewId, cellValuesByFieldId;
636
- return _regenerator.default.async(function getDefaultCellValuesByFieldIdAsync$(_context2) {
637
- while (1) {
638
- switch (_context2.prev = _context2.next) {
645
+ value: function () {
646
+ var _getDefaultCellValuesByFieldIdAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(opts) {
647
+ var viewId, cellValuesByFieldId;
648
+ return _regenerator.default.wrap(function _callee2$(_context2) {
649
+ while (1) switch (_context2.prev = _context2.next) {
639
650
  case 0:
640
651
  viewId = opts && opts.view ? opts.view.id : null;
641
652
  _context2.next = 3;
642
- return _regenerator.default.awrap(this._sdk.__airtableInterface.fetchDefaultCellValuesByFieldIdAsync(this._id, viewId));
643
-
653
+ return this._sdk.__airtableInterface.fetchDefaultCellValuesByFieldIdAsync(this._id, viewId);
644
654
  case 3:
645
655
  cellValuesByFieldId = _context2.sent;
646
656
  return _context2.abrupt("return", cellValuesByFieldId);
647
-
648
657
  case 5:
649
658
  case "end":
650
659
  return _context2.stop();
651
660
  }
652
- }
653
- }, null, this);
654
- }
661
+ }, _callee2, this);
662
+ }));
663
+ function getDefaultCellValuesByFieldIdAsync(_x2) {
664
+ return _getDefaultCellValuesByFieldIdAsync.apply(this, arguments);
665
+ }
666
+ return getDefaultCellValuesByFieldIdAsync;
667
+ }()
655
668
  /**
656
669
  * Updates cell values for a record.
657
670
  *
@@ -706,29 +719,31 @@ function (_AbstractModel) {
706
719
  * });
707
720
  * ```
708
721
  */
709
-
710
722
  }, {
711
723
  key: "updateRecordAsync",
712
- value: function updateRecordAsync(recordOrRecordId, fields) {
713
- var recordId;
714
- return _regenerator.default.async(function updateRecordAsync$(_context3) {
715
- while (1) {
716
- switch (_context3.prev = _context3.next) {
724
+ value: (function () {
725
+ var _updateRecordAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(recordOrRecordId, fields) {
726
+ var recordId;
727
+ return _regenerator.default.wrap(function _callee3$(_context3) {
728
+ while (1) switch (_context3.prev = _context3.next) {
717
729
  case 0:
718
730
  recordId = typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id;
719
731
  _context3.next = 3;
720
- return _regenerator.default.awrap(this.updateRecordsAsync([{
732
+ return this.updateRecordsAsync([{
721
733
  id: recordId,
722
734
  fields
723
- }]));
724
-
735
+ }]);
725
736
  case 3:
726
737
  case "end":
727
738
  return _context3.stop();
728
739
  }
729
- }
730
- }, null, this);
731
- }
740
+ }, _callee3, this);
741
+ }));
742
+ function updateRecordAsync(_x3, _x4) {
743
+ return _updateRecordAsync.apply(this, arguments);
744
+ }
745
+ return updateRecordAsync;
746
+ }()
732
747
  /**
733
748
  * Checks whether the current user has permission to perform the given record update.
734
749
  *
@@ -784,7 +799,7 @@ function (_AbstractModel) {
784
799
  * table.checkPermissionsForUpdateRecord();
785
800
  * ```
786
801
  */
787
-
802
+ )
788
803
  }, {
789
804
  key: "checkPermissionsForUpdateRecord",
790
805
  value: function checkPermissionsForUpdateRecord(recordOrRecordId, fields) {
@@ -844,7 +859,6 @@ function (_AbstractModel) {
844
859
  * const canUpdateUnknownRecordAndFields = table.hasPermissionToUpdateRecord();
845
860
  * ```
846
861
  */
847
-
848
862
  }, {
849
863
  key: "hasPermissionToUpdateRecord",
850
864
  value: function hasPermissionToUpdateRecord(recordOrRecordId, fields) {
@@ -925,36 +939,38 @@ function (_AbstractModel) {
925
939
  * }
926
940
  * ```
927
941
  */
928
-
929
942
  }, {
930
943
  key: "updateRecordsAsync",
931
- value: function updateRecordsAsync(records) {
932
- var recordsWithCellValuesByFieldId;
933
- return _regenerator.default.async(function updateRecordsAsync$(_context4) {
934
- while (1) {
935
- switch (_context4.prev = _context4.next) {
944
+ value: (function () {
945
+ var _updateRecordsAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(records) {
946
+ var recordsWithCellValuesByFieldId;
947
+ return _regenerator.default.wrap(function _callee4$(_context4) {
948
+ while (1) switch (_context4.prev = _context4.next) {
936
949
  case 0:
937
950
  recordsWithCellValuesByFieldId = records.map(record => ({
938
951
  id: record.id,
939
952
  cellValuesByFieldId: this._cellValuesByFieldIdOrNameToCellValuesByFieldId(record.fields)
940
953
  }));
941
954
  _context4.next = 3;
942
- return _regenerator.default.awrap(this._sdk.__mutations.applyMutationAsync({
955
+ return this._sdk.__mutations.applyMutationAsync({
943
956
  type: _mutations.MutationTypes.SET_MULTIPLE_RECORDS_CELL_VALUES,
944
957
  tableId: this.id,
945
958
  records: recordsWithCellValuesByFieldId,
946
959
  opts: {
947
960
  parseDateCellValueInColumnTimeZone: true
948
- }
949
- }));
950
-
961
+ }
962
+ });
951
963
  case 3:
952
964
  case "end":
953
965
  return _context4.stop();
954
966
  }
955
- }
956
- }, null, this);
957
- }
967
+ }, _callee4, this);
968
+ }));
969
+ function updateRecordsAsync(_x5) {
970
+ return _updateRecordsAsync.apply(this, arguments);
971
+ }
972
+ return updateRecordsAsync;
973
+ }()
958
974
  /**
959
975
  * Checks whether the current user has permission to perform the given record updates.
960
976
  *
@@ -1014,7 +1030,7 @@ function (_AbstractModel) {
1014
1030
  * table.checkPermissionsForUpdateRecords();
1015
1031
  * ```
1016
1032
  */
1017
-
1033
+ )
1018
1034
  }, {
1019
1035
  key: "checkPermissionsForUpdateRecords",
1020
1036
  value: function checkPermissionsForUpdateRecords(records) {
@@ -1083,7 +1099,6 @@ function (_AbstractModel) {
1083
1099
  * table.hasPermissionToUpdateRecords();
1084
1100
  * ```
1085
1101
  */
1086
-
1087
1102
  }, {
1088
1103
  key: "hasPermissionToUpdateRecords",
1089
1104
  value: function hasPermissionToUpdateRecords(records) {
@@ -1120,24 +1135,26 @@ function (_AbstractModel) {
1120
1135
  * }
1121
1136
  * ```
1122
1137
  */
1123
-
1124
1138
  }, {
1125
1139
  key: "deleteRecordAsync",
1126
- value: function deleteRecordAsync(recordOrRecordId) {
1127
- return _regenerator.default.async(function deleteRecordAsync$(_context5) {
1128
- while (1) {
1129
- switch (_context5.prev = _context5.next) {
1140
+ value: (function () {
1141
+ var _deleteRecordAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(recordOrRecordId) {
1142
+ return _regenerator.default.wrap(function _callee5$(_context5) {
1143
+ while (1) switch (_context5.prev = _context5.next) {
1130
1144
  case 0:
1131
1145
  _context5.next = 2;
1132
- return _regenerator.default.awrap(this.deleteRecordsAsync([recordOrRecordId]));
1133
-
1146
+ return this.deleteRecordsAsync([recordOrRecordId]);
1134
1147
  case 2:
1135
1148
  case "end":
1136
1149
  return _context5.stop();
1137
1150
  }
1138
- }
1139
- }, null, this);
1140
- }
1151
+ }, _callee5, this);
1152
+ }));
1153
+ function deleteRecordAsync(_x6) {
1154
+ return _deleteRecordAsync.apply(this, arguments);
1155
+ }
1156
+ return deleteRecordAsync;
1157
+ }()
1141
1158
  /**
1142
1159
  * Checks whether the current user has permission to delete the specified record.
1143
1160
  *
@@ -1165,7 +1182,7 @@ function (_AbstractModel) {
1165
1182
  * table.checkPermissionsForDeleteRecord();
1166
1183
  * ```
1167
1184
  */
1168
-
1185
+ )
1169
1186
  }, {
1170
1187
  key: "checkPermissionsForDeleteRecord",
1171
1188
  value: function checkPermissionsForDeleteRecord(recordOrRecordId) {
@@ -1194,7 +1211,6 @@ function (_AbstractModel) {
1194
1211
  * const canDeleteUnknownRecord = table.hasPermissionToDeleteRecord();
1195
1212
  * ```
1196
1213
  */
1197
-
1198
1214
  }, {
1199
1215
  key: "hasPermissionToDeleteRecord",
1200
1216
  value: function hasPermissionToDeleteRecord(recordOrRecordId) {
@@ -1236,30 +1252,32 @@ function (_AbstractModel) {
1236
1252
  * }
1237
1253
  * ```
1238
1254
  */
1239
-
1240
1255
  }, {
1241
1256
  key: "deleteRecordsAsync",
1242
- value: function deleteRecordsAsync(recordsOrRecordIds) {
1243
- var recordIds;
1244
- return _regenerator.default.async(function deleteRecordsAsync$(_context6) {
1245
- while (1) {
1246
- switch (_context6.prev = _context6.next) {
1257
+ value: (function () {
1258
+ var _deleteRecordsAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(recordsOrRecordIds) {
1259
+ var recordIds;
1260
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1261
+ while (1) switch (_context6.prev = _context6.next) {
1247
1262
  case 0:
1248
1263
  recordIds = recordsOrRecordIds.map(recordOrRecordId => typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id);
1249
1264
  _context6.next = 3;
1250
- return _regenerator.default.awrap(this._sdk.__mutations.applyMutationAsync({
1265
+ return this._sdk.__mutations.applyMutationAsync({
1251
1266
  type: _mutations.MutationTypes.DELETE_MULTIPLE_RECORDS,
1252
1267
  tableId: this.id,
1253
1268
  recordIds
1254
- }));
1255
-
1269
+ });
1256
1270
  case 3:
1257
1271
  case "end":
1258
1272
  return _context6.stop();
1259
1273
  }
1260
- }
1261
- }, null, this);
1262
- }
1274
+ }, _callee6, this);
1275
+ }));
1276
+ function deleteRecordsAsync(_x7) {
1277
+ return _deleteRecordsAsync.apply(this, arguments);
1278
+ }
1279
+ return deleteRecordsAsync;
1280
+ }()
1263
1281
  /**
1264
1282
  * Checks whether the current user has permission to delete the specified records.
1265
1283
  *
@@ -1288,7 +1306,7 @@ function (_AbstractModel) {
1288
1306
  * table.checkPermissionsForDeleteRecords();
1289
1307
  * ```
1290
1308
  */
1291
-
1309
+ )
1292
1310
  }, {
1293
1311
  key: "checkPermissionsForDeleteRecords",
1294
1312
  value: function checkPermissionsForDeleteRecords(recordsOrRecordIds) {
@@ -1323,12 +1341,12 @@ function (_AbstractModel) {
1323
1341
  * const canDeleteUnknownRecords = table.hasPermissionToDeleteRecords();
1324
1342
  * ```
1325
1343
  */
1326
-
1327
1344
  }, {
1328
1345
  key: "hasPermissionToDeleteRecords",
1329
1346
  value: function hasPermissionToDeleteRecords(recordsOrRecordIds) {
1330
1347
  return this.checkPermissionsForDeleteRecords(recordsOrRecordIds).hasPermission;
1331
1348
  }
1349
+
1332
1350
  /**
1333
1351
  * Creates a new record with the specified cell values.
1334
1352
  *
@@ -1385,34 +1403,35 @@ function (_AbstractModel) {
1385
1403
  * });
1386
1404
  * ```
1387
1405
  */
1388
-
1389
1406
  }, {
1390
1407
  key: "createRecordAsync",
1391
- value: function createRecordAsync() {
1392
- var fields,
1408
+ value: (function () {
1409
+ var _createRecordAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1410
+ var fields,
1393
1411
  recordIds,
1394
1412
  _args7 = arguments;
1395
- return _regenerator.default.async(function createRecordAsync$(_context7) {
1396
- while (1) {
1397
- switch (_context7.prev = _context7.next) {
1413
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1414
+ while (1) switch (_context7.prev = _context7.next) {
1398
1415
  case 0:
1399
1416
  fields = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
1400
1417
  _context7.next = 3;
1401
- return _regenerator.default.awrap(this.createRecordsAsync([{
1418
+ return this.createRecordsAsync([{
1402
1419
  fields
1403
- }]));
1404
-
1420
+ }]);
1405
1421
  case 3:
1406
1422
  recordIds = _context7.sent;
1407
1423
  return _context7.abrupt("return", recordIds[0]);
1408
-
1409
1424
  case 5:
1410
1425
  case "end":
1411
1426
  return _context7.stop();
1412
1427
  }
1413
- }
1414
- }, null, this);
1415
- }
1428
+ }, _callee7, this);
1429
+ }));
1430
+ function createRecordAsync() {
1431
+ return _createRecordAsync.apply(this, arguments);
1432
+ }
1433
+ return createRecordAsync;
1434
+ }()
1416
1435
  /**
1417
1436
  * Checks whether the current user has permission to create the specified record.
1418
1437
  *
@@ -1449,7 +1468,7 @@ function (_AbstractModel) {
1449
1468
  * table.checkPermissionsForCreateRecord();
1450
1469
  * ```
1451
1470
  */
1452
-
1471
+ )
1453
1472
  }, {
1454
1473
  key: "checkPermissionsForCreateRecord",
1455
1474
  value: function checkPermissionsForCreateRecord(fields) {
@@ -1490,7 +1509,6 @@ function (_AbstractModel) {
1490
1509
  * const canCreateUnknownRecord = table.hasPermissionToCreateRecord();
1491
1510
  * ```
1492
1511
  */
1493
-
1494
1512
  }, {
1495
1513
  key: "hasPermissionToCreateRecord",
1496
1514
  value: function hasPermissionToCreateRecord(fields) {
@@ -1568,50 +1586,49 @@ function (_AbstractModel) {
1568
1586
  * }
1569
1587
  * ```
1570
1588
  */
1571
-
1572
1589
  }, {
1573
1590
  key: "createRecordsAsync",
1574
- value: function createRecordsAsync(records) {
1575
- var recordsToCreate;
1576
- return _regenerator.default.async(function createRecordsAsync$(_context8) {
1577
- while (1) {
1578
- switch (_context8.prev = _context8.next) {
1591
+ value: (function () {
1592
+ var _createRecordsAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(records) {
1593
+ var recordsToCreate;
1594
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1595
+ while (1) switch (_context8.prev = _context8.next) {
1579
1596
  case 0:
1580
1597
  recordsToCreate = records.map(recordDef => {
1581
1598
  var recordDefKeys = (0, _private_utils.keys)(recordDef);
1582
1599
  var fields;
1583
-
1584
1600
  if (recordDefKeys.length === 1 && recordDefKeys[0] === 'fields') {
1585
1601
  fields = recordDef.fields;
1586
1602
  } else {
1587
1603
  throw (0, _error_utils.spawnError)('Invalid record format. Please define field mappings using a `fields` key for each record definition object');
1588
1604
  }
1589
-
1590
1605
  return {
1591
1606
  id: this._sdk.__airtableInterface.idGenerator.generateRecordId(),
1592
1607
  cellValuesByFieldId: this._cellValuesByFieldIdOrNameToCellValuesByFieldId(fields)
1593
1608
  };
1594
1609
  });
1595
1610
  _context8.next = 3;
1596
- return _regenerator.default.awrap(this._sdk.__mutations.applyMutationAsync({
1611
+ return this._sdk.__mutations.applyMutationAsync({
1597
1612
  type: _mutations.MutationTypes.CREATE_MULTIPLE_RECORDS,
1598
1613
  tableId: this.id,
1599
1614
  records: recordsToCreate,
1600
1615
  opts: {
1601
1616
  parseDateCellValueInColumnTimeZone: true
1602
1617
  }
1603
- }));
1604
-
1618
+ });
1605
1619
  case 3:
1606
1620
  return _context8.abrupt("return", recordsToCreate.map(record => record.id));
1607
-
1608
1621
  case 4:
1609
1622
  case "end":
1610
1623
  return _context8.stop();
1611
1624
  }
1612
- }
1613
- }, null, this);
1614
- }
1625
+ }, _callee8, this);
1626
+ }));
1627
+ function createRecordsAsync(_x8) {
1628
+ return _createRecordsAsync.apply(this, arguments);
1629
+ }
1630
+ return createRecordsAsync;
1631
+ }()
1615
1632
  /**
1616
1633
  * Checks whether the current user has permission to create the specified records.
1617
1634
  *
@@ -1655,7 +1672,7 @@ function (_AbstractModel) {
1655
1672
  * table.checkPermissionsForCreateRecords();
1656
1673
  * ```
1657
1674
  */
1658
-
1675
+ )
1659
1676
  }, {
1660
1677
  key: "checkPermissionsForCreateRecords",
1661
1678
  value: function checkPermissionsForCreateRecords(records) {
@@ -1708,24 +1725,20 @@ function (_AbstractModel) {
1708
1725
  * const canCreateUnknownRecords = table.hasPermissionToCreateRecords();
1709
1726
  * ```
1710
1727
  */
1711
-
1712
1728
  }, {
1713
1729
  key: "hasPermissionToCreateRecords",
1714
1730
  value: function hasPermissionToCreateRecords(records) {
1715
1731
  return this.checkPermissionsForCreateRecords(records).hasPermission;
1716
1732
  }
1717
1733
  /** @internal */
1718
-
1719
1734
  }, {
1720
1735
  key: "_cellValuesByFieldIdOrNameToCellValuesByFieldId",
1721
1736
  value: function _cellValuesByFieldIdOrNameToCellValuesByFieldId(cellValuesByFieldIdOrName) {
1722
- return Object.fromEntries((0, _private_utils.entries)(cellValuesByFieldIdOrName).map((_ref) => {
1737
+ return Object.fromEntries((0, _private_utils.entries)(cellValuesByFieldIdOrName).map(_ref => {
1723
1738
  var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
1724
- fieldIdOrName = _ref2[0],
1725
- cellValue = _ref2[1];
1726
-
1739
+ fieldIdOrName = _ref2[0],
1740
+ cellValue = _ref2[1];
1727
1741
  var field = this.__getFieldMatching(fieldIdOrName);
1728
-
1729
1742
  return [field.id, cellValue];
1730
1743
  }));
1731
1744
  }
@@ -1752,7 +1765,6 @@ function (_AbstractModel) {
1752
1765
  * }
1753
1766
  * ```
1754
1767
  */
1755
-
1756
1768
  }, {
1757
1769
  key: "checkPermissionsForCreateField",
1758
1770
  value: function checkPermissionsForCreateField(name, type, options, description) {
@@ -1770,6 +1782,7 @@ function (_AbstractModel) {
1770
1782
  description
1771
1783
  });
1772
1784
  }
1785
+
1773
1786
  /**
1774
1787
  * An alias for `checkPermissionsForCreateField(name, type, options, description).hasPermission`.
1775
1788
  *
@@ -1791,12 +1804,12 @@ function (_AbstractModel) {
1791
1804
  * }
1792
1805
  * ```
1793
1806
  */
1794
-
1795
1807
  }, {
1796
1808
  key: "hasPermissionToCreateField",
1797
1809
  value: function hasPermissionToCreateField(name, type, options, description) {
1798
1810
  return this.checkPermissionsForCreateField(name, type, options, description).hasPermission;
1799
1811
  }
1812
+
1800
1813
  /**
1801
1814
  * Creates a new field.
1802
1815
  *
@@ -1849,18 +1862,17 @@ function (_AbstractModel) {
1849
1862
  * }
1850
1863
  * ```
1851
1864
  */
1852
-
1853
1865
  }, {
1854
1866
  key: "createFieldAsync",
1855
- value: function createFieldAsync(name, type, options, description) {
1856
- var fieldId;
1857
- return _regenerator.default.async(function createFieldAsync$(_context9) {
1858
- while (1) {
1859
- switch (_context9.prev = _context9.next) {
1867
+ value: (function () {
1868
+ var _createFieldAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(name, type, options, description) {
1869
+ var fieldId;
1870
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1871
+ while (1) switch (_context9.prev = _context9.next) {
1860
1872
  case 0:
1861
1873
  fieldId = this._sdk.__airtableInterface.idGenerator.generateFieldId();
1862
1874
  _context9.next = 3;
1863
- return _regenerator.default.awrap(this._sdk.__mutations.applyMutationAsync({
1875
+ return this._sdk.__mutations.applyMutationAsync({
1864
1876
  type: _mutations.MutationTypes.CREATE_SINGLE_FIELD,
1865
1877
  tableId: this.id,
1866
1878
  id: fieldId,
@@ -1874,199 +1886,152 @@ function (_AbstractModel) {
1874
1886
  // '' is permitted, as we already set empty descriptions to '' when editing descriptions
1875
1887
  // from the UI
1876
1888
  description: description !== null && description !== void 0 ? description : null
1877
- }));
1878
-
1889
+ });
1879
1890
  case 3:
1880
1891
  return _context9.abrupt("return", this.getFieldById(fieldId));
1881
-
1882
1892
  case 4:
1883
1893
  case "end":
1884
1894
  return _context9.stop();
1885
1895
  }
1886
- }
1887
- }, null, this);
1888
- }
1896
+ }, _callee9, this);
1897
+ }));
1898
+ function createFieldAsync(_x9, _x10, _x11, _x12) {
1899
+ return _createFieldAsync.apply(this, arguments);
1900
+ }
1901
+ return createFieldAsync;
1902
+ }()
1889
1903
  /**
1890
1904
  * @internal
1891
1905
  */
1892
-
1906
+ )
1893
1907
  }, {
1894
1908
  key: "__getFieldMatching",
1895
1909
  value: function __getFieldMatching(fieldOrFieldIdOrFieldName) {
1896
1910
  var field;
1897
-
1898
1911
  if (fieldOrFieldIdOrFieldName instanceof _field.default) {
1899
1912
  if (fieldOrFieldIdOrFieldName.parentTable.id !== this.id) {
1900
1913
  throw (0, _error_utils.spawnError)("Field '%s' is from a different table than table '%s'", fieldOrFieldIdOrFieldName.name, this.name);
1901
1914
  }
1902
-
1903
1915
  field = fieldOrFieldIdOrFieldName;
1904
1916
  } else {
1905
1917
  field = this.getFieldByIdIfExists(fieldOrFieldIdOrFieldName) || this.getFieldByNameIfExists(fieldOrFieldIdOrFieldName);
1906
-
1907
1918
  if (field === null) {
1908
1919
  throw (0, _error_utils.spawnError)("Field '%s' does not exist in table '%s'", fieldOrFieldIdOrFieldName, this.name);
1909
1920
  }
1910
1921
  }
1911
-
1912
1922
  if (field.isDeleted) {
1913
1923
  throw (0, _error_utils.spawnError)("Field '%s' was deleted from table '%s'", field.name, this.name);
1914
1924
  }
1915
-
1916
1925
  return field;
1917
1926
  }
1918
1927
  /**
1919
1928
  * @internal
1920
1929
  */
1921
-
1922
1930
  }, {
1923
1931
  key: "__getViewMatching",
1924
1932
  value: function __getViewMatching(viewOrViewIdOrViewName) {
1925
1933
  var view;
1926
-
1927
1934
  if (viewOrViewIdOrViewName instanceof _view.default) {
1928
1935
  if (viewOrViewIdOrViewName.parentTable.id !== this.id) {
1929
1936
  throw (0, _error_utils.spawnError)("View '%s' is from a different table than table '%s'", viewOrViewIdOrViewName.name, this.name);
1930
1937
  }
1931
-
1932
1938
  view = viewOrViewIdOrViewName;
1933
1939
  } else {
1934
1940
  view = this.getViewByIdIfExists(viewOrViewIdOrViewName) || this.getViewByNameIfExists(viewOrViewIdOrViewName);
1935
-
1936
1941
  if (view === null) {
1937
1942
  throw (0, _error_utils.spawnError)("View '%s' does not exist in table '%s'", viewOrViewIdOrViewName, this.name);
1938
1943
  }
1939
1944
  }
1940
-
1941
1945
  if (view.isDeleted) {
1942
1946
  throw (0, _error_utils.spawnError)("View '%s' was deleted from table '%s'", view.name, this.name);
1943
1947
  }
1944
-
1945
1948
  return view;
1946
1949
  }
1947
1950
  /**
1948
1951
  * @internal
1949
1952
  */
1950
-
1951
1953
  }, {
1952
1954
  key: "__triggerOnChangeForDirtyPaths",
1953
1955
  value: function __triggerOnChangeForDirtyPaths(dirtyPaths) {
1954
1956
  var didTableSchemaChange = false;
1955
-
1956
1957
  if (dirtyPaths.name) {
1957
1958
  this._onChange(WatchableTableKeys.name);
1958
-
1959
1959
  didTableSchemaChange = true;
1960
1960
  }
1961
-
1962
1961
  if (dirtyPaths.viewOrder) {
1963
1962
  this._onChange(WatchableTableKeys.views);
1963
+ didTableSchemaChange = true;
1964
1964
 
1965
- didTableSchemaChange = true; // Clean up deleted views
1966
-
1967
- var _iteratorNormalCompletion3 = true;
1968
- var _didIteratorError3 = false;
1969
- var _iteratorError3 = undefined;
1970
-
1965
+ // Clean up deleted views
1966
+ var _iterator3 = _createForOfIteratorHelper((0, _private_utils.entries)(this._viewModelsById)),
1967
+ _step3;
1971
1968
  try {
1972
- for (var _iterator3 = (0, _private_utils.entries)(this._viewModelsById)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
1969
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1973
1970
  var _step3$value = (0, _slicedToArray2.default)(_step3.value, 2),
1974
- viewId = _step3$value[0],
1975
- viewModel = _step3$value[1];
1976
-
1971
+ viewId = _step3$value[0],
1972
+ viewModel = _step3$value[1];
1977
1973
  if (viewModel.isDeleted) {
1978
1974
  delete this._viewModelsById[viewId];
1979
1975
  }
1980
1976
  }
1981
1977
  } catch (err) {
1982
- _didIteratorError3 = true;
1983
- _iteratorError3 = err;
1978
+ _iterator3.e(err);
1984
1979
  } finally {
1985
- try {
1986
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
1987
- _iterator3.return();
1988
- }
1989
- } finally {
1990
- if (_didIteratorError3) {
1991
- throw _iteratorError3;
1992
- }
1993
- }
1980
+ _iterator3.f();
1994
1981
  }
1995
1982
  }
1996
-
1997
1983
  if (dirtyPaths.lock) {
1998
1984
  didTableSchemaChange = true;
1999
1985
  }
2000
-
2001
1986
  if (dirtyPaths.externalSyncById) {
2002
1987
  didTableSchemaChange = true;
2003
1988
  }
2004
-
2005
1989
  if (dirtyPaths.description) {
2006
1990
  this._onChange(WatchableTableKeys.description);
2007
-
2008
1991
  didTableSchemaChange = true;
2009
1992
  }
2010
-
2011
1993
  if (dirtyPaths.viewsById) {
2012
- var _iteratorNormalCompletion4 = true;
2013
- var _didIteratorError4 = false;
2014
- var _iteratorError4 = undefined;
2015
-
1994
+ var _iterator4 = _createForOfIteratorHelper((0, _private_utils.entries)(dirtyPaths.viewsById)),
1995
+ _step4;
2016
1996
  try {
2017
- for (var _iterator4 = (0, _private_utils.entries)(dirtyPaths.viewsById)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
1997
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
2018
1998
  var _step4$value = (0, _slicedToArray2.default)(_step4.value, 2),
2019
- _viewId = _step4$value[0],
2020
- dirtyViewPaths = _step4$value[1];
2021
-
1999
+ _viewId = _step4$value[0],
2000
+ dirtyViewPaths = _step4$value[1];
2022
2001
  // Directly access from _viewModelsById to avoid creating
2023
2002
  // a view model if it doesn't already exist. If it doesn't exist,
2024
2003
  // nothing can be subscribed to any events on it.
2025
2004
  var view = this._viewModelsById[_viewId];
2026
-
2027
2005
  if (view) {
2028
2006
  var didViewSchemaChange = view.__triggerOnChangeForDirtyPaths(dirtyViewPaths);
2029
-
2030
2007
  if (didViewSchemaChange) {
2031
2008
  didTableSchemaChange = true;
2032
2009
  }
2033
2010
  }
2034
2011
  }
2035
2012
  } catch (err) {
2036
- _didIteratorError4 = true;
2037
- _iteratorError4 = err;
2013
+ _iterator4.e(err);
2038
2014
  } finally {
2039
- try {
2040
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
2041
- _iterator4.return();
2042
- }
2043
- } finally {
2044
- if (_didIteratorError4) {
2045
- throw _iteratorError4;
2046
- }
2047
- }
2015
+ _iterator4.f();
2048
2016
  }
2049
2017
  }
2050
-
2051
2018
  if (dirtyPaths.fieldsById) {
2052
2019
  // TODO: don't trigger schema change when autonumber typeOptions change.
2053
2020
  // That currently happens every time you create a row in a table with an
2054
2021
  // autonumber field.
2055
- didTableSchemaChange = true; // Since tables don't have a field order, need to detect if a field
2056
- // was created or deleted and trigger onChange for fields.
2022
+ didTableSchemaChange = true;
2057
2023
 
2024
+ // Since tables don't have a field order, need to detect if a field
2025
+ // was created or deleted and trigger onChange for fields.
2058
2026
  var addedFieldIds = [];
2059
2027
  var removedFieldIds = [];
2060
- var _iteratorNormalCompletion5 = true;
2061
- var _didIteratorError5 = false;
2062
- var _iteratorError5 = undefined;
2063
-
2028
+ var _iterator5 = _createForOfIteratorHelper((0, _private_utils.entries)(dirtyPaths.fieldsById)),
2029
+ _step5;
2064
2030
  try {
2065
- for (var _iterator5 = (0, _private_utils.entries)(dirtyPaths.fieldsById)[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
2031
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
2066
2032
  var _step5$value = (0, _slicedToArray2.default)(_step5.value, 2),
2067
- fieldId = _step5$value[0],
2068
- dirtyFieldPaths = _step5$value[1];
2069
-
2033
+ fieldId = _step5$value[0],
2034
+ dirtyFieldPaths = _step5$value[1];
2070
2035
  if (dirtyFieldPaths && dirtyFieldPaths._isDirty) {
2071
2036
  // If the entire field is dirty, it was either created or deleted.
2072
2037
  if ((0, _private_utils.has)(this._data.fieldsById, fieldId)) {
@@ -2074,7 +2039,6 @@ function (_AbstractModel) {
2074
2039
  } else {
2075
2040
  removedFieldIds.push(fieldId);
2076
2041
  var fieldModel = this._fieldModelsById[fieldId];
2077
-
2078
2042
  if (fieldModel) {
2079
2043
  // Remove the Field model if it was deleted.
2080
2044
  delete this._fieldModelsById[fieldId];
@@ -2085,217 +2049,65 @@ function (_AbstractModel) {
2085
2049
  // a field model if it doesn't already exist. If it doesn't exist,
2086
2050
  // nothing can be subscribed to any events on it.
2087
2051
  var field = this._fieldModelsById[fieldId];
2088
-
2089
2052
  if (field) {
2090
2053
  field.__triggerOnChangeForDirtyPaths(dirtyFieldPaths);
2091
2054
  }
2092
2055
  }
2093
2056
  }
2094
2057
  } catch (err) {
2095
- _didIteratorError5 = true;
2096
- _iteratorError5 = err;
2058
+ _iterator5.e(err);
2097
2059
  } finally {
2098
- try {
2099
- if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
2100
- _iterator5.return();
2101
- }
2102
- } finally {
2103
- if (_didIteratorError5) {
2104
- throw _iteratorError5;
2105
- }
2106
- }
2060
+ _iterator5.f();
2107
2061
  }
2108
-
2109
2062
  if (addedFieldIds.length > 0 || removedFieldIds.length > 0) {
2110
2063
  this._onChange(WatchableTableKeys.fields, {
2111
2064
  addedFieldIds,
2112
2065
  removedFieldIds
2113
2066
  });
2114
- } // Clear out cached field names in case a field was added/removed/renamed.
2115
-
2067
+ }
2116
2068
 
2069
+ // Clear out cached field names in case a field was added/removed/renamed.
2117
2070
  this._cachedFieldNamesById = null;
2118
- } // NOTE: Record store onChange triggers must be performed AFTER field onChange triggers to
2071
+ }
2072
+ // NOTE: Record store onChange triggers must be performed AFTER field onChange triggers to
2119
2073
  // ensure the column type providers are not stale.
2120
-
2121
-
2122
2074
  this._recordStore.triggerOnChangeForDirtyPaths(dirtyPaths);
2123
-
2124
2075
  return didTableSchemaChange;
2125
2076
  }
2126
2077
  /**
2127
2078
  * @internal
2128
2079
  */
2129
-
2130
2080
  }, {
2131
2081
  key: "__getFieldNamesById",
2132
2082
  value: function __getFieldNamesById() {
2133
2083
  if (!this._cachedFieldNamesById) {
2134
2084
  var fieldNamesById = {};
2135
- var _iteratorNormalCompletion6 = true;
2136
- var _didIteratorError6 = false;
2137
- var _iteratorError6 = undefined;
2138
-
2085
+ var _iterator6 = _createForOfIteratorHelper((0, _private_utils.entries)(this._data.fieldsById)),
2086
+ _step6;
2139
2087
  try {
2140
- for (var _iterator6 = (0, _private_utils.entries)(this._data.fieldsById)[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
2088
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
2141
2089
  var _step6$value = (0, _slicedToArray2.default)(_step6.value, 2),
2142
- fieldId = _step6$value[0],
2143
- fieldData = _step6$value[1];
2144
-
2090
+ fieldId = _step6$value[0],
2091
+ fieldData = _step6$value[1];
2145
2092
  fieldNamesById[fieldId] = fieldData.name;
2146
2093
  }
2147
2094
  } catch (err) {
2148
- _didIteratorError6 = true;
2149
- _iteratorError6 = err;
2095
+ _iterator6.e(err);
2150
2096
  } finally {
2151
- try {
2152
- if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
2153
- _iterator6.return();
2154
- }
2155
- } finally {
2156
- if (_didIteratorError6) {
2157
- throw _iteratorError6;
2158
- }
2159
- }
2097
+ _iterator6.f();
2160
2098
  }
2161
-
2162
2099
  this._cachedFieldNamesById = fieldNamesById;
2163
2100
  }
2164
-
2165
2101
  return this._cachedFieldNamesById;
2166
2102
  }
2167
- }, {
2168
- key: "_dataOrNullIfDeleted",
2169
- get: function get() {
2170
- var _this$_baseData$table;
2171
-
2172
- return (_this$_baseData$table = this._baseData.tablesById[this._id]) !== null && _this$_baseData$table !== void 0 ? _this$_baseData$table : null;
2173
- }
2174
- /**
2175
- * The base that this table belongs to.
2176
- *
2177
- * @internal (since we may not be able to return parent model instances in the immutable models world)
2178
- * @example
2179
- * ```js
2180
- * import {base} from '@airtable/blocks';
2181
- * const table = base.getTableByName('Table 1');
2182
- * console.log(table.parentBase.id === base.id);
2183
- * // => true
2184
- * ```
2185
- */
2186
-
2187
- }, {
2188
- key: "parentBase",
2189
- get: function get() {
2190
- return this._parentBase;
2191
- }
2192
- /**
2193
- * The name of the table. Can be watched.
2194
- *
2195
- * @example
2196
- * ```js
2197
- * console.log(myTable.name);
2198
- * // => 'Table 1'
2199
- * ```
2200
- */
2201
-
2202
- }, {
2203
- key: "name",
2204
- get: function get() {
2205
- return this._data.name;
2206
- }
2207
- /**
2208
- * The description of the table, if it has one. Can be watched.
2209
- *
2210
- * @example
2211
- * ```js
2212
- * console.log(myTable.description);
2213
- * // => 'This is my table'
2214
- * ```
2215
- */
2216
-
2217
- }, {
2218
- key: "description",
2219
- get: function get() {
2220
- return this._data.description;
2221
- }
2222
- /**
2223
- * The URL for the table. You can visit this URL in the browser to be taken to the table in the Airtable UI.
2224
- *
2225
- * @example
2226
- * ```js
2227
- * console.log(myTable.url);
2228
- * // => 'https://airtable.com/appxxxxxxxxxxxxxx/tblxxxxxxxxxxxxxx'
2229
- * ```
2230
- */
2231
-
2232
- }, {
2233
- key: "url",
2234
- get: function get() {
2235
- return this._sdk.__airtableInterface.urlConstructor.getTableUrl(this.id);
2236
- }
2237
- /**
2238
- * The table's primary field. Every table has exactly one primary
2239
- * field. The primary field of a table will not change.
2240
- *
2241
- * @example
2242
- * ```js
2243
- * console.log(myTable.primaryField.name);
2244
- * // => 'Name'
2245
- * ```
2246
- */
2247
-
2248
- }, {
2249
- key: "primaryField",
2250
- get: function get() {
2251
- var primaryField = this.getFieldById(this._data.primaryFieldId);
2252
- return primaryField;
2253
- }
2254
- /**
2255
- * The fields in this table. The order is arbitrary, since fields are
2256
- * only ordered in the context of a specific view.
2257
- *
2258
- * Can be watched to know when fields are created or deleted.
2259
- *
2260
- * @example
2261
- * ```js
2262
- * console.log(`This table has ${myTable.fields.length} fields`);
2263
- * ```
2264
- */
2265
-
2266
- }, {
2267
- key: "fields",
2268
- get: function get() {
2269
- // TODO(kasra): is it confusing that this returns an array, since the order
2270
- // is arbitrary?
2271
- // TODO(kasra): cache and freeze this so it isn't O(n)
2272
- var fields = [];
2273
-
2274
- for (var _i = 0, _Object$keys = Object.keys(this._data.fieldsById); _i < _Object$keys.length; _i++) {
2275
- var fieldId = _Object$keys[_i];
2276
- var field = this.getFieldById(fieldId);
2277
- fields.push(field);
2278
- }
2279
-
2280
- return fields;
2281
- }
2282
- }, {
2283
- key: "views",
2284
- get: function get() {
2285
- // TODO(kasra): cache and freeze this so it isn't O(n)
2286
- var views = [];
2287
-
2288
- this._data.viewOrder.forEach(viewId => {
2289
- var view = this.getViewById(viewId);
2290
- views.push(view);
2291
- });
2292
-
2293
- return views;
2103
+ }], [{
2104
+ key: "_isWatchableKey",
2105
+ value: /** @internal */
2106
+ function _isWatchableKey(key) {
2107
+ return (0, _private_utils.isEnumValue)(WatchableTableKeys, key);
2294
2108
  }
2295
2109
  }]);
2296
- return Table;
2297
2110
  }(_abstract_model.default);
2298
-
2111
+ /** @internal */
2299
2112
  (0, _defineProperty2.default)(Table, "_className", 'Table');
2300
- var _default = Table;
2301
- exports.default = _default;
2113
+ var _default = exports.default = Table;