@league-of-foundry-developers/foundry-vtt-types 12.331.2-beta → 12.331.4-beta
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.
- package/README.md +17 -18
- package/package.json +73 -32
- package/src/configuration/configuration.d.mts +316 -0
- package/src/configuration/documents.d.mts +295 -0
- package/src/configuration/globals.d.mts +357 -0
- package/src/configuration/index.d.mts +5 -0
- package/src/foundry/client/apps/app.d.mts +129 -122
- package/src/foundry/client/apps/av/av-config.d.mts +12 -7
- package/src/foundry/client/apps/av/cameras.d.mts +12 -7
- package/src/foundry/client/apps/dice/dice-config.d.mts +59 -0
- package/src/foundry/client/apps/dice/index.d.mts +1 -0
- package/src/foundry/client/apps/form.d.mts +114 -86
- package/src/foundry/client/apps/forms/actor.d.mts +21 -11
- package/src/foundry/client/apps/forms/adventure-exporter.d.mts +12 -7
- package/src/foundry/client/apps/forms/adventure-importer.d.mts +14 -6
- package/src/foundry/client/apps/forms/base-sheet.d.mts +16 -8
- package/src/foundry/client/apps/forms/card-config.d.mts +16 -8
- package/src/foundry/client/apps/forms/cards-config.d.mts +15 -14
- package/src/foundry/client/apps/forms/combat-config.d.mts +7 -7
- package/src/foundry/client/apps/forms/combatant-config.d.mts +3 -3
- package/src/foundry/client/apps/forms/default-sheets-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/effect-config.d.mts +7 -7
- package/src/foundry/client/apps/forms/folder-config.d.mts +5 -5
- package/src/foundry/client/apps/forms/fonts.d.mts +42 -35
- package/src/foundry/client/apps/forms/grid-config.d.mts +12 -17
- package/src/foundry/client/apps/forms/image-popout.d.mts +29 -23
- package/src/foundry/client/apps/forms/item.d.mts +9 -9
- package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +16 -14
- package/src/foundry/client/apps/forms/journal-sheet.d.mts +48 -38
- package/src/foundry/client/apps/forms/macro-config.d.mts +7 -7
- package/src/foundry/client/apps/forms/measure-template.d.mts +10 -12
- package/src/foundry/client/apps/forms/ownership.d.mts +5 -5
- package/src/foundry/client/apps/forms/playlist-config.d.mts +8 -10
- package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +7 -7
- package/src/foundry/client/apps/forms/roll-table-config.d.mts +11 -10
- package/src/foundry/client/apps/forms/scene-config.d.mts +40 -41
- package/src/foundry/client/apps/forms/sheet-config.d.mts +9 -21
- package/src/foundry/client/apps/forms/user-config.d.mts +13 -12
- package/src/foundry/client/apps/hud/chatbubble.d.mts +18 -6
- package/src/foundry/client/apps/hud/container.d.mts +4 -4
- package/src/foundry/client/apps/hud/controls.d.mts +126 -81
- package/src/foundry/client/apps/hud/hotbar.d.mts +17 -12
- package/src/foundry/client/apps/hud/hud.d.mts +5 -5
- package/src/foundry/client/apps/hud/menu.d.mts +10 -3
- package/src/foundry/client/apps/hud/navigation.d.mts +14 -9
- package/src/foundry/client/apps/hud/pause.d.mts +9 -4
- package/src/foundry/client/apps/hud/players.d.mts +14 -9
- package/src/foundry/client/apps/i18n.d.mts +34 -27
- package/src/foundry/client/apps/index.d.mts +1 -0
- package/src/foundry/client/apps/placeables/drawing-config.d.mts +41 -33
- package/src/foundry/client/apps/placeables/drawing-hud.d.mts +5 -5
- package/src/foundry/client/apps/placeables/index.d.mts +0 -2
- package/src/foundry/client/apps/placeables/note-config.d.mts +28 -18
- package/src/foundry/client/apps/placeables/tile-config.d.mts +23 -10
- package/src/foundry/client/apps/placeables/tile-hud.d.mts +10 -5
- package/src/foundry/client/apps/placeables/token-config.d.mts +91 -58
- package/src/foundry/client/apps/placeables/token-hud.d.mts +12 -7
- package/src/foundry/client/apps/placeables/wall-config.d.mts +21 -17
- package/src/foundry/client/apps/sidebar/apps/chat-popout.d.mts +5 -5
- package/src/foundry/client/apps/sidebar/apps/client-settings.d.mts +3 -3
- package/src/foundry/client/apps/sidebar/apps/compendium.d.mts +15 -13
- package/src/foundry/client/apps/sidebar/apps/invitation-links.d.mts +3 -3
- package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +3 -2
- package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +6 -6
- package/src/foundry/client/apps/sidebar/apps/permission-config.d.mts +6 -6
- package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +34 -29
- package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +2 -2
- package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +13 -10
- package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +50 -35
- package/src/foundry/client/apps/sidebar/document-directory.d.mts +52 -38
- package/src/foundry/client/apps/sidebar/package-configuration.d.mts +4 -4
- package/src/foundry/client/apps/sidebar/sidebar-tab.d.mts +3 -3
- package/src/foundry/client/apps/sidebar/sidebar.d.mts +9 -4
- package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +11 -2
- package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +11 -2
- package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +39 -27
- package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +21 -12
- package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +30 -15
- package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +11 -2
- package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +11 -2
- package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +14 -5
- package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +30 -22
- package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +11 -2
- package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +14 -5
- package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +23 -5
- package/src/foundry/client/apps/templates.d.mts +6 -2
- package/src/foundry/client/av/client.d.mts +1 -1
- package/src/foundry/client/av/clients/simplepeer.d.mts +11 -1
- package/src/foundry/client/av/master.d.mts +2 -2
- package/src/foundry/client/av/settings.d.mts +17 -15
- package/src/foundry/client/config.d.mts +444 -314
- package/src/foundry/client/core/document-index.d.mts +11 -3
- package/src/foundry/client/core/hooks.d.mts +2 -4
- package/src/foundry/client/core/image.d.mts +92 -42
- package/src/foundry/client/core/issues.d.mts +9 -4
- package/src/foundry/client/core/keybindings.d.mts +5 -5
- package/src/foundry/client/core/nue.d.mts +1 -1
- package/src/foundry/client/core/packages.d.mts +397 -61
- package/src/foundry/client/core/settings.d.mts +62 -38
- package/src/foundry/client/core/socket.d.mts +2 -2
- package/src/foundry/client/core/sorting.d.mts +6 -6
- package/src/foundry/client/core/time.d.mts +6 -3
- package/src/foundry/client/core/tooltip.d.mts +2 -2
- package/src/foundry/client/core/tour.d.mts +59 -50
- package/src/foundry/client/core/tours.d.mts +1 -1
- package/src/foundry/client/core/utils.d.mts +33 -10
- package/src/foundry/client/core/video.d.mts +1 -1
- package/src/foundry/client/core/workers.d.mts +24 -17
- package/src/foundry/client/data/abstract/canvas-document.d.mts +21 -17
- package/src/foundry/client/data/abstract/client-document.d.mts +153 -183
- package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +23 -39
- package/src/foundry/client/data/abstract/document-collection.d.mts +96 -68
- package/src/foundry/client/data/abstract/world-collection.d.mts +48 -56
- package/src/foundry/client/data/collections/actors.d.mts +30 -28
- package/src/foundry/client/data/collections/cards.d.mts +16 -3
- package/src/foundry/client/data/collections/combats.d.mts +18 -5
- package/src/foundry/client/data/collections/compendium-collection.d.mts +85 -101
- package/src/foundry/client/data/collections/compendium-folders.d.mts +6 -6
- package/src/foundry/client/data/collections/compendium-packs.d.mts +6 -6
- package/src/foundry/client/data/collections/fog.d.mts +16 -3
- package/src/foundry/client/data/collections/folder.d.mts +20 -6
- package/src/foundry/client/data/collections/items.d.mts +17 -4
- package/src/foundry/client/data/collections/journal.d.mts +22 -7
- package/src/foundry/client/data/collections/macros.d.mts +21 -19
- package/src/foundry/client/data/collections/messages.d.mts +19 -6
- package/src/foundry/client/data/collections/playlists.d.mts +17 -5
- package/src/foundry/client/data/collections/scenes.d.mts +24 -27
- package/src/foundry/client/data/collections/settings.d.mts +16 -3
- package/src/foundry/client/data/collections/tables.d.mts +18 -5
- package/src/foundry/client/data/collections/users.d.mts +19 -7
- package/src/foundry/client/data/documents/active-effect.d.mts +677 -85
- package/src/foundry/client/data/documents/actor-delta.d.mts +670 -27
- package/src/foundry/client/data/documents/actor.d.mts +718 -55
- package/src/foundry/client/data/documents/adventure.d.mts +480 -46
- package/src/foundry/client/data/documents/ambient-light.d.mts +423 -19
- package/src/foundry/client/data/documents/ambient-sound.d.mts +473 -14
- package/src/foundry/client/data/documents/card.d.mts +567 -36
- package/src/foundry/client/data/documents/cards.d.mts +744 -85
- package/src/foundry/client/data/documents/chat-message.d.mts +574 -42
- package/src/foundry/client/data/documents/combat.d.mts +699 -69
- package/src/foundry/client/data/documents/combatant.d.mts +504 -24
- package/src/foundry/client/data/documents/drawing.d.mts +540 -14
- package/src/foundry/client/data/documents/fog-exploration.d.mts +416 -21
- package/src/foundry/client/data/documents/folder.d.mts +468 -30
- package/src/foundry/client/data/documents/index.d.mts +2 -0
- package/src/foundry/client/data/documents/item.d.mts +677 -20
- package/src/foundry/client/data/documents/journal-entry-page.d.mts +585 -19
- package/src/foundry/client/data/documents/journal-entry.d.mts +619 -18
- package/src/foundry/client/data/documents/macro.d.mts +528 -25
- package/src/foundry/client/data/documents/measured-template.d.mts +478 -14
- package/src/foundry/client/data/documents/note.d.mts +491 -15
- package/src/foundry/client/data/documents/playlist-sound.d.mts +426 -24
- package/src/foundry/client/data/documents/playlist.d.mts +665 -74
- package/src/foundry/client/data/documents/region-behavior.d.mts +507 -0
- package/src/foundry/client/data/documents/region.d.mts +784 -0
- package/src/foundry/client/data/documents/scene.d.mts +983 -140
- package/src/foundry/client/data/documents/setting.d.mts +395 -13
- package/src/foundry/client/data/documents/table-result.d.mts +476 -14
- package/src/foundry/client/data/documents/table.d.mts +661 -78
- package/src/foundry/client/data/documents/tile.d.mts +499 -14
- package/src/foundry/client/data/documents/token.d.mts +1110 -97
- package/src/foundry/client/data/documents/user.d.mts +493 -25
- package/src/foundry/client/data/documents/wall.d.mts +548 -14
- package/src/foundry/client/game.d.mts +62 -89
- package/src/foundry/client/head.d.mts +9 -9
- package/src/foundry/client/hooks.d.mts +257 -237
- package/src/foundry/client/pixi/board.d.mts +111 -104
- package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +97 -25
- package/src/foundry/client/pixi/core/containers/cached-container.d.mts +37 -19
- package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +7 -10
- package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +25 -15
- package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +16 -6
- package/src/foundry/client/pixi/core/containers/quadtree.d.mts +113 -54
- package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +69 -26
- package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +20 -2
- package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +164 -99
- package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +61 -22
- package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +120 -53
- package/src/foundry/client/pixi/core/interaction/ping.d.mts +62 -31
- package/src/foundry/client/pixi/core/interaction/pings/chevron.d.mts +23 -10
- package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +91 -34
- package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +76 -31
- package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +35 -5
- package/src/foundry/client/pixi/core/interaction/targets.d.mts +21 -18
- package/src/foundry/client/pixi/core/loader.d.mts +86 -76
- package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +42 -17
- package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +92 -64
- package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +28 -10
- package/src/foundry/client/pixi/core/shapes/ray.d.mts +47 -23
- package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +170 -75
- package/src/foundry/client/pixi/extensions/circle.d.mts +133 -122
- package/src/foundry/client/pixi/extensions/graphics.d.mts +3 -1
- package/src/foundry/client/pixi/extensions/observable-transform.d.mts +10 -2
- package/src/foundry/client/pixi/extensions/polygon.d.mts +155 -134
- package/src/foundry/client/pixi/extensions/rectangle.d.mts +266 -240
- package/src/foundry/client/pixi/groups/effects.d.mts +75 -24
- package/src/foundry/client/pixi/groups/environment.d.mts +68 -19
- package/src/foundry/client/pixi/groups/hidden.d.mts +27 -11
- package/src/foundry/client/pixi/groups/interface.d.mts +62 -38
- package/src/foundry/client/pixi/groups/overlay.d.mts +19 -7
- package/src/foundry/client/pixi/groups/primary.d.mts +66 -44
- package/src/foundry/client/pixi/groups/rendered.d.mts +19 -7
- package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +11 -15
- package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +29 -28
- package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +306 -272
- package/src/foundry/client/pixi/layers/controls/cursor.d.mts +18 -9
- package/src/foundry/client/pixi/layers/controls/door.d.mts +32 -11
- package/src/foundry/client/pixi/layers/controls/layer.d.mts +89 -77
- package/src/foundry/client/pixi/layers/controls/ruler.d.mts +121 -96
- package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +9 -12
- package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +9 -10
- package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +8 -8
- package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +22 -22
- package/src/foundry/client/pixi/layers/effects/visibility.d.mts +106 -86
- package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +14 -5
- package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +31 -2
- package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +137 -65
- package/src/foundry/client/pixi/layers/grid/highlight.d.mts +14 -4
- package/src/foundry/client/pixi/layers/grid/layer.d.mts +92 -92
- package/src/foundry/client/pixi/layers/grid/mesh.d.mts +37 -16
- package/src/foundry/client/pixi/layers/masks/depth.d.mts +12 -7
- package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +19 -12
- package/src/foundry/client/pixi/layers/masks/vision.d.mts +104 -18
- package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +16 -15
- package/src/foundry/client/pixi/layers/placeables/index.d.mts +1 -0
- package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +12 -14
- package/src/foundry/client/pixi/layers/placeables/notes.d.mts +49 -32
- package/src/foundry/client/pixi/layers/placeables/regions.d.mts +113 -0
- package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +81 -67
- package/src/foundry/client/pixi/layers/placeables/templates.d.mts +11 -15
- package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +30 -21
- package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +66 -52
- package/src/foundry/client/pixi/layers/placeables/walls.d.mts +54 -57
- package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +62 -27
- package/src/foundry/client/pixi/perception/detection-mode.d.mts +121 -47
- package/src/foundry/client/pixi/perception/fog.d.mts +38 -15
- package/src/foundry/client/pixi/perception/perception-manager.d.mts +136 -136
- package/src/foundry/client/pixi/perception/vision-mode.d.mts +108 -66
- package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +77 -39
- package/src/foundry/client/pixi/placeable.d.mts +238 -137
- package/src/foundry/client/pixi/placeables/drawing.d.mts +255 -133
- package/src/foundry/client/pixi/placeables/index.d.mts +1 -0
- package/src/foundry/client/pixi/placeables/light.d.mts +199 -64
- package/src/foundry/client/pixi/placeables/note.d.mts +145 -54
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +30 -8
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +41 -11
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +59 -18
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +120 -37
- package/src/foundry/client/pixi/placeables/region.d.mts +280 -0
- package/src/foundry/client/pixi/placeables/sound.d.mts +205 -66
- package/src/foundry/client/pixi/placeables/template.d.mts +181 -99
- package/src/foundry/client/pixi/placeables/tile.d.mts +206 -140
- package/src/foundry/client/pixi/placeables/token.d.mts +916 -448
- package/src/foundry/client/pixi/placeables/wall.d.mts +249 -129
- package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +72 -33
- package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/helpers/{framebugger-snapshot.d.mts → framebuffer-snapshot.d.mts} +10 -9
- package/src/foundry/client/pixi/webgl/helpers/index.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +38 -23
- package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +82 -53
- package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +12 -12
- package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +45 -28
- package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +12 -11
- package/src/foundry/client/pixi/webgl/shaders/filters/base-mask-filter.d.mts +12 -10
- package/src/foundry/client/pixi/webgl/shaders/filters/blur.d.mts +22 -20
- package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +36 -32
- package/src/foundry/client/pixi/webgl/shaders/filters/environment.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +12 -11
- package/src/foundry/client/pixi/webgl/shaders/filters/invisibility.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +12 -11
- package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +67 -60
- package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +24 -17
- package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +13 -10
- package/src/foundry/client/pixi/webgl/shaders/filters/void.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/filters/weather-occlusion-masks.d.mts +11 -10
- package/src/foundry/client/pixi/webgl/shaders/fragment-channel-mixin.d.mts +20 -14
- package/src/foundry/client/pixi/webgl/shaders/grid/grid.d.mts +12 -11
- package/src/foundry/client/pixi/webgl/shaders/lighting/background-lighting.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/base-lighting.d.mts +33 -33
- package/src/foundry/client/pixi/webgl/shaders/lighting/coloration-lighting.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/darkness-lighting.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/bewitching-wave.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/black-hole.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/chroma.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/emanation.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/energy-field.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/flame.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fog.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/force-grid.d.mts +10 -8
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/ghost-light.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/hexa-dome.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/light-dome.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/magical-gloom.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/pulse.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/radial-rainbow.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/revolving-light.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/roiling-mass.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/siren-light.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/smoke-patch.d.mts +20 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/star-light.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/sunburst.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/swirling-rainbow.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/torch.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/vortex.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/wave.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/lighting/illumination-lighting.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/region/adjust-darkness-level.d.mts +71 -29
- package/src/foundry/client/pixi/webgl/shaders/region/base.d.mts +54 -10
- package/src/foundry/client/pixi/webgl/shaders/region/highlight.d.mts +69 -9
- package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +24 -25
- package/src/foundry/client/pixi/webgl/shaders/samplers/baseline-illumination.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/samplers/color-adjustment.d.mts +38 -29
- package/src/foundry/client/pixi/webgl/shaders/samplers/depth.d.mts +21 -17
- package/src/foundry/client/pixi/webgl/shaders/samplers/fog-of-war.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/samplers/occlusion.d.mts +20 -18
- package/src/foundry/client/pixi/webgl/shaders/samplers/primary.d.mts +11 -2
- package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +28 -2
- package/src/foundry/client/pixi/webgl/shaders/vision/background-vision.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/vision/base-vision.d.mts +11 -9
- package/src/foundry/client/pixi/webgl/shaders/vision/coloration-vision.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/vision/effects/amplification.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/vision/effects/wave.d.mts +19 -17
- package/src/foundry/client/pixi/webgl/shaders/vision/illumination-vision.d.mts +10 -9
- package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +40 -36
- package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +27 -33
- package/src/foundry/client/pixi/webgl/shaders/weather/fog.d.mts +17 -16
- package/src/foundry/client/pixi/webgl/shaders/weather/rain.d.mts +19 -18
- package/src/foundry/client/pixi/webgl/shaders/weather/snow.d.mts +15 -14
- package/src/foundry/client/pixi/workers/texture-worker.d.mts +33 -53
- package/src/foundry/client/tours/setup-tour.d.mts +15 -10
- package/src/foundry/client/ui/context.d.mts +48 -40
- package/src/foundry/client/ui/dialog.d.mts +137 -126
- package/src/foundry/client/ui/drag.d.mts +1 -1
- package/src/foundry/client/ui/dragdrop.d.mts +34 -28
- package/src/foundry/client/ui/editor.d.mts +29 -21
- package/src/foundry/client/ui/filepicker.d.mts +43 -38
- package/src/foundry/client/ui/filter.d.mts +62 -50
- package/src/foundry/client/ui/forms.d.mts +22 -22
- package/src/foundry/client/ui/notifications.d.mts +10 -3
- package/src/foundry/client/ui/prosemirror.d.mts +15 -7
- package/src/foundry/client/ui/secrets.d.mts +42 -27
- package/src/foundry/client/ui/tabs.d.mts +40 -33
- package/src/foundry/client-esm/applications/_module.d.mts +3 -3
- package/src/foundry/client-esm/applications/_types.d.mts +0 -2
- package/src/foundry/client-esm/applications/api/_module.d.mts +2 -2
- package/src/foundry/client-esm/applications/api/application.d.mts +51 -39
- package/src/foundry/client-esm/applications/api/dialog.d.mts +20 -22
- package/src/foundry/client-esm/applications/api/document-sheet.d.mts +26 -12
- package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +142 -126
- package/src/foundry/client-esm/applications/apps/_module.d.mts +2 -2
- package/src/foundry/client-esm/applications/apps/compendium-art-config.d.mts +10 -10
- package/src/foundry/client-esm/applications/apps/permission-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/dice/_module.d.mts +2 -2
- package/src/foundry/client-esm/applications/dice/roll-resolver.d.mts +14 -2
- package/src/foundry/client-esm/applications/elements/_module.d.mts +2 -2
- package/src/foundry/client-esm/applications/elements/document-tags.d.mts +2 -0
- package/src/foundry/client-esm/applications/elements/file-picker.d.mts +1 -1
- package/src/foundry/client-esm/applications/elements/multi-select.d.mts +15 -5
- package/src/foundry/client-esm/applications/elements/string-tags.d.mts +1 -1
- package/src/foundry/client-esm/applications/forms/fields.d.mts +6 -1
- package/src/foundry/client-esm/applications/sheets/_module.d.mts +2 -2
- package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +16 -11
- package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +9 -7
- package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +30 -5
- package/src/foundry/client-esm/applications/sheets/region-config.d.mts +36 -5
- package/src/foundry/client-esm/applications/sheets/user-config.d.mts +8 -7
- package/src/foundry/client-esm/applications/ui/_module.d.mts +2 -2
- package/src/foundry/client-esm/applications/ui/region-legend.d.mts +45 -3
- package/src/foundry/client-esm/audio/_module.d.mts +2 -3
- package/src/foundry/client-esm/audio/_types.d.mts +3 -1
- package/src/foundry/client-esm/audio/biquad.d.mts +76 -26
- package/src/foundry/client-esm/audio/cache.d.mts +31 -20
- package/src/foundry/client-esm/audio/convolver.d.mts +47 -25
- package/src/foundry/client-esm/audio/helper.d.mts +123 -78
- package/src/foundry/client-esm/audio/sound.d.mts +230 -126
- package/src/foundry/client-esm/audio/timeout.d.mts +30 -11
- package/src/foundry/client-esm/canvas/_module.d.mts +2 -2
- package/src/foundry/client-esm/canvas/edges/_module.d.mts +2 -2
- package/src/foundry/client-esm/canvas/edges/collision.d.mts +69 -18
- package/src/foundry/client-esm/canvas/edges/edge.d.mts +110 -41
- package/src/foundry/client-esm/canvas/edges/edges.d.mts +10 -0
- package/src/foundry/client-esm/canvas/edges/vertex.d.mts +56 -26
- package/src/foundry/client-esm/canvas/regions/_module.d.mts +2 -3
- package/src/foundry/client-esm/canvas/regions/geometry.d.mts +38 -0
- package/src/foundry/client-esm/canvas/regions/mesh.d.mts +72 -0
- package/src/foundry/client-esm/canvas/regions/polygon-tree.d.mts +130 -0
- package/src/foundry/client-esm/canvas/regions/shape.d.mts +129 -0
- package/src/foundry/client-esm/canvas/scene-manager.d.mts +16 -6
- package/src/foundry/client-esm/canvas/smaa/blend.d.mts +14 -3
- package/src/foundry/client-esm/canvas/smaa/edges.d.mts +25 -3
- package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +121 -23
- package/src/foundry/client-esm/canvas/smaa/weights.d.mts +26 -3
- package/src/foundry/client-esm/canvas/sources/_module.d.mts +2 -2
- package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +84 -40
- package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +103 -39
- package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +89 -15
- package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +71 -30
- package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +49 -20
- package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +57 -16
- package/src/foundry/client-esm/canvas/sources/point-movement-source.d.mts +31 -4
- package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +45 -12
- package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +98 -52
- package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +180 -69
- package/src/foundry/client-esm/canvas/tokens/_module.d.mts +2 -3
- package/src/foundry/client-esm/canvas/tokens/ring-config.d.mts +174 -2
- package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +141 -2
- package/src/foundry/client-esm/canvas/tokens/ring.d.mts +284 -2
- package/src/foundry/client-esm/client.d.mts +47 -54
- package/src/foundry/client-esm/data/_module.d.mts +2 -2
- package/src/foundry/client-esm/data/client-backend.d.mts +22 -23
- package/src/foundry/client-esm/data/region-behaviors/_module.d.mts +3 -3
- package/src/foundry/client-esm/data/region-behaviors/adjust-darkness-level.d.mts +57 -0
- package/src/foundry/client-esm/data/region-behaviors/base.d.mts +59 -0
- package/src/foundry/client-esm/data/region-behaviors/display-scrolling-text.d.mts +64 -0
- package/src/foundry/client-esm/data/region-behaviors/execute-macro.d.mts +27 -0
- package/src/foundry/client-esm/data/region-behaviors/execute-script.d.mts +23 -0
- package/src/foundry/client-esm/data/region-behaviors/pause-game.d.mts +23 -0
- package/src/foundry/client-esm/data/region-behaviors/suppress-weather.d.mts +17 -0
- package/src/foundry/client-esm/data/region-behaviors/teleport-token.d.mts +32 -0
- package/src/foundry/client-esm/data/region-behaviors/toggle-behavior.d.mts +31 -0
- package/src/foundry/client-esm/dice/_module.d.mts +2 -3
- package/src/foundry/client-esm/dice/parser.d.mts +11 -25
- package/src/foundry/client-esm/dice/roll.d.mts +115 -89
- package/src/foundry/client-esm/dice/terms/_module.d.mts +2 -3
- package/src/foundry/client-esm/dice/terms/coin.d.mts +8 -5
- package/src/foundry/client-esm/dice/terms/dice.d.mts +93 -63
- package/src/foundry/client-esm/dice/terms/die.d.mts +11 -4
- package/src/foundry/client-esm/dice/terms/fate.d.mts +9 -2
- package/src/foundry/client-esm/dice/terms/function.d.mts +18 -18
- package/src/foundry/client-esm/dice/terms/numeric.d.mts +3 -5
- package/src/foundry/client-esm/dice/terms/operator.d.mts +2 -2
- package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +9 -10
- package/src/foundry/client-esm/dice/terms/pool.d.mts +25 -31
- package/src/foundry/client-esm/dice/terms/string.d.mts +4 -4
- package/src/foundry/client-esm/dice/terms/term.d.mts +18 -4
- package/src/foundry/client-esm/dice/twister.d.mts +3 -3
- package/src/foundry/client-esm/helpers/_module.d.mts +2 -2
- package/src/foundry/client-esm/helpers/_types.d.mts +12 -46
- package/src/foundry/client-esm/helpers/compendium-art.d.mts +56 -4
- package/src/foundry/common/abstract/_types.d.mts +60 -54
- package/src/foundry/common/abstract/backend.d.mts +51 -45
- package/src/foundry/common/abstract/data.d.mts +140 -154
- package/src/foundry/common/abstract/document.d.mts +1305 -421
- package/src/foundry/common/abstract/embedded-collection-delta.d.mts +1 -1
- package/src/foundry/common/abstract/embedded-collection.d.mts +37 -7
- package/src/foundry/common/abstract/module.d.mts +3 -2
- package/src/foundry/common/abstract/singleton-collection.d.mts +1 -1
- package/src/foundry/common/abstract/socket.d.mts +1 -1
- package/src/foundry/common/abstract/type-data.d.mts +62 -54
- package/src/foundry/common/config.d.mts +5 -3
- package/src/foundry/common/constants.d.mts +261 -231
- package/src/foundry/common/data/data.d.mts +200 -94
- package/src/foundry/common/data/fields.d.mts +746 -585
- package/src/foundry/common/data/module.d.mts +2 -2
- package/src/foundry/common/data/validation-failure.d.mts +12 -9
- package/src/foundry/common/documents/_module.d.mts +4 -2
- package/src/foundry/common/documents/_types.d.mts +22 -50
- package/src/foundry/common/documents/active-effect.d.mts +280 -177
- package/src/foundry/common/documents/actor-delta.d.mts +318 -69
- package/src/foundry/common/documents/actor.d.mts +305 -117
- package/src/foundry/common/documents/adventure.d.mts +266 -141
- package/src/foundry/common/documents/ambient-light.d.mts +268 -75
- package/src/foundry/common/documents/ambient-sound.d.mts +268 -109
- package/src/foundry/common/documents/card.d.mts +267 -174
- package/src/foundry/common/documents/cards.d.mts +299 -126
- package/src/foundry/common/documents/chat-message.d.mts +276 -158
- package/src/foundry/common/documents/combat.d.mts +300 -89
- package/src/foundry/common/documents/combatant.d.mts +275 -88
- package/src/foundry/common/documents/drawing.d.mts +286 -206
- package/src/foundry/common/documents/fog-exploration.d.mts +258 -70
- package/src/foundry/common/documents/folder.d.mts +252 -81
- package/src/foundry/common/documents/item.d.mts +305 -99
- package/src/foundry/common/documents/journal-entry-page.d.mts +279 -189
- package/src/foundry/common/documents/journal-entry.d.mts +294 -68
- package/src/foundry/common/documents/macro.d.mts +254 -132
- package/src/foundry/common/documents/measured-template.d.mts +293 -139
- package/src/foundry/common/documents/note.d.mts +274 -149
- package/src/foundry/common/documents/playlist-sound.d.mts +260 -94
- package/src/foundry/common/documents/playlist.d.mts +279 -120
- package/src/foundry/common/documents/region-behavior.d.mts +329 -0
- package/src/foundry/common/documents/region.d.mts +327 -0
- package/src/foundry/common/documents/roll-table.d.mts +286 -102
- package/src/foundry/common/documents/scene.d.mts +276 -336
- package/src/foundry/common/documents/setting.d.mts +229 -54
- package/src/foundry/common/documents/table-result.d.mts +267 -96
- package/src/foundry/common/documents/tile.d.mts +301 -170
- package/src/foundry/common/documents/token.d.mts +351 -445
- package/src/foundry/common/documents/user.d.mts +256 -144
- package/src/foundry/common/documents/wall.d.mts +273 -161
- package/src/foundry/common/grid/_module.d.mts +3 -3
- package/src/foundry/common/grid/base.d.mts +66 -49
- package/src/foundry/common/grid/gridless.d.mts +2 -2
- package/src/foundry/common/grid/hexagonal.d.mts +40 -29
- package/src/foundry/common/grid/square.d.mts +3 -3
- package/src/foundry/common/packages/base-module.d.mts +6 -24
- package/src/foundry/common/packages/base-package.d.mts +23 -21
- package/src/foundry/common/packages/base-system.d.mts +6 -63
- package/src/foundry/common/packages/base-world.d.mts +8 -61
- package/src/foundry/common/packages/module.d.mts +7 -7
- package/src/foundry/common/packages/sub-types.d.mts +2 -2
- package/src/foundry/common/primitives/array.d.mts +4 -4
- package/src/foundry/common/primitives/math.d.mts +7 -1
- package/src/foundry/common/primitives/number.d.mts +2 -2
- package/src/foundry/common/primitives/set.d.mts +17 -14
- package/src/foundry/common/primitives/string.d.mts +1 -1
- package/src/foundry/common/prosemirror/_module.d.mts +15 -15
- package/src/foundry/common/prosemirror/dirty-plugin.d.mts +1 -1
- package/src/foundry/common/prosemirror/dom-parser.d.mts +2 -1
- package/src/foundry/common/prosemirror/dropdown.d.mts +1 -1
- package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +2 -2
- package/src/foundry/common/prosemirror/image-plugin.d.mts +1 -1
- package/src/foundry/common/prosemirror/menu.d.mts +3 -3
- package/src/foundry/common/prosemirror/paste-transformer.d.mts +1 -1
- package/src/foundry/common/prosemirror/plugin.d.mts +2 -2
- package/src/foundry/common/prosemirror/schema/index.d.mts +0 -1
- package/src/foundry/common/prosemirror/schema/lists.d.mts +2 -0
- package/src/foundry/common/prosemirror/util.d.mts +1 -1
- package/src/foundry/common/types.d.mts +3 -3
- package/src/foundry/common/utils/bitmask.d.mts +23 -11
- package/src/foundry/common/utils/collection.d.mts +61 -38
- package/src/foundry/common/utils/color.d.mts +20 -2
- package/src/foundry/common/utils/event-emitter.d.mts +32 -17
- package/src/foundry/common/utils/geometry.d.mts +12 -2
- package/src/foundry/common/utils/helpers.d.mts +36 -26
- package/src/foundry/common/utils/http.d.mts +2 -2
- package/src/foundry/common/utils/module.d.mts +2 -2
- package/src/foundry/common/utils/string-tree.d.mts +45 -39
- package/src/foundry/common/utils/word-tree.d.mts +10 -23
- package/src/foundry/index.d.mts +0 -1
- package/src/foundry/{clipper → public/scripts/clipper}/clipper.d.mts +52 -43
- package/src/foundry/public/scripts/index.d.mts +1 -0
- package/src/foundry/public/scripts/workers/image-compressor.d.mts +23 -0
- package/src/foundry/public/scripts/workers/index.d.mts +1 -0
- package/{index-lenient.d.mts → src/index-lenient.d.mts} +2 -0
- package/src/index.d.mts +6 -0
- package/src/tsconfig.json +15 -0
- package/src/types/augments/particles.d.mts +29 -0
- package/src/types/augments/pixi.d.mts +1024 -21
- package/src/types/augments/smooth.d.mts +31 -0
- package/src/types/augments/tinyMCE.d.mts +1 -1
- package/src/types/config.d.mts +20 -311
- package/src/types/documentConfiguration.d.mts +286 -542
- package/src/types/index.d.mts +1 -1
- package/src/types/lib.d.mts +12 -0
- package/src/types/workers/image-compressor.d.mts +176 -0
- package/src/utils/index.d.mts +1279 -0
- package/tsconfig.json +29 -0
- package/tsconfig.main.json +8 -0
- package/tsconfig.miscellaneous.json +16 -0
- package/index.d.mts +0 -5
- package/src/foundry/client/apps/placeables/light-config.d.mts +0 -100
- package/src/foundry/client/apps/placeables/sound-config.d.mts +0 -43
- package/src/foundry/common/documents/module.d.mts +0 -35
- package/src/foundry/common/primitives/regex.d.mts +0 -12
- package/src/types/helperTypes.d.mts +0 -389
- package/src/types/utils.d.mts +0 -520
- /package/src/foundry/{clipper → public/scripts/clipper}/index.d.mts +0 -0
@@ -1,47 +1,74 @@
|
|
1
1
|
import type {
|
2
|
-
|
2
|
+
ConfigurationFailure,
|
3
|
+
ConfiguredDocumentClass,
|
4
|
+
ConfiguredDocumentInstance,
|
3
5
|
ConfiguredMetadata,
|
4
|
-
|
5
|
-
ConstructorData,
|
6
|
+
CreateData,
|
6
7
|
} from "../../../types/documentConfiguration.d.mts";
|
7
8
|
import type {
|
8
|
-
DatabaseOperationsFor,
|
9
9
|
GetKey,
|
10
10
|
InterfaceToObject,
|
11
11
|
MakeConform,
|
12
12
|
MustConform,
|
13
13
|
ToMethod,
|
14
|
-
} from "../../../types/helperTypes.mts";
|
15
|
-
import type {
|
16
14
|
AnyObject,
|
17
|
-
DeepPartial,
|
18
15
|
EmptyObject,
|
19
16
|
InexactPartial,
|
20
17
|
RemoveIndexSignatures,
|
21
|
-
|
22
|
-
|
18
|
+
FixedInstanceType,
|
19
|
+
NullishProps,
|
20
|
+
AllKeysOf,
|
21
|
+
DiscriminatedUnion,
|
22
|
+
SimpleMerge,
|
23
|
+
PickValue,
|
24
|
+
Identity,
|
25
|
+
Brand,
|
26
|
+
} from "fvtt-types/utils";
|
23
27
|
import type * as CONST from "../constants.mts";
|
24
|
-
import type {
|
28
|
+
import type {
|
29
|
+
DataField,
|
30
|
+
DocumentStatsField,
|
31
|
+
EmbeddedCollectionField,
|
32
|
+
EmbeddedDocumentField,
|
33
|
+
SchemaField,
|
34
|
+
TypeDataField,
|
35
|
+
} from "../data/fields.d.mts";
|
25
36
|
import type { fields } from "../data/module.mts";
|
26
37
|
import type { LogCompatibilityWarningOptions } from "../utils/logging.mts";
|
27
38
|
import type {
|
39
|
+
DatabaseAction,
|
28
40
|
DatabaseCreateOperation,
|
29
41
|
DatabaseDeleteOperation,
|
30
|
-
DatabaseGetOperation,
|
31
42
|
DatabaseUpdateOperation,
|
43
|
+
DocumentSocketRequest,
|
32
44
|
} from "./_types.d.mts";
|
33
45
|
import type DataModel from "./data.mts";
|
46
|
+
import type DocumentSocketResponse from "./socket.d.mts";
|
47
|
+
import type EmbeddedCollection from "./embedded-collection.d.mts";
|
34
48
|
|
35
|
-
|
36
|
-
|
37
|
-
declare const __DocumentBrand: unique symbol;
|
49
|
+
type DataSchema = foundry.data.fields.DataSchema;
|
38
50
|
|
39
|
-
|
40
|
-
declare const __Parent: unique symbol;
|
51
|
+
export default Document;
|
41
52
|
|
42
53
|
type _ClassMustBeAssignableToInternal = MustConform<typeof Document, Document.Internal.Constructor>;
|
43
54
|
type _InstanceMustBeAssignableToInternal = MustConform<Document.Any, Document.Internal.Instance.Any>;
|
44
55
|
|
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;
|
71
|
+
|
45
72
|
/**
|
46
73
|
* An extension of the base DataModel which defines a Document.
|
47
74
|
* Documents are special in that they are persisted to the database and referenced by _id.
|
@@ -50,17 +77,16 @@ declare abstract class Document<
|
|
50
77
|
DocumentName extends Document.Type,
|
51
78
|
Schema extends DataSchema,
|
52
79
|
Parent extends Document.Any | null = null,
|
53
|
-
> extends
|
54
|
-
static [__DocumentBrand]: never;
|
55
|
-
|
56
|
-
[__Schema]: Schema;
|
57
|
-
[__Parent]: Parent;
|
58
|
-
|
80
|
+
> extends _InternalDocument<Schema, Parent, InterfaceToObject<Document.ConstructionContext<Parent>>> {
|
59
81
|
/**
|
60
82
|
* @param data - Initial data provided to construct the Document
|
61
83
|
* @param context - Construction context options
|
62
84
|
*/
|
63
|
-
constructor
|
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);
|
64
90
|
|
65
91
|
override parent: Parent;
|
66
92
|
|
@@ -72,7 +98,7 @@ declare abstract class Document<
|
|
72
98
|
/**
|
73
99
|
* An immutable reverse-reference to the name of the collection that this Document exists in on its parent, if any.
|
74
100
|
*/
|
75
|
-
readonly parentCollection:
|
101
|
+
readonly parentCollection: Document.MetadataFor<DocumentName>["collection"] | null;
|
76
102
|
|
77
103
|
/**
|
78
104
|
* An immutable reference to a containing Compendium collection to which this Document belongs.
|
@@ -120,7 +146,7 @@ declare abstract class Document<
|
|
120
146
|
* }
|
121
147
|
* ```
|
122
148
|
*/
|
123
|
-
static metadata:
|
149
|
+
static metadata: Document.Metadata.Any;
|
124
150
|
|
125
151
|
/**
|
126
152
|
* The database backend used to execute operations and handle results
|
@@ -130,8 +156,6 @@ declare abstract class Document<
|
|
130
156
|
/**
|
131
157
|
* Return a reference to the implemented subclass of this base document type.
|
132
158
|
*/
|
133
|
-
// Referencing the concrete class the config is not possible because accessors cannot be generic and there is not
|
134
|
-
// static polymorphic this type
|
135
159
|
static get implementation(): Document.AnyConstructor;
|
136
160
|
|
137
161
|
/**
|
@@ -147,7 +171,7 @@ declare abstract class Document<
|
|
147
171
|
/**
|
148
172
|
* The named collection to which this Document belongs.
|
149
173
|
*/
|
150
|
-
get collectionName(): Document.
|
174
|
+
get collectionName(): Document.MetadataFor<DocumentName>["collection"];
|
151
175
|
|
152
176
|
/**
|
153
177
|
* The canonical name of this Document type, for example "Actor".
|
@@ -157,23 +181,22 @@ declare abstract class Document<
|
|
157
181
|
/**
|
158
182
|
* The canonical name of this Document type, for example "Actor".
|
159
183
|
*/
|
160
|
-
get documentName():
|
184
|
+
get documentName(): DocumentName;
|
161
185
|
|
162
186
|
/**
|
163
187
|
* The allowed types which may exist for this Document class
|
164
|
-
* @remarks Document.TYPES is overly generic so subclasses don't cause problems
|
165
188
|
*/
|
166
189
|
static get TYPES(): string[];
|
167
190
|
|
168
191
|
/**
|
169
192
|
* Does this Document support additional subtypes?
|
170
193
|
*/
|
171
|
-
static get hasTypeData():
|
194
|
+
static get hasTypeData(): undefined | true;
|
172
195
|
|
173
196
|
/**
|
174
197
|
* The Embedded Document hierarchy for this Document.
|
175
198
|
*/
|
176
|
-
static get hierarchy(): Record<string, EmbeddedCollectionField
|
199
|
+
static get hierarchy(): Record<string, EmbeddedCollectionField.Any | EmbeddedDocumentField.Any>;
|
177
200
|
|
178
201
|
/**
|
179
202
|
* Identify the collection in a parent Document that this Document exists belongs to, if any.
|
@@ -201,7 +224,7 @@ declare abstract class Document<
|
|
201
224
|
* @param user - The User being tested
|
202
225
|
* @returns Does the User have a sufficient role to create?
|
203
226
|
*/
|
204
|
-
static canUserCreate(user:
|
227
|
+
static canUserCreate(user: User.Internal.Implementation): boolean;
|
205
228
|
|
206
229
|
/**
|
207
230
|
* Get the explicit permission level that a specific User has over this Document, a value in CONST.DOCUMENT_OWNERSHIP_LEVELS.
|
@@ -211,7 +234,7 @@ declare abstract class Document<
|
|
211
234
|
* (default: `game.user`)
|
212
235
|
* @returns A numeric permission level from CONST.DOCUMENT_OWNERSHIP_LEVELS or null
|
213
236
|
*/
|
214
|
-
getUserLevel(user?:
|
237
|
+
getUserLevel(user?: User.Internal.Implementation): CONST.DOCUMENT_OWNERSHIP_LEVELS | null;
|
215
238
|
|
216
239
|
/**
|
217
240
|
* Test whether a certain User has a requested permission level (or greater) over the Document
|
@@ -220,16 +243,11 @@ declare abstract class Document<
|
|
220
243
|
* @param options - Additional options involved in the permission test
|
221
244
|
* @returns Does the user have this permission level over the Document?
|
222
245
|
*/
|
246
|
+
// options: not null (destructured)
|
223
247
|
testUserPermission(
|
224
|
-
user:
|
225
|
-
permission:
|
226
|
-
options?:
|
227
|
-
/**
|
228
|
-
* Require the exact permission level requested?
|
229
|
-
* @defaultValue `false`
|
230
|
-
*/
|
231
|
-
exact: boolean;
|
232
|
-
}>,
|
248
|
+
user: User.Internal.Implementation,
|
249
|
+
permission: Document.TestableOwnershipLevel,
|
250
|
+
options?: Document.TestUserPermissionOptions,
|
233
251
|
): boolean;
|
234
252
|
|
235
253
|
/**
|
@@ -240,7 +258,11 @@ declare abstract class Document<
|
|
240
258
|
* (default: `{}`)
|
241
259
|
* @returns Does the User have permission?
|
242
260
|
*/
|
243
|
-
canUserModify
|
261
|
+
canUserModify<Action extends "create" | "update" | "delete">(
|
262
|
+
user: User.Internal.Implementation,
|
263
|
+
action: Action,
|
264
|
+
data?: Document.CanUserModifyData<Schema, Action>,
|
265
|
+
): boolean;
|
244
266
|
|
245
267
|
/**
|
246
268
|
* Clone a document, creating a new document by combining current data with provided overrides.
|
@@ -250,28 +272,8 @@ declare abstract class Document<
|
|
250
272
|
* @returns The cloned Document instance
|
251
273
|
*/
|
252
274
|
override clone<Save extends boolean = false>(
|
253
|
-
data?: fields.SchemaField.
|
254
|
-
context?: InexactPartial<
|
255
|
-
{
|
256
|
-
/**
|
257
|
-
* Save the clone to the World database?
|
258
|
-
* @defaultValue `false`
|
259
|
-
*/
|
260
|
-
save: Save;
|
261
|
-
|
262
|
-
/**
|
263
|
-
* Keep the same ID of the original document
|
264
|
-
* @defaultValue `false`
|
265
|
-
*/
|
266
|
-
keepId: boolean;
|
267
|
-
|
268
|
-
/**
|
269
|
-
* Track the clone source
|
270
|
-
* @defaultValue `false`
|
271
|
-
*/
|
272
|
-
addSource: boolean;
|
273
|
-
} & Document.ConstructionContext<this["parent"]>
|
274
|
-
>, // 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>>,
|
275
277
|
): Save extends true ? Promise<this> : this;
|
276
278
|
|
277
279
|
/**
|
@@ -281,8 +283,9 @@ declare abstract class Document<
|
|
281
283
|
*/
|
282
284
|
migrateSystemData(): object;
|
283
285
|
|
284
|
-
override toObject
|
285
|
-
|
286
|
+
override toObject<Source extends boolean | undefined>(
|
287
|
+
source?: Source,
|
288
|
+
): Source extends false ? SchemaField.SourceData<Schema> : Readonly<SchemaField.SourceData<Schema>>;
|
286
289
|
|
287
290
|
/**
|
288
291
|
* Create multiple Documents using provided input data.
|
@@ -318,14 +321,12 @@ declare abstract class Document<
|
|
318
321
|
* const data = [{name: "Compendium Actor", type: "character", img: "path/to/profile.jpg"}];
|
319
322
|
* const created = await Actor.createDocuments(data, {pack: "mymodule.mypack"});
|
320
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.
|
321
327
|
*/
|
322
|
-
|
323
|
-
|
324
|
-
data: Array<Document.ConstructorDataFor<T>>,
|
325
|
-
operation?: InexactPartial<Omit<DatabaseOperationsFor<T["metadata"]["name"], "create">, "data">> & {
|
326
|
-
temporary?: Temporary;
|
327
|
-
},
|
328
|
-
): 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[]>;
|
329
330
|
|
330
331
|
/**
|
331
332
|
* Update multiple Document instances using provided differential data.
|
@@ -361,12 +362,12 @@ declare abstract class Document<
|
|
361
362
|
* const actor = await pack.getDocument(documentId);
|
362
363
|
* const updated = await Actor.updateDocuments([{_id: actor.id, name: "New Name"}], {pack: "mymodule.mypack"});
|
363
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.
|
364
368
|
*/
|
365
|
-
|
366
|
-
|
367
|
-
updates?: Array<DeepPartial<Document.UpdateDataFor<T>>>,
|
368
|
-
operation?: InexactPartial<Omit<DatabaseOperationsFor<InstanceType<T>["documentName"], "update">, "updates">>,
|
369
|
-
): 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[]>;
|
370
371
|
|
371
372
|
/**
|
372
373
|
* Delete one or multiple existing Documents using an array of provided ids.
|
@@ -404,16 +405,16 @@ declare abstract class Document<
|
|
404
405
|
* const actor = await pack.getDocument(documentId);
|
405
406
|
* const deleted = await Actor.deleteDocuments([actor.id], {pack: "mymodule.mypack"});
|
406
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.
|
407
411
|
*/
|
408
|
-
|
409
|
-
|
410
|
-
ids?: string[],
|
411
|
-
operation?: InexactPartial<Omit<DatabaseOperationsFor<InstanceType<T>["documentName"], "delete">, "ids">>,
|
412
|
-
): 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[]>;
|
413
414
|
|
414
415
|
/**
|
415
416
|
* Create a new Document using provided input data, saving it to the database.
|
416
|
-
* @see {@link Document.createDocuments}
|
417
|
+
* @see {@link Document.createDocuments | `Document.createDocuments`}
|
417
418
|
* @param data - Initial data used to create this Document, or a Document instance to persist.
|
418
419
|
* @param operation - Parameters of the creation operation
|
419
420
|
* (default: `{}`)
|
@@ -438,53 +439,47 @@ declare abstract class Document<
|
|
438
439
|
* const created = await Item.create(data, {pack: "mymodule.mypack"});
|
439
440
|
* ```
|
440
441
|
*
|
441
|
-
* @remarks If
|
442
|
+
* @remarks If the document creation is skipped by a hook or `_preCreate` then `undefined` is
|
443
|
+
* returned.
|
442
444
|
*/
|
443
|
-
|
444
|
-
|
445
|
-
data: Document.ConstructorDataFor<T> | Document.ConstructorDataFor<T>[],
|
446
|
-
operation?: InexactPartial<Omit<DatabaseOperationsFor<T["metadata"]["name"], "create">, "data">> & {
|
447
|
-
temporary?: Temporary;
|
448
|
-
},
|
449
|
-
): 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>;
|
450
447
|
|
451
448
|
/**
|
452
449
|
* Update this Document using incremental data, saving it to the database.
|
453
|
-
* @see {@link Document.updateDocuments}
|
450
|
+
* @see {@link Document.updateDocuments | `Document.updateDocuments`}
|
454
451
|
* @param data - Differential update data which modifies the existing values of this document data
|
455
452
|
* (default: `{}`)
|
456
453
|
* @param operation - Parameters of the update operation
|
457
454
|
* (default: `{}`)
|
458
455
|
* @returns The updated Document instance
|
459
456
|
*
|
460
|
-
* @remarks If
|
457
|
+
* @remarks If the document update is skipped by a hook or `_preUpdate` then `undefined` is
|
458
|
+
* returned.
|
461
459
|
*/
|
462
|
-
update
|
463
|
-
|
464
|
-
data?: Partial<Document.ConstructorDataForSchema<Schema>>,
|
465
|
-
operation?: InexactPartial<Omit<DatabaseOperationsFor<DocumentName, "update">, "updates">>,
|
466
|
-
): 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>;
|
467
462
|
|
468
463
|
/**
|
469
464
|
* Delete this Document, removing it from the database.
|
470
|
-
* @see {@link Document.deleteDocuments}
|
465
|
+
* @see {@link Document.deleteDocuments | `Document.deleteDocuments`}
|
471
466
|
* @param operation - Parameters of the deletion operation
|
472
467
|
* (default: `{}`)
|
473
468
|
* @returns The deleted Document instance
|
474
469
|
*
|
475
|
-
* @remarks If
|
470
|
+
* @remarks If the document deletion is skipped by a hook or `_preUpdate` then `undefined` is
|
471
|
+
* returned.
|
476
472
|
*/
|
477
|
-
delete
|
478
|
-
|
479
|
-
): 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>;
|
480
475
|
|
481
476
|
/**
|
482
477
|
* Get a World-level Document of this type by its id.
|
483
478
|
* @param documentId - The Document ID
|
484
|
-
* @param
|
479
|
+
* @param operation - Additional options which customize the request
|
485
480
|
* @returns The retrieved Document, or null
|
486
481
|
*/
|
487
|
-
static get(documentId: string,
|
482
|
+
static get(documentId: string, operation?: Document.Database.GetOptions): Document.Any | null;
|
488
483
|
|
489
484
|
/**
|
490
485
|
* A compatibility method that returns the appropriate name of an embedded collection within this Document.
|
@@ -503,7 +498,7 @@ declare abstract class Document<
|
|
503
498
|
* // returns "items"
|
504
499
|
* ```
|
505
500
|
*/
|
506
|
-
static getCollectionName(name:
|
501
|
+
static getCollectionName(name: never): string | null;
|
507
502
|
|
508
503
|
/**
|
509
504
|
* Obtain a reference to the Array of source data within the data object for a certain embedded Document name
|
@@ -511,10 +506,8 @@ declare abstract class Document<
|
|
511
506
|
* @returns The Collection instance of embedded Documents of the requested type
|
512
507
|
* @remarks Usually returns some form of DocumentCollection, but not always (e.g. Token["actors"])
|
513
508
|
*/
|
514
|
-
//
|
515
|
-
getEmbeddedCollection
|
516
|
-
EmbeddedName extends Exclude<foundry.CONST.EMBEDDED_DOCUMENT_TYPES, "Region" | "RegionBehavior">,
|
517
|
-
>(embeddedName: EmbeddedName): 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;
|
518
511
|
|
519
512
|
/**
|
520
513
|
* Get an embedded document by its id from a named collection in the parent document.
|
@@ -524,26 +517,16 @@ declare abstract class Document<
|
|
524
517
|
* @returns The retrieved embedded Document instance, or undefined
|
525
518
|
* @throws If the embedded collection does not exist, or if strict is true and the Embedded Document could not be found.
|
526
519
|
*/
|
520
|
+
// Note: This uses `never` because it's unsound to try to call `Document#getEmbeddedDocument` directly.
|
527
521
|
getEmbeddedDocument(
|
528
|
-
embeddedName:
|
522
|
+
embeddedName: never,
|
529
523
|
id: string,
|
530
|
-
options:
|
531
|
-
|
532
|
-
* Throw an Error if the requested id does not exist. See Collection#get
|
533
|
-
* @defaultValue `false`
|
534
|
-
*/
|
535
|
-
strict: boolean;
|
536
|
-
/**
|
537
|
-
* Allow retrieving an invalid Embedded Document.
|
538
|
-
* @defaultValue `false`
|
539
|
-
*/
|
540
|
-
invalid: boolean;
|
541
|
-
}>,
|
542
|
-
): Document.AnyChild<this> | undefined;
|
524
|
+
options: Document.GetEmbeddedDocumentOptions,
|
525
|
+
): Document.Any | undefined;
|
543
526
|
|
544
527
|
/**
|
545
528
|
* Create multiple embedded Document instances within this parent Document using provided input data.
|
546
|
-
* @see {@link Document.createDocuments}
|
529
|
+
* @see {@link Document.createDocuments | `Document.createDocuments`}
|
547
530
|
* @param embeddedName - The name of the embedded Document type
|
548
531
|
* @param data - An array of data objects used to create multiple documents
|
549
532
|
* (default: `[]`)
|
@@ -551,24 +534,18 @@ declare abstract class Document<
|
|
551
534
|
* (default: `{}`)
|
552
535
|
* @returns An array of created Document instances
|
553
536
|
*/
|
554
|
-
//
|
555
|
-
//
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
embeddedName: EmbeddedName,
|
563
|
-
data?: Array<Document.ConstructorDataForName<Extract<EmbeddedName, Document.Type>>>,
|
564
|
-
operation?: InexactPartial<DatabaseOperationsFor<Extract<EmbeddedName, Document.Type>, "create">> & {
|
565
|
-
temporary?: Temporary;
|
566
|
-
},
|
567
|
-
): 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;
|
568
545
|
|
569
546
|
/**
|
570
547
|
* Update multiple embedded Document instances within a parent Document using provided differential data.
|
571
|
-
* @see {@link Document.updateDocuments}
|
548
|
+
* @see {@link Document.updateDocuments | `Document.updateDocuments`}
|
572
549
|
* @param embeddedName - The name of the embedded Document type
|
573
550
|
* @param updates - An array of differential data objects, each used to update a single Document
|
574
551
|
* (default: `[]`)
|
@@ -576,37 +553,34 @@ declare abstract class Document<
|
|
576
553
|
* (default: `{}`)
|
577
554
|
* @returns An array of updated Document instances
|
578
555
|
*/
|
579
|
-
//
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
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;
|
585
564
|
|
586
565
|
/**
|
587
566
|
* Delete multiple embedded Document instances within a parent Document using provided string ids.
|
588
|
-
* @see {@link Document.deleteDocuments}
|
567
|
+
* @see {@link Document.deleteDocuments | `Document.deleteDocuments`}
|
589
568
|
* @param embeddedName - The name of the embedded Document type
|
590
569
|
* @param ids - An array of string ids for each Document to be deleted
|
591
570
|
* @param operation - Parameters of the database deletion workflow
|
592
571
|
* (default: `{}`)
|
593
572
|
* @returns An array of deleted Document instances
|
594
573
|
*/
|
595
|
-
//
|
596
|
-
|
597
|
-
|
598
|
-
>(
|
599
|
-
embeddedName: EmbeddedName,
|
600
|
-
ids: Array<string>,
|
601
|
-
operation?: DatabaseOperationsFor<DocumentName, "delete">,
|
602
|
-
): 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;
|
603
577
|
|
604
578
|
/**
|
605
579
|
* Iterate over all embedded Documents that are hierarchical children of this Document.
|
606
580
|
* @param _parentPath - A parent field path already traversed
|
607
581
|
* @remarks Not called within Foundry's client-side code, likely exists for server documents
|
608
582
|
*/
|
609
|
-
traverseEmbeddedDocuments(_parentPath?: string): Generator<[string, Document.
|
583
|
+
traverseEmbeddedDocuments(_parentPath?: string): Generator<[string, Document.AnyChild<this>]>;
|
610
584
|
|
611
585
|
/**
|
612
586
|
* Get the value of a "flag" for this document
|
@@ -616,10 +590,7 @@ declare abstract class Document<
|
|
616
590
|
* @param key - The flag key
|
617
591
|
* @returns The flag value
|
618
592
|
*/
|
619
|
-
getFlag
|
620
|
-
S extends Document.FlagKeyOf<Document.ConfiguredFlagsForName<DocumentName>>,
|
621
|
-
K extends Document.FlagKeyOf<Document.FlagGetKey<Document.ConfiguredFlagsForName<DocumentName>, S>>,
|
622
|
-
>(scope: S, key: K): Document.GetFlag<DocumentName, S, K>;
|
593
|
+
getFlag(scope: never, key: never): unknown;
|
623
594
|
|
624
595
|
/**
|
625
596
|
* Assign a "flag" to this document.
|
@@ -639,11 +610,7 @@ declare abstract class Document<
|
|
639
610
|
* @param value - The flag value
|
640
611
|
* @returns A Promise resolving to the updated document
|
641
612
|
*/
|
642
|
-
setFlag<
|
643
|
-
S extends Document.FlagKeyOf<Document.ConfiguredFlagsForName<DocumentName>>,
|
644
|
-
K extends Document.FlagKeyOf<Document.FlagGetKey<Document.ConfiguredFlagsForName<DocumentName>, S>>,
|
645
|
-
V extends Document.GetFlag<DocumentName, S, K>,
|
646
|
-
>(scope: S, key: K, value: V): Promise<this>;
|
613
|
+
setFlag(scope: never, key: never, value: never): Promise<this>;
|
647
614
|
|
648
615
|
/**
|
649
616
|
* Remove a flag assigned to the document
|
@@ -651,22 +618,18 @@ declare abstract class Document<
|
|
651
618
|
* @param key - The flag key
|
652
619
|
* @returns The updated document instance
|
653
620
|
*/
|
654
|
-
unsetFlag(scope:
|
621
|
+
unsetFlag(scope: never, key: never): Promise<this>;
|
655
622
|
|
656
623
|
/**
|
657
624
|
* Pre-process a creation operation for a single Document instance.
|
658
625
|
* Pre-operation events only occur for the client which requested the operation.
|
659
|
-
* 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`}.
|
660
627
|
* @param data - The initial data object provided to the document creation request
|
661
628
|
* @param options - Additional options which modify the creation request
|
662
629
|
* @param user - The User requesting the document creation
|
663
630
|
* @returns Return false to exclude this Document from the creation operation
|
664
631
|
*/
|
665
|
-
protected _preCreate(
|
666
|
-
data: fields.SchemaField.AssignmentType<Schema>,
|
667
|
-
options: Document.PreCreateOptions<DocumentName>,
|
668
|
-
user: foundry.documents.BaseUser,
|
669
|
-
): Promise<boolean | void>;
|
632
|
+
protected _preCreate(data: never, options: never, user: User.Internal.Implementation): Promise<boolean | void>;
|
670
633
|
|
671
634
|
/**
|
672
635
|
* Post-process a creation operation for a single Document instance.
|
@@ -675,48 +638,44 @@ declare abstract class Document<
|
|
675
638
|
* @param options - Additional options which modify the creation request
|
676
639
|
* @param userId - The id of the User requesting the document update
|
677
640
|
*/
|
678
|
-
protected _onCreate(
|
679
|
-
data: fields.SchemaField.InnerAssignmentType<Schema>,
|
680
|
-
options: Document.OnCreateOptions<DocumentName>,
|
681
|
-
userId: string,
|
682
|
-
): void;
|
641
|
+
protected _onCreate(data: never, options: never, userId: string): void;
|
683
642
|
|
684
643
|
/**
|
685
644
|
* Pre-process a creation operation, potentially altering its instructions or input data. Pre-operation events only
|
686
645
|
* occur for the client which requested the operation.
|
687
646
|
*
|
688
|
-
* 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
|
689
648
|
* pre-flight check before a database operation occurs.
|
690
649
|
*
|
691
650
|
* Modifications to pending documents must mutate the documents array or alter individual document instances using
|
692
|
-
* {@link Document#updateSource}.
|
651
|
+
* {@link Document.updateSource | `Document#updateSource`}.
|
693
652
|
* @param documents - Pending document instances ot be created
|
694
653
|
* @param operation - Parameters of the database creation operation
|
695
654
|
* @param user - The User requesting the creation operation
|
696
655
|
* @returns Return false to cancel the creation operation entirely
|
697
656
|
*/
|
698
|
-
|
699
|
-
|
700
|
-
documents:
|
701
|
-
operation:
|
702
|
-
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,
|
703
662
|
): Promise<boolean | void>;
|
704
663
|
|
705
664
|
/**
|
706
665
|
* Post-process a creation operation, reacting to database changes which have occurred. Post-operation events occur
|
707
666
|
* for all connected clients.
|
708
667
|
*
|
709
|
-
* 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.
|
710
669
|
*
|
711
670
|
* @param documents - The Document instances which were created
|
712
671
|
* @param operation - Parameters of the database creation operation
|
713
672
|
* @param user - The User who performed the creation operation
|
714
673
|
*/
|
715
|
-
|
716
|
-
|
717
|
-
documents:
|
718
|
-
operation:
|
719
|
-
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,
|
720
679
|
): Promise<void>;
|
721
680
|
|
722
681
|
/**
|
@@ -727,11 +686,7 @@ declare abstract class Document<
|
|
727
686
|
* @param user - The User requesting the document update
|
728
687
|
* @returns A return value of false indicates the update operation should be cancelled
|
729
688
|
*/
|
730
|
-
protected _preUpdate(
|
731
|
-
changed: fields.SchemaField.AssignmentType<Schema>,
|
732
|
-
options: Document.PreUpdateOptions<DocumentName>,
|
733
|
-
user: foundry.documents.BaseUser,
|
734
|
-
): Promise<boolean | void>;
|
689
|
+
protected _preUpdate(changed: never, options: never, user: User.Internal.Implementation): Promise<boolean | void>;
|
735
690
|
|
736
691
|
/**
|
737
692
|
* Perform follow-up operations after a Document of this type is updated.
|
@@ -740,49 +695,45 @@ declare abstract class Document<
|
|
740
695
|
* @param options - Additional options which modify the update request
|
741
696
|
* @param userId - The id of the User requesting the document update
|
742
697
|
*/
|
743
|
-
protected _onUpdate(
|
744
|
-
changed: fields.SchemaField.InnerAssignmentType<Schema>,
|
745
|
-
options: Document.OnUpdateOptions<DocumentName>,
|
746
|
-
userId: string,
|
747
|
-
): void;
|
698
|
+
protected _onUpdate(changed: never, options: never, userId: string): void;
|
748
699
|
|
749
700
|
/**
|
750
701
|
* Pre-process an update operation, potentially altering its instructions or input data. Pre-operation events only
|
751
702
|
* occur for the client which requested the operation.
|
752
703
|
*
|
753
|
-
* 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
|
754
705
|
* pre-flight check before a database operation occurs.
|
755
706
|
*
|
756
707
|
* Modifications to the requested updates are performed by mutating the data array of the operation.
|
757
|
-
* {@link Document#updateSource}.
|
708
|
+
* {@link Document.updateSource | `Document#updateSource`}.
|
758
709
|
*
|
759
710
|
* @param documents - Document instances to be updated
|
760
711
|
* @param operation - Parameters of the database update operation
|
761
712
|
* @param user - The User requesting the update operation
|
762
713
|
* @returns Return false to cancel the update operation entirely
|
763
714
|
*/
|
764
|
-
|
765
|
-
|
766
|
-
documents:
|
767
|
-
operation:
|
768
|
-
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,
|
769
720
|
): Promise<boolean | void>;
|
770
721
|
|
771
722
|
/**
|
772
723
|
* Post-process an update operation, reacting to database changes which have occurred. Post-operation events occur
|
773
724
|
* for all connected clients.
|
774
725
|
*
|
775
|
-
* 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.
|
776
727
|
*
|
777
728
|
* @param documents - The Document instances which were updated
|
778
729
|
* @param operation - Parameters of the database update operation
|
779
730
|
* @param user - The User who performed the update operation
|
780
731
|
*/
|
781
|
-
|
782
|
-
|
783
|
-
documents:
|
784
|
-
operation:
|
785
|
-
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,
|
786
737
|
): Promise<void>;
|
787
738
|
|
788
739
|
/**
|
@@ -792,10 +743,7 @@ declare abstract class Document<
|
|
792
743
|
* @param user - The User requesting the document deletion
|
793
744
|
* @returns A return value of false indicates the delete operation should be cancelled
|
794
745
|
*/
|
795
|
-
protected _preDelete(
|
796
|
-
options: Document.PreDeleteOptions<DocumentName>,
|
797
|
-
user: foundry.documents.BaseUser,
|
798
|
-
): Promise<boolean | void>;
|
746
|
+
protected _preDelete(options: never, user: User.Internal.Implementation): Promise<boolean | void>;
|
799
747
|
|
800
748
|
/**
|
801
749
|
* Perform follow-up operations after a Document of this type is deleted.
|
@@ -803,17 +751,17 @@ declare abstract class Document<
|
|
803
751
|
* @param options - Additional options which modify the deletion request
|
804
752
|
* @param userId - The id of the User requesting the document update
|
805
753
|
*/
|
806
|
-
protected _onDelete(options:
|
754
|
+
protected _onDelete(options: never, userId: string): void;
|
807
755
|
|
808
756
|
/**
|
809
757
|
* Pre-process a deletion operation, potentially altering its instructions or input data. Pre-operation events only
|
810
758
|
* occur for the client which requested the operation.
|
811
759
|
*
|
812
|
-
* 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
|
813
761
|
* pre-flight check before a database operation occurs.
|
814
762
|
*
|
815
763
|
* Modifications to the requested deletions are performed by mutating the operation object.
|
816
|
-
* {@link Document#updateSource}.
|
764
|
+
* {@link Document.updateSource | `Document#updateSource`}.
|
817
765
|
*
|
818
766
|
* @param documents - Document instances to be deleted
|
819
767
|
* @param operation - Parameters of the database update operation
|
@@ -821,28 +769,28 @@ declare abstract class Document<
|
|
821
769
|
* @returns Return false to cancel the deletion operation entirely
|
822
770
|
* @internal
|
823
771
|
*/
|
824
|
-
|
825
|
-
|
826
|
-
documents:
|
827
|
-
operation:
|
828
|
-
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,
|
829
777
|
): Promise<unknown>;
|
830
778
|
|
831
779
|
/**
|
832
780
|
* Post-process a deletion operation, reacting to database changes which have occurred. Post-operation events occur
|
833
781
|
* for all connected clients.
|
834
782
|
*
|
835
|
-
* 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.
|
836
784
|
*
|
837
785
|
* @param documents - The Document instances which were deleted
|
838
786
|
* @param operation - Parameters of the database deletion operation
|
839
787
|
* @param user - The User who performed the deletion operation
|
840
788
|
*/
|
841
|
-
|
842
|
-
|
843
|
-
documents:
|
844
|
-
operation:
|
845
|
-
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,
|
846
794
|
): Promise<unknown>;
|
847
795
|
|
848
796
|
/**
|
@@ -854,17 +802,22 @@ declare abstract class Document<
|
|
854
802
|
* @deprecated since v11, will be removed in v13
|
855
803
|
* @remarks "You are accessing `Document.hasSystemData` which is deprecated. Please use `Document.hasTypeData` instead."
|
856
804
|
*/
|
857
|
-
static get hasSystemData():
|
805
|
+
static get hasSystemData(): undefined | true;
|
858
806
|
|
859
807
|
/**
|
860
808
|
* A reusable helper for adding migration shims.
|
861
809
|
*/
|
862
|
-
protected static _addDataFieldShims(data:
|
810
|
+
protected static _addDataFieldShims(data: AnyObject, shims: AnyObject, options?: Document.DataFieldShimOptions): void;
|
863
811
|
|
864
812
|
/**
|
865
813
|
* A reusable helper for adding a migration shim
|
866
814
|
*/
|
867
|
-
protected static _addDataFieldShim(
|
815
|
+
protected static _addDataFieldShim(
|
816
|
+
data: AnyObject,
|
817
|
+
oldKey: string,
|
818
|
+
newKey: string,
|
819
|
+
options?: Document.DataFieldShimOptions,
|
820
|
+
): void;
|
868
821
|
|
869
822
|
/**
|
870
823
|
* Define a simple migration from one field name to another.
|
@@ -876,10 +829,10 @@ declare abstract class Document<
|
|
876
829
|
* @internal
|
877
830
|
*/
|
878
831
|
protected static _addDataFieldMigration(
|
879
|
-
data:
|
832
|
+
data: AnyObject,
|
880
833
|
oldKey: string,
|
881
834
|
newKey: string,
|
882
|
-
apply?: (data:
|
835
|
+
apply?: (data: AnyObject) => unknown,
|
883
836
|
): unknown;
|
884
837
|
|
885
838
|
protected static _logDataFieldMigration(
|
@@ -892,9 +845,9 @@ declare abstract class Document<
|
|
892
845
|
* @deprecated since v12, will be removed in v14
|
893
846
|
* @remarks `"The Document._onCreateDocuments static method is deprecated in favor of Document._onCreateOperation"`
|
894
847
|
*/
|
895
|
-
|
896
|
-
|
897
|
-
documents:
|
848
|
+
// Note: This uses `never` because it's unsound to try to do `Document._onCreateDocuments` directly.
|
849
|
+
protected static _onCreateDocuments(
|
850
|
+
documents: never,
|
898
851
|
context: Document.ModificationContext<Document.Any | null>,
|
899
852
|
): Promise<void>;
|
900
853
|
|
@@ -902,9 +855,9 @@ declare abstract class Document<
|
|
902
855
|
* @deprecated since v12, will be removed in v14
|
903
856
|
* @remarks `"The Document._onUpdateDocuments static method is deprecated in favor of Document._onUpdateOperation"`
|
904
857
|
*/
|
905
|
-
|
906
|
-
|
907
|
-
documents:
|
858
|
+
// Note: This uses `never` because it's unsound to try to do `Document._onUpdateDocuments` directly.
|
859
|
+
protected static _onUpdateDocuments(
|
860
|
+
documents: never,
|
908
861
|
context: Document.ModificationContext<Document.Any | null>,
|
909
862
|
): Promise<unknown>;
|
910
863
|
|
@@ -912,59 +865,36 @@ declare abstract class Document<
|
|
912
865
|
* @deprecated since v12, will be removed in v14
|
913
866
|
* @remarks `"The Document._onDeleteDocuments static method is deprecated in favor of Document._onDeleteOperation"`
|
914
867
|
*/
|
915
|
-
|
916
|
-
|
917
|
-
documents:
|
868
|
+
// Note: This uses `never` because it's unsound to try to do `Document._onDeleteDocuments` directly.
|
869
|
+
protected static _onDeleteDocuments(
|
870
|
+
documents: never,
|
918
871
|
context: Document.ModificationContext<Document.Any | null>,
|
919
872
|
): Promise<unknown>;
|
920
|
-
}
|
921
873
|
|
922
|
-
|
923
|
-
constructor(arg0: never, ...args: never[]);
|
874
|
+
static " fvtt_types_internal_document_name_static": Document.Type;
|
924
875
|
|
925
|
-
|
926
|
-
|
927
|
-
|
876
|
+
" fvtt_types_internal_document_name": DocumentName;
|
877
|
+
" fvtt_types_internal_document_schema": Schema;
|
878
|
+
" fvtt_types_internal_document_parent": Parent;
|
879
|
+
}
|
928
880
|
|
929
|
-
|
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);
|
930
885
|
|
931
|
-
|
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;
|
932
889
|
}
|
933
890
|
|
934
|
-
// Note(LukeAbby): The point of this class is to show up in intellisense.
|
935
|
-
// When something fails to be configured it should be replaced with `typeof ConfigurationFailure & typeof Item` or whatever the relevant class is.
|
936
|
-
// This helps to minimize the number of errors that appears in a repo with broken configuration as they can be very misleading and confusing.
|
937
|
-
declare abstract class ConfigurationFailure extends AnyDocument {}
|
938
|
-
|
939
891
|
declare namespace Document {
|
940
|
-
|
941
|
-
|
892
|
+
interface Any extends AnyDocument {}
|
893
|
+
interface AnyStored extends Stored<Any> {}
|
894
|
+
interface AnyValid extends AnyDocument {}
|
895
|
+
interface AnyConstructor extends Identity<typeof AnyDocument> {}
|
942
896
|
|
943
|
-
type Type =
|
944
|
-
| "ActiveEffect"
|
945
|
-
| "ActorDelta"
|
946
|
-
| "Actor"
|
947
|
-
| "Adventure"
|
948
|
-
| "Card"
|
949
|
-
| "Cards"
|
950
|
-
| "ChatMessage"
|
951
|
-
| "Combat"
|
952
|
-
| "Combatant"
|
953
|
-
| "FogExploration"
|
954
|
-
| "Folder"
|
955
|
-
| "Item"
|
956
|
-
| "JournalEntryPage"
|
957
|
-
| "JournalEntry"
|
958
|
-
| "Macro"
|
959
|
-
| "PlaylistSound"
|
960
|
-
| "Playlist"
|
961
|
-
| "RollTable"
|
962
|
-
| "Scene"
|
963
|
-
| "Setting"
|
964
|
-
| "TableResult"
|
965
|
-
| "User"
|
966
|
-
// All placeables also have a corresponding document class.
|
967
|
-
| PlaceableType;
|
897
|
+
type Type = CONST.ALL_DOCUMENT_TYPES;
|
968
898
|
|
969
899
|
type PlaceableType =
|
970
900
|
| "AmbientLight"
|
@@ -972,12 +902,89 @@ declare namespace Document {
|
|
972
902
|
| "Drawing"
|
973
903
|
| "MeasuredTemplate"
|
974
904
|
| "Note"
|
905
|
+
| "Region"
|
975
906
|
| "Tile"
|
976
907
|
| "Token"
|
977
908
|
| "Wall";
|
978
909
|
|
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;
|
914
|
+
|
915
|
+
type WithSubTypes = WithSystem | "Folder" | "Macro" | "TableResult";
|
916
|
+
|
917
|
+
type WithSystem =
|
918
|
+
| "ActiveEffect"
|
919
|
+
| "ActorDelta"
|
920
|
+
| "Actor"
|
921
|
+
| "Card"
|
922
|
+
| "Cards"
|
923
|
+
| "ChatMessage"
|
924
|
+
| "Combat"
|
925
|
+
| "Combatant"
|
926
|
+
| "Item"
|
927
|
+
| "JournalEntryPage"
|
928
|
+
| "RegionBehavior";
|
929
|
+
|
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>];
|
939
|
+
|
979
940
|
type CoreTypesForName<Name extends Type> = string &
|
980
|
-
GetKey<Document.
|
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;
|
981
988
|
|
982
989
|
// TODO: Probably a way to auto-determine this
|
983
990
|
type SystemType =
|
@@ -989,142 +996,311 @@ declare namespace Document {
|
|
989
996
|
| "Combat"
|
990
997
|
| "Combatant"
|
991
998
|
| "Item"
|
992
|
-
| "JournalEntryPage"
|
999
|
+
| "JournalEntryPage"
|
1000
|
+
| "RegionBehavior";
|
1001
|
+
|
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
|
+
}
|
993
1023
|
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
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>>;
|
999
1057
|
|
1000
1058
|
type IsParentOf<
|
1001
1059
|
ParentDocument extends Document.Internal.Instance.Any,
|
1002
1060
|
ChildDocument extends Document.Internal.Instance.Any,
|
1003
1061
|
> = ParentDocument extends Internal.ParentFor<ChildDocument> ? true : false;
|
1004
1062
|
|
1063
|
+
type SocketRequest<Action extends DatabaseAction> = DocumentSocketRequest<Action>;
|
1064
|
+
type SocketResponse<Action extends DatabaseAction> = DocumentSocketResponse<Action>;
|
1065
|
+
|
1005
1066
|
// Documented at https://gist.github.com/LukeAbby/c7420b053d881db4a4d4496b95995c98
|
1006
1067
|
namespace Internal {
|
1007
|
-
type
|
1008
|
-
|
1009
|
-
type Constructor = (abstract new (arg0: never, ...args: never[]) => Instance.Any) & {
|
1010
|
-
[__DocumentBrand]: never;
|
1068
|
+
type Constructor = (abstract new (...args: never) => Instance.Any) & {
|
1069
|
+
" fvtt_types_internal_document_name_static": Document.Type;
|
1011
1070
|
};
|
1012
1071
|
|
1013
|
-
interface Instance<
|
1014
|
-
|
1015
|
-
|
1072
|
+
interface Instance<
|
1073
|
+
DocumentName extends Document.Type,
|
1074
|
+
Schema extends DataSchema,
|
1075
|
+
Parent extends Document.Internal.Instance.Any | null,
|
1076
|
+
> {
|
1077
|
+
" fvtt_types_internal_document_name": DocumentName;
|
1078
|
+
" fvtt_types_internal_document_schema": Schema;
|
1079
|
+
" fvtt_types_internal_document_parent": Parent;
|
1016
1080
|
}
|
1017
1081
|
|
1018
|
-
type
|
1082
|
+
type DocumentNameFor<ConcreteInstance extends Instance.Any> =
|
1083
|
+
ConcreteInstance[" fvtt_types_internal_document_name"];
|
1019
1084
|
|
1020
|
-
type
|
1085
|
+
type SchemaFor<ConcreteInstance extends Instance.Any> = ConcreteInstance[" fvtt_types_internal_document_schema"];
|
1086
|
+
|
1087
|
+
type ParentFor<ConcreteInstance extends Instance.Any> = ConcreteInstance[" fvtt_types_internal_document_parent"];
|
1021
1088
|
|
1022
1089
|
namespace Instance {
|
1023
|
-
|
1090
|
+
interface Any extends Instance<any, any, any> {}
|
1024
1091
|
|
1025
1092
|
type Complete<T extends Any> = T extends Document.Any ? T : never;
|
1026
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);
|
1027
1125
|
}
|
1028
1126
|
|
1029
1127
|
/** Any Document, that is a child of the given parent Document. */
|
1030
|
-
|
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>;
|
1031
1131
|
|
1032
|
-
|
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
|
+
>;
|
1033
1138
|
|
1034
1139
|
/**
|
1035
|
-
* 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`}.
|
1036
1141
|
*/
|
1037
|
-
type
|
1142
|
+
type CreateDataFor<T extends Document.Internal.Constructor> = SchemaField.CreateData<
|
1038
1143
|
T extends { defineSchema: () => infer R extends DataSchema } ? R : never
|
1039
1144
|
>;
|
1040
1145
|
|
1041
|
-
|
1042
|
-
type UpdateDataFor<T extends Document.Internal.Constructor> = ConstructorDataForSchema<
|
1146
|
+
type UpdateDataFor<T extends Document.Internal.Constructor> = SchemaField.UpdateData<
|
1043
1147
|
T extends { defineSchema: () => infer R extends DataSchema } ? R : never
|
1044
1148
|
>;
|
1045
1149
|
|
1046
1150
|
// These helper types exist to help break a loop
|
1047
|
-
type ConstructorDataForName<T extends Document.Type> = ConstructorData[T];
|
1048
|
-
type UpdateDataForName<T extends Document.Type> = ConstructorData[T];
|
1049
1151
|
|
1050
|
-
type
|
1051
|
-
|
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>;
|
1052
1224
|
|
1053
1225
|
type SystemConstructor = AnyConstructor & {
|
1054
1226
|
metadata: { name: SystemType };
|
1055
1227
|
};
|
1056
1228
|
|
1057
|
-
type
|
1058
|
-
|
1059
|
-
type ConfiguredClassForName<Name extends Type> = MakeConform<
|
1060
|
-
ConfiguredDocuments[Name],
|
1061
|
-
typeof ConfigurationFailure & DefaultDocuments[Name]
|
1062
|
-
>;
|
1063
|
-
|
1064
|
-
type SubTypesOf<T extends Type> =
|
1065
|
-
ConfiguredInstanceForName<T> extends { type: infer Types } ? Types : typeof foundry.CONST.BASE_DOCUMENT_TYPE;
|
1066
|
-
|
1067
|
-
type ToConfiguredClass<ConcreteDocument extends Document.Internal.Constructor> = MakeConform<
|
1068
|
-
ConfiguredDocuments[NameFor<ConcreteDocument>],
|
1069
|
-
typeof ConfigurationFailure & DefaultDocuments[NameFor<ConcreteDocument>]
|
1229
|
+
type ToConfiguredClass<ConcreteDocument extends Document.Internal.Constructor> = ImplementationClassFor<
|
1230
|
+
NameFor<ConcreteDocument>
|
1070
1231
|
>;
|
1071
1232
|
|
1072
1233
|
type ToConfiguredInstance<ConcreteDocument extends Document.Internal.Constructor> = MakeConform<
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
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]>
|
1076
1238
|
>;
|
1077
1239
|
|
1078
|
-
type ToConfiguredStored<D extends Document.
|
1240
|
+
type ToConfiguredStored<D extends Document.AnyConstructor> = Stored<ToConfiguredInstance<D>>;
|
1079
1241
|
|
1080
|
-
type Stored<D extends Document.
|
1242
|
+
type Stored<D extends Document.Any> = D & {
|
1081
1243
|
id: string;
|
1082
1244
|
_id: string;
|
1083
1245
|
_source: GetKey<D, "_source"> & { _id: string };
|
1084
1246
|
};
|
1085
1247
|
|
1086
|
-
type
|
1087
|
-
D
|
1088
|
-
|
1089
|
-
|
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
|
+
>;
|
1090
1257
|
|
1091
|
-
type
|
1258
|
+
type ToStored<D extends Document.AnyConstructor> = Stored<FixedInstanceType<D>>;
|
1092
1259
|
|
1093
|
-
type
|
1094
|
-
|
1095
|
-
|
1096
|
-
? Name
|
1097
|
-
: never;
|
1260
|
+
type ToStoredIf<D extends Document.AnyConstructor, Temporary extends boolean | undefined> = Temporary extends true
|
1261
|
+
? FixedInstanceType<D>
|
1262
|
+
: ToConfiguredStored<D>;
|
1098
1263
|
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
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;
|
1103
1272
|
|
1104
|
-
type
|
1105
|
-
|
1273
|
+
type NameFor<ConcreteDocument extends Document.Internal.Constructor> =
|
1274
|
+
ConcreteDocument[" fvtt_types_internal_document_name_static"];
|
1275
|
+
|
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>;
|
1106
1291
|
|
1107
1292
|
type ConfiguredDataForName<Name extends Type> = GetKey<DataConfig, Name, EmptyObject>;
|
1108
1293
|
|
1109
1294
|
type ConfiguredSourceForName<Name extends Type> = GetKey<SourceConfig, Name, EmptyObject>;
|
1110
1295
|
|
1111
|
-
type
|
1112
|
-
|
1113
|
-
type
|
1114
|
-
toObject: (source: false) => infer U;
|
1115
|
-
}
|
1116
|
-
? U
|
1117
|
-
: 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, {}>;
|
1118
1299
|
|
1119
1300
|
type SchemaFor<ConcreteDocument extends Internal.Instance.Any> =
|
1120
|
-
ConcreteDocument extends Internal.Instance<infer Schema,
|
1301
|
+
ConcreteDocument extends Internal.Instance<infer _1, infer Schema, infer _2> ? Schema : never;
|
1121
1302
|
|
1122
|
-
type MetadataFor<
|
1123
|
-
ConfiguredMetadata<ConcreteDocument>[ConcreteDocument extends {
|
1124
|
-
readonly documentName: infer Name extends Document.Type;
|
1125
|
-
}
|
1126
|
-
? Name
|
1127
|
-
: never];
|
1303
|
+
type MetadataFor<Name extends Document.Type> = ConfiguredMetadata[Name];
|
1128
1304
|
|
1129
1305
|
type CollectionRecord<Schema extends DataSchema> = {
|
1130
1306
|
[Key in keyof Schema]: Schema[Key] extends fields.EmbeddedCollectionField.Any ? Schema[Key] : never;
|
@@ -1132,11 +1308,12 @@ declare namespace Document {
|
|
1132
1308
|
|
1133
1309
|
type Flags<ConcreteDocument extends Internal.Instance.Any> = OptionsForSchema<SchemaFor<ConcreteDocument>>;
|
1134
1310
|
|
1135
|
-
|
1311
|
+
/** @internal */
|
1312
|
+
interface OptionsInFlags<Options extends DataField.Options.Any> {
|
1136
1313
|
readonly flags?: DataField<Options, any>;
|
1137
1314
|
}
|
1138
1315
|
|
1139
|
-
// These
|
1316
|
+
// These types only exists to simplify solving the `Document` type. Using `Document.Flags<this>` means the constraint `this extends Document.Any` has to be proved.
|
1140
1317
|
// This is much more complex than proving the constraint for `Document.FlagsInternal<Schema>` that `Schema extends DataSchema`.
|
1141
1318
|
|
1142
1319
|
// TODO: This needs to use the derived flags not just how they're initialized.
|
@@ -1159,7 +1336,7 @@ declare namespace Document {
|
|
1159
1336
|
type FlagGetKey<T, K extends PropertyKey> = T extends unknown ? (K extends keyof T ? T[K] : never) : never;
|
1160
1337
|
|
1161
1338
|
// Note(LukeAbby): It's at times been very important for `GetFlag` to be covariant over `ConcreteSchema`.
|
1162
|
-
// If it isn't then issues arise where the `Document` type ends up becoming
|
1339
|
+
// If it isn't then issues arise where the `Document` type ends up becoming invariant.
|
1163
1340
|
// Currently it is actually contravariant over `ConcreteSchema` and this may cause issues (because of the usage of `keyof`).
|
1164
1341
|
// Unfortunately it's not easy to avoid because the typical `GetKey` trick has issues between `never`, not defined at all, and `unknown` etc.
|
1165
1342
|
type GetFlag<Name extends Document.Type, S extends string, K extends string> = FlagGetKey<
|
@@ -1167,12 +1344,19 @@ declare namespace Document {
|
|
1167
1344
|
K
|
1168
1345
|
>;
|
1169
1346
|
|
1347
|
+
interface CoreFlags {
|
1348
|
+
core?: {
|
1349
|
+
sheetLock?: boolean;
|
1350
|
+
sheetClass?: string;
|
1351
|
+
};
|
1352
|
+
}
|
1353
|
+
|
1170
1354
|
interface ConstructionContext<Parent extends Document.Any | null> {
|
1171
1355
|
/**
|
1172
1356
|
* The parent Document of this one, if this one is embedded
|
1173
1357
|
* @defaultValue `null`
|
1174
1358
|
*/
|
1175
|
-
parent?: Parent | undefined;
|
1359
|
+
parent?: Parent | null | undefined;
|
1176
1360
|
|
1177
1361
|
/**
|
1178
1362
|
* The compendium collection ID which contains this Document, if any
|
@@ -1276,102 +1460,697 @@ declare namespace Document {
|
|
1276
1460
|
deleteAll?: boolean | undefined;
|
1277
1461
|
}
|
1278
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
|
+
|
1279
1483
|
type ModificationOptions = Omit<Document.ModificationContext<Document.Any | null>, "parent" | "pack">;
|
1280
1484
|
|
1485
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
1486
|
+
/** @deprecated Use {@link Database.PreCreateOptions | `Database.PreCreateOptions`} */
|
1281
1487
|
type PreCreateOptions<Name extends Type> = Omit<
|
1282
|
-
|
1488
|
+
Document.Database.OperationOf<Name, "create">,
|
1283
1489
|
"data" | "noHook" | "pack" | "parent"
|
1284
1490
|
>;
|
1491
|
+
|
1492
|
+
/** @deprecated Use {@link Database.CreateOptions | `Database.CreateOptions`} */
|
1285
1493
|
type OnCreateOptions<Name extends Type> = Omit<
|
1286
|
-
|
1494
|
+
Document.Database.OperationOf<Name, "create">,
|
1287
1495
|
"pack" | "parentUuid" | "syntheticActorUpdate"
|
1288
1496
|
>;
|
1289
1497
|
|
1498
|
+
/** @deprecated Use {@link Database.PreUpdateOptions | `Database.PreUpdateOperation`} */
|
1290
1499
|
type PreUpdateOptions<Name extends Type> = Omit<
|
1291
|
-
|
1500
|
+
Document.Database.OperationOf<Name, "update">,
|
1292
1501
|
"updates" | "restoreDelta" | "noHook" | "parent" | "pack"
|
1293
1502
|
>;
|
1503
|
+
|
1504
|
+
/** @deprecated Use {@link Database.UpdateOptions | `Database.OnUpdateOperation`} */
|
1294
1505
|
type OnUpdateOptions<Name extends Type> = Omit<
|
1295
|
-
|
1506
|
+
Document.Database.OperationOf<Name, "update">,
|
1296
1507
|
"pack" | "parentUuid" | "syntheticActorUpdate"
|
1297
1508
|
>;
|
1298
1509
|
|
1510
|
+
/** @deprecated Use {@link Database.PreDeleteOperationInstance | `Database.PreDeleteOperationInstance`} */
|
1299
1511
|
type PreDeleteOptions<Name extends Type> = Omit<
|
1300
|
-
|
1512
|
+
Document.Database.OperationOf<Name, "delete">,
|
1301
1513
|
"ids" | "deleteAll" | "noHook" | "pack" | "parent"
|
1302
1514
|
>;
|
1515
|
+
|
1516
|
+
/** @deprecated Use {@link Database.DeleteOptions | `Database.OnDeleteOptions`} */
|
1303
1517
|
type OnDeleteOptions<Name extends Type> = Omit<
|
1304
|
-
|
1518
|
+
Document.Database.OperationOf<Name, "delete">,
|
1305
1519
|
"deleteAll" | "pack" | "parentUuid" | "syntheticActorUpdate"
|
1306
1520
|
>;
|
1307
1521
|
|
1522
|
+
/** @deprecated Use {@link Database.PreCreateOptions | `Database.PreCreateOptions`} or {@link Database.PreUpdateOptions | `Database.PreUpdateOperation`}*/
|
1308
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`} */
|
1309
1526
|
type OnUpsertOptions<Name extends Type> = OnCreateOptions<Name> | OnUpdateOptions<Name>;
|
1527
|
+
/* eslint-enable @typescript-eslint/no-deprecated */
|
1310
1528
|
|
1311
1529
|
interface Metadata<out ThisType extends Document.Any> {
|
1312
1530
|
readonly name: ThisType["documentName"];
|
1313
1531
|
readonly collection: string;
|
1314
|
-
readonly indexed
|
1315
|
-
readonly compendiumIndexFields
|
1532
|
+
readonly indexed: boolean;
|
1533
|
+
readonly compendiumIndexFields: readonly string[];
|
1316
1534
|
readonly label: string;
|
1317
1535
|
readonly coreTypes: readonly string[];
|
1318
|
-
readonly embedded:
|
1536
|
+
readonly embedded: {
|
1537
|
+
[DocumentType in Document.Type]?: string;
|
1538
|
+
};
|
1319
1539
|
readonly permissions: {
|
1320
|
-
create:
|
1321
|
-
|
1322
|
-
|
1323
|
-
(user: foundry.documents.BaseUser, doc: ThisType, data: Document.ConstructorDataForName<Type>) => boolean
|
1324
|
-
>;
|
1325
|
-
update:
|
1326
|
-
| string
|
1327
|
-
| ToMethod<
|
1328
|
-
(user: foundry.documents.BaseUser, doc: ThisType, data: Document.UpdateDataForName<Type>) => boolean
|
1329
|
-
>;
|
1330
|
-
delete: string | ToMethod<(user: foundry.documents.BaseUser, 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>;
|
1331
1543
|
};
|
1332
|
-
readonly preserveOnImport
|
1333
|
-
readonly schemaVersion
|
1334
|
-
readonly labelPlural
|
1335
|
-
readonly types
|
1336
|
-
readonly hasSystemData
|
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;
|
1337
1549
|
}
|
1338
1550
|
|
1339
1551
|
namespace Metadata {
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
name: "Document";
|
1344
|
-
collection: "documents";
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
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: {
|
1351
1563
|
create: "ASSISTANT";
|
1352
1564
|
update: "ASSISTANT";
|
1353
1565
|
delete: "ASSISTANT";
|
1354
1566
|
};
|
1355
|
-
|
1567
|
+
readonly preserveOnImport: ["_id", "sort", "ownership"];
|
1356
1568
|
}
|
1569
|
+
|
1570
|
+
interface Embedded extends Identity<{ [K in Document.Type]?: string }> {}
|
1357
1571
|
}
|
1358
|
-
}
|
1359
1572
|
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1573
|
+
type ConfiguredSheetClassFor<Name extends Document.Type> = MakeConform<
|
1574
|
+
GetKey<GetKey<CONFIG, Name>, "sheetClass">,
|
1575
|
+
AnyConstructor
|
1576
|
+
>;
|
1577
|
+
|
1578
|
+
type ConfiguredObjectClassFor<Name extends Document.Type> = GetKey<GetKey<CONFIG, Name>, "objectClass">;
|
1579
|
+
|
1580
|
+
type ConfiguredLayerClassFor<Name extends Document.Type> = GetKey<GetKey<CONFIG, Name>, "layerClass">;
|
1581
|
+
|
1582
|
+
type DropData<T extends Document.Any> = T extends { id: string | undefined }
|
1583
|
+
? DropData.Data<T> & DropData.UUID
|
1584
|
+
: DropData.Data<T>;
|
1585
|
+
|
1586
|
+
namespace DropData {
|
1587
|
+
type Any = DropData<any>;
|
1588
|
+
|
1589
|
+
interface Data<T extends Document.Any> {
|
1590
|
+
type: T["documentName"];
|
1591
|
+
data: T["_source"];
|
1592
|
+
}
|
1593
|
+
|
1594
|
+
interface UUID {
|
1595
|
+
uuid: string;
|
1596
|
+
}
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
namespace Database {
|
1600
|
+
type Operation = "create" | "update" | "delete";
|
1601
|
+
|
1602
|
+
interface GetOptions {
|
1603
|
+
pack?: string | null;
|
1604
|
+
}
|
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
|
+
>;
|
1689
|
+
|
1690
|
+
/**
|
1691
|
+
* This is a helper type that gets the right DatabaseOperation (including the
|
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.
|
1928
|
+
*/
|
1929
|
+
value?: unknown;
|
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;
|
1372
2145
|
}
|
1373
|
-
/* eslint-enable @typescript-eslint/no-empty-object-type */
|
1374
2146
|
|
2147
|
+
/** @deprecated {@link Document.Database.Operation | `Document.Database.Operation`} */
|
2148
|
+
export type Operation = Document.Database.Operation;
|
2149
|
+
|
2150
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
2151
|
+
/**
|
2152
|
+
* @deprecated if you want to get individual operations see {@link Document.Database.OperationOf | `Document.Database.OperationOf`}
|
2153
|
+
*/
|
1375
2154
|
export interface DatabaseOperationMap {
|
1376
2155
|
ActiveEffect: ActiveEffect.DatabaseOperations;
|
1377
2156
|
Actor: Actor.DatabaseOperations;
|
@@ -1395,9 +2174,8 @@ export interface DatabaseOperationMap {
|
|
1395
2174
|
Note: NoteDocument.DatabaseOperations;
|
1396
2175
|
Playlist: Playlist.DatabaseOperations;
|
1397
2176
|
PlaylistSound: PlaylistSound.DatabaseOperations;
|
1398
|
-
|
1399
|
-
|
1400
|
-
// RegionBehavior: ActiveEffect.DatabaseOperations;
|
2177
|
+
Region: RegionDocument.DatabaseOperations;
|
2178
|
+
RegionBehavior: RegionBehavior.DatabaseOperations;
|
1401
2179
|
RollTable: RollTable.DatabaseOperations;
|
1402
2180
|
Scene: Scene.DatabaseOperations;
|
1403
2181
|
Setting: Setting.DatabaseOperations;
|
@@ -1407,3 +2185,109 @@ export interface DatabaseOperationMap {
|
|
1407
2185
|
User: User.DatabaseOperations;
|
1408
2186
|
Wall: WallDocument.DatabaseOperations;
|
1409
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
|
+
}
|