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