@airtable/blocks 0.0.0-experimental-c4b2228f4-20250630 → 0.0.0-experimental-3649c7162-20250904

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 (679) hide show
  1. package/dist/esm/base/assert_run_context.js +12 -0
  2. package/dist/{cjs → esm}/base/index.js +30 -32
  3. package/dist/esm/base/models/abstract_model_with_async_data.js +190 -0
  4. package/dist/esm/base/models/base.js +252 -0
  5. package/dist/esm/base/models/create_aggregators.js +90 -0
  6. package/dist/esm/base/models/cursor.js +305 -0
  7. package/dist/esm/base/models/field.js +338 -0
  8. package/dist/esm/base/models/grouped_record_query_result.js +280 -0
  9. package/dist/esm/base/models/linked_records_query_result.js +553 -0
  10. package/dist/{cjs → esm}/base/models/models.js +19 -40
  11. package/dist/esm/base/models/mutations.js +312 -0
  12. package/dist/esm/base/models/object_pool.js +145 -0
  13. package/dist/esm/base/models/record.js +239 -0
  14. package/dist/{cjs → esm}/base/models/record_coloring.js +6 -6
  15. package/dist/esm/base/models/record_query_result.js +657 -0
  16. package/dist/esm/base/models/record_store.js +475 -0
  17. package/dist/esm/base/models/session.js +154 -0
  18. package/dist/esm/base/models/table.js +520 -0
  19. package/dist/esm/base/models/table_or_view_query_result.js +749 -0
  20. package/dist/esm/base/models/view.js +326 -0
  21. package/dist/esm/base/models/view_data_store.js +265 -0
  22. package/dist/esm/base/models/view_metadata_query_result.js +176 -0
  23. package/dist/esm/base/perform_record_action.js +215 -0
  24. package/dist/esm/base/sdk.js +178 -0
  25. package/dist/esm/base/settings_button.js +118 -0
  26. package/dist/{cjs → esm}/base/types/airtable_interface.js +1 -1
  27. package/dist/{cjs → esm}/base/types/mutations.js +5 -11
  28. package/dist/{cjs → esm}/base/types/undo_redo.js +1 -1
  29. package/dist/{cjs → esm}/base/types/view.js +1 -1
  30. package/dist/{cjs → esm}/base/ui/base_provider.js +6 -8
  31. package/dist/esm/base/ui/baymax_utils.js +461 -0
  32. package/dist/esm/base/ui/block_wrapper.js +118 -0
  33. package/dist/esm/base/ui/box.js +84 -0
  34. package/dist/esm/base/ui/button.js +152 -0
  35. package/dist/esm/base/ui/cell_renderer.js +198 -0
  36. package/dist/esm/base/ui/choice_token.js +93 -0
  37. package/dist/esm/base/ui/collaborator_token.js +123 -0
  38. package/dist/esm/base/ui/color_palette.js +196 -0
  39. package/dist/esm/base/ui/color_palette_synced.js +69 -0
  40. package/dist/esm/base/ui/confirmation_dialog.js +103 -0
  41. package/dist/{cjs → esm}/base/ui/control_sizes.js +24 -22
  42. package/dist/{cjs → esm}/base/ui/create_detect_element_resize.js +6 -10
  43. package/dist/{cjs → esm}/base/ui/css_helpers.js +1 -1
  44. package/dist/esm/base/ui/dialog.js +101 -0
  45. package/dist/esm/base/ui/dialog_close_button.js +106 -0
  46. package/dist/{cjs → esm}/base/ui/expand_record.js +1 -2
  47. package/dist/{cjs → esm}/base/ui/expand_record_list.js +3 -4
  48. package/dist/esm/base/ui/expand_record_picker_async.js +71 -0
  49. package/dist/esm/base/ui/field_icon.js +44 -0
  50. package/dist/esm/base/ui/field_picker.js +98 -0
  51. package/dist/esm/base/ui/field_picker_synced.js +66 -0
  52. package/dist/esm/base/ui/form_field.js +109 -0
  53. package/dist/{cjs → esm}/base/ui/geometry/geometry.js +5 -5
  54. package/dist/esm/base/ui/geometry/point.js +19 -0
  55. package/dist/esm/base/ui/geometry/rect.js +51 -0
  56. package/dist/esm/base/ui/geometry/size.js +19 -0
  57. package/dist/esm/base/ui/global_alert.js +71 -0
  58. package/dist/esm/base/ui/heading.js +132 -0
  59. package/dist/esm/base/ui/icon.js +109 -0
  60. package/dist/{cjs → esm}/base/ui/icon_config.js +6 -12
  61. package/dist/{cjs → esm}/base/ui/initialize_block.js +16 -35
  62. package/dist/esm/base/ui/input.js +161 -0
  63. package/dist/esm/base/ui/input_synced.js +66 -0
  64. package/dist/{cjs → esm}/base/ui/key_codes.js +2 -3
  65. package/dist/esm/base/ui/label.js +80 -0
  66. package/dist/esm/base/ui/link.js +196 -0
  67. package/dist/esm/base/ui/loader.js +61 -0
  68. package/dist/esm/base/ui/modal.js +145 -0
  69. package/dist/esm/base/ui/model_picker_select.js +57 -0
  70. package/dist/esm/base/ui/popover.js +315 -0
  71. package/dist/esm/base/ui/progress_bar.js +115 -0
  72. package/dist/esm/base/ui/record_card.js +564 -0
  73. package/dist/esm/base/ui/record_card_list.js +303 -0
  74. package/dist/esm/base/ui/select.js +191 -0
  75. package/dist/esm/base/ui/select_and_select_buttons_helpers.js +63 -0
  76. package/dist/esm/base/ui/select_buttons.js +159 -0
  77. package/dist/esm/base/ui/select_buttons_synced.js +62 -0
  78. package/dist/esm/base/ui/select_synced.js +65 -0
  79. package/dist/esm/base/ui/switch.js +167 -0
  80. package/dist/esm/base/ui/switch_synced.js +53 -0
  81. package/dist/esm/base/ui/synced.js +49 -0
  82. package/dist/{cjs → esm}/base/ui/system/all_styles_set.js +4 -12
  83. package/dist/esm/base/ui/system/appearance/appearance_set.js +27 -0
  84. package/dist/esm/base/ui/system/appearance/background_color.js +18 -0
  85. package/dist/{cjs → esm}/base/ui/system/appearance/border.js +3 -6
  86. package/dist/esm/base/ui/system/appearance/border_radius.js +18 -0
  87. package/dist/esm/base/ui/system/appearance/box_shadow.js +18 -0
  88. package/dist/esm/base/ui/system/appearance/opacity.js +18 -0
  89. package/dist/esm/base/ui/system/dimensions/dimensions_set.js +29 -0
  90. package/dist/esm/base/ui/system/dimensions/height.js +18 -0
  91. package/dist/esm/base/ui/system/dimensions/max_height.js +18 -0
  92. package/dist/esm/base/ui/system/dimensions/max_width.js +18 -0
  93. package/dist/esm/base/ui/system/dimensions/min_height.js +18 -0
  94. package/dist/esm/base/ui/system/dimensions/min_width.js +18 -0
  95. package/dist/esm/base/ui/system/dimensions/width.js +18 -0
  96. package/dist/esm/base/ui/system/display.js +19 -0
  97. package/dist/esm/base/ui/system/flex_container/align_content.js +15 -0
  98. package/dist/esm/base/ui/system/flex_container/align_items.js +15 -0
  99. package/dist/esm/base/ui/system/flex_container/flex_container_set.js +29 -0
  100. package/dist/esm/base/ui/system/flex_container/flex_direction.js +15 -0
  101. package/dist/esm/base/ui/system/flex_container/flex_wrap.js +15 -0
  102. package/dist/esm/base/ui/system/flex_container/justify_content.js +15 -0
  103. package/dist/esm/base/ui/system/flex_container/justify_items.js +16 -0
  104. package/dist/esm/base/ui/system/flex_item/align_self.js +15 -0
  105. package/dist/esm/base/ui/system/flex_item/flex.js +15 -0
  106. package/dist/esm/base/ui/system/flex_item/flex_basis.js +15 -0
  107. package/dist/esm/base/ui/system/flex_item/flex_grow.js +15 -0
  108. package/dist/esm/base/ui/system/flex_item/flex_item_set.js +31 -0
  109. package/dist/esm/base/ui/system/flex_item/flex_shrink.js +15 -0
  110. package/dist/esm/base/ui/system/flex_item/justify_self.js +16 -0
  111. package/dist/esm/base/ui/system/flex_item/order.js +15 -0
  112. package/dist/{cjs → esm}/base/ui/system/index.js +104 -416
  113. package/dist/esm/base/ui/system/overflow.js +21 -0
  114. package/dist/{cjs → esm}/base/ui/system/position/bottom.js +4 -6
  115. package/dist/{cjs → esm}/base/ui/system/position/left.js +4 -6
  116. package/dist/esm/base/ui/system/position/position.js +15 -0
  117. package/dist/esm/base/ui/system/position/position_set.js +29 -0
  118. package/dist/{cjs → esm}/base/ui/system/position/right.js +4 -6
  119. package/dist/{cjs → esm}/base/ui/system/position/top.js +4 -6
  120. package/dist/esm/base/ui/system/position/z_index.js +18 -0
  121. package/dist/{cjs → esm}/base/ui/system/spacing/margin.js +4 -6
  122. package/dist/{cjs → esm}/base/ui/system/spacing/padding.js +4 -6
  123. package/dist/esm/base/ui/system/spacing/spacing_set.js +21 -0
  124. package/dist/esm/base/ui/system/typography/font_family.js +18 -0
  125. package/dist/esm/base/ui/system/typography/font_size.js +18 -0
  126. package/dist/esm/base/ui/system/typography/font_style.js +15 -0
  127. package/dist/esm/base/ui/system/typography/font_weight.js +18 -0
  128. package/dist/esm/base/ui/system/typography/letter_spacing.js +18 -0
  129. package/dist/esm/base/ui/system/typography/line_height.js +15 -0
  130. package/dist/esm/base/ui/system/typography/text_align.js +15 -0
  131. package/dist/esm/base/ui/system/typography/text_color.js +18 -0
  132. package/dist/esm/base/ui/system/typography/text_decoration.js +15 -0
  133. package/dist/esm/base/ui/system/typography/text_transform.js +15 -0
  134. package/dist/esm/base/ui/system/typography/typography_set.js +37 -0
  135. package/dist/{cjs → esm}/base/ui/system/utils/ensure_numbers_are_within_scale.js +3 -4
  136. package/dist/esm/base/ui/system/utils/get_style_props_for_responsive_prop.js +73 -0
  137. package/dist/esm/base/ui/table_picker.js +71 -0
  138. package/dist/esm/base/ui/table_picker_synced.js +62 -0
  139. package/dist/esm/base/ui/text.js +117 -0
  140. package/dist/esm/base/ui/text_button.js +196 -0
  141. package/dist/{cjs → esm}/base/ui/theme/default_theme/button_variants.js +3 -3
  142. package/dist/esm/base/ui/theme/default_theme/control_sizes.js +102 -0
  143. package/dist/{cjs → esm}/base/ui/theme/default_theme/heading_styles.js +1 -1
  144. package/dist/{cjs → esm}/base/ui/theme/default_theme/index.js +9 -15
  145. package/dist/{cjs → esm}/base/ui/theme/default_theme/input_variants.js +3 -3
  146. package/dist/{cjs → esm}/base/ui/theme/default_theme/link_variants.js +3 -3
  147. package/dist/{cjs → esm}/base/ui/theme/default_theme/select_buttons_variants.js +4 -4
  148. package/dist/esm/base/ui/theme/default_theme/select_variants.js +50 -0
  149. package/dist/esm/base/ui/theme/default_theme/switch_variants.js +85 -0
  150. package/dist/{cjs → esm}/base/ui/theme/default_theme/text_button_variants.js +5 -5
  151. package/dist/{cjs → esm}/base/ui/theme/default_theme/text_styles.js +1 -1
  152. package/dist/{cjs → esm}/base/ui/theme/default_theme/tokens.js +14 -14
  153. package/dist/{cjs → esm}/base/ui/theme/theme_context.js +2 -2
  154. package/dist/{cjs → esm}/base/ui/theme/use_theme.js +2 -2
  155. package/dist/esm/base/ui/tooltip.js +175 -0
  156. package/dist/{cjs → esm}/base/ui/ui.js +48 -49
  157. package/dist/{cjs → esm}/base/ui/unstable_standalone_ui.js +27 -27
  158. package/dist/{cjs → esm}/base/ui/use_base.js +1 -1
  159. package/dist/{cjs → esm}/base/ui/use_cursor.js +5 -4
  160. package/dist/{cjs → esm}/base/ui/use_form_field.js +1 -1
  161. package/dist/{cjs → esm}/base/ui/use_loadable.js +25 -91
  162. package/dist/{cjs → esm}/base/ui/use_record_action_data.js +4 -3
  163. package/dist/{cjs → esm}/base/ui/use_records.js +9 -13
  164. package/dist/{cjs → esm}/base/ui/use_session.js +1 -1
  165. package/dist/{cjs → esm}/base/ui/use_settings_button.js +4 -3
  166. package/dist/esm/base/ui/use_styled_system.js +25 -0
  167. package/dist/{cjs → esm}/base/ui/use_text_color_for_background_color.js +4 -3
  168. package/dist/{cjs → esm}/base/ui/use_view_metadata.js +4 -4
  169. package/dist/{cjs → esm}/base/ui/use_viewport.js +2 -2
  170. package/dist/esm/base/ui/view_picker.js +89 -0
  171. package/dist/esm/base/ui/view_picker_synced.js +66 -0
  172. package/dist/esm/base/ui/viewport_constraint.js +129 -0
  173. package/dist/esm/base/ui/with_styled_system.js +129 -0
  174. package/dist/esm/base/undo_redo.js +37 -0
  175. package/dist/{cjs → esm}/base/unstable_testing_utils.js +27 -27
  176. package/dist/esm/base/viewport.js +353 -0
  177. package/dist/esm/injected/airtable_interface.js +22 -0
  178. package/dist/esm/interface/assert_run_context.js +12 -0
  179. package/dist/esm/interface/index.js +22 -0
  180. package/dist/esm/interface/models/base.js +35 -0
  181. package/dist/esm/interface/models/field.js +28 -0
  182. package/dist/{cjs → esm}/interface/models/models.js +8 -7
  183. package/dist/esm/interface/models/mutations.js +63 -0
  184. package/dist/esm/interface/models/record.js +51 -0
  185. package/dist/esm/interface/models/record_store.js +51 -0
  186. package/dist/esm/interface/models/session.js +28 -0
  187. package/dist/esm/interface/models/table.js +97 -0
  188. package/dist/esm/interface/sdk.js +78 -0
  189. package/dist/{cjs → esm}/interface/types/airtable_interface.js +2 -2
  190. package/dist/esm/interface/types/mutations.js +17 -0
  191. package/dist/esm/interface/ui/block_wrapper.js +69 -0
  192. package/dist/{cjs → esm}/interface/ui/initialize_block.js +13 -28
  193. package/dist/{cjs → esm}/interface/ui/ui.js +20 -19
  194. package/dist/{cjs → esm}/interface/ui/use_base.js +1 -1
  195. package/dist/{cjs → esm}/interface/ui/use_custom_properties.js +19 -35
  196. package/dist/{cjs → esm}/interface/ui/use_records.js +6 -5
  197. package/dist/{cjs → esm}/interface/ui/use_run_info.js +2 -2
  198. package/dist/{cjs → esm}/interface/ui/use_session.js +1 -1
  199. package/dist/{cjs → esm}/shared/color_utils.js +9 -16
  200. package/dist/{cjs → esm}/shared/colors.js +2 -2
  201. package/dist/{cjs → esm}/shared/error_utils.js +9 -11
  202. package/dist/{cjs → esm}/shared/event_tracker.js +3 -3
  203. package/dist/esm/shared/global_config.js +399 -0
  204. package/dist/esm/shared/models/abstract_model.js +94 -0
  205. package/dist/esm/shared/models/base_core.js +482 -0
  206. package/dist/esm/shared/models/field_core.js +288 -0
  207. package/dist/esm/shared/models/mutations_core.js +343 -0
  208. package/dist/esm/shared/models/record_core.js +215 -0
  209. package/dist/esm/shared/models/record_store_core.js +160 -0
  210. package/dist/esm/shared/models/session_core.js +160 -0
  211. package/dist/esm/shared/models/table_core.js +1318 -0
  212. package/dist/{cjs → esm}/shared/private_utils.js +54 -124
  213. package/dist/esm/shared/sdk_core.js +113 -0
  214. package/dist/{cjs → esm}/shared/types/field_core.js +1 -1
  215. package/dist/esm/shared/types/mutation_constants.js +11 -0
  216. package/dist/{cjs → esm}/shared/types/mutations_core.js +1 -1
  217. package/dist/{cjs → esm}/shared/types/permission_levels.js +1 -1
  218. package/dist/esm/shared/types/record.js +1 -0
  219. package/dist/esm/shared/types/stat.js +1 -0
  220. package/dist/esm/shared/types/table_core.js +1 -0
  221. package/dist/{cjs → esm}/shared/ui/global_config_synced_component_helpers.js +9 -9
  222. package/dist/esm/shared/ui/loader.js +47 -0
  223. package/dist/{cjs → esm}/shared/ui/remote_utils.js +5 -7
  224. package/dist/{cjs → esm}/shared/ui/sdk_context.js +4 -8
  225. package/dist/{cjs → esm}/shared/ui/use_array_identity.js +2 -2
  226. package/dist/{cjs → esm}/shared/ui/use_base.js +6 -5
  227. package/dist/{cjs → esm}/shared/ui/use_color_scheme.js +3 -8
  228. package/dist/{cjs → esm}/shared/ui/use_global_config.js +5 -4
  229. package/dist/{cjs → esm}/shared/ui/use_session.js +6 -5
  230. package/dist/{cjs → esm}/shared/ui/use_synced.js +7 -5
  231. package/dist/{cjs → esm}/shared/ui/use_watchable.js +17 -44
  232. package/dist/{cjs → esm}/shared/ui/with_hooks.js +6 -13
  233. package/dist/{cjs → esm}/shared/unstable_private_utils.js +4 -6
  234. package/dist/{cjs → esm}/shared/warning.js +5 -5
  235. package/dist/esm/shared/watchable.js +150 -0
  236. package/dist/esm/stats/block_stats.js +73 -0
  237. package/dist/esm/testing/base/abstract_mock_airtable_interface.js +208 -0
  238. package/dist/esm/testing/interface/abstract_mock_airtable_interface.js +124 -0
  239. package/dist/types/src/base/assert_run_context.d.ts +2 -0
  240. package/dist/types/src/base/assert_run_context.d.ts.map +1 -0
  241. package/dist/types/src/base/index.d.ts +1 -0
  242. package/dist/types/src/base/index.d.ts.map +1 -1
  243. package/dist/types/src/base/models/base.d.ts +19 -0
  244. package/dist/types/src/base/models/base.d.ts.map +1 -1
  245. package/dist/types/src/base/models/create_aggregators.d.ts +3 -4
  246. package/dist/types/src/base/models/create_aggregators.d.ts.map +1 -1
  247. package/dist/types/src/base/models/field.d.ts +3 -2
  248. package/dist/types/src/base/models/field.d.ts.map +1 -1
  249. package/dist/types/src/base/models/models.d.ts +1 -2
  250. package/dist/types/src/base/models/models.d.ts.map +1 -1
  251. package/dist/types/src/base/models/mutations.d.ts.map +1 -1
  252. package/dist/types/src/base/sdk.d.ts.map +1 -1
  253. package/dist/types/src/base/ui/block_wrapper.d.ts +1 -1
  254. package/dist/types/src/base/ui/box.d.ts.map +1 -1
  255. package/dist/types/src/base/ui/button.d.ts +0 -5
  256. package/dist/types/src/base/ui/button.d.ts.map +1 -1
  257. package/dist/types/src/base/ui/cell_renderer.d.ts +1 -22
  258. package/dist/types/src/base/ui/cell_renderer.d.ts.map +1 -1
  259. package/dist/types/src/base/ui/choice_token.d.ts +1 -21
  260. package/dist/types/src/base/ui/choice_token.d.ts.map +1 -1
  261. package/dist/types/src/base/ui/collaborator_token.d.ts +0 -20
  262. package/dist/types/src/base/ui/collaborator_token.d.ts.map +1 -1
  263. package/dist/types/src/base/ui/color_palette.d.ts +1 -32
  264. package/dist/types/src/base/ui/color_palette.d.ts.map +1 -1
  265. package/dist/types/src/base/ui/color_palette_synced.d.ts +0 -14
  266. package/dist/types/src/base/ui/color_palette_synced.d.ts.map +1 -1
  267. package/dist/types/src/base/ui/confirmation_dialog.d.ts +0 -17
  268. package/dist/types/src/base/ui/confirmation_dialog.d.ts.map +1 -1
  269. package/dist/types/src/base/ui/control_sizes.d.ts +0 -1
  270. package/dist/types/src/base/ui/control_sizes.d.ts.map +1 -1
  271. package/dist/types/src/base/ui/dialog.d.ts +1 -23
  272. package/dist/types/src/base/ui/dialog.d.ts.map +1 -1
  273. package/dist/types/src/base/ui/dialog_close_button.d.ts +2 -24
  274. package/dist/types/src/base/ui/dialog_close_button.d.ts.map +1 -1
  275. package/dist/types/src/base/ui/field_icon.d.ts +1 -17
  276. package/dist/types/src/base/ui/field_icon.d.ts.map +1 -1
  277. package/dist/types/src/base/ui/field_picker.d.ts +0 -23
  278. package/dist/types/src/base/ui/field_picker.d.ts.map +1 -1
  279. package/dist/types/src/base/ui/field_picker_synced.d.ts.map +1 -1
  280. package/dist/types/src/base/ui/form_field.d.ts +0 -4
  281. package/dist/types/src/base/ui/form_field.d.ts.map +1 -1
  282. package/dist/types/src/base/ui/heading.d.ts +1 -1
  283. package/dist/types/src/base/ui/heading.d.ts.map +1 -1
  284. package/dist/types/src/base/ui/icon.d.ts +0 -16
  285. package/dist/types/src/base/ui/icon.d.ts.map +1 -1
  286. package/dist/types/src/base/ui/icon_config.d.ts +50 -51
  287. package/dist/types/src/base/ui/icon_config.d.ts.map +1 -1
  288. package/dist/types/src/base/ui/initialize_block.d.ts.map +1 -1
  289. package/dist/types/src/base/ui/input.d.ts +12 -46
  290. package/dist/types/src/base/ui/input.d.ts.map +1 -1
  291. package/dist/types/src/base/ui/input_synced.d.ts.map +1 -1
  292. package/dist/types/src/base/ui/label.d.ts.map +1 -1
  293. package/dist/types/src/base/ui/link.d.ts +1 -5
  294. package/dist/types/src/base/ui/link.d.ts.map +1 -1
  295. package/dist/types/src/base/ui/loader.d.ts +3 -20
  296. package/dist/types/src/base/ui/loader.d.ts.map +1 -1
  297. package/dist/types/src/base/ui/modal.d.ts +1 -14
  298. package/dist/types/src/base/ui/modal.d.ts.map +1 -1
  299. package/dist/types/src/base/ui/model_picker_select.d.ts.map +1 -1
  300. package/dist/types/src/base/ui/popover.d.ts +1 -17
  301. package/dist/types/src/base/ui/popover.d.ts.map +1 -1
  302. package/dist/types/src/base/ui/progress_bar.d.ts +1 -24
  303. package/dist/types/src/base/ui/progress_bar.d.ts.map +1 -1
  304. package/dist/types/src/base/ui/record_card.d.ts +1 -23
  305. package/dist/types/src/base/ui/record_card.d.ts.map +1 -1
  306. package/dist/types/src/base/ui/record_card_list.d.ts +1 -18
  307. package/dist/types/src/base/ui/record_card_list.d.ts.map +1 -1
  308. package/dist/types/src/base/ui/select.d.ts +0 -44
  309. package/dist/types/src/base/ui/select.d.ts.map +1 -1
  310. package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts +0 -2
  311. package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
  312. package/dist/types/src/base/ui/select_buttons.d.ts +0 -22
  313. package/dist/types/src/base/ui/select_buttons.d.ts.map +1 -1
  314. package/dist/types/src/base/ui/select_buttons_synced.d.ts.map +1 -1
  315. package/dist/types/src/base/ui/select_synced.d.ts.map +1 -1
  316. package/dist/types/src/base/ui/switch.d.ts +0 -22
  317. package/dist/types/src/base/ui/switch.d.ts.map +1 -1
  318. package/dist/types/src/base/ui/switch_synced.d.ts.map +1 -1
  319. package/dist/types/src/base/ui/synced.d.ts +2 -8
  320. package/dist/types/src/base/ui/synced.d.ts.map +1 -1
  321. package/dist/types/src/base/ui/system/all_styles_set.d.ts +0 -3
  322. package/dist/types/src/base/ui/system/all_styles_set.d.ts.map +1 -1
  323. package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts +0 -1
  324. package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts.map +1 -1
  325. package/dist/types/src/base/ui/system/appearance/background_color.d.ts +0 -1
  326. package/dist/types/src/base/ui/system/appearance/background_color.d.ts.map +1 -1
  327. package/dist/types/src/base/ui/system/appearance/border.d.ts +0 -1
  328. package/dist/types/src/base/ui/system/appearance/border.d.ts.map +1 -1
  329. package/dist/types/src/base/ui/system/appearance/border_radius.d.ts +0 -1
  330. package/dist/types/src/base/ui/system/appearance/border_radius.d.ts.map +1 -1
  331. package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts +0 -1
  332. package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts.map +1 -1
  333. package/dist/types/src/base/ui/system/appearance/opacity.d.ts +0 -1
  334. package/dist/types/src/base/ui/system/appearance/opacity.d.ts.map +1 -1
  335. package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts +0 -1
  336. package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
  337. package/dist/types/src/base/ui/system/dimensions/height.d.ts +0 -1
  338. package/dist/types/src/base/ui/system/dimensions/height.d.ts.map +1 -1
  339. package/dist/types/src/base/ui/system/dimensions/max_height.d.ts +0 -1
  340. package/dist/types/src/base/ui/system/dimensions/max_height.d.ts.map +1 -1
  341. package/dist/types/src/base/ui/system/dimensions/max_width.d.ts +0 -1
  342. package/dist/types/src/base/ui/system/dimensions/max_width.d.ts.map +1 -1
  343. package/dist/types/src/base/ui/system/dimensions/min_height.d.ts +0 -1
  344. package/dist/types/src/base/ui/system/dimensions/min_height.d.ts.map +1 -1
  345. package/dist/types/src/base/ui/system/dimensions/min_width.d.ts +0 -1
  346. package/dist/types/src/base/ui/system/dimensions/min_width.d.ts.map +1 -1
  347. package/dist/types/src/base/ui/system/dimensions/width.d.ts +0 -1
  348. package/dist/types/src/base/ui/system/dimensions/width.d.ts.map +1 -1
  349. package/dist/types/src/base/ui/system/display.d.ts +0 -1
  350. package/dist/types/src/base/ui/system/display.d.ts.map +1 -1
  351. package/dist/types/src/base/ui/system/flex_container/align_content.d.ts +0 -1
  352. package/dist/types/src/base/ui/system/flex_container/align_content.d.ts.map +1 -1
  353. package/dist/types/src/base/ui/system/flex_container/align_items.d.ts +0 -1
  354. package/dist/types/src/base/ui/system/flex_container/align_items.d.ts.map +1 -1
  355. package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts +0 -1
  356. package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
  357. package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts +0 -1
  358. package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts.map +1 -1
  359. package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts +0 -1
  360. package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
  361. package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts +0 -1
  362. package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts.map +1 -1
  363. package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts +0 -1
  364. package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts.map +1 -1
  365. package/dist/types/src/base/ui/system/flex_item/align_self.d.ts +0 -1
  366. package/dist/types/src/base/ui/system/flex_item/align_self.d.ts.map +1 -1
  367. package/dist/types/src/base/ui/system/flex_item/flex.d.ts +0 -1
  368. package/dist/types/src/base/ui/system/flex_item/flex.d.ts.map +1 -1
  369. package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts +0 -1
  370. package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts.map +1 -1
  371. package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts +0 -1
  372. package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts.map +1 -1
  373. package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts +0 -1
  374. package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
  375. package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts +0 -1
  376. package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
  377. package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts +0 -1
  378. package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts.map +1 -1
  379. package/dist/types/src/base/ui/system/flex_item/order.d.ts +0 -1
  380. package/dist/types/src/base/ui/system/flex_item/order.d.ts.map +1 -1
  381. package/dist/types/src/base/ui/system/index.d.ts +52 -52
  382. package/dist/types/src/base/ui/system/index.d.ts.map +1 -1
  383. package/dist/types/src/base/ui/system/overflow.d.ts +0 -1
  384. package/dist/types/src/base/ui/system/overflow.d.ts.map +1 -1
  385. package/dist/types/src/base/ui/system/position/bottom.d.ts +0 -1
  386. package/dist/types/src/base/ui/system/position/bottom.d.ts.map +1 -1
  387. package/dist/types/src/base/ui/system/position/left.d.ts +0 -1
  388. package/dist/types/src/base/ui/system/position/left.d.ts.map +1 -1
  389. package/dist/types/src/base/ui/system/position/position.d.ts +0 -1
  390. package/dist/types/src/base/ui/system/position/position.d.ts.map +1 -1
  391. package/dist/types/src/base/ui/system/position/position_set.d.ts +0 -1
  392. package/dist/types/src/base/ui/system/position/position_set.d.ts.map +1 -1
  393. package/dist/types/src/base/ui/system/position/right.d.ts +0 -1
  394. package/dist/types/src/base/ui/system/position/right.d.ts.map +1 -1
  395. package/dist/types/src/base/ui/system/position/top.d.ts +0 -1
  396. package/dist/types/src/base/ui/system/position/top.d.ts.map +1 -1
  397. package/dist/types/src/base/ui/system/position/z_index.d.ts +0 -1
  398. package/dist/types/src/base/ui/system/position/z_index.d.ts.map +1 -1
  399. package/dist/types/src/base/ui/system/spacing/margin.d.ts +0 -1
  400. package/dist/types/src/base/ui/system/spacing/margin.d.ts.map +1 -1
  401. package/dist/types/src/base/ui/system/spacing/padding.d.ts +0 -1
  402. package/dist/types/src/base/ui/system/spacing/padding.d.ts.map +1 -1
  403. package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts +0 -1
  404. package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts.map +1 -1
  405. package/dist/types/src/base/ui/system/typography/font_family.d.ts +0 -1
  406. package/dist/types/src/base/ui/system/typography/font_family.d.ts.map +1 -1
  407. package/dist/types/src/base/ui/system/typography/font_size.d.ts +0 -1
  408. package/dist/types/src/base/ui/system/typography/font_size.d.ts.map +1 -1
  409. package/dist/types/src/base/ui/system/typography/font_style.d.ts +0 -1
  410. package/dist/types/src/base/ui/system/typography/font_style.d.ts.map +1 -1
  411. package/dist/types/src/base/ui/system/typography/font_weight.d.ts +0 -1
  412. package/dist/types/src/base/ui/system/typography/font_weight.d.ts.map +1 -1
  413. package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts +0 -1
  414. package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts.map +1 -1
  415. package/dist/types/src/base/ui/system/typography/line_height.d.ts +0 -1
  416. package/dist/types/src/base/ui/system/typography/line_height.d.ts.map +1 -1
  417. package/dist/types/src/base/ui/system/typography/text_align.d.ts +0 -1
  418. package/dist/types/src/base/ui/system/typography/text_align.d.ts.map +1 -1
  419. package/dist/types/src/base/ui/system/typography/text_color.d.ts +0 -1
  420. package/dist/types/src/base/ui/system/typography/text_color.d.ts.map +1 -1
  421. package/dist/types/src/base/ui/system/typography/text_decoration.d.ts +0 -1
  422. package/dist/types/src/base/ui/system/typography/text_decoration.d.ts.map +1 -1
  423. package/dist/types/src/base/ui/system/typography/text_transform.d.ts +0 -1
  424. package/dist/types/src/base/ui/system/typography/text_transform.d.ts.map +1 -1
  425. package/dist/types/src/base/ui/system/typography/typography_set.d.ts +0 -1
  426. package/dist/types/src/base/ui/system/typography/typography_set.d.ts.map +1 -1
  427. package/dist/types/src/base/ui/table_picker.d.ts +0 -21
  428. package/dist/types/src/base/ui/table_picker.d.ts.map +1 -1
  429. package/dist/types/src/base/ui/table_picker_synced.d.ts.map +1 -1
  430. package/dist/types/src/base/ui/text.d.ts +0 -3
  431. package/dist/types/src/base/ui/text.d.ts.map +1 -1
  432. package/dist/types/src/base/ui/text_button.d.ts +1 -5
  433. package/dist/types/src/base/ui/text_button.d.ts.map +1 -1
  434. package/dist/types/src/base/ui/theme/default_theme/index.d.ts +1 -1
  435. package/dist/types/src/base/ui/theme/theme_context.d.ts +1 -1
  436. package/dist/types/src/base/ui/theme/use_theme.d.ts +1 -1
  437. package/dist/types/src/base/ui/tooltip.d.ts +0 -16
  438. package/dist/types/src/base/ui/tooltip.d.ts.map +1 -1
  439. package/dist/types/src/base/ui/types/aria_props.d.ts.map +1 -1
  440. package/dist/types/src/base/ui/types/data_attributes_prop.d.ts +0 -4
  441. package/dist/types/src/base/ui/types/data_attributes_prop.d.ts.map +1 -1
  442. package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts +0 -7
  443. package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts.map +1 -1
  444. package/dist/types/src/base/ui/ui.d.ts +1 -0
  445. package/dist/types/src/base/ui/ui.d.ts.map +1 -1
  446. package/dist/types/src/base/ui/view_picker.d.ts +0 -23
  447. package/dist/types/src/base/ui/view_picker.d.ts.map +1 -1
  448. package/dist/types/src/base/ui/view_picker_synced.d.ts.map +1 -1
  449. package/dist/types/src/base/ui/viewport_constraint.d.ts +1 -14
  450. package/dist/types/src/base/ui/viewport_constraint.d.ts.map +1 -1
  451. package/dist/types/src/base/unstable_testing_utils.d.ts +1 -1
  452. package/dist/types/src/base/unstable_testing_utils.d.ts.map +1 -1
  453. package/dist/types/src/interface/assert_run_context.d.ts +2 -0
  454. package/dist/types/src/interface/assert_run_context.d.ts.map +1 -0
  455. package/dist/types/src/interface/index.d.ts +1 -6
  456. package/dist/types/src/interface/index.d.ts.map +1 -1
  457. package/dist/types/src/interface/models/models.d.ts +1 -0
  458. package/dist/types/src/interface/models/models.d.ts.map +1 -1
  459. package/dist/types/src/interface/models/mutations.d.ts.map +1 -1
  460. package/dist/types/src/interface/models/table.d.ts.map +1 -1
  461. package/dist/types/src/interface/types/field.d.ts +6 -0
  462. package/dist/types/src/interface/types/field.d.ts.map +1 -1
  463. package/dist/types/src/interface/ui/initialize_block.d.ts.map +1 -1
  464. package/dist/types/src/interface/ui/ui.d.ts +1 -0
  465. package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
  466. package/dist/types/src/interface/ui/use_custom_properties.d.ts +1 -1
  467. package/dist/types/src/shared/models/field_core.d.ts +3 -1
  468. package/dist/types/src/shared/models/field_core.d.ts.map +1 -1
  469. package/dist/types/src/shared/models/mutations_core.d.ts.map +1 -1
  470. package/dist/types/src/shared/models/table_core.d.ts.map +1 -1
  471. package/dist/types/src/shared/private_utils.d.ts +0 -9
  472. package/dist/types/src/shared/private_utils.d.ts.map +1 -1
  473. package/dist/types/src/shared/types/field_core.d.ts +19 -1
  474. package/dist/types/src/shared/types/field_core.d.ts.map +1 -1
  475. package/dist/types/src/shared/types/mutations_core.d.ts +8 -4
  476. package/dist/types/src/shared/types/mutations_core.d.ts.map +1 -1
  477. package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts +0 -2
  478. package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts.map +1 -1
  479. package/dist/types/src/shared/ui/loader.d.ts.map +1 -1
  480. package/dist/types/src/shared/ui/use_watchable.d.ts +4 -2
  481. package/dist/types/src/shared/ui/use_watchable.d.ts.map +1 -1
  482. package/dist/types/src/shared/ui/with_hooks.d.ts +2 -2
  483. package/dist/types/src/shared/ui/with_hooks.d.ts.map +1 -1
  484. package/dist/types/src/testing/{abstract_mock_airtable_interface.d.ts → base/abstract_mock_airtable_interface.d.ts} +13 -13
  485. package/dist/types/src/testing/base/abstract_mock_airtable_interface.d.ts.map +1 -0
  486. package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts +51 -0
  487. package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts.map +1 -0
  488. package/models.js +1 -1
  489. package/package.json +24 -23
  490. package/types.js +1 -1
  491. package/dist/cjs/base/models/abstract_model_with_async_data.js +0 -273
  492. package/dist/cjs/base/models/base.js +0 -306
  493. package/dist/cjs/base/models/create_aggregators.js +0 -115
  494. package/dist/cjs/base/models/cursor.js +0 -393
  495. package/dist/cjs/base/models/field.js +0 -427
  496. package/dist/cjs/base/models/grouped_record_query_result.js +0 -399
  497. package/dist/cjs/base/models/linked_records_query_result.js +0 -728
  498. package/dist/cjs/base/models/mutations.js +0 -338
  499. package/dist/cjs/base/models/object_pool.js +0 -184
  500. package/dist/cjs/base/models/record.js +0 -304
  501. package/dist/cjs/base/models/record_query_result.js +0 -741
  502. package/dist/cjs/base/models/record_store.js +0 -825
  503. package/dist/cjs/base/models/session.js +0 -182
  504. package/dist/cjs/base/models/table.js +0 -668
  505. package/dist/cjs/base/models/table_or_view_query_result.js +0 -1013
  506. package/dist/cjs/base/models/view.js +0 -431
  507. package/dist/cjs/base/models/view_data_store.js +0 -403
  508. package/dist/cjs/base/models/view_metadata_query_result.js +0 -224
  509. package/dist/cjs/base/perform_record_action.js +0 -257
  510. package/dist/cjs/base/sdk.js +0 -233
  511. package/dist/cjs/base/settings_button.js +0 -138
  512. package/dist/cjs/base/ui/baymax_utils.js +0 -133
  513. package/dist/cjs/base/ui/block_wrapper.js +0 -143
  514. package/dist/cjs/base/ui/box.js +0 -110
  515. package/dist/cjs/base/ui/button.js +0 -182
  516. package/dist/cjs/base/ui/cell_renderer.js +0 -255
  517. package/dist/cjs/base/ui/choice_token.js +0 -110
  518. package/dist/cjs/base/ui/collaborator_token.js +0 -145
  519. package/dist/cjs/base/ui/color_palette.js +0 -239
  520. package/dist/cjs/base/ui/color_palette_synced.js +0 -98
  521. package/dist/cjs/base/ui/confirmation_dialog.js +0 -153
  522. package/dist/cjs/base/ui/dialog.js +0 -142
  523. package/dist/cjs/base/ui/dialog_close_button.js +0 -152
  524. package/dist/cjs/base/ui/expand_record_picker_async.js +0 -100
  525. package/dist/cjs/base/ui/field_icon.js +0 -62
  526. package/dist/cjs/base/ui/field_picker.js +0 -143
  527. package/dist/cjs/base/ui/field_picker_synced.js +0 -88
  528. package/dist/cjs/base/ui/form_field.js +0 -137
  529. package/dist/cjs/base/ui/geometry/point.js +0 -21
  530. package/dist/cjs/base/ui/geometry/rect.js +0 -67
  531. package/dist/cjs/base/ui/geometry/size.js +0 -21
  532. package/dist/cjs/base/ui/global_alert.js +0 -92
  533. package/dist/cjs/base/ui/heading.js +0 -181
  534. package/dist/cjs/base/ui/icon.js +0 -129
  535. package/dist/cjs/base/ui/input.js +0 -200
  536. package/dist/cjs/base/ui/input_synced.js +0 -89
  537. package/dist/cjs/base/ui/label.js +0 -105
  538. package/dist/cjs/base/ui/link.js +0 -229
  539. package/dist/cjs/base/ui/loader.js +0 -82
  540. package/dist/cjs/base/ui/modal.js +0 -184
  541. package/dist/cjs/base/ui/model_picker_select.js +0 -83
  542. package/dist/cjs/base/ui/popover.js +0 -407
  543. package/dist/cjs/base/ui/progress_bar.js +0 -128
  544. package/dist/cjs/base/ui/record_card.js +0 -653
  545. package/dist/cjs/base/ui/record_card_list.js +0 -377
  546. package/dist/cjs/base/ui/select.js +0 -247
  547. package/dist/cjs/base/ui/select_and_select_buttons_helpers.js +0 -87
  548. package/dist/cjs/base/ui/select_buttons.js +0 -192
  549. package/dist/cjs/base/ui/select_buttons_synced.js +0 -84
  550. package/dist/cjs/base/ui/select_synced.js +0 -87
  551. package/dist/cjs/base/ui/switch.js +0 -196
  552. package/dist/cjs/base/ui/switch_synced.js +0 -75
  553. package/dist/cjs/base/ui/synced.js +0 -70
  554. package/dist/cjs/base/ui/system/appearance/appearance_set.js +0 -30
  555. package/dist/cjs/base/ui/system/appearance/background_color.js +0 -21
  556. package/dist/cjs/base/ui/system/appearance/border_radius.js +0 -21
  557. package/dist/cjs/base/ui/system/appearance/box_shadow.js +0 -21
  558. package/dist/cjs/base/ui/system/appearance/opacity.js +0 -21
  559. package/dist/cjs/base/ui/system/dimensions/dimensions_set.js +0 -31
  560. package/dist/cjs/base/ui/system/dimensions/height.js +0 -21
  561. package/dist/cjs/base/ui/system/dimensions/max_height.js +0 -21
  562. package/dist/cjs/base/ui/system/dimensions/max_width.js +0 -21
  563. package/dist/cjs/base/ui/system/dimensions/min_height.js +0 -21
  564. package/dist/cjs/base/ui/system/dimensions/min_width.js +0 -21
  565. package/dist/cjs/base/ui/system/dimensions/width.js +0 -21
  566. package/dist/cjs/base/ui/system/display.js +0 -22
  567. package/dist/cjs/base/ui/system/flex_container/align_content.js +0 -18
  568. package/dist/cjs/base/ui/system/flex_container/align_items.js +0 -18
  569. package/dist/cjs/base/ui/system/flex_container/flex_container_set.js +0 -31
  570. package/dist/cjs/base/ui/system/flex_container/flex_direction.js +0 -18
  571. package/dist/cjs/base/ui/system/flex_container/flex_wrap.js +0 -18
  572. package/dist/cjs/base/ui/system/flex_container/justify_content.js +0 -18
  573. package/dist/cjs/base/ui/system/flex_container/justify_items.js +0 -19
  574. package/dist/cjs/base/ui/system/flex_item/align_self.js +0 -18
  575. package/dist/cjs/base/ui/system/flex_item/flex.js +0 -18
  576. package/dist/cjs/base/ui/system/flex_item/flex_basis.js +0 -18
  577. package/dist/cjs/base/ui/system/flex_item/flex_grow.js +0 -18
  578. package/dist/cjs/base/ui/system/flex_item/flex_item_set.js +0 -32
  579. package/dist/cjs/base/ui/system/flex_item/flex_shrink.js +0 -18
  580. package/dist/cjs/base/ui/system/flex_item/justify_self.js +0 -19
  581. package/dist/cjs/base/ui/system/flex_item/order.js +0 -18
  582. package/dist/cjs/base/ui/system/overflow.js +0 -24
  583. package/dist/cjs/base/ui/system/position/position.js +0 -18
  584. package/dist/cjs/base/ui/system/position/position_set.js +0 -31
  585. package/dist/cjs/base/ui/system/position/z_index.js +0 -21
  586. package/dist/cjs/base/ui/system/spacing/spacing_set.js +0 -27
  587. package/dist/cjs/base/ui/system/typography/font_family.js +0 -21
  588. package/dist/cjs/base/ui/system/typography/font_size.js +0 -21
  589. package/dist/cjs/base/ui/system/typography/font_style.js +0 -18
  590. package/dist/cjs/base/ui/system/typography/font_weight.js +0 -21
  591. package/dist/cjs/base/ui/system/typography/letter_spacing.js +0 -21
  592. package/dist/cjs/base/ui/system/typography/line_height.js +0 -18
  593. package/dist/cjs/base/ui/system/typography/text_align.js +0 -18
  594. package/dist/cjs/base/ui/system/typography/text_color.js +0 -21
  595. package/dist/cjs/base/ui/system/typography/text_decoration.js +0 -18
  596. package/dist/cjs/base/ui/system/typography/text_transform.js +0 -18
  597. package/dist/cjs/base/ui/system/typography/typography_set.js +0 -35
  598. package/dist/cjs/base/ui/system/utils/create_responsive_prop_type.js +0 -19
  599. package/dist/cjs/base/ui/system/utils/create_style_prop_types.js +0 -24
  600. package/dist/cjs/base/ui/system/utils/enum_prop_type_utils.js +0 -35
  601. package/dist/cjs/base/ui/system/utils/get_style_props_for_responsive_prop.js +0 -113
  602. package/dist/cjs/base/ui/table_picker.js +0 -95
  603. package/dist/cjs/base/ui/table_picker_synced.js +0 -84
  604. package/dist/cjs/base/ui/text.js +0 -150
  605. package/dist/cjs/base/ui/text_button.js +0 -228
  606. package/dist/cjs/base/ui/theme/default_theme/control_sizes.js +0 -96
  607. package/dist/cjs/base/ui/theme/default_theme/select_variants.js +0 -59
  608. package/dist/cjs/base/ui/theme/default_theme/switch_variants.js +0 -91
  609. package/dist/cjs/base/ui/tooltip.js +0 -215
  610. package/dist/cjs/base/ui/types/aria_props.js +0 -23
  611. package/dist/cjs/base/ui/types/data_attributes_prop.js +0 -18
  612. package/dist/cjs/base/ui/types/tooltip_anchor_props.js +0 -17
  613. package/dist/cjs/base/ui/use_styled_system.js +0 -32
  614. package/dist/cjs/base/ui/view_picker.js +0 -133
  615. package/dist/cjs/base/ui/view_picker_synced.js +0 -88
  616. package/dist/cjs/base/ui/viewport_constraint.js +0 -176
  617. package/dist/cjs/base/ui/with_styled_system.js +0 -165
  618. package/dist/cjs/base/undo_redo.js +0 -48
  619. package/dist/cjs/base/viewport.js +0 -397
  620. package/dist/cjs/injected/airtable_interface.js +0 -22
  621. package/dist/cjs/interface/index.js +0 -36
  622. package/dist/cjs/interface/models/base.js +0 -54
  623. package/dist/cjs/interface/models/field.js +0 -42
  624. package/dist/cjs/interface/models/mutations.js +0 -79
  625. package/dist/cjs/interface/models/record.js +0 -71
  626. package/dist/cjs/interface/models/record_store.js +0 -83
  627. package/dist/cjs/interface/models/session.js +0 -42
  628. package/dist/cjs/interface/models/table.js +0 -92
  629. package/dist/cjs/interface/sdk.js +0 -104
  630. package/dist/cjs/interface/types/mutations.js +0 -24
  631. package/dist/cjs/interface/ui/block_wrapper.js +0 -61
  632. package/dist/cjs/shared/global_config.js +0 -511
  633. package/dist/cjs/shared/models/abstract_model.js +0 -119
  634. package/dist/cjs/shared/models/base_core.js +0 -602
  635. package/dist/cjs/shared/models/field_core.js +0 -329
  636. package/dist/cjs/shared/models/mutations_core.js +0 -439
  637. package/dist/cjs/shared/models/record_core.js +0 -272
  638. package/dist/cjs/shared/models/record_store_core.js +0 -213
  639. package/dist/cjs/shared/models/session_core.js +0 -214
  640. package/dist/cjs/shared/models/table_core.js +0 -1530
  641. package/dist/cjs/shared/sdk_core.js +0 -115
  642. package/dist/cjs/shared/types/mutation_constants.js +0 -11
  643. package/dist/cjs/shared/ui/loader.js +0 -68
  644. package/dist/cjs/shared/watchable.js +0 -216
  645. package/dist/cjs/stats/block_stats.js +0 -96
  646. package/dist/cjs/testing/abstract_mock_airtable_interface.js +0 -277
  647. package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts +0 -2
  648. package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts.map +0 -1
  649. package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts +0 -4
  650. package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts.map +0 -1
  651. package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts +0 -21
  652. package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts.map +0 -1
  653. package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +0 -1
  654. /package/dist/{cjs → esm}/base/types/aggregators.js +0 -0
  655. /package/dist/{cjs → esm}/base/types/backend_fetch_types.js +0 -0
  656. /package/dist/{cjs → esm}/base/types/base.js +0 -0
  657. /package/dist/{cjs → esm}/base/types/cursor.js +0 -0
  658. /package/dist/{cjs → esm}/base/types/field.js +0 -0
  659. /package/dist/{cjs → esm}/base/types/record.js +0 -0
  660. /package/dist/{cjs → esm}/base/types/record_action_data.js +0 -0
  661. /package/dist/{cjs → esm}/base/types/table.js +0 -0
  662. /package/dist/{cjs → esm}/base/types/viewport.js +0 -0
  663. /package/dist/{cjs → esm}/base/ui/system/utils/csstype.js +0 -0
  664. /package/dist/{cjs → esm}/base/ui/system/utils/types.js +0 -0
  665. /package/dist/{cjs/interface/types/base.js → esm/base/ui/types/aria_props.js} +0 -0
  666. /package/dist/{cjs/interface/types/field.js → esm/base/ui/types/data_attributes_prop.js} +0 -0
  667. /package/dist/{cjs/interface/types/record.js → esm/base/ui/types/tooltip_anchor_props.js} +0 -0
  668. /package/dist/{cjs/interface/types/table.js → esm/interface/types/base.js} +0 -0
  669. /package/dist/{cjs/sdk_mode.js → esm/interface/types/field.js} +0 -0
  670. /package/dist/{cjs/shared → esm/interface}/types/record.js +0 -0
  671. /package/dist/{cjs/shared/types/airtable_interface_core.js → esm/interface/types/table.js} +0 -0
  672. /package/dist/{cjs → esm}/interface/ui/expand_record.js +0 -0
  673. /package/dist/{cjs/shared/types/attachment.js → esm/sdk_mode.js} +0 -0
  674. /package/dist/{cjs/shared/types/base_core.js → esm/shared/types/airtable_interface_core.js} +0 -0
  675. /package/dist/{cjs/shared/types/collaborator.js → esm/shared/types/attachment.js} +0 -0
  676. /package/dist/{cjs/shared/types/global_config.js → esm/shared/types/base_core.js} +0 -0
  677. /package/dist/{cjs/shared/types/hyper_ids.js → esm/shared/types/collaborator.js} +0 -0
  678. /package/dist/{cjs/shared/types/stat.js → esm/shared/types/global_config.js} +0 -0
  679. /package/dist/{cjs/shared/types/table_core.js → esm/shared/types/hyper_ids.js} +0 -0
@@ -0,0 +1,1318 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WatchableTableKeysCore = exports.TableCore = void 0;
7
+ var _private_utils = require("../private_utils");
8
+ var _error_utils = require("../error_utils");
9
+ var _mutations_core = require("../types/mutations_core");
10
+ var _abstract_model = _interopRequireDefault(require("./abstract_model"));
11
+ var _field_core = require("./field_core");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ // This doesn't follow our enum naming conventions because we want the keys
14
+ // to mirror the method/getter names on the model class.
15
+ const WatchableTableKeysCore = exports.WatchableTableKeysCore = Object.freeze({
16
+ name: 'name',
17
+ description: 'description',
18
+ fields: 'fields'
19
+ });
20
+
21
+ /** @hidden */
22
+
23
+ /** @hidden */
24
+ class TableCore extends _abstract_model.default {
25
+ /** @internal */
26
+ static _className = 'TableCore';
27
+ /** @internal */
28
+ static _isWatchableKey(key) {
29
+ return (0, _private_utils.isEnumValue)(WatchableTableKeysCore, key);
30
+ }
31
+ /** @internal */
32
+
33
+ /** @internal */
34
+
35
+ /** @internal */
36
+
37
+ /** @internal */
38
+
39
+ /**
40
+ * @internal
41
+ */
42
+ constructor(parentBase, recordStore, tableId, sdk) {
43
+ super(sdk, tableId);
44
+ this._parentBase = parentBase;
45
+ this._recordStore = recordStore;
46
+ this._fieldModelsById = {}; // Field instances are lazily created by getFieldById.
47
+ this._cachedFieldNamesById = null;
48
+ }
49
+
50
+ /**
51
+ * @internal
52
+ */
53
+ get _dataOrNullIfDeleted() {
54
+ return this._baseData.tablesById[this._id] ?? null;
55
+ }
56
+ /**
57
+ * The base that this table belongs to.
58
+ *
59
+ * @internal (since we may not be able to return parent model instances in the immutable models world)
60
+ * @example
61
+ * ```js
62
+ * import {base} from '@airtable/blocks/base';
63
+ * const table = base.getTableByName('Table 1');
64
+ * console.log(table.parentBase.id === base.id);
65
+ * // => true
66
+ * ```
67
+ */
68
+ get parentBase() {
69
+ return this._parentBase;
70
+ }
71
+ /**
72
+ * The name of the table. Can be watched.
73
+ *
74
+ * @example
75
+ * ```js
76
+ * console.log(myTable.name);
77
+ * // => 'Table 1'
78
+ * ```
79
+ */
80
+ get name() {
81
+ return this._data.name;
82
+ }
83
+ /**
84
+ * The description of the table, if it has one. Can be watched.
85
+ *
86
+ * @example
87
+ * ```js
88
+ * console.log(myTable.description);
89
+ * // => 'This is my table'
90
+ * ```
91
+ */
92
+ get description() {
93
+ return this._data.description;
94
+ }
95
+ /**
96
+ * The table's primary field. Every table has exactly one primary
97
+ * field. The primary field of a table will not change.
98
+ *
99
+ * @example
100
+ * ```js
101
+ * console.log(myTable.primaryField.name);
102
+ * // => 'Name'
103
+ * ```
104
+ */
105
+ get primaryField() {
106
+ const primaryField = this.getFieldById(this._data.primaryFieldId);
107
+ return primaryField;
108
+ }
109
+ /**
110
+ * The fields in this table. The order is arbitrary, since fields are
111
+ * only ordered in the context of a specific view.
112
+ *
113
+ * Can be watched to know when fields are created or deleted.
114
+ *
115
+ * @example
116
+ * ```js
117
+ * console.log(`This table has ${myTable.fields.length} fields`);
118
+ * ```
119
+ */
120
+ get fields() {
121
+ // TODO(kasra): is it confusing that this returns an array, since the order
122
+ // is arbitrary?
123
+ // TODO(kasra): cache and freeze this so it isn't O(n)
124
+ const fields = [];
125
+ for (const fieldId of Object.keys(this._data.fieldsById)) {
126
+ const field = this.getFieldById(fieldId);
127
+ fields.push(field);
128
+ }
129
+ return fields;
130
+ }
131
+ /**
132
+ * Gets the field matching the given ID, or `null` if that field does not exist in this table.
133
+ * @param fieldId The ID of the field.
134
+ * @example
135
+ * ```js
136
+ * const fieldId = 'fldxxxxxxxxxxxxxx';
137
+ * const field = myTable.getFieldByIdIfExists(fieldId);
138
+ * if (field !== null) {
139
+ * console.log(field.name);
140
+ * } else {
141
+ * console.log('No field exists with that ID');
142
+ * }
143
+ * ```
144
+ */
145
+ getFieldByIdIfExists(fieldId) {
146
+ if (!this._data.fieldsById[fieldId]) {
147
+ return null;
148
+ } else {
149
+ if (!this._fieldModelsById[fieldId]) {
150
+ this._fieldModelsById[fieldId] = this._constructField(fieldId);
151
+ }
152
+ return this._fieldModelsById[fieldId];
153
+ }
154
+ }
155
+ /** @internal */
156
+
157
+ /**
158
+ * Gets the field matching the given ID. Throws if that field does not exist in this table. Use
159
+ * {@link getFieldByIdIfExists} instead if you are unsure whether a field exists with the given
160
+ * ID.
161
+ *
162
+ * @param fieldId The ID of the field.
163
+ * @example
164
+ * ```js
165
+ * const fieldId = 'fldxxxxxxxxxxxxxx';
166
+ * const field = myTable.getFieldById(fieldId);
167
+ * console.log(field.name);
168
+ * // => 'Name'
169
+ * ```
170
+ */
171
+ getFieldById(fieldId) {
172
+ const field = this.getFieldByIdIfExists(fieldId);
173
+ if (!field) {
174
+ throw (0, _error_utils.spawnError)("No field with ID %s in table '%s'", fieldId, this.name);
175
+ }
176
+ return field;
177
+ }
178
+ /**
179
+ * Gets the field matching the given name, or `null` if no field exists with that name in this
180
+ * table.
181
+ *
182
+ * @param fieldName The name of the field you're looking for.
183
+ * @example
184
+ * ```js
185
+ * const field = myTable.getFieldByNameIfExists('Name');
186
+ * if (field !== null) {
187
+ * console.log(field.id);
188
+ * } else {
189
+ * console.log('No field exists with that name');
190
+ * }
191
+ * ```
192
+ */
193
+ getFieldByNameIfExists(fieldName) {
194
+ for (const [fieldId, fieldData] of (0, _private_utils.entries)(this._data.fieldsById)) {
195
+ if (fieldData.name === fieldName) {
196
+ return this.getFieldByIdIfExists(fieldId);
197
+ }
198
+ }
199
+ return null;
200
+ }
201
+ /**
202
+ * Gets the field matching the given name. Throws if no field exists with that name in this
203
+ * table. Use {@link getFieldByNameIfExists} instead if you are unsure whether a field exists
204
+ * with the given name.
205
+ *
206
+ * @param fieldName The name of the field you're looking for.
207
+ * @example
208
+ * ```js
209
+ * const field = myTable.getFieldByName('Name');
210
+ * console.log(field.id);
211
+ * // => 'fldxxxxxxxxxxxxxx'
212
+ * ```
213
+ */
214
+ getFieldByName(fieldName) {
215
+ const field = this.getFieldByNameIfExists(fieldName);
216
+ if (!field) {
217
+ throw (0, _error_utils.spawnError)("No field named '%s' in table '%s'", fieldName, this.name);
218
+ }
219
+ return field;
220
+ }
221
+ /**
222
+ * The field matching the given ID or name. Returns `null` if no matching field exists within
223
+ * this table.
224
+ *
225
+ * This method is convenient when building an extension for a specific base, but for more generic
226
+ * extensions the best practice is to use the {@link getFieldByIdIfExists} or
227
+ * {@link getFieldByNameIfExists} methods instead.
228
+ *
229
+ * @param fieldIdOrName The ID or name of the field you're looking for.
230
+ */
231
+ getFieldIfExists(fieldIdOrName) {
232
+ return this.getFieldByIdIfExists(fieldIdOrName) ?? this.getFieldByNameIfExists(fieldIdOrName);
233
+ }
234
+ /**
235
+ * The field matching the given ID or name. Throws if no matching field exists within this table.
236
+ * Use {@link getFieldIfExists} instead if you are unsure whether a field exists with the given
237
+ * name/ID.
238
+ *
239
+ * This method is convenient when building an extension for a specific base, but for more generic
240
+ * extensions the best practice is to use the {@link getFieldById} or {@link getFieldByName} methods
241
+ * instead.
242
+ *
243
+ * @param fieldIdOrName The ID or name of the field you're looking for.
244
+ */
245
+ getField(fieldIdOrName) {
246
+ const field = this.getFieldIfExists(fieldIdOrName);
247
+ if (!field) {
248
+ throw (0, _error_utils.spawnError)("No field with ID or name '%s' in table '%s'", fieldIdOrName, this.name);
249
+ }
250
+ return field;
251
+ }
252
+ /** @internal */
253
+ _cellValuesByFieldIdOrNameToCellValuesByFieldId(cellValuesByFieldIdOrName, onGenerateIdForNewForeignRecord) {
254
+ return Object.fromEntries((0, _private_utils.entries)(cellValuesByFieldIdOrName).map(_ref => {
255
+ let [fieldIdOrName, cellValue] = _ref;
256
+ const field = this.__getFieldMatching(fieldIdOrName);
257
+ return [field.id, this._adjustCellValueForFieldIfNecessary(field, cellValue, onGenerateIdForNewForeignRecord)];
258
+ }));
259
+ }
260
+ // This can be overridden by subclasses. See sdk/src/interface/models/table.ts.
261
+ /** @internal */
262
+ _adjustCellValueForFieldIfNecessary(field, cellValue, onGenerateIdForNewForeignRecord) {
263
+ return cellValue;
264
+ }
265
+ /**
266
+ * @internal
267
+ */
268
+ __getFieldMatching(fieldOrFieldIdOrFieldName) {
269
+ let field;
270
+ if (fieldOrFieldIdOrFieldName instanceof _field_core.FieldCore) {
271
+ if (fieldOrFieldIdOrFieldName.parentTable.id !== this.id) {
272
+ throw (0, _error_utils.spawnError)("Field '%s' is from a different table than table '%s'", fieldOrFieldIdOrFieldName.name, this.name);
273
+ }
274
+ field = fieldOrFieldIdOrFieldName;
275
+ } else {
276
+ field = this.getFieldByIdIfExists(fieldOrFieldIdOrFieldName) || this.getFieldByNameIfExists(fieldOrFieldIdOrFieldName);
277
+ if (field === null) {
278
+ throw (0, _error_utils.spawnError)("Field '%s' does not exist in table '%s'", fieldOrFieldIdOrFieldName, this.name);
279
+ }
280
+ }
281
+ if (field.isDeleted) {
282
+ throw (0, _error_utils.spawnError)("Field '%s' was deleted from table '%s'", field.name, this.name);
283
+ }
284
+ return field;
285
+ }
286
+
287
+ /**
288
+ * Updates cell values for a record.
289
+ *
290
+ * Throws an error if the user does not have permission to update the given cell values in
291
+ * the record, or if invalid input is provided (eg. invalid cell values).
292
+ *
293
+ * Refer to {@link FieldType} for cell value write formats.
294
+ *
295
+ * This action is asynchronous: `await` the returned promise if you wish to wait for the updated
296
+ * cell values to be persisted to Airtable servers.
297
+ * Updates are applied optimistically locally, so your changes will be reflected in your extension
298
+ * before the promise resolves.
299
+ *
300
+ * @param recordOrRecordId the record to update
301
+ * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
302
+ * @example
303
+ * ```js
304
+ * function updateRecord(record, recordFields) {
305
+ * if (table.hasPermissionToUpdateRecord(record, recordFields)) {
306
+ * table.updateRecordAsync(record, recordFields);
307
+ * }
308
+ * // The updated values will now show in your extension (eg in
309
+ * // `table.selectRecords()` result) but are still being saved to Airtable
310
+ * // servers (e.g. other users may not be able to see them yet).
311
+ * }
312
+ *
313
+ * async function updateRecordAsync(record, recordFields) {
314
+ * if (table.hasPermissionToUpdateRecord(record, recordFields)) {
315
+ * await table.updateRecordAsync(record, recordFields);
316
+ * }
317
+ * // New record has been saved to Airtable servers.
318
+ * alert(`record with ID ${record.id} has been updated`);
319
+ * }
320
+ *
321
+ * // Fields can be specified by name or ID
322
+ * updateRecord(record1, {
323
+ * 'Post Title': 'How to make: orange-mango pound cake',
324
+ * 'Publication Date': '2020-01-01',
325
+ * });
326
+ * updateRecord(record2, {
327
+ * [postTitleField.id]: 'Cake decorating tips & tricks',
328
+ * [publicationDateField.id]: '2020-02-02',
329
+ * });
330
+ *
331
+ * // Cell values should generally have format matching the output of
332
+ * // record.getCellValue() for the field being updated
333
+ * updateRecord(record1, {
334
+ * 'Category (single select)': {name: 'Recipe'},
335
+ * 'Tags (multiple select)': [{name: 'Desserts'}, {id: 'someChoiceId'}],
336
+ * 'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
337
+ * 'Related posts (linked records)': [{id: 'someRecordId'}],
338
+ * });
339
+ * ```
340
+ */
341
+ async updateRecordAsync(recordOrRecordId, fields) {
342
+ const recordId = typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id;
343
+ await this.updateRecordsAsync([{
344
+ id: recordId,
345
+ fields
346
+ }]);
347
+ }
348
+ /**
349
+ * Checks whether the current user has permission to perform the given record update.
350
+ *
351
+ * Accepts partial input, in the same format as {@link updateRecordAsync}.
352
+ * The more information provided, the more accurate the permissions check will be.
353
+ *
354
+ * Returns `{hasPermission: true}` if the current user can update the specified record,
355
+ * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
356
+ * used to display an error message to the user.
357
+ *
358
+ * @param recordOrRecordId the record to update
359
+ * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
360
+ * @example
361
+ * ```js
362
+ * // Check if user can update specific fields for a specific record.
363
+ * const updateRecordCheckResult =
364
+ * table.checkPermissionsForUpdateRecord(record, {
365
+ * 'Post Title': 'How to make: orange-mango pound cake',
366
+ * 'Publication Date': '2020-01-01',
367
+ * });
368
+ * if (!updateRecordCheckResult.hasPermission) {
369
+ * alert(updateRecordCheckResult.reasonDisplayString);
370
+ * }
371
+ *
372
+ * // Like updateRecordAsync, you can use either field names or field IDs.
373
+ * const updateRecordCheckResultWithFieldIds =
374
+ * table.checkPermissionsForUpdateRecord(record, {
375
+ * [postTitleField.id]: 'Cake decorating tips & tricks',
376
+ * [publicationDateField.id]: '2020-02-02',
377
+ * });
378
+ *
379
+ * // Check if user could update a given record, when you don't know the
380
+ * // specific fields that will be updated yet (e.g. to check whether you should
381
+ * // allow a user to select a certain record to update).
382
+ * const updateUnknownFieldsCheckResult =
383
+ * table.checkPermissionsForUpdateRecord(record);
384
+ *
385
+ * // Check if user could update specific fields, when you don't know the
386
+ * // specific record that will be updated yet. (for example, if the field is
387
+ * // selected by the user and you want to check if your extension can write to it).
388
+ * const updateUnknownRecordCheckResult =
389
+ * table.checkPermissionsForUpdateRecord(undefined, {
390
+ * 'My field name': 'updated value',
391
+ * // You can use undefined if you know you're going to update a field,
392
+ * // but don't know the new cell value yet.
393
+ * 'Another field name': undefined,
394
+ * });
395
+ *
396
+ * // Check if user could perform updates within the table, without knowing the
397
+ * // specific record or fields that will be updated yet (e.g., to render your
398
+ * // extension in "read only" mode).
399
+ * const updateUnknownRecordAndFieldsCheckResult =
400
+ * table.checkPermissionsForUpdateRecord();
401
+ * ```
402
+ */
403
+ checkPermissionsForUpdateRecord(recordOrRecordId, fields) {
404
+ const recordId = typeof recordOrRecordId === 'object' && recordOrRecordId !== null ? recordOrRecordId.id : recordOrRecordId;
405
+ return this.checkPermissionsForUpdateRecords([{
406
+ id: recordId,
407
+ fields
408
+ }]);
409
+ }
410
+ /**
411
+ * An alias for `checkPermissionsForUpdateRecord(recordOrRecordId, fields).hasPermission`.
412
+ *
413
+ * Checks whether the current user has permission to perform the given record update.
414
+ *
415
+ * Accepts partial input, in the same format as {@link updateRecordAsync}.
416
+ * The more information provided, the more accurate the permissions check will be.
417
+ *
418
+ * @param recordOrRecordId the record to update
419
+ * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
420
+ * @example
421
+ * ```js
422
+ * // Check if user can update specific fields for a specific record.
423
+ * const canUpdateRecord = table.hasPermissionToUpdateRecord(record, {
424
+ * 'Post Title': 'How to make: orange-mango pound cake',
425
+ * 'Publication Date': '2020-01-01',
426
+ * });
427
+ * if (!canUpdateRecord) {
428
+ * alert('not allowed!');
429
+ * }
430
+ *
431
+ * // Like updateRecordAsync, you can use either field names or field IDs.
432
+ * const canUpdateRecordWithFieldIds =
433
+ * table.hasPermissionToUpdateRecord(record, {
434
+ * [postTitleField.id]: 'Cake decorating tips & tricks',
435
+ * [publicationDateField.id]: '2020-02-02',
436
+ * });
437
+ *
438
+ * // Check if user could update a given record, when you don't know the
439
+ * // specific fields that will be updated yet (e.g. to check whether you should
440
+ * // allow a user to select a certain record to update).
441
+ * const canUpdateUnknownFields = table.hasPermissionToUpdateRecord(record);
442
+ *
443
+ * // Check if user could update specific fields, when you don't know the
444
+ * // specific record that will be updated yet (e.g. if the field is selected
445
+ * // by the user and you want to check if your extension can write to it).
446
+ * const canUpdateUnknownRecord =
447
+ * table.hasPermissionToUpdateRecord(undefined, {
448
+ * 'My field name': 'updated value',
449
+ * // You can use undefined if you know you're going to update a field,
450
+ * // but don't know the new cell value yet.
451
+ * 'Another field name': undefined,
452
+ * });
453
+ *
454
+ * // Check if user could perform updates within the table, without knowing the
455
+ * // specific record or fields that will be updated yet. (for example, to
456
+ * // render your extension in "read only" mode)
457
+ * const canUpdateUnknownRecordAndFields = table.hasPermissionToUpdateRecord();
458
+ * ```
459
+ */
460
+ hasPermissionToUpdateRecord(recordOrRecordId, fields) {
461
+ return this.checkPermissionsForUpdateRecord(recordOrRecordId, fields).hasPermission;
462
+ }
463
+ /**
464
+ * Updates cell values for records.
465
+ *
466
+ * Throws an error if the user does not have permission to update the given cell values in
467
+ * the records, or if invalid input is provided (eg. invalid cell values).
468
+ *
469
+ * Refer to {@link FieldType} for cell value write formats.
470
+ *
471
+ * You may only update up to 50 records in one call to `updateRecordsAsync`.
472
+ * See [Write back to Airtable](/guides/write-back-to-airtable) for more information
473
+ * about write limits.
474
+ *
475
+ * This action is asynchronous: `await` the returned promise if you wish to wait for the
476
+ * updates to be persisted to Airtable servers.
477
+ * Updates are applied optimistically locally, so your changes will be reflected in your extension
478
+ * before the promise resolves.
479
+ *
480
+ * @param records Array of objects containing recordId and fields/cellValues to update for that record (specified as an object mapping `FieldId` or field name to cell value)
481
+ * @example
482
+ * ```js
483
+ * const recordsToUpdate = [
484
+ * // Fields can be specified by name or ID
485
+ * {
486
+ * id: record1.id,
487
+ * fields: {
488
+ * 'Post Title': 'How to make: orange-mango pound cake',
489
+ * 'Publication Date': '2020-01-01',
490
+ * },
491
+ * },
492
+ * {
493
+ * id: record2.id,
494
+ * fields: {
495
+ * // Sets the cell values to be empty.
496
+ * 'Post Title': '',
497
+ * 'Publication Date': '',
498
+ * },
499
+ * },
500
+ * {
501
+ * id: record3.id,
502
+ * fields: {
503
+ * [postTitleField.id]: 'Cake decorating tips & tricks',
504
+ * [publicationDateField.id]: '2020-02-02',
505
+ * },
506
+ * },
507
+ * // Cell values should generally have format matching the output of
508
+ * // record.getCellValue() for the field being updated
509
+ * {
510
+ * id: record4.id,
511
+ * fields: {
512
+ * 'Category (single select)': {name: 'Recipe'},
513
+ * 'Tags (multiple select)': [{name: 'Desserts'}, {id: 'choiceId'}],
514
+ * 'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
515
+ * 'Related posts (linked records)': [{id: 'someRecordId'}],
516
+ * },
517
+ * },
518
+ * ];
519
+ *
520
+ * function updateRecords() {
521
+ * if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
522
+ * table.updateRecordsAsync(recordsToUpdate);
523
+ * }
524
+ * // The records are now updated within your extension (eg will be reflected in
525
+ * // `table.selectRecords()`) but are still being saved to Airtable servers
526
+ * // (e.g. they may not be updated for other users yet).
527
+ * }
528
+ *
529
+ * async function updateRecordsAsync() {
530
+ * if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
531
+ * await table.updateRecordsAsync(recordsToUpdate);
532
+ * }
533
+ * // Record updates have been saved to Airtable servers.
534
+ * alert('records have been updated');
535
+ * }
536
+ * ```
537
+ */
538
+ async updateRecordsAsync(records) {
539
+ let includesForeignRowsThatShouldBeCreated = false;
540
+ const recordsWithCellValuesByFieldId = records.map(record => ({
541
+ id: record.id,
542
+ cellValuesByFieldId: this._cellValuesByFieldIdOrNameToCellValuesByFieldId(record.fields, () => {
543
+ includesForeignRowsThatShouldBeCreated = true;
544
+ })
545
+ }));
546
+ await this._sdk.__mutations.applyMutationAsync({
547
+ type: _mutations_core.MutationTypesCore.SET_MULTIPLE_RECORDS_CELL_VALUES,
548
+ tableId: this.id,
549
+ records: recordsWithCellValuesByFieldId,
550
+ opts: {
551
+ parseDateCellValueInColumnTimeZone: true,
552
+ includesForeignRowsThatShouldBeCreated
553
+ }
554
+ });
555
+ }
556
+ /**
557
+ * Checks whether the current user has permission to perform the given record updates.
558
+ *
559
+ * Accepts partial input, in the same format as {@link updateRecordsAsync}.
560
+ * The more information provided, the more accurate the permissions check will be.
561
+ *
562
+ * Returns `{hasPermission: true}` if the current user can update the specified records,
563
+ * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
564
+ * used to display an error message to the user.
565
+ *
566
+ * @param records Array of objects containing recordId and fields/cellValues to update for that record (specified as an object mapping `FieldId` or field name to cell value)
567
+ * @example
568
+ * ```js
569
+ * const recordsToUpdate = [
570
+ * {
571
+ * // Validating a complete record update
572
+ * id: record1.id,
573
+ * fields: {
574
+ * 'Post Title': 'How to make: orange-mango pound cake',
575
+ * 'Publication Date': '2020-01-01',
576
+ * },
577
+ * },
578
+ * {
579
+ * // Like updateRecordsAsync, fields can be specified by name or ID
580
+ * id: record2.id,
581
+ * fields: {
582
+ * [postTitleField.id]: 'Cake decorating tips & tricks',
583
+ * [publicationDateField.id]: '2020-02-02',
584
+ * },
585
+ * },
586
+ * {
587
+ * // Validating an update to a specific record, not knowing what
588
+ * // fields will be updated
589
+ * id: record3.id,
590
+ * },
591
+ * {
592
+ * // Validating an update to specific cell values, not knowing what
593
+ * // record will be updated
594
+ * fields: {
595
+ * 'My field name': 'updated value for unknown record',
596
+ * // You can use undefined if you know you're going to update a
597
+ * // field, but don't know the new cell value yet.
598
+ * 'Another field name': undefined,
599
+ * },
600
+ * },
601
+ * ];
602
+ *
603
+ * const updateRecordsCheckResult =
604
+ * table.checkPermissionsForUpdateRecords(recordsToUpdate);
605
+ * if (!updateRecordsCheckResult.hasPermission) {
606
+ * alert(updateRecordsCheckResult.reasonDisplayString);
607
+ * }
608
+ *
609
+ * // Check if user could potentially update records.
610
+ * // Equivalent to table.checkPermissionsForUpdateRecord()
611
+ * const updateUnknownRecordAndFieldsCheckResult =
612
+ * table.checkPermissionsForUpdateRecords();
613
+ * ```
614
+ */
615
+ checkPermissionsForUpdateRecords(records) {
616
+ let includesForeignRowsThatShouldBeCreated = false;
617
+ const recordsWithCellValuesByFieldId = records ? records.map(record => ({
618
+ id: record.id || undefined,
619
+ cellValuesByFieldId: record.fields ? this._cellValuesByFieldIdOrNameToCellValuesByFieldId(record.fields, () => {
620
+ includesForeignRowsThatShouldBeCreated = true;
621
+ }) : undefined
622
+ })) : undefined;
623
+ return this._sdk.__mutations.checkPermissionsForMutation({
624
+ type: _mutations_core.MutationTypesCore.SET_MULTIPLE_RECORDS_CELL_VALUES,
625
+ tableId: this.id,
626
+ records: recordsWithCellValuesByFieldId,
627
+ opts: {
628
+ parseDateCellValueInColumnTimeZone: true,
629
+ includesForeignRowsThatShouldBeCreated
630
+ }
631
+ });
632
+ }
633
+ /**
634
+ * An alias for `checkPermissionsForUpdateRecords(records).hasPermission`.
635
+ *
636
+ * Checks whether the current user has permission to perform the given record updates.
637
+ *
638
+ * Accepts partial input, in the same format as {@link updateRecordsAsync}.
639
+ * The more information provided, the more accurate the permissions check will be.
640
+ *
641
+ * @param records Array of objects containing recordId and fields/cellValues to update for that record (specified as an object mapping `FieldId` or field name to cell value)
642
+ * @example
643
+ * ```js
644
+ * const recordsToUpdate = [
645
+ * {
646
+ * // Validating a complete record update
647
+ * id: record1.id,
648
+ * fields: {
649
+ * 'Post Title': 'How to make: orange-mango pound cake',
650
+ * 'Publication Date': '2020-01-01',
651
+ * },
652
+ * },
653
+ * {
654
+ * // Like updateRecordsAsync, fields can be specified by name or ID
655
+ * id: record2.id,
656
+ * fields: {
657
+ * [postTitleField.id]: 'Cake decorating tips & tricks',
658
+ * [publicationDateField.id]: '2020-02-02',
659
+ * },
660
+ * },
661
+ * {
662
+ * // Validating an update to a specific record, not knowing what
663
+ * // fields will be updated
664
+ * id: record3.id,
665
+ * },
666
+ * {
667
+ * // Validating an update to specific cell values, not knowing what
668
+ * // record will be updated
669
+ * fields: {
670
+ * 'My field name': 'updated value for unknown record',
671
+ * // You can use undefined if you know you're going to update a
672
+ * // field, but don't know the new cell value yet.
673
+ * 'Another field name': undefined,
674
+ * },
675
+ * },
676
+ * ];
677
+ *
678
+ * const canUpdateRecords = table.hasPermissionToUpdateRecords(recordsToUpdate);
679
+ * if (!canUpdateRecords) {
680
+ * alert('not allowed');
681
+ * }
682
+ *
683
+ * // Check if user could potentially update records.
684
+ * // Equivalent to table.hasPermissionToUpdateRecord()
685
+ * const canUpdateUnknownRecordsAndFields =
686
+ * table.hasPermissionToUpdateRecords();
687
+ * ```
688
+ */
689
+ hasPermissionToUpdateRecords(records) {
690
+ return this.checkPermissionsForUpdateRecords(records).hasPermission;
691
+ }
692
+ /**
693
+ * Delete the given record.
694
+ *
695
+ * Throws an error if the user does not have permission to delete the given record.
696
+ *
697
+ * This action is asynchronous: `await` the returned promise if you wish to wait for the
698
+ * delete to be persisted to Airtable servers.
699
+ * Updates are applied optimistically locally, so your changes will be reflected in your extension
700
+ * before the promise resolves.
701
+ *
702
+ * @param recordOrRecordId the record to be deleted
703
+ * @example
704
+ * ```js
705
+ * function deleteRecord(record) {
706
+ * if (table.hasPermissionToDeleteRecord(record)) {
707
+ * table.deleteRecordAsync(record);
708
+ * }
709
+ * // The record is now deleted within your extension (eg will not be returned
710
+ * // in `table.selectRecords`) but it is still being saved to Airtable
711
+ * // servers (e.g. it may not look deleted to other users yet).
712
+ * }
713
+ *
714
+ * async function deleteRecordAsync(record) {
715
+ * if (table.hasPermissionToDeleteRecord(record)) {
716
+ * await table.deleteRecordAsync(record);
717
+ * }
718
+ * // Record deletion has been saved to Airtable servers.
719
+ * alert('record has been deleted');
720
+ * }
721
+ * ```
722
+ */
723
+ async deleteRecordAsync(recordOrRecordId) {
724
+ await this.deleteRecordsAsync([recordOrRecordId]);
725
+ }
726
+ /**
727
+ * Checks whether the current user has permission to delete the specified record.
728
+ *
729
+ * Accepts optional input, in the same format as {@link deleteRecordAsync}.
730
+ * The more information provided, the more accurate the permissions check will be.
731
+ *
732
+ * Returns `{hasPermission: true}` if the current user can delete the specified record,
733
+ * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
734
+ * used to display an error message to the user.
735
+ *
736
+ * @param recordOrRecordId the record to be deleted
737
+ * @example
738
+ * ```js
739
+ * // Check if user can delete a specific record
740
+ * const deleteRecordCheckResult =
741
+ * table.checkPermissionsForDeleteRecord(record);
742
+ * if (!deleteRecordCheckResult.hasPermission) {
743
+ * alert(deleteRecordCheckResult.reasonDisplayString);
744
+ * }
745
+ *
746
+ * // Check if user could potentially delete a record.
747
+ * // Use when you don't know the specific record you want to delete yet (for
748
+ * // example, to show/hide UI controls that let you select a record to delete).
749
+ * const deleteUnknownRecordCheckResult =
750
+ * table.checkPermissionsForDeleteRecord();
751
+ * ```
752
+ */
753
+ checkPermissionsForDeleteRecord(recordOrRecordId) {
754
+ return this.checkPermissionsForDeleteRecords(recordOrRecordId ? [recordOrRecordId] : undefined);
755
+ }
756
+ /**
757
+ * An alias for `checkPermissionsForDeleteRecord(recordOrRecordId).hasPermission`.
758
+ *
759
+ * Checks whether the current user has permission to delete the specified record.
760
+ *
761
+ * Accepts optional input, in the same format as {@link deleteRecordAsync}.
762
+ * The more information provided, the more accurate the permissions check will be.
763
+ *
764
+ * @param recordOrRecordId the record to be deleted
765
+ * @example
766
+ * ```js
767
+ * // Check if user can delete a specific record
768
+ * const canDeleteRecord = table.hasPermissionToDeleteRecord(record);
769
+ * if (!canDeleteRecord) {
770
+ * alert('not allowed');
771
+ * }
772
+ *
773
+ * // Check if user could potentially delete a record.
774
+ * // Use when you don't know the specific record you want to delete yet (for
775
+ * // example, to show/hide UI controls that let you select a record to delete).
776
+ * const canDeleteUnknownRecord = table.hasPermissionToDeleteRecord();
777
+ * ```
778
+ */
779
+ hasPermissionToDeleteRecord(recordOrRecordId) {
780
+ return this.checkPermissionsForDeleteRecord(recordOrRecordId).hasPermission;
781
+ }
782
+ /**
783
+ * Delete the given records.
784
+ *
785
+ * Throws an error if the user does not have permission to delete the given records.
786
+ *
787
+ * You may only delete up to 50 records in one call to `deleteRecordsAsync`.
788
+ * See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
789
+ * more information about write limits.
790
+ *
791
+ * This action is asynchronous: `await` the returned promise if you wish to wait for the
792
+ * delete to be persisted to Airtable servers.
793
+ * Updates are applied optimistically locally, so your changes will be reflected in your extension
794
+ * before the promise resolves.
795
+ *
796
+ * @param recordsOrRecordIds Array of Records and RecordIds
797
+ * @example
798
+ * ```js
799
+ *
800
+ * function deleteRecords(records) {
801
+ * if (table.hasPermissionToDeleteRecords(records)) {
802
+ * table.deleteRecordsAsync(records);
803
+ * }
804
+ * // The records are now deleted within your extension (eg will not be
805
+ * // returned in `table.selectRecords()`) but are still being saved to
806
+ * // Airtable servers (e.g. they may not look deleted to other users yet).
807
+ * }
808
+ *
809
+ * async function deleteRecordsAsync(records) {
810
+ * if (table.hasPermissionToDeleteRecords(records)) {
811
+ * await table.deleteRecordsAsync(records);
812
+ * }
813
+ * // Record deletions have been saved to Airtable servers.
814
+ * alert('records have been deleted');
815
+ * }
816
+ * ```
817
+ */
818
+ async deleteRecordsAsync(recordsOrRecordIds) {
819
+ const recordIds = recordsOrRecordIds.map(recordOrRecordId => typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id);
820
+ await this._sdk.__mutations.applyMutationAsync({
821
+ type: _mutations_core.MutationTypesCore.DELETE_MULTIPLE_RECORDS,
822
+ tableId: this.id,
823
+ recordIds
824
+ });
825
+ }
826
+ /**
827
+ * Checks whether the current user has permission to delete the specified records.
828
+ *
829
+ * Accepts optional input, in the same format as {@link deleteRecordsAsync}.
830
+ * The more information provided, the more accurate the permissions check will be.
831
+ *
832
+ * Returns `{hasPermission: true}` if the current user can delete the specified records,
833
+ * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
834
+ * used to display an error message to the user.
835
+ *
836
+ * @param recordsOrRecordIds the records to be deleted
837
+ * @example
838
+ * ```js
839
+ * // Check if user can delete specific records
840
+ * const deleteRecordsCheckResult =
841
+ * table.checkPermissionsForDeleteRecords([record1, record2]);
842
+ * if (!deleteRecordsCheckResult.hasPermission) {
843
+ * alert(deleteRecordsCheckResult.reasonDisplayString);
844
+ * }
845
+ *
846
+ * // Check if user could potentially delete records.
847
+ * // Use when you don't know the specific records you want to delete yet (for
848
+ * // example, to show/hide UI controls that let you select records to delete).
849
+ * // Equivalent to table.hasPermissionToDeleteRecord()
850
+ * const deleteUnknownRecordsCheckResult =
851
+ * table.checkPermissionsForDeleteRecords();
852
+ * ```
853
+ */
854
+ checkPermissionsForDeleteRecords(recordsOrRecordIds) {
855
+ return this._sdk.__mutations.checkPermissionsForMutation({
856
+ type: _mutations_core.MutationTypesCore.DELETE_MULTIPLE_RECORDS,
857
+ tableId: this.id,
858
+ recordIds: recordsOrRecordIds ? recordsOrRecordIds.map(recordOrRecordId => typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id) : undefined
859
+ });
860
+ }
861
+ /**
862
+ * An alias for `checkPermissionsForDeleteRecords(recordsOrRecordIds).hasPermission`.
863
+ *
864
+ * Checks whether the current user has permission to delete the specified records.
865
+ *
866
+ * Accepts optional input, in the same format as {@link deleteRecordsAsync}.
867
+ * The more information provided, the more accurate the permissions check will be.
868
+ *
869
+ * @param recordsOrRecordIds the records to be deleted
870
+ * @example
871
+ * ```js
872
+ * // Check if user can delete specific records
873
+ * const canDeleteRecords =
874
+ * table.hasPermissionToDeleteRecords([record1, record2]);
875
+ * if (!canDeleteRecords) {
876
+ * alert('not allowed!');
877
+ * }
878
+ *
879
+ * // Check if user could potentially delete records.
880
+ * // Use when you don't know the specific records you want to delete yet (for
881
+ * // example, to show/hide UI controls that let you select records to delete).
882
+ * // Equivalent to table.hasPermissionToDeleteRecord()
883
+ * const canDeleteUnknownRecords = table.hasPermissionToDeleteRecords();
884
+ * ```
885
+ */
886
+ hasPermissionToDeleteRecords(recordsOrRecordIds) {
887
+ return this.checkPermissionsForDeleteRecords(recordsOrRecordIds).hasPermission;
888
+ }
889
+
890
+ /**
891
+ * Creates a new record with the specified cell values.
892
+ *
893
+ * Throws an error if the user does not have permission to create the given records, or
894
+ * if invalid input is provided (eg. invalid cell values).
895
+ *
896
+ * Refer to {@link FieldType} for cell value write formats.
897
+ *
898
+ * This action is asynchronous: `await` the returned promise if you wish to wait for the new
899
+ * record to be persisted to Airtable servers.
900
+ * Updates are applied optimistically locally, so your changes will be reflected in your extension
901
+ * before the promise resolves.
902
+ *
903
+ * The returned promise will resolve to the RecordId of the new record once it is persisted.
904
+ *
905
+ * @param fields object mapping `FieldId` or field name to value for that field.
906
+ * @example
907
+ * ```js
908
+ * function createNewRecord(recordFields) {
909
+ * if (table.hasPermissionToCreateRecord(recordFields)) {
910
+ * table.createRecordAsync(recordFields);
911
+ * }
912
+ * // You can now access the new record in your extension (eg
913
+ * // `table.selectRecords()`) but it is still being saved to Airtable
914
+ * // servers (e.g. other users may not be able to see it yet).
915
+ * }
916
+ *
917
+ * async function createNewRecordAsync(recordFields) {
918
+ * if (table.hasPermissionToCreateRecord(recordFields)) {
919
+ * const newRecordId = await table.createRecordAsync(recordFields);
920
+ * }
921
+ * // New record has been saved to Airtable servers.
922
+ * alert(`new record with ID ${newRecordId} has been created`);
923
+ * }
924
+ *
925
+ * // Fields can be specified by name or ID
926
+ * createNewRecord({
927
+ * 'Project Name': 'Advertising campaign',
928
+ * 'Budget': 100,
929
+ * });
930
+ * createNewRecord({
931
+ * [projectNameField.id]: 'Cat video',
932
+ * [budgetField.id]: 200,
933
+ * });
934
+ *
935
+ * // Cell values should generally have format matching the output of
936
+ * // record.getCellValue() for the field being updated
937
+ * createNewRecord({
938
+ * 'Project Name': 'Cat video 2'
939
+ * 'Category (single select)': {name: 'Video'},
940
+ * 'Tags (multiple select)': [{name: 'Cats'}, {id: 'someChoiceId'}],
941
+ * 'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
942
+ * 'Related projects (linked records)': [{id: 'someRecordId'}],
943
+ * });
944
+ * ```
945
+ */
946
+ async createRecordAsync() {
947
+ let fields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
948
+ const recordIds = await this.createRecordsAsync([{
949
+ fields
950
+ }]);
951
+ return recordIds[0];
952
+ }
953
+
954
+ /**
955
+ * Checks whether the current user has permission to create the specified record.
956
+ *
957
+ * Accepts partial input, in the same format as {@link createRecordAsync}.
958
+ * The more information provided, the more accurate the permissions check will be.
959
+ *
960
+ * Returns `{hasPermission: true}` if the current user can create the specified record,
961
+ * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
962
+ * used to display an error message to the user.
963
+ *
964
+ * @param fields object mapping `FieldId` or field name to value for that field.
965
+ * @example
966
+ * ```js
967
+ * // Check if user can create a specific record, when you already know what
968
+ * // fields/cell values will be set for the record.
969
+ * const createRecordCheckResult = table.checkPermissionsForCreateRecord({
970
+ * 'Project Name': 'Advertising campaign',
971
+ * 'Budget': 100,
972
+ * });
973
+ * if (!createRecordCheckResult.hasPermission) {
974
+ * alert(createRecordCheckResult.reasonDisplayString);
975
+ * }
976
+ *
977
+ * // Like createRecordAsync, you can use either field names or field IDs.
978
+ * const checkResultWithFieldIds = table.checkPermissionsForCreateRecord({
979
+ * [projectNameField.id]: 'Cat video',
980
+ * [budgetField.id]: 200,
981
+ * });
982
+ *
983
+ * // Check if user could potentially create a record.
984
+ * // Use when you don't know the specific fields/cell values yet (for example,
985
+ * // to show or hide UI controls that let you start creating a record.)
986
+ * const createUnknownRecordCheckResult =
987
+ * table.checkPermissionsForCreateRecord();
988
+ * ```
989
+ */
990
+ checkPermissionsForCreateRecord(fields) {
991
+ return this.checkPermissionsForCreateRecords([{
992
+ fields: fields || undefined
993
+ }]);
994
+ }
995
+ /**
996
+ * An alias for `checkPermissionsForCreateRecord(fields).hasPermission`.
997
+ *
998
+ * Checks whether the current user has permission to create the specified record.
999
+ *
1000
+ * Accepts partial input, in the same format as {@link createRecordAsync}.
1001
+ * The more information provided, the more accurate the permissions check will be.
1002
+ *
1003
+ * @param fields object mapping `FieldId` or field name to value for that field.
1004
+ * @example
1005
+ * ```js
1006
+ * // Check if user can create a specific record, when you already know what
1007
+ * // fields/cell values will be set for the record.
1008
+ * const canCreateRecord = table.hasPermissionToCreateRecord({
1009
+ * 'Project Name': 'Advertising campaign',
1010
+ * 'Budget': 100,
1011
+ * });
1012
+ * if (!canCreateRecord) {
1013
+ * alert('not allowed!');
1014
+ * }
1015
+ *
1016
+ * // Like createRecordAsync, you can use either field names or field IDs.
1017
+ * const canCreateRecordWithFieldIds = table.hasPermissionToCreateRecord({
1018
+ * [projectNameField.id]: 'Cat video',
1019
+ * [budgetField.id]: 200,
1020
+ * });
1021
+ *
1022
+ * // Check if user could potentially create a record.
1023
+ * // Use when you don't know the specific fields/cell values yet (for example,
1024
+ * // to show or hide UI controls that let you start creating a record.)
1025
+ * const canCreateUnknownRecord = table.hasPermissionToCreateRecord();
1026
+ * ```
1027
+ */
1028
+ hasPermissionToCreateRecord(fields) {
1029
+ return this.checkPermissionsForCreateRecord(fields).hasPermission;
1030
+ }
1031
+ /**
1032
+ * Creates new records with the specified cell values.
1033
+ *
1034
+ * Throws an error if the user does not have permission to create the given records, or
1035
+ * if invalid input is provided (eg. invalid cell values).
1036
+ *
1037
+ * Refer to {@link FieldType} for cell value write formats.
1038
+ *
1039
+ * You may only create up to 50 records in one call to `createRecordsAsync`.
1040
+ * See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
1041
+ * more information about write limits.
1042
+ *
1043
+ * This action is asynchronous: `await` the returned promise if you wish to wait for the new
1044
+ * record to be persisted to Airtable servers.
1045
+ * Updates are applied optimistically locally, so your changes will be reflected in your extension
1046
+ * before the promise resolves.
1047
+ *
1048
+ * The returned promise will resolve to an array of RecordIds of the new records once the new
1049
+ * records are persisted.
1050
+ *
1051
+ * @param records Array of objects with a `fields` key mapping `FieldId` or field name to value for that field.
1052
+ * @example
1053
+ * ```js
1054
+ * const recordDefs = [
1055
+ * // Fields can be specified by name or ID
1056
+ * {
1057
+ * fields: {
1058
+ * 'Project Name': 'Advertising campaign',
1059
+ * 'Budget': 100,
1060
+ * },
1061
+ * },
1062
+ * {
1063
+ * fields: {
1064
+ * [projectNameField.id]: 'Cat video',
1065
+ * [budgetField.id]: 200,
1066
+ * },
1067
+ * },
1068
+ * // Specifying no fields will create a new record with no cell values set
1069
+ * {
1070
+ * fields: {},
1071
+ * },
1072
+ * // Cell values should generally have format matching the output of
1073
+ * // record.getCellValue() for the field being updated
1074
+ * {
1075
+ * fields: {
1076
+ * 'Project Name': 'Cat video 2'
1077
+ * 'Category (single select)': {name: 'Video'},
1078
+ * 'Tags (multiple select)': [{name: 'Cats'}, {id: 'choiceId'}],
1079
+ * 'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
1080
+ * 'Related projects (linked records)': [{id: 'someRecordId'}],
1081
+ * },
1082
+ * },
1083
+ * ];
1084
+ *
1085
+ * function createNewRecords() {
1086
+ * if (table.hasPermissionToCreateRecords(recordDefs)) {
1087
+ * table.createRecordsAsync(recordDefs);
1088
+ * }
1089
+ * // You can now access the new records in your extension (e.g.
1090
+ * // `table.selectRecords()`) but they are still being saved to Airtable
1091
+ * // servers (e.g. other users may not be able to see them yet.)
1092
+ * }
1093
+ *
1094
+ * async function createNewRecordsAsync() {
1095
+ * if (table.hasPermissionToCreateRecords(recordDefs)) {
1096
+ * const newRecordIds = await table.createRecordsAsync(recordDefs);
1097
+ * }
1098
+ * // New records have been saved to Airtable servers.
1099
+ * alert(`new records with IDs ${newRecordIds} have been created`);
1100
+ * }
1101
+ * ```
1102
+ */
1103
+ async createRecordsAsync(records) {
1104
+ let includesForeignRowsThatShouldBeCreated = false;
1105
+ const recordsToCreate = records.map(recordDef => {
1106
+ const recordDefKeys = (0, _private_utils.keys)(recordDef);
1107
+ let fields;
1108
+ if (recordDefKeys.length === 1 && recordDefKeys[0] === 'fields') {
1109
+ fields = recordDef.fields;
1110
+ } else {
1111
+ throw (0, _error_utils.spawnError)('Invalid record format. Please define field mappings using a `fields` key for each record definition object');
1112
+ }
1113
+ return {
1114
+ id: this._sdk.__airtableInterface.idGenerator.generateRecordId(),
1115
+ cellValuesByFieldId: this._cellValuesByFieldIdOrNameToCellValuesByFieldId(fields, () => {
1116
+ includesForeignRowsThatShouldBeCreated = true;
1117
+ })
1118
+ };
1119
+ });
1120
+ await this._sdk.__mutations.applyMutationAsync({
1121
+ type: _mutations_core.MutationTypesCore.CREATE_MULTIPLE_RECORDS,
1122
+ tableId: this.id,
1123
+ records: recordsToCreate,
1124
+ opts: {
1125
+ parseDateCellValueInColumnTimeZone: true,
1126
+ includesForeignRowsThatShouldBeCreated
1127
+ }
1128
+ });
1129
+ return recordsToCreate.map(record => record.id);
1130
+ }
1131
+ /**
1132
+ * Checks whether the current user has permission to create the specified records.
1133
+ *
1134
+ * Accepts partial input, in the same format as {@link createRecordsAsync}.
1135
+ * The more information provided, the more accurate the permissions check will be.
1136
+ *
1137
+ * Returns `{hasPermission: true}` if the current user can create the specified records,
1138
+ * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
1139
+ * used to display an error message to the user.
1140
+ *
1141
+ * @param records Array of objects mapping `FieldId` or field name to value for that field.
1142
+ * @example
1143
+ * ```js
1144
+ * // Check if user can create specific records, when you already know what
1145
+ * // fields/cell values will be set for the records.
1146
+ * const createRecordsCheckResult = table.checkPermissionsForCreateRecords([
1147
+ * // Like createRecordsAsync, fields can be specified by name or ID
1148
+ * {
1149
+ * fields: {
1150
+ * 'Project Name': 'Advertising campaign',
1151
+ * 'Budget': 100,
1152
+ * },
1153
+ * },
1154
+ * {
1155
+ * fields: {
1156
+ * [projectNameField.id]: 'Cat video',
1157
+ * [budgetField.id]: 200,
1158
+ * },
1159
+ * },
1160
+ * {},
1161
+ * ]);
1162
+ * if (!createRecordsCheckResult.hasPermission) {
1163
+ * alert(createRecordsCheckResult.reasonDisplayString);
1164
+ * }
1165
+ *
1166
+ * // Check if user could potentially create records.
1167
+ * // Use when you don't know the specific fields/cell values yet (for example,
1168
+ * // to show or hide UI controls that let you start creating records.)
1169
+ * // Equivalent to table.checkPermissionsForCreateRecord()
1170
+ * const createUnknownRecordCheckResult =
1171
+ * table.checkPermissionsForCreateRecords();
1172
+ * ```
1173
+ */
1174
+ checkPermissionsForCreateRecords(records) {
1175
+ let includesForeignRowsThatShouldBeCreated = false;
1176
+ const recordsWithCellValuesByFieldId = records ? records.map(record => ({
1177
+ id: undefined,
1178
+ cellValuesByFieldId: record.fields ? this._cellValuesByFieldIdOrNameToCellValuesByFieldId(record.fields, () => {
1179
+ includesForeignRowsThatShouldBeCreated = true;
1180
+ }) : undefined
1181
+ })) : undefined;
1182
+ return this._sdk.__mutations.checkPermissionsForMutation({
1183
+ type: _mutations_core.MutationTypesCore.CREATE_MULTIPLE_RECORDS,
1184
+ tableId: this.id,
1185
+ records: recordsWithCellValuesByFieldId,
1186
+ opts: {
1187
+ parseDateCellValueInColumnTimeZone: true,
1188
+ includesForeignRowsThatShouldBeCreated
1189
+ }
1190
+ });
1191
+ }
1192
+ /**
1193
+ * An alias for `checkPermissionsForCreateRecords(records).hasPermission`.
1194
+ *
1195
+ * Checks whether the current user has permission to create the specified records.
1196
+ *
1197
+ * Accepts partial input, in the same format as {@link createRecordsAsync}.
1198
+ * The more information provided, the more accurate the permissions check will be.
1199
+ *
1200
+ * @param records Array of objects mapping `FieldId` or field name to value for that field.
1201
+ * @example
1202
+ * ```js
1203
+ * // Check if user can create specific records, when you already know what fields/cell values
1204
+ * // will be set for the records.
1205
+ * const canCreateRecords = table.hasPermissionToCreateRecords([
1206
+ * // Like createRecordsAsync, fields can be specified by name or ID
1207
+ * {
1208
+ * fields: {
1209
+ * 'Project Name': 'Advertising campaign',
1210
+ * 'Budget': 100,
1211
+ * }
1212
+ * },
1213
+ * {
1214
+ * fields: {
1215
+ * [projectNameField.id]: 'Cat video',
1216
+ * [budgetField.id]: 200,
1217
+ * }
1218
+ * },
1219
+ * {},
1220
+ * ]);
1221
+ * if (!canCreateRecords) {
1222
+ * alert('not allowed');
1223
+ * }
1224
+ *
1225
+ * // Check if user could potentially create records.
1226
+ * // Use when you don't know the specific fields/cell values yet (for example,
1227
+ * // to show or hide UI controls that let you start creating records).
1228
+ * // Equivalent to table.hasPermissionToCreateRecord()
1229
+ * const canCreateUnknownRecords = table.hasPermissionToCreateRecords();
1230
+ * ```
1231
+ */
1232
+ hasPermissionToCreateRecords(records) {
1233
+ return this.checkPermissionsForCreateRecords(records).hasPermission;
1234
+ }
1235
+
1236
+ /**
1237
+ * @internal
1238
+ */
1239
+ __triggerOnChangeForDirtyPaths(dirtyPaths) {
1240
+ let didTableSchemaChange = false;
1241
+ if (dirtyPaths.name) {
1242
+ this._onChange(WatchableTableKeysCore.name);
1243
+ didTableSchemaChange = true;
1244
+ }
1245
+ if (dirtyPaths.lock) {
1246
+ didTableSchemaChange = true;
1247
+ }
1248
+ if (dirtyPaths.externalSyncById) {
1249
+ didTableSchemaChange = true;
1250
+ }
1251
+ if (dirtyPaths.description) {
1252
+ this._onChange(WatchableTableKeysCore.description);
1253
+ didTableSchemaChange = true;
1254
+ }
1255
+ if (dirtyPaths.fieldsById) {
1256
+ // TODO: don't trigger schema change when autonumber typeOptions change.
1257
+ // That currently happens every time you create a row in a table with an
1258
+ // autonumber field.
1259
+ didTableSchemaChange = true;
1260
+
1261
+ // Since tables don't have a field order, need to detect if a field
1262
+ // was created or deleted and trigger onChange for fields.
1263
+ const addedFieldIds = [];
1264
+ const removedFieldIds = [];
1265
+ for (const [fieldId, dirtyFieldPaths] of (0, _private_utils.entries)(dirtyPaths.fieldsById)) {
1266
+ if (dirtyFieldPaths && dirtyFieldPaths._isDirty) {
1267
+ // If the entire field is dirty, it was either created or deleted.
1268
+ if ((0, _private_utils.has)(this._data.fieldsById, fieldId)) {
1269
+ addedFieldIds.push(fieldId);
1270
+ } else {
1271
+ removedFieldIds.push(fieldId);
1272
+ const fieldModel = this._fieldModelsById[fieldId];
1273
+ if (fieldModel) {
1274
+ // Remove the Field model if it was deleted.
1275
+ delete this._fieldModelsById[fieldId];
1276
+ }
1277
+ }
1278
+ } else {
1279
+ // Directly access from _fieldModelsById to avoid creating
1280
+ // a field model if it doesn't already exist. If it doesn't exist,
1281
+ // nothing can be subscribed to any events on it.
1282
+ const field = this._fieldModelsById[fieldId];
1283
+ if (field) {
1284
+ field.__triggerOnChangeForDirtyPaths(dirtyFieldPaths);
1285
+ }
1286
+ }
1287
+ }
1288
+ if (addedFieldIds.length > 0 || removedFieldIds.length > 0) {
1289
+ this._onChange(WatchableTableKeysCore.fields, {
1290
+ addedFieldIds,
1291
+ removedFieldIds
1292
+ });
1293
+ }
1294
+
1295
+ // Clear out cached field names in case a field was added/removed/renamed.
1296
+ this._cachedFieldNamesById = null;
1297
+ }
1298
+
1299
+ // NOTE: Record store onChange triggers must be performed AFTER field onChange triggers to
1300
+ // ensure the column type providers are not stale.
1301
+ this._recordStore.triggerOnChangeForDirtyPaths(dirtyPaths);
1302
+ return didTableSchemaChange;
1303
+ }
1304
+ /**
1305
+ * @internal
1306
+ */
1307
+ __getFieldNamesById() {
1308
+ if (!this._cachedFieldNamesById) {
1309
+ const fieldNamesById = {};
1310
+ for (const [fieldId, fieldData] of (0, _private_utils.entries)(this._data.fieldsById)) {
1311
+ fieldNamesById[fieldId] = fieldData.name;
1312
+ }
1313
+ this._cachedFieldNamesById = fieldNamesById;
1314
+ }
1315
+ return this._cachedFieldNamesById;
1316
+ }
1317
+ }
1318
+ exports.TableCore = TableCore;