@league-of-foundry-developers/foundry-vtt-types 13.340.0 → 13.340.1

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 (543) hide show
  1. package/README.md +6 -3
  2. package/package.json +40 -18
  3. package/src/configuration/configuration.d.mts +24 -23
  4. package/src/configuration/documents.d.mts +295 -0
  5. package/src/configuration/globals.d.mts +8 -2
  6. package/src/configuration/index.d.mts +1 -0
  7. package/src/foundry/client/apps/app.d.mts +121 -119
  8. package/src/foundry/client/apps/av/av-config.d.mts +13 -8
  9. package/src/foundry/client/apps/av/cameras.d.mts +11 -11
  10. package/src/foundry/client/apps/dice/dice-config.d.mts +22 -8
  11. package/src/foundry/client/apps/form.d.mts +112 -94
  12. package/src/foundry/client/apps/forms/actor.d.mts +22 -12
  13. package/src/foundry/client/apps/forms/adventure-exporter.d.mts +13 -8
  14. package/src/foundry/client/apps/forms/adventure-importer.d.mts +15 -7
  15. package/src/foundry/client/apps/forms/base-sheet.d.mts +14 -7
  16. package/src/foundry/client/apps/forms/card-config.d.mts +17 -9
  17. package/src/foundry/client/apps/forms/cards-config.d.mts +13 -14
  18. package/src/foundry/client/apps/forms/combat-config.d.mts +7 -7
  19. package/src/foundry/client/apps/forms/combatant-config.d.mts +4 -4
  20. package/src/foundry/client/apps/forms/default-sheets-config.d.mts +1 -1
  21. package/src/foundry/client/apps/forms/effect-config.d.mts +6 -6
  22. package/src/foundry/client/apps/forms/folder-config.d.mts +5 -5
  23. package/src/foundry/client/apps/forms/fonts.d.mts +42 -35
  24. package/src/foundry/client/apps/forms/grid-config.d.mts +11 -11
  25. package/src/foundry/client/apps/forms/image-popout.d.mts +28 -22
  26. package/src/foundry/client/apps/forms/item.d.mts +6 -6
  27. package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +17 -15
  28. package/src/foundry/client/apps/forms/journal-sheet.d.mts +46 -37
  29. package/src/foundry/client/apps/forms/macro-config.d.mts +6 -6
  30. package/src/foundry/client/apps/forms/measure-template.d.mts +8 -8
  31. package/src/foundry/client/apps/forms/ownership.d.mts +5 -5
  32. package/src/foundry/client/apps/forms/playlist-config.d.mts +7 -9
  33. package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +6 -6
  34. package/src/foundry/client/apps/forms/roll-table-config.d.mts +9 -10
  35. package/src/foundry/client/apps/forms/scene-config.d.mts +39 -39
  36. package/src/foundry/client/apps/forms/sheet-config.d.mts +8 -8
  37. package/src/foundry/client/apps/forms/user-config.d.mts +11 -11
  38. package/src/foundry/client/apps/hud/chatbubble.d.mts +14 -9
  39. package/src/foundry/client/apps/hud/container.d.mts +3 -3
  40. package/src/foundry/client/apps/hud/controls.d.mts +124 -84
  41. package/src/foundry/client/apps/hud/hotbar.d.mts +12 -12
  42. package/src/foundry/client/apps/hud/hud.d.mts +4 -4
  43. package/src/foundry/client/apps/hud/menu.d.mts +6 -6
  44. package/src/foundry/client/apps/hud/navigation.d.mts +11 -11
  45. package/src/foundry/client/apps/hud/pause.d.mts +7 -7
  46. package/src/foundry/client/apps/hud/players.d.mts +11 -11
  47. package/src/foundry/client/apps/i18n.d.mts +31 -27
  48. package/src/foundry/client/apps/placeables/drawing-config.d.mts +41 -33
  49. package/src/foundry/client/apps/placeables/drawing-hud.d.mts +4 -4
  50. package/src/foundry/client/apps/placeables/index.d.mts +0 -2
  51. package/src/foundry/client/apps/placeables/note-config.d.mts +27 -17
  52. package/src/foundry/client/apps/placeables/tile-config.d.mts +23 -10
  53. package/src/foundry/client/apps/placeables/tile-hud.d.mts +8 -8
  54. package/src/foundry/client/apps/placeables/token-config.d.mts +84 -63
  55. package/src/foundry/client/apps/placeables/token-hud.d.mts +10 -10
  56. package/src/foundry/client/apps/placeables/wall-config.d.mts +19 -16
  57. package/src/foundry/client/apps/sidebar/apps/chat-popout.d.mts +5 -5
  58. package/src/foundry/client/apps/sidebar/apps/client-settings.d.mts +2 -2
  59. package/src/foundry/client/apps/sidebar/apps/compendium.d.mts +13 -10
  60. package/src/foundry/client/apps/sidebar/apps/invitation-links.d.mts +3 -3
  61. package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +1 -1
  62. package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +6 -6
  63. package/src/foundry/client/apps/sidebar/apps/permission-config.d.mts +6 -6
  64. package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +33 -28
  65. package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +1 -1
  66. package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +12 -9
  67. package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +40 -32
  68. package/src/foundry/client/apps/sidebar/document-directory.d.mts +44 -37
  69. package/src/foundry/client/apps/sidebar/package-configuration.d.mts +3 -3
  70. package/src/foundry/client/apps/sidebar/sidebar-tab.d.mts +3 -3
  71. package/src/foundry/client/apps/sidebar/sidebar.d.mts +7 -7
  72. package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +4 -4
  73. package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +4 -4
  74. package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +34 -29
  75. package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +15 -15
  76. package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +21 -12
  77. package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +4 -4
  78. package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +4 -4
  79. package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +8 -8
  80. package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +21 -21
  81. package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +4 -4
  82. package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +6 -6
  83. package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +12 -12
  84. package/src/foundry/client/apps/templates.d.mts +2 -2
  85. package/src/foundry/client/av/clients/simplepeer.d.mts +4 -4
  86. package/src/foundry/client/av/settings.d.mts +16 -13
  87. package/src/foundry/client/config.d.mts +1982 -1823
  88. package/src/foundry/client/core/document-index.d.mts +12 -4
  89. package/src/foundry/client/core/hooks.d.mts +0 -2
  90. package/src/foundry/client/core/image.d.mts +13 -11
  91. package/src/foundry/client/core/issues.d.mts +11 -6
  92. package/src/foundry/client/core/keybindings.d.mts +3 -3
  93. package/src/foundry/client/core/nue.d.mts +1 -1
  94. package/src/foundry/client/core/packages.d.mts +393 -63
  95. package/src/foundry/client/core/settings.d.mts +34 -12
  96. package/src/foundry/client/core/socket.d.mts +2 -2
  97. package/src/foundry/client/core/sorting.d.mts +6 -6
  98. package/src/foundry/client/core/time.d.mts +6 -3
  99. package/src/foundry/client/core/tooltip.d.mts +1 -1
  100. package/src/foundry/client/core/tour.d.mts +58 -49
  101. package/src/foundry/client/core/tours.d.mts +1 -1
  102. package/src/foundry/client/core/utils.d.mts +3 -3
  103. package/src/foundry/client/core/workers.d.mts +24 -17
  104. package/src/foundry/client/data/abstract/canvas-document.d.mts +9 -15
  105. package/src/foundry/client/data/abstract/client-document.d.mts +133 -172
  106. package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +14 -36
  107. package/src/foundry/client/data/abstract/document-collection.d.mts +89 -65
  108. package/src/foundry/client/data/abstract/world-collection.d.mts +47 -53
  109. package/src/foundry/client/data/collections/actors.d.mts +24 -31
  110. package/src/foundry/client/data/collections/cards.d.mts +10 -6
  111. package/src/foundry/client/data/collections/combats.d.mts +12 -8
  112. package/src/foundry/client/data/collections/compendium-collection.d.mts +79 -66
  113. package/src/foundry/client/data/collections/compendium-folders.d.mts +6 -6
  114. package/src/foundry/client/data/collections/compendium-packs.d.mts +4 -4
  115. package/src/foundry/client/data/collections/fog.d.mts +10 -6
  116. package/src/foundry/client/data/collections/folder.d.mts +15 -10
  117. package/src/foundry/client/data/collections/items.d.mts +11 -7
  118. package/src/foundry/client/data/collections/journal.d.mts +16 -10
  119. package/src/foundry/client/data/collections/macros.d.mts +15 -22
  120. package/src/foundry/client/data/collections/messages.d.mts +14 -10
  121. package/src/foundry/client/data/collections/playlists.d.mts +12 -9
  122. package/src/foundry/client/data/collections/scenes.d.mts +19 -31
  123. package/src/foundry/client/data/collections/settings.d.mts +10 -6
  124. package/src/foundry/client/data/collections/tables.d.mts +11 -7
  125. package/src/foundry/client/data/collections/users.d.mts +14 -11
  126. package/src/foundry/client/data/documents/active-effect.d.mts +652 -88
  127. package/src/foundry/client/data/documents/actor-delta.d.mts +672 -28
  128. package/src/foundry/client/data/documents/actor.d.mts +722 -60
  129. package/src/foundry/client/data/documents/adventure.d.mts +482 -49
  130. package/src/foundry/client/data/documents/ambient-light.d.mts +426 -21
  131. package/src/foundry/client/data/documents/ambient-sound.d.mts +474 -15
  132. package/src/foundry/client/data/documents/card.d.mts +570 -39
  133. package/src/foundry/client/data/documents/cards.d.mts +742 -78
  134. package/src/foundry/client/data/documents/chat-message.d.mts +578 -45
  135. package/src/foundry/client/data/documents/combat.d.mts +701 -71
  136. package/src/foundry/client/data/documents/combatant.d.mts +510 -28
  137. package/src/foundry/client/data/documents/drawing.d.mts +543 -16
  138. package/src/foundry/client/data/documents/fog-exploration.d.mts +413 -27
  139. package/src/foundry/client/data/documents/folder.d.mts +461 -40
  140. package/src/foundry/client/data/documents/item.d.mts +679 -25
  141. package/src/foundry/client/data/documents/journal-entry-page.d.mts +587 -21
  142. package/src/foundry/client/data/documents/journal-entry.d.mts +621 -20
  143. package/src/foundry/client/data/documents/macro.d.mts +530 -25
  144. package/src/foundry/client/data/documents/measured-template.d.mts +480 -16
  145. package/src/foundry/client/data/documents/note.d.mts +495 -18
  146. package/src/foundry/client/data/documents/playlist-sound.d.mts +429 -27
  147. package/src/foundry/client/data/documents/playlist.d.mts +666 -75
  148. package/src/foundry/client/data/documents/region-behavior.d.mts +468 -38
  149. package/src/foundry/client/data/documents/region.d.mts +661 -35
  150. package/src/foundry/client/data/documents/scene.d.mts +986 -149
  151. package/src/foundry/client/data/documents/setting.d.mts +397 -15
  152. package/src/foundry/client/data/documents/table-result.d.mts +479 -17
  153. package/src/foundry/client/data/documents/table.d.mts +663 -80
  154. package/src/foundry/client/data/documents/tile.d.mts +502 -16
  155. package/src/foundry/client/data/documents/token.d.mts +1114 -90
  156. package/src/foundry/client/data/documents/user.d.mts +495 -27
  157. package/src/foundry/client/data/documents/wall.d.mts +550 -15
  158. package/src/foundry/client/game.d.mts +58 -92
  159. package/src/foundry/client/head.d.mts +5 -6
  160. package/src/foundry/client/hooks.d.mts +237 -221
  161. package/src/foundry/client/pixi/board.d.mts +95 -89
  162. package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +6 -5
  163. package/src/foundry/client/pixi/core/containers/cached-container.d.mts +5 -5
  164. package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +2 -2
  165. package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +3 -3
  166. package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +3 -3
  167. package/src/foundry/client/pixi/core/containers/quadtree.d.mts +23 -21
  168. package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +5 -5
  169. package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +5 -5
  170. package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +57 -51
  171. package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +3 -3
  172. package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +7 -7
  173. package/src/foundry/client/pixi/core/interaction/ping.d.mts +19 -11
  174. package/src/foundry/client/pixi/core/interaction/pings/chevron.d.mts +7 -2
  175. package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +29 -23
  176. package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +83 -38
  177. package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +3 -3
  178. package/src/foundry/client/pixi/core/interaction/targets.d.mts +9 -9
  179. package/src/foundry/client/pixi/core/loader.d.mts +8 -8
  180. package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +9 -4
  181. package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +3 -3
  182. package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +3 -3
  183. package/src/foundry/client/pixi/core/shapes/ray.d.mts +23 -17
  184. package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +19 -14
  185. package/src/foundry/client/pixi/extensions/circle.d.mts +1 -1
  186. package/src/foundry/client/pixi/extensions/observable-transform.d.mts +3 -3
  187. package/src/foundry/client/pixi/groups/effects.d.mts +4 -4
  188. package/src/foundry/client/pixi/groups/environment.d.mts +5 -5
  189. package/src/foundry/client/pixi/groups/hidden.d.mts +3 -3
  190. package/src/foundry/client/pixi/groups/interface.d.mts +6 -6
  191. package/src/foundry/client/pixi/groups/overlay.d.mts +3 -3
  192. package/src/foundry/client/pixi/groups/primary.d.mts +11 -11
  193. package/src/foundry/client/pixi/groups/rendered.d.mts +3 -3
  194. package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +3 -3
  195. package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +13 -13
  196. package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +279 -233
  197. package/src/foundry/client/pixi/layers/controls/cursor.d.mts +17 -8
  198. package/src/foundry/client/pixi/layers/controls/door.d.mts +26 -14
  199. package/src/foundry/client/pixi/layers/controls/layer.d.mts +89 -79
  200. package/src/foundry/client/pixi/layers/controls/ruler.d.mts +121 -96
  201. package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +4 -5
  202. package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +6 -4
  203. package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +7 -4
  204. package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +19 -16
  205. package/src/foundry/client/pixi/layers/effects/visibility.d.mts +101 -84
  206. package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +13 -4
  207. package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +31 -2
  208. package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +134 -59
  209. package/src/foundry/client/pixi/layers/grid/highlight.d.mts +13 -3
  210. package/src/foundry/client/pixi/layers/grid/layer.d.mts +89 -87
  211. package/src/foundry/client/pixi/layers/grid/mesh.d.mts +36 -15
  212. package/src/foundry/client/pixi/layers/masks/depth.d.mts +3 -3
  213. package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +4 -4
  214. package/src/foundry/client/pixi/layers/masks/vision.d.mts +6 -6
  215. package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +15 -11
  216. package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +11 -10
  217. package/src/foundry/client/pixi/layers/placeables/notes.d.mts +47 -28
  218. package/src/foundry/client/pixi/layers/placeables/regions.d.mts +25 -12
  219. package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +81 -63
  220. package/src/foundry/client/pixi/layers/placeables/templates.d.mts +10 -11
  221. package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +28 -17
  222. package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +67 -46
  223. package/src/foundry/client/pixi/layers/placeables/walls.d.mts +50 -51
  224. package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +22 -16
  225. package/src/foundry/client/pixi/perception/detection-mode.d.mts +123 -51
  226. package/src/foundry/client/pixi/perception/fog.d.mts +34 -19
  227. package/src/foundry/client/pixi/perception/perception-manager.d.mts +137 -137
  228. package/src/foundry/client/pixi/perception/vision-mode.d.mts +92 -67
  229. package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +3 -3
  230. package/src/foundry/client/pixi/placeable.d.mts +241 -146
  231. package/src/foundry/client/pixi/placeables/drawing.d.mts +260 -134
  232. package/src/foundry/client/pixi/placeables/light.d.mts +204 -66
  233. package/src/foundry/client/pixi/placeables/note.d.mts +150 -55
  234. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +7 -6
  235. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +3 -3
  236. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +2 -2
  237. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +4 -4
  238. package/src/foundry/client/pixi/placeables/region.d.mts +219 -110
  239. package/src/foundry/client/pixi/placeables/sound.d.mts +211 -68
  240. package/src/foundry/client/pixi/placeables/template.d.mts +186 -100
  241. package/src/foundry/client/pixi/placeables/tile.d.mts +211 -142
  242. package/src/foundry/client/pixi/placeables/token.d.mts +911 -568
  243. package/src/foundry/client/pixi/placeables/wall.d.mts +253 -130
  244. package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +27 -5
  245. package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +3 -3
  246. package/src/foundry/client/pixi/webgl/helpers/framebuffer-snapshot.d.mts +3 -3
  247. package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +13 -5
  248. package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +6 -6
  249. package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +2 -2
  250. package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +5 -5
  251. package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +4 -4
  252. package/src/foundry/client/pixi/webgl/shaders/filters/base-mask-filter.d.mts +3 -3
  253. package/src/foundry/client/pixi/webgl/shaders/filters/blur.d.mts +5 -5
  254. package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +6 -3
  255. package/src/foundry/client/pixi/webgl/shaders/filters/environment.d.mts +3 -3
  256. package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +4 -4
  257. package/src/foundry/client/pixi/webgl/shaders/filters/invisibility.d.mts +3 -3
  258. package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +4 -4
  259. package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +6 -6
  260. package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +8 -5
  261. package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +3 -3
  262. package/src/foundry/client/pixi/webgl/shaders/filters/void.d.mts +3 -3
  263. package/src/foundry/client/pixi/webgl/shaders/filters/weather-occlusion-masks.d.mts +4 -4
  264. package/src/foundry/client/pixi/webgl/shaders/fragment-channel-mixin.d.mts +1 -1
  265. package/src/foundry/client/pixi/webgl/shaders/grid/grid.d.mts +4 -4
  266. package/src/foundry/client/pixi/webgl/shaders/lighting/background-lighting.d.mts +3 -3
  267. package/src/foundry/client/pixi/webgl/shaders/lighting/base-lighting.d.mts +3 -3
  268. package/src/foundry/client/pixi/webgl/shaders/lighting/coloration-lighting.d.mts +3 -3
  269. package/src/foundry/client/pixi/webgl/shaders/lighting/darkness-lighting.d.mts +3 -3
  270. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/bewitching-wave.d.mts +5 -5
  271. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/black-hole.d.mts +3 -3
  272. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/chroma.d.mts +3 -3
  273. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/emanation.d.mts +3 -3
  274. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/energy-field.d.mts +3 -3
  275. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +6 -6
  276. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/flame.d.mts +5 -5
  277. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fog.d.mts +3 -3
  278. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/force-grid.d.mts +3 -3
  279. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/ghost-light.d.mts +5 -5
  280. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/hexa-dome.d.mts +3 -3
  281. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/light-dome.d.mts +3 -3
  282. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/magical-gloom.d.mts +3 -3
  283. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/pulse.d.mts +5 -5
  284. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/radial-rainbow.d.mts +3 -3
  285. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/revolving-light.d.mts +3 -3
  286. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/roiling-mass.d.mts +3 -3
  287. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/siren-light.d.mts +5 -5
  288. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/smoke-patch.d.mts +6 -5
  289. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/star-light.d.mts +3 -3
  290. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/sunburst.d.mts +5 -5
  291. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/swirling-rainbow.d.mts +4 -3
  292. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/torch.d.mts +5 -5
  293. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/vortex.d.mts +5 -5
  294. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/wave.d.mts +5 -5
  295. package/src/foundry/client/pixi/webgl/shaders/lighting/illumination-lighting.d.mts +3 -3
  296. package/src/foundry/client/pixi/webgl/shaders/region/adjust-darkness-level.d.mts +7 -7
  297. package/src/foundry/client/pixi/webgl/shaders/region/base.d.mts +4 -4
  298. package/src/foundry/client/pixi/webgl/shaders/region/highlight.d.mts +3 -3
  299. package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +4 -4
  300. package/src/foundry/client/pixi/webgl/shaders/samplers/baseline-illumination.d.mts +3 -3
  301. package/src/foundry/client/pixi/webgl/shaders/samplers/color-adjustment.d.mts +5 -5
  302. package/src/foundry/client/pixi/webgl/shaders/samplers/depth.d.mts +3 -3
  303. package/src/foundry/client/pixi/webgl/shaders/samplers/fog-of-war.d.mts +3 -3
  304. package/src/foundry/client/pixi/webgl/shaders/samplers/occlusion.d.mts +3 -3
  305. package/src/foundry/client/pixi/webgl/shaders/samplers/primary.d.mts +4 -4
  306. package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +4 -6
  307. package/src/foundry/client/pixi/webgl/shaders/vision/background-vision.d.mts +3 -3
  308. package/src/foundry/client/pixi/webgl/shaders/vision/base-vision.d.mts +3 -3
  309. package/src/foundry/client/pixi/webgl/shaders/vision/coloration-vision.d.mts +3 -3
  310. package/src/foundry/client/pixi/webgl/shaders/vision/effects/amplification.d.mts +3 -3
  311. package/src/foundry/client/pixi/webgl/shaders/vision/effects/wave.d.mts +5 -5
  312. package/src/foundry/client/pixi/webgl/shaders/vision/illumination-vision.d.mts +3 -3
  313. package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +14 -15
  314. package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +20 -27
  315. package/src/foundry/client/pixi/webgl/shaders/weather/fog.d.mts +5 -5
  316. package/src/foundry/client/pixi/webgl/shaders/weather/rain.d.mts +5 -5
  317. package/src/foundry/client/pixi/webgl/shaders/weather/snow.d.mts +5 -5
  318. package/src/foundry/client/pixi/workers/texture-worker.d.mts +5 -5
  319. package/src/foundry/client/tours/setup-tour.d.mts +15 -10
  320. package/src/foundry/client/ui/dialog.d.mts +3 -3
  321. package/src/foundry/client/ui/dragdrop.d.mts +33 -27
  322. package/src/foundry/client/ui/editor.d.mts +29 -21
  323. package/src/foundry/client/ui/filepicker.d.mts +42 -37
  324. package/src/foundry/client/ui/filter.d.mts +60 -48
  325. package/src/foundry/client/ui/forms.d.mts +22 -22
  326. package/src/foundry/client/ui/prosemirror.d.mts +15 -7
  327. package/src/foundry/client/ui/secrets.d.mts +43 -28
  328. package/src/foundry/client/ui/tabs.d.mts +40 -33
  329. package/src/foundry/client-esm/_module.d.mts +5 -5
  330. package/src/foundry/client-esm/_types.d.mts +2 -1
  331. package/src/foundry/client-esm/applications/api/application.d.mts +93 -31
  332. package/src/foundry/client-esm/applications/api/dialog.d.mts +23 -23
  333. package/src/foundry/client-esm/applications/api/document-sheet.d.mts +85 -32
  334. package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +1 -1
  335. package/src/foundry/client-esm/applications/apps/av/camera-popout.d.mts +1 -1
  336. package/src/foundry/client-esm/applications/apps/av/cameras.d.mts +2 -2
  337. package/src/foundry/client-esm/applications/apps/compendium-art-config.d.mts +4 -5
  338. package/src/foundry/client-esm/applications/apps/file-picker.d.mts +2 -2
  339. package/src/foundry/client-esm/applications/apps/grid-config.d.mts +3 -3
  340. package/src/foundry/client-esm/applications/apps/image-popout.d.mts +1 -1
  341. package/src/foundry/client-esm/applications/apps/permission-config.d.mts +1 -1
  342. package/src/foundry/client-esm/applications/dice/roll-resolver.d.mts +4 -4
  343. package/src/foundry/client-esm/applications/elements/file-picker.d.mts +1 -1
  344. package/src/foundry/client-esm/applications/elements/prosemirror-editor.d.mts +1 -1
  345. package/src/foundry/client-esm/applications/hud/drawing-hud.d.mts +1 -1
  346. package/src/foundry/client-esm/applications/hud/tile-hud.d.mts +1 -1
  347. package/src/foundry/client-esm/applications/hud/token-hud.d.mts +1 -1
  348. package/src/foundry/client-esm/applications/sheets/active-effect-config.d.mts +3 -3
  349. package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +2 -2
  350. package/src/foundry/client-esm/applications/sheets/adventure-exporter.d.mts +3 -3
  351. package/src/foundry/client-esm/applications/sheets/adventure-importer.d.mts +3 -3
  352. package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +5 -5
  353. package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +4 -4
  354. package/src/foundry/client-esm/applications/sheets/card-config.d.mts +3 -3
  355. package/src/foundry/client-esm/applications/sheets/cards-config.d.mts +2 -2
  356. package/src/foundry/client-esm/applications/sheets/combatant-config.d.mts +3 -3
  357. package/src/foundry/client-esm/applications/sheets/drawing-config.d.mts +3 -3
  358. package/src/foundry/client-esm/applications/sheets/folder-config.d.mts +3 -3
  359. package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +2 -2
  360. package/src/foundry/client-esm/applications/sheets/journal/journal-entry-category-config.d.mts +3 -3
  361. package/src/foundry/client-esm/applications/sheets/journal/journal-entry-page-sheet.d.mts +3 -3
  362. package/src/foundry/client-esm/applications/sheets/journal/journal-entry-sheet.d.mts +3 -3
  363. package/src/foundry/client-esm/applications/sheets/macro-config.d.mts +3 -3
  364. package/src/foundry/client-esm/applications/sheets/note-config.d.mts +3 -3
  365. package/src/foundry/client-esm/applications/sheets/playlist-config.d.mts +3 -3
  366. package/src/foundry/client-esm/applications/sheets/playlist-sound-config.d.mts +3 -3
  367. package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +3 -3
  368. package/src/foundry/client-esm/applications/sheets/region-config.d.mts +3 -3
  369. package/src/foundry/client-esm/applications/sheets/roll-table-config.d.mts +3 -3
  370. package/src/foundry/client-esm/applications/sheets/roll-table-sheet.d.mts +3 -3
  371. package/src/foundry/client-esm/applications/sheets/scene-config.d.mts +3 -3
  372. package/src/foundry/client-esm/applications/sheets/table-result-config.d.mts +3 -3
  373. package/src/foundry/client-esm/applications/sheets/template-config.d.mts +3 -3
  374. package/src/foundry/client-esm/applications/sheets/tile-config.d.mts +3 -3
  375. package/src/foundry/client-esm/applications/sheets/token/mixin.d.mts +1 -0
  376. package/src/foundry/client-esm/applications/sheets/token/token-config.d.mts +3 -3
  377. package/src/foundry/client-esm/applications/sheets/user-config.d.mts +4 -4
  378. package/src/foundry/client-esm/applications/sheets/wall-config.d.mts +3 -3
  379. package/src/foundry/client-esm/applications/sidebar/apps/chat-popout.d.mts +1 -1
  380. package/src/foundry/client-esm/applications/sidebar/sidebar-tab.d.mts +2 -2
  381. package/src/foundry/client-esm/applications/sidebar/tabs/actor-directory.d.mts +1 -1
  382. package/src/foundry/client-esm/applications/sidebar/tabs/cards-directory.d.mts +1 -1
  383. package/src/foundry/client-esm/applications/sidebar/tabs/combat-tracker.d.mts +242 -1
  384. package/src/foundry/client-esm/applications/sidebar/tabs/item-directory.d.mts +1 -1
  385. package/src/foundry/client-esm/applications/sidebar/tabs/journal-directory.d.mts +1 -1
  386. package/src/foundry/client-esm/applications/sidebar/tabs/macro-directory.d.mts +1 -1
  387. package/src/foundry/client-esm/applications/sidebar/tabs/playlist-directory.d.mts +1 -1
  388. package/src/foundry/client-esm/applications/sidebar/tabs/roll-table-directory.d.mts +1 -1
  389. package/src/foundry/client-esm/applications/sidebar/tabs/scene-directory.d.mts +1 -1
  390. package/src/foundry/client-esm/applications/ui/region-legend.d.mts +2 -2
  391. package/src/foundry/client-esm/applications/ux/context-menu.d.mts +56 -36
  392. package/src/foundry/client-esm/audio/_types.d.mts +2 -0
  393. package/src/foundry/client-esm/audio/biquad.d.mts +76 -26
  394. package/src/foundry/client-esm/audio/cache.d.mts +31 -20
  395. package/src/foundry/client-esm/audio/convolver.d.mts +47 -25
  396. package/src/foundry/client-esm/audio/helper.d.mts +124 -80
  397. package/src/foundry/client-esm/audio/sound.d.mts +202 -97
  398. package/src/foundry/client-esm/audio/timeout.d.mts +28 -12
  399. package/src/foundry/client-esm/canvas/edges/collision.d.mts +12 -4
  400. package/src/foundry/client-esm/canvas/edges/edge.d.mts +13 -8
  401. package/src/foundry/client-esm/canvas/edges/edges.d.mts +3 -2
  402. package/src/foundry/client-esm/canvas/edges/vertex.d.mts +12 -10
  403. package/src/foundry/client-esm/canvas/regions/geometry.d.mts +14 -7
  404. package/src/foundry/client-esm/canvas/regions/mesh.d.mts +25 -14
  405. package/src/foundry/client-esm/canvas/regions/polygon-tree.d.mts +50 -19
  406. package/src/foundry/client-esm/canvas/regions/shape.d.mts +45 -34
  407. package/src/foundry/client-esm/canvas/scene-manager.d.mts +7 -6
  408. package/src/foundry/client-esm/canvas/smaa/blend.d.mts +14 -3
  409. package/src/foundry/client-esm/canvas/smaa/edges.d.mts +25 -3
  410. package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +119 -20
  411. package/src/foundry/client-esm/canvas/smaa/weights.d.mts +26 -3
  412. package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +69 -39
  413. package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +66 -40
  414. package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +78 -19
  415. package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +37 -20
  416. package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +39 -20
  417. package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +41 -12
  418. package/src/foundry/client-esm/canvas/sources/point-movement-source.d.mts +15 -4
  419. package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +29 -14
  420. package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +84 -39
  421. package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +115 -41
  422. package/src/foundry/client-esm/canvas/tokens/ring-config.d.mts +83 -21
  423. package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +66 -93
  424. package/src/foundry/client-esm/canvas/tokens/ring.d.mts +146 -51
  425. package/src/foundry/client-esm/client.d.mts +16 -16
  426. package/src/foundry/client-esm/data/_module.d.mts +1 -1
  427. package/src/foundry/client-esm/data/calendar.d.mts +26 -39
  428. package/src/foundry/client-esm/data/client-backend.d.mts +6 -6
  429. package/src/foundry/client-esm/data/region-behaviors/adjust-darkness-level.d.mts +1 -1
  430. package/src/foundry/client-esm/data/region-behaviors/base.d.mts +5 -5
  431. package/src/foundry/client-esm/data/region-behaviors/display-scrolling-text.d.mts +2 -2
  432. package/src/foundry/client-esm/data/terrain-data.d.mts +1 -1
  433. package/src/foundry/client-esm/dice/parser.d.mts +5 -27
  434. package/src/foundry/client-esm/dice/roll.d.mts +63 -80
  435. package/src/foundry/client-esm/dice/terms/coin.d.mts +4 -8
  436. package/src/foundry/client-esm/dice/terms/dice.d.mts +85 -64
  437. package/src/foundry/client-esm/dice/terms/die.d.mts +7 -7
  438. package/src/foundry/client-esm/dice/terms/fate.d.mts +5 -5
  439. package/src/foundry/client-esm/dice/terms/function.d.mts +13 -16
  440. package/src/foundry/client-esm/dice/terms/numeric.d.mts +2 -4
  441. package/src/foundry/client-esm/dice/terms/operator.d.mts +1 -1
  442. package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +8 -9
  443. package/src/foundry/client-esm/dice/terms/pool.d.mts +13 -28
  444. package/src/foundry/client-esm/dice/terms/string.d.mts +3 -3
  445. package/src/foundry/client-esm/dice/terms/term.d.mts +10 -5
  446. package/src/foundry/client-esm/dice/twister.d.mts +3 -3
  447. package/src/foundry/client-esm/documents/_module.d.mts +1 -1
  448. package/src/foundry/client-esm/helpers/_types.d.mts +12 -46
  449. package/src/foundry/client-esm/helpers/compendium-art.d.mts +57 -4
  450. package/src/foundry/client-esm/packages/_module.d.mts +1 -1
  451. package/src/foundry/client-esm/packages/_types.d.mts +2 -0
  452. package/src/foundry/client-esm/utils/_module.d.mts +1 -1
  453. package/src/foundry/client-esm/utils/_types.d.mts +2 -1
  454. package/src/foundry/common/_types.d.mts +1 -1
  455. package/src/foundry/common/abstract/_module.d.mts +1 -0
  456. package/src/foundry/common/abstract/_types.d.mts +60 -54
  457. package/src/foundry/common/abstract/backend.d.mts +28 -16
  458. package/src/foundry/common/abstract/data.d.mts +133 -116
  459. package/src/foundry/common/abstract/document.d.mts +1233 -440
  460. package/src/foundry/common/abstract/embedded-collection.d.mts +2 -2
  461. package/src/foundry/common/abstract/singleton-collection.d.mts +1 -1
  462. package/src/foundry/common/abstract/type-data.d.mts +35 -43
  463. package/src/foundry/common/config.d.mts +3 -3
  464. package/src/foundry/common/constants.d.mts +27 -26
  465. package/src/foundry/common/data/_types.d.mts +2 -0
  466. package/src/foundry/common/data/data.d.mts +189 -87
  467. package/src/foundry/common/data/fields.d.mts +579 -258
  468. package/src/foundry/common/data/validation-failure.d.mts +9 -4
  469. package/src/foundry/common/documents/_types.d.mts +16 -9
  470. package/src/foundry/common/documents/active-effect.d.mts +280 -180
  471. package/src/foundry/common/documents/actor-delta.d.mts +317 -70
  472. package/src/foundry/common/documents/actor.d.mts +304 -103
  473. package/src/foundry/common/documents/adventure.d.mts +254 -140
  474. package/src/foundry/common/documents/ambient-light.d.mts +267 -76
  475. package/src/foundry/common/documents/ambient-sound.d.mts +267 -110
  476. package/src/foundry/common/documents/card.d.mts +267 -176
  477. package/src/foundry/common/documents/cards.d.mts +299 -128
  478. package/src/foundry/common/documents/chat-message.d.mts +276 -160
  479. package/src/foundry/common/documents/combat.d.mts +300 -91
  480. package/src/foundry/common/documents/combatant.d.mts +283 -88
  481. package/src/foundry/common/documents/drawing.d.mts +286 -207
  482. package/src/foundry/common/documents/fog-exploration.d.mts +258 -72
  483. package/src/foundry/common/documents/folder.d.mts +248 -85
  484. package/src/foundry/common/documents/item.d.mts +305 -101
  485. package/src/foundry/common/documents/journal-entry-page.d.mts +279 -190
  486. package/src/foundry/common/documents/journal-entry.d.mts +294 -70
  487. package/src/foundry/common/documents/macro.d.mts +254 -134
  488. package/src/foundry/common/documents/measured-template.d.mts +293 -137
  489. package/src/foundry/common/documents/note.d.mts +274 -151
  490. package/src/foundry/common/documents/playlist-sound.d.mts +260 -96
  491. package/src/foundry/common/documents/playlist.d.mts +279 -122
  492. package/src/foundry/common/documents/region-behavior.d.mts +305 -64
  493. package/src/foundry/common/documents/region.d.mts +309 -90
  494. package/src/foundry/common/documents/roll-table.d.mts +286 -104
  495. package/src/foundry/common/documents/scene.d.mts +276 -344
  496. package/src/foundry/common/documents/setting.d.mts +229 -55
  497. package/src/foundry/common/documents/table-result.d.mts +267 -96
  498. package/src/foundry/common/documents/tile.d.mts +301 -172
  499. package/src/foundry/common/documents/token.d.mts +350 -452
  500. package/src/foundry/common/documents/user.d.mts +256 -146
  501. package/src/foundry/common/documents/wall.d.mts +272 -157
  502. package/src/foundry/common/grid/_types.d.mts +2 -0
  503. package/src/foundry/common/grid/base.d.mts +58 -37
  504. package/src/foundry/common/grid/hexagonal.d.mts +19 -19
  505. package/src/foundry/common/grid/square.d.mts +1 -1
  506. package/src/foundry/common/packages/_module.d.mts +5 -5
  507. package/src/foundry/common/packages/_types.d.mts +2 -0
  508. package/src/foundry/common/packages/base-module.d.mts +6 -24
  509. package/src/foundry/common/packages/base-package.d.mts +18 -16
  510. package/src/foundry/common/packages/base-system.d.mts +6 -78
  511. package/src/foundry/common/packages/base-world.d.mts +7 -60
  512. package/src/foundry/common/packages/sub-types.d.mts +1 -1
  513. package/src/foundry/common/primitives/array.d.mts +3 -3
  514. package/src/foundry/common/primitives/math.d.mts +7 -1
  515. package/src/foundry/common/primitives/number.d.mts +1 -1
  516. package/src/foundry/common/primitives/set.d.mts +17 -14
  517. package/src/foundry/common/prosemirror/_types.d.mts +2 -0
  518. package/src/foundry/common/prosemirror/dropdown.d.mts +1 -1
  519. package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +1 -1
  520. package/src/foundry/common/prosemirror/menu.d.mts +3 -3
  521. package/src/foundry/common/prosemirror/plugin.d.mts +1 -1
  522. package/src/foundry/common/prosemirror/schema/index.d.mts +0 -1
  523. package/src/foundry/common/prosemirror/util.d.mts +1 -1
  524. package/src/foundry/common/utils/bitmask.d.mts +4 -1
  525. package/src/foundry/common/utils/collection.d.mts +59 -24
  526. package/src/foundry/common/utils/event-emitter.d.mts +46 -19
  527. package/src/foundry/common/utils/helpers.d.mts +13 -13
  528. package/src/foundry/common/utils/http.d.mts +2 -2
  529. package/src/foundry/common/utils/string-tree.d.mts +45 -39
  530. package/src/foundry/common/utils/word-tree.d.mts +10 -23
  531. package/src/tsconfig.json +1 -5
  532. package/src/types/augments/pixi.d.mts +28 -28
  533. package/src/types/config.d.mts +12 -12
  534. package/src/types/documentConfiguration.d.mts +282 -597
  535. package/src/types/lib.d.mts +4 -4
  536. package/src/types/workers/image-compressor.d.mts +1 -1
  537. package/src/utils/index.d.mts +255 -60
  538. package/tsconfig.json +29 -0
  539. package/tsconfig.main.json +8 -0
  540. package/tsconfig.miscellaneous.json +16 -0
  541. package/src/foundry/client/apps/placeables/light-config.d.mts +0 -100
  542. package/src/foundry/client/apps/placeables/sound-config.d.mts +0 -44
  543. package/src/foundry/common/documents/module.d.mts +0 -35
@@ -1,8 +1,9 @@
1
1
  import type {
2
- ConfiguredDocuments,
2
+ ConfigurationFailure,
3
+ ConfiguredDocumentClass,
4
+ ConfiguredDocumentInstance,
3
5
  ConfiguredMetadata,
4
- DefaultDocuments,
5
- ConstructorData,
6
+ CreateData,
6
7
  } from "../../../types/documentConfiguration.d.mts";
7
8
  import type {
8
9
  GetKey,
@@ -11,26 +12,39 @@ import type {
11
12
  MustConform,
12
13
  ToMethod,
13
14
  AnyObject,
14
- DeepPartial,
15
15
  EmptyObject,
16
16
  InexactPartial,
17
17
  RemoveIndexSignatures,
18
18
  FixedInstanceType,
19
- } from "../../../utils/index.d.mts";
19
+ NullishProps,
20
+ AllKeysOf,
21
+ DiscriminatedUnion,
22
+ SimpleMerge,
23
+ PickValue,
24
+ Identity,
25
+ Brand,
26
+ } from "fvtt-types/utils";
20
27
  import type * as CONST from "../constants.mts";
21
- import type { DataField, EmbeddedCollectionField, EmbeddedDocumentField } from "../data/fields.d.mts";
28
+ import type {
29
+ DataField,
30
+ DocumentStatsField,
31
+ EmbeddedCollectionField,
32
+ EmbeddedDocumentField,
33
+ SchemaField,
34
+ TypeDataField,
35
+ } from "../data/fields.d.mts";
22
36
  import type { fields } from "../data/_module.d.mts";
23
37
  import type { LogCompatibilityWarningOptions } from "../utils/logging.mts";
24
38
  import type {
25
39
  DatabaseAction,
26
40
  DatabaseCreateOperation,
27
41
  DatabaseDeleteOperation,
28
- DatabaseGetOperation,
29
42
  DatabaseUpdateOperation,
30
43
  DocumentSocketRequest,
31
44
  } from "./_types.d.mts";
32
45
  import type DataModel from "./data.mts";
33
46
  import type DocumentSocketResponse from "./socket.d.mts";
47
+ import type EmbeddedCollection from "./embedded-collection.d.mts";
34
48
 
35
49
  type DataSchema = foundry.data.fields.DataSchema;
36
50
 
@@ -39,14 +53,21 @@ export default Document;
39
53
  type _ClassMustBeAssignableToInternal = MustConform<typeof Document, Document.Internal.Constructor>;
40
54
  type _InstanceMustBeAssignableToInternal = MustConform<Document.Any, Document.Internal.Instance.Any>;
41
55
 
42
- type _ConfigurationFailureClassMustBeAssignableToInternal = MustConform<
43
- Document.ConfigurationFailureClass,
44
- Document.Internal.Constructor
45
- >;
46
- type _ConfigurationFailureInstanceMustBeAssignableToInternal = MustConform<
47
- Document.ConfigurationFailureInstance,
48
- Document.Internal.Instance.Any
49
- >;
56
+ // Note(LukeAbby): Properties from `Schema` technically derive from `DataModel`. This means that if
57
+ // `name?: string` etc. were to be put in `Document` directly they'd actually override the schema.
58
+ // Therefore this workaround is used to force `DataModel` to override the properties.
59
+ declare const _InternalDocument: (new (...args: any[]) => {
60
+ name?: string | undefined;
61
+
62
+ // `{}` is used so that `{}` and the actual shape of `system` are merged.
63
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
64
+ system?: {} | undefined;
65
+ _stats?: DocumentStatsField.InitializedData | undefined;
66
+
67
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
68
+ flags?: {} | undefined;
69
+ }) &
70
+ typeof DataModel;
50
71
 
51
72
  /**
52
73
  * An extension of the base DataModel which defines a Document.
@@ -56,18 +77,16 @@ declare abstract class Document<
56
77
  DocumentName extends Document.Type,
57
78
  Schema extends DataSchema,
58
79
  Parent extends Document.Any | null = null,
59
- > extends DataModel<Schema, Parent, InterfaceToObject<Document.ConstructionContext<Parent>>> {
60
- static [Document.Internal.DocumentBrand]: true;
61
-
62
- [Document.Internal.DocumentName]: DocumentName;
63
- [Document.Internal.Schema]: Schema;
64
- [Document.Internal.Parent]: Parent;
65
-
80
+ > extends _InternalDocument<Schema, Parent, InterfaceToObject<Document.ConstructionContext<Parent>>> {
66
81
  /**
67
82
  * @param data - Initial data provided to construct the Document
68
83
  * @param context - Construction context options
69
84
  */
70
- constructor(data?: fields.SchemaField.InnerConstructorType<Schema>, context?: Document.ConstructionContext<Parent>);
85
+ // Note: The constructor has been replaced with `never` in `Document` itself because it never makes
86
+ // sense to try to construct `new Document(...)` directly. Not only is it an abstract class but
87
+ // also it varies based upon the `Schema`. While this could be supported it also simplifies
88
+ // typechecking and helps stymy circularities.
89
+ constructor(...args: never);
71
90
 
72
91
  override parent: Parent;
73
92
 
@@ -79,7 +98,7 @@ declare abstract class Document<
79
98
  /**
80
99
  * An immutable reverse-reference to the name of the collection that this Document exists in on its parent, if any.
81
100
  */
82
- readonly parentCollection: string | null;
101
+ readonly parentCollection: Document.MetadataFor<DocumentName>["collection"] | null;
83
102
 
84
103
  /**
85
104
  * An immutable reference to a containing Compendium collection to which this Document belongs.
@@ -127,7 +146,7 @@ declare abstract class Document<
127
146
  * }
128
147
  * ```
129
148
  */
130
- static metadata: Readonly<Document.Metadata.Any>;
149
+ static metadata: Document.Metadata.Any;
131
150
 
132
151
  /**
133
152
  * The database backend used to execute operations and handle results
@@ -152,7 +171,7 @@ declare abstract class Document<
152
171
  /**
153
172
  * The named collection to which this Document belongs.
154
173
  */
155
- get collectionName(): Document.Internal.SimpleMetadata<DocumentName>["collection"];
174
+ get collectionName(): Document.MetadataFor<DocumentName>["collection"];
156
175
 
157
176
  /**
158
177
  * The canonical name of this Document type, for example "Actor".
@@ -166,19 +185,18 @@ declare abstract class Document<
166
185
 
167
186
  /**
168
187
  * The allowed types which may exist for this Document class
169
- * @remarks Document.TYPES is overly generic so subclasses don't cause problems
170
188
  */
171
189
  static get TYPES(): string[];
172
190
 
173
191
  /**
174
192
  * Does this Document support additional subtypes?
175
193
  */
176
- static get hasTypeData(): boolean;
194
+ static get hasTypeData(): undefined | true;
177
195
 
178
196
  /**
179
197
  * The Embedded Document hierarchy for this Document.
180
198
  */
181
- static get hierarchy(): Record<string, EmbeddedCollectionField<any, any> | EmbeddedDocumentField<any>>;
199
+ static get hierarchy(): Record<string, EmbeddedCollectionField.Any | EmbeddedDocumentField.Any>;
182
200
 
183
201
  /**
184
202
  * Identify the collection in a parent Document that this Document exists belongs to, if any.
@@ -206,7 +224,7 @@ declare abstract class Document<
206
224
  * @param user - The User being tested
207
225
  * @returns Does the User have a sufficient role to create?
208
226
  */
209
- static canUserCreate(user: User): boolean;
227
+ static canUserCreate(user: User.Internal.Implementation): boolean;
210
228
 
211
229
  /**
212
230
  * Get the explicit permission level that a specific User has over this Document, a value in CONST.DOCUMENT_OWNERSHIP_LEVELS.
@@ -216,7 +234,7 @@ declare abstract class Document<
216
234
  * (default: `game.user`)
217
235
  * @returns A numeric permission level from CONST.DOCUMENT_OWNERSHIP_LEVELS or null
218
236
  */
219
- getUserLevel(user?: User): CONST.DOCUMENT_OWNERSHIP_LEVELS | null;
237
+ getUserLevel(user?: User.Internal.Implementation): CONST.DOCUMENT_OWNERSHIP_LEVELS | null;
220
238
 
221
239
  /**
222
240
  * Test whether a certain User has a requested permission level (or greater) over the Document
@@ -225,16 +243,11 @@ declare abstract class Document<
225
243
  * @param options - Additional options involved in the permission test
226
244
  * @returns Does the user have this permission level over the Document?
227
245
  */
246
+ // options: not null (destructured)
228
247
  testUserPermission(
229
- user: User,
230
- permission: keyof typeof CONST.DOCUMENT_OWNERSHIP_LEVELS | CONST.DOCUMENT_OWNERSHIP_LEVELS,
231
- options?: InexactPartial<{
232
- /**
233
- * Require the exact permission level requested?
234
- * @defaultValue `false`
235
- */
236
- exact: boolean;
237
- }>,
248
+ user: User.Internal.Implementation,
249
+ permission: Document.TestableOwnershipLevel,
250
+ options?: Document.TestUserPermissionOptions,
238
251
  ): boolean;
239
252
 
240
253
  /**
@@ -245,7 +258,11 @@ declare abstract class Document<
245
258
  * (default: `{}`)
246
259
  * @returns Does the User have permission?
247
260
  */
248
- canUserModify(user: User, action: "create" | "update" | "delete", data?: object): boolean;
261
+ canUserModify<Action extends "create" | "update" | "delete">(
262
+ user: User.Internal.Implementation,
263
+ action: Action,
264
+ data?: Document.CanUserModifyData<Schema, Action>,
265
+ ): boolean;
249
266
 
250
267
  /**
251
268
  * Clone a document, creating a new document by combining current data with provided overrides.
@@ -255,28 +272,8 @@ declare abstract class Document<
255
272
  * @returns The cloned Document instance
256
273
  */
257
274
  override clone<Save extends boolean = false>(
258
- data?: fields.SchemaField.AssignmentType<Schema, EmptyObject>,
259
- context?: InexactPartial<
260
- {
261
- /**
262
- * Save the clone to the World database?
263
- * @defaultValue `false`
264
- */
265
- save: Save;
266
-
267
- /**
268
- * Keep the same ID of the original document
269
- * @defaultValue `false`
270
- */
271
- keepId: boolean;
272
-
273
- /**
274
- * Track the clone source
275
- * @defaultValue `false`
276
- */
277
- addSource: boolean;
278
- } & Document.ConstructionContext<this["parent"]>
279
- >, // FIXME(LukeAbby): Adding Document.Stored to the return causes a recursive type error in Scene
275
+ data?: fields.SchemaField.UpdateData<Schema>,
276
+ context?: Document.CloneContext<Save> & InexactPartial<Document.ConstructionContext<Parent>>,
280
277
  ): Save extends true ? Promise<this> : this;
281
278
 
282
279
  /**
@@ -286,8 +283,9 @@ declare abstract class Document<
286
283
  */
287
284
  migrateSystemData(): object;
288
285
 
289
- override toObject(source: true): this["_source"];
290
- override toObject(source?: boolean): ReturnType<this["schema"]["toObject"]>;
286
+ override toObject<Source extends boolean | undefined>(
287
+ source?: Source,
288
+ ): Source extends false ? SchemaField.SourceData<Schema> : Readonly<SchemaField.SourceData<Schema>>;
291
289
 
292
290
  /**
293
291
  * Create multiple Documents using provided input data.
@@ -323,16 +321,12 @@ declare abstract class Document<
323
321
  * const data = [{name: "Compendium Actor", type: "character", img: "path/to/profile.jpg"}];
324
322
  * const created = await Actor.createDocuments(data, {pack: "mymodule.mypack"});
325
323
  * ```
324
+ *
325
+ * @remarks If a document is skipped by a hook or `_preCreate` then that element is skipped in the
326
+ * return type. This means that you receive only documents that were actually created.
326
327
  */
327
- static createDocuments<T extends Document.AnyConstructor, Temporary extends boolean | undefined>(
328
- this: T,
329
- data: Array<Document.ConstructorDataFor<NoInfer<T>>>,
330
- operation?: InexactPartial<
331
- Omit<Document.Database.OperationOf<NoInfer<T>["metadata"]["name"], "create">, "data">
332
- > & {
333
- temporary?: Temporary;
334
- },
335
- ): Promise<Document.ToStoredIf<T, Temporary>[] | undefined>;
328
+ // Note: This uses `never` because it's unsound to try to do `Document.createDocuments` directly.
329
+ static createDocuments(data: never, operation?: never): Promise<Document.Any[]>;
336
330
 
337
331
  /**
338
332
  * Update multiple Document instances using provided differential data.
@@ -368,14 +362,12 @@ declare abstract class Document<
368
362
  * const actor = await pack.getDocument(documentId);
369
363
  * const updated = await Actor.updateDocuments([{_id: actor.id, name: "New Name"}], {pack: "mymodule.mypack"});
370
364
  * ```
365
+ *
366
+ * @remarks If a document is skipped by a hook or `_preCreate` then that element is skipped in the
367
+ * return type. This means that you receive only documents that were actually updated.
371
368
  */
372
- static updateDocuments<T extends Document.AnyConstructor>(
373
- this: T,
374
- updates?: Array<DeepPartial<Document.UpdateDataFor<NoInfer<T>>>>,
375
- operation?: InexactPartial<
376
- Omit<Document.Database.OperationOf<FixedInstanceType<NoInfer<T>>["documentName"], "update">, "updates">
377
- >,
378
- ): Promise<Document.ToConfiguredInstance<T>[]>;
369
+ // Note: This uses `never` because it's unsound to try to do `Document.updateDocuments`
370
+ static updateDocuments(updates: never, operation?: never): Promise<Document.Any[]>;
379
371
 
380
372
  /**
381
373
  * Delete one or multiple existing Documents using an array of provided ids.
@@ -413,18 +405,16 @@ declare abstract class Document<
413
405
  * const actor = await pack.getDocument(documentId);
414
406
  * const deleted = await Actor.deleteDocuments([actor.id], {pack: "mymodule.mypack"});
415
407
  * ```
408
+ *
409
+ * @remarks If a document is skipped by a hook or `_preDelete` then that element is skipped in the
410
+ * return type. This means that you receive only documents that were actually deleted.
416
411
  */
417
- static deleteDocuments<T extends Document.AnyConstructor>(
418
- this: T,
419
- ids?: string[],
420
- operation?: InexactPartial<
421
- Omit<Document.Database.OperationOf<FixedInstanceType<NoInfer<T>>["documentName"], "delete">, "ids">
422
- >,
423
- ): Promise<Document.ToConfiguredInstance<T>[]>;
412
+ // Note: This uses `never` because it's unsound to try to pass the operation for `Document.deleteDocument`
413
+ static deleteDocuments(ids?: readonly string[], operation?: never): Promise<Document.Any[]>;
424
414
 
425
415
  /**
426
416
  * Create a new Document using provided input data, saving it to the database.
427
- * @see {@link Document.createDocuments}
417
+ * @see {@link Document.createDocuments | `Document.createDocuments`}
428
418
  * @param data - Initial data used to create this Document, or a Document instance to persist.
429
419
  * @param operation - Parameters of the creation operation
430
420
  * (default: `{}`)
@@ -449,55 +439,47 @@ declare abstract class Document<
449
439
  * const created = await Item.create(data, {pack: "mymodule.mypack"});
450
440
  * ```
451
441
  *
452
- * @remarks If no document has actually been created, the returned {@link Promise} resolves to `undefined`.
442
+ * @remarks If the document creation is skipped by a hook or `_preCreate` then `undefined` is
443
+ * returned.
453
444
  */
454
- static create<T extends Document.AnyConstructor, Temporary extends boolean | undefined>(
455
- this: T,
456
- data: Document.ConstructorDataFor<NoInfer<T>> | Document.ConstructorDataFor<NoInfer<T>>[],
457
- operation?: InexactPartial<
458
- Omit<Document.Database.OperationOf<NoInfer<T>["metadata"]["name"], "create">, "data">
459
- > & {
460
- temporary?: Temporary;
461
- },
462
- ): Promise<Document.ToStoredIf<T, Temporary> | undefined>;
445
+ // Note: This uses `never` because it's unsound to try to call `Document.create` directly.
446
+ static create(data: never, operation?: never): Promise<Document.Any | undefined>;
463
447
 
464
448
  /**
465
449
  * Update this Document using incremental data, saving it to the database.
466
- * @see {@link Document.updateDocuments}
450
+ * @see {@link Document.updateDocuments | `Document.updateDocuments`}
467
451
  * @param data - Differential update data which modifies the existing values of this document data
468
452
  * (default: `{}`)
469
453
  * @param operation - Parameters of the update operation
470
454
  * (default: `{}`)
471
455
  * @returns The updated Document instance
472
456
  *
473
- * @remarks If no document has actually been updated, the returned {@link Promise} resolves to `undefined`.
457
+ * @remarks If the document update is skipped by a hook or `_preUpdate` then `undefined` is
458
+ * returned.
474
459
  */
475
- update(
476
- // TODO: Determine if this is Partial, DeepPartial, or InexactPartial.
477
- data?: Partial<Document.ConstructorDataForSchema<Schema>>,
478
- operation?: InexactPartial<Omit<Document.Database.OperationOf<DocumentName, "update">, "updates">>,
479
- ): Promise<this | undefined>;
460
+ // Note: This uses `never` because it's unsound to try to call `Document#update` directly.
461
+ update(data: never, operation: never): Promise<this | undefined>;
480
462
 
481
463
  /**
482
464
  * Delete this Document, removing it from the database.
483
- * @see {@link Document.deleteDocuments}
465
+ * @see {@link Document.deleteDocuments | `Document.deleteDocuments`}
484
466
  * @param operation - Parameters of the deletion operation
485
467
  * (default: `{}`)
486
468
  * @returns The deleted Document instance
487
469
  *
488
- * @remarks If no document has actually been deleted, the returned {@link Promise} resolves to `undefined`.
470
+ * @remarks If the document deletion is skipped by a hook or `_preUpdate` then `undefined` is
471
+ * returned.
489
472
  */
490
- delete(
491
- operation?: InexactPartial<Omit<Document.Database.OperationOf<DocumentName, "delete">, "ids">>,
492
- ): Promise<this | undefined>;
473
+ // Note: This uses `never` because it's unsound to try to call `Document#delete` directly.
474
+ delete(operation: never): Promise<this | undefined>;
493
475
 
494
476
  /**
495
477
  * Get a World-level Document of this type by its id.
496
478
  * @param documentId - The Document ID
497
- * @param options - Additional options which customize the request
479
+ * @param operation - Additional options which customize the request
498
480
  * @returns The retrieved Document, or null
499
481
  */
500
- static get(documentId: string, options?: InexactPartial<DatabaseGetOperation>): Document.Any | null;
482
+ static get(documentId: string, operation?: Document.Database.GetOptions): Document.Any | null;
501
483
 
502
484
  /**
503
485
  * A compatibility method that returns the appropriate name of an embedded collection within this Document.
@@ -516,7 +498,7 @@ declare abstract class Document<
516
498
  * // returns "items"
517
499
  * ```
518
500
  */
519
- static getCollectionName(name: string): string | null;
501
+ static getCollectionName(name: never): string | null;
520
502
 
521
503
  /**
522
504
  * Obtain a reference to the Array of source data within the data object for a certain embedded Document name
@@ -524,9 +506,8 @@ declare abstract class Document<
524
506
  * @returns The Collection instance of embedded Documents of the requested type
525
507
  * @remarks Usually returns some form of DocumentCollection, but not always (e.g. Token["actors"])
526
508
  */
527
- getEmbeddedCollection<EmbeddedName extends foundry.CONST.EMBEDDED_DOCUMENT_TYPES>(
528
- embeddedName: EmbeddedName,
529
- ): Collection<Document.ConfiguredInstanceForName<EmbeddedName>>;
509
+ // Note: This uses `never` because it's unsound to try to call `Document#getEmbeddedCollection` directly.
510
+ getEmbeddedCollection(embeddedName: never): unknown;
530
511
 
531
512
  /**
532
513
  * Get an embedded document by its id from a named collection in the parent document.
@@ -536,26 +517,16 @@ declare abstract class Document<
536
517
  * @returns The retrieved embedded Document instance, or undefined
537
518
  * @throws If the embedded collection does not exist, or if strict is true and the Embedded Document could not be found.
538
519
  */
520
+ // Note: This uses `never` because it's unsound to try to call `Document#getEmbeddedDocument` directly.
539
521
  getEmbeddedDocument(
540
- embeddedName: string,
522
+ embeddedName: never,
541
523
  id: string,
542
- options: InexactPartial<{
543
- /**
544
- * Throw an Error if the requested id does not exist. See Collection#get
545
- * @defaultValue `false`
546
- */
547
- strict: boolean;
548
- /**
549
- * Allow retrieving an invalid Embedded Document.
550
- * @defaultValue `false`
551
- */
552
- invalid: boolean;
553
- }>,
554
- ): Document.AnyChild<this> | undefined;
524
+ options: Document.GetEmbeddedDocumentOptions,
525
+ ): Document.Any | undefined;
555
526
 
556
527
  /**
557
528
  * Create multiple embedded Document instances within this parent Document using provided input data.
558
- * @see {@link Document.createDocuments}
529
+ * @see {@link Document.createDocuments | `Document.createDocuments`}
559
530
  * @param embeddedName - The name of the embedded Document type
560
531
  * @param data - An array of data objects used to create multiple documents
561
532
  * (default: `[]`)
@@ -563,23 +534,18 @@ declare abstract class Document<
563
534
  * (default: `{}`)
564
535
  * @returns An array of created Document instances
565
536
  */
566
- // TODO: I think we could do a better job on all the embedded methods of limiting the types here based on the
567
- // allowed embedded types of the parent (vs. allowing any document to create embedded
568
- // documents of any type)
569
- createEmbeddedDocuments<
570
- EmbeddedName extends foundry.CONST.EMBEDDED_DOCUMENT_TYPES,
571
- Temporary extends boolean | undefined,
572
- >(
573
- embeddedName: EmbeddedName,
574
- data?: Array<Document.ConstructorDataForName<Extract<EmbeddedName, Document.Type>>>,
575
- operation?: InexactPartial<Document.Database.OperationOf<Extract<EmbeddedName, Document.Type>, "create">> & {
576
- temporary?: Temporary;
577
- },
578
- ): Promise<Array<Document.ConfiguredInstanceForName<Extract<EmbeddedName, Document.Type>>> | undefined>;
537
+ // Note: This uses `never` because it's unsound to try to call `Document#createEmbeddedDocuments` directly.
538
+ // Note(LukeAbby): Returns `unknown` instead of `Promise<Array<Document.AnyStored> | undefined>` to stymy errors.
539
+ createEmbeddedDocuments(
540
+ embeddedName: never,
541
+ // Note: Not optional because `createEmbeddedDocuments("Actor")` does effectively nothing.
542
+ data: never,
543
+ operation?: never,
544
+ ): unknown;
579
545
 
580
546
  /**
581
547
  * Update multiple embedded Document instances within a parent Document using provided differential data.
582
- * @see {@link Document.updateDocuments}
548
+ * @see {@link Document.updateDocuments | `Document.updateDocuments`}
583
549
  * @param embeddedName - The name of the embedded Document type
584
550
  * @param updates - An array of differential data objects, each used to update a single Document
585
551
  * (default: `[]`)
@@ -587,33 +553,34 @@ declare abstract class Document<
587
553
  * (default: `{}`)
588
554
  * @returns An array of updated Document instances
589
555
  */
590
- updateEmbeddedDocuments<EmbeddedName extends foundry.CONST.EMBEDDED_DOCUMENT_TYPES>(
591
- embeddedName: EmbeddedName,
592
- updates?: Array<AnyObject>,
593
- context?: Document.ModificationContext<this["parent"]>,
594
- ): Promise<Array<Document.Stored<Document.ConfiguredInstanceForName<Extract<EmbeddedName, Document.Type>>>>>;
556
+ // Note: This uses `never` because it's unsound to try to call `Document#updateEmbeddedDocuments` directly.
557
+ // Note(LukeAbby): Returns `unknown` instead of `Promise<Array<Document.AnyStored> | undefined>` to stymy errors.
558
+ updateEmbeddedDocuments(
559
+ embeddedName: never,
560
+ // Note: Not optional because `updateEmbeddedDocuments("Actor")` does effectively nothing.
561
+ updates: never,
562
+ context?: never,
563
+ ): unknown;
595
564
 
596
565
  /**
597
566
  * Delete multiple embedded Document instances within a parent Document using provided string ids.
598
- * @see {@link Document.deleteDocuments}
567
+ * @see {@link Document.deleteDocuments | `Document.deleteDocuments`}
599
568
  * @param embeddedName - The name of the embedded Document type
600
569
  * @param ids - An array of string ids for each Document to be deleted
601
570
  * @param operation - Parameters of the database deletion workflow
602
571
  * (default: `{}`)
603
572
  * @returns An array of deleted Document instances
604
573
  */
605
- deleteEmbeddedDocuments<EmbeddedName extends foundry.CONST.EMBEDDED_DOCUMENT_TYPES>(
606
- embeddedName: EmbeddedName,
607
- ids: Array<string>,
608
- operation?: Document.Database.OperationOf<DocumentName, "delete">,
609
- ): Promise<Array<Document.Stored<Document.ConfiguredInstanceForName<EmbeddedName>>>>;
574
+ // Note: This uses `never` because it's unsound to try to call `Document#deleteEmbeddedDocuments` directly.
575
+ // Note(LukeAbby): Returns `unknown` instead of `Promise<Array<Document.AnyStored> | undefined>` to stymy errors.
576
+ deleteEmbeddedDocuments(embeddedName: never, ids: Array<string>, operation?: never): unknown;
610
577
 
611
578
  /**
612
579
  * Iterate over all embedded Documents that are hierarchical children of this Document.
613
580
  * @param _parentPath - A parent field path already traversed
614
581
  * @remarks Not called within Foundry's client-side code, likely exists for server documents
615
582
  */
616
- traverseEmbeddedDocuments(_parentPath?: string): Generator<[string, Document.Any]>;
583
+ traverseEmbeddedDocuments(_parentPath?: string): Generator<[string, Document.AnyChild<this>]>;
617
584
 
618
585
  /**
619
586
  * Get the value of a "flag" for this document
@@ -623,10 +590,7 @@ declare abstract class Document<
623
590
  * @param key - The flag key
624
591
  * @returns The flag value
625
592
  */
626
- getFlag<
627
- S extends Document.FlagKeyOf<Document.ConfiguredFlagsForName<DocumentName>>,
628
- K extends Document.FlagKeyOf<Document.FlagGetKey<Document.ConfiguredFlagsForName<DocumentName>, S>>,
629
- >(scope: S, key: K): Document.GetFlag<DocumentName, S, K>;
593
+ getFlag(scope: never, key: never): unknown;
630
594
 
631
595
  /**
632
596
  * Assign a "flag" to this document.
@@ -646,11 +610,7 @@ declare abstract class Document<
646
610
  * @param value - The flag value
647
611
  * @returns A Promise resolving to the updated document
648
612
  */
649
- setFlag<
650
- S extends Document.FlagKeyOf<Document.ConfiguredFlagsForName<DocumentName>>,
651
- K extends Document.FlagKeyOf<Document.FlagGetKey<Document.ConfiguredFlagsForName<DocumentName>, S>>,
652
- V extends Document.GetFlag<DocumentName, S, K>,
653
- >(scope: S, key: K, value: V): Promise<this>;
613
+ setFlag(scope: never, key: never, value: never): Promise<this>;
654
614
 
655
615
  /**
656
616
  * Remove a flag assigned to the document
@@ -658,22 +618,18 @@ declare abstract class Document<
658
618
  * @param key - The flag key
659
619
  * @returns The updated document instance
660
620
  */
661
- unsetFlag(scope: string, key: string): Promise<this>;
621
+ unsetFlag(scope: never, key: never): Promise<this>;
662
622
 
663
623
  /**
664
624
  * Pre-process a creation operation for a single Document instance.
665
625
  * Pre-operation events only occur for the client which requested the operation.
666
- * Modifications to the pending Document instance must be performed using {@link Document#updateSource}.
626
+ * Modifications to the pending Document instance must be performed using {@link Document.updateSource | `Document#updateSource`}.
667
627
  * @param data - The initial data object provided to the document creation request
668
628
  * @param options - Additional options which modify the creation request
669
629
  * @param user - The User requesting the document creation
670
630
  * @returns Return false to exclude this Document from the creation operation
671
631
  */
672
- protected _preCreate(
673
- data: fields.SchemaField.AssignmentType<Schema>,
674
- options: Document.PreCreateOptions<DocumentName>,
675
- user: User,
676
- ): Promise<boolean | void>;
632
+ protected _preCreate(data: never, options: never, user: User.Internal.Implementation): Promise<boolean | void>;
677
633
 
678
634
  /**
679
635
  * Post-process a creation operation for a single Document instance.
@@ -682,48 +638,44 @@ declare abstract class Document<
682
638
  * @param options - Additional options which modify the creation request
683
639
  * @param userId - The id of the User requesting the document update
684
640
  */
685
- protected _onCreate(
686
- data: fields.SchemaField.InnerAssignmentType<Schema>,
687
- options: Document.OnCreateOptions<DocumentName>,
688
- userId: string,
689
- ): void;
641
+ protected _onCreate(data: never, options: never, userId: string): void;
690
642
 
691
643
  /**
692
644
  * Pre-process a creation operation, potentially altering its instructions or input data. Pre-operation events only
693
645
  * occur for the client which requested the operation.
694
646
  *
695
- * This batch-wise workflow occurs after individual {@link Document#_preCreate} workflows and provides a final
647
+ * This batch-wise workflow occurs after individual {@link Document._preCreate | `Document#_preCreate`} workflows and provides a final
696
648
  * pre-flight check before a database operation occurs.
697
649
  *
698
650
  * Modifications to pending documents must mutate the documents array or alter individual document instances using
699
- * {@link Document#updateSource}.
651
+ * {@link Document.updateSource | `Document#updateSource`}.
700
652
  * @param documents - Pending document instances ot be created
701
653
  * @param operation - Parameters of the database creation operation
702
654
  * @param user - The User requesting the creation operation
703
655
  * @returns Return false to cancel the creation operation entirely
704
656
  */
705
- protected static _preCreateOperation<T extends Document.AnyConstructor>(
706
- this: T,
707
- documents: Document.ToConfiguredInstance<NoInfer<T>>[],
708
- operation: Document.Database.OperationOf<NoInfer<T>["metadata"]["name"], "create">,
709
- user: User,
657
+ // Note: This uses `never` because it's unsound to try to do `Document._preCreateOperation` directly.
658
+ protected static _preCreateOperation(
659
+ documents: never[],
660
+ operation: never,
661
+ user: User.Internal.Implementation,
710
662
  ): Promise<boolean | void>;
711
663
 
712
664
  /**
713
665
  * Post-process a creation operation, reacting to database changes which have occurred. Post-operation events occur
714
666
  * for all connected clients.
715
667
  *
716
- * This batch-wise workflow occurs after individual {@link Document#_onCreate} workflows.
668
+ * This batch-wise workflow occurs after individual {@link Document._onCreate | `Document#_onCreate`} workflows.
717
669
  *
718
670
  * @param documents - The Document instances which were created
719
671
  * @param operation - Parameters of the database creation operation
720
672
  * @param user - The User who performed the creation operation
721
673
  */
722
- protected static _onCreateOperation<T extends Document.AnyConstructor>(
723
- this: T,
724
- documents: Document.ToConfiguredInstance<NoInfer<T>>[],
725
- operation: Document.Database.OperationOf<NoInfer<T>["metadata"]["name"], "create">,
726
- user: User,
674
+ // Note: This uses `never` because it's unsound to try to do `Document._onCreateOperation` directly.
675
+ protected static _onCreateOperation(
676
+ documents: never,
677
+ operation: never,
678
+ user: User.Internal.Implementation,
727
679
  ): Promise<void>;
728
680
 
729
681
  /**
@@ -734,11 +686,7 @@ declare abstract class Document<
734
686
  * @param user - The User requesting the document update
735
687
  * @returns A return value of false indicates the update operation should be cancelled
736
688
  */
737
- protected _preUpdate(
738
- changed: fields.SchemaField.AssignmentType<Schema>,
739
- options: Document.PreUpdateOptions<DocumentName>,
740
- user: User,
741
- ): Promise<boolean | void>;
689
+ protected _preUpdate(changed: never, options: never, user: User.Internal.Implementation): Promise<boolean | void>;
742
690
 
743
691
  /**
744
692
  * Perform follow-up operations after a Document of this type is updated.
@@ -747,49 +695,45 @@ declare abstract class Document<
747
695
  * @param options - Additional options which modify the update request
748
696
  * @param userId - The id of the User requesting the document update
749
697
  */
750
- protected _onUpdate(
751
- changed: fields.SchemaField.InnerUpdateData<Schema>,
752
- options: Document.OnUpdateOptions<DocumentName>,
753
- userId: string,
754
- ): void;
698
+ protected _onUpdate(changed: never, options: never, userId: string): void;
755
699
 
756
700
  /**
757
701
  * Pre-process an update operation, potentially altering its instructions or input data. Pre-operation events only
758
702
  * occur for the client which requested the operation.
759
703
  *
760
- * This batch-wise workflow occurs after individual {@link Document#_preUpdate} workflows and provides a final
704
+ * This batch-wise workflow occurs after individual {@link Document._preUpdate | `Document#_preUpdate`} workflows and provides a final
761
705
  * pre-flight check before a database operation occurs.
762
706
  *
763
707
  * Modifications to the requested updates are performed by mutating the data array of the operation.
764
- * {@link Document#updateSource}.
708
+ * {@link Document.updateSource | `Document#updateSource`}.
765
709
  *
766
710
  * @param documents - Document instances to be updated
767
711
  * @param operation - Parameters of the database update operation
768
712
  * @param user - The User requesting the update operation
769
713
  * @returns Return false to cancel the update operation entirely
770
714
  */
771
- protected static _preUpdateOperation<T extends Document.AnyConstructor>(
772
- this: T,
773
- documents: Document.ToConfiguredInstance<NoInfer<T>>[],
774
- operation: Document.Database.OperationOf<FixedInstanceType<NoInfer<T>>["documentName"], "update">,
775
- user: User,
715
+ // Note: This uses `never` because it's unsound to try to do `Document._preUpdateOperation` directly.
716
+ protected static _preUpdateOperation(
717
+ documents: never,
718
+ operation: never,
719
+ user: User.Internal.Implementation,
776
720
  ): Promise<boolean | void>;
777
721
 
778
722
  /**
779
723
  * Post-process an update operation, reacting to database changes which have occurred. Post-operation events occur
780
724
  * for all connected clients.
781
725
  *
782
- * This batch-wise workflow occurs after individual {@link Document#_onUpdate} workflows.
726
+ * This batch-wise workflow occurs after individual {@link Document._onUpdate | `Document#_onUpdate`} workflows.
783
727
  *
784
728
  * @param documents - The Document instances which were updated
785
729
  * @param operation - Parameters of the database update operation
786
730
  * @param user - The User who performed the update operation
787
731
  */
788
- protected static _onUpdateOperation<T extends Document.AnyConstructor>(
789
- this: T,
790
- documents: Document.ToConfiguredInstance<NoInfer<T>>[],
791
- operation: Document.Database.OperationOf<FixedInstanceType<NoInfer<T>>["documentName"], "update">,
792
- user: User,
732
+ // Note: This uses `never` because it's unsound to try to do `Document._onUpdateOperation` directly.
733
+ protected static _onUpdateOperation(
734
+ documents: never,
735
+ operation: never,
736
+ user: User.Internal.Implementation,
793
737
  ): Promise<void>;
794
738
 
795
739
  /**
@@ -799,7 +743,7 @@ declare abstract class Document<
799
743
  * @param user - The User requesting the document deletion
800
744
  * @returns A return value of false indicates the delete operation should be cancelled
801
745
  */
802
- protected _preDelete(options: Document.PreDeleteOptions<DocumentName>, user: User): Promise<boolean | void>;
746
+ protected _preDelete(options: never, user: User.Internal.Implementation): Promise<boolean | void>;
803
747
 
804
748
  /**
805
749
  * Perform follow-up operations after a Document of this type is deleted.
@@ -807,17 +751,17 @@ declare abstract class Document<
807
751
  * @param options - Additional options which modify the deletion request
808
752
  * @param userId - The id of the User requesting the document update
809
753
  */
810
- protected _onDelete(options: Document.OnDeleteOptions<DocumentName>, userId: string): void;
754
+ protected _onDelete(options: never, userId: string): void;
811
755
 
812
756
  /**
813
757
  * Pre-process a deletion operation, potentially altering its instructions or input data. Pre-operation events only
814
758
  * occur for the client which requested the operation.
815
759
  *
816
- * This batch-wise workflow occurs after individual {@link Document#_preDelete} workflows and provides a final
760
+ * This batch-wise workflow occurs after individual {@link Document._preDelete | `Document#_preDelete`} workflows and provides a final
817
761
  * pre-flight check before a database operation occurs.
818
762
  *
819
763
  * Modifications to the requested deletions are performed by mutating the operation object.
820
- * {@link Document#updateSource}.
764
+ * {@link Document.updateSource | `Document#updateSource`}.
821
765
  *
822
766
  * @param documents - Document instances to be deleted
823
767
  * @param operation - Parameters of the database update operation
@@ -825,28 +769,28 @@ declare abstract class Document<
825
769
  * @returns Return false to cancel the deletion operation entirely
826
770
  * @internal
827
771
  */
828
- protected static _preDeleteOperation<T extends Document.AnyConstructor>(
829
- this: T,
830
- documents: Document.ToConfiguredInstance<NoInfer<T>>[],
831
- operation: Document.Database.OperationOf<FixedInstanceType<NoInfer<T>>["documentName"], "delete">,
832
- user: User,
772
+ // Note: This uses `never` because it's unsound to try to do `Document._preDeleteOperation` directly.
773
+ protected static _preDeleteOperation(
774
+ documents: never,
775
+ operation: never,
776
+ user: User.Internal.Implementation,
833
777
  ): Promise<unknown>;
834
778
 
835
779
  /**
836
780
  * Post-process a deletion operation, reacting to database changes which have occurred. Post-operation events occur
837
781
  * for all connected clients.
838
782
  *
839
- * This batch-wise workflow occurs after individual {@link Document#_onDelete} workflows.
783
+ * This batch-wise workflow occurs after individual {@link Document._onDelete | `Document#_onDelete`} workflows.
840
784
  *
841
785
  * @param documents - The Document instances which were deleted
842
786
  * @param operation - Parameters of the database deletion operation
843
787
  * @param user - The User who performed the deletion operation
844
788
  */
845
- protected static _onDeleteOperation<T extends Document.AnyConstructor>(
846
- this: T,
847
- documents: Document.ToConfiguredInstance<NoInfer<T>>[],
848
- operation: Document.Database.OperationOf<FixedInstanceType<NoInfer<T>>["documentName"], "delete">,
849
- user: User,
789
+ // Note: This uses `never` because it's unsound to try to do `Document._onDeleteOperation` directly.
790
+ protected static _onDeleteOperation(
791
+ documents: never,
792
+ operation: never,
793
+ user: User.Internal.Implementation,
850
794
  ): Promise<unknown>;
851
795
 
852
796
  /**
@@ -858,17 +802,22 @@ declare abstract class Document<
858
802
  * @deprecated since v11, will be removed in v13
859
803
  * @remarks "You are accessing `Document.hasSystemData` which is deprecated. Please use `Document.hasTypeData` instead."
860
804
  */
861
- static get hasSystemData(): boolean;
805
+ static get hasSystemData(): undefined | true;
862
806
 
863
807
  /**
864
808
  * A reusable helper for adding migration shims.
865
809
  */
866
- protected static _addDataFieldShims(data: object, shims: object, options: object): unknown;
810
+ protected static _addDataFieldShims(data: AnyObject, shims: AnyObject, options?: Document.DataFieldShimOptions): void;
867
811
 
868
812
  /**
869
813
  * A reusable helper for adding a migration shim
870
814
  */
871
- protected static _addDataFieldShim(data: object, oldKey: string, newKey: string, options?: object): unknown;
815
+ protected static _addDataFieldShim(
816
+ data: AnyObject,
817
+ oldKey: string,
818
+ newKey: string,
819
+ options?: Document.DataFieldShimOptions,
820
+ ): void;
872
821
 
873
822
  /**
874
823
  * Define a simple migration from one field name to another.
@@ -880,10 +829,10 @@ declare abstract class Document<
880
829
  * @internal
881
830
  */
882
831
  protected static _addDataFieldMigration(
883
- data: object,
832
+ data: AnyObject,
884
833
  oldKey: string,
885
834
  newKey: string,
886
- apply?: (data: object) => any,
835
+ apply?: (data: AnyObject) => unknown,
887
836
  ): unknown;
888
837
 
889
838
  protected static _logDataFieldMigration(
@@ -896,9 +845,9 @@ declare abstract class Document<
896
845
  * @deprecated since v12, will be removed in v14
897
846
  * @remarks `"The Document._onCreateDocuments static method is deprecated in favor of Document._onCreateOperation"`
898
847
  */
899
- protected static _onCreateDocuments<T extends Document.AnyConstructor>(
900
- this: T,
901
- documents: Array<Document.ToConfiguredInstance<NoInfer<T>>>,
848
+ // Note: This uses `never` because it's unsound to try to do `Document._onCreateDocuments` directly.
849
+ protected static _onCreateDocuments(
850
+ documents: never,
902
851
  context: Document.ModificationContext<Document.Any | null>,
903
852
  ): Promise<void>;
904
853
 
@@ -906,9 +855,9 @@ declare abstract class Document<
906
855
  * @deprecated since v12, will be removed in v14
907
856
  * @remarks `"The Document._onUpdateDocuments static method is deprecated in favor of Document._onUpdateOperation"`
908
857
  */
909
- protected static _onUpdateDocuments<T extends Document.AnyConstructor>(
910
- this: T,
911
- documents: Array<Document.ToConfiguredInstance<NoInfer<T>>>,
858
+ // Note: This uses `never` because it's unsound to try to do `Document._onUpdateDocuments` directly.
859
+ protected static _onUpdateDocuments(
860
+ documents: never,
912
861
  context: Document.ModificationContext<Document.Any | null>,
913
862
  ): Promise<unknown>;
914
863
 
@@ -916,81 +865,126 @@ declare abstract class Document<
916
865
  * @deprecated since v12, will be removed in v14
917
866
  * @remarks `"The Document._onDeleteDocuments static method is deprecated in favor of Document._onDeleteOperation"`
918
867
  */
919
- protected static _onDeleteDocuments<T extends Document.AnyConstructor>(
920
- this: T,
921
- documents: Array<Document.ToConfiguredInstance<NoInfer<T>>>,
868
+ // Note: This uses `never` because it's unsound to try to do `Document._onDeleteDocuments` directly.
869
+ protected static _onDeleteDocuments(
870
+ documents: never,
922
871
  context: Document.ModificationContext<Document.Any | null>,
923
872
  ): Promise<unknown>;
924
- }
925
873
 
926
- declare abstract class AnyDocument extends Document<any, any, any> {
927
- constructor(arg0: never, ...args: never[]);
874
+ static " fvtt_types_internal_document_name_static": Document.Type;
928
875
 
929
- // Note(LukeAbby): Specifically adding the `DocumentBrand` should be redundant but in practice it seems to help tsc more efficiently deduce that it's actually inheriting from `Document`.
930
- // This is odd but probably is because it bails from looking up the parent class properties at times or something.
931
- static [Document.Internal.DocumentBrand]: true;
932
-
933
- flags?: unknown;
934
-
935
- getFlag(scope: never, key: never): any;
876
+ " fvtt_types_internal_document_name": DocumentName;
877
+ " fvtt_types_internal_document_schema": Schema;
878
+ " fvtt_types_internal_document_parent": Parent;
936
879
  }
937
880
 
938
- // Note(LukeAbby): The point of this class is to show up in intellisense.
939
- // When something fails to be configured it should be replaced with `typeof ConfigurationFailure & typeof Item` or whatever the relevant class is.
940
- // This helps to minimize the number of errors that appears in a repo with broken configuration as they can be very misleading and confusing.
941
- declare abstract class ConfigurationFailure extends AnyDocument {
942
- static [Document.Internal.DocumentBrand]: true;
881
+ // An empty schema is the most accurate because index signatures are stripped.
882
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
883
+ declare abstract class AnyDocument extends Document<Document.Type, {}, Document.Any | null> {
884
+ constructor(...args: never);
885
+
886
+ // Note(LukeAbby): This uses `object` instead of `AnyObject` to avoid more thorough evaluation of
887
+ // the involved types which can cause a loop.
888
+ _source: object;
943
889
  }
944
890
 
945
891
  declare namespace Document {
946
- /** Any Document, except for Settings */
947
- type Any = AnyDocument;
948
- type AnyConstructor = typeof AnyDocument;
892
+ interface Any extends AnyDocument {}
893
+ interface AnyStored extends Stored<Any> {}
894
+ interface AnyValid extends AnyDocument {}
895
+ interface AnyConstructor extends Identity<typeof AnyDocument> {}
896
+
897
+ type Type = CONST.ALL_DOCUMENT_TYPES;
898
+
899
+ type PlaceableType =
900
+ | "AmbientLight"
901
+ | "AmbientSound"
902
+ | "Drawing"
903
+ | "MeasuredTemplate"
904
+ | "Note"
905
+ | "Region"
906
+ | "Tile"
907
+ | "Token"
908
+ | "Wall";
949
909
 
950
- type ConfigurationFailureClass = typeof ConfigurationFailure;
951
- type ConfigurationFailureInstance = ConfigurationFailure;
910
+ type PrimaryType = CONST.PRIMARY_DOCUMENT_TYPES;
911
+ type EmbeddedType = CONST.EMBEDDED_DOCUMENT_TYPES;
912
+ type WorldType = CONST.WORLD_DOCUMENT_TYPES;
913
+ type CompendiumType = CONST.COMPENDIUM_DOCUMENT_TYPES;
952
914
 
953
- type Type =
915
+ type WithSubTypes = WithSystem | "Folder" | "Macro" | "TableResult";
916
+
917
+ type WithSystem =
954
918
  | "ActiveEffect"
955
919
  | "ActorDelta"
956
920
  | "Actor"
957
- | "Adventure"
958
921
  | "Card"
959
922
  | "Cards"
960
923
  | "ChatMessage"
961
924
  | "Combat"
962
925
  | "Combatant"
963
- | "FogExploration"
964
- | "Folder"
965
926
  | "Item"
966
927
  | "JournalEntryPage"
967
- | "JournalEntry"
968
- | "Macro"
969
- | "PlaylistSound"
970
- | "Playlist"
971
- | "RegionBehavior"
972
- | "Region"
973
- | "RollTable"
974
- | "Scene"
975
- | "Setting"
976
- | "TableResult"
977
- | "User"
978
- // All placeables also have a corresponding document class.
979
- | PlaceableType;
928
+ | "RegionBehavior";
980
929
 
981
- type PlaceableType =
982
- | "AmbientLight"
983
- | "AmbientSound"
984
- | "Drawing"
985
- | "MeasuredTemplate"
986
- | "Note"
987
- | "Region"
988
- | "Tile"
989
- | "Token"
990
- | "Wall";
930
+ // The `data` parameter has a default of `{}`. This means it's optional in that scenario.
931
+ // Note(LukeAbby): Update when `ParameterWithDefaults` is added.
932
+ // `CreateData` also should be updated to allow `undefined` directly.
933
+ type ConstructorParameters<CreateData extends object | undefined, Parent extends Document.Any | null> = [
934
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
935
+ {},
936
+ ] extends [CreateData]
937
+ ? [data?: CreateData, context?: Document.ConstructionContext<Parent>]
938
+ : [data: CreateData, context?: Document.ConstructionContext<Parent>];
991
939
 
992
940
  type CoreTypesForName<Name extends Type> = string &
993
- GetKey<Document.Internal.SimpleMetadata<Name>, "coreTypes", ["base"]>[number];
941
+ GetKey<Document.MetadataFor<Name>, "coreTypes", [CONST.BASE_DOCUMENT_TYPE]>[number];
942
+
943
+ type ConfiguredSubTypesOf<Name extends Type> = Name extends "ActorDelta"
944
+ ? ConfiguredSubTypesOf<"Actor">
945
+ : string & (keyof GetKey<DataModelConfig, Name, unknown> | keyof GetKey<SourceConfig, Name, unknown>);
946
+
947
+ type SubTypesOf<Name extends Type> = Name extends "ActorDelta"
948
+ ? SubTypesOf<"Actor">
949
+ :
950
+ | Document.CoreTypesForName<Name>
951
+ | ConfiguredSubTypesOf<Name>
952
+ | (Document.MetadataFor<Name> extends { readonly hasTypeData: true } ? Document.ModuleSubtype : never);
953
+
954
+ type ModuleSubtype = Brand<`${string}.${string}`, "Document.ModuleSubtype">;
955
+
956
+ type OfType<Name extends WithSubTypes, SubType extends SubTypesOf<Name>> =
957
+ | (Name extends "ActiveEffect" ? ActiveEffect.OfType<SubType & ActiveEffect.SubType> : never)
958
+ | (Name extends "ActorDelta" ? ActorDelta.OfType<SubType & ActorDelta.SubType> : never)
959
+ | (Name extends "Actor" ? Actor.OfType<SubType & Actor.SubType> : never)
960
+ | (Name extends "Card" ? Card.OfType<SubType & Card.SubType> : never)
961
+ | (Name extends "Cards" ? Cards.OfType<SubType & Cards.SubType> : never)
962
+ | (Name extends "ChatMessage" ? ChatMessage.OfType<SubType & ChatMessage.SubType> : never)
963
+ | (Name extends "Combat" ? Combat.OfType<SubType & Combat.SubType> : never)
964
+ | (Name extends "Combatant" ? Combatant.OfType<SubType & Combatant.SubType> : never)
965
+ | (Name extends "Folder" ? Folder.OfType<SubType & Folder.SubType> : never)
966
+ | (Name extends "Item" ? Item.OfType<SubType & Item.SubType> : never)
967
+ | (Name extends "JournalEntryPage" ? JournalEntryPage.OfType<SubType & JournalEntryPage.SubType> : never)
968
+ | (Name extends "Macro" ? Macro.OfType<SubType & Macro.SubType> : never)
969
+ | (Name extends "RegionBehavior" ? RegionBehavior.OfType<SubType & RegionBehavior.SubType> : never)
970
+ | (Name extends "TableResult" ? TableResult.OfType<SubType & TableResult.SubType> : never);
971
+
972
+ /**
973
+ * With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
974
+ * A module can provide its own custom type though it is always of the form `${moduleName}.${subType}` so the `.` is a pretty
975
+ * strong indicator.
976
+ *
977
+ * `UnknownSourceData` covers the case where it's configured without a data model.
978
+ * See {@link UnknownSystem | `UnknownSystem`} for other possibilities.
979
+ */
980
+ interface UnknownSourceData extends AnyObject {
981
+ type: ModuleSubtype;
982
+ }
983
+
984
+ /**
985
+ * With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
986
+ */
987
+ type UnknownSystem = UnknownSourceData | TypeDataField.UnknownTypeDataModel | DataModel.UnknownDataModel;
994
988
 
995
989
  // TODO: Probably a way to auto-determine this
996
990
  type SystemType =
@@ -1005,14 +999,61 @@ declare namespace Document {
1005
999
  | "JournalEntryPage"
1006
1000
  | "RegionBehavior";
1007
1001
 
1008
- type EmbeddableNamesFor<ConcreteDocument extends Document.Internal.Instance.Any> = {
1009
- [K in keyof ConfiguredDocuments]: IsParentOf<
1010
- ConcreteDocument,
1011
- FixedInstanceType<ConfiguredDocuments[K]>
1012
- > extends true
1013
- ? K
1014
- : never;
1015
- };
1002
+ namespace Embedded {
1003
+ type CollectionNameFor<
1004
+ Embedded extends Document.Metadata.Embedded,
1005
+ CollectionName extends Document.Embedded.CollectionName<Embedded>,
1006
+ > = Extract<GetKey<Metadata.Embedded, CollectionName, CollectionName>, Document.Type>;
1007
+
1008
+ type DocumentFor<
1009
+ Embedded extends Document.Metadata.Embedded,
1010
+ CollectionName extends Document.Embedded.CollectionName<Embedded>,
1011
+ > = Document.ImplementationFor<CollectionNameFor<Embedded, CollectionName>>;
1012
+
1013
+ type CollectionFor<
1014
+ Parent extends Document.Any,
1015
+ Embedded extends Document.Metadata.Embedded,
1016
+ CollectionName extends Document.Embedded.CollectionName<Embedded>,
1017
+ > = EmbeddedCollection<DocumentFor<Embedded, CollectionName>, Parent>;
1018
+
1019
+ type CollectionName<Embedded extends Document.Metadata.Embedded> = {
1020
+ [K in keyof Embedded]: K extends Document.Type ? Extract<K | Embedded[K], string> : never;
1021
+ }[keyof Embedded];
1022
+ }
1023
+
1024
+ /**
1025
+ * @internal
1026
+ */
1027
+ interface _WorldCollectionMap {
1028
+ Actor: Actors.Configured;
1029
+ Cards: CardStacks;
1030
+ Combat: CombatEncounters;
1031
+ FogExploration: FogExplorations;
1032
+ Folder: Folders;
1033
+ Item: Items;
1034
+ JournalEntry: Journal;
1035
+ Macro: Macros;
1036
+ ChatMessage: Messages;
1037
+ Playlist: Playlists;
1038
+ Scene: Scenes;
1039
+ Setting: WorldSettings;
1040
+ RollTable: RollTables;
1041
+ User: Users;
1042
+ }
1043
+
1044
+ type WorldCollectionFor<Name extends Document.WorldType> = _WorldCollectionMap[Name];
1045
+
1046
+ // Note(LukeAbby): Will be updated with the CONFIG revamp.
1047
+ type ConfiguredCollectionClass<Name extends Document.Type> = CONFIG extends {
1048
+ readonly [K in Name]: {
1049
+ readonly documentClass?: infer DocumentClass;
1050
+ };
1051
+ }
1052
+ ? DocumentClass
1053
+ : never;
1054
+
1055
+ // Note(LukeAbby): Will be updated with the CONFIG revamp.
1056
+ type ConfiguredCollection<Name extends Document.Type> = FixedInstanceType<ConfiguredCollectionClass<Name>>;
1016
1057
 
1017
1058
  type IsParentOf<
1018
1059
  ParentDocument extends Document.Internal.Instance.Any,
@@ -1024,19 +1065,8 @@ declare namespace Document {
1024
1065
 
1025
1066
  // Documented at https://gist.github.com/LukeAbby/c7420b053d881db4a4d4496b95995c98
1026
1067
  namespace Internal {
1027
- const DocumentBrand: unique symbol;
1028
-
1029
- const DocumentName: unique symbol;
1030
- const Schema: unique symbol;
1031
- const Parent: unique symbol;
1032
-
1033
- // This metadata is called "simple" because where there should be proper references to the
1034
- // current document there is instead `Document.Any`. This helps simplify loops.
1035
- // Use cases should be limited to when these references aren't needed.
1036
- type SimpleMetadata<Name extends Document.Type> = ConfiguredMetadata<Document.Any>[Name];
1037
-
1038
- type Constructor = (abstract new (arg0: never, ...args: never[]) => Instance.Any) & {
1039
- [DocumentBrand]: true;
1068
+ type Constructor = (abstract new (...args: never) => Instance.Any) & {
1069
+ " fvtt_types_internal_document_name_static": Document.Type;
1040
1070
  };
1041
1071
 
1042
1072
  interface Instance<
@@ -1044,124 +1074,233 @@ declare namespace Document {
1044
1074
  Schema extends DataSchema,
1045
1075
  Parent extends Document.Internal.Instance.Any | null,
1046
1076
  > {
1047
- [DocumentName]: DocumentName;
1048
- [Schema]: Schema;
1049
- [Parent]: Parent;
1077
+ " fvtt_types_internal_document_name": DocumentName;
1078
+ " fvtt_types_internal_document_schema": Schema;
1079
+ " fvtt_types_internal_document_parent": Parent;
1050
1080
  }
1051
1081
 
1052
- type DocumentNameFor<ConcreteInstance extends Instance.Any> = ConcreteInstance[typeof DocumentName];
1082
+ type DocumentNameFor<ConcreteInstance extends Instance.Any> =
1083
+ ConcreteInstance[" fvtt_types_internal_document_name"];
1053
1084
 
1054
- type SchemaFor<ConcreteInstance extends Instance.Any> = ConcreteInstance[typeof Schema];
1085
+ type SchemaFor<ConcreteInstance extends Instance.Any> = ConcreteInstance[" fvtt_types_internal_document_schema"];
1055
1086
 
1056
- type ParentFor<ConcreteInstance extends Instance.Any> = ConcreteInstance[typeof Parent];
1087
+ type ParentFor<ConcreteInstance extends Instance.Any> = ConcreteInstance[" fvtt_types_internal_document_parent"];
1057
1088
 
1058
1089
  namespace Instance {
1059
- type Any = Instance<any, any, any>;
1090
+ interface Any extends Instance<any, any, any> {}
1060
1091
 
1061
1092
  type Complete<T extends Any> = T extends Document.Any ? T : never;
1062
1093
  }
1094
+
1095
+ type OfType<Configured, Document extends Document.Any> = Configured extends { document: infer D }
1096
+ ? D extends Document
1097
+ ? D
1098
+ : FixedInstanceType<ConfigurationFailure[Document["documentName"]]>
1099
+ : Document;
1100
+
1101
+ type SystemMap<Name extends Document.WithSystem> = _SystemMap<
1102
+ Name,
1103
+ GetKey<DataModelConfig, Name>,
1104
+ GetKey<SourceConfig, Name>
1105
+ >;
1106
+
1107
+ type _SystemMap<Name extends Document.WithSystem, DataModel, SourceData> = {
1108
+ [SubType in SubTypesOf<Name>]: DataModel extends {
1109
+ [K in SubType]: abstract new (...args: infer _) => infer Model;
1110
+ }
1111
+ ? Model
1112
+ : SourceData extends {
1113
+ [K in SubType]: infer Source;
1114
+ }
1115
+ ? Source
1116
+ : SubType extends Document.ModuleSubtype
1117
+ ? // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1118
+ {}
1119
+ : UnknownSystem;
1120
+ };
1121
+
1122
+ type SystemOfType<SystemMap extends Record<SubType, object>, SubType extends string> =
1123
+ | DiscriminatedUnion<SystemMap[SubType]>
1124
+ | (SubType extends ModuleSubtype ? UnknownSystem : never);
1063
1125
  }
1064
1126
 
1065
1127
  /** Any Document, that is a child of the given parent Document. */
1066
- type AnyChild<Parent extends Any | null> = Document<any, any, Parent>;
1128
+ // An empty schema is the most appropriate type due to removing index signatures.
1129
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1130
+ type AnyChild<Parent extends Any | null> = Document<Document.Type, {}, Parent>;
1131
+
1132
+ /**
1133
+ * @deprecated {@link Document.CreateDataFor | `Document.CreateDataFor`}
1134
+ */
1135
+ type ConstructorDataFor<T extends Document.Internal.Constructor> = SchemaField.CreateData<
1136
+ T extends { defineSchema: () => infer R extends DataSchema } ? R : never
1137
+ >;
1067
1138
 
1068
1139
  /**
1069
- * Returns the type of the constructor data for the given {@link foundry.abstract.Document}.
1140
+ * Returns the type of the constructor data for the given {@link foundry.abstract.Document | `foundry.abstract.Document`}.
1070
1141
  */
1071
- type ConstructorDataFor<T extends Document.Internal.Constructor> = ConstructorDataForSchema<
1142
+ type CreateDataFor<T extends Document.Internal.Constructor> = SchemaField.CreateData<
1072
1143
  T extends { defineSchema: () => infer R extends DataSchema } ? R : never
1073
1144
  >;
1074
1145
 
1075
- // TODO(LukeAbby): Actually make this distinguishable from `Document.ConstructorDataFor` and `Document.ConstructorDataForSchema`.
1076
- type UpdateDataFor<T extends Document.Internal.Constructor> = ConstructorDataForSchema<
1146
+ type UpdateDataFor<T extends Document.Internal.Constructor> = SchemaField.UpdateData<
1077
1147
  T extends { defineSchema: () => infer R extends DataSchema } ? R : never
1078
1148
  >;
1079
1149
 
1080
1150
  // These helper types exist to help break a loop
1081
- type ConstructorDataForName<T extends Document.Type> = ConstructorData[T];
1082
- type UpdateDataForName<T extends Document.Type> = ConstructorData[T];
1083
1151
 
1084
- type ConstructorDataForSchema<Schema extends DataSchema> =
1085
- foundry.data.fields.SchemaField.InnerAssignmentType<Schema>;
1152
+ type CreateDataForName<DocumentType extends Document.Type> =
1153
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.CreateData : never)
1154
+ | (DocumentType extends "ActorDelta" ? ActorDelta.CreateData : never)
1155
+ | (DocumentType extends "Actor" ? Actor.CreateData : never)
1156
+ | (DocumentType extends "Adventure" ? Adventure.CreateData : never)
1157
+ | (DocumentType extends "Card" ? Card.CreateData : never)
1158
+ | (DocumentType extends "Cards" ? Cards.CreateData : never)
1159
+ | (DocumentType extends "ChatMessage" ? ChatMessage.CreateData : never)
1160
+ | (DocumentType extends "Combat" ? Combat.CreateData : never)
1161
+ | (DocumentType extends "Combatant" ? Combatant.CreateData : never)
1162
+ | (DocumentType extends "FogExploration" ? FogExploration.CreateData : never)
1163
+ | (DocumentType extends "Folder" ? Folder.CreateData : never)
1164
+ | (DocumentType extends "Item" ? Item.CreateData : never)
1165
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.CreateData : never)
1166
+ | (DocumentType extends "JournalEntry" ? JournalEntry.CreateData : never)
1167
+ | (DocumentType extends "Macro" ? Macro.CreateData : never)
1168
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.CreateData : never)
1169
+ | (DocumentType extends "Playlist" ? Playlist.CreateData : never)
1170
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.CreateData : never)
1171
+ | (DocumentType extends "RollTable" ? RollTable.CreateData : never)
1172
+ | (DocumentType extends "Scene" ? Scene.CreateData : never)
1173
+ | (DocumentType extends "Setting" ? Setting.CreateData : never)
1174
+ | (DocumentType extends "TableResult" ? TableResult.CreateData : never)
1175
+ | (DocumentType extends "User" ? User.CreateData : never)
1176
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.CreateData : never)
1177
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.CreateData : never)
1178
+ | (DocumentType extends "Drawing" ? DrawingDocument.CreateData : never)
1179
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.CreateData : never)
1180
+ | (DocumentType extends "Note" ? NoteDocument.CreateData : never)
1181
+ | (DocumentType extends "Region" ? RegionDocument.CreateData : never)
1182
+ | (DocumentType extends "Tile" ? TileDocument.CreateData : never)
1183
+ | (DocumentType extends "Token" ? TokenDocument.CreateData : never)
1184
+ | (DocumentType extends "Wall" ? WallDocument.CreateData : never);
1185
+
1186
+ type UpdateDataForName<DocumentType extends Document.Type> =
1187
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.UpdateData : never)
1188
+ | (DocumentType extends "ActorDelta" ? ActorDelta.UpdateData : never)
1189
+ | (DocumentType extends "Actor" ? Actor.UpdateData : never)
1190
+ | (DocumentType extends "Adventure" ? Adventure.UpdateData : never)
1191
+ | (DocumentType extends "Card" ? Card.UpdateData : never)
1192
+ | (DocumentType extends "Cards" ? Cards.UpdateData : never)
1193
+ | (DocumentType extends "ChatMessage" ? ChatMessage.UpdateData : never)
1194
+ | (DocumentType extends "Combat" ? Combat.UpdateData : never)
1195
+ | (DocumentType extends "Combatant" ? Combatant.UpdateData : never)
1196
+ | (DocumentType extends "FogExploration" ? FogExploration.UpdateData : never)
1197
+ | (DocumentType extends "Folder" ? Folder.UpdateData : never)
1198
+ | (DocumentType extends "Item" ? Item.UpdateData : never)
1199
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.UpdateData : never)
1200
+ | (DocumentType extends "JournalEntry" ? JournalEntry.UpdateData : never)
1201
+ | (DocumentType extends "Macro" ? Macro.UpdateData : never)
1202
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.UpdateData : never)
1203
+ | (DocumentType extends "Playlist" ? Playlist.UpdateData : never)
1204
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.UpdateData : never)
1205
+ | (DocumentType extends "RollTable" ? RollTable.UpdateData : never)
1206
+ | (DocumentType extends "Scene" ? Scene.UpdateData : never)
1207
+ | (DocumentType extends "Setting" ? Setting.UpdateData : never)
1208
+ | (DocumentType extends "TableResult" ? TableResult.UpdateData : never)
1209
+ | (DocumentType extends "User" ? User.UpdateData : never)
1210
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.UpdateData : never)
1211
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.UpdateData : never)
1212
+ | (DocumentType extends "Drawing" ? DrawingDocument.UpdateData : never)
1213
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.UpdateData : never)
1214
+ | (DocumentType extends "Note" ? NoteDocument.UpdateData : never)
1215
+ | (DocumentType extends "Region" ? NoteDocument.UpdateData : never)
1216
+ | (DocumentType extends "Tile" ? TileDocument.UpdateData : never)
1217
+ | (DocumentType extends "Token" ? TokenDocument.UpdateData : never)
1218
+ | (DocumentType extends "Wall" ? WallDocument.UpdateData : never);
1219
+
1220
+ /**
1221
+ * @deprecated {@link SchemaField.CreateData | `SchemaField.CreateData`}
1222
+ */
1223
+ type ConstructorDataForSchema<Schema extends DataSchema> = SchemaField.CreateData<Schema>;
1086
1224
 
1087
1225
  type SystemConstructor = AnyConstructor & {
1088
1226
  metadata: { name: SystemType };
1089
1227
  };
1090
1228
 
1091
- type ConfiguredClassForName<Name extends Type> = MakeConform<
1092
- ConfiguredDocuments[Name],
1093
- Document.Internal.Constructor,
1094
- typeof ConfigurationFailure & DefaultDocuments[Name]
1095
- >;
1096
-
1097
- type SubTypesOf<T extends Type> =
1098
- ConfiguredInstanceForName<T> extends { type: infer Types } ? Types : typeof foundry.CONST.BASE_DOCUMENT_TYPE;
1099
-
1100
- // NOTE(LukeAbby): This type is less DRY than it could be to avoid undue complexity in such a critical helpeer.
1101
- // This has _many_ times been seen to cause loops so this type is written in an intentionally more paranoid way.
1102
- // The reason for the verbosity and repetition is to avoid eagerly evaluating any branches that might cause a loop.
1103
- type ToConfiguredClass<ConcreteDocument extends Document.Internal.Constructor> = MakeConform<
1104
- ConfiguredDocuments[NameFor<ConcreteDocument>],
1105
- Document.AnyConstructor,
1106
- typeof ConfigurationFailure & DefaultDocuments[NameFor<ConcreteDocument>]
1229
+ type ToConfiguredClass<ConcreteDocument extends Document.Internal.Constructor> = ImplementationClassFor<
1230
+ NameFor<ConcreteDocument>
1107
1231
  >;
1108
1232
 
1109
1233
  type ToConfiguredInstance<ConcreteDocument extends Document.Internal.Constructor> = MakeConform<
1110
- FixedInstanceType<ConfiguredDocuments[NameFor<ConcreteDocument>]>,
1111
- Document.Any,
1112
- ConfigurationFailure & FixedInstanceType<DefaultDocuments[NameFor<ConcreteDocument>]>
1234
+ FixedInstanceType<ConfiguredDocumentClass[NameFor<ConcreteDocument>]>,
1235
+ Document.Any
1236
+ // TODO(LukeAbby): Look into if there's a way to do this without causing circular loops.
1237
+ // FixedInstanceType<ConfigurationFailure[Name]>
1113
1238
  >;
1114
1239
 
1115
- type ToConfiguredStored<D extends Document.Internal.Constructor> = Stored<ToConfiguredInstance<D>>;
1240
+ type ToConfiguredStored<D extends Document.AnyConstructor> = Stored<ToConfiguredInstance<D>>;
1116
1241
 
1117
- type Stored<D extends Document.Internal.Instance.Any> = D & {
1242
+ type Stored<D extends Document.Any> = D & {
1118
1243
  id: string;
1119
1244
  _id: string;
1120
1245
  _source: GetKey<D, "_source"> & { _id: string };
1121
1246
  };
1122
1247
 
1123
- type ToStoredIf<
1124
- D extends Document.Internal.Constructor,
1125
- Temporary extends boolean | undefined,
1126
- > = Temporary extends true ? ToConfiguredStored<D> : ToConfiguredInstance<D>;
1248
+ type Invalid<D extends Document.Any> = SimpleMerge<
1249
+ D,
1250
+ {
1251
+ id: string;
1252
+ _id: string;
1253
+ _source: object;
1254
+ system: object;
1255
+ }
1256
+ >;
1127
1257
 
1128
- type Temporary<D extends Document.Internal.Instance.Any> = D extends Stored<infer U> ? U : D;
1258
+ type ToStored<D extends Document.AnyConstructor> = Stored<FixedInstanceType<D>>;
1129
1259
 
1130
- type NameFor<ConcreteDocument extends Document.Internal.Constructor> = ConcreteDocument extends {
1131
- readonly metadata: { readonly name: infer Name extends Type };
1132
- }
1133
- ? Name
1134
- : never;
1260
+ type ToStoredIf<D extends Document.AnyConstructor, Temporary extends boolean | undefined> = Temporary extends true
1261
+ ? FixedInstanceType<D>
1262
+ : ToConfiguredStored<D>;
1135
1263
 
1136
- type ConfiguredInstanceForName<Name extends Type> = MakeConform<
1137
- FixedInstanceType<ConfiguredDocuments[Name]>,
1138
- Document.Any
1139
- >;
1264
+ /** @deprecated {@link Document.TemporaryIf | `Document.TemporaryIf`} */
1265
+ type StoredIf<D extends Document.Any, Temporary extends boolean | undefined> = TemporaryIf<D, Temporary>;
1266
+
1267
+ type TemporaryIf<D extends Document.Any, Temporary extends boolean | undefined> = Temporary extends true
1268
+ ? D
1269
+ : Stored<D>;
1270
+
1271
+ type Temporary<D extends Document.Any> = D extends Stored<infer U> ? U : D;
1272
+
1273
+ type NameFor<ConcreteDocument extends Document.Internal.Constructor> =
1274
+ ConcreteDocument[" fvtt_types_internal_document_name_static"];
1140
1275
 
1141
- type ConfiguredObjectClassForName<Name extends PlaceableType> = CONFIG[Name]["objectClass"];
1142
- type ConfiguredObjectInstanceForName<Name extends PlaceableType> = FixedInstanceType<CONFIG[Name]["objectClass"]>;
1276
+ type ImplementationFor<Name extends Type> = ConfiguredDocumentInstance[Name];
1277
+ type ImplementationClassFor<Name extends Type> = ConfiguredDocumentClass[Name];
1278
+
1279
+ type ObjectClassFor<Name extends PlaceableType> = CONFIG[Name]["objectClass"];
1280
+ type ObjectFor<Name extends PlaceableType> = FixedInstanceType<CONFIG[Name]["objectClass"]>;
1281
+
1282
+ /**
1283
+ * @deprecated {@link ObjectClassFor | `ObjectClassFor`}
1284
+ */
1285
+ type ConfiguredObjectClassForName<Name extends PlaceableType> = ObjectClassFor<Name>;
1286
+
1287
+ /**
1288
+ * @deprecated {@link ObjectFor | `ObjectFor`}
1289
+ */
1290
+ type ConfiguredObjectInstanceForName<Name extends PlaceableType> = ObjectFor<Name>;
1143
1291
 
1144
1292
  type ConfiguredDataForName<Name extends Type> = GetKey<DataConfig, Name, EmptyObject>;
1145
1293
 
1146
1294
  type ConfiguredSourceForName<Name extends Type> = GetKey<SourceConfig, Name, EmptyObject>;
1147
1295
 
1148
- type ConfiguredFlagsForName<Name extends Type> = GetKey<FlagConfig, Name, EmptyObject>;
1149
-
1150
- type ToObjectFalseType<T extends Document.Internal.Instance.Any> = T extends {
1151
- toObject: (source: false) => infer U;
1152
- }
1153
- ? U
1154
- : T;
1296
+ // The type `{}` is useful here because in an intersection it reduces down to nothing unlike `EmptyObject`.
1297
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1298
+ type ConfiguredFlagsForName<Name extends Type> = GetKey<FlagConfig, Name, {}>;
1155
1299
 
1156
1300
  type SchemaFor<ConcreteDocument extends Internal.Instance.Any> =
1157
1301
  ConcreteDocument extends Internal.Instance<infer _1, infer Schema, infer _2> ? Schema : never;
1158
1302
 
1159
- type MetadataFor<ConcreteDocument extends Document.Internal.Instance.Any> =
1160
- ConfiguredMetadata<ConcreteDocument>[ConcreteDocument extends {
1161
- readonly documentName: infer Name extends Document.Type;
1162
- }
1163
- ? Name
1164
- : never];
1303
+ type MetadataFor<Name extends Document.Type> = ConfiguredMetadata[Name];
1165
1304
 
1166
1305
  type CollectionRecord<Schema extends DataSchema> = {
1167
1306
  [Key in keyof Schema]: Schema[Key] extends fields.EmbeddedCollectionField.Any ? Schema[Key] : never;
@@ -1197,7 +1336,7 @@ declare namespace Document {
1197
1336
  type FlagGetKey<T, K extends PropertyKey> = T extends unknown ? (K extends keyof T ? T[K] : never) : never;
1198
1337
 
1199
1338
  // Note(LukeAbby): It's at times been very important for `GetFlag` to be covariant over `ConcreteSchema`.
1200
- // If it isn't then issues arise where the `Document` type ends up becoming invaraint.
1339
+ // If it isn't then issues arise where the `Document` type ends up becoming invariant.
1201
1340
  // Currently it is actually contravariant over `ConcreteSchema` and this may cause issues (because of the usage of `keyof`).
1202
1341
  // Unfortunately it's not easy to avoid because the typical `GetKey` trick has issues between `never`, not defined at all, and `unknown` etc.
1203
1342
  type GetFlag<Name extends Document.Type, S extends string, K extends string> = FlagGetKey<
@@ -1205,12 +1344,19 @@ declare namespace Document {
1205
1344
  K
1206
1345
  >;
1207
1346
 
1347
+ interface CoreFlags {
1348
+ core?: {
1349
+ sheetLock?: boolean;
1350
+ sheetClass?: string;
1351
+ };
1352
+ }
1353
+
1208
1354
  interface ConstructionContext<Parent extends Document.Any | null> {
1209
1355
  /**
1210
1356
  * The parent Document of this one, if this one is embedded
1211
1357
  * @defaultValue `null`
1212
1358
  */
1213
- parent?: Parent | undefined;
1359
+ parent?: Parent | null | undefined;
1214
1360
 
1215
1361
  /**
1216
1362
  * The compendium collection ID which contains this Document, if any
@@ -1314,85 +1460,115 @@ declare namespace Document {
1314
1460
  deleteAll?: boolean | undefined;
1315
1461
  }
1316
1462
 
1463
+ interface CloneContext<Save extends boolean | undefined = boolean | undefined> {
1464
+ /**
1465
+ * Save the clone to the World database?
1466
+ * @defaultValue `false`
1467
+ */
1468
+ save?: Save;
1469
+
1470
+ /**
1471
+ * Keep the same ID of the original document
1472
+ * @defaultValue `false`
1473
+ */
1474
+ keepId?: boolean | undefined;
1475
+
1476
+ /**
1477
+ * Track the clone source
1478
+ * @defaultValue `false`
1479
+ */
1480
+ addSource?: boolean | undefined;
1481
+ }
1482
+
1317
1483
  type ModificationOptions = Omit<Document.ModificationContext<Document.Any | null>, "parent" | "pack">;
1318
1484
 
1485
+ /* eslint-disable @typescript-eslint/no-deprecated */
1486
+ /** @deprecated Use {@link Database.PreCreateOptions | `Database.PreCreateOptions`} */
1319
1487
  type PreCreateOptions<Name extends Type> = Omit<
1320
1488
  Document.Database.OperationOf<Name, "create">,
1321
1489
  "data" | "noHook" | "pack" | "parent"
1322
1490
  >;
1491
+
1492
+ /** @deprecated Use {@link Database.CreateOptions | `Database.CreateOptions`} */
1323
1493
  type OnCreateOptions<Name extends Type> = Omit<
1324
1494
  Document.Database.OperationOf<Name, "create">,
1325
1495
  "pack" | "parentUuid" | "syntheticActorUpdate"
1326
1496
  >;
1327
1497
 
1498
+ /** @deprecated Use {@link Database.PreUpdateOptions | `Database.PreUpdateOperation`} */
1328
1499
  type PreUpdateOptions<Name extends Type> = Omit<
1329
1500
  Document.Database.OperationOf<Name, "update">,
1330
1501
  "updates" | "restoreDelta" | "noHook" | "parent" | "pack"
1331
1502
  >;
1503
+
1504
+ /** @deprecated Use {@link Database.UpdateOptions | `Database.OnUpdateOperation`} */
1332
1505
  type OnUpdateOptions<Name extends Type> = Omit<
1333
1506
  Document.Database.OperationOf<Name, "update">,
1334
1507
  "pack" | "parentUuid" | "syntheticActorUpdate"
1335
1508
  >;
1336
1509
 
1510
+ /** @deprecated Use {@link Database.PreDeleteOperationInstance | `Database.PreDeleteOperationInstance`} */
1337
1511
  type PreDeleteOptions<Name extends Type> = Omit<
1338
1512
  Document.Database.OperationOf<Name, "delete">,
1339
1513
  "ids" | "deleteAll" | "noHook" | "pack" | "parent"
1340
1514
  >;
1515
+
1516
+ /** @deprecated Use {@link Database.DeleteOptions | `Database.OnDeleteOptions`} */
1341
1517
  type OnDeleteOptions<Name extends Type> = Omit<
1342
1518
  Document.Database.OperationOf<Name, "delete">,
1343
1519
  "deleteAll" | "pack" | "parentUuid" | "syntheticActorUpdate"
1344
1520
  >;
1345
1521
 
1522
+ /** @deprecated Use {@link Database.PreCreateOptions | `Database.PreCreateOptions`} or {@link Database.PreUpdateOptions | `Database.PreUpdateOperation`}*/
1346
1523
  type PreUpsertOptions<Name extends Type> = PreCreateOptions<Name> | PreUpdateOptions<Name>;
1524
+
1525
+ /** @deprecated Use {@link Database.CreateOptions | `Database.CreateOptions`} or {@link Database.UpdateOptions | `Database.OnUpdateOperation`} */
1347
1526
  type OnUpsertOptions<Name extends Type> = OnCreateOptions<Name> | OnUpdateOptions<Name>;
1527
+ /* eslint-enable @typescript-eslint/no-deprecated */
1348
1528
 
1349
1529
  interface Metadata<out ThisType extends Document.Any> {
1350
1530
  readonly name: ThisType["documentName"];
1351
1531
  readonly collection: string;
1352
- readonly indexed?: boolean | undefined;
1353
- readonly compendiumIndexFields?: readonly string[] | undefined;
1532
+ readonly indexed: boolean;
1533
+ readonly compendiumIndexFields: readonly string[];
1354
1534
  readonly label: string;
1355
1535
  readonly coreTypes: readonly string[];
1356
- readonly embedded: Record<string, string>;
1536
+ readonly embedded: {
1537
+ [DocumentType in Document.Type]?: string;
1538
+ };
1357
1539
  readonly permissions: {
1358
- create: string | ToMethod<(user: User, doc: ThisType, data: Document.ConstructorDataForName<Type>) => boolean>;
1359
- update: string | ToMethod<(user: User, doc: ThisType, data: Document.UpdateDataForName<Type>) => boolean>;
1360
- delete: string | ToMethod<(user: User, doc: ThisType, data: EmptyObject) => boolean>;
1540
+ create: string | ToMethod<(user: User.Internal.Implementation, doc: ThisType, data: AnyObject) => boolean>;
1541
+ update: string | ToMethod<(user: User.Internal.Implementation, doc: ThisType, data: AnyObject) => boolean>;
1542
+ delete: string | ToMethod<(user: User.Internal.Implementation, doc: ThisType, data: EmptyObject) => boolean>;
1361
1543
  };
1362
- readonly preserveOnImport?: readonly string[] | undefined;
1363
- readonly schemaVersion: string | undefined;
1364
- readonly labelPlural: string; // This is not set for the Document class but every class that implements Document actually provides it.
1365
- readonly types: readonly string[];
1366
- readonly hasSystemData: boolean;
1544
+ readonly preserveOnImport: readonly string[];
1545
+ readonly schemaVersion?: string | undefined;
1546
+ readonly labelPlural?: string; // This is not set for the Document class but every class that implements Document actually provides it.
1547
+ readonly types?: readonly string[];
1548
+ readonly hasSystemData?: boolean;
1367
1549
  }
1368
1550
 
1369
1551
  namespace Metadata {
1370
- type Any = Metadata<any>;
1371
-
1372
- export interface Default {
1373
- name: "Document";
1374
- collection: "documents";
1375
- label: "DOCUMENT.Document";
1376
- coreTypes: [typeof foundry.CONST.BASE_DOCUMENT_TYPE];
1377
- types: [];
1378
- embedded: EmptyObject;
1379
- hasSystemData: false;
1380
- permissions: {
1552
+ interface Any extends Metadata<any> {}
1553
+
1554
+ interface Default {
1555
+ readonly name: "Document";
1556
+ readonly collection: "documents";
1557
+ readonly indexed: false;
1558
+ readonly compendiumIndexFields: [];
1559
+ readonly label: "DOCUMENT.Document";
1560
+ readonly coreTypes: [CONST.BASE_DOCUMENT_TYPE];
1561
+ readonly embedded: EmptyObject;
1562
+ readonly permissions: {
1381
1563
  create: "ASSISTANT";
1382
1564
  update: "ASSISTANT";
1383
1565
  delete: "ASSISTANT";
1384
1566
  };
1385
- pack: null;
1567
+ readonly preserveOnImport: ["_id", "sort", "ownership"];
1386
1568
  }
1387
- }
1388
1569
 
1389
- /**
1390
- * @deprecated {@link Document.Database.OperationOf | `Document.Database.OperationOf`}
1391
- */
1392
- type DatabaseOperationsFor<
1393
- Name extends Document.Type,
1394
- ConcreteOperation extends Document.Database.Operation,
1395
- > = Document.Database.OperationOf<Name, ConcreteOperation>;
1570
+ interface Embedded extends Identity<{ [K in Document.Type]?: string }> {}
1571
+ }
1396
1572
 
1397
1573
  type ConfiguredSheetClassFor<Name extends Document.Type> = MakeConform<
1398
1574
  GetKey<GetKey<CONFIG, Name>, "sheetClass">,
@@ -1423,44 +1599,555 @@ declare namespace Document {
1423
1599
  namespace Database {
1424
1600
  type Operation = "create" | "update" | "delete";
1425
1601
 
1426
- /* eslint-disable @typescript-eslint/no-empty-object-type */
1427
- interface Operations<
1428
- T extends Document.Internal.Instance.Any = Document.Internal.Instance.Any,
1429
- ExtraCreateOptions extends AnyObject = {},
1430
- ExtraUpdateOptions extends AnyObject = {},
1431
- ExtraDeleteOptions extends AnyObject = {},
1432
- > {
1433
- create: DatabaseCreateOperation<T> & InexactPartial<ExtraCreateOptions>;
1434
- update: DatabaseUpdateOperation<T> & InexactPartial<ExtraUpdateOptions>;
1435
- delete: DatabaseDeleteOperation & InexactPartial<ExtraDeleteOptions>;
1602
+ interface GetOptions {
1603
+ pack?: string | null;
1436
1604
  }
1437
- /* eslint-enable @typescript-eslint/no-empty-object-type */
1605
+
1606
+ /** Used for {@link Document.createDocuments | `Document.createDocuments`} */
1607
+ type CreateOperation<Op extends DatabaseCreateOperation> = NullishProps<Omit<Op, "data" | "modifiedTime">>;
1608
+
1609
+ /** Used for {@link Document.update | `Document.update`} */
1610
+ type UpdateOperation<Op extends DatabaseUpdateOperation> = InexactPartial<Omit<Op, "updates">>;
1611
+
1612
+ /** Used for {@link Document.delete | `Document.delete`} */
1613
+ type DeleteOperation<Op extends DatabaseDeleteOperation> = InexactPartial<Omit<Op, "ids">>;
1614
+
1615
+ /** Used for {@link Document._preCreateOperation | `Document._preCreateOperation`} */
1616
+ type PreCreateOperationStatic<Op extends DatabaseCreateOperation> = InexactPartial<
1617
+ Op,
1618
+ Exclude<AllKeysOf<Op>, "modifiedTime" | "render" | "renderSheet" | "data" | "noHook" | "pack" | "parent">
1619
+ >;
1620
+
1621
+ /** Used for {@link Document._preCreate | `Document#_preCreate`} */
1622
+ type PreCreateOptions<Op extends DatabaseCreateOperation> = Omit<
1623
+ PreCreateOperationStatic<Op>,
1624
+ "data" | "noHook" | "pack" | "parent"
1625
+ >;
1626
+
1627
+ /** Used for {@link Document._onCreate | `Document#_onCreate`} */
1628
+ type CreateOptions<Op extends DatabaseCreateOperation> = Omit<
1629
+ Op,
1630
+ "data" | "pack" | "parentUuid" | "syntheticActorUpdate"
1631
+ >;
1632
+
1633
+ /** Used for {@link Document.updateDocuments | `Document.updateDocuments`} */
1634
+ type UpdateDocumentsOperation<Op extends DatabaseUpdateOperation> = NullishProps<
1635
+ Omit<Op, "updates" | "modifiedTime">
1636
+ >;
1637
+
1638
+ /** Used for {@link Document.update | `Document#update`} */
1639
+ type UpdateOperationInstance<Op extends DatabaseUpdateOperation> = InexactPartial<
1640
+ Omit<Op, "updates" | "parent" | "pack">
1641
+ >;
1642
+
1643
+ /** Used for {@link Document._preUpdateOperation | `Document._preUpdateOperation`} */
1644
+ type PreUpdateOperationStatic<Op extends DatabaseUpdateOperation> = InexactPartial<
1645
+ Op,
1646
+ Exclude<
1647
+ AllKeysOf<Op>,
1648
+ "modifiedTime" | "diff" | "recursive" | "render" | "updates" | "restoreDelta" | "noHook" | "pack" | "parent"
1649
+ >
1650
+ >;
1651
+
1652
+ /** Used for {@link Document._preUpdate | `Document#_preUpdate`} */
1653
+ type PreUpdateOptions<Op extends DatabaseUpdateOperation> = Omit<
1654
+ PreUpdateOperationStatic<Op>,
1655
+ "updates" | "restoreDelta" | "noHook" | "pack" | "parent"
1656
+ >;
1657
+
1658
+ /** Used for {@link Document._onUpdate | `Document#_onUpdate`} */
1659
+ type UpdateOptions<Op extends DatabaseUpdateOperation> = Omit<
1660
+ Op,
1661
+ "updates" | "pack" | "parentUuid" | "syntheticActorUpdate"
1662
+ >;
1663
+
1664
+ /** Used for {@link Document.deleteDocuments | `Document.deleteDocuments`} */
1665
+ type DeleteDocumentsOperation<Op extends DatabaseDeleteOperation> = NullishProps<Omit<Op, "ids" | "modifiedTime">>;
1666
+
1667
+ /** Used for {@link Document.delete | `Document.delete`} */
1668
+ type DeleteOperationInstance<Op extends DatabaseDeleteOperation> = InexactPartial<
1669
+ Omit<Op, "ids" | "parent" | "pack">
1670
+ >;
1671
+
1672
+ /** Used for {@link Document._preDeleteOperation | `Document._preDeleteOperation`} */
1673
+ type PreDeleteOperationStatic<Op extends DatabaseDeleteOperation> = InexactPartial<
1674
+ Op,
1675
+ Exclude<AllKeysOf<Op>, "modifiedTime" | "render" | "ids" | "deleteAll" | "noHook" | "pack" | "parent">
1676
+ >;
1677
+
1678
+ /** Used for {@link Document._preDelete | `Document#_preDelete`} */
1679
+ type PreDeleteOperationInstance<Op extends DatabaseDeleteOperation> = Omit<
1680
+ InexactPartial<Op, Exclude<AllKeysOf<Op>, "modifiedTime" | "render">>,
1681
+ "ids" | "deleteAll" | "noHook" | "pack" | "parent"
1682
+ >;
1683
+
1684
+ /** Used for {@link Document._onDelete | `Document#_onDelete`} */
1685
+ type DeleteOptions<Op extends DatabaseDeleteOperation> = Omit<
1686
+ Op,
1687
+ "ids" | "deleteAll" | "pack" | "parentUuid" | "syntheticActorUpdate"
1688
+ >;
1438
1689
 
1439
1690
  /**
1440
1691
  * This is a helper type that gets the right DatabaseOperation (including the
1441
1692
  * proper options) for a particular Document type.
1693
+ *
1694
+ * @deprecated This is no longer used internally inside fvtt-types. If you have use for it please file an issue.
1695
+ */
1696
+ type OperationOf<T extends Document.Type, Operation extends Database.Operation> =
1697
+ | (Operation extends "create" ? DatabaseOperationCreateMap[T] : never)
1698
+ | (Operation extends "update" ? DatabaseOperationUpdateMap[T] : never)
1699
+ | (Operation extends "delete" ? DatabaseOperationDeleteMap[T] : never);
1700
+
1701
+ /**
1702
+ * @deprecated See individual document's namespaces.
1703
+ */
1704
+ interface Operations<
1705
+ _T extends Document.Internal.Instance.Any = Document.Internal.Instance.Any,
1706
+ _ExtraCreateOptions extends AnyObject = any,
1707
+ _ExtraUpdateOptions extends AnyObject = any,
1708
+ _ExtraDeleteOptions extends AnyObject = any,
1709
+ > {
1710
+ create: AnyObject;
1711
+ update: AnyObject;
1712
+ delete: AnyObject;
1713
+ }
1714
+
1715
+ type CreateForName<DocumentType extends Document.Type> =
1716
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.Database.Create : never)
1717
+ | (DocumentType extends "ActorDelta" ? ActorDelta.Database.Create : never)
1718
+ | (DocumentType extends "Actor" ? Actor.Database.Create : never)
1719
+ | (DocumentType extends "Adventure" ? Adventure.Database.Create : never)
1720
+ | (DocumentType extends "Card" ? Card.Database.Create : never)
1721
+ | (DocumentType extends "Cards" ? Cards.Database.Create : never)
1722
+ | (DocumentType extends "ChatMessage" ? ChatMessage.Database.Create : never)
1723
+ | (DocumentType extends "Combat" ? Combat.Database.Create : never)
1724
+ | (DocumentType extends "Combatant" ? Combatant.Database.Create : never)
1725
+ | (DocumentType extends "FogExploration" ? FogExploration.Database.Create : never)
1726
+ | (DocumentType extends "Folder" ? Folder.Database.Create : never)
1727
+ | (DocumentType extends "Item" ? Item.Database.Create : never)
1728
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.Database.Create : never)
1729
+ | (DocumentType extends "JournalEntry" ? JournalEntry.Database.Create : never)
1730
+ | (DocumentType extends "Macro" ? Macro.Database.Create : never)
1731
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.Database.Create : never)
1732
+ | (DocumentType extends "Playlist" ? Playlist.Database.Create : never)
1733
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.Database.Create : never)
1734
+ | (DocumentType extends "RollTable" ? RollTable.Database.Create : never)
1735
+ | (DocumentType extends "Scene" ? Scene.Database.Create : never)
1736
+ | (DocumentType extends "Setting" ? Setting.Database.Create : never)
1737
+ | (DocumentType extends "TableResult" ? TableResult.Database.Create : never)
1738
+ | (DocumentType extends "User" ? User.Database.Create : never)
1739
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.Database.Create : never)
1740
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.Database.Create : never)
1741
+ | (DocumentType extends "Drawing" ? DrawingDocument.Database.Create : never)
1742
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.Database.Create : never)
1743
+ | (DocumentType extends "Note" ? NoteDocument.Database.Create : never)
1744
+ | (DocumentType extends "Region" ? RegionDocument.Database.Create : never)
1745
+ | (DocumentType extends "Tile" ? TileDocument.Database.Create : never)
1746
+ | (DocumentType extends "Token" ? TokenDocument.Database.Create : never)
1747
+ | (DocumentType extends "Wall" ? WallDocument.Database.Create : never);
1748
+
1749
+ type UpdateOperationForName<DocumentType extends Document.Type> =
1750
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.Database.UpdateOperation : never)
1751
+ | (DocumentType extends "ActorDelta" ? ActorDelta.Database.UpdateOperation : never)
1752
+ | (DocumentType extends "Actor" ? Actor.Database.UpdateOperation : never)
1753
+ | (DocumentType extends "Adventure" ? Adventure.Database.UpdateOperation : never)
1754
+ | (DocumentType extends "Card" ? Card.Database.UpdateOperation : never)
1755
+ | (DocumentType extends "Cards" ? Cards.Database.UpdateOperation : never)
1756
+ | (DocumentType extends "ChatMessage" ? ChatMessage.Database.UpdateOperation : never)
1757
+ | (DocumentType extends "Combat" ? Combat.Database.UpdateOperation : never)
1758
+ | (DocumentType extends "Combatant" ? Combatant.Database.UpdateOperation : never)
1759
+ | (DocumentType extends "FogExploration" ? FogExploration.Database.UpdateOperation : never)
1760
+ | (DocumentType extends "Folder" ? Folder.Database.UpdateOperation : never)
1761
+ | (DocumentType extends "Item" ? Item.Database.UpdateOperation : never)
1762
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.Database.UpdateOperation : never)
1763
+ | (DocumentType extends "JournalEntry" ? JournalEntry.Database.UpdateOperation : never)
1764
+ | (DocumentType extends "Macro" ? Macro.Database.UpdateOperation : never)
1765
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.Database.UpdateOperation : never)
1766
+ | (DocumentType extends "Playlist" ? Playlist.Database.UpdateOperation : never)
1767
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.Database.UpdateOperation : never)
1768
+ | (DocumentType extends "RollTable" ? RollTable.Database.UpdateOperation : never)
1769
+ | (DocumentType extends "Scene" ? Scene.Database.UpdateOperation : never)
1770
+ | (DocumentType extends "Setting" ? Setting.Database.UpdateOperation : never)
1771
+ | (DocumentType extends "TableResult" ? TableResult.Database.UpdateOperation : never)
1772
+ | (DocumentType extends "User" ? User.Database.UpdateOperation : never)
1773
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.Database.UpdateOperation : never)
1774
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.Database.UpdateOperation : never)
1775
+ | (DocumentType extends "Drawing" ? DrawingDocument.Database.UpdateOperation : never)
1776
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.Database.UpdateOperation : never)
1777
+ | (DocumentType extends "Note" ? NoteDocument.Database.UpdateOperation : never)
1778
+ | (DocumentType extends "Region" ? RegionDocument.Database.UpdateOperation : never)
1779
+ | (DocumentType extends "Tile" ? TileDocument.Database.UpdateOperation : never)
1780
+ | (DocumentType extends "Token" ? TokenDocument.Database.UpdateOperation : never)
1781
+ | (DocumentType extends "Wall" ? WallDocument.Database.UpdateOperation : never);
1782
+
1783
+ type DeleteOperationForName<DocumentType extends Document.Type> =
1784
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.Database.DeleteOperation : never)
1785
+ | (DocumentType extends "ActorDelta" ? ActorDelta.Database.DeleteOperation : never)
1786
+ | (DocumentType extends "Actor" ? Actor.Database.DeleteOperation : never)
1787
+ | (DocumentType extends "Adventure" ? Adventure.Database.DeleteOperation : never)
1788
+ | (DocumentType extends "Card" ? Card.Database.DeleteOperation : never)
1789
+ | (DocumentType extends "Cards" ? Cards.Database.DeleteOperation : never)
1790
+ | (DocumentType extends "ChatMessage" ? ChatMessage.Database.DeleteOperation : never)
1791
+ | (DocumentType extends "Combat" ? Combat.Database.DeleteOperation : never)
1792
+ | (DocumentType extends "Combatant" ? Combatant.Database.DeleteOperation : never)
1793
+ | (DocumentType extends "FogExploration" ? FogExploration.Database.DeleteOperation : never)
1794
+ | (DocumentType extends "Folder" ? Folder.Database.DeleteOperation : never)
1795
+ | (DocumentType extends "Item" ? Item.Database.DeleteOperation : never)
1796
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.Database.DeleteOperation : never)
1797
+ | (DocumentType extends "JournalEntry" ? JournalEntry.Database.DeleteOperation : never)
1798
+ | (DocumentType extends "Macro" ? Macro.Database.DeleteOperation : never)
1799
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.Database.DeleteOperation : never)
1800
+ | (DocumentType extends "Playlist" ? Playlist.Database.DeleteOperation : never)
1801
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.Database.DeleteOperation : never)
1802
+ | (DocumentType extends "RollTable" ? RollTable.Database.DeleteOperation : never)
1803
+ | (DocumentType extends "Scene" ? Scene.Database.DeleteOperation : never)
1804
+ | (DocumentType extends "Setting" ? Setting.Database.DeleteOperation : never)
1805
+ | (DocumentType extends "TableResult" ? TableResult.Database.DeleteOperation : never)
1806
+ | (DocumentType extends "User" ? User.Database.DeleteOperation : never)
1807
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.Database.DeleteOperation : never)
1808
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.Database.DeleteOperation : never)
1809
+ | (DocumentType extends "Drawing" ? DrawingDocument.Database.DeleteOperation : never)
1810
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.Database.DeleteOperation : never)
1811
+ | (DocumentType extends "Note" ? NoteDocument.Database.DeleteOperation : never)
1812
+ | (DocumentType extends "Region" ? RegionDocument.Database.DeleteOperation : never)
1813
+ | (DocumentType extends "Tile" ? TileDocument.Database.DeleteOperation : never)
1814
+ | (DocumentType extends "Token" ? TokenDocument.Database.DeleteOperation : never)
1815
+ | (DocumentType extends "Wall" ? WallDocument.Database.DeleteOperation : never);
1816
+
1817
+ type CreateOptionsFor<DocumentType extends Document.Type> =
1818
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.Database.CreateOptions : never)
1819
+ | (DocumentType extends "ActorDelta" ? ActorDelta.Database.CreateOptions : never)
1820
+ | (DocumentType extends "Actor" ? Actor.Database.CreateOptions : never)
1821
+ | (DocumentType extends "Adventure" ? Adventure.Database.CreateOptions : never)
1822
+ | (DocumentType extends "Card" ? Card.Database.CreateOptions : never)
1823
+ | (DocumentType extends "Cards" ? Cards.Database.CreateOptions : never)
1824
+ | (DocumentType extends "ChatMessage" ? ChatMessage.Database.CreateOptions : never)
1825
+ | (DocumentType extends "Combat" ? Combat.Database.CreateOptions : never)
1826
+ | (DocumentType extends "Combatant" ? Combatant.Database.CreateOptions : never)
1827
+ | (DocumentType extends "FogExploration" ? FogExploration.Database.CreateOptions : never)
1828
+ | (DocumentType extends "Folder" ? Folder.Database.CreateOptions : never)
1829
+ | (DocumentType extends "Item" ? Item.Database.CreateOptions : never)
1830
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.Database.CreateOptions : never)
1831
+ | (DocumentType extends "JournalEntry" ? JournalEntry.Database.CreateOptions : never)
1832
+ | (DocumentType extends "Macro" ? Macro.Database.CreateOptions : never)
1833
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.Database.CreateOptions : never)
1834
+ | (DocumentType extends "Playlist" ? Playlist.Database.CreateOptions : never)
1835
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.Database.CreateOptions : never)
1836
+ | (DocumentType extends "RollTable" ? RollTable.Database.CreateOptions : never)
1837
+ | (DocumentType extends "Scene" ? Scene.Database.CreateOptions : never)
1838
+ | (DocumentType extends "Setting" ? Setting.Database.CreateOptions : never)
1839
+ | (DocumentType extends "TableResult" ? TableResult.Database.CreateOptions : never)
1840
+ | (DocumentType extends "User" ? User.Database.CreateOptions : never)
1841
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.Database.CreateOptions : never)
1842
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.Database.CreateOptions : never)
1843
+ | (DocumentType extends "Drawing" ? DrawingDocument.Database.CreateOptions : never)
1844
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.Database.CreateOptions : never)
1845
+ | (DocumentType extends "Note" ? NoteDocument.Database.CreateOptions : never)
1846
+ | (DocumentType extends "Region" ? RegionDocument.Database.CreateOptions : never)
1847
+ | (DocumentType extends "Tile" ? TileDocument.Database.CreateOptions : never)
1848
+ | (DocumentType extends "Token" ? TokenDocument.Database.CreateOptions : never)
1849
+ | (DocumentType extends "Wall" ? WallDocument.Database.CreateOptions : never);
1850
+
1851
+ type UpdateOptionsFor<DocumentType extends Document.Type> =
1852
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.Database.UpdateOptions : never)
1853
+ | (DocumentType extends "ActorDelta" ? ActorDelta.Database.UpdateOptions : never)
1854
+ | (DocumentType extends "Actor" ? Actor.Database.UpdateOptions : never)
1855
+ | (DocumentType extends "Adventure" ? Adventure.Database.UpdateOptions : never)
1856
+ | (DocumentType extends "Card" ? Card.Database.UpdateOptions : never)
1857
+ | (DocumentType extends "Cards" ? Cards.Database.UpdateOptions : never)
1858
+ | (DocumentType extends "ChatMessage" ? ChatMessage.Database.UpdateOptions : never)
1859
+ | (DocumentType extends "Combat" ? Combat.Database.UpdateOptions : never)
1860
+ | (DocumentType extends "Combatant" ? Combatant.Database.UpdateOptions : never)
1861
+ | (DocumentType extends "FogExploration" ? FogExploration.Database.UpdateOptions : never)
1862
+ | (DocumentType extends "Folder" ? Folder.Database.UpdateOptions : never)
1863
+ | (DocumentType extends "Item" ? Item.Database.UpdateOptions : never)
1864
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.Database.UpdateOptions : never)
1865
+ | (DocumentType extends "JournalEntry" ? JournalEntry.Database.UpdateOptions : never)
1866
+ | (DocumentType extends "Macro" ? Macro.Database.UpdateOptions : never)
1867
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.Database.UpdateOptions : never)
1868
+ | (DocumentType extends "Playlist" ? Playlist.Database.UpdateOptions : never)
1869
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.Database.UpdateOptions : never)
1870
+ | (DocumentType extends "RollTable" ? RollTable.Database.UpdateOptions : never)
1871
+ | (DocumentType extends "Scene" ? Scene.Database.UpdateOptions : never)
1872
+ | (DocumentType extends "Setting" ? Setting.Database.UpdateOptions : never)
1873
+ | (DocumentType extends "TableResult" ? TableResult.Database.UpdateOptions : never)
1874
+ | (DocumentType extends "User" ? User.Database.UpdateOptions : never)
1875
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.Database.UpdateOptions : never)
1876
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.Database.UpdateOptions : never)
1877
+ | (DocumentType extends "Drawing" ? DrawingDocument.Database.UpdateOptions : never)
1878
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.Database.UpdateOptions : never)
1879
+ | (DocumentType extends "Note" ? NoteDocument.Database.UpdateOptions : never)
1880
+ | (DocumentType extends "Region" ? RegionDocument.Database.UpdateOptions : never)
1881
+ | (DocumentType extends "Tile" ? TileDocument.Database.UpdateOptions : never)
1882
+ | (DocumentType extends "Token" ? TokenDocument.Database.UpdateOptions : never)
1883
+ | (DocumentType extends "Wall" ? WallDocument.Database.UpdateOptions : never);
1884
+
1885
+ type DeleteOptionsFor<DocumentType extends Document.Type> =
1886
+ | (DocumentType extends "ActiveEffect" ? ActiveEffect.Database.DeleteOptions : never)
1887
+ | (DocumentType extends "ActorDelta" ? ActorDelta.Database.DeleteOptions : never)
1888
+ | (DocumentType extends "Actor" ? Actor.Database.DeleteOptions : never)
1889
+ | (DocumentType extends "Adventure" ? Adventure.Database.DeleteOptions : never)
1890
+ | (DocumentType extends "Card" ? Card.Database.DeleteOptions : never)
1891
+ | (DocumentType extends "Cards" ? Cards.Database.DeleteOptions : never)
1892
+ | (DocumentType extends "ChatMessage" ? ChatMessage.Database.DeleteOptions : never)
1893
+ | (DocumentType extends "Combat" ? Combat.Database.DeleteOptions : never)
1894
+ | (DocumentType extends "Combatant" ? Combatant.Database.DeleteOptions : never)
1895
+ | (DocumentType extends "FogExploration" ? FogExploration.Database.DeleteOptions : never)
1896
+ | (DocumentType extends "Folder" ? Folder.Database.DeleteOptions : never)
1897
+ | (DocumentType extends "Item" ? Item.Database.DeleteOptions : never)
1898
+ | (DocumentType extends "JournalEntryPage" ? JournalEntryPage.Database.DeleteOptions : never)
1899
+ | (DocumentType extends "JournalEntry" ? JournalEntry.Database.DeleteOptions : never)
1900
+ | (DocumentType extends "Macro" ? Macro.Database.DeleteOptions : never)
1901
+ | (DocumentType extends "PlaylistSound" ? PlaylistSound.Database.DeleteOptions : never)
1902
+ | (DocumentType extends "Playlist" ? Playlist.Database.DeleteOptions : never)
1903
+ | (DocumentType extends "RegionBehavior" ? RegionBehavior.Database.DeleteOptions : never)
1904
+ | (DocumentType extends "RollTable" ? RollTable.Database.DeleteOptions : never)
1905
+ | (DocumentType extends "Scene" ? Scene.Database.DeleteOptions : never)
1906
+ | (DocumentType extends "Setting" ? Setting.Database.DeleteOptions : never)
1907
+ | (DocumentType extends "TableResult" ? TableResult.Database.DeleteOptions : never)
1908
+ | (DocumentType extends "User" ? User.Database.DeleteOptions : never)
1909
+ | (DocumentType extends "AmbientLight" ? AmbientLightDocument.Database.DeleteOptions : never)
1910
+ | (DocumentType extends "AmbientSound" ? AmbientSoundDocument.Database.DeleteOptions : never)
1911
+ | (DocumentType extends "Drawing" ? DrawingDocument.Database.DeleteOptions : never)
1912
+ | (DocumentType extends "MeasuredTemplate" ? MeasuredTemplateDocument.Database.DeleteOptions : never)
1913
+ | (DocumentType extends "Note" ? NoteDocument.Database.DeleteOptions : never)
1914
+ | (DocumentType extends "Region" ? RegionDocument.Database.DeleteOptions : never)
1915
+ | (DocumentType extends "Tile" ? TileDocument.Database.DeleteOptions : never)
1916
+ | (DocumentType extends "Token" ? TokenDocument.Database.DeleteOptions : never)
1917
+ | (DocumentType extends "Wall" ? WallDocument.Database.DeleteOptions : never);
1918
+ }
1919
+
1920
+ interface DataFieldShimOptions {
1921
+ /**
1922
+ * Apply shims to embedded models?
1923
+ */
1924
+ warning?: string | null | undefined;
1925
+
1926
+ /**
1927
+ * @remarks Foundry uses `if ("value" in options)` to determine whether to override the default value.
1442
1928
  */
1443
- type OperationOf<
1444
- T extends Document.Type,
1445
- Operation extends Database.Operation,
1446
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1447
- > = DatabaseOperationMap[T][Operation];
1929
+ value?: unknown;
1448
1930
  }
1931
+
1932
+ type ParentContext<Parent extends Document.Any | null> = Parent extends null
1933
+ ? {
1934
+ /** A parent document within which the created Document should belong */
1935
+ parent?: Parent | undefined;
1936
+ }
1937
+ : {
1938
+ /** A parent document within which the created Document should belong */
1939
+ parent: Parent;
1940
+ };
1941
+
1942
+ type DefaultNameContext<SubType extends string, Parent extends Document.Any | null> = {
1943
+ /** The sub-type of the document */
1944
+ type?: SubType | undefined;
1945
+
1946
+ /** A compendium pack within which the Document should be created */
1947
+ pack?: string | undefined;
1948
+ } & ParentContext<Parent>;
1949
+
1950
+ interface FromDropDataOptions {
1951
+ /**
1952
+ * Import the provided document data into the World, if it is not already a World-level Document reference
1953
+ * @defaultValue `false`
1954
+ */
1955
+ importWorld?: boolean;
1956
+ }
1957
+
1958
+ type CreateDialogData<CreateData extends object> = InexactPartial<
1959
+ CreateData,
1960
+ Extract<AllKeysOf<CreateData>, "name" | "type" | "folder">
1961
+ >;
1962
+
1963
+ type CreateDialogContext<
1964
+ SubType extends string,
1965
+ Parent extends Document.Any | null,
1966
+ > = InexactPartial<Dialog.Options> & {
1967
+ /**
1968
+ * A compendium pack within which the Document should be created
1969
+ */
1970
+ pack?: string | null | undefined;
1971
+
1972
+ /** A restriction the selectable sub-types of the Dialog. */
1973
+ types?: SubType[] | null | undefined;
1974
+ } & ParentContext<Parent>;
1975
+
1976
+ interface FromImportContext<Parent extends Document.Any | null>
1977
+ extends ConstructionContext<Parent>,
1978
+ DataModel.DataValidationOptions<Parent> {}
1979
+
1980
+ type TestableOwnershipLevel = keyof typeof CONST.DOCUMENT_OWNERSHIP_LEVELS | CONST.DOCUMENT_OWNERSHIP_LEVELS;
1981
+
1982
+ /** @internal */
1983
+ type _TestUserPermissionsOptions = NullishProps<{
1984
+ /**
1985
+ * Require the exact permission level requested?
1986
+ * @defaultValue `false`
1987
+ */
1988
+ exact: boolean;
1989
+ }>;
1990
+
1991
+ interface TestUserPermissionOptions extends _TestUserPermissionsOptions {}
1992
+
1993
+ /**
1994
+ * @deprecated {@link ImplementationFor | `ImplementationFor`}
1995
+ */
1996
+ type ConfiguredInstanceForName<Name extends Type> = ImplementationFor<Name>;
1997
+
1998
+ /**
1999
+ * @deprecated {@link ImplementationClassFor | `ImplementationClassFor`}
2000
+ */
2001
+ type ConfiguredClassForName<Name extends Type> = ImplementationClassFor<Name>;
2002
+
2003
+ /**
2004
+ * @deprecated {@link SchemaField.SourceData | `SchemaField.SourceData<Schema>`}
2005
+ */
2006
+ type ToObjectFalseType<T extends Document.Internal.Instance.Any> = T extends {
2007
+ toObject: (source: false) => infer U;
2008
+ }
2009
+ ? U
2010
+ : T;
2011
+
2012
+ /**
2013
+ * @deprecated {@link Document.Database.OperationOf | `Document.Database.OperationOf`}
2014
+ */
2015
+ type DatabaseOperationsFor<
2016
+ Name extends Document.Type,
2017
+ ConcreteOperation extends Document.Database.Operation,
2018
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
2019
+ > = Document.Database.OperationOf<Name, ConcreteOperation>;
2020
+
2021
+ /**
2022
+ * @deprecated {@link CreateDataForName | `CreateDataForName`}
2023
+ */
2024
+ type ConstructorDataForName<T extends Document.Type> = CreateData[T];
2025
+
2026
+ type CanUserModifyData<Schema extends DataSchema, Action extends "create" | "update" | "delete"> =
2027
+ | (Action extends "create" ? SchemaField.CreateData<Schema> : never)
2028
+ | (Action extends "update" ? SchemaField.UpdateData<Schema> : never)
2029
+ | (Action extends "delete" ? EmptyObject : never);
2030
+
2031
+ /**
2032
+ * @internal
2033
+ */
2034
+ type _GetEmbeddedDocumentOptions = InexactPartial<{
2035
+ /**
2036
+ * Throw an Error if the requested id does not exist. See {@link Collection.get | `Collection#get`}
2037
+ * @defaultValue `false`
2038
+ */
2039
+ strict: boolean;
2040
+
2041
+ /**
2042
+ * Allow retrieving an invalid Embedded Document.
2043
+ * @defaultValue `false`
2044
+ */
2045
+ invalid: boolean;
2046
+ }>;
2047
+
2048
+ interface GetEmbeddedDocumentOptions extends _GetEmbeddedDocumentOptions {}
2049
+
2050
+ /**
2051
+ * Gets the hierarchical fields in the schema. Hardcoded to whatever Foundry fields are hierarchical
2052
+ * as there is no way to access the a static property of a custom fields from an instance.
2053
+ */
2054
+ type HierarchyOf<Schema extends DataSchema> = PickValue<
2055
+ Schema,
2056
+ EmbeddedCollectionField.Any | EmbeddedDocumentField.Any
2057
+ >;
2058
+
2059
+ type PreCreateDescendantDocumentsArgs<
2060
+ Parent extends Document.AnyStored,
2061
+ DirectDescendant extends Document.Any,
2062
+ Embedded extends Document.Metadata.Embedded,
2063
+ > = DirectDescendant extends unknown
2064
+ ? [
2065
+ parent: Parent,
2066
+ collection: Embedded[DirectDescendant["documentName"]],
2067
+ data: Document.CreateDataForName<DirectDescendant["documentName"]>[],
2068
+ options: Document.Database.CreateOptionsFor<DirectDescendant["documentName"]>,
2069
+ userId: string,
2070
+ ]
2071
+ : never;
2072
+
2073
+ type OnCreateDescendantDocumentsArgs<
2074
+ Parent extends Document.AnyStored,
2075
+ DirectDescendant extends Document.Any,
2076
+ Embedded extends Document.Metadata.Embedded,
2077
+ > = DirectDescendant extends unknown
2078
+ ? [
2079
+ parent: Parent,
2080
+ collection: Embedded[DirectDescendant["documentName"]],
2081
+ documents: DirectDescendant[],
2082
+ data: Document.CreateDataForName<DirectDescendant["documentName"]>[],
2083
+ options: Document.Database.CreateOptionsFor<DirectDescendant["documentName"]>,
2084
+ userId: string,
2085
+ ]
2086
+ : never;
2087
+
2088
+ type PreUpdateDescendantDocumentsArgs<
2089
+ Parent extends Document.AnyStored,
2090
+ DirectDescendant extends Document.Any,
2091
+ Embedded extends Document.Metadata.Embedded,
2092
+ > = DirectDescendant extends unknown
2093
+ ? [
2094
+ parent: Parent,
2095
+ collection: Embedded[DirectDescendant["documentName"]],
2096
+ changes: Document.UpdateDataForName<DirectDescendant["documentName"]>[],
2097
+ options: Document.Database.UpdateOptionsFor<DirectDescendant["documentName"]>,
2098
+ userId: string,
2099
+ ]
2100
+ : never;
2101
+
2102
+ type OnUpdateDescendantDocumentsArgs<
2103
+ Parent extends Document.AnyStored,
2104
+ DirectDescendant extends Document.Any,
2105
+ Embedded extends Document.Metadata.Embedded,
2106
+ > = DirectDescendant extends unknown
2107
+ ? [
2108
+ parent: Parent,
2109
+ collection: Embedded[DirectDescendant["documentName"]],
2110
+ documents: DirectDescendant[],
2111
+ changes: Document.UpdateDataForName<DirectDescendant["documentName"]>[],
2112
+ options: Document.Database.UpdateOptionsFor<DirectDescendant["documentName"]>,
2113
+ userId: string,
2114
+ ]
2115
+ : never;
2116
+
2117
+ type PreDeleteDescendantDocumentsArgs<
2118
+ Parent extends Document.AnyStored,
2119
+ DirectDescendant extends Document.Any,
2120
+ Embedded extends Document.Metadata.Embedded,
2121
+ > = DirectDescendant extends unknown
2122
+ ? [
2123
+ parent: Parent,
2124
+ collection: Embedded[DirectDescendant["documentName"]],
2125
+ ids: string[],
2126
+ options: Document.Database.DeleteOptionsFor<DirectDescendant["documentName"]>,
2127
+ userId: string,
2128
+ ]
2129
+ : never;
2130
+
2131
+ type OnDeleteDescendantDocumentsArgs<
2132
+ Parent extends Document.AnyStored,
2133
+ DirectDescendant extends Document.Any,
2134
+ Embedded extends Document.Metadata.Embedded,
2135
+ > = DirectDescendant extends unknown
2136
+ ? [
2137
+ parent: Parent,
2138
+ collection: Embedded[DirectDescendant["documentName"]],
2139
+ documents: DirectDescendant[],
2140
+ ids: string[],
2141
+ options: Document.Database.DeleteOptionsFor<DirectDescendant["documentName"]>,
2142
+ userId: string,
2143
+ ]
2144
+ : never;
1449
2145
  }
1450
2146
 
1451
2147
  /** @deprecated {@link Document.Database.Operation | `Document.Database.Operation`} */
1452
2148
  export type Operation = Document.Database.Operation;
1453
2149
 
1454
- /* eslint-disable @typescript-eslint/no-empty-object-type */
1455
- /** @deprecated {@link Document.Database.Operations | `Document.Database.Operations`} */
1456
- export type DocumentDatabaseOperations<
1457
- T extends Document.Internal.Instance.Any = Document.Internal.Instance.Any,
1458
- ExtraCreateOptions extends AnyObject = {},
1459
- ExtraUpdateOptions extends AnyObject = {},
1460
- ExtraDeleteOptions extends AnyObject = {},
1461
- > = Document.Database.Operations<T, ExtraCreateOptions, ExtraUpdateOptions, ExtraDeleteOptions>;
1462
- /* eslint-enable @typescript-eslint/no-empty-object-type */
1463
-
2150
+ /* eslint-disable @typescript-eslint/no-deprecated */
1464
2151
  /**
1465
2152
  * @deprecated if you want to get individual operations see {@link Document.Database.OperationOf | `Document.Database.OperationOf`}
1466
2153
  */
@@ -1487,8 +2174,8 @@ export interface DatabaseOperationMap {
1487
2174
  Note: NoteDocument.DatabaseOperations;
1488
2175
  Playlist: Playlist.DatabaseOperations;
1489
2176
  PlaylistSound: PlaylistSound.DatabaseOperations;
1490
- Region: ActiveEffect.DatabaseOperations;
1491
- RegionBehavior: ActiveEffect.DatabaseOperations;
2177
+ Region: RegionDocument.DatabaseOperations;
2178
+ RegionBehavior: RegionBehavior.DatabaseOperations;
1492
2179
  RollTable: RollTable.DatabaseOperations;
1493
2180
  Scene: Scene.DatabaseOperations;
1494
2181
  Setting: Setting.DatabaseOperations;
@@ -1498,3 +2185,109 @@ export interface DatabaseOperationMap {
1498
2185
  User: User.DatabaseOperations;
1499
2186
  Wall: WallDocument.DatabaseOperations;
1500
2187
  }
2188
+ /* eslint-enable @typescript-eslint/no-deprecated */
2189
+
2190
+ interface DatabaseOperationCreateMap {
2191
+ ActiveEffect: ActiveEffect.Database.Create;
2192
+ Actor: Actor.Database.Create;
2193
+ ActorDelta: ActorDelta.Database.Create;
2194
+ Adventure: Adventure.Database.Create;
2195
+ AmbientLight: AmbientLightDocument.Database.Create;
2196
+ AmbientSound: AmbientSoundDocument.Database.Create;
2197
+ Card: Card.Database.Create;
2198
+ Cards: Cards.Database.Create;
2199
+ ChatMessage: ChatMessage.Database.Create;
2200
+ Combat: Combat.Database.Create;
2201
+ Combatant: Combatant.Database.Create;
2202
+ Drawing: DrawingDocument.Database.Create;
2203
+ FogExploration: FogExploration.Database.Create;
2204
+ Folder: Folder.Database.Create;
2205
+ Item: Item.Database.Create;
2206
+ JournalEntry: JournalEntry.Database.Create;
2207
+ JournalEntryPage: JournalEntryPage.Database.Create;
2208
+ Macro: Macro.Database.Create;
2209
+ MeasuredTemplate: MeasuredTemplateDocument.Database.Create;
2210
+ Note: NoteDocument.Database.Create;
2211
+ Playlist: Playlist.Database.Create;
2212
+ PlaylistSound: PlaylistSound.Database.Create;
2213
+ Region: RegionDocument.Database.Create;
2214
+ RegionBehavior: RegionBehavior.Database.Create;
2215
+ RollTable: RollTable.Database.Create;
2216
+ Scene: Scene.Database.Create;
2217
+ Setting: Setting.Database.Create;
2218
+ TableResult: TableResult.Database.Create;
2219
+ Tile: TileDocument.Database.Create;
2220
+ Token: TokenDocument.Database.Create;
2221
+ User: User.Database.Create;
2222
+ Wall: WallDocument.Database.Create;
2223
+ }
2224
+
2225
+ interface DatabaseOperationUpdateMap {
2226
+ ActiveEffect: ActiveEffect.Database.Update;
2227
+ Actor: Actor.Database.Update;
2228
+ ActorDelta: ActorDelta.Database.Update;
2229
+ Adventure: Adventure.Database.Update;
2230
+ AmbientLight: AmbientLightDocument.Database.Update;
2231
+ AmbientSound: AmbientSoundDocument.Database.Update;
2232
+ Card: Card.Database.Update;
2233
+ Cards: Cards.Database.Update;
2234
+ ChatMessage: ChatMessage.Database.Update;
2235
+ Combat: Combat.Database.Update;
2236
+ Combatant: Combatant.Database.Update;
2237
+ Drawing: DrawingDocument.Database.Update;
2238
+ FogExploration: FogExploration.Database.Update;
2239
+ Folder: Folder.Database.Update;
2240
+ Item: Item.Database.Update;
2241
+ JournalEntry: JournalEntry.Database.Update;
2242
+ JournalEntryPage: JournalEntryPage.Database.Update;
2243
+ Macro: Macro.Database.Update;
2244
+ MeasuredTemplate: MeasuredTemplateDocument.Database.Update;
2245
+ Note: NoteDocument.Database.Update;
2246
+ Playlist: Playlist.Database.Update;
2247
+ PlaylistSound: PlaylistSound.Database.Update;
2248
+ Region: RegionDocument.Database.Update;
2249
+ RegionBehavior: RegionBehavior.Database.Update;
2250
+ RollTable: RollTable.Database.Update;
2251
+ Scene: Scene.Database.Update;
2252
+ Setting: Setting.Database.Update;
2253
+ TableResult: TableResult.Database.Update;
2254
+ Tile: TileDocument.Database.Update;
2255
+ Token: TokenDocument.Database.Update;
2256
+ User: User.Database.Update;
2257
+ Wall: WallDocument.Database.Update;
2258
+ }
2259
+
2260
+ interface DatabaseOperationDeleteMap {
2261
+ ActiveEffect: ActiveEffect.Database.Delete;
2262
+ Actor: Actor.Database.Delete;
2263
+ ActorDelta: ActorDelta.Database.Delete;
2264
+ Adventure: Adventure.Database.Delete;
2265
+ AmbientLight: AmbientLightDocument.Database.Delete;
2266
+ AmbientSound: AmbientSoundDocument.Database.Delete;
2267
+ Card: Card.Database.Delete;
2268
+ Cards: Cards.Database.Delete;
2269
+ ChatMessage: ChatMessage.Database.Delete;
2270
+ Combat: Combat.Database.Delete;
2271
+ Combatant: Combatant.Database.Delete;
2272
+ Drawing: DrawingDocument.Database.Delete;
2273
+ FogExploration: FogExploration.Database.Delete;
2274
+ Folder: Folder.Database.Delete;
2275
+ Item: Item.Database.Delete;
2276
+ JournalEntry: JournalEntry.Database.Delete;
2277
+ JournalEntryPage: JournalEntryPage.Database.Delete;
2278
+ Macro: Macro.Database.Delete;
2279
+ MeasuredTemplate: MeasuredTemplateDocument.Database.Delete;
2280
+ Note: NoteDocument.Database.Delete;
2281
+ Playlist: Playlist.Database.Delete;
2282
+ PlaylistSound: PlaylistSound.Database.Delete;
2283
+ Region: RegionDocument.Database.Delete;
2284
+ RegionBehavior: RegionBehavior.Database.Delete;
2285
+ RollTable: RollTable.Database.Delete;
2286
+ Scene: Scene.Database.Delete;
2287
+ Setting: Setting.Database.Delete;
2288
+ TableResult: TableResult.Database.Delete;
2289
+ Tile: TileDocument.Database.Delete;
2290
+ Token: TokenDocument.Database.Delete;
2291
+ User: User.Database.Delete;
2292
+ Wall: WallDocument.Database.Delete;
2293
+ }