@airtable/blocks 0.0.0-experimental-d5ee5e823-20250501 → 0.0.0-experimental-15dc8a3ea-20250616

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/dist/cjs/base/models/linked_records_query_result.js +2 -2
  2. package/dist/cjs/base/models/models.js +5 -5
  3. package/dist/cjs/base/models/mutations.js +86 -264
  4. package/dist/cjs/base/models/record_query_result.js +5 -5
  5. package/dist/cjs/base/models/table.js +1 -1070
  6. package/dist/cjs/base/types/field.js +1 -0
  7. package/dist/cjs/base/types/mutations.js +0 -27
  8. package/dist/cjs/base/ui/cell_renderer.js +2 -2
  9. package/dist/cjs/base/ui/field_picker.js +2 -2
  10. package/dist/cjs/base/ui/initialize_block.js +2 -0
  11. package/dist/cjs/base/ui/record_card.js +13 -13
  12. package/dist/cjs/base/ui/select_and_select_buttons_helpers.js +2 -0
  13. package/dist/cjs/base/ui/system/utils/ensure_numbers_are_within_scale.js +2 -0
  14. package/dist/cjs/base/ui/ui.js +8 -0
  15. package/dist/cjs/base/unstable_testing_utils.js +3 -2
  16. package/dist/cjs/interface/models/models.js +5 -5
  17. package/dist/cjs/interface/models/mutations.js +40 -26
  18. package/dist/cjs/interface/models/record.js +27 -2
  19. package/dist/cjs/interface/models/table.js +45 -0
  20. package/dist/cjs/interface/types/airtable_interface.js +1 -0
  21. package/dist/cjs/interface/types/field.js +1 -0
  22. package/dist/cjs/interface/ui/initialize_block.js +2 -0
  23. package/dist/cjs/interface/ui/ui.js +7 -0
  24. package/dist/cjs/shared/models/field_core.js +3 -3
  25. package/dist/cjs/shared/models/mutations_core.js +268 -0
  26. package/dist/cjs/shared/models/record_core.js +4 -4
  27. package/dist/cjs/shared/models/table_core.js +1070 -0
  28. package/dist/cjs/shared/sdk_core.js +1 -1
  29. package/dist/cjs/shared/types/mutations_core.js +28 -1
  30. package/dist/cjs/shared/ui/use_color_scheme.js +60 -0
  31. package/dist/types/src/base/models/base.d.ts +1 -1
  32. package/dist/types/src/base/models/base.d.ts.map +1 -1
  33. package/dist/types/src/base/models/field.d.ts +1 -1
  34. package/dist/types/src/base/models/field.d.ts.map +1 -1
  35. package/dist/types/src/base/models/models.d.ts +1 -1
  36. package/dist/types/src/base/models/models.d.ts.map +1 -1
  37. package/dist/types/src/base/models/mutations.d.ts.map +1 -1
  38. package/dist/types/src/base/models/record.d.ts +5 -1
  39. package/dist/types/src/base/models/record.d.ts.map +1 -1
  40. package/dist/types/src/base/models/table.d.ts +3 -836
  41. package/dist/types/src/base/models/table.d.ts.map +1 -1
  42. package/dist/types/src/base/types/airtable_interface.d.ts +1 -1
  43. package/dist/types/src/base/types/airtable_interface.d.ts.map +1 -1
  44. package/dist/types/src/base/types/base.d.ts +5 -2
  45. package/dist/types/src/base/types/base.d.ts.map +1 -1
  46. package/dist/types/src/base/types/field.d.ts +8 -0
  47. package/dist/types/src/base/types/field.d.ts.map +1 -0
  48. package/dist/types/src/base/types/mutations.d.ts +7 -90
  49. package/dist/types/src/base/types/mutations.d.ts.map +1 -1
  50. package/dist/types/src/base/types/table.d.ts +8 -2
  51. package/dist/types/src/base/types/table.d.ts.map +1 -1
  52. package/dist/types/src/base/ui/field_picker.d.ts +1 -1
  53. package/dist/types/src/base/ui/field_picker.d.ts.map +1 -1
  54. package/dist/types/src/base/ui/initialize_block.d.ts.map +1 -1
  55. package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
  56. package/dist/types/src/base/ui/ui.d.ts +1 -0
  57. package/dist/types/src/base/ui/ui.d.ts.map +1 -1
  58. package/dist/types/src/base/unstable_testing_utils.d.ts +2 -1
  59. package/dist/types/src/base/unstable_testing_utils.d.ts.map +1 -1
  60. package/dist/types/src/interface/models/models.d.ts +1 -1
  61. package/dist/types/src/interface/models/models.d.ts.map +1 -1
  62. package/dist/types/src/interface/models/mutations.d.ts.map +1 -1
  63. package/dist/types/src/interface/models/record.d.ts +17 -0
  64. package/dist/types/src/interface/models/record.d.ts.map +1 -1
  65. package/dist/types/src/interface/models/table.d.ts +30 -0
  66. package/dist/types/src/interface/models/table.d.ts.map +1 -1
  67. package/dist/types/src/interface/types/airtable_interface.d.ts +12 -2
  68. package/dist/types/src/interface/types/airtable_interface.d.ts.map +1 -1
  69. package/dist/types/src/interface/types/base.d.ts +5 -2
  70. package/dist/types/src/interface/types/base.d.ts.map +1 -1
  71. package/dist/types/src/interface/types/field.d.ts +10 -0
  72. package/dist/types/src/interface/types/field.d.ts.map +1 -0
  73. package/dist/types/src/interface/types/mutations.d.ts +3 -0
  74. package/dist/types/src/interface/types/mutations.d.ts.map +1 -1
  75. package/dist/types/src/interface/types/table.d.ts +15 -2
  76. package/dist/types/src/interface/types/table.d.ts.map +1 -1
  77. package/dist/types/src/interface/ui/initialize_block.d.ts.map +1 -1
  78. package/dist/types/src/interface/ui/ui.d.ts +1 -0
  79. package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
  80. package/dist/types/src/sdk_mode.d.ts +8 -2
  81. package/dist/types/src/sdk_mode.d.ts.map +1 -1
  82. package/dist/types/src/shared/models/field_core.d.ts +2 -2
  83. package/dist/types/src/shared/models/field_core.d.ts.map +1 -1
  84. package/dist/types/src/shared/models/mutations_core.d.ts.map +1 -1
  85. package/dist/types/src/shared/models/table_core.d.ts +835 -2
  86. package/dist/types/src/shared/models/table_core.d.ts.map +1 -1
  87. package/dist/types/src/shared/types/airtable_interface_core.d.ts +9 -9
  88. package/dist/types/src/shared/types/airtable_interface_core.d.ts.map +1 -1
  89. package/dist/types/src/shared/types/base_core.d.ts +3 -3
  90. package/dist/types/src/shared/types/base_core.d.ts.map +1 -1
  91. package/dist/types/src/shared/types/{field.d.ts → field_core.d.ts} +3 -3
  92. package/dist/types/src/shared/types/field_core.d.ts.map +1 -0
  93. package/dist/types/src/shared/types/mutations_core.d.ts +90 -2
  94. package/dist/types/src/shared/types/mutations_core.d.ts.map +1 -1
  95. package/dist/types/src/shared/types/table_core.d.ts +3 -8
  96. package/dist/types/src/shared/types/table_core.d.ts.map +1 -1
  97. package/dist/types/src/shared/ui/use_color_scheme.d.ts +28 -0
  98. package/dist/types/src/shared/ui/use_color_scheme.d.ts.map +1 -0
  99. package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts +1 -1
  100. package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +1 -1
  101. package/package.json +2 -16
  102. package/dist/types/src/shared/types/field.d.ts.map +0 -1
  103. package/dist/types/stories/all_controls.stories.d.ts +0 -10
  104. package/dist/types/stories/all_controls.stories.d.ts.map +0 -1
  105. package/dist/types/stories/box/appearance.stories.d.ts +0 -21
  106. package/dist/types/stories/box/appearance.stories.d.ts.map +0 -1
  107. package/dist/types/stories/box/box.stories.d.ts +0 -45
  108. package/dist/types/stories/box/box.stories.d.ts.map +0 -1
  109. package/dist/types/stories/box/dimensions.stories.d.ts +0 -24
  110. package/dist/types/stories/box/dimensions.stories.d.ts.map +0 -1
  111. package/dist/types/stories/box/flex_container.stories.d.ts +0 -24
  112. package/dist/types/stories/box/flex_container.stories.d.ts.map +0 -1
  113. package/dist/types/stories/box/flex_item.stories.d.ts +0 -25
  114. package/dist/types/stories/box/flex_item.stories.d.ts.map +0 -1
  115. package/dist/types/stories/box/position.stories.d.ts +0 -25
  116. package/dist/types/stories/box/position.stories.d.ts.map +0 -1
  117. package/dist/types/stories/box/spacing.stories.d.ts +0 -39
  118. package/dist/types/stories/box/spacing.stories.d.ts.map +0 -1
  119. package/dist/types/stories/box/typography.stories.d.ts +0 -33
  120. package/dist/types/stories/box/typography.stories.d.ts.map +0 -1
  121. package/dist/types/stories/button.stories.d.ts +0 -48
  122. package/dist/types/stories/button.stories.d.ts.map +0 -1
  123. package/dist/types/stories/cell_renderer.stories.d.ts +0 -11
  124. package/dist/types/stories/cell_renderer.stories.d.ts.map +0 -1
  125. package/dist/types/stories/choice_token.stories.d.ts +0 -24
  126. package/dist/types/stories/choice_token.stories.d.ts.map +0 -1
  127. package/dist/types/stories/collaborator_token.stories.d.ts +0 -29
  128. package/dist/types/stories/collaborator_token.stories.d.ts.map +0 -1
  129. package/dist/types/stories/color_palette.stories.d.ts +0 -12
  130. package/dist/types/stories/color_palette.stories.d.ts.map +0 -1
  131. package/dist/types/stories/confirmation_dialog.stories.d.ts +0 -10
  132. package/dist/types/stories/confirmation_dialog.stories.d.ts.map +0 -1
  133. package/dist/types/stories/dialog.stories.d.ts +0 -10
  134. package/dist/types/stories/dialog.stories.d.ts.map +0 -1
  135. package/dist/types/stories/field_icon.stories.d.ts +0 -10
  136. package/dist/types/stories/field_icon.stories.d.ts.map +0 -1
  137. package/dist/types/stories/field_picker.stories.d.ts +0 -12
  138. package/dist/types/stories/field_picker.stories.d.ts.map +0 -1
  139. package/dist/types/stories/form_field.stories.d.ts +0 -33
  140. package/dist/types/stories/form_field.stories.d.ts.map +0 -1
  141. package/dist/types/stories/heading.size.stories.d.ts +0 -19
  142. package/dist/types/stories/heading.size.stories.d.ts.map +0 -1
  143. package/dist/types/stories/heading.stories.d.ts +0 -33
  144. package/dist/types/stories/heading.stories.d.ts.map +0 -1
  145. package/dist/types/stories/helpers/attachments.d.ts +0 -4
  146. package/dist/types/stories/helpers/attachments.d.ts.map +0 -1
  147. package/dist/types/stories/helpers/categorize_style_props.d.ts +0 -14
  148. package/dist/types/stories/helpers/categorize_style_props.d.ts.map +0 -1
  149. package/dist/types/stories/helpers/choice_options.d.ts +0 -7
  150. package/dist/types/stories/helpers/choice_options.d.ts.map +0 -1
  151. package/dist/types/stories/helpers/code_block.d.ts +0 -5
  152. package/dist/types/stories/helpers/code_block.d.ts.map +0 -1
  153. package/dist/types/stories/helpers/code_utils.d.ts +0 -32
  154. package/dist/types/stories/helpers/code_utils.d.ts.map +0 -1
  155. package/dist/types/stories/helpers/collaborator_options.d.ts +0 -7
  156. package/dist/types/stories/helpers/collaborator_options.d.ts.map +0 -1
  157. package/dist/types/stories/helpers/example.d.ts +0 -39
  158. package/dist/types/stories/helpers/example.d.ts.map +0 -1
  159. package/dist/types/stories/helpers/example_code_panel.d.ts +0 -10
  160. package/dist/types/stories/helpers/example_code_panel.d.ts.map +0 -1
  161. package/dist/types/stories/helpers/fake_cell_renderer.d.ts +0 -7
  162. package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +0 -1
  163. package/dist/types/stories/helpers/fake_foreign_record.d.ts +0 -5
  164. package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +0 -1
  165. package/dist/types/stories/helpers/fake_record_card.d.ts +0 -13
  166. package/dist/types/stories/helpers/fake_record_card.d.ts.map +0 -1
  167. package/dist/types/stories/helpers/field_type.d.ts +0 -6
  168. package/dist/types/stories/helpers/field_type.d.ts.map +0 -1
  169. package/dist/types/stories/helpers/raf_throttle.d.ts +0 -5
  170. package/dist/types/stories/helpers/raf_throttle.d.ts.map +0 -1
  171. package/dist/types/stories/helpers/style_prop_list.d.ts +0 -9
  172. package/dist/types/stories/helpers/style_prop_list.d.ts.map +0 -1
  173. package/dist/types/stories/helpers/sync_source_options.d.ts +0 -7
  174. package/dist/types/stories/helpers/sync_source_options.d.ts.map +0 -1
  175. package/dist/types/stories/helpers/use_resizable_panel.d.ts +0 -27
  176. package/dist/types/stories/helpers/use_resizable_panel.d.ts.map +0 -1
  177. package/dist/types/stories/icon.stories.d.ts +0 -18
  178. package/dist/types/stories/icon.stories.d.ts.map +0 -1
  179. package/dist/types/stories/icon_example.d.ts +0 -3
  180. package/dist/types/stories/icon_example.d.ts.map +0 -1
  181. package/dist/types/stories/input.stories.d.ts +0 -27
  182. package/dist/types/stories/input.stories.d.ts.map +0 -1
  183. package/dist/types/stories/label.stories.d.ts +0 -36
  184. package/dist/types/stories/label.stories.d.ts.map +0 -1
  185. package/dist/types/stories/link.stories.d.ts +0 -45
  186. package/dist/types/stories/link.stories.d.ts.map +0 -1
  187. package/dist/types/stories/loader.stories.d.ts +0 -21
  188. package/dist/types/stories/loader.stories.d.ts.map +0 -1
  189. package/dist/types/stories/progress_bar.stories.d.ts +0 -27
  190. package/dist/types/stories/progress_bar.stories.d.ts.map +0 -1
  191. package/dist/types/stories/record_card.stories.d.ts +0 -9
  192. package/dist/types/stories/record_card.stories.d.ts.map +0 -1
  193. package/dist/types/stories/record_card_list.stories.d.ts +0 -9
  194. package/dist/types/stories/record_card_list.stories.d.ts.map +0 -1
  195. package/dist/types/stories/select.stories.d.ts +0 -30
  196. package/dist/types/stories/select.stories.d.ts.map +0 -1
  197. package/dist/types/stories/select_buttons.stories.d.ts +0 -30
  198. package/dist/types/stories/select_buttons.stories.d.ts.map +0 -1
  199. package/dist/types/stories/switch.stories.d.ts +0 -48
  200. package/dist/types/stories/switch.stories.d.ts.map +0 -1
  201. package/dist/types/stories/table_picker.stories.d.ts +0 -12
  202. package/dist/types/stories/table_picker.stories.d.ts.map +0 -1
  203. package/dist/types/stories/text.size.stories.d.ts +0 -16
  204. package/dist/types/stories/text.size.stories.d.ts.map +0 -1
  205. package/dist/types/stories/text.stories.d.ts +0 -36
  206. package/dist/types/stories/text.stories.d.ts.map +0 -1
  207. package/dist/types/stories/text_button.stories.d.ts +0 -45
  208. package/dist/types/stories/text_button.stories.d.ts.map +0 -1
  209. package/dist/types/stories/tooltip.stories.d.ts +0 -10
  210. package/dist/types/stories/tooltip.stories.d.ts.map +0 -1
  211. package/dist/types/stories/view_picker.stories.d.ts +0 -12
  212. package/dist/types/stories/view_picker.stories.d.ts.map +0 -1
  213. package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts +0 -122
  214. package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts.map +0 -1
  215. package/dist/types/test/airtable_interface_mocks/linked_records.d.ts +0 -4
  216. package/dist/types/test/airtable_interface_mocks/linked_records.d.ts.map +0 -1
  217. package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -60
  218. package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +0 -1
  219. package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts +0 -4
  220. package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts.map +0 -1
  221. package/dist/types/test/error_utils.test.d.ts +0 -2
  222. package/dist/types/test/error_utils.test.d.ts.map +0 -1
  223. package/dist/types/test/get_style_props_for_responsive_prop.test.d.ts +0 -2
  224. package/dist/types/test/get_style_props_for_responsive_prop.test.d.ts.map +0 -1
  225. package/dist/types/test/index.test.d.ts +0 -2
  226. package/dist/types/test/index.test.d.ts.map +0 -1
  227. package/dist/types/test/models/base.test.d.ts +0 -2
  228. package/dist/types/test/models/base.test.d.ts.map +0 -1
  229. package/dist/types/test/models/cursor.test.d.ts +0 -2
  230. package/dist/types/test/models/cursor.test.d.ts.map +0 -1
  231. package/dist/types/test/models/field.test.d.ts +0 -2
  232. package/dist/types/test/models/field.test.d.ts.map +0 -1
  233. package/dist/types/test/models/linked_records_query_result.test.d.ts +0 -2
  234. package/dist/types/test/models/linked_records_query_result.test.d.ts.map +0 -1
  235. package/dist/types/test/models/mutations.test.d.ts +0 -2
  236. package/dist/types/test/models/mutations.test.d.ts.map +0 -1
  237. package/dist/types/test/models/object_pool.test.d.ts +0 -2
  238. package/dist/types/test/models/object_pool.test.d.ts.map +0 -1
  239. package/dist/types/test/models/record.test.d.ts +0 -2
  240. package/dist/types/test/models/record.test.d.ts.map +0 -1
  241. package/dist/types/test/models/session.test.d.ts +0 -2
  242. package/dist/types/test/models/session.test.d.ts.map +0 -1
  243. package/dist/types/test/models/table.test.d.ts +0 -2
  244. package/dist/types/test/models/table.test.d.ts.map +0 -1
  245. package/dist/types/test/models/table_mutations.test.d.ts +0 -2
  246. package/dist/types/test/models/table_mutations.test.d.ts.map +0 -1
  247. package/dist/types/test/models/table_or_view_query_result.test.d.ts +0 -2
  248. package/dist/types/test/models/table_or_view_query_result.test.d.ts.map +0 -1
  249. package/dist/types/test/models/view.test.d.ts +0 -2
  250. package/dist/types/test/models/view.test.d.ts.map +0 -1
  251. package/dist/types/test/models/view_metadata_query_result.test.d.ts +0 -2
  252. package/dist/types/test/models/view_metadata_query_result.test.d.ts.map +0 -1
  253. package/dist/types/test/private_utils.test.d.ts +0 -2
  254. package/dist/types/test/private_utils.test.d.ts.map +0 -1
  255. package/dist/types/test/sdk.test.d.ts +0 -2
  256. package/dist/types/test/sdk.test.d.ts.map +0 -1
  257. package/dist/types/test/setup_enzyme.d.ts +0 -2
  258. package/dist/types/test/setup_enzyme.d.ts.map +0 -1
  259. package/dist/types/test/test_helpers.d.ts +0 -11
  260. package/dist/types/test/test_helpers.d.ts.map +0 -1
  261. package/dist/types/test/ui/base_provider.test.d.ts +0 -2
  262. package/dist/types/test/ui/base_provider.test.d.ts.map +0 -1
  263. package/dist/types/test/ui/block_wrapper.test.d.ts +0 -2
  264. package/dist/types/test/ui/block_wrapper.test.d.ts.map +0 -1
  265. package/dist/types/test/ui/box.test.d.ts +0 -2
  266. package/dist/types/test/ui/box.test.d.ts.map +0 -1
  267. package/dist/types/test/ui/button.test.d.ts +0 -2
  268. package/dist/types/test/ui/button.test.d.ts.map +0 -1
  269. package/dist/types/test/ui/cell_renderer.test.d.ts +0 -2
  270. package/dist/types/test/ui/cell_renderer.test.d.ts.map +0 -1
  271. package/dist/types/test/ui/choice_token.test.d.ts +0 -2
  272. package/dist/types/test/ui/choice_token.test.d.ts.map +0 -1
  273. package/dist/types/test/ui/collaborator_token.test.d.ts +0 -2
  274. package/dist/types/test/ui/collaborator_token.test.d.ts.map +0 -1
  275. package/dist/types/test/ui/color_palette.test.d.ts +0 -2
  276. package/dist/types/test/ui/color_palette.test.d.ts.map +0 -1
  277. package/dist/types/test/ui/color_palette_synced.test.d.ts +0 -2
  278. package/dist/types/test/ui/color_palette_synced.test.d.ts.map +0 -1
  279. package/dist/types/test/ui/confirmation_dialog.test.d.ts +0 -2
  280. package/dist/types/test/ui/confirmation_dialog.test.d.ts.map +0 -1
  281. package/dist/types/test/ui/dialog.test.d.ts +0 -2
  282. package/dist/types/test/ui/dialog.test.d.ts.map +0 -1
  283. package/dist/types/test/ui/expand_record.test.d.ts +0 -2
  284. package/dist/types/test/ui/expand_record.test.d.ts.map +0 -1
  285. package/dist/types/test/ui/expand_record_list.test.d.ts +0 -2
  286. package/dist/types/test/ui/expand_record_list.test.d.ts.map +0 -1
  287. package/dist/types/test/ui/expand_record_picker_async.test.d.ts +0 -2
  288. package/dist/types/test/ui/expand_record_picker_async.test.d.ts.map +0 -1
  289. package/dist/types/test/ui/field_icon.test.d.ts +0 -2
  290. package/dist/types/test/ui/field_icon.test.d.ts.map +0 -1
  291. package/dist/types/test/ui/field_picker.test.d.ts +0 -2
  292. package/dist/types/test/ui/field_picker.test.d.ts.map +0 -1
  293. package/dist/types/test/ui/field_picker_synced.test.d.ts +0 -2
  294. package/dist/types/test/ui/field_picker_synced.test.d.ts.map +0 -1
  295. package/dist/types/test/ui/form_field.test.d.ts +0 -2
  296. package/dist/types/test/ui/form_field.test.d.ts.map +0 -1
  297. package/dist/types/test/ui/global_alert.test.d.ts +0 -2
  298. package/dist/types/test/ui/global_alert.test.d.ts.map +0 -1
  299. package/dist/types/test/ui/heading.test.d.ts +0 -2
  300. package/dist/types/test/ui/heading.test.d.ts.map +0 -1
  301. package/dist/types/test/ui/icon.test.d.ts +0 -2
  302. package/dist/types/test/ui/icon.test.d.ts.map +0 -1
  303. package/dist/types/test/ui/initialize_block.test.d.ts +0 -2
  304. package/dist/types/test/ui/initialize_block.test.d.ts.map +0 -1
  305. package/dist/types/test/ui/input.test.d.ts +0 -2
  306. package/dist/types/test/ui/input.test.d.ts.map +0 -1
  307. package/dist/types/test/ui/input_synced.test.d.ts +0 -2
  308. package/dist/types/test/ui/input_synced.test.d.ts.map +0 -1
  309. package/dist/types/test/ui/label.test.d.ts +0 -2
  310. package/dist/types/test/ui/label.test.d.ts.map +0 -1
  311. package/dist/types/test/ui/link.test.d.ts +0 -2
  312. package/dist/types/test/ui/link.test.d.ts.map +0 -1
  313. package/dist/types/test/ui/loader.test.d.ts +0 -2
  314. package/dist/types/test/ui/loader.test.d.ts.map +0 -1
  315. package/dist/types/test/ui/modal.test.d.ts +0 -2
  316. package/dist/types/test/ui/modal.test.d.ts.map +0 -1
  317. package/dist/types/test/ui/popover.test.d.ts +0 -2
  318. package/dist/types/test/ui/popover.test.d.ts.map +0 -1
  319. package/dist/types/test/ui/progress_bar.test.d.ts +0 -2
  320. package/dist/types/test/ui/progress_bar.test.d.ts.map +0 -1
  321. package/dist/types/test/ui/record_card.test.d.ts +0 -2
  322. package/dist/types/test/ui/record_card.test.d.ts.map +0 -1
  323. package/dist/types/test/ui/record_card_list.test.d.ts +0 -2
  324. package/dist/types/test/ui/record_card_list.test.d.ts.map +0 -1
  325. package/dist/types/test/ui/remote_utils.test.d.ts +0 -2
  326. package/dist/types/test/ui/remote_utils.test.d.ts.map +0 -1
  327. package/dist/types/test/ui/select.test.d.ts +0 -2
  328. package/dist/types/test/ui/select.test.d.ts.map +0 -1
  329. package/dist/types/test/ui/select_buttons.test.d.ts +0 -2
  330. package/dist/types/test/ui/select_buttons.test.d.ts.map +0 -1
  331. package/dist/types/test/ui/select_buttons_synced.test.d.ts +0 -2
  332. package/dist/types/test/ui/select_buttons_synced.test.d.ts.map +0 -1
  333. package/dist/types/test/ui/select_synced.test.d.ts +0 -2
  334. package/dist/types/test/ui/select_synced.test.d.ts.map +0 -1
  335. package/dist/types/test/ui/switch.test.d.ts +0 -2
  336. package/dist/types/test/ui/switch.test.d.ts.map +0 -1
  337. package/dist/types/test/ui/switch_synced.test.d.ts +0 -2
  338. package/dist/types/test/ui/switch_synced.test.d.ts.map +0 -1
  339. package/dist/types/test/ui/synced.test.d.ts +0 -2
  340. package/dist/types/test/ui/synced.test.d.ts.map +0 -1
  341. package/dist/types/test/ui/table_picker.test.d.ts +0 -2
  342. package/dist/types/test/ui/table_picker.test.d.ts.map +0 -1
  343. package/dist/types/test/ui/table_picker_synced.test.d.ts +0 -2
  344. package/dist/types/test/ui/table_picker_synced.test.d.ts.map +0 -1
  345. package/dist/types/test/ui/text.test.d.ts +0 -2
  346. package/dist/types/test/ui/text.test.d.ts.map +0 -1
  347. package/dist/types/test/ui/text_button.test.d.ts +0 -2
  348. package/dist/types/test/ui/text_button.test.d.ts.map +0 -1
  349. package/dist/types/test/ui/tooltip.test.d.ts +0 -2
  350. package/dist/types/test/ui/tooltip.test.d.ts.map +0 -1
  351. package/dist/types/test/ui/ui.test.d.ts +0 -2
  352. package/dist/types/test/ui/ui.test.d.ts.map +0 -1
  353. package/dist/types/test/ui/unstable_standalone_ui.test.d.ts +0 -1
  354. package/dist/types/test/ui/unstable_standalone_ui.test.d.ts.map +0 -1
  355. package/dist/types/test/ui/use_array_identity.test.d.ts +0 -2
  356. package/dist/types/test/ui/use_array_identity.test.d.ts.map +0 -1
  357. package/dist/types/test/ui/use_loadable.test.d.ts +0 -2
  358. package/dist/types/test/ui/use_loadable.test.d.ts.map +0 -1
  359. package/dist/types/test/ui/use_record_action_data.test.d.ts +0 -2
  360. package/dist/types/test/ui/use_record_action_data.test.d.ts.map +0 -1
  361. package/dist/types/test/ui/use_records.test.d.ts +0 -2
  362. package/dist/types/test/ui/use_records.test.d.ts.map +0 -1
  363. package/dist/types/test/ui/use_view_metadata.test.d.ts +0 -2
  364. package/dist/types/test/ui/use_view_metadata.test.d.ts.map +0 -1
  365. package/dist/types/test/ui/use_watchable.test.d.ts +0 -2
  366. package/dist/types/test/ui/use_watchable.test.d.ts.map +0 -1
  367. package/dist/types/test/ui/view_picker.test.d.ts +0 -2
  368. package/dist/types/test/ui/view_picker.test.d.ts.map +0 -1
  369. package/dist/types/test/ui/view_picker_synced.test.d.ts +0 -2
  370. package/dist/types/test/ui/view_picker_synced.test.d.ts.map +0 -1
  371. package/dist/types/test/ui/viewport_constraint.test.d.ts +0 -2
  372. package/dist/types/test/ui/viewport_constraint.test.d.ts.map +0 -1
  373. package/dist/types/test/unstable_private_utils.test.d.ts +0 -1
  374. package/dist/types/test/unstable_private_utils.test.d.ts.map +0 -1
  375. /package/dist/cjs/shared/types/{field.js → field_core.js} +0 -0
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", {
17
17
  exports.default = exports.WatchableTableKeys = void 0;
18
18
  require("core-js/modules/es.array.find.js");
19
19
  require("core-js/modules/es.array.includes.js");
20
- require("core-js/modules/es.array.map.js");
21
20
  require("core-js/modules/es.object.to-string.js");
22
21
  require("core-js/modules/es.string.includes.js");
23
22
  require("core-js/modules/web.dom-collections.for-each.js");
@@ -599,1075 +598,7 @@ var Table = /*#__PURE__*/function (_TableCore) {
599
598
  return _createFieldAsync.apply(this, arguments);
600
599
  }
601
600
  return createFieldAsync;
602
- }()
603
- /**
604
- * Updates cell values for a record.
605
- *
606
- * Throws an error if the user does not have permission to update the given cell values in
607
- * the record, or if invalid input is provided (eg. invalid cell values).
608
- *
609
- * Refer to {@link FieldType} for cell value write formats.
610
- *
611
- * This action is asynchronous: `await` the returned promise if you wish to wait for the updated
612
- * cell values to be persisted to Airtable servers.
613
- * Updates are applied optimistically locally, so your changes will be reflected in your extension
614
- * before the promise resolves.
615
- *
616
- * @param recordOrRecordId the record to update
617
- * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
618
- * @example
619
- * ```js
620
- * function updateRecord(record, recordFields) {
621
- * if (table.hasPermissionToUpdateRecord(record, recordFields)) {
622
- * table.updateRecordAsync(record, recordFields);
623
- * }
624
- * // The updated values will now show in your extension (eg in
625
- * // `table.selectRecords()` result) but are still being saved to Airtable
626
- * // servers (e.g. other users may not be able to see them yet).
627
- * }
628
- *
629
- * async function updateRecordAsync(record, recordFields) {
630
- * if (table.hasPermissionToUpdateRecord(record, recordFields)) {
631
- * await table.updateRecordAsync(record, recordFields);
632
- * }
633
- * // New record has been saved to Airtable servers.
634
- * alert(`record with ID ${record.id} has been updated`);
635
- * }
636
- *
637
- * // Fields can be specified by name or ID
638
- * updateRecord(record1, {
639
- * 'Post Title': 'How to make: orange-mango pound cake',
640
- * 'Publication Date': '2020-01-01',
641
- * });
642
- * updateRecord(record2, {
643
- * [postTitleField.id]: 'Cake decorating tips & tricks',
644
- * [publicationDateField.id]: '2020-02-02',
645
- * });
646
- *
647
- * // Cell values should generally have format matching the output of
648
- * // record.getCellValue() for the field being updated
649
- * updateRecord(record1, {
650
- * 'Category (single select)': {name: 'Recipe'},
651
- * 'Tags (multiple select)': [{name: 'Desserts'}, {id: 'someChoiceId'}],
652
- * 'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
653
- * 'Related posts (linked records)': [{id: 'someRecordId'}],
654
- * });
655
- * ```
656
- */
657
- )
658
- }, {
659
- key: "updateRecordAsync",
660
- value: (function () {
661
- var _updateRecordAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(recordOrRecordId, fields) {
662
- var recordId;
663
- return _regenerator.default.wrap(function _callee4$(_context4) {
664
- while (1) switch (_context4.prev = _context4.next) {
665
- case 0:
666
- recordId = typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id;
667
- _context4.next = 3;
668
- return this.updateRecordsAsync([{
669
- id: recordId,
670
- fields
671
- }]);
672
- case 3:
673
- case "end":
674
- return _context4.stop();
675
- }
676
- }, _callee4, this);
677
- }));
678
- function updateRecordAsync(_x7, _x8) {
679
- return _updateRecordAsync.apply(this, arguments);
680
- }
681
- return updateRecordAsync;
682
- }()
683
- /**
684
- * Checks whether the current user has permission to perform the given record update.
685
- *
686
- * Accepts partial input, in the same format as {@link updateRecordAsync}.
687
- * The more information provided, the more accurate the permissions check will be.
688
- *
689
- * Returns `{hasPermission: true}` if the current user can update the specified record,
690
- * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
691
- * used to display an error message to the user.
692
- *
693
- * @param recordOrRecordId the record to update
694
- * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
695
- * @example
696
- * ```js
697
- * // Check if user can update specific fields for a specific record.
698
- * const updateRecordCheckResult =
699
- * table.checkPermissionsForUpdateRecord(record, {
700
- * 'Post Title': 'How to make: orange-mango pound cake',
701
- * 'Publication Date': '2020-01-01',
702
- * });
703
- * if (!updateRecordCheckResult.hasPermission) {
704
- * alert(updateRecordCheckResult.reasonDisplayString);
705
- * }
706
- *
707
- * // Like updateRecordAsync, you can use either field names or field IDs.
708
- * const updateRecordCheckResultWithFieldIds =
709
- * table.checkPermissionsForUpdateRecord(record, {
710
- * [postTitleField.id]: 'Cake decorating tips & tricks',
711
- * [publicationDateField.id]: '2020-02-02',
712
- * });
713
- *
714
- * // Check if user could update a given record, when you don't know the
715
- * // specific fields that will be updated yet (e.g. to check whether you should
716
- * // allow a user to select a certain record to update).
717
- * const updateUnknownFieldsCheckResult =
718
- * table.checkPermissionsForUpdateRecord(record);
719
- *
720
- * // Check if user could update specific fields, when you don't know the
721
- * // specific record that will be updated yet. (for example, if the field is
722
- * // selected by the user and you want to check if your extension can write to it).
723
- * const updateUnknownRecordCheckResult =
724
- * table.checkPermissionsForUpdateRecord(undefined, {
725
- * 'My field name': 'updated value',
726
- * // You can use undefined if you know you're going to update a field,
727
- * // but don't know the new cell value yet.
728
- * 'Another field name': undefined,
729
- * });
730
- *
731
- * // Check if user could perform updates within the table, without knowing the
732
- * // specific record or fields that will be updated yet (e.g., to render your
733
- * // extension in "read only" mode).
734
- * const updateUnknownRecordAndFieldsCheckResult =
735
- * table.checkPermissionsForUpdateRecord();
736
- * ```
737
- */
738
- )
739
- }, {
740
- key: "checkPermissionsForUpdateRecord",
741
- value: function checkPermissionsForUpdateRecord(recordOrRecordId, fields) {
742
- var recordId = typeof recordOrRecordId === 'object' && recordOrRecordId !== null ? recordOrRecordId.id : recordOrRecordId;
743
- return this.checkPermissionsForUpdateRecords([{
744
- id: recordId,
745
- fields
746
- }]);
747
- }
748
- /**
749
- * An alias for `checkPermissionsForUpdateRecord(recordOrRecordId, fields).hasPermission`.
750
- *
751
- * Checks whether the current user has permission to perform the given record update.
752
- *
753
- * Accepts partial input, in the same format as {@link updateRecordAsync}.
754
- * The more information provided, the more accurate the permissions check will be.
755
- *
756
- * @param recordOrRecordId the record to update
757
- * @param fields cell values to update in that record, specified as object mapping `FieldId` or field name to value for that field.
758
- * @example
759
- * ```js
760
- * // Check if user can update specific fields for a specific record.
761
- * const canUpdateRecord = table.hasPermissionToUpdateRecord(record, {
762
- * 'Post Title': 'How to make: orange-mango pound cake',
763
- * 'Publication Date': '2020-01-01',
764
- * });
765
- * if (!canUpdateRecord) {
766
- * alert('not allowed!');
767
- * }
768
- *
769
- * // Like updateRecordAsync, you can use either field names or field IDs.
770
- * const canUpdateRecordWithFieldIds =
771
- * table.hasPermissionToUpdateRecord(record, {
772
- * [postTitleField.id]: 'Cake decorating tips & tricks',
773
- * [publicationDateField.id]: '2020-02-02',
774
- * });
775
- *
776
- * // Check if user could update a given record, when you don't know the
777
- * // specific fields that will be updated yet (e.g. to check whether you should
778
- * // allow a user to select a certain record to update).
779
- * const canUpdateUnknownFields = table.hasPermissionToUpdateRecord(record);
780
- *
781
- * // Check if user could update specific fields, when you don't know the
782
- * // specific record that will be updated yet (e.g. if the field is selected
783
- * // by the user and you want to check if your extension can write to it).
784
- * const canUpdateUnknownRecord =
785
- * table.hasPermissionToUpdateRecord(undefined, {
786
- * 'My field name': 'updated value',
787
- * // You can use undefined if you know you're going to update a field,
788
- * // but don't know the new cell value yet.
789
- * 'Another field name': undefined,
790
- * });
791
- *
792
- * // Check if user could perform updates within the table, without knowing the
793
- * // specific record or fields that will be updated yet. (for example, to
794
- * // render your extension in "read only" mode)
795
- * const canUpdateUnknownRecordAndFields = table.hasPermissionToUpdateRecord();
796
- * ```
797
- */
798
- }, {
799
- key: "hasPermissionToUpdateRecord",
800
- value: function hasPermissionToUpdateRecord(recordOrRecordId, fields) {
801
- return this.checkPermissionsForUpdateRecord(recordOrRecordId, fields).hasPermission;
802
- }
803
- /**
804
- * Updates cell values for records.
805
- *
806
- * Throws an error if the user does not have permission to update the given cell values in
807
- * the records, or if invalid input is provided (eg. invalid cell values).
808
- *
809
- * Refer to {@link FieldType} for cell value write formats.
810
- *
811
- * You may only update up to 50 records in one call to `updateRecordsAsync`.
812
- * See [Write back to Airtable](/guides/write-back-to-airtable) for more information
813
- * about write limits.
814
- *
815
- * This action is asynchronous: `await` the returned promise if you wish to wait for the
816
- * updates to be persisted to Airtable servers.
817
- * Updates are applied optimistically locally, so your changes will be reflected in your extension
818
- * before the promise resolves.
819
- *
820
- * @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)
821
- * @example
822
- * ```js
823
- * const recordsToUpdate = [
824
- * // Fields can be specified by name or ID
825
- * {
826
- * id: record1.id,
827
- * fields: {
828
- * 'Post Title': 'How to make: orange-mango pound cake',
829
- * 'Publication Date': '2020-01-01',
830
- * },
831
- * },
832
- * {
833
- * id: record2.id,
834
- * fields: {
835
- * // Sets the cell values to be empty.
836
- * 'Post Title': '',
837
- * 'Publication Date': '',
838
- * },
839
- * },
840
- * {
841
- * id: record3.id,
842
- * fields: {
843
- * [postTitleField.id]: 'Cake decorating tips & tricks',
844
- * [publicationDateField.id]: '2020-02-02',
845
- * },
846
- * },
847
- * // Cell values should generally have format matching the output of
848
- * // record.getCellValue() for the field being updated
849
- * {
850
- * id: record4.id,
851
- * fields: {
852
- * 'Category (single select)': {name: 'Recipe'},
853
- * 'Tags (multiple select)': [{name: 'Desserts'}, {id: 'choiceId'}],
854
- * 'Images (attachment)': [{url: 'http://mywebsite.com/cake.png'}],
855
- * 'Related posts (linked records)': [{id: 'someRecordId'}],
856
- * },
857
- * },
858
- * ];
859
- *
860
- * function updateRecords() {
861
- * if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
862
- * table.updateRecordsAsync(recordsToUpdate);
863
- * }
864
- * // The records are now updated within your extension (eg will be reflected in
865
- * // `table.selectRecords()`) but are still being saved to Airtable servers
866
- * // (e.g. they may not be updated for other users yet).
867
- * }
868
- *
869
- * async function updateRecordsAsync() {
870
- * if (table.hasPermissionToUpdateRecords(recordsToUpdate)) {
871
- * await table.updateRecordsAsync(recordsToUpdate);
872
- * }
873
- * // Record updates have been saved to Airtable servers.
874
- * alert('records have been updated');
875
- * }
876
- * ```
877
- */
878
- }, {
879
- key: "updateRecordsAsync",
880
- value: (function () {
881
- var _updateRecordsAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(records) {
882
- var recordsWithCellValuesByFieldId;
883
- return _regenerator.default.wrap(function _callee5$(_context5) {
884
- while (1) switch (_context5.prev = _context5.next) {
885
- case 0:
886
- recordsWithCellValuesByFieldId = records.map(record => ({
887
- id: record.id,
888
- cellValuesByFieldId: this._cellValuesByFieldIdOrNameToCellValuesByFieldId(record.fields)
889
- }));
890
- _context5.next = 3;
891
- return this._sdk.__mutations.applyMutationAsync({
892
- type: _mutations.MutationTypes.SET_MULTIPLE_RECORDS_CELL_VALUES,
893
- tableId: this.id,
894
- records: recordsWithCellValuesByFieldId,
895
- opts: {
896
- parseDateCellValueInColumnTimeZone: true
897
- }
898
- });
899
- case 3:
900
- case "end":
901
- return _context5.stop();
902
- }
903
- }, _callee5, this);
904
- }));
905
- function updateRecordsAsync(_x9) {
906
- return _updateRecordsAsync.apply(this, arguments);
907
- }
908
- return updateRecordsAsync;
909
- }()
910
- /**
911
- * Checks whether the current user has permission to perform the given record updates.
912
- *
913
- * Accepts partial input, in the same format as {@link updateRecordsAsync}.
914
- * The more information provided, the more accurate the permissions check will be.
915
- *
916
- * Returns `{hasPermission: true}` if the current user can update the specified records,
917
- * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
918
- * used to display an error message to the user.
919
- *
920
- * @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)
921
- * @example
922
- * ```js
923
- * const recordsToUpdate = [
924
- * {
925
- * // Validating a complete record update
926
- * id: record1.id,
927
- * fields: {
928
- * 'Post Title': 'How to make: orange-mango pound cake',
929
- * 'Publication Date': '2020-01-01',
930
- * },
931
- * },
932
- * {
933
- * // Like updateRecordsAsync, fields can be specified by name or ID
934
- * id: record2.id,
935
- * fields: {
936
- * [postTitleField.id]: 'Cake decorating tips & tricks',
937
- * [publicationDateField.id]: '2020-02-02',
938
- * },
939
- * },
940
- * {
941
- * // Validating an update to a specific record, not knowing what
942
- * // fields will be updated
943
- * id: record3.id,
944
- * },
945
- * {
946
- * // Validating an update to specific cell values, not knowing what
947
- * // record will be updated
948
- * fields: {
949
- * 'My field name': 'updated value for unknown record',
950
- * // You can use undefined if you know you're going to update a
951
- * // field, but don't know the new cell value yet.
952
- * 'Another field name': undefined,
953
- * },
954
- * },
955
- * ];
956
- *
957
- * const updateRecordsCheckResult =
958
- * table.checkPermissionsForUpdateRecords(recordsToUpdate);
959
- * if (!updateRecordsCheckResult.hasPermission) {
960
- * alert(updateRecordsCheckResult.reasonDisplayString);
961
- * }
962
- *
963
- * // Check if user could potentially update records.
964
- * // Equivalent to table.checkPermissionsForUpdateRecord()
965
- * const updateUnknownRecordAndFieldsCheckResult =
966
- * table.checkPermissionsForUpdateRecords();
967
- * ```
968
- */
969
- )
970
- }, {
971
- key: "checkPermissionsForUpdateRecords",
972
- value: function checkPermissionsForUpdateRecords(records) {
973
- return this._sdk.__mutations.checkPermissionsForMutation({
974
- type: _mutations.MutationTypes.SET_MULTIPLE_RECORDS_CELL_VALUES,
975
- tableId: this.id,
976
- records: records ? records.map(record => ({
977
- id: record.id || undefined,
978
- cellValuesByFieldId: record.fields ? this._cellValuesByFieldIdOrNameToCellValuesByFieldId(record.fields) : undefined
979
- })) : undefined
980
- });
981
- }
982
- /**
983
- * An alias for `checkPermissionsForUpdateRecords(records).hasPermission`.
984
- *
985
- * Checks whether the current user has permission to perform the given record updates.
986
- *
987
- * Accepts partial input, in the same format as {@link updateRecordsAsync}.
988
- * The more information provided, the more accurate the permissions check will be.
989
- *
990
- * @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)
991
- * @example
992
- * ```js
993
- * const recordsToUpdate = [
994
- * {
995
- * // Validating a complete record update
996
- * id: record1.id,
997
- * fields: {
998
- * 'Post Title': 'How to make: orange-mango pound cake',
999
- * 'Publication Date': '2020-01-01',
1000
- * },
1001
- * },
1002
- * {
1003
- * // Like updateRecordsAsync, fields can be specified by name or ID
1004
- * id: record2.id,
1005
- * fields: {
1006
- * [postTitleField.id]: 'Cake decorating tips & tricks',
1007
- * [publicationDateField.id]: '2020-02-02',
1008
- * },
1009
- * },
1010
- * {
1011
- * // Validating an update to a specific record, not knowing what
1012
- * // fields will be updated
1013
- * id: record3.id,
1014
- * },
1015
- * {
1016
- * // Validating an update to specific cell values, not knowing what
1017
- * // record will be updated
1018
- * fields: {
1019
- * 'My field name': 'updated value for unknown record',
1020
- * // You can use undefined if you know you're going to update a
1021
- * // field, but don't know the new cell value yet.
1022
- * 'Another field name': undefined,
1023
- * },
1024
- * },
1025
- * ];
1026
- *
1027
- * const canUpdateRecords = table.hasPermissionToUpdateRecords(recordsToUpdate);
1028
- * if (!canUpdateRecords) {
1029
- * alert('not allowed');
1030
- * }
1031
- *
1032
- * // Check if user could potentially update records.
1033
- * // Equivalent to table.hasPermissionToUpdateRecord()
1034
- * const canUpdateUnknownRecordsAndFields =
1035
- * table.hasPermissionToUpdateRecords();
1036
- * ```
1037
- */
1038
- }, {
1039
- key: "hasPermissionToUpdateRecords",
1040
- value: function hasPermissionToUpdateRecords(records) {
1041
- return this.checkPermissionsForUpdateRecords(records).hasPermission;
1042
- }
1043
- /**
1044
- * Delete the given record.
1045
- *
1046
- * Throws an error if the user does not have permission to delete the given record.
1047
- *
1048
- * This action is asynchronous: `await` the returned promise if you wish to wait for the
1049
- * delete to be persisted to Airtable servers.
1050
- * Updates are applied optimistically locally, so your changes will be reflected in your extension
1051
- * before the promise resolves.
1052
- *
1053
- * @param recordOrRecordId the record to be deleted
1054
- * @example
1055
- * ```js
1056
- * function deleteRecord(record) {
1057
- * if (table.hasPermissionToDeleteRecord(record)) {
1058
- * table.deleteRecordAsync(record);
1059
- * }
1060
- * // The record is now deleted within your extension (eg will not be returned
1061
- * // in `table.selectRecords`) but it is still being saved to Airtable
1062
- * // servers (e.g. it may not look deleted to other users yet).
1063
- * }
1064
- *
1065
- * async function deleteRecordAsync(record) {
1066
- * if (table.hasPermissionToDeleteRecord(record)) {
1067
- * await table.deleteRecordAsync(record);
1068
- * }
1069
- * // Record deletion has been saved to Airtable servers.
1070
- * alert('record has been deleted');
1071
- * }
1072
- * ```
1073
- */
1074
- }, {
1075
- key: "deleteRecordAsync",
1076
- value: (function () {
1077
- var _deleteRecordAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(recordOrRecordId) {
1078
- return _regenerator.default.wrap(function _callee6$(_context6) {
1079
- while (1) switch (_context6.prev = _context6.next) {
1080
- case 0:
1081
- _context6.next = 2;
1082
- return this.deleteRecordsAsync([recordOrRecordId]);
1083
- case 2:
1084
- case "end":
1085
- return _context6.stop();
1086
- }
1087
- }, _callee6, this);
1088
- }));
1089
- function deleteRecordAsync(_x10) {
1090
- return _deleteRecordAsync.apply(this, arguments);
1091
- }
1092
- return deleteRecordAsync;
1093
- }()
1094
- /**
1095
- * Checks whether the current user has permission to delete the specified record.
1096
- *
1097
- * Accepts optional input, in the same format as {@link deleteRecordAsync}.
1098
- * The more information provided, the more accurate the permissions check will be.
1099
- *
1100
- * Returns `{hasPermission: true}` if the current user can delete the specified record,
1101
- * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
1102
- * used to display an error message to the user.
1103
- *
1104
- * @param recordOrRecordId the record to be deleted
1105
- * @example
1106
- * ```js
1107
- * // Check if user can delete a specific record
1108
- * const deleteRecordCheckResult =
1109
- * table.checkPermissionsForDeleteRecord(record);
1110
- * if (!deleteRecordCheckResult.hasPermission) {
1111
- * alert(deleteRecordCheckResult.reasonDisplayString);
1112
- * }
1113
- *
1114
- * // Check if user could potentially delete a record.
1115
- * // Use when you don't know the specific record you want to delete yet (for
1116
- * // example, to show/hide UI controls that let you select a record to delete).
1117
- * const deleteUnknownRecordCheckResult =
1118
- * table.checkPermissionsForDeleteRecord();
1119
- * ```
1120
- */
1121
- )
1122
- }, {
1123
- key: "checkPermissionsForDeleteRecord",
1124
- value: function checkPermissionsForDeleteRecord(recordOrRecordId) {
1125
- return this.checkPermissionsForDeleteRecords(recordOrRecordId ? [recordOrRecordId] : undefined);
1126
- }
1127
- /**
1128
- * An alias for `checkPermissionsForDeleteRecord(recordOrRecordId).hasPermission`.
1129
- *
1130
- * Checks whether the current user has permission to delete the specified record.
1131
- *
1132
- * Accepts optional input, in the same format as {@link deleteRecordAsync}.
1133
- * The more information provided, the more accurate the permissions check will be.
1134
- *
1135
- * @param recordOrRecordId the record to be deleted
1136
- * @example
1137
- * ```js
1138
- * // Check if user can delete a specific record
1139
- * const canDeleteRecord = table.hasPermissionToDeleteRecord(record);
1140
- * if (!canDeleteRecord) {
1141
- * alert('not allowed');
1142
- * }
1143
- *
1144
- * // Check if user could potentially delete a record.
1145
- * // Use when you don't know the specific record you want to delete yet (for
1146
- * // example, to show/hide UI controls that let you select a record to delete).
1147
- * const canDeleteUnknownRecord = table.hasPermissionToDeleteRecord();
1148
- * ```
1149
- */
1150
- }, {
1151
- key: "hasPermissionToDeleteRecord",
1152
- value: function hasPermissionToDeleteRecord(recordOrRecordId) {
1153
- return this.checkPermissionsForDeleteRecord(recordOrRecordId).hasPermission;
1154
- }
1155
- /**
1156
- * Delete the given records.
1157
- *
1158
- * Throws an error if the user does not have permission to delete the given records.
1159
- *
1160
- * You may only delete up to 50 records in one call to `deleteRecordsAsync`.
1161
- * See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
1162
- * more information about write limits.
1163
- *
1164
- * This action is asynchronous: `await` the returned promise if you wish to wait for the
1165
- * delete to be persisted to Airtable servers.
1166
- * Updates are applied optimistically locally, so your changes will be reflected in your extension
1167
- * before the promise resolves.
1168
- *
1169
- * @param recordsOrRecordIds Array of Records and RecordIds
1170
- * @example
1171
- * ```js
1172
- *
1173
- * function deleteRecords(records) {
1174
- * if (table.hasPermissionToDeleteRecords(records)) {
1175
- * table.deleteRecordsAsync(records);
1176
- * }
1177
- * // The records are now deleted within your extension (eg will not be
1178
- * // returned in `table.selectRecords()`) but are still being saved to
1179
- * // Airtable servers (e.g. they may not look deleted to other users yet).
1180
- * }
1181
- *
1182
- * async function deleteRecordsAsync(records) {
1183
- * if (table.hasPermissionToDeleteRecords(records)) {
1184
- * await table.deleteRecordsAsync(records);
1185
- * }
1186
- * // Record deletions have been saved to Airtable servers.
1187
- * alert('records have been deleted');
1188
- * }
1189
- * ```
1190
- */
1191
- }, {
1192
- key: "deleteRecordsAsync",
1193
- value: (function () {
1194
- var _deleteRecordsAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(recordsOrRecordIds) {
1195
- var recordIds;
1196
- return _regenerator.default.wrap(function _callee7$(_context7) {
1197
- while (1) switch (_context7.prev = _context7.next) {
1198
- case 0:
1199
- recordIds = recordsOrRecordIds.map(recordOrRecordId => typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id);
1200
- _context7.next = 3;
1201
- return this._sdk.__mutations.applyMutationAsync({
1202
- type: _mutations.MutationTypes.DELETE_MULTIPLE_RECORDS,
1203
- tableId: this.id,
1204
- recordIds
1205
- });
1206
- case 3:
1207
- case "end":
1208
- return _context7.stop();
1209
- }
1210
- }, _callee7, this);
1211
- }));
1212
- function deleteRecordsAsync(_x11) {
1213
- return _deleteRecordsAsync.apply(this, arguments);
1214
- }
1215
- return deleteRecordsAsync;
1216
- }()
1217
- /**
1218
- * Checks whether the current user has permission to delete the specified records.
1219
- *
1220
- * Accepts optional input, in the same format as {@link deleteRecordsAsync}.
1221
- * The more information provided, the more accurate the permissions check will be.
1222
- *
1223
- * Returns `{hasPermission: true}` if the current user can delete the specified records,
1224
- * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
1225
- * used to display an error message to the user.
1226
- *
1227
- * @param recordsOrRecordIds the records to be deleted
1228
- * @example
1229
- * ```js
1230
- * // Check if user can delete specific records
1231
- * const deleteRecordsCheckResult =
1232
- * table.checkPermissionsForDeleteRecords([record1, record2]);
1233
- * if (!deleteRecordsCheckResult.hasPermission) {
1234
- * alert(deleteRecordsCheckResult.reasonDisplayString);
1235
- * }
1236
- *
1237
- * // Check if user could potentially delete records.
1238
- * // Use when you don't know the specific records you want to delete yet (for
1239
- * // example, to show/hide UI controls that let you select records to delete).
1240
- * // Equivalent to table.hasPermissionToDeleteRecord()
1241
- * const deleteUnknownRecordsCheckResult =
1242
- * table.checkPermissionsForDeleteRecords();
1243
- * ```
1244
- */
1245
- )
1246
- }, {
1247
- key: "checkPermissionsForDeleteRecords",
1248
- value: function checkPermissionsForDeleteRecords(recordsOrRecordIds) {
1249
- return this._sdk.__mutations.checkPermissionsForMutation({
1250
- type: _mutations.MutationTypes.DELETE_MULTIPLE_RECORDS,
1251
- tableId: this.id,
1252
- recordIds: recordsOrRecordIds ? recordsOrRecordIds.map(recordOrRecordId => typeof recordOrRecordId === 'string' ? recordOrRecordId : recordOrRecordId.id) : undefined
1253
- });
1254
- }
1255
- /**
1256
- * An alias for `checkPermissionsForDeleteRecords(recordsOrRecordIds).hasPermission`.
1257
- *
1258
- * Checks whether the current user has permission to delete the specified records.
1259
- *
1260
- * Accepts optional input, in the same format as {@link deleteRecordsAsync}.
1261
- * The more information provided, the more accurate the permissions check will be.
1262
- *
1263
- * @param recordsOrRecordIds the records to be deleted
1264
- * @example
1265
- * ```js
1266
- * // Check if user can delete specific records
1267
- * const canDeleteRecords =
1268
- * table.hasPermissionToDeleteRecords([record1, record2]);
1269
- * if (!canDeleteRecords) {
1270
- * alert('not allowed!');
1271
- * }
1272
- *
1273
- * // Check if user could potentially delete records.
1274
- * // Use when you don't know the specific records you want to delete yet (for
1275
- * // example, to show/hide UI controls that let you select records to delete).
1276
- * // Equivalent to table.hasPermissionToDeleteRecord()
1277
- * const canDeleteUnknownRecords = table.hasPermissionToDeleteRecords();
1278
- * ```
1279
- */
1280
- }, {
1281
- key: "hasPermissionToDeleteRecords",
1282
- value: function hasPermissionToDeleteRecords(recordsOrRecordIds) {
1283
- return this.checkPermissionsForDeleteRecords(recordsOrRecordIds).hasPermission;
1284
- }
1285
-
1286
- /**
1287
- * Creates a new record with the specified cell values.
1288
- *
1289
- * Throws an error if the user does not have permission to create the given records, or
1290
- * if invalid input is provided (eg. invalid cell values).
1291
- *
1292
- * Refer to {@link FieldType} for cell value write formats.
1293
- *
1294
- * This action is asynchronous: `await` the returned promise if you wish to wait for the new
1295
- * record to be persisted to Airtable servers.
1296
- * Updates are applied optimistically locally, so your changes will be reflected in your extension
1297
- * before the promise resolves.
1298
- *
1299
- * The returned promise will resolve to the RecordId of the new record once it is persisted.
1300
- *
1301
- * @param fields object mapping `FieldId` or field name to value for that field.
1302
- * @example
1303
- * ```js
1304
- * function createNewRecord(recordFields) {
1305
- * if (table.hasPermissionToCreateRecord(recordFields)) {
1306
- * table.createRecordAsync(recordFields);
1307
- * }
1308
- * // You can now access the new record in your extension (eg
1309
- * // `table.selectRecords()`) but it is still being saved to Airtable
1310
- * // servers (e.g. other users may not be able to see it yet).
1311
- * }
1312
- *
1313
- * async function createNewRecordAsync(recordFields) {
1314
- * if (table.hasPermissionToCreateRecord(recordFields)) {
1315
- * const newRecordId = await table.createRecordAsync(recordFields);
1316
- * }
1317
- * // New record has been saved to Airtable servers.
1318
- * alert(`new record with ID ${newRecordId} has been created`);
1319
- * }
1320
- *
1321
- * // Fields can be specified by name or ID
1322
- * createNewRecord({
1323
- * 'Project Name': 'Advertising campaign',
1324
- * 'Budget': 100,
1325
- * });
1326
- * createNewRecord({
1327
- * [projectNameField.id]: 'Cat video',
1328
- * [budgetField.id]: 200,
1329
- * });
1330
- *
1331
- * // Cell values should generally have format matching the output of
1332
- * // record.getCellValue() for the field being updated
1333
- * createNewRecord({
1334
- * 'Project Name': 'Cat video 2'
1335
- * 'Category (single select)': {name: 'Video'},
1336
- * 'Tags (multiple select)': [{name: 'Cats'}, {id: 'someChoiceId'}],
1337
- * 'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
1338
- * 'Related projects (linked records)': [{id: 'someRecordId'}],
1339
- * });
1340
- * ```
1341
- */
1342
- }, {
1343
- key: "createRecordAsync",
1344
- value: (function () {
1345
- var _createRecordAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1346
- var fields,
1347
- recordIds,
1348
- _args8 = arguments;
1349
- return _regenerator.default.wrap(function _callee8$(_context8) {
1350
- while (1) switch (_context8.prev = _context8.next) {
1351
- case 0:
1352
- fields = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
1353
- _context8.next = 3;
1354
- return this.createRecordsAsync([{
1355
- fields
1356
- }]);
1357
- case 3:
1358
- recordIds = _context8.sent;
1359
- return _context8.abrupt("return", recordIds[0]);
1360
- case 5:
1361
- case "end":
1362
- return _context8.stop();
1363
- }
1364
- }, _callee8, this);
1365
- }));
1366
- function createRecordAsync() {
1367
- return _createRecordAsync.apply(this, arguments);
1368
- }
1369
- return createRecordAsync;
1370
- }()
1371
- /**
1372
- * Checks whether the current user has permission to create the specified record.
1373
- *
1374
- * Accepts partial input, in the same format as {@link createRecordAsync}.
1375
- * The more information provided, the more accurate the permissions check will be.
1376
- *
1377
- * Returns `{hasPermission: true}` if the current user can create the specified record,
1378
- * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
1379
- * used to display an error message to the user.
1380
- *
1381
- * @param fields object mapping `FieldId` or field name to value for that field.
1382
- * @example
1383
- * ```js
1384
- * // Check if user can create a specific record, when you already know what
1385
- * // fields/cell values will be set for the record.
1386
- * const createRecordCheckResult = table.checkPermissionsForCreateRecord({
1387
- * 'Project Name': 'Advertising campaign',
1388
- * 'Budget': 100,
1389
- * });
1390
- * if (!createRecordCheckResult.hasPermission) {
1391
- * alert(createRecordCheckResult.reasonDisplayString);
1392
- * }
1393
- *
1394
- * // Like createRecordAsync, you can use either field names or field IDs.
1395
- * const checkResultWithFieldIds = table.checkPermissionsForCreateRecord({
1396
- * [projectNameField.id]: 'Cat video',
1397
- * [budgetField.id]: 200,
1398
- * });
1399
- *
1400
- * // Check if user could potentially create a record.
1401
- * // Use when you don't know the specific fields/cell values yet (for example,
1402
- * // to show or hide UI controls that let you start creating a record.)
1403
- * const createUnknownRecordCheckResult =
1404
- * table.checkPermissionsForCreateRecord();
1405
- * ```
1406
- */
1407
- )
1408
- }, {
1409
- key: "checkPermissionsForCreateRecord",
1410
- value: function checkPermissionsForCreateRecord(fields) {
1411
- return this.checkPermissionsForCreateRecords([{
1412
- fields: fields || undefined
1413
- }]);
1414
- }
1415
- /**
1416
- * An alias for `checkPermissionsForCreateRecord(fields).hasPermission`.
1417
- *
1418
- * Checks whether the current user has permission to create the specified record.
1419
- *
1420
- * Accepts partial input, in the same format as {@link createRecordAsync}.
1421
- * The more information provided, the more accurate the permissions check will be.
1422
- *
1423
- * @param fields object mapping `FieldId` or field name to value for that field.
1424
- * @example
1425
- * ```js
1426
- * // Check if user can create a specific record, when you already know what
1427
- * // fields/cell values will be set for the record.
1428
- * const canCreateRecord = table.hasPermissionToCreateRecord({
1429
- * 'Project Name': 'Advertising campaign',
1430
- * 'Budget': 100,
1431
- * });
1432
- * if (!canCreateRecord) {
1433
- * alert('not allowed!');
1434
- * }
1435
- *
1436
- * // Like createRecordAsync, you can use either field names or field IDs.
1437
- * const canCreateRecordWithFieldIds = table.hasPermissionToCreateRecord({
1438
- * [projectNameField.id]: 'Cat video',
1439
- * [budgetField.id]: 200,
1440
- * });
1441
- *
1442
- * // Check if user could potentially create a record.
1443
- * // Use when you don't know the specific fields/cell values yet (for example,
1444
- * // to show or hide UI controls that let you start creating a record.)
1445
- * const canCreateUnknownRecord = table.hasPermissionToCreateRecord();
1446
- * ```
1447
- */
1448
- }, {
1449
- key: "hasPermissionToCreateRecord",
1450
- value: function hasPermissionToCreateRecord(fields) {
1451
- return this.checkPermissionsForCreateRecord(fields).hasPermission;
1452
- }
1453
- /**
1454
- * Creates new records with the specified cell values.
1455
- *
1456
- * Throws an error if the user does not have permission to create the given records, or
1457
- * if invalid input is provided (eg. invalid cell values).
1458
- *
1459
- * Refer to {@link FieldType} for cell value write formats.
1460
- *
1461
- * You may only create up to 50 records in one call to `createRecordsAsync`.
1462
- * See [Write back to Airtable](/guides/write-back-to-airtable#size-limits-rate-limits) for
1463
- * more information about write limits.
1464
- *
1465
- * This action is asynchronous: `await` the returned promise if you wish to wait for the new
1466
- * record to be persisted to Airtable servers.
1467
- * Updates are applied optimistically locally, so your changes will be reflected in your extension
1468
- * before the promise resolves.
1469
- *
1470
- * The returned promise will resolve to an array of RecordIds of the new records once the new
1471
- * records are persisted.
1472
- *
1473
- * @param records Array of objects with a `fields` key mapping `FieldId` or field name to value for that field.
1474
- * @example
1475
- * ```js
1476
- * const recordDefs = [
1477
- * // Fields can be specified by name or ID
1478
- * {
1479
- * fields: {
1480
- * 'Project Name': 'Advertising campaign',
1481
- * 'Budget': 100,
1482
- * },
1483
- * },
1484
- * {
1485
- * fields: {
1486
- * [projectNameField.id]: 'Cat video',
1487
- * [budgetField.id]: 200,
1488
- * },
1489
- * },
1490
- * // Specifying no fields will create a new record with no cell values set
1491
- * {
1492
- * fields: {},
1493
- * },
1494
- * // Cell values should generally have format matching the output of
1495
- * // record.getCellValue() for the field being updated
1496
- * {
1497
- * fields: {
1498
- * 'Project Name': 'Cat video 2'
1499
- * 'Category (single select)': {name: 'Video'},
1500
- * 'Tags (multiple select)': [{name: 'Cats'}, {id: 'choiceId'}],
1501
- * 'Assets (attachment)': [{url: 'http://mywebsite.com/cats.mp4'}],
1502
- * 'Related projects (linked records)': [{id: 'someRecordId'}],
1503
- * },
1504
- * },
1505
- * ];
1506
- *
1507
- * function createNewRecords() {
1508
- * if (table.hasPermissionToCreateRecords(recordDefs)) {
1509
- * table.createRecordsAsync(recordDefs);
1510
- * }
1511
- * // You can now access the new records in your extension (e.g.
1512
- * // `table.selectRecords()`) but they are still being saved to Airtable
1513
- * // servers (e.g. other users may not be able to see them yet.)
1514
- * }
1515
- *
1516
- * async function createNewRecordsAsync() {
1517
- * if (table.hasPermissionToCreateRecords(recordDefs)) {
1518
- * const newRecordIds = await table.createRecordsAsync(recordDefs);
1519
- * }
1520
- * // New records have been saved to Airtable servers.
1521
- * alert(`new records with IDs ${newRecordIds} have been created`);
1522
- * }
1523
- * ```
1524
- */
1525
- }, {
1526
- key: "createRecordsAsync",
1527
- value: (function () {
1528
- var _createRecordsAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(records) {
1529
- var recordsToCreate;
1530
- return _regenerator.default.wrap(function _callee9$(_context9) {
1531
- while (1) switch (_context9.prev = _context9.next) {
1532
- case 0:
1533
- recordsToCreate = records.map(recordDef => {
1534
- var recordDefKeys = (0, _private_utils.keys)(recordDef);
1535
- var fields;
1536
- if (recordDefKeys.length === 1 && recordDefKeys[0] === 'fields') {
1537
- fields = recordDef.fields;
1538
- } else {
1539
- throw (0, _error_utils.spawnError)('Invalid record format. Please define field mappings using a `fields` key for each record definition object');
1540
- }
1541
- return {
1542
- id: this._sdk.__airtableInterface.idGenerator.generateRecordId(),
1543
- cellValuesByFieldId: this._cellValuesByFieldIdOrNameToCellValuesByFieldId(fields)
1544
- };
1545
- });
1546
- _context9.next = 3;
1547
- return this._sdk.__mutations.applyMutationAsync({
1548
- type: _mutations.MutationTypes.CREATE_MULTIPLE_RECORDS,
1549
- tableId: this.id,
1550
- records: recordsToCreate,
1551
- opts: {
1552
- parseDateCellValueInColumnTimeZone: true
1553
- }
1554
- });
1555
- case 3:
1556
- return _context9.abrupt("return", recordsToCreate.map(record => record.id));
1557
- case 4:
1558
- case "end":
1559
- return _context9.stop();
1560
- }
1561
- }, _callee9, this);
1562
- }));
1563
- function createRecordsAsync(_x12) {
1564
- return _createRecordsAsync.apply(this, arguments);
1565
- }
1566
- return createRecordsAsync;
1567
- }()
1568
- /**
1569
- * Checks whether the current user has permission to create the specified records.
1570
- *
1571
- * Accepts partial input, in the same format as {@link createRecordsAsync}.
1572
- * The more information provided, the more accurate the permissions check will be.
1573
- *
1574
- * Returns `{hasPermission: true}` if the current user can create the specified records,
1575
- * `{hasPermission: false, reasonDisplayString: string}` otherwise. `reasonDisplayString` may be
1576
- * used to display an error message to the user.
1577
- *
1578
- * @param records Array of objects mapping `FieldId` or field name to value for that field.
1579
- * @example
1580
- * ```js
1581
- * // Check if user can create specific records, when you already know what
1582
- * // fields/cell values will be set for the records.
1583
- * const createRecordsCheckResult = table.checkPermissionsForCreateRecords([
1584
- * // Like createRecordsAsync, fields can be specified by name or ID
1585
- * {
1586
- * fields: {
1587
- * 'Project Name': 'Advertising campaign',
1588
- * 'Budget': 100,
1589
- * },
1590
- * },
1591
- * {
1592
- * fields: {
1593
- * [projectNameField.id]: 'Cat video',
1594
- * [budgetField.id]: 200,
1595
- * },
1596
- * },
1597
- * {},
1598
- * ]);
1599
- * if (!createRecordsCheckResult.hasPermission) {
1600
- * alert(createRecordsCheckResult.reasonDisplayString);
1601
- * }
1602
- *
1603
- * // Check if user could potentially create records.
1604
- * // Use when you don't know the specific fields/cell values yet (for example,
1605
- * // to show or hide UI controls that let you start creating records.)
1606
- * // Equivalent to table.checkPermissionsForCreateRecord()
1607
- * const createUnknownRecordCheckResult =
1608
- * table.checkPermissionsForCreateRecords();
1609
- * ```
1610
- */
1611
- )
1612
- }, {
1613
- key: "checkPermissionsForCreateRecords",
1614
- value: function checkPermissionsForCreateRecords(records) {
1615
- return this._sdk.__mutations.checkPermissionsForMutation({
1616
- type: _mutations.MutationTypes.CREATE_MULTIPLE_RECORDS,
1617
- tableId: this.id,
1618
- records: records ? records.map(record => ({
1619
- id: undefined,
1620
- cellValuesByFieldId: record.fields ? this._cellValuesByFieldIdOrNameToCellValuesByFieldId(record.fields) : undefined
1621
- })) : undefined
1622
- });
1623
- }
1624
- /**
1625
- * An alias for `checkPermissionsForCreateRecords(records).hasPermission`.
1626
- *
1627
- * Checks whether the current user has permission to create the specified records.
1628
- *
1629
- * Accepts partial input, in the same format as {@link createRecordsAsync}.
1630
- * The more information provided, the more accurate the permissions check will be.
1631
- *
1632
- * @param records Array of objects mapping `FieldId` or field name to value for that field.
1633
- * @example
1634
- * ```js
1635
- * // Check if user can create specific records, when you already know what fields/cell values
1636
- * // will be set for the records.
1637
- * const canCreateRecords = table.hasPermissionToCreateRecords([
1638
- * // Like createRecordsAsync, fields can be specified by name or ID
1639
- * {
1640
- * fields: {
1641
- * 'Project Name': 'Advertising campaign',
1642
- * 'Budget': 100,
1643
- * }
1644
- * },
1645
- * {
1646
- * fields: {
1647
- * [projectNameField.id]: 'Cat video',
1648
- * [budgetField.id]: 200,
1649
- * }
1650
- * },
1651
- * {},
1652
- * ]);
1653
- * if (!canCreateRecords) {
1654
- * alert('not allowed');
1655
- * }
1656
- *
1657
- * // Check if user could potentially create records.
1658
- * // Use when you don't know the specific fields/cell values yet (for example,
1659
- * // to show or hide UI controls that let you start creating records).
1660
- * // Equivalent to table.hasPermissionToCreateRecord()
1661
- * const canCreateUnknownRecords = table.hasPermissionToCreateRecords();
1662
- * ```
1663
- */
1664
- }, {
1665
- key: "hasPermissionToCreateRecords",
1666
- value: function hasPermissionToCreateRecords(records) {
1667
- return this.checkPermissionsForCreateRecords(records).hasPermission;
1668
- }
1669
-
1670
- /** @internal */
601
+ }() /** @internal */)
1671
602
  }, {
1672
603
  key: "__triggerOnChangeForDirtyPaths",
1673
604
  value: function __triggerOnChangeForDirtyPaths(dirtyPaths) {