@league-of-foundry-developers/foundry-vtt-types 12.331.3-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 +74 -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 -13
- 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 +31 -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 +1 -1
- 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 -312
- 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 +14 -13
- 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 -16
- 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 +47 -55
- 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 +81 -99
- package/src/foundry/client/data/collections/compendium-folders.d.mts +6 -6
- package/src/foundry/client/data/collections/compendium-packs.d.mts +5 -5
- 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 -64
- 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 -87
- 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 -35
- 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 -147
- 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 +1111 -94
- 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 +60 -92
- 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 +106 -94
- 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 -30
- 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 +128 -125
- package/src/foundry/client/pixi/extensions/graphics.d.mts +3 -1
- package/src/foundry/client/pixi/extensions/observable-transform.d.mts +5 -4
- package/src/foundry/client/pixi/extensions/polygon.d.mts +154 -134
- package/src/foundry/client/pixi/extensions/rectangle.d.mts +242 -259
- 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 +91 -64
- package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +44 -16
- 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 -100
- package/src/foundry/client/pixi/placeables/tile.d.mts +206 -140
- package/src/foundry/client/pixi/placeables/token.d.mts +916 -449
- 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 +36 -19
- 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 +1 -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 +10 -8
- 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 +2 -0
- 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 +124 -80
- package/src/foundry/client-esm/audio/sound.d.mts +230 -126
- package/src/foundry/client-esm/audio/timeout.d.mts +28 -12
- 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 +6 -11
- 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 +13 -3
- 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 -27
- 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 +175 -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 +11 -14
- 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 +132 -154
- package/src/foundry/common/abstract/document.d.mts +1306 -438
- 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 +58 -55
- 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 +700 -644
- 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 -179
- 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 -94
- 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 -156
- 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 +35 -28
- 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/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 +58 -16
- 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 -312
- 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 -583
- package/src/types/utils.d.mts +0 -539
- /package/src/foundry/{clipper → public/scripts/clipper}/index.d.mts +0 -0
@@ -1,20 +1,22 @@
|
|
1
1
|
import type {
|
2
2
|
RemoveIndexSignatures,
|
3
3
|
SimpleMerge,
|
4
|
-
ValueOf,
|
5
4
|
AnyObject,
|
6
5
|
EmptyObject,
|
7
6
|
NullishProps,
|
8
7
|
InexactPartial,
|
9
|
-
|
10
|
-
|
8
|
+
FixedInstanceType,
|
9
|
+
Identity,
|
10
|
+
PrettifyType,
|
11
|
+
InterfaceToObject,
|
12
|
+
AnyArray,
|
13
|
+
} from "fvtt-types/utils";
|
11
14
|
import type { DataModel } from "../abstract/data.mts";
|
12
15
|
import type Document from "../abstract/document.mts";
|
13
16
|
import type { EmbeddedCollection, EmbeddedCollectionDelta, TypeDataModel } from "../abstract/module.d.mts";
|
14
17
|
import type { DOCUMENT_OWNERSHIP_LEVELS } from "../constants.d.mts";
|
15
18
|
import type { CONST } from "../../client-esm/client.d.mts";
|
16
19
|
import type { DataModelValidationFailure } from "./validation-failure.mts";
|
17
|
-
import type { EffectChangeData } from "../documents/_types.d.mts";
|
18
20
|
import type {
|
19
21
|
FormGroupConfig,
|
20
22
|
FormInputConfig,
|
@@ -23,100 +25,8 @@ import type {
|
|
23
25
|
SelectInputConfig,
|
24
26
|
TextAreaInputConfig,
|
25
27
|
} from "../../client-esm/applications/forms/fields.d.mts";
|
26
|
-
import type { ToMethod } from "../../../types/helperTypes.d.mts";
|
27
28
|
|
28
|
-
|
29
|
-
/**
|
30
|
-
* @typeParam BaseAssignmentType - the base assignment type for a DataField, without null or undefined
|
31
|
-
*/
|
32
|
-
interface DataFieldOptions<BaseAssignmentType> {
|
33
|
-
/**
|
34
|
-
* Is this field required to be populated?
|
35
|
-
* @defaultValue `false`
|
36
|
-
*/
|
37
|
-
required?: boolean | undefined;
|
38
|
-
|
39
|
-
/**
|
40
|
-
* Can this field have null values?
|
41
|
-
* @defaultValue `false`
|
42
|
-
*/
|
43
|
-
nullable?: boolean | undefined;
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Can this field only be modified by a gamemaster or assistant gamemaster?
|
47
|
-
* @defaultValue `false`
|
48
|
-
*/
|
49
|
-
gmOnly?: boolean | undefined;
|
50
|
-
|
51
|
-
/** The initial value of a field, or a function which assigns that initial value. */
|
52
|
-
initial?:
|
53
|
-
| DataFieldOptions.InitialType<
|
54
|
-
DataFieldOptions.InitialReturnType<BaseAssignmentType, this["nullable"], this["required"]>
|
55
|
-
>
|
56
|
-
| undefined;
|
57
|
-
|
58
|
-
/** A data validation function which accepts one argument with the current value. */
|
59
|
-
validate?: DataField.Validator<BaseAssignmentType> | undefined;
|
60
|
-
|
61
|
-
/** A localizable label displayed on forms which render this field. */
|
62
|
-
label?: string | undefined;
|
63
|
-
|
64
|
-
/** Localizable help text displayed on forms which render this field. */
|
65
|
-
hint?: string | undefined;
|
66
|
-
|
67
|
-
/**
|
68
|
-
* A custom validation error string. When displayed will be prepended with the
|
69
|
-
* document name, field name, and candidate value. This error string is only
|
70
|
-
* used when the return type of the validate function is a boolean. If an Error
|
71
|
-
* is thrown in the validate function, the string message of that Error is used.
|
72
|
-
*/
|
73
|
-
validationError?: string | undefined;
|
74
|
-
}
|
75
|
-
|
76
|
-
namespace DataFieldOptions {
|
77
|
-
/** Any DataFieldOptions. */
|
78
|
-
// Note(LukeAbby): This `& object` is intentional. Its purpose is to allow options like `{ integer: true }` to be assigned.
|
79
|
-
// This is an issue because `{ integer: true }` does not extend `{ required?: boolean }` because they have properties in common.
|
80
|
-
// Even though `{ integer: true, required: undefined }` would extend `{ required?: boolean }` following the regular rules of surplus properties being allowed.
|
81
|
-
// `object` was chosen over `AnyObject` so that people may pass in interfa
|
82
|
-
type Any = DataFieldOptions<any> & object;
|
83
|
-
|
84
|
-
/**
|
85
|
-
* A helper type for the {@link DataFieldOptions.initial} option.
|
86
|
-
* @typeParam ReturnType - the return type of the option
|
87
|
-
*/
|
88
|
-
type InitialType<ReturnType> = ReturnType | ((initialData: unknown) => ReturnType);
|
89
|
-
|
90
|
-
/**
|
91
|
-
* The decorated return type for the {@link DataFieldOptions.initial} option.
|
92
|
-
* @typeParam BaseAssignmentType - the base assignment type for a DataField
|
93
|
-
* @typeParam NullableOption - the value of the nullable option
|
94
|
-
* @typeParam RequiredOption - the value of the required option
|
95
|
-
*/
|
96
|
-
type InitialReturnType<BaseAssignmentType, NullableOption, RequiredOption> =
|
97
|
-
| Exclude<BaseAssignmentType, null | undefined>
|
98
|
-
| (NullableOption extends true ? null : never)
|
99
|
-
| (RequiredOption extends true ? never : undefined);
|
100
|
-
}
|
101
|
-
|
102
|
-
interface DataFieldValidationOptions {
|
103
|
-
/** Whether this is a partial schema validation, or a complete one. */
|
104
|
-
partial?: boolean;
|
105
|
-
|
106
|
-
/** Whether to allow replacing invalid values with valid fallbacks. */
|
107
|
-
fallback?: boolean;
|
108
|
-
|
109
|
-
/** The full source object being evaluated. */
|
110
|
-
source?: AnyObject;
|
111
|
-
|
112
|
-
/**
|
113
|
-
* If true, invalid embedded documents will emit a warning and be placed in
|
114
|
-
* the invalidDocuments collection rather than causing the parent to be
|
115
|
-
* considered invalid.
|
116
|
-
*/
|
117
|
-
dropInvalidEmbedded?: boolean;
|
118
|
-
}
|
119
|
-
}
|
29
|
+
export type DataSchema = Record<string, DataField.Any>;
|
120
30
|
|
121
31
|
/**
|
122
32
|
* An abstract class that defines the base pattern for a data field within a data schema.
|
@@ -132,10 +42,10 @@ declare global {
|
|
132
42
|
* InitialValue: `undefined`
|
133
43
|
*/
|
134
44
|
declare abstract class DataField<
|
135
|
-
const Options extends
|
45
|
+
const Options extends DataField.Options.Any = DataField.DefaultOptions,
|
136
46
|
const AssignmentType = DataField.AssignmentType<Options>,
|
137
47
|
const InitializedType = DataField.InitializedType<Options>,
|
138
|
-
const PersistedType
|
48
|
+
const PersistedType = InitializedType,
|
139
49
|
> {
|
140
50
|
// Prevent from being bivariant.
|
141
51
|
#assignmentType: AssignmentType;
|
@@ -145,6 +55,15 @@ declare abstract class DataField<
|
|
145
55
|
*/
|
146
56
|
constructor(options?: Options, context?: DataField.Context);
|
147
57
|
|
58
|
+
/** @internal */
|
59
|
+
" __fvtt_types_internal_source_data": PersistedType;
|
60
|
+
|
61
|
+
/** @internal */
|
62
|
+
" __fvtt_types_internal_assignment_data": AssignmentType;
|
63
|
+
|
64
|
+
/** @internal */
|
65
|
+
" __fvtt_types_internal_initialized_data": InitializedType;
|
66
|
+
|
148
67
|
/** The initially provided options which configure the data field */
|
149
68
|
options: Options;
|
150
69
|
|
@@ -170,7 +89,7 @@ declare abstract class DataField<
|
|
170
89
|
* The initial value of a field, or a function which assigns that initial value.
|
171
90
|
* @defaultValue `undefined`
|
172
91
|
*/
|
173
|
-
initial:
|
92
|
+
initial: DataField.Options.InitialType<InitializedType>;
|
174
93
|
|
175
94
|
/**
|
176
95
|
* Should the prepared value of the field be read-only, preventing it from being
|
@@ -234,7 +153,7 @@ declare abstract class DataField<
|
|
234
153
|
* Default parameters for this field type
|
235
154
|
* @remarks This is not entirely type-safe, overrides should specify a more concrete return type.
|
236
155
|
*/
|
237
|
-
protected static get _defaults():
|
156
|
+
protected static get _defaults(): DataField.Options.Any;
|
238
157
|
|
239
158
|
/**
|
240
159
|
* A dot-separated string representation of the field path within the parent schema.
|
@@ -301,7 +220,7 @@ declare abstract class DataField<
|
|
301
220
|
validate(
|
302
221
|
value: AssignmentType,
|
303
222
|
options?: DataField.ValidationOptions<DataField.Any>,
|
304
|
-
): DataModelValidationFailure |
|
223
|
+
): DataModelValidationFailure | void;
|
305
224
|
|
306
225
|
/**
|
307
226
|
* Special validation rules which supersede regular field validation.
|
@@ -403,7 +322,7 @@ declare abstract class DataField<
|
|
403
322
|
* @param change - The change to apply.
|
404
323
|
* @returns The updated value.
|
405
324
|
*/
|
406
|
-
applyChange(value: InitializedType, model: DataModel.Any, change: EffectChangeData): InitializedType;
|
325
|
+
applyChange(value: InitializedType, model: DataModel.Any, change: ActiveEffect.EffectChangeData): InitializedType;
|
407
326
|
|
408
327
|
/**
|
409
328
|
* Cast a change delta into an appropriate type to be applied to this field.
|
@@ -426,7 +345,7 @@ declare abstract class DataField<
|
|
426
345
|
value: InitializedType,
|
427
346
|
delta: InitializedType,
|
428
347
|
model: DataModel.Any,
|
429
|
-
change: EffectChangeData,
|
348
|
+
change: ActiveEffect.EffectChangeData,
|
430
349
|
): InitializedType | undefined;
|
431
350
|
|
432
351
|
/**
|
@@ -441,7 +360,7 @@ declare abstract class DataField<
|
|
441
360
|
value: InitializedType,
|
442
361
|
delta: InitializedType,
|
443
362
|
model: DataModel.Any,
|
444
|
-
change: EffectChangeData,
|
363
|
+
change: ActiveEffect.EffectChangeData,
|
445
364
|
): InitializedType | undefined;
|
446
365
|
|
447
366
|
/**
|
@@ -456,7 +375,7 @@ declare abstract class DataField<
|
|
456
375
|
value: InitializedType,
|
457
376
|
delta: InitializedType,
|
458
377
|
model: DataModel.Any,
|
459
|
-
change: EffectChangeData,
|
378
|
+
change: ActiveEffect.EffectChangeData,
|
460
379
|
): InitializedType | undefined;
|
461
380
|
|
462
381
|
/**
|
@@ -471,7 +390,7 @@ declare abstract class DataField<
|
|
471
390
|
value: InitializedType,
|
472
391
|
delta: InitializedType,
|
473
392
|
model: DataModel.Any,
|
474
|
-
change: EffectChangeData,
|
393
|
+
change: ActiveEffect.EffectChangeData,
|
475
394
|
): InitializedType | undefined;
|
476
395
|
|
477
396
|
/**
|
@@ -486,7 +405,7 @@ declare abstract class DataField<
|
|
486
405
|
value: InitializedType,
|
487
406
|
delta: InitializedType,
|
488
407
|
model: DataModel.Any,
|
489
|
-
change: EffectChangeData,
|
408
|
+
change: ActiveEffect.EffectChangeData,
|
490
409
|
): InitializedType | undefined;
|
491
410
|
|
492
411
|
/**
|
@@ -501,15 +420,14 @@ declare abstract class DataField<
|
|
501
420
|
value: InitializedType,
|
502
421
|
delta: InitializedType,
|
503
422
|
model: DataModel.Any,
|
504
|
-
change: EffectChangeData,
|
423
|
+
change: ActiveEffect.EffectChangeData,
|
505
424
|
): InitializedType;
|
506
425
|
}
|
507
426
|
|
508
427
|
declare namespace DataField {
|
509
428
|
/** Any DataField. */
|
510
|
-
|
511
|
-
|
512
|
-
type AnyConstructor = typeof AnyDataField;
|
429
|
+
interface Any extends AnyDataField {}
|
430
|
+
interface AnyConstructor extends Identity<typeof AnyDataField> {}
|
513
431
|
|
514
432
|
/** A DataField with unknown inner types. */
|
515
433
|
type Unknown = DataField<any, unknown, unknown, unknown>;
|
@@ -523,7 +441,7 @@ declare namespace DataField {
|
|
523
441
|
type PersistedTypeFor<ConcreteDataField extends Any> =
|
524
442
|
ConcreteDataField extends DataField<any, any, any, infer PersistedType> ? PersistedType : never;
|
525
443
|
|
526
|
-
/** The type of the default options for the {@link DataField} class. */
|
444
|
+
/** The type of the default options for the {@link DataField | `DataField`} class. */
|
527
445
|
interface DefaultOptions {
|
528
446
|
required: false;
|
529
447
|
nullable: false;
|
@@ -535,18 +453,108 @@ declare namespace DataField {
|
|
535
453
|
validationError: "is not a valid value";
|
536
454
|
}
|
537
455
|
|
456
|
+
interface Options<BaseAssignmentType> {
|
457
|
+
/**
|
458
|
+
* Is this field required to be populated?
|
459
|
+
* @defaultValue `false`
|
460
|
+
*/
|
461
|
+
required?: boolean | undefined;
|
462
|
+
|
463
|
+
/**
|
464
|
+
* Can this field have null values?
|
465
|
+
* @defaultValue `false`
|
466
|
+
*/
|
467
|
+
nullable?: boolean | undefined;
|
468
|
+
|
469
|
+
/**
|
470
|
+
* Can this field only be modified by a gamemaster or assistant gamemaster?
|
471
|
+
* @defaultValue `false`
|
472
|
+
*/
|
473
|
+
gmOnly?: boolean | undefined;
|
474
|
+
|
475
|
+
/** The initial value of a field, or a function which assigns that initial value. */
|
476
|
+
initial?:
|
477
|
+
| DataField.Options.InitialType<
|
478
|
+
// TODO(LukeAbby): Add a `ValidateOptions` type or something of that sort in order to
|
479
|
+
// catch incorrect initial types.
|
480
|
+
DataField.Options.InitialReturnType<BaseAssignmentType, boolean, boolean>
|
481
|
+
>
|
482
|
+
| undefined;
|
483
|
+
|
484
|
+
/** A data validation function which accepts one argument with the current value. */
|
485
|
+
validate?: DataField.Validator<DataField.Any, BaseAssignmentType> | undefined;
|
486
|
+
|
487
|
+
/** A localizable label displayed on forms which render this field. */
|
488
|
+
label?: string | undefined;
|
489
|
+
|
490
|
+
/** Localizable help text displayed on forms which render this field. */
|
491
|
+
hint?: string | undefined;
|
492
|
+
|
493
|
+
/**
|
494
|
+
* A custom validation error string. When displayed will be prepended with the
|
495
|
+
* document name, field name, and candidate value. This error string is only
|
496
|
+
* used when the return type of the validate function is a boolean. If an Error
|
497
|
+
* is thrown in the validate function, the string message of that Error is used.
|
498
|
+
*/
|
499
|
+
validationError?: string | undefined;
|
500
|
+
}
|
501
|
+
|
502
|
+
namespace Options {
|
503
|
+
/** Any DataField.Options. */
|
504
|
+
// Note(LukeAbby): This `& object` is intentional. Its purpose is to allow options like `{ integer: true }` to be assigned.
|
505
|
+
// This is an issue because `{ integer: true }` does not extend `{ required?: boolean }` because they have no properties in common.
|
506
|
+
// Even though `{ integer: true, required: undefined }` would extend `{ required?: boolean }` following the regular rules of surplus properties being allowed.
|
507
|
+
// `object` was chosen over `AnyObject` so that people may pass in interfaces.
|
508
|
+
interface Any extends DataField.Options<any>, Identity<object> {}
|
509
|
+
|
510
|
+
/**
|
511
|
+
* A helper type for the {@link DataField.Options.initial | `DataField.Options.initial`} option.
|
512
|
+
* @typeParam ReturnType - the return type of the option
|
513
|
+
*/
|
514
|
+
type InitialType<ReturnType> = ReturnType | ((initialData: unknown) => ReturnType);
|
515
|
+
|
516
|
+
/**
|
517
|
+
* The decorated return type for the {@link DataField.Options.initial | `DataField.Options.initial`} option.
|
518
|
+
* @typeParam BaseAssignmentType - the base assignment type for a DataField
|
519
|
+
* @typeParam NullableOption - the value of the nullable option
|
520
|
+
* @typeParam RequiredOption - the value of the required option
|
521
|
+
*/
|
522
|
+
type InitialReturnType<BaseAssignmentType, NullableOption, RequiredOption> =
|
523
|
+
| Exclude<BaseAssignmentType, null | undefined>
|
524
|
+
| (NullableOption extends true ? null : never)
|
525
|
+
| (RequiredOption extends true ? never : undefined);
|
526
|
+
}
|
527
|
+
|
528
|
+
interface DataValidationOptions {
|
529
|
+
/** Whether this is a partial schema validation, or a complete one. */
|
530
|
+
partial?: boolean;
|
531
|
+
|
532
|
+
/** Whether to allow replacing invalid values with valid fallbacks. */
|
533
|
+
fallback?: boolean;
|
534
|
+
|
535
|
+
/** The full source object being evaluated. */
|
536
|
+
source?: AnyObject;
|
537
|
+
|
538
|
+
/**
|
539
|
+
* If true, invalid embedded documents will emit a warning and be placed in
|
540
|
+
* the invalidDocuments collection rather than causing the parent to be
|
541
|
+
* considered invalid.
|
542
|
+
*/
|
543
|
+
dropInvalidEmbedded?: boolean;
|
544
|
+
}
|
545
|
+
|
538
546
|
/**
|
539
547
|
* A helper type for the given options type merged into the default options of the DataField class.
|
540
548
|
* @typeParam Options - the options that override the default options
|
541
549
|
*/
|
542
|
-
type MergedOptions<Options extends
|
550
|
+
type MergedOptions<Options extends DataField.Options.Any> = SimpleMerge<DefaultOptions, Options>;
|
543
551
|
|
544
552
|
/**
|
545
553
|
* A type to decorate the base assignment type to a DataField, based on the options of the field.
|
546
554
|
* @typeParam BaseAssignmentType - the base assignment type of the DataField, without null or undefined
|
547
555
|
* @typeParam Options - the options of the DataField
|
548
556
|
*/
|
549
|
-
type DerivedAssignmentType<BaseAssignmentType, Options extends
|
557
|
+
type DerivedAssignmentType<BaseAssignmentType, Options extends DataField.Options.Any> =
|
550
558
|
| Exclude<BaseAssignmentType, null | undefined> // Always include the base type
|
551
559
|
| (Options["nullable"] extends true // determine whether null is in the union
|
552
560
|
? // when nullable, null is always allowed
|
@@ -576,7 +584,7 @@ declare namespace DataField {
|
|
576
584
|
* @typeParam BaseInitializedType - the base initialized type of the DataField, without null or undefined
|
577
585
|
* @typeParam Options - the options of the DataField
|
578
586
|
*/
|
579
|
-
type DerivedInitializedType<BaseInitializedType, Options extends
|
587
|
+
type DerivedInitializedType<BaseInitializedType, Options extends DataField.Options.Any> =
|
580
588
|
| Exclude<BaseInitializedType, null | undefined>
|
581
589
|
| (Options["nullable"] extends true ? null : never)
|
582
590
|
| (Options["required"] extends true ? never : undefined);
|
@@ -585,15 +593,15 @@ declare namespace DataField {
|
|
585
593
|
* A shorthand for the assignment type of a DataField class.
|
586
594
|
* @typeParam Options - the options overriding the defaults
|
587
595
|
*/
|
588
|
-
type AssignmentType<Options extends
|
596
|
+
type AssignmentType<Options extends DataField.Options.Any> = DerivedAssignmentType<any, MergedOptions<Options>>;
|
589
597
|
|
590
598
|
/**
|
591
599
|
* A shorthand for the initialized type of a DataField class.
|
592
600
|
* @typeParam Options - the options overriding the defaults
|
593
601
|
*/
|
594
|
-
type InitializedType<Options extends
|
602
|
+
type InitializedType<Options extends DataField.Options.Any> = DerivedInitializedType<any, MergedOptions<Options>>;
|
595
603
|
|
596
|
-
/** An interface for the options of the {@link DataField} clean functions. */
|
604
|
+
/** An interface for the options of the {@link DataField | `DataField`} clean functions. */
|
597
605
|
interface CleanOptions {
|
598
606
|
/** Whether to perform partial cleaning? */
|
599
607
|
partial?: boolean;
|
@@ -615,22 +623,36 @@ declare namespace DataField {
|
|
615
623
|
*
|
616
624
|
* An Error may be thrown which provides a custom error message explaining the reason the value is invalid.
|
617
625
|
*/
|
618
|
-
type Validator<BaseAssignmentType> =
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
+
type Validator<CurrentField extends DataField.Any, BaseAssignmentType> =
|
627
|
+
| {
|
628
|
+
validate(
|
629
|
+
this: CurrentField,
|
630
|
+
value: unknown,
|
631
|
+
options: ValidationOptions<CurrentField>,
|
632
|
+
): value is BaseAssignmentType;
|
633
|
+
}["validate"]
|
634
|
+
| {
|
635
|
+
validate(
|
636
|
+
this: CurrentField,
|
637
|
+
value: unknown,
|
638
|
+
options: ValidationOptions<CurrentField>,
|
639
|
+
): asserts value is BaseAssignmentType;
|
640
|
+
}["validate"]
|
641
|
+
| {
|
642
|
+
validate(
|
643
|
+
this: CurrentField,
|
644
|
+
value: unknown,
|
645
|
+
options: ValidationOptions<CurrentField>,
|
646
|
+
): DataModelValidationFailure | boolean | void;
|
647
|
+
}["validate"];
|
626
648
|
|
627
649
|
/**
|
628
|
-
* An interface for the options of the {@link DataField} validation functions.
|
629
|
-
* @typeParam
|
650
|
+
* An interface for the options of the {@link DataField | `DataField`} validation functions.
|
651
|
+
* @typeParam CurrentField - the type of the DataField, which is the receiver of the validate function
|
630
652
|
*/
|
631
|
-
interface ValidationOptions<
|
653
|
+
interface ValidationOptions<CurrentField extends DataField.Any> extends DataValidationOptions {
|
632
654
|
source?: AnyObject;
|
633
|
-
validate?: Validator<DataField.AssignmentTypeFor<
|
655
|
+
validate?: Validator<CurrentField, DataField.AssignmentTypeFor<CurrentField>>;
|
634
656
|
}
|
635
657
|
|
636
658
|
interface Context {
|
@@ -662,11 +684,11 @@ declare namespace DataField {
|
|
662
684
|
}
|
663
685
|
|
664
686
|
declare abstract class AnyDataField extends DataField<any, any, any, any> {
|
665
|
-
constructor(
|
687
|
+
constructor(...args: never);
|
666
688
|
}
|
667
689
|
|
668
690
|
/**
|
669
|
-
* A special class of {@link DataField} which defines a data schema.
|
691
|
+
* A special class of {@link DataField | `DataField`} which defines a data schema.
|
670
692
|
* @typeParam Fields - the DataSchema fields of the SchemaField
|
671
693
|
* @typeParam Options - the options of the SchemaField instance
|
672
694
|
* @typeParam AssignmentType - the type of the allowed assignment values of the SchemaField
|
@@ -681,9 +703,9 @@ declare abstract class AnyDataField extends DataField<any, any, any, any> {
|
|
681
703
|
declare class SchemaField<
|
682
704
|
Fields extends DataSchema,
|
683
705
|
Options extends SchemaField.Options<Fields> = SchemaField.DefaultOptions,
|
684
|
-
AssignmentType = SchemaField.AssignmentType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
|
685
|
-
InitializedType = SchemaField.InitializedType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
|
686
|
-
PersistedType extends AnyObject | null | undefined = SchemaField.PersistedType<
|
706
|
+
AssignmentType = SchemaField.Internal.AssignmentType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
|
707
|
+
InitializedType = SchemaField.Internal.InitializedType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
|
708
|
+
PersistedType extends AnyObject | null | undefined = SchemaField.Internal.PersistedType<
|
687
709
|
Fields,
|
688
710
|
SimpleMerge<Options, SchemaField.DefaultOptions>
|
689
711
|
>,
|
@@ -702,7 +724,7 @@ declare class SchemaField<
|
|
702
724
|
override nullable: boolean;
|
703
725
|
|
704
726
|
/** @defaultValue `() => this.clean({})` */
|
705
|
-
override initial:
|
727
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
706
728
|
|
707
729
|
protected static override get _defaults(): SchemaField.Options<DataSchema>;
|
708
730
|
|
@@ -785,7 +807,7 @@ declare class SchemaField<
|
|
785
807
|
|
786
808
|
override apply<Options, Return>(
|
787
809
|
fn: keyof this | ((this: this, value: undefined | null, options: Options) => Return),
|
788
|
-
value?:
|
810
|
+
value?: null,
|
789
811
|
options?: Options,
|
790
812
|
): Return;
|
791
813
|
override apply<Value, Options, Return>(
|
@@ -803,7 +825,7 @@ declare class SchemaField<
|
|
803
825
|
}
|
804
826
|
|
805
827
|
// FIXME(LukeAbby): This is a quick patch that avoids issues with the fact that the `initial` in `SchemaField` is not actually assignable to its assignment type etc.
|
806
|
-
// This will be
|
828
|
+
// This will be superseded once proper field treatment is applied.
|
807
829
|
declare const __SchemaFieldInitialSymbol: unique symbol;
|
808
830
|
|
809
831
|
type __SchemaFieldInitial = typeof __SchemaFieldInitialSymbol;
|
@@ -813,64 +835,97 @@ declare namespace SchemaField {
|
|
813
835
|
* A shorthand for the options of a SchemaField class.
|
814
836
|
* @typeParam Fields - the DataSchema fields of the SchemaField
|
815
837
|
*/
|
816
|
-
type Options<Fields extends DataSchema> =
|
838
|
+
type Options<Fields extends DataSchema> = DataField.Options<AssignmentData<Fields> | __SchemaFieldInitial>;
|
817
839
|
|
818
840
|
/** Any SchemaField. */
|
819
|
-
|
841
|
+
interface Any extends SchemaField<any, any, any, any, any> {}
|
820
842
|
|
821
843
|
/**
|
822
844
|
* Get the constructor type for the given DataSchema.
|
823
845
|
* @typeParam Fields - the DataSchema fields of the SchemaField
|
824
846
|
*/
|
825
|
-
type
|
847
|
+
// Note(LukeAbby): Currently this is identical to the assignment type. The intent is to make this
|
848
|
+
// More accurate in the future, e.g. requiring some requisite properties.
|
849
|
+
type CreateData<Fields extends DataSchema> = AssignmentData<Fields>;
|
826
850
|
|
827
851
|
/**
|
828
852
|
* Get the inner assignment type for the given DataSchema.
|
829
853
|
* @typeParam Fields - the DataSchema fields of the SchemaField
|
830
854
|
*/
|
831
|
-
type
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
// This
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
855
|
+
type AssignmentData<Fields extends DataSchema> = PrettifyType<
|
856
|
+
RemoveIndexSignatures<{
|
857
|
+
[Key in keyof Fields]?: Fields[Key] extends EmbeddedDataField<any, any, infer AssignmentType, any, any>
|
858
|
+
? AssignmentType
|
859
|
+
: Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
860
|
+
? // FIXME(LukeAbby): This is a quick hack into AssignmentData that assumes that the `initial` of `SchemaField` is not changed from the default of `{}`
|
861
|
+
// This will be fixed with the refactoring of the types
|
862
|
+
EmptyObject extends AssignmentData<SubSchema>
|
863
|
+
? AssignmentData<SubSchema> | undefined | null
|
864
|
+
: AssignmentData<SubSchema>
|
865
|
+
: Fields[Key] extends DataField<any, infer AssignType, any, any>
|
866
|
+
? AssignType
|
867
|
+
: never;
|
868
|
+
}>
|
869
|
+
>;
|
870
|
+
|
871
|
+
/**
|
872
|
+
* The required type of data used when updating a document.
|
847
873
|
* @typeParam Fields - the DataSchema fields of the SchemaField
|
848
874
|
*/
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
: Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
853
|
-
? InnerInitializedType<SubSchema>
|
854
|
-
: Fields[Key] extends DataField<any, any, infer InitType, any>
|
855
|
-
? InitType
|
856
|
-
: never;
|
857
|
-
}>;
|
875
|
+
// Note(LukeAbby): Currently this is identical to `AssignmentData` but the intent is to make it
|
876
|
+
// more accurate in the future.
|
877
|
+
type UpdateData<Fields extends DataSchema> = AssignmentData<Fields>;
|
858
878
|
|
859
879
|
/**
|
860
|
-
*
|
880
|
+
* Gets the initialized version of a schema. This means a
|
861
881
|
* @typeParam Fields - the DataSchema fields of the SchemaField
|
862
882
|
*/
|
863
|
-
type
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
883
|
+
type InitializedData<Fields extends DataSchema> = PrettifyType<
|
884
|
+
RemoveIndexSignatures<{
|
885
|
+
[Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<infer Model, any, any, any, any>
|
886
|
+
? FixedInstanceType<Model>
|
887
|
+
: Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
888
|
+
? InitializedData<SubSchema>
|
889
|
+
: Fields[Key] extends DataField<any, any, infer InitType, any>
|
890
|
+
? InitType
|
891
|
+
: never;
|
892
|
+
}>
|
893
|
+
>;
|
894
|
+
|
895
|
+
/**
|
896
|
+
* @deprecated {@link SourceData | `SourceData`}
|
897
|
+
*/
|
898
|
+
type PersistedData<Fields extends DataSchema> = SourceData<Fields>;
|
899
|
+
|
900
|
+
/**
|
901
|
+
* Get the persisted type for the given DataSchema. This is the type used for source.
|
902
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
903
|
+
*/
|
904
|
+
type SourceData<Fields extends DataSchema> = PrettifyType<
|
905
|
+
RemoveIndexSignatures<{
|
906
|
+
[Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<any, any, any, any, infer PersistType>
|
907
|
+
? PersistType
|
908
|
+
: Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
909
|
+
? SourceData<SubSchema>
|
910
|
+
: Fields[Key] extends DataField<any, any, any, infer PersistType>
|
911
|
+
? PersistType
|
912
|
+
: never;
|
913
|
+
}>
|
914
|
+
>;
|
915
|
+
|
916
|
+
type UpdateSourceData<Fields extends DataSchema> = PrettifyType<
|
917
|
+
RemoveIndexSignatures<{
|
918
|
+
[Key in keyof Fields]: Fields[Key] extends EmbeddedDataField<any, any, any, any, infer PersistType>
|
919
|
+
? PersistType
|
920
|
+
: Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
921
|
+
? SourceData<SubSchema>
|
922
|
+
: Fields[Key] extends DataField<any, any, any, infer PersistType>
|
923
|
+
? PersistType
|
924
|
+
: never;
|
925
|
+
}>
|
926
|
+
>;
|
927
|
+
|
928
|
+
/** The type of the default options for the {@link SchemaField | `SchemaField`} class. */
|
874
929
|
type DefaultOptions = SimpleMerge<
|
875
930
|
DataField.DefaultOptions,
|
876
931
|
{
|
@@ -887,40 +942,97 @@ declare namespace SchemaField {
|
|
887
942
|
*/
|
888
943
|
type MergedOptions<Fields extends DataSchema, Opts extends Options<Fields>> = SimpleMerge<DefaultOptions, Opts>;
|
889
944
|
|
890
|
-
//
|
945
|
+
// These exist for calculating the type of schema field with options.
|
946
|
+
// This will be deleted once fields are refactored.
|
947
|
+
// The names are also confusing. Hence these it's put into `Internal.
|
948
|
+
namespace Internal {
|
949
|
+
// FIXME: null or undefined should be permissible, cast as the initialized type
|
950
|
+
/**
|
951
|
+
* A shorthand for the assignment type of a SchemaField class.
|
952
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
953
|
+
* @typeParam Opts - the options that override the default options
|
954
|
+
*/
|
955
|
+
type AssignmentType<
|
956
|
+
Fields extends DataSchema,
|
957
|
+
Opts extends Options<Fields> = DefaultOptions,
|
958
|
+
> = DataField.DerivedAssignmentType<AssignmentData<Fields>, MergedOptions<Fields, Opts>>;
|
959
|
+
|
960
|
+
/**
|
961
|
+
* A shorthand for the assignment type of a SchemaField class.
|
962
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
963
|
+
* @typeParam Opts - the options that override the default options
|
964
|
+
*/
|
965
|
+
type InitializedType<
|
966
|
+
Fields extends DataSchema,
|
967
|
+
Opts extends Options<Fields> = DefaultOptions,
|
968
|
+
> = DataField.DerivedInitializedType<InitializedData<Fields>, MergedOptions<Fields, Opts>>;
|
969
|
+
|
970
|
+
/**
|
971
|
+
* A shorthand for the assignment type of a SchemaField class.
|
972
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
973
|
+
* @typeParam Opts - the options that override the default options
|
974
|
+
*/
|
975
|
+
type PersistedType<
|
976
|
+
Fields extends DataSchema,
|
977
|
+
Opts extends Options<Fields> = DefaultOptions,
|
978
|
+
> = DataField.DerivedInitializedType<SourceData<Fields>, MergedOptions<Fields, Opts>>;
|
979
|
+
}
|
980
|
+
|
891
981
|
/**
|
892
|
-
*
|
893
|
-
* @
|
894
|
-
* @typeParam Opts - the options that override the default options
|
982
|
+
* This is deprecated because of likely confusion between `SchemaField.AssignmentData` and `SchemaField.AssignmentType`.
|
983
|
+
* @deprecated {@link SchemaField.Internal.AssignmentType | `SchemaField.Internal.AssignmentType`}
|
895
984
|
*/
|
896
985
|
type AssignmentType<
|
897
986
|
Fields extends DataSchema,
|
898
987
|
Opts extends Options<Fields> = DefaultOptions,
|
899
|
-
> =
|
988
|
+
> = Internal.AssignmentType<Fields, Opts>;
|
900
989
|
|
901
990
|
/**
|
902
|
-
*
|
903
|
-
* @
|
904
|
-
* @typeParam Opts - the options that override the default options
|
991
|
+
* This is deprecated because of likely confusion between `SchemaField.InitializedData` and `SchemaField.InitializedType`.
|
992
|
+
* @deprecated {@link SchemaField.Internal.InitializedType | `SchemaField.Internal.InitializedType`}
|
905
993
|
*/
|
906
994
|
type InitializedType<
|
907
995
|
Fields extends DataSchema,
|
908
996
|
Opts extends Options<Fields> = DefaultOptions,
|
909
|
-
> =
|
997
|
+
> = Internal.InitializedType<Fields, Opts>;
|
910
998
|
|
911
999
|
/**
|
912
|
-
*
|
913
|
-
* @
|
914
|
-
* @typeParam Opts - the options that override the default options
|
1000
|
+
* This is deprecated because of likely confusion between `SchemaField.PersistedData` and `SchemaField.PersistedType`.
|
1001
|
+
* @deprecated {@link SchemaField.Internal.PersistedType | `SchemaField.Internal.PersistedType`}
|
915
1002
|
*/
|
916
|
-
type PersistedType<
|
917
|
-
Fields
|
918
|
-
Opts
|
919
|
-
|
1003
|
+
type PersistedType<Fields extends DataSchema, Opts extends Options<Fields> = DefaultOptions> = Internal.PersistedType<
|
1004
|
+
Fields,
|
1005
|
+
Opts
|
1006
|
+
>;
|
1007
|
+
|
1008
|
+
/**
|
1009
|
+
* @deprecated {@link SchemaField.CreateData | `SchemaField.CreateData`}
|
1010
|
+
*/
|
1011
|
+
type InnerConstructorType<Fields extends DataSchema> = CreateData<Fields>;
|
1012
|
+
|
1013
|
+
/**
|
1014
|
+
* @deprecated {@link SchemaField.AssignmentData | `SchemaField.AssignmentData`}
|
1015
|
+
*/
|
1016
|
+
type InnerAssignmentType<Fields extends DataSchema> = AssignmentData<Fields>;
|
1017
|
+
|
1018
|
+
/**
|
1019
|
+
* @deprecated {@link SchemaField.InitializedData | `SchemaField.InitializedData`}
|
1020
|
+
*/
|
1021
|
+
type InnerInitializedType<Fields extends DataSchema> = InitializedData<Fields>;
|
1022
|
+
|
1023
|
+
/**
|
1024
|
+
* @deprecated {@link SchemaField.UpdateData | `SchemaField.UpdateData`}
|
1025
|
+
*/
|
1026
|
+
type InnerUpdateData<Fields extends DataSchema> = UpdateData<Fields>;
|
1027
|
+
|
1028
|
+
/**
|
1029
|
+
* @deprecated {@link SchemaField.SourceData | `SchemaField.SourceData`}
|
1030
|
+
*/
|
1031
|
+
type InnerPersistedType<Fields extends DataSchema> = SourceData<Fields>;
|
920
1032
|
}
|
921
1033
|
|
922
1034
|
/**
|
923
|
-
* A subclass of
|
1035
|
+
* A subclass of {@link DataField | `DataField`} which deals with boolean-typed data.
|
924
1036
|
* @typeParam Options - the options of the BooleanField instance
|
925
1037
|
* @typeParam AssignmentType - the type of the allowed assignment values of the BooleanField
|
926
1038
|
* @typeParam InitializedType - the type of the initialized values of the BooleanField
|
@@ -947,7 +1059,7 @@ declare class BooleanField<
|
|
947
1059
|
override nullable: boolean;
|
948
1060
|
|
949
1061
|
/** @defaultValue `false` */
|
950
|
-
override initial:
|
1062
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
951
1063
|
|
952
1064
|
protected static override get _defaults(): BooleanField.Options;
|
953
1065
|
|
@@ -963,9 +1075,9 @@ declare class BooleanField<
|
|
963
1075
|
|
964
1076
|
declare namespace BooleanField {
|
965
1077
|
/** A shorthand for the options of a BooleanField class. */
|
966
|
-
type Options =
|
1078
|
+
type Options = DataField.Options<boolean>;
|
967
1079
|
|
968
|
-
/** The type of the default options for the {@link BooleanField} class. */
|
1080
|
+
/** The type of the default options for the {@link BooleanField | `BooleanField`} class. */
|
969
1081
|
type DefaultOptions = SimpleMerge<
|
970
1082
|
DataField.DefaultOptions,
|
971
1083
|
{
|
@@ -994,50 +1106,8 @@ declare namespace BooleanField {
|
|
994
1106
|
type InitializedType<Opts extends Options> = DataField.DerivedInitializedType<boolean, MergedOptions<Opts>>;
|
995
1107
|
}
|
996
1108
|
|
997
|
-
declare global {
|
998
|
-
interface NumberFieldOptions extends DataFieldOptions<number> {
|
999
|
-
/**
|
1000
|
-
* A minimum allowed value
|
1001
|
-
* @defaultValue `undefined`
|
1002
|
-
*/
|
1003
|
-
min?: number | undefined;
|
1004
|
-
|
1005
|
-
/**
|
1006
|
-
* A maximum allowed value
|
1007
|
-
* @defaultValue `undefined`
|
1008
|
-
*/
|
1009
|
-
max?: number | undefined;
|
1010
|
-
|
1011
|
-
/**
|
1012
|
-
* A permitted step size
|
1013
|
-
* @defaultValue `undefined`
|
1014
|
-
*/
|
1015
|
-
step?: number | undefined;
|
1016
|
-
|
1017
|
-
/**
|
1018
|
-
* Must the number be an integer?
|
1019
|
-
* @defaultValue `false`
|
1020
|
-
*/
|
1021
|
-
integer?: boolean | undefined;
|
1022
|
-
|
1023
|
-
/**
|
1024
|
-
* Must the number be positive?
|
1025
|
-
* @defaultValue `false`
|
1026
|
-
*/
|
1027
|
-
positive?: boolean | undefined;
|
1028
|
-
|
1029
|
-
/**
|
1030
|
-
* An array of values or an object of values/labels which represent
|
1031
|
-
* allowed choices for the field. A function may be provided which dynamically
|
1032
|
-
* returns the array of choices.
|
1033
|
-
* @defaultValue `undefined`
|
1034
|
-
*/
|
1035
|
-
choices?: NumberField.Choices | undefined;
|
1036
|
-
}
|
1037
|
-
}
|
1038
|
-
|
1039
1109
|
/**
|
1040
|
-
* A subclass of
|
1110
|
+
* A subclass of {@link DataField | `DataField`} which deals with number-typed data.
|
1041
1111
|
* @typeParam Options - the options of the NumberField instance
|
1042
1112
|
* @typeParam AssignmentType - the type of the allowed assignment values of the NumberField
|
1043
1113
|
* @typeParam InitializedType - the type of the initialized values of the NumberField
|
@@ -1050,7 +1120,7 @@ declare global {
|
|
1050
1120
|
* InitialValue: `null`
|
1051
1121
|
*/
|
1052
1122
|
declare class NumberField<
|
1053
|
-
const Options extends
|
1123
|
+
const Options extends NumberField.Options = NumberField.DefaultOptions,
|
1054
1124
|
const AssignmentType = NumberField.AssignmentType<Options>,
|
1055
1125
|
const InitializedType = NumberField.InitializedType<Options>,
|
1056
1126
|
const PersistedType extends number | null | undefined = NumberField.InitializedType<Options>,
|
@@ -1061,7 +1131,7 @@ declare class NumberField<
|
|
1061
1131
|
constructor(options?: Options, context?: DataField.Context);
|
1062
1132
|
|
1063
1133
|
/** @defaultValue `null` */
|
1064
|
-
override initial:
|
1134
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
1065
1135
|
|
1066
1136
|
/** @defaultValue `true` */
|
1067
1137
|
override nullable: boolean;
|
@@ -1104,7 +1174,7 @@ declare class NumberField<
|
|
1104
1174
|
*/
|
1105
1175
|
choices: number[] | Record<number, string> | (() => number[] | Record<number, string>) | undefined;
|
1106
1176
|
|
1107
|
-
protected static override get _defaults():
|
1177
|
+
protected static override get _defaults(): NumberField.Options;
|
1108
1178
|
|
1109
1179
|
protected override _cast(value: AssignmentType): InitializedType;
|
1110
1180
|
|
@@ -1155,7 +1225,7 @@ declare class NumberField<
|
|
1155
1225
|
}
|
1156
1226
|
|
1157
1227
|
declare namespace NumberField {
|
1158
|
-
/** The type of the default options for the {@link NumberField} class. */
|
1228
|
+
/** The type of the default options for the {@link NumberField | `NumberField`} class. */
|
1159
1229
|
type DefaultOptions = SimpleMerge<
|
1160
1230
|
DataField.DefaultOptions,
|
1161
1231
|
{
|
@@ -1170,14 +1240,54 @@ declare namespace NumberField {
|
|
1170
1240
|
}
|
1171
1241
|
>;
|
1172
1242
|
|
1173
|
-
|
1243
|
+
interface Options extends DataField.Options<number> {
|
1244
|
+
/**
|
1245
|
+
* A minimum allowed value
|
1246
|
+
* @defaultValue `undefined`
|
1247
|
+
*/
|
1248
|
+
min?: number | undefined;
|
1249
|
+
|
1250
|
+
/**
|
1251
|
+
* A maximum allowed value
|
1252
|
+
* @defaultValue `undefined`
|
1253
|
+
*/
|
1254
|
+
max?: number | undefined;
|
1255
|
+
|
1256
|
+
/**
|
1257
|
+
* A permitted step size
|
1258
|
+
* @defaultValue `undefined`
|
1259
|
+
*/
|
1260
|
+
step?: number | undefined;
|
1261
|
+
|
1262
|
+
/**
|
1263
|
+
* Must the number be an integer?
|
1264
|
+
* @defaultValue `false`
|
1265
|
+
*/
|
1266
|
+
integer?: boolean | undefined;
|
1267
|
+
|
1268
|
+
/**
|
1269
|
+
* Must the number be positive?
|
1270
|
+
* @defaultValue `false`
|
1271
|
+
*/
|
1272
|
+
positive?: boolean | undefined;
|
1273
|
+
|
1274
|
+
/**
|
1275
|
+
* An array of values or an object of values/labels which represent
|
1276
|
+
* allowed choices for the field. A function may be provided which dynamically
|
1277
|
+
* returns the array of choices.
|
1278
|
+
* @defaultValue `undefined`
|
1279
|
+
*/
|
1280
|
+
choices?: NumberField.Choices | undefined;
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
/** The type of the default options for the {@link NumberField | `NumberField`} class when choices are provided. */
|
1174
1284
|
type DefaultOptionsWhenChoicesProvided = SimpleMerge<DefaultOptions, { nullable: false }>;
|
1175
1285
|
|
1176
1286
|
/**
|
1177
1287
|
* A helper type for the given options type merged into the default options of the NumberField class.
|
1178
1288
|
* @typeParam Options - the options that override the default options
|
1179
1289
|
*/
|
1180
|
-
type MergedOptions<Options extends
|
1290
|
+
type MergedOptions<Options extends NumberField.Options> = SimpleMerge<
|
1181
1291
|
undefined extends Options["choices"] ? DefaultOptions : DefaultOptionsWhenChoicesProvided,
|
1182
1292
|
Options
|
1183
1293
|
>;
|
@@ -1186,7 +1296,7 @@ declare namespace NumberField {
|
|
1186
1296
|
* A shorthand for the assignment type of a NumberField class.
|
1187
1297
|
* @typeParam Options - the options that override the default options
|
1188
1298
|
*/
|
1189
|
-
type AssignmentType<Options extends
|
1299
|
+
type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
|
1190
1300
|
number,
|
1191
1301
|
MergedOptions<Options>
|
1192
1302
|
>;
|
@@ -1195,7 +1305,7 @@ declare namespace NumberField {
|
|
1195
1305
|
* A shorthand for the initialized type of a NumberField class.
|
1196
1306
|
* @typeParam Options - the options that override the default options
|
1197
1307
|
*/
|
1198
|
-
type InitializedType<Options extends
|
1308
|
+
type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
|
1199
1309
|
number,
|
1200
1310
|
MergedOptions<Options>
|
1201
1311
|
>;
|
@@ -1231,37 +1341,8 @@ declare namespace NumberField {
|
|
1231
1341
|
| ToInputConfigWithOptions<InitializedType>;
|
1232
1342
|
}
|
1233
1343
|
|
1234
|
-
declare global {
|
1235
|
-
interface StringFieldOptions extends DataFieldOptions<string> {
|
1236
|
-
/**
|
1237
|
-
* Is the string allowed to be blank (empty)?
|
1238
|
-
* @defaultValue `true`
|
1239
|
-
*/
|
1240
|
-
blank?: boolean | undefined;
|
1241
|
-
|
1242
|
-
/**
|
1243
|
-
* Should any provided string be trimmed as part of cleaning?
|
1244
|
-
* @defaultValue `true`
|
1245
|
-
*/
|
1246
|
-
trim?: boolean | undefined;
|
1247
|
-
|
1248
|
-
/**
|
1249
|
-
* An array of values or an object of values/labels which represent
|
1250
|
-
* allowed choices for the field. A function may be provided which dynamically
|
1251
|
-
* returns the array of choices.
|
1252
|
-
* @defaultValue `undefined`
|
1253
|
-
*/
|
1254
|
-
choices?: StringField.Choices | undefined;
|
1255
|
-
|
1256
|
-
/**
|
1257
|
-
* @defaultValue `false`
|
1258
|
-
*/
|
1259
|
-
textSearch?: boolean | undefined;
|
1260
|
-
}
|
1261
|
-
}
|
1262
|
-
|
1263
1344
|
/**
|
1264
|
-
* A subclass of
|
1345
|
+
* A subclass of {@link DataField | `DataField`} which deals with string-typed data.
|
1265
1346
|
* @typeParam Options - the options of the StringField instance
|
1266
1347
|
* @typeParam AssignmentType - the type of the allowed assignment values of the StringField
|
1267
1348
|
* @typeParam InitializedType - the type of the initialized values of the StringField
|
@@ -1274,7 +1355,7 @@ declare global {
|
|
1274
1355
|
* InitialValue: `""`
|
1275
1356
|
*/
|
1276
1357
|
declare class StringField<
|
1277
|
-
const Options extends
|
1358
|
+
const Options extends StringField.Options<unknown> = StringField.DefaultOptions,
|
1278
1359
|
const AssignmentType = StringField.AssignmentType<Options>,
|
1279
1360
|
const InitializedType = StringField.InitializedType<Options>,
|
1280
1361
|
const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
|
@@ -1285,7 +1366,7 @@ declare class StringField<
|
|
1285
1366
|
constructor(options?: Options, context?: DataField.Context);
|
1286
1367
|
|
1287
1368
|
/** @defaultValue `undefined` */
|
1288
|
-
override initial:
|
1369
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
1289
1370
|
|
1290
1371
|
/**
|
1291
1372
|
* Is the string allowed to be blank (empty)?
|
@@ -1313,7 +1394,7 @@ declare class StringField<
|
|
1313
1394
|
/** @defaultValue `false` */
|
1314
1395
|
textSearch: boolean;
|
1315
1396
|
|
1316
|
-
protected static override get _defaults():
|
1397
|
+
protected static override get _defaults(): StringField.Options<unknown>;
|
1317
1398
|
|
1318
1399
|
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
1319
1400
|
|
@@ -1364,7 +1445,7 @@ declare class StringField<
|
|
1364
1445
|
}
|
1365
1446
|
|
1366
1447
|
declare namespace StringField {
|
1367
|
-
/** The type of the default options for the {@link StringField} class. */
|
1448
|
+
/** The type of the default options for the {@link StringField | `StringField`} class. */
|
1368
1449
|
type DefaultOptions = SimpleMerge<
|
1369
1450
|
DataField.DefaultOptions,
|
1370
1451
|
{
|
@@ -1376,28 +1457,55 @@ declare namespace StringField {
|
|
1376
1457
|
}
|
1377
1458
|
>;
|
1378
1459
|
|
1379
|
-
|
1460
|
+
interface Options<Type = string> extends DataField.Options<Type> {
|
1461
|
+
/**
|
1462
|
+
* Is the string allowed to be blank (empty)?
|
1463
|
+
* @defaultValue `true`
|
1464
|
+
*/
|
1465
|
+
blank?: boolean | undefined;
|
1466
|
+
|
1467
|
+
/**
|
1468
|
+
* Should any provided string be trimmed as part of cleaning?
|
1469
|
+
* @defaultValue `true`
|
1470
|
+
*/
|
1471
|
+
trim?: boolean | undefined;
|
1472
|
+
|
1473
|
+
/**
|
1474
|
+
* An array of values or an object of values/labels which represent
|
1475
|
+
* allowed choices for the field. A function may be provided which dynamically
|
1476
|
+
* returns the array of choices.
|
1477
|
+
* @defaultValue `undefined`
|
1478
|
+
*/
|
1479
|
+
choices?: StringField.Choices | undefined;
|
1480
|
+
|
1481
|
+
/**
|
1482
|
+
* @defaultValue `false`
|
1483
|
+
*/
|
1484
|
+
textSearch?: boolean | undefined;
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
/** The type of the default options for the {@link StringField | `StringField`} class when choices are provided. */
|
1380
1488
|
type DefaultOptionsWhenChoicesProvided = SimpleMerge<DefaultOptions, { nullable: false; blank: false }>;
|
1381
1489
|
|
1382
1490
|
/**
|
1383
1491
|
* A helper type for the given options type merged into the default options of the StringField class.
|
1384
1492
|
* @typeParam Options - the options that override the default options
|
1385
1493
|
*/
|
1386
|
-
type MergedOptions<Options extends
|
1494
|
+
type MergedOptions<Options extends StringField.Options<unknown>> = SimpleMerge<
|
1387
1495
|
_OptionsForInitial<_OptionsForChoices<Options["choices"]>>,
|
1388
1496
|
Options
|
1389
1497
|
>;
|
1390
1498
|
|
1391
|
-
type _OptionsForChoices<Choices extends
|
1499
|
+
type _OptionsForChoices<Choices extends StringField.Options["choices"]> = undefined extends Choices
|
1392
1500
|
? DefaultOptions
|
1393
1501
|
: DefaultOptionsWhenChoicesProvided;
|
1394
1502
|
|
1395
1503
|
// FIXME: `"initial" extends keyof Options` does not work for modeling `"initial" in options`.
|
1396
|
-
type _OptionsForInitial<Options extends
|
1504
|
+
type _OptionsForInitial<Options extends StringField.Options<unknown>> = "initial" extends keyof Options
|
1397
1505
|
? Options
|
1398
1506
|
: SimpleMerge<Options, { initial: _InitialForOptions<Options> }>;
|
1399
1507
|
|
1400
|
-
type _InitialForOptions<Options extends
|
1508
|
+
type _InitialForOptions<Options extends StringField.Options<unknown>> = Options["required"] extends false | undefined
|
1401
1509
|
? undefined
|
1402
1510
|
: Options["blank"] extends true
|
1403
1511
|
? string
|
@@ -1407,19 +1515,24 @@ declare namespace StringField {
|
|
1407
1515
|
|
1408
1516
|
// choices?: string[] | Record<string, string> | (() => string[] | Record<string, string>) | undefined;
|
1409
1517
|
|
1410
|
-
type ValidChoice<Options extends
|
1518
|
+
type ValidChoice<Options extends StringField.Options<unknown>> = Options["choices"] extends undefined
|
1411
1519
|
? string
|
1412
|
-
: Options["choices"] extends (...args:
|
1520
|
+
: Options["choices"] extends (...args: infer _1) => infer Choices
|
1413
1521
|
? FixedChoice<Choices>
|
1414
1522
|
: FixedChoice<Options["choices"]>;
|
1415
1523
|
|
1416
|
-
type FixedChoice<Choices> =
|
1524
|
+
type FixedChoice<Choices> =
|
1525
|
+
Choices extends ReadonlyArray<infer U>
|
1526
|
+
? U
|
1527
|
+
: Choices extends { readonly [_ in infer K]: infer _1 }
|
1528
|
+
? K & string
|
1529
|
+
: string;
|
1417
1530
|
|
1418
1531
|
/**
|
1419
1532
|
* A shorthand for the assignment type of a StringField class.
|
1420
1533
|
* @typeParam Options - the options that override the default options
|
1421
1534
|
*/
|
1422
|
-
type AssignmentType<Options extends
|
1535
|
+
type AssignmentType<Options extends StringField.Options<unknown>> = DataField.DerivedAssignmentType<
|
1423
1536
|
ValidChoice<Options>,
|
1424
1537
|
MergedOptions<Options>
|
1425
1538
|
>;
|
@@ -1428,7 +1541,7 @@ declare namespace StringField {
|
|
1428
1541
|
* A shorthand for the initialized type of a StringField class.
|
1429
1542
|
* @typeParam Options - the options that override the default options
|
1430
1543
|
*/
|
1431
|
-
type InitializedType<Options extends
|
1544
|
+
type InitializedType<Options extends StringField.Options<unknown>> = DataField.DerivedInitializedType<
|
1432
1545
|
// TODO(LukeAbby): This is a workaround for how `ValidChoice` is defined ignorant of the `StringField`/`NumberField` divide.
|
1433
1546
|
ValidChoice<Options> & (string | null | undefined),
|
1434
1547
|
MergedOptions<Options>
|
@@ -1470,7 +1583,7 @@ declare namespace StringField {
|
|
1470
1583
|
}
|
1471
1584
|
|
1472
1585
|
/**
|
1473
|
-
* A subclass of
|
1586
|
+
* A subclass of {@link DataField | `DataField`} which deals with object-typed data.
|
1474
1587
|
* @typeParam Options - the options of the ObjectField instance
|
1475
1588
|
* @typeParam AssignmentType - the type of the allowed assignment values of the ObjectField
|
1476
1589
|
* @typeParam InitializedType - the type of the initialized values of the ObjectField
|
@@ -1483,7 +1596,7 @@ declare namespace StringField {
|
|
1483
1596
|
* InitialValue: `{}`
|
1484
1597
|
*/
|
1485
1598
|
declare class ObjectField<
|
1486
|
-
const Options extends
|
1599
|
+
const Options extends DataField.Options<AnyObject> = ObjectField.DefaultOptions,
|
1487
1600
|
const AssignmentType = ObjectField.AssignmentType<Options>,
|
1488
1601
|
const InitializedType = ObjectField.InitializedType<Options>,
|
1489
1602
|
const PersistedType extends AnyObject | null | undefined = ObjectField.InitializedType<Options>,
|
@@ -1495,9 +1608,9 @@ declare class ObjectField<
|
|
1495
1608
|
override nullable: boolean;
|
1496
1609
|
|
1497
1610
|
/** @defaultValue `() => ({})` */
|
1498
|
-
override initial:
|
1611
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
1499
1612
|
|
1500
|
-
protected static override get _defaults():
|
1613
|
+
protected static override get _defaults(): DataField.Options<AnyObject>;
|
1501
1614
|
|
1502
1615
|
protected override _cast(value: AssignmentType): InitializedType;
|
1503
1616
|
|
@@ -1516,7 +1629,7 @@ declare class ObjectField<
|
|
1516
1629
|
}
|
1517
1630
|
|
1518
1631
|
declare namespace ObjectField {
|
1519
|
-
/** The type of the default options for the {@link ObjectField} class. */
|
1632
|
+
/** The type of the default options for the {@link ObjectField | `ObjectField`} class. */
|
1520
1633
|
type DefaultOptions = SimpleMerge<
|
1521
1634
|
DataField.DefaultOptions,
|
1522
1635
|
{
|
@@ -1529,13 +1642,13 @@ declare namespace ObjectField {
|
|
1529
1642
|
* A helper type for the given options type merged into the default options of the ObjectField class.
|
1530
1643
|
* @typeParam Options - the options that override the default options
|
1531
1644
|
*/
|
1532
|
-
type MergedOptions<Options extends
|
1645
|
+
type MergedOptions<Options extends DataField.Options<AnyObject>> = SimpleMerge<DefaultOptions, Options>;
|
1533
1646
|
|
1534
1647
|
/**
|
1535
1648
|
* A shorthand for the assignment type of a ObjectField class.
|
1536
1649
|
* @typeParam Options - the options that override the default options
|
1537
1650
|
*/
|
1538
|
-
type AssignmentType<Options extends
|
1651
|
+
type AssignmentType<Options extends DataField.Options<AnyObject>> = DataField.DerivedAssignmentType<
|
1539
1652
|
AnyObject,
|
1540
1653
|
MergedOptions<Options>
|
1541
1654
|
>;
|
@@ -1544,13 +1657,13 @@ declare namespace ObjectField {
|
|
1544
1657
|
* A shorthand for the initialized type of a ObjectField class.
|
1545
1658
|
* @typeParam Options - the options that override the default options
|
1546
1659
|
*/
|
1547
|
-
type InitializedType<Options extends
|
1660
|
+
type InitializedType<Options extends DataField.Options<AnyObject>> = DataField.DerivedInitializedType<
|
1548
1661
|
AnyObject,
|
1549
1662
|
MergedOptions<Options>
|
1550
1663
|
>;
|
1551
1664
|
|
1552
1665
|
/**
|
1553
|
-
* A helper to create a flags object field for the given key in the {@link FlagConfig}.
|
1666
|
+
* A helper to create a flags object field for the given key in the {@link FlagConfig | `FlagConfig`}.
|
1554
1667
|
* @typeParam Key - the key to look for in the FlagConfig
|
1555
1668
|
* @typeParam ExtensionFlags - additional flags besides the ones configured for the class
|
1556
1669
|
* @typeParam Options - the options of the field
|
@@ -1560,17 +1673,26 @@ declare namespace ObjectField {
|
|
1560
1673
|
// The type `{}` is useful here because in an intersection it reduces down to nothing unlike `EmptyObject`.
|
1561
1674
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
1562
1675
|
ExtensionFlags extends AnyObject = {},
|
1563
|
-
Options extends
|
1676
|
+
Options extends DataField.Options.Any = ObjectField.DefaultOptions,
|
1564
1677
|
> = ObjectField<
|
1565
1678
|
Options,
|
1566
|
-
DataField.DerivedAssignmentType<
|
1567
|
-
|
1568
|
-
|
1679
|
+
DataField.DerivedAssignmentType<
|
1680
|
+
Document.ConfiguredFlagsForName<Name> & ExtensionFlags & InterfaceToObject<Document.CoreFlags>,
|
1681
|
+
MergedOptions<Options>
|
1682
|
+
>,
|
1683
|
+
DataField.DerivedInitializedType<
|
1684
|
+
Document.ConfiguredFlagsForName<Name> & ExtensionFlags & InterfaceToObject<Document.CoreFlags>,
|
1685
|
+
MergedOptions<Options>
|
1686
|
+
>,
|
1687
|
+
DataField.DerivedInitializedType<
|
1688
|
+
Document.ConfiguredFlagsForName<Name> & ExtensionFlags & InterfaceToObject<Document.CoreFlags>,
|
1689
|
+
MergedOptions<Options>
|
1690
|
+
>
|
1569
1691
|
>;
|
1570
1692
|
}
|
1571
1693
|
|
1572
1694
|
/**
|
1573
|
-
* A subclass of
|
1695
|
+
* A subclass of {@link DataField | `DataField`} which deals with array-typed data.
|
1574
1696
|
* @typeParam ElementFieldType - the field type for the elements in the ArrayField
|
1575
1697
|
* @typeParam AssignmentElementType - the assignment type for the elements in the array
|
1576
1698
|
* @typeParam InitializedElementType - the initialized type for the elements in the array
|
@@ -1615,7 +1737,7 @@ declare class ArrayField<
|
|
1615
1737
|
override nullable: boolean;
|
1616
1738
|
|
1617
1739
|
/** @defaultValue `() => []` */
|
1618
|
-
override initial:
|
1740
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
1619
1741
|
|
1620
1742
|
/**
|
1621
1743
|
* The data type of each element in this array
|
@@ -1655,7 +1777,7 @@ declare class ArrayField<
|
|
1655
1777
|
* @returns An array of element-specific errors
|
1656
1778
|
*/
|
1657
1779
|
protected _validateElements(
|
1658
|
-
value:
|
1780
|
+
value: AnyArray,
|
1659
1781
|
options?: DataField.ValidationOptions<DataField.Any>,
|
1660
1782
|
): DataModelValidationFailure | void;
|
1661
1783
|
|
@@ -1666,7 +1788,7 @@ declare class ArrayField<
|
|
1666
1788
|
* @returns A validation failure if the element failed validation
|
1667
1789
|
*/
|
1668
1790
|
protected _validateElement(
|
1669
|
-
value:
|
1791
|
+
value: unknown,
|
1670
1792
|
options: DataField.ValidationOptions<DataField.Any>,
|
1671
1793
|
): DataModelValidationFailure | void;
|
1672
1794
|
|
@@ -1700,12 +1822,12 @@ declare namespace ArrayField {
|
|
1700
1822
|
* A shorthand for the options of an ArrayField class.
|
1701
1823
|
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1702
1824
|
*/
|
1703
|
-
type Options<AssignmentElementType> =
|
1825
|
+
type Options<AssignmentElementType> = DataField.Options<BaseAssignmentType<AssignmentElementType>>;
|
1704
1826
|
|
1705
1827
|
type AnyOptions = Options<unknown>;
|
1706
1828
|
|
1707
1829
|
/**
|
1708
|
-
* The base assignment type for the {@link ArrayField} class.
|
1830
|
+
* The base assignment type for the {@link ArrayField | `ArrayField`} class.
|
1709
1831
|
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1710
1832
|
*/
|
1711
1833
|
type BaseAssignmentType<AssignmentElementType> =
|
@@ -1715,7 +1837,7 @@ declare namespace ArrayField {
|
|
1715
1837
|
| AssignmentElementType;
|
1716
1838
|
|
1717
1839
|
/**
|
1718
|
-
* The type of the default options for the {@link ArrayField} class.
|
1840
|
+
* The type of the default options for the {@link ArrayField | `ArrayField`} class.
|
1719
1841
|
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1720
1842
|
*/
|
1721
1843
|
type DefaultOptions<AssignmentElementType> = SimpleMerge<
|
@@ -1742,33 +1864,33 @@ declare namespace ArrayField {
|
|
1742
1864
|
* @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
|
1743
1865
|
*/
|
1744
1866
|
type AssignmentElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
|
1745
|
-
ElementFieldType extends
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1867
|
+
ElementFieldType extends
|
1868
|
+
| (abstract new (...args: infer _1) => { " __fvtt_types_internal_assignment_data": infer AssignmentData })
|
1869
|
+
| { " __fvtt_types_internal_assignment_data": infer AssignmentData }
|
1870
|
+
? AssignmentData
|
1871
|
+
: never;
|
1750
1872
|
|
1751
1873
|
/**
|
1752
1874
|
* A type to infer the initialized element type of an ArrayField from its ElementFieldType.
|
1753
1875
|
* @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
|
1754
1876
|
*/
|
1755
1877
|
type InitializedElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
|
1756
|
-
ElementFieldType extends
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1878
|
+
ElementFieldType extends
|
1879
|
+
| (abstract new (...args: infer _1) => { " __fvtt_types_internal_initialized_data": infer InitializedData })
|
1880
|
+
| { " __fvtt_types_internal_initialized_data": infer InitializedData }
|
1881
|
+
? InitializedData
|
1882
|
+
: never;
|
1761
1883
|
|
1762
1884
|
/**
|
1763
1885
|
* A type to infer the initialized element type of an ArrayField from its ElementFieldType.
|
1764
1886
|
* @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
|
1765
1887
|
*/
|
1766
1888
|
type PersistedElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
|
1767
|
-
ElementFieldType extends
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1889
|
+
ElementFieldType extends
|
1890
|
+
| (abstract new (...args: infer _1) => { " __fvtt_types_internal_source_data": infer PersistedData })
|
1891
|
+
| { " __fvtt_types_internal_source_data": infer PersistedData }
|
1892
|
+
? PersistedData
|
1893
|
+
: never;
|
1772
1894
|
|
1773
1895
|
/**
|
1774
1896
|
* A shorthand for the assignment type of an ArrayField class.
|
@@ -1795,7 +1917,7 @@ declare namespace ArrayField {
|
|
1795
1917
|
/**
|
1796
1918
|
* A shorthand for the persisted type of an ArrayField class.
|
1797
1919
|
* @typeParam AssignmentElementType - the assignment type of the elements of the ArrayField
|
1798
|
-
* @typeParam PersistedElementType - the
|
1920
|
+
* @typeParam PersistedElementType - the persisted type of the elements of the ArrayField
|
1799
1921
|
* @typeParam Opts - the options that override the default options
|
1800
1922
|
*/
|
1801
1923
|
type PersistedType<
|
@@ -1806,7 +1928,7 @@ declare namespace ArrayField {
|
|
1806
1928
|
}
|
1807
1929
|
|
1808
1930
|
/**
|
1809
|
-
* A subclass of
|
1931
|
+
* A subclass of {@link ArrayField | `ArrayField`} which supports a set of contained elements.
|
1810
1932
|
* Elements in this set are treated as fungible and may be represented in any order or discarded if invalid.
|
1811
1933
|
* @typeParam ElementFieldType - the field type for the elements in the SetField
|
1812
1934
|
* @typeParam AssignmentElementType - the assignment type for the elements in the set
|
@@ -1873,24 +1995,24 @@ declare class SetField<
|
|
1873
1995
|
|
1874
1996
|
declare namespace SetField {
|
1875
1997
|
/** Any SetField */
|
1876
|
-
|
1998
|
+
interface Any extends SetField<DataField.Any, any, any, any, any, any, any, any> {}
|
1877
1999
|
|
1878
2000
|
/**
|
1879
2001
|
* A shorthand for the options of a SetField class.
|
1880
2002
|
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1881
2003
|
*/
|
1882
|
-
type Options<AssignmentElementType> =
|
2004
|
+
type Options<AssignmentElementType> = DataField.Options<SetField.BaseAssignmentType<AssignmentElementType>>;
|
1883
2005
|
|
1884
2006
|
type AnyOptions = Options<unknown>;
|
1885
2007
|
|
1886
2008
|
/**
|
1887
|
-
* The base assignment type for the {@link SetField} class.
|
2009
|
+
* The base assignment type for the {@link SetField | `SetField`} class.
|
1888
2010
|
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1889
2011
|
*/
|
1890
2012
|
type BaseAssignmentType<AssignmentElementType> = ArrayField.BaseAssignmentType<AssignmentElementType>;
|
1891
2013
|
|
1892
2014
|
/**
|
1893
|
-
* The type of the default options for the {@link SetField} class.
|
2015
|
+
* The type of the default options for the {@link SetField | `SetField`} class.
|
1894
2016
|
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1895
2017
|
*/
|
1896
2018
|
type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
|
@@ -1930,7 +2052,7 @@ declare namespace SetField {
|
|
1930
2052
|
/**
|
1931
2053
|
* A shorthand for the persisted type of a SetField class.
|
1932
2054
|
* @typeParam AssignmentElementType - the assignment type of the elements of the SetField
|
1933
|
-
* @typeParam PersistedElementType - the
|
2055
|
+
* @typeParam PersistedElementType - the persisted type of the elements of the SetField
|
1934
2056
|
* @typeParam Opts - the options that override the default options
|
1935
2057
|
*/
|
1936
2058
|
type PersistedType<
|
@@ -1949,7 +2071,7 @@ declare namespace SetField {
|
|
1949
2071
|
}
|
1950
2072
|
|
1951
2073
|
/**
|
1952
|
-
* A subclass of
|
2074
|
+
* A subclass of {@link ObjectField | `ObjectField`} which embeds some other DataModel definition as an inner object.
|
1953
2075
|
* @typeParam ModelType - the DataModel for the embedded data
|
1954
2076
|
* @typeParam Options - the options of the EmbeddedDataField instance
|
1955
2077
|
* @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedDataField
|
@@ -2005,11 +2127,11 @@ declare namespace EmbeddedDataField {
|
|
2005
2127
|
* A shorthand for the options of an EmbeddedDataField class.
|
2006
2128
|
* @typeParam ModelType - the DataModel for the embedded data
|
2007
2129
|
*/
|
2008
|
-
type Options<ModelType extends DataModel.AnyConstructor> =
|
2009
|
-
SchemaField.
|
2130
|
+
type Options<ModelType extends DataModel.AnyConstructor> = DataField.Options<
|
2131
|
+
SchemaField.AssignmentData<DataModel.SchemaOfClass<ModelType>> | __SchemaFieldInitial
|
2010
2132
|
>;
|
2011
2133
|
|
2012
|
-
/** The type of the default options for the {@link EmbeddedDataField} class. */
|
2134
|
+
/** The type of the default options for the {@link EmbeddedDataField | `EmbeddedDataField`} class. */
|
2013
2135
|
type DefaultOptions = SchemaField.DefaultOptions;
|
2014
2136
|
|
2015
2137
|
/**
|
@@ -2031,7 +2153,7 @@ declare namespace EmbeddedDataField {
|
|
2031
2153
|
ModelType extends DataModel.AnyConstructor,
|
2032
2154
|
Opts extends Options<ModelType>,
|
2033
2155
|
> = DataField.DerivedAssignmentType<
|
2034
|
-
SchemaField.
|
2156
|
+
SchemaField.AssignmentData<DataModel.SchemaOfClass<ModelType>>,
|
2035
2157
|
MergedOptions<ModelType, Opts>
|
2036
2158
|
>;
|
2037
2159
|
|
@@ -2044,7 +2166,7 @@ declare namespace EmbeddedDataField {
|
|
2044
2166
|
type InitializedType<
|
2045
2167
|
ModelType extends DataModel.AnyConstructor,
|
2046
2168
|
Opts extends Options<ModelType>,
|
2047
|
-
> = DataField.DerivedInitializedType<
|
2169
|
+
> = DataField.DerivedInitializedType<FixedInstanceType<ModelType>, MergedOptions<ModelType, Opts>>;
|
2048
2170
|
|
2049
2171
|
/**
|
2050
2172
|
* A shorthand for the persisted type of an EmbeddedDataField class.
|
@@ -2055,13 +2177,13 @@ declare namespace EmbeddedDataField {
|
|
2055
2177
|
ModelType extends DataModel.AnyConstructor,
|
2056
2178
|
Opts extends Options<ModelType>,
|
2057
2179
|
> = DataField.DerivedInitializedType<
|
2058
|
-
SchemaField.
|
2180
|
+
SchemaField.SourceData<DataModel.SchemaOfClass<ModelType>>,
|
2059
2181
|
MergedOptions<ModelType, Opts>
|
2060
2182
|
>;
|
2061
2183
|
}
|
2062
2184
|
|
2063
2185
|
/**
|
2064
|
-
* A subclass of
|
2186
|
+
* A subclass of {@link ArrayField | `ArrayField`} which supports an embedded Document collection.
|
2065
2187
|
* Invalid elements will be dropped from the collection during validation rather than failing for the field entirely.
|
2066
2188
|
* @typeParam ElementFieldType - the field type for the elements in the EmbeddedCollectionField
|
2067
2189
|
* @typeParam AssignmentElementType - the assignment type for the elements in the collection
|
@@ -2175,16 +2297,16 @@ declare class EmbeddedCollectionField<
|
|
2175
2297
|
}
|
2176
2298
|
|
2177
2299
|
declare namespace EmbeddedCollectionField {
|
2178
|
-
|
2300
|
+
interface Any extends EmbeddedCollectionField<any, any, any, any, any, any, any, any, any> {}
|
2179
2301
|
|
2180
2302
|
/**
|
2181
2303
|
* A shorthand for the options of an EmbeddedCollectionField class.
|
2182
2304
|
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2183
2305
|
*/
|
2184
|
-
type Options<AssignmentElementType> =
|
2306
|
+
type Options<AssignmentElementType> = DataField.Options<ArrayField.BaseAssignmentType<AssignmentElementType>>;
|
2185
2307
|
|
2186
2308
|
/**
|
2187
|
-
* The type of the default options for the {@link EmbeddedCollectionField} class.
|
2309
|
+
* The type of the default options for the {@link EmbeddedCollectionField | `EmbeddedCollectionField`} class.
|
2188
2310
|
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2189
2311
|
*/
|
2190
2312
|
type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
|
@@ -2203,10 +2325,11 @@ declare namespace EmbeddedCollectionField {
|
|
2203
2325
|
* A type to infer the assignment element type of an EmbeddedCollectionField from its ElementFieldType.
|
2204
2326
|
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionField
|
2205
2327
|
*/
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2328
|
+
// Note(LukeAbby): For some reason checking `extends Document` causes issues where this doesn't.
|
2329
|
+
type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
|
2330
|
+
...args: infer _1
|
2331
|
+
) => { " __fvtt_types_internal_assignment_data": infer AssignmentData }
|
2332
|
+
? AssignmentData
|
2210
2333
|
: never;
|
2211
2334
|
|
2212
2335
|
/**
|
@@ -2220,10 +2343,11 @@ declare namespace EmbeddedCollectionField {
|
|
2220
2343
|
* A type to infer the initialized element type of an EmbeddedCollectionField from its ElementFieldType.
|
2221
2344
|
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionField
|
2222
2345
|
*/
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2346
|
+
// Note(LukeAbby): For some reason checking `extends Document` causes issues where this doesn't.
|
2347
|
+
type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
|
2348
|
+
...args: infer _1
|
2349
|
+
) => { " __fvtt_types_internal_source_data": infer AssignmentData }
|
2350
|
+
? AssignmentData
|
2227
2351
|
: never;
|
2228
2352
|
|
2229
2353
|
/**
|
@@ -2258,7 +2382,7 @@ declare namespace EmbeddedCollectionField {
|
|
2258
2382
|
/**
|
2259
2383
|
* A shorthand for the persisted type of an ArrayField class.
|
2260
2384
|
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2261
|
-
* @typeParam PersistedElementType - the
|
2385
|
+
* @typeParam PersistedElementType - the persisted type of the elements of the EmbeddedCollectionField
|
2262
2386
|
* @typeParam Opts - the options that override the default options
|
2263
2387
|
*/
|
2264
2388
|
type PersistedType<
|
@@ -2269,7 +2393,7 @@ declare namespace EmbeddedCollectionField {
|
|
2269
2393
|
}
|
2270
2394
|
|
2271
2395
|
/**
|
2272
|
-
* A subclass of {@link EmbeddedCollectionField} which manages a collection of delta objects relative to another
|
2396
|
+
* A subclass of {@link EmbeddedCollectionField | `EmbeddedCollectionField`} which manages a collection of delta objects relative to another
|
2273
2397
|
* collection.
|
2274
2398
|
* @typeParam ElementFieldType - the field type for the elements in the EmbeddedCollectionDeltaField
|
2275
2399
|
* @typeParam AssignmentElementType - the assignment type for the elements in the collection
|
@@ -2333,10 +2457,10 @@ declare namespace EmbeddedCollectionDeltaField {
|
|
2333
2457
|
* A shorthand for the options of an EmbeddedCollectionDeltaField class.
|
2334
2458
|
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2335
2459
|
*/
|
2336
|
-
type Options<AssignmentElementType> =
|
2460
|
+
type Options<AssignmentElementType> = DataField.Options<ArrayField.BaseAssignmentType<AssignmentElementType>>;
|
2337
2461
|
|
2338
2462
|
/**
|
2339
|
-
* The type of the default options for the {@link EmbeddedCollectionDeltaField} class.
|
2463
|
+
* The type of the default options for the {@link EmbeddedCollectionDeltaField | `EmbeddedCollectionDeltaField`} class.
|
2340
2464
|
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2341
2465
|
*/
|
2342
2466
|
type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
|
@@ -2355,10 +2479,10 @@ declare namespace EmbeddedCollectionDeltaField {
|
|
2355
2479
|
* A type to infer the assignment element type of an EmbeddedCollectionDeltaField from its ElementFieldType.
|
2356
2480
|
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionDeltaField
|
2357
2481
|
*/
|
2358
|
-
type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
|
2359
|
-
...args:
|
2360
|
-
) =>
|
2361
|
-
?
|
2482
|
+
type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
|
2483
|
+
...args: infer _1
|
2484
|
+
) => { " __fvtt_types_internal_assignment_data": infer AssignmentData }
|
2485
|
+
? AssignmentData
|
2362
2486
|
: never;
|
2363
2487
|
|
2364
2488
|
/**
|
@@ -2372,10 +2496,11 @@ declare namespace EmbeddedCollectionDeltaField {
|
|
2372
2496
|
* A type to infer the initialized element type of an EmbeddedCollectionDeltaField from its ElementFieldType.
|
2373
2497
|
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionDeltaField
|
2374
2498
|
*/
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2378
|
-
|
2499
|
+
// Note(LukeAbby): For some reason checking `extends Document` causes issues where `extends DataModel` doesn't.
|
2500
|
+
type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends abstract new (
|
2501
|
+
...args: infer _1
|
2502
|
+
) => { " __fvtt_types_internal_source_data": infer AssignmentData }
|
2503
|
+
? AssignmentData
|
2379
2504
|
: never;
|
2380
2505
|
|
2381
2506
|
/**
|
@@ -2410,7 +2535,7 @@ declare namespace EmbeddedCollectionDeltaField {
|
|
2410
2535
|
/**
|
2411
2536
|
* A shorthand for the persisted type of an ArrayField class.
|
2412
2537
|
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2413
|
-
* @typeParam PersistedElementType - the
|
2538
|
+
* @typeParam PersistedElementType - the persisted type of the elements of the EmbeddedCollectionDeltaField
|
2414
2539
|
* @typeParam Opts - the options that override the default options
|
2415
2540
|
*/
|
2416
2541
|
type PersistedType<
|
@@ -2421,7 +2546,7 @@ declare namespace EmbeddedCollectionDeltaField {
|
|
2421
2546
|
}
|
2422
2547
|
|
2423
2548
|
/**
|
2424
|
-
* A subclass of {@link EmbeddedDataField} which supports a single embedded Document.
|
2549
|
+
* A subclass of {@link EmbeddedDataField | `EmbeddedDataField`} which supports a single embedded Document.
|
2425
2550
|
* @typeParam DocumentType - the type of the embedded Document
|
2426
2551
|
* @typeParam Options - the options of the EmbeddedDocumentField instance
|
2427
2552
|
* @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedDocumentField
|
@@ -2469,15 +2594,17 @@ declare class EmbeddedDocumentField<
|
|
2469
2594
|
}
|
2470
2595
|
|
2471
2596
|
declare namespace EmbeddedDocumentField {
|
2597
|
+
interface Any extends EmbeddedDocumentField<any, any, any, any, any> {}
|
2598
|
+
|
2472
2599
|
/**
|
2473
2600
|
* A shorthand for the options of an EmbeddedDocumentField class.
|
2474
2601
|
* @typeParam DocumentType - the type of the embedded Document
|
2475
2602
|
*/
|
2476
|
-
type Options<DocumentType extends Document.AnyConstructor> =
|
2477
|
-
SchemaField.
|
2603
|
+
type Options<DocumentType extends Document.AnyConstructor> = DataField.Options<
|
2604
|
+
SchemaField.AssignmentData<DataModel.SchemaOfClass<DocumentType>> | __SchemaFieldInitial
|
2478
2605
|
>;
|
2479
2606
|
|
2480
|
-
/** The type of the default options for the {@link EmbeddedDocumentField} class. */
|
2607
|
+
/** The type of the default options for the {@link EmbeddedDocumentField | `EmbeddedDocumentField`} class. */
|
2481
2608
|
type DefaultOptions = SimpleMerge<
|
2482
2609
|
EmbeddedDataField.DefaultOptions,
|
2483
2610
|
{
|
@@ -2504,7 +2631,7 @@ declare namespace EmbeddedDocumentField {
|
|
2504
2631
|
DocumentType extends Document.AnyConstructor,
|
2505
2632
|
Opts extends Options<DocumentType>,
|
2506
2633
|
> = DataField.DerivedAssignmentType<
|
2507
|
-
SchemaField.
|
2634
|
+
SchemaField.AssignmentData<DataModel.SchemaOfClass<DocumentType>>,
|
2508
2635
|
MergedOptions<DocumentType, Opts>
|
2509
2636
|
>;
|
2510
2637
|
|
@@ -2517,7 +2644,7 @@ declare namespace EmbeddedDocumentField {
|
|
2517
2644
|
DocumentType extends Document.AnyConstructor,
|
2518
2645
|
Opts extends Options<DocumentType>,
|
2519
2646
|
> = DataField.DerivedInitializedType<
|
2520
|
-
SchemaField.
|
2647
|
+
SchemaField.InitializedData<DataModel.SchemaOfClass<DocumentType>>,
|
2521
2648
|
MergedOptions<DocumentType, Opts>
|
2522
2649
|
>;
|
2523
2650
|
|
@@ -2530,13 +2657,13 @@ declare namespace EmbeddedDocumentField {
|
|
2530
2657
|
DocumentType extends Document.AnyConstructor,
|
2531
2658
|
Opts extends Options<DocumentType>,
|
2532
2659
|
> = DataField.DerivedInitializedType<
|
2533
|
-
SchemaField.
|
2660
|
+
SchemaField.SourceData<DataModel.SchemaOfClass<DocumentType>>,
|
2534
2661
|
MergedOptions<DocumentType, Opts>
|
2535
2662
|
>;
|
2536
2663
|
}
|
2537
2664
|
|
2538
2665
|
/**
|
2539
|
-
* A subclass of
|
2666
|
+
* A subclass of {@link StringField | `StringField`} which provides the primary _id for a Document.
|
2540
2667
|
* The field may be initially null, but it must be non-null when it is saved to the database.
|
2541
2668
|
* @typeParam Options - the options of the DocumentIdField instance
|
2542
2669
|
* @typeParam AssignmentType - the type of the allowed assignment values of the DocumentIdField
|
@@ -2550,7 +2677,7 @@ declare namespace EmbeddedDocumentField {
|
|
2550
2677
|
* InitialValue: `null`
|
2551
2678
|
*/
|
2552
2679
|
declare class DocumentIdField<
|
2553
|
-
Options extends
|
2680
|
+
Options extends DocumentIdField.Options = DocumentIdField.DefaultOptions,
|
2554
2681
|
AssignmentType = DocumentIdField.AssignmentType<Options>,
|
2555
2682
|
InitializedType = DocumentIdField.InitializedType<Options>,
|
2556
2683
|
PersistedType extends string | null | undefined = DocumentIdField.InitializedType<Options>,
|
@@ -2565,7 +2692,7 @@ declare class DocumentIdField<
|
|
2565
2692
|
override nullable: boolean;
|
2566
2693
|
|
2567
2694
|
/** @defaultValue `null` */
|
2568
|
-
override initial:
|
2695
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
2569
2696
|
|
2570
2697
|
/** @defaultValue `true` */
|
2571
2698
|
override readonly: boolean;
|
@@ -2573,7 +2700,7 @@ declare class DocumentIdField<
|
|
2573
2700
|
/** @defaultValue `"is not a valid Document ID string"` */
|
2574
2701
|
override validationError: string;
|
2575
2702
|
|
2576
|
-
protected static override get _defaults():
|
2703
|
+
protected static override get _defaults(): StringField.Options<unknown>;
|
2577
2704
|
|
2578
2705
|
protected override _cast(value: AssignmentType): InitializedType;
|
2579
2706
|
|
@@ -2584,7 +2711,11 @@ declare class DocumentIdField<
|
|
2584
2711
|
}
|
2585
2712
|
|
2586
2713
|
declare namespace DocumentIdField {
|
2587
|
-
|
2714
|
+
type Options = StringField.Options<unknown> & {
|
2715
|
+
readonly?: boolean;
|
2716
|
+
};
|
2717
|
+
|
2718
|
+
/** The type of the default options for the {@link DocumentIdField | `DocumentIdField`} class. */
|
2588
2719
|
type DefaultOptions = SimpleMerge<
|
2589
2720
|
StringField.DefaultOptions,
|
2590
2721
|
{
|
@@ -2601,13 +2732,13 @@ declare namespace DocumentIdField {
|
|
2601
2732
|
* A helper type for the given options type merged into the default options of the DocumentIdField class.
|
2602
2733
|
* @typeParam Options - the options that override the default options
|
2603
2734
|
*/
|
2604
|
-
type MergedOptions<Options extends
|
2735
|
+
type MergedOptions<Options extends StringField.Options<unknown>> = SimpleMerge<DefaultOptions, Options>;
|
2605
2736
|
|
2606
2737
|
/**
|
2607
2738
|
* A shorthand for the assignment type of a StringField class.
|
2608
2739
|
* @typeParam Options - the options that override the default options
|
2609
2740
|
*/
|
2610
|
-
type AssignmentType<Options extends
|
2741
|
+
type AssignmentType<Options extends StringField.Options<unknown>> = DataField.DerivedAssignmentType<
|
2611
2742
|
string | Document.Any,
|
2612
2743
|
MergedOptions<Options>
|
2613
2744
|
>;
|
@@ -2616,14 +2747,14 @@ declare namespace DocumentIdField {
|
|
2616
2747
|
* A shorthand for the initialized type of a StringField class.
|
2617
2748
|
* @typeParam Options - the options that override the default options
|
2618
2749
|
*/
|
2619
|
-
type InitializedType<Options extends
|
2750
|
+
type InitializedType<Options extends StringField.Options<unknown>> = DataField.DerivedInitializedType<
|
2620
2751
|
string,
|
2621
2752
|
MergedOptions<Options>
|
2622
2753
|
>;
|
2623
2754
|
}
|
2624
2755
|
|
2625
2756
|
/**
|
2626
|
-
* A subclass of {@link StringField} which supports referencing some other Document by its UUID.
|
2757
|
+
* A subclass of {@link StringField | `StringField`} which supports referencing some other Document by its UUID.
|
2627
2758
|
* This field may not be blank, but may be null to indicate that no UUID is referenced.
|
2628
2759
|
*/
|
2629
2760
|
declare class DocumentUUIDField<
|
@@ -2681,14 +2812,13 @@ declare class DocumentUUIDField<
|
|
2681
2812
|
}
|
2682
2813
|
|
2683
2814
|
declare namespace DocumentUUIDField {
|
2684
|
-
type Options =
|
2685
|
-
|
2686
|
-
|
2687
|
-
type?: Document.Type | undefined;
|
2815
|
+
type Options = StringField.Options & {
|
2816
|
+
/* A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field */
|
2817
|
+
type?: Document.Type | undefined;
|
2688
2818
|
|
2689
|
-
|
2690
|
-
|
2691
|
-
|
2819
|
+
/* Does this field require (or prohibit) embedded documents? */
|
2820
|
+
embedded?: boolean | undefined;
|
2821
|
+
};
|
2692
2822
|
|
2693
2823
|
type DefaultOptions = SimpleMerge<
|
2694
2824
|
StringField.DefaultOptions,
|
@@ -2722,7 +2852,7 @@ declare namespace DocumentUUIDField {
|
|
2722
2852
|
}
|
2723
2853
|
|
2724
2854
|
/**
|
2725
|
-
* A special class of
|
2855
|
+
* A special class of {@link StringField | `StringField`} field which references another DataModel by its id.
|
2726
2856
|
* This field may also be null to indicate that no foreign model is linked.
|
2727
2857
|
* @typeParam DocumentType - the type of the foreign document constructor
|
2728
2858
|
* @typeParam Options - the options for the ForeignDocumentField
|
@@ -2778,13 +2908,13 @@ declare class ForeignDocumentField<
|
|
2778
2908
|
|
2779
2909
|
declare namespace ForeignDocumentField {
|
2780
2910
|
/** The options for the ForeignDocumentField class. */
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2911
|
+
// TODO(LukeAbby)
|
2912
|
+
interface Options extends StringField.Options<string | Document.Any> {
|
2913
|
+
// ^ Making this more concrete leads to excessively deep instantiation
|
2914
|
+
idOnly?: boolean;
|
2915
|
+
}
|
2786
2916
|
|
2787
|
-
/** The type of the default options for the {@link ForeignDocumentField} class. */
|
2917
|
+
/** The type of the default options for the {@link ForeignDocumentField | `ForeignDocumentField`} class. */
|
2788
2918
|
type DefaultOptions = SimpleMerge<
|
2789
2919
|
DocumentIdField.DefaultOptions,
|
2790
2920
|
{
|
@@ -2807,7 +2937,7 @@ declare namespace ForeignDocumentField {
|
|
2807
2937
|
type AssignmentType<
|
2808
2938
|
ConcreteDocument extends Document.AnyConstructor,
|
2809
2939
|
Opts extends Options,
|
2810
|
-
> = DataField.DerivedAssignmentType<string | Document.
|
2940
|
+
> = DataField.DerivedAssignmentType<string | Document.ToConfiguredInstance<ConcreteDocument>, MergedOptions<Opts>>;
|
2811
2941
|
|
2812
2942
|
/**
|
2813
2943
|
* A shorthand for the initialized type of a ForeignDocumentField class.
|
@@ -2829,7 +2959,7 @@ declare namespace ForeignDocumentField {
|
|
2829
2959
|
}
|
2830
2960
|
|
2831
2961
|
/**
|
2832
|
-
* A special
|
2962
|
+
* A special {@link StringField | `StringField`} which records a standardized CSS color string.
|
2833
2963
|
* @typeParam Options - the options of the ColorField instance
|
2834
2964
|
* @typeParam AssignmentType - the type of the allowed assignment values of the ColorField
|
2835
2965
|
* @typeParam InitializedType - the type of the initialized values of the ColorField
|
@@ -2842,7 +2972,7 @@ declare namespace ForeignDocumentField {
|
|
2842
2972
|
* InitialValue: `null`
|
2843
2973
|
*/
|
2844
2974
|
declare class ColorField<
|
2845
|
-
Options extends
|
2975
|
+
Options extends StringField.Options = ColorField.DefaultOptions,
|
2846
2976
|
AssignmentType = ColorField.AssignmentType<Options>,
|
2847
2977
|
InitializedType = ColorField.InitializedType<Options>,
|
2848
2978
|
PersistedType extends string | null | undefined = ColorField.PersistedType<Options>,
|
@@ -2851,7 +2981,7 @@ declare class ColorField<
|
|
2851
2981
|
override nullable: boolean;
|
2852
2982
|
|
2853
2983
|
/** @defaultValue `null` */
|
2854
|
-
override initial:
|
2984
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
2855
2985
|
|
2856
2986
|
/** @defaultValue `false` */
|
2857
2987
|
override blank: boolean;
|
@@ -2859,7 +2989,7 @@ declare class ColorField<
|
|
2859
2989
|
/** @defaultValue `"is not a valid hexadecimal color string"` */
|
2860
2990
|
override validationError: string;
|
2861
2991
|
|
2862
|
-
protected static override get _defaults():
|
2992
|
+
protected static override get _defaults(): StringField.Options;
|
2863
2993
|
|
2864
2994
|
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
2865
2995
|
|
@@ -2870,7 +3000,7 @@ declare class ColorField<
|
|
2870
3000
|
}
|
2871
3001
|
|
2872
3002
|
declare namespace ColorField {
|
2873
|
-
/** The type of the default options for the {@link ColorField} class. */
|
3003
|
+
/** The type of the default options for the {@link ColorField | `ColorField`} class. */
|
2874
3004
|
type DefaultOptions = SimpleMerge<
|
2875
3005
|
StringField.DefaultOptions,
|
2876
3006
|
{
|
@@ -2885,13 +3015,13 @@ declare namespace ColorField {
|
|
2885
3015
|
* A helper type for the given options type merged into the default options of the ColorField class.
|
2886
3016
|
* @typeParam Options - the options that override the default options
|
2887
3017
|
*/
|
2888
|
-
type MergedOptions<Options extends
|
3018
|
+
type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
|
2889
3019
|
|
2890
3020
|
/**
|
2891
3021
|
* A shorthand for the assignment type of a ColorField class.
|
2892
3022
|
* @typeParam Options - the options that override the default options
|
2893
3023
|
*/
|
2894
|
-
type AssignmentType<Options extends
|
3024
|
+
type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
|
2895
3025
|
string,
|
2896
3026
|
MergedOptions<Options>
|
2897
3027
|
>;
|
@@ -2900,7 +3030,7 @@ declare namespace ColorField {
|
|
2900
3030
|
* A shorthand for the initialized type of a ColorField class.
|
2901
3031
|
* @typeParam Options - the options that override the default options
|
2902
3032
|
*/
|
2903
|
-
type InitializedType<Options extends
|
3033
|
+
type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
|
2904
3034
|
Color,
|
2905
3035
|
MergedOptions<Options>
|
2906
3036
|
>;
|
@@ -2909,39 +3039,14 @@ declare namespace ColorField {
|
|
2909
3039
|
* A shorthand for the persisted type of a ColorField class.
|
2910
3040
|
* @typeParam Options - the options that override the default options
|
2911
3041
|
*/
|
2912
|
-
type PersistedType<Options extends
|
3042
|
+
type PersistedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
|
2913
3043
|
string,
|
2914
3044
|
MergedOptions<Options>
|
2915
3045
|
>;
|
2916
3046
|
}
|
2917
3047
|
|
2918
|
-
declare global {
|
2919
|
-
/**
|
2920
|
-
* @typeParam Value - the type of the value of the field
|
2921
|
-
*/
|
2922
|
-
interface FilePathFieldOptions extends StringFieldOptions {
|
2923
|
-
/**
|
2924
|
-
* A set of categories in CONST.FILE_CATEGORIES which this field supports
|
2925
|
-
* @defaultValue `[]`
|
2926
|
-
*/
|
2927
|
-
categories?: (keyof typeof CONST.FILE_CATEGORIES)[];
|
2928
|
-
|
2929
|
-
/**
|
2930
|
-
* Is embedded base64 data supported in lieu of a file path?
|
2931
|
-
* @defaultValue `false`
|
2932
|
-
*/
|
2933
|
-
base64?: boolean;
|
2934
|
-
|
2935
|
-
/**
|
2936
|
-
* Does this file path field allow wildcard characters?
|
2937
|
-
* @defaultValue `false`
|
2938
|
-
*/
|
2939
|
-
wildcard?: boolean;
|
2940
|
-
}
|
2941
|
-
}
|
2942
|
-
|
2943
3048
|
/**
|
2944
|
-
* A special
|
3049
|
+
* A special {@link StringField | `StringField`} which records a file path or inline base64 data.
|
2945
3050
|
* @typeParam Options - the options of the FilePathField instance
|
2946
3051
|
* @typeParam AssignmentType - the type of the allowed assignment values of the FilePathField
|
2947
3052
|
* @typeParam InitializedType - the type of the initialized values of the FilePathField
|
@@ -2954,7 +3059,7 @@ declare global {
|
|
2954
3059
|
* InitialValue: `null`
|
2955
3060
|
*/
|
2956
3061
|
declare class FilePathField<
|
2957
|
-
Options extends
|
3062
|
+
Options extends FilePathField.Options = FilePathField.DefaultOptions,
|
2958
3063
|
AssignmentType = FilePathField.AssignmentType<Options>,
|
2959
3064
|
InitializedType = FilePathField.InitializedType<Options>,
|
2960
3065
|
PersistedType extends string | null | undefined = FilePathField.InitializedType<Options>,
|
@@ -2989,9 +3094,9 @@ declare class FilePathField<
|
|
2989
3094
|
override blank: boolean;
|
2990
3095
|
|
2991
3096
|
/** @defaultValue `null` */
|
2992
|
-
override initial:
|
3097
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
2993
3098
|
|
2994
|
-
protected static override get _defaults():
|
3099
|
+
protected static override get _defaults(): FilePathField.Options;
|
2995
3100
|
|
2996
3101
|
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
2997
3102
|
|
@@ -3002,7 +3107,7 @@ declare class FilePathField<
|
|
3002
3107
|
}
|
3003
3108
|
|
3004
3109
|
declare namespace FilePathField {
|
3005
|
-
/** The type of the default options for the {@link FilePathField} class. */
|
3110
|
+
/** The type of the default options for the {@link FilePathField | `FilePathField`} class. */
|
3006
3111
|
type DefaultOptions = SimpleMerge<
|
3007
3112
|
StringField.DefaultOptions,
|
3008
3113
|
{
|
@@ -3015,17 +3120,37 @@ declare namespace FilePathField {
|
|
3015
3120
|
}
|
3016
3121
|
>;
|
3017
3122
|
|
3123
|
+
interface Options extends StringField.Options {
|
3124
|
+
/**
|
3125
|
+
* A set of categories in CONST.FILE_CATEGORIES which this field supports
|
3126
|
+
* @defaultValue `[]`
|
3127
|
+
*/
|
3128
|
+
categories?: (keyof typeof CONST.FILE_CATEGORIES)[];
|
3129
|
+
|
3130
|
+
/**
|
3131
|
+
* Is embedded base64 data supported in lieu of a file path?
|
3132
|
+
* @defaultValue `false`
|
3133
|
+
*/
|
3134
|
+
base64?: boolean;
|
3135
|
+
|
3136
|
+
/**
|
3137
|
+
* Does this file path field allow wildcard characters?
|
3138
|
+
* @defaultValue `false`
|
3139
|
+
*/
|
3140
|
+
wildcard?: boolean;
|
3141
|
+
}
|
3142
|
+
|
3018
3143
|
/**
|
3019
3144
|
* A helper type for the given options type merged into the default options of the FilePathField class.
|
3020
3145
|
* @typeParam Options - the options that override the default options
|
3021
3146
|
*/
|
3022
|
-
type MergedOptions<Options extends
|
3147
|
+
type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
|
3023
3148
|
|
3024
3149
|
/**
|
3025
3150
|
* A shorthand for the assignment type of a FilePathField class.
|
3026
3151
|
* @typeParam Options - the options that override the default options
|
3027
3152
|
*/
|
3028
|
-
type AssignmentType<Options extends
|
3153
|
+
type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
|
3029
3154
|
string,
|
3030
3155
|
MergedOptions<Options>
|
3031
3156
|
>;
|
@@ -3034,14 +3159,14 @@ declare namespace FilePathField {
|
|
3034
3159
|
* A shorthand for the initialized type of a FilePathField class.
|
3035
3160
|
* @typeParam Options - the options that override the default options
|
3036
3161
|
*/
|
3037
|
-
type InitializedType<Options extends
|
3162
|
+
type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
|
3038
3163
|
string,
|
3039
3164
|
MergedOptions<Options>
|
3040
3165
|
>;
|
3041
3166
|
}
|
3042
3167
|
|
3043
3168
|
/**
|
3044
|
-
* A special
|
3169
|
+
* A special {@link NumberField | `NumberField`} which represents an angle of rotation in degrees between 0 and 360.
|
3045
3170
|
* @typeParam Options - the options of the AngleField instance
|
3046
3171
|
* @typeParam AssignmentType - the type of the allowed assignment values of the AngleField
|
3047
3172
|
* @typeParam InitializedType - the type of the initialized values of the AngleField
|
@@ -3054,7 +3179,7 @@ declare namespace FilePathField {
|
|
3054
3179
|
* InitialValue: `0`
|
3055
3180
|
*/
|
3056
3181
|
declare class AngleField<
|
3057
|
-
Options extends
|
3182
|
+
Options extends NumberField.Options = AngleField.DefaultOptions,
|
3058
3183
|
AssignmentType = AngleField.AssignmentType<Options>,
|
3059
3184
|
InitializedType = AngleField.InitializedType<Options>,
|
3060
3185
|
PersistedType extends number | null | undefined = AngleField.InitializedType<Options>,
|
@@ -3066,7 +3191,7 @@ declare class AngleField<
|
|
3066
3191
|
override nullable: boolean;
|
3067
3192
|
|
3068
3193
|
/** @defaultValue `0` */
|
3069
|
-
override initial:
|
3194
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
3070
3195
|
|
3071
3196
|
/** @defaultValue `0` */
|
3072
3197
|
base: number;
|
@@ -3080,13 +3205,13 @@ declare class AngleField<
|
|
3080
3205
|
/** @defaultValue `"is not a number between 0 and 360"` */
|
3081
3206
|
override validationError: string;
|
3082
3207
|
|
3083
|
-
protected static override get _defaults():
|
3208
|
+
protected static override get _defaults(): NumberField.Options;
|
3084
3209
|
|
3085
3210
|
protected override _cast(value: AssignmentType): InitializedType;
|
3086
3211
|
}
|
3087
3212
|
|
3088
3213
|
declare namespace AngleField {
|
3089
|
-
/** The type of the default options for the {@link AngleField} class. */
|
3214
|
+
/** The type of the default options for the {@link AngleField | `AngleField`} class. */
|
3090
3215
|
type DefaultOptions = SimpleMerge<
|
3091
3216
|
NumberField.DefaultOptions,
|
3092
3217
|
{
|
@@ -3104,13 +3229,13 @@ declare namespace AngleField {
|
|
3104
3229
|
* A helper type for the given options type merged into the default options of the AngleField class.
|
3105
3230
|
* @typeParam Options - the options that override the default options
|
3106
3231
|
*/
|
3107
|
-
type MergedOptions<Options extends
|
3232
|
+
type MergedOptions<Options extends NumberField.Options> = SimpleMerge<DefaultOptions, Options>;
|
3108
3233
|
|
3109
3234
|
/**
|
3110
3235
|
* A shorthand for the assignment type of a AngleField class.
|
3111
3236
|
* @typeParam Options - the options that override the default options
|
3112
3237
|
*/
|
3113
|
-
type AssignmentType<Options extends
|
3238
|
+
type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
|
3114
3239
|
number,
|
3115
3240
|
MergedOptions<Options>
|
3116
3241
|
>;
|
@@ -3119,14 +3244,14 @@ declare namespace AngleField {
|
|
3119
3244
|
* A shorthand for the initialized type of a AngleField class.
|
3120
3245
|
* @typeParam Options - the options that override the default options
|
3121
3246
|
*/
|
3122
|
-
type InitializedType<Options extends
|
3247
|
+
type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
|
3123
3248
|
number,
|
3124
3249
|
MergedOptions<Options>
|
3125
3250
|
>;
|
3126
3251
|
}
|
3127
3252
|
|
3128
3253
|
/**
|
3129
|
-
* A special
|
3254
|
+
* A special {@link NumberField | `NumberField`} represents a number between 0 and 1.
|
3130
3255
|
* @typeParam Options - the options of the AlphaField instance
|
3131
3256
|
* @typeParam AssignmentType - the type of the allowed assignment values of the AlphaField
|
3132
3257
|
* @typeParam InitializedType - the type of the initialized values of the AlphaField
|
@@ -3139,7 +3264,7 @@ declare namespace AngleField {
|
|
3139
3264
|
* InitialValue: `1`
|
3140
3265
|
*/
|
3141
3266
|
declare class AlphaField<
|
3142
|
-
Options extends
|
3267
|
+
Options extends NumberField.Options = AlphaField.DefaultOptions,
|
3143
3268
|
AssignmentType = AlphaField.AssignmentType<Options>,
|
3144
3269
|
InitializedType = AlphaField.InitializedType<Options>,
|
3145
3270
|
PersistedType extends number | null | undefined = AlphaField.InitializedType<Options>,
|
@@ -3151,7 +3276,7 @@ declare class AlphaField<
|
|
3151
3276
|
override nullable: boolean;
|
3152
3277
|
|
3153
3278
|
/** @defaultValue `1` */
|
3154
|
-
override initial:
|
3279
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
3155
3280
|
|
3156
3281
|
/** @defaultValue `0` */
|
3157
3282
|
override min: number | undefined;
|
@@ -3162,11 +3287,11 @@ declare class AlphaField<
|
|
3162
3287
|
/** @defaultValue `"is not a number between 0 and 1"` */
|
3163
3288
|
override validationError: string;
|
3164
3289
|
|
3165
|
-
protected static override get _defaults():
|
3290
|
+
protected static override get _defaults(): NumberField.Options;
|
3166
3291
|
}
|
3167
3292
|
|
3168
3293
|
declare namespace AlphaField {
|
3169
|
-
/** The type of the default options for the {@link AlphaField} class. */
|
3294
|
+
/** The type of the default options for the {@link AlphaField | `AlphaField`} class. */
|
3170
3295
|
type DefaultOptions = SimpleMerge<
|
3171
3296
|
NumberField.DefaultOptions,
|
3172
3297
|
{
|
@@ -3183,13 +3308,13 @@ declare namespace AlphaField {
|
|
3183
3308
|
* A helper type for the given options type merged into the default options of the AlphaField class.
|
3184
3309
|
* @typeParam Options - the options that override the default options
|
3185
3310
|
*/
|
3186
|
-
type MergedOptions<Options extends
|
3311
|
+
type MergedOptions<Options extends NumberField.Options> = SimpleMerge<DefaultOptions, Options>;
|
3187
3312
|
|
3188
3313
|
/**
|
3189
3314
|
* A shorthand for the assignment type of a AlphaField class.
|
3190
3315
|
* @typeParam Options - the options that override the default options
|
3191
3316
|
*/
|
3192
|
-
type AssignmentType<Options extends
|
3317
|
+
type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
|
3193
3318
|
number,
|
3194
3319
|
MergedOptions<Options>
|
3195
3320
|
>;
|
@@ -3198,18 +3323,18 @@ declare namespace AlphaField {
|
|
3198
3323
|
* A shorthand for the initialized type of a AlphaField class.
|
3199
3324
|
* @typeParam Options - the options that override the default options
|
3200
3325
|
*/
|
3201
|
-
type InitializedType<Options extends
|
3326
|
+
type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
|
3202
3327
|
number,
|
3203
3328
|
MergedOptions<Options>
|
3204
3329
|
>;
|
3205
3330
|
}
|
3206
3331
|
|
3207
3332
|
/**
|
3208
|
-
* A special
|
3333
|
+
* A special {@link NumberField | `NumberField`} represents a number between 0 (inclusive) and 1 (exclusive).
|
3209
3334
|
* Its values are normalized (modulo 1) to the range [0, 1) instead of being clamped.
|
3210
3335
|
*/
|
3211
3336
|
declare class HueField<
|
3212
|
-
const Options extends
|
3337
|
+
const Options extends NumberField.Options = NumberField.DefaultOptions,
|
3213
3338
|
const AssignmentType = NumberField.AssignmentType<Options>,
|
3214
3339
|
const InitializedType = NumberField.InitializedType<Options>,
|
3215
3340
|
const PersistedType extends number | null | undefined = NumberField.InitializedType<Options>,
|
@@ -3220,7 +3345,7 @@ declare class HueField<
|
|
3220
3345
|
}
|
3221
3346
|
|
3222
3347
|
declare namespace HueField {
|
3223
|
-
type Options =
|
3348
|
+
type Options = NumberField.Options;
|
3224
3349
|
|
3225
3350
|
type DefaultOptions = SimpleMerge<
|
3226
3351
|
NumberField.DefaultOptions,
|
@@ -3236,7 +3361,7 @@ declare namespace HueField {
|
|
3236
3361
|
}
|
3237
3362
|
|
3238
3363
|
/**
|
3239
|
-
* A special
|
3364
|
+
* A special {@link ObjectField | `ObjectField`} which captures a mapping of User IDs to Document permission levels.
|
3240
3365
|
* @typeParam Options - the options of the DocumentOwnershipField instance
|
3241
3366
|
* @typeParam AssignmentType - the type of the allowed assignment values of the DocumentOwnershipField
|
3242
3367
|
* @typeParam InitializedType - the type of the initialized values of the DocumentOwnershipField
|
@@ -3258,7 +3383,7 @@ declare class DocumentOwnershipField<
|
|
3258
3383
|
| undefined = DocumentOwnershipField.InitializedType<Options>,
|
3259
3384
|
> extends ObjectField<Options, AssignmentType, InitializedType, PersistedType> {
|
3260
3385
|
/** @defaultValue `{"default": DOCUMENT_OWNERSHIP_LEVELS.NONE}` */
|
3261
|
-
override initial:
|
3386
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
3262
3387
|
|
3263
3388
|
/** @defaultValue `"is not a mapping of user IDs and document permission levels"` */
|
3264
3389
|
override validationError: string;
|
@@ -3273,9 +3398,9 @@ declare class DocumentOwnershipField<
|
|
3273
3398
|
|
3274
3399
|
declare namespace DocumentOwnershipField {
|
3275
3400
|
/** A shorthand for the options of a DocumentOwnershipField class. */
|
3276
|
-
type Options =
|
3401
|
+
type Options = DataField.Options<Record<string, DOCUMENT_OWNERSHIP_LEVELS>>;
|
3277
3402
|
|
3278
|
-
/** The type of the default options for the {@link DocumentOwnershipField} class. */
|
3403
|
+
/** The type of the default options for the {@link DocumentOwnershipField | `DocumentOwnershipField`} class. */
|
3279
3404
|
type DefaultOptions = SimpleMerge<
|
3280
3405
|
ObjectField.DefaultOptions,
|
3281
3406
|
{
|
@@ -3310,7 +3435,7 @@ declare namespace DocumentOwnershipField {
|
|
3310
3435
|
}
|
3311
3436
|
|
3312
3437
|
/**
|
3313
|
-
* A special
|
3438
|
+
* A special {@link StringField | `StringField`} which contains serialized JSON data.
|
3314
3439
|
* @typeParam Options - the options of the JSONField instance
|
3315
3440
|
* @typeParam AssignmentType - the type of the allowed assignment values of the JSONField
|
3316
3441
|
* @typeParam InitializedType - the type of the initialized values of the JSONField
|
@@ -3324,7 +3449,7 @@ declare namespace DocumentOwnershipField {
|
|
3324
3449
|
*/
|
3325
3450
|
declare class JSONField<
|
3326
3451
|
// TODO(LukeAbby): Due to the unconditional setting of `blank`, `trim`, and `choices` setting them is meaningless which basically means they're removed from the options.
|
3327
|
-
Options extends
|
3452
|
+
Options extends StringField.Options = JSONField.DefaultOptions,
|
3328
3453
|
AssignmentType = JSONField.AssignmentType<Options>,
|
3329
3454
|
InitializedType = JSONField.InitializedType<Options>,
|
3330
3455
|
PersistedType extends string | null | undefined = JSONField.PersistedType<Options>,
|
@@ -3335,12 +3460,12 @@ declare class JSONField<
|
|
3335
3460
|
override blank: boolean;
|
3336
3461
|
|
3337
3462
|
/** @defaultValue `undefined` */
|
3338
|
-
override initial:
|
3463
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
3339
3464
|
|
3340
3465
|
/** @defaultValue `"is not a valid JSON string"` */
|
3341
3466
|
override validationError: string;
|
3342
3467
|
|
3343
|
-
protected static override get _defaults():
|
3468
|
+
protected static override get _defaults(): StringField.Options;
|
3344
3469
|
|
3345
3470
|
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
3346
3471
|
|
@@ -3383,7 +3508,7 @@ declare class JSONField<
|
|
3383
3508
|
}
|
3384
3509
|
|
3385
3510
|
declare namespace JSONField {
|
3386
|
-
/** The type of the default options for the {@link JSONField} class. */
|
3511
|
+
/** The type of the default options for the {@link JSONField | `JSONField`} class. */
|
3387
3512
|
type DefaultOptions = SimpleMerge<
|
3388
3513
|
StringField.DefaultOptions,
|
3389
3514
|
{
|
@@ -3397,13 +3522,13 @@ declare namespace JSONField {
|
|
3397
3522
|
* A helper type for the given options type merged into the default options of the JSONField class.
|
3398
3523
|
* @typeParam Options - the options that override the default options
|
3399
3524
|
*/
|
3400
|
-
type MergedOptions<Options extends
|
3525
|
+
type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
|
3401
3526
|
|
3402
3527
|
/**
|
3403
3528
|
* A shorthand for the assignment type of a JSONField class.
|
3404
3529
|
* @typeParam Options - the options that override the default options
|
3405
3530
|
*/
|
3406
|
-
type AssignmentType<Options extends
|
3531
|
+
type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
|
3407
3532
|
string,
|
3408
3533
|
MergedOptions<Options>
|
3409
3534
|
>;
|
@@ -3412,7 +3537,7 @@ declare namespace JSONField {
|
|
3412
3537
|
* A shorthand for the initialized type of a JSONField class.
|
3413
3538
|
* @typeParam Options - the options that override the default options
|
3414
3539
|
*/
|
3415
|
-
type InitializedType<Options extends
|
3540
|
+
type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
|
3416
3541
|
AnyObject,
|
3417
3542
|
MergedOptions<Options>
|
3418
3543
|
>;
|
@@ -3421,19 +3546,19 @@ declare namespace JSONField {
|
|
3421
3546
|
* A shorthand for the persisted type of a JSONField class.
|
3422
3547
|
* @typeParam Options - the options that override the default options
|
3423
3548
|
*/
|
3424
|
-
type PersistedType<Options extends
|
3549
|
+
type PersistedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
|
3425
3550
|
string,
|
3426
3551
|
MergedOptions<Options>
|
3427
3552
|
>;
|
3428
3553
|
}
|
3429
3554
|
|
3430
3555
|
/**
|
3431
|
-
* A special subclass of {@link DataField} which can contain any value of any type.
|
3556
|
+
* A special subclass of {@link DataField | `DataField`} which can contain any value of any type.
|
3432
3557
|
* Any input is accepted and is treated as valid.
|
3433
3558
|
* It is not recommended to use this class except for very specific circumstances.
|
3434
3559
|
*/
|
3435
3560
|
// TODO(LukeAbby): This field effectively removes all options because there's no point asking for an options when none of them do anything.
|
3436
|
-
declare class AnyField extends DataField<
|
3561
|
+
declare class AnyField extends DataField<DataField.Options.Any, unknown, unknown, unknown> {
|
3437
3562
|
override _cast(value: unknown): unknown;
|
3438
3563
|
|
3439
3564
|
protected override _validateType(
|
@@ -3443,7 +3568,7 @@ declare class AnyField extends DataField<DataFieldOptions.Any, unknown, unknown,
|
|
3443
3568
|
}
|
3444
3569
|
|
3445
3570
|
/**
|
3446
|
-
* A subclass of
|
3571
|
+
* A subclass of {@link StringField | `StringField`} which contains a sanitized HTML string.
|
3447
3572
|
* This class does not override any StringField behaviors, but is used by the server-side to identify fields which
|
3448
3573
|
* require sanitization of user input.
|
3449
3574
|
* @typeParam Options - the options of the HTMLField instance
|
@@ -3458,7 +3583,7 @@ declare class AnyField extends DataField<DataFieldOptions.Any, unknown, unknown,
|
|
3458
3583
|
* InitialValue: `""`
|
3459
3584
|
*/
|
3460
3585
|
declare class HTMLField<
|
3461
|
-
Options extends
|
3586
|
+
Options extends StringField.Options = HTMLField.DefaultOptions,
|
3462
3587
|
AssignmentType = HTMLField.AssignmentType<Options>,
|
3463
3588
|
InitializedType = HTMLField.InitializedType<Options>,
|
3464
3589
|
PersistedType extends string | null | undefined = HTMLField.InitializedType<Options>,
|
@@ -3469,7 +3594,7 @@ declare class HTMLField<
|
|
3469
3594
|
/** @defaultValue `true` */
|
3470
3595
|
override blank: boolean;
|
3471
3596
|
|
3472
|
-
protected static override get _defaults():
|
3597
|
+
protected static override get _defaults(): StringField.Options;
|
3473
3598
|
|
3474
3599
|
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
3475
3600
|
toFormGroup(
|
@@ -3497,7 +3622,7 @@ declare class HTMLField<
|
|
3497
3622
|
}
|
3498
3623
|
|
3499
3624
|
declare namespace HTMLField {
|
3500
|
-
/** The type of the default options for the {@link HTMLField} class. */
|
3625
|
+
/** The type of the default options for the {@link HTMLField | `HTMLField`} class. */
|
3501
3626
|
type DefaultOptions = SimpleMerge<
|
3502
3627
|
StringField.DefaultOptions,
|
3503
3628
|
{
|
@@ -3510,13 +3635,13 @@ declare namespace HTMLField {
|
|
3510
3635
|
* A helper type for the given options type merged into the default options of the HTMLField class.
|
3511
3636
|
* @typeParam Options - the options that override the default options
|
3512
3637
|
*/
|
3513
|
-
type MergedOptions<Options extends
|
3638
|
+
type MergedOptions<Options extends StringField.Options> = SimpleMerge<DefaultOptions, Options>;
|
3514
3639
|
|
3515
3640
|
/**
|
3516
3641
|
* A shorthand for the assignment type of a HTMLField class.
|
3517
3642
|
* @typeParam Options - the options that override the default options
|
3518
3643
|
*/
|
3519
|
-
type AssignmentType<Options extends
|
3644
|
+
type AssignmentType<Options extends StringField.Options> = DataField.DerivedAssignmentType<
|
3520
3645
|
string,
|
3521
3646
|
MergedOptions<Options>
|
3522
3647
|
>;
|
@@ -3525,7 +3650,7 @@ declare namespace HTMLField {
|
|
3525
3650
|
* A shorthand for the initialized type of a HTMLField class.
|
3526
3651
|
* @typeParam Options - the options that override the default options
|
3527
3652
|
*/
|
3528
|
-
type InitializedType<Options extends
|
3653
|
+
type InitializedType<Options extends StringField.Options> = DataField.DerivedInitializedType<
|
3529
3654
|
string,
|
3530
3655
|
MergedOptions<Options>
|
3531
3656
|
>;
|
@@ -3535,7 +3660,7 @@ declare namespace HTMLField {
|
|
3535
3660
|
}
|
3536
3661
|
|
3537
3662
|
/**
|
3538
|
-
* A subclass of {@link NumberField} which is used for storing integer sort keys.
|
3663
|
+
* A subclass of {@link NumberField | `NumberField`} which is used for storing integer sort keys.
|
3539
3664
|
* @typeParam Options - the options of the IntegerSortField instance
|
3540
3665
|
* @typeParam AssignmentType - the type of the allowed assignment values of the IntegerSortField
|
3541
3666
|
* @typeParam InitializedType - the type of the initialized values of the IntegerSortField
|
@@ -3548,7 +3673,7 @@ declare namespace HTMLField {
|
|
3548
3673
|
* InitialValue: `0`
|
3549
3674
|
*/
|
3550
3675
|
declare class IntegerSortField<
|
3551
|
-
Options extends
|
3676
|
+
Options extends NumberField.Options = IntegerSortField.DefaultOptions,
|
3552
3677
|
AssignmentType = IntegerSortField.AssignmentType<Options>,
|
3553
3678
|
InitializedType = IntegerSortField.InitializedType<Options>,
|
3554
3679
|
PersistedType extends number | null | undefined = IntegerSortField.InitializedType<Options>,
|
@@ -3563,7 +3688,7 @@ declare class IntegerSortField<
|
|
3563
3688
|
override integer: boolean;
|
3564
3689
|
|
3565
3690
|
/** @defaultValue `0` */
|
3566
|
-
override initial:
|
3691
|
+
override initial: DataField.Options.InitialType<InitializedType>;
|
3567
3692
|
|
3568
3693
|
/** @defaultValue `"FOLDER.DocumentSort"` */
|
3569
3694
|
override label: string;
|
@@ -3573,7 +3698,7 @@ declare class IntegerSortField<
|
|
3573
3698
|
}
|
3574
3699
|
|
3575
3700
|
declare namespace IntegerSortField {
|
3576
|
-
/** The type of the default options for the {@link IntegerSortField} class. */
|
3701
|
+
/** The type of the default options for the {@link IntegerSortField | `IntegerSortField`} class. */
|
3577
3702
|
type DefaultOptions = SimpleMerge<
|
3578
3703
|
DataField.DefaultOptions,
|
3579
3704
|
{
|
@@ -3590,13 +3715,13 @@ declare namespace IntegerSortField {
|
|
3590
3715
|
* A helper type for the given options type merged into the default options of the IntegerSortField class.
|
3591
3716
|
* @typeParam Options - the options that override the default options
|
3592
3717
|
*/
|
3593
|
-
type MergedOptions<Options extends
|
3718
|
+
type MergedOptions<Options extends NumberField.Options> = SimpleMerge<DefaultOptions, Options>;
|
3594
3719
|
|
3595
3720
|
/**
|
3596
3721
|
* A shorthand for the assignment type of a IntegerSortField class.
|
3597
3722
|
* @typeParam Options - the options that override the default options
|
3598
3723
|
*/
|
3599
|
-
type AssignmentType<Options extends
|
3724
|
+
type AssignmentType<Options extends NumberField.Options> = DataField.DerivedAssignmentType<
|
3600
3725
|
number,
|
3601
3726
|
MergedOptions<Options>
|
3602
3727
|
>;
|
@@ -3605,18 +3730,14 @@ declare namespace IntegerSortField {
|
|
3605
3730
|
* A shorthand for the initialized type of a IntegerSortField class.
|
3606
3731
|
* @typeParam Options - the options that override the default options
|
3607
3732
|
*/
|
3608
|
-
type InitializedType<Options extends
|
3733
|
+
type InitializedType<Options extends NumberField.Options> = DataField.DerivedInitializedType<
|
3609
3734
|
number,
|
3610
3735
|
MergedOptions<Options>
|
3611
3736
|
>;
|
3612
3737
|
}
|
3613
3738
|
|
3614
|
-
declare global {
|
3615
|
-
type DocumentStats = DocumentStatsField.Properties;
|
3616
|
-
}
|
3617
|
-
|
3618
3739
|
/**
|
3619
|
-
* A subclass of {@link SchemaField} which stores document metadata in the _stats field.
|
3740
|
+
* A subclass of {@link SchemaField | `SchemaField`} which stores document metadata in the _stats field.
|
3620
3741
|
* @typeParam Options - the options of the DocumentStatsField instance
|
3621
3742
|
* @typeParam AssignmentType - the type of the allowed assignment values of the DocumentStatsField
|
3622
3743
|
* @typeParam InitializedType - the type of the initialized values of the DocumentStatsField
|
@@ -3649,13 +3770,13 @@ declare class DocumentStatsField<
|
|
3649
3770
|
|
3650
3771
|
declare namespace DocumentStatsField {
|
3651
3772
|
/** A shorthand for the options of a DocumentStatsField class. */
|
3652
|
-
type Options =
|
3773
|
+
type Options = DataField.Options<SchemaField.AssignmentData<Schema>>;
|
3653
3774
|
|
3654
|
-
/** The type of the default options for the {@link DocumentStatsField} class. */
|
3655
|
-
type DefaultOptions = SimpleMerge<SchemaField.DefaultOptions, { initial: SchemaField.
|
3775
|
+
/** The type of the default options for the {@link DocumentStatsField | `DocumentStatsField`} class. */
|
3776
|
+
type DefaultOptions = SimpleMerge<SchemaField.DefaultOptions, { initial: SchemaField.AssignmentData<Schema> }>;
|
3656
3777
|
|
3657
3778
|
/**
|
3658
|
-
* A helper type for the given options type merged into the default options of the {@link DocumentStatsField} class.
|
3779
|
+
* A helper type for the given options type merged into the default options of the {@link DocumentStatsField | `DocumentStatsField`} class.
|
3659
3780
|
* @typeParam Opts - the options that override the default options
|
3660
3781
|
*/
|
3661
3782
|
type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
|
@@ -3665,7 +3786,7 @@ declare namespace DocumentStatsField {
|
|
3665
3786
|
* @typeParam Opts - the options that override the default options
|
3666
3787
|
*/
|
3667
3788
|
type AssignmentType<Opts extends Options = DefaultOptions> = DataField.DerivedAssignmentType<
|
3668
|
-
SchemaField.
|
3789
|
+
SchemaField.AssignmentData<Schema>,
|
3669
3790
|
MergedOptions<Opts>
|
3670
3791
|
>;
|
3671
3792
|
|
@@ -3674,7 +3795,7 @@ declare namespace DocumentStatsField {
|
|
3674
3795
|
* @typeParam Opts - the options that override the default options
|
3675
3796
|
*/
|
3676
3797
|
type InitializedType<Opts extends Options = DefaultOptions> = DataField.DerivedInitializedType<
|
3677
|
-
SchemaField.
|
3798
|
+
SchemaField.InitializedData<Schema>,
|
3678
3799
|
MergedOptions<Opts>
|
3679
3800
|
>;
|
3680
3801
|
|
@@ -3683,13 +3804,24 @@ declare namespace DocumentStatsField {
|
|
3683
3804
|
* @typeParam Opts - the options that override the default options
|
3684
3805
|
*/
|
3685
3806
|
type PersistedType<Opts extends Options = DefaultOptions> = DataField.DerivedInitializedType<
|
3686
|
-
SchemaField.
|
3807
|
+
SchemaField.SourceData<Schema>,
|
3687
3808
|
MergedOptions<Opts>
|
3688
3809
|
>;
|
3689
3810
|
|
3690
|
-
|
3691
|
-
|
3692
|
-
|
3811
|
+
interface CreateData extends SchemaField.CreateData<Schema> {}
|
3812
|
+
|
3813
|
+
interface InitializedData extends SchemaField.InitializedData<Schema> {}
|
3814
|
+
|
3815
|
+
interface SourceData extends SchemaField.SourceData<Schema> {}
|
3816
|
+
|
3817
|
+
/** @deprecated {@link DocumentStatsField.CreateData | `DocumentStatsField.CreateData`} */
|
3818
|
+
type ConstructorData = CreateData;
|
3819
|
+
|
3820
|
+
/** @deprecated {@link DocumentStatsField.InitializedData | `DocumentStatsField.InitializedData`} */
|
3821
|
+
type Properties = SchemaField.InitializedData<Schema>;
|
3822
|
+
|
3823
|
+
/** @deprecated {@link DocumentStatsField.SourceData | `DocumentStatsField.SourceData`} */
|
3824
|
+
type Source = SchemaField.SourceData<Schema>;
|
3693
3825
|
|
3694
3826
|
interface Schema extends DataSchema {
|
3695
3827
|
/**
|
@@ -3734,7 +3866,7 @@ declare namespace DocumentStatsField {
|
|
3734
3866
|
}
|
3735
3867
|
|
3736
3868
|
/**
|
3737
|
-
* A subclass of
|
3869
|
+
* A subclass of {@link StringField | `StringField`} that is used specifically for the Document "type" field.
|
3738
3870
|
*/
|
3739
3871
|
declare class DocumentTypeField<
|
3740
3872
|
const ConcreteDocumentClass extends Document.AnyConstructor,
|
@@ -3756,7 +3888,7 @@ declare class DocumentTypeField<
|
|
3756
3888
|
* @param options - Options which configure the behavior of the field
|
3757
3889
|
* @param context - Additional context which describes the field
|
3758
3890
|
*/
|
3759
|
-
constructor(documentClass: ConcreteDocumentClass, options
|
3891
|
+
constructor(documentClass: ConcreteDocumentClass, options?: DocumentTypeField.Options, context?: DataField.Context);
|
3760
3892
|
|
3761
3893
|
static override get _defaults(): DocumentTypeField.Options;
|
3762
3894
|
|
@@ -3767,7 +3899,7 @@ declare class DocumentTypeField<
|
|
3767
3899
|
}
|
3768
3900
|
|
3769
3901
|
declare namespace DocumentTypeField {
|
3770
|
-
/** The type of the default options for the {@link DocumentTypeField} class. */
|
3902
|
+
/** The type of the default options for the {@link DocumentTypeField | `DocumentTypeField`} class. */
|
3771
3903
|
type DefaultOptions = SimpleMerge<
|
3772
3904
|
StringField.DefaultOptions,
|
3773
3905
|
{
|
@@ -3777,12 +3909,12 @@ declare namespace DocumentTypeField {
|
|
3777
3909
|
}
|
3778
3910
|
>;
|
3779
3911
|
|
3780
|
-
interface Options extends
|
3912
|
+
interface Options extends StringField.Options {}
|
3781
3913
|
|
3782
3914
|
// TODO(LukeAbby): This class has effectively removed `choices` and `validationError` since they're unconditionally set in the constructor.
|
3783
3915
|
type MergedOptions<
|
3784
3916
|
ConcreteDocumentClass extends Document.AnyConstructor,
|
3785
|
-
Options extends
|
3917
|
+
Options extends StringField.Options,
|
3786
3918
|
> = SimpleMerge<
|
3787
3919
|
SimpleMerge<DefaultOptions, Options>,
|
3788
3920
|
{
|
@@ -3793,20 +3925,20 @@ declare namespace DocumentTypeField {
|
|
3793
3925
|
|
3794
3926
|
type AssignmentType<
|
3795
3927
|
ConcreteDocumentClass extends Document.AnyConstructor,
|
3796
|
-
Options extends
|
3928
|
+
Options extends StringField.Options,
|
3797
3929
|
> = StringField.AssignmentType<MergedOptions<ConcreteDocumentClass, Options>>;
|
3798
3930
|
type InitializedType<
|
3799
3931
|
ConcreteDocumentClass extends Document.AnyConstructor,
|
3800
|
-
Options extends
|
3932
|
+
Options extends StringField.Options,
|
3801
3933
|
> = StringField.InitializedType<MergedOptions<ConcreteDocumentClass, Options>>;
|
3802
3934
|
type PersistedType<
|
3803
3935
|
ConcreteDocumentClass extends Document.AnyConstructor,
|
3804
|
-
Options extends
|
3936
|
+
Options extends StringField.Options,
|
3805
3937
|
> = StringField.InitializedType<MergedOptions<ConcreteDocumentClass, Options>>;
|
3806
3938
|
}
|
3807
3939
|
|
3808
3940
|
/**
|
3809
|
-
* A subclass of
|
3941
|
+
* A subclass of {@link ObjectField | `ObjectField`} which supports a type-specific data object.
|
3810
3942
|
* @typeParam DocumentType - the type of the embedded Document
|
3811
3943
|
* @typeParam Options - the options of the TypeDataField instance
|
3812
3944
|
* @typeParam AssignmentType - the type of the allowed assignment values of the TypeDataField
|
@@ -3895,11 +4027,11 @@ declare namespace TypeDataField {
|
|
3895
4027
|
* A shorthand for the options of a TypeDataField class.
|
3896
4028
|
* @typeParam DocumentType - the type of the embedded Document
|
3897
4029
|
*/
|
3898
|
-
type Options<DocumentType extends Document.SystemConstructor> =
|
3899
|
-
SchemaField.
|
4030
|
+
type Options<DocumentType extends Document.SystemConstructor> = DataField.Options<
|
4031
|
+
SchemaField.AssignmentData<DataModel.SchemaOfClass<DocumentType>>
|
3900
4032
|
>;
|
3901
4033
|
|
3902
|
-
/** The type of the default options for the {@link TypeDataField} class. */
|
4034
|
+
/** The type of the default options for the {@link TypeDataField | `TypeDataField`} class. */
|
3903
4035
|
type DefaultOptions = SimpleMerge<
|
3904
4036
|
ObjectField.DefaultOptions,
|
3905
4037
|
{
|
@@ -3917,73 +4049,10 @@ declare namespace TypeDataField {
|
|
3917
4049
|
Opts
|
3918
4050
|
>;
|
3919
4051
|
|
3920
|
-
|
3921
|
-
|
3922
|
-
* @typeParam DocumentType - the type of the Document this system data is for
|
3923
|
-
*
|
3924
|
-
* @deprecated - This helper is from a time where {@link DataModelConfig | `DataModelConfig`}
|
3925
|
-
* was still recommended to use instances. This will always return instances but
|
3926
|
-
* its name is now misleading. For a replacement see {@link DataModelInstances | `DataModelInstances`}.
|
3927
|
-
* If you want to get the class see {@link DataModelClasses | `DataModelClasses`}.
|
3928
|
-
*/
|
3929
|
-
type Config<DocumentType extends Document.SystemConstructor> = DataModelInstances<DocumentType["metadata"]["name"]>;
|
3930
|
-
|
3931
|
-
type DataModelInstances<DocumentType extends Document.Type> = DocumentType extends keyof DataModelConfig
|
3932
|
-
? _ToInstances<DataModelConfig[DocumentType]>
|
4052
|
+
type DataModelsFor<DocumentType extends Document.Type> = DocumentType extends keyof DataModelConfig
|
4053
|
+
? DataModelConfig[DocumentType]
|
3933
4054
|
: EmptyObject;
|
3934
4055
|
|
3935
|
-
/**
|
3936
|
-
* @internal
|
3937
|
-
*/
|
3938
|
-
type _ToInstances<T extends AnyObject> = {
|
3939
|
-
[K in keyof T]: T[K] extends AnyConstructor ? InstanceType<T[K]> : T[K];
|
3940
|
-
};
|
3941
|
-
|
3942
|
-
type DataModelClasses<DocumentType extends Document.Type> = DocumentType extends keyof DataModelConfig
|
3943
|
-
? _ToClasses<DataModelConfig[DocumentType]>
|
3944
|
-
: EmptyObject;
|
3945
|
-
|
3946
|
-
/**
|
3947
|
-
* @internal
|
3948
|
-
*/
|
3949
|
-
type _ToClasses<T extends AnyObject> = {
|
3950
|
-
[K in keyof T]: _ToClass<T[K]>;
|
3951
|
-
};
|
3952
|
-
|
3953
|
-
/**
|
3954
|
-
* @internal
|
3955
|
-
* This method must go from an instance to a static side we know nothing about.
|
3956
|
-
* This means its inherently lossy and full of assumptions.
|
3957
|
-
* This is to support old configuration styles relatively gracefully.
|
3958
|
-
*/
|
3959
|
-
type _ToClass<T> = T extends AnyConstructor
|
3960
|
-
? T
|
3961
|
-
: T extends TypeDataModel<infer Schema, infer Parent, infer BaseData, infer DerivedData>
|
3962
|
-
? TypeDataModel.ConfigurationFailureClass &
|
3963
|
-
(abstract new (...args: any[]) => T) &
|
3964
|
-
typeof TypeDataModel<Schema, Parent, BaseData, DerivedData>
|
3965
|
-
: T extends DataModel<infer Schema, infer Parent, infer ExtraConstructorOptions>
|
3966
|
-
? TypeDataModel.ConfigurationFailureClass &
|
3967
|
-
(abstract new (...args: any[]) => T) &
|
3968
|
-
typeof DataModel<Schema, Parent, ExtraConstructorOptions>
|
3969
|
-
: TypeDataModel.ConfigurationFailureClass;
|
3970
|
-
|
3971
|
-
/**
|
3972
|
-
* Get the configured core and system type names for a specific document type.
|
3973
|
-
* @typeParam ConcreteDocument - the type of the Document this data is for
|
3974
|
-
* @deprecated Use the Game.Model namespace instead of TypeDataField
|
3975
|
-
*/
|
3976
|
-
type TypeNames<ConcreteDocument extends Document.SystemConstructor> = Game.Model.TypeNames<
|
3977
|
-
ConcreteDocument["metadata"]["name"]
|
3978
|
-
>;
|
3979
|
-
|
3980
|
-
/**
|
3981
|
-
* Get the core type names for a specific document type.
|
3982
|
-
* @typeParam DocumentType - the type of the Document this data is for
|
3983
|
-
* @deprecated Use `DocumentType["metadata"]["coreTypes"][number]`
|
3984
|
-
*/
|
3985
|
-
type CoreTypeNames<DocumentType extends Document.SystemConstructor> = DocumentType["metadata"]["coreTypes"][number];
|
3986
|
-
|
3987
4056
|
/**
|
3988
4057
|
* A shorthand for the assignment type of a TypeDataField class.
|
3989
4058
|
* @typeParam DocumentType - the type of the embedded Document
|
@@ -3991,8 +4060,8 @@ declare namespace TypeDataField {
|
|
3991
4060
|
*/
|
3992
4061
|
type AssignmentType<
|
3993
4062
|
SystemDocumentConstructor extends Document.SystemConstructor,
|
3994
|
-
Opts extends Options<
|
3995
|
-
> = DataField.DerivedAssignmentType<AnyObject, MergedOptions<
|
4063
|
+
Opts extends Options<SystemDocumentConstructor>,
|
4064
|
+
> = DataField.DerivedAssignmentType<AnyObject, MergedOptions<SystemDocumentConstructor, Opts>>;
|
3996
4065
|
|
3997
4066
|
/**
|
3998
4067
|
* A shorthand for the initialized type of a TypeDataField class.
|
@@ -4001,23 +4070,16 @@ declare namespace TypeDataField {
|
|
4001
4070
|
*/
|
4002
4071
|
type InitializedType<
|
4003
4072
|
SystemDocumentConstructor extends Document.SystemConstructor,
|
4004
|
-
Opts extends Options<
|
4073
|
+
Opts extends Options<SystemDocumentConstructor>,
|
4005
4074
|
> = DataField.DerivedInitializedType<
|
4006
|
-
|
4007
|
-
MergedOptions<
|
4075
|
+
_Instances<DataModelsFor<SystemDocumentConstructor["metadata"]["name"]>> | Document.UnknownSystem,
|
4076
|
+
MergedOptions<SystemDocumentConstructor, Opts>
|
4008
4077
|
>;
|
4009
4078
|
|
4010
|
-
/**
|
4011
|
-
|
4012
|
-
|
4013
|
-
|
4014
|
-
*
|
4015
|
-
* `UnknownSourceData` covers the case where it's configured without a data model.
|
4016
|
-
* See {@link UnknownSystem | `UnknownSystem`} for other possibilities.
|
4017
|
-
*/
|
4018
|
-
interface UnknownSourceData extends AnyObject {
|
4019
|
-
type: `${string}.${string}`;
|
4020
|
-
}
|
4079
|
+
/** @internal */
|
4080
|
+
type _Instances<T> = {
|
4081
|
+
[K in keyof T]: T[K] extends (abstract new (...args: never) => infer U extends DataModel.Any) ? U : never;
|
4082
|
+
}[keyof T];
|
4021
4083
|
|
4022
4084
|
/**
|
4023
4085
|
* With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
|
@@ -4029,50 +4091,35 @@ declare namespace TypeDataField {
|
|
4029
4091
|
*/
|
4030
4092
|
interface UnknownTypeDataModel extends TypeDataModel<any, any, any, any> {}
|
4031
4093
|
|
4032
|
-
/**
|
4033
|
-
* With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
|
4034
|
-
*
|
4035
|
-
* `UnknownDataModel` covers the case where it's configured with a {@link DataModel | `DataModel`}.
|
4036
|
-
* Using a {@link TypeDataModel | `TypeDataModel`} is recommended by Foundry but a {@link DataModel | `DataModel`} is
|
4037
|
-
* always possible.
|
4038
|
-
* See {@link UnknownSystem | `UnknownSystem`} for other possibilities.
|
4039
|
-
*/
|
4040
|
-
interface UnknownDataModel extends DataModel<any, any, any> {}
|
4041
|
-
|
4042
|
-
/**
|
4043
|
-
* With the existence of custom module subtypes a system can no longer rely on their configured types being the only ones.
|
4044
|
-
*/
|
4045
|
-
type UnknownSystem = UnknownSourceData | UnknownTypeDataModel | UnknownDataModel;
|
4046
|
-
|
4047
4094
|
/**
|
4048
4095
|
* A shorthand for the persisted type of a TypeDataField class.
|
4049
4096
|
* @typeParam DocumentType - the type of the embedded Document
|
4050
4097
|
* @typeParam Opts - the options that override the default options
|
4051
4098
|
*/
|
4052
4099
|
type PersistedType<
|
4053
|
-
|
4054
|
-
Opts extends Options<
|
4055
|
-
> = DataField.DerivedInitializedType<AnyObject, MergedOptions<
|
4100
|
+
ConcreteDocument extends Document.SystemConstructor,
|
4101
|
+
Opts extends Options<ConcreteDocument>,
|
4102
|
+
> = DataField.DerivedInitializedType<AnyObject, MergedOptions<ConcreteDocument, Opts>>;
|
4056
4103
|
}
|
4057
4104
|
|
4058
4105
|
/**
|
4059
|
-
* A subclass of
|
4106
|
+
* A subclass of {@link DataField | `DataField`} which allows to typed schemas.
|
4060
4107
|
*/
|
4061
4108
|
declare class TypedSchemaField<
|
4062
4109
|
const Types extends TypedSchemaField.Types,
|
4063
|
-
const Options extends TypedSchemaField.
|
4110
|
+
const Options extends TypedSchemaField.Options<Types> = TypedSchemaField.DefaultOptions,
|
4064
4111
|
const AssignmentType = TypedSchemaField.AssignmentType<Types, Options>,
|
4065
4112
|
const InitializedType = TypedSchemaField.InitializedType<Types, Options>,
|
4066
|
-
const PersistedType
|
4113
|
+
const PersistedType = TypedSchemaField.PersistedType<Types, Options>,
|
4067
4114
|
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
4068
4115
|
/**
|
4069
4116
|
* @param types - The different types this field can represent.
|
4070
4117
|
* @param options - Options which configure the behavior of the field
|
4071
4118
|
* @param context - Additional context which describes the field
|
4072
4119
|
*/
|
4073
|
-
constructor(types: Types, options
|
4120
|
+
constructor(types: Types, options?: Options, context?: DataField.Context);
|
4074
4121
|
|
4075
|
-
static get _defaults():
|
4122
|
+
static get _defaults(): DataField.Options.Any;
|
4076
4123
|
|
4077
4124
|
/**
|
4078
4125
|
* The types of this field.
|
@@ -4106,6 +4153,8 @@ declare class TypedSchemaField<
|
|
4106
4153
|
}
|
4107
4154
|
|
4108
4155
|
declare namespace TypedSchemaField {
|
4156
|
+
interface Options<T extends Types> extends DataField.Options<_AssignmentType<ToConfiguredTypes<T>>> {}
|
4157
|
+
|
4109
4158
|
type DefaultOptions = SimpleMerge<
|
4110
4159
|
DataField.DefaultOptions,
|
4111
4160
|
{
|
@@ -4113,31 +4162,36 @@ declare namespace TypedSchemaField {
|
|
4113
4162
|
}
|
4114
4163
|
>;
|
4115
4164
|
|
4116
|
-
|
4117
|
-
|
4118
|
-
|
4119
|
-
|
4120
|
-
|
4121
|
-
|
4122
|
-
|
4123
|
-
|
4124
|
-
|
4125
|
-
|
4165
|
+
/**
|
4166
|
+
* A `ValidDataSchema` must pass the checks in `#configureTypes`. Namely:
|
4167
|
+
* - No `name` property.
|
4168
|
+
* - No `parent`.
|
4169
|
+
*
|
4170
|
+
* Additionally the `type` property (if any):
|
4171
|
+
* - Must be a `StringField`.
|
4172
|
+
* - Must be `required`
|
4173
|
+
* - Must not be `nullable`.
|
4174
|
+
* - Must not be `blank`.
|
4175
|
+
* - Must allow the corresponding type as a valid value.
|
4176
|
+
*/
|
4126
4177
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
4127
4178
|
type ValidDataSchema = {
|
4128
|
-
readonly [field: string]:
|
4179
|
+
readonly [field: string]: DataField.Any;
|
4129
4180
|
};
|
4130
4181
|
|
4131
4182
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
4132
4183
|
type Types = {
|
4133
4184
|
[type: string]:
|
4134
4185
|
| ValidDataSchema
|
4135
|
-
| SchemaField<
|
4136
|
-
| typeof DataModel<
|
4186
|
+
| SchemaField<DataSchema, { required: true; nullable: false }, any, any, any>
|
4187
|
+
| typeof DataModel<DataSchema, null>;
|
4137
4188
|
};
|
4138
4189
|
|
4139
4190
|
type ToConfiguredTypes<Types extends TypedSchemaField.Types> = {
|
4140
|
-
[K in keyof Types]:
|
4191
|
+
[K in keyof Types]:
|
4192
|
+
| (Types[K] extends ValidDataSchema ? SchemaField<Types[K]> : never)
|
4193
|
+
| (Types[K] extends SchemaField.Any ? Types[K] : never)
|
4194
|
+
| (Types[K] extends DataModel.AnyConstructor ? EmbeddedDataField<Types[K]> : never);
|
4141
4195
|
};
|
4142
4196
|
|
4143
4197
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
@@ -4149,37 +4203,37 @@ declare namespace TypedSchemaField {
|
|
4149
4203
|
* @internal
|
4150
4204
|
*/
|
4151
4205
|
type _AssignmentType<Types extends ConfiguredTypes> = {
|
4152
|
-
[K in keyof Types]: DataField.AssignmentTypeFor<Types[K]
|
4206
|
+
[K in keyof Types]: DataField.AssignmentTypeFor<Types[K]> & { type: K };
|
4153
4207
|
}[keyof Types];
|
4154
4208
|
|
4155
4209
|
type AssignmentType<
|
4156
4210
|
Types extends TypedSchemaField.Types,
|
4157
|
-
Options extends TypedSchemaField.
|
4211
|
+
Options extends TypedSchemaField.Options<Types>,
|
4158
4212
|
> = DataField.DerivedAssignmentType<_AssignmentType<ToConfiguredTypes<Types>>, Options>;
|
4159
4213
|
|
4160
4214
|
/**
|
4161
4215
|
* @internal
|
4162
4216
|
*/
|
4163
4217
|
type _InitializedType<Types extends ConfiguredTypes> = {
|
4164
|
-
[K in keyof Types]: DataField.InitializedTypeFor<Types[K]
|
4218
|
+
[K in keyof Types]: DataField.InitializedTypeFor<Types[K]> & { type: K };
|
4165
4219
|
}[keyof Types];
|
4166
4220
|
|
4167
4221
|
type InitializedType<
|
4168
4222
|
Types extends TypedSchemaField.Types,
|
4169
|
-
Options extends TypedSchemaField.
|
4223
|
+
Options extends TypedSchemaField.Options<Types>,
|
4170
4224
|
> = DataField.DerivedInitializedType<_InitializedType<ToConfiguredTypes<Types>>, Options>;
|
4171
4225
|
|
4172
4226
|
/**
|
4173
4227
|
* @internal
|
4174
4228
|
*/
|
4175
4229
|
type _PersistedType<Types extends ConfiguredTypes> = {
|
4176
|
-
[K in keyof Types]: DataField.PersistedTypeFor<Types[K]
|
4230
|
+
[K in keyof Types]: DataField.PersistedTypeFor<Types[K]> & { type: K };
|
4177
4231
|
}[keyof Types];
|
4178
4232
|
|
4179
4233
|
type PersistedType<
|
4180
4234
|
Types extends TypedSchemaField.Types,
|
4181
|
-
|
4182
|
-
> = DataField.DerivedInitializedType<_PersistedType<ToConfiguredTypes<Types>>,
|
4235
|
+
Options extends TypedSchemaField.Options<Types>,
|
4236
|
+
> = DataField.DerivedInitializedType<_PersistedType<ToConfiguredTypes<Types>>, Options>;
|
4183
4237
|
}
|
4184
4238
|
|
4185
4239
|
/**
|
@@ -4187,6 +4241,7 @@ declare namespace TypedSchemaField {
|
|
4187
4241
|
* @typeParam Errors - the type of the errors contained in this error
|
4188
4242
|
*/
|
4189
4243
|
declare class ModelValidationError<
|
4244
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
4190
4245
|
Errors extends ModelValidationError.Errors = ModelValidationError.Errors,
|
4191
4246
|
> extends Error {
|
4192
4247
|
/**
|
@@ -4202,6 +4257,7 @@ declare class ModelValidationError<
|
|
4202
4257
|
* @param errors - The raw error structure
|
4203
4258
|
* @returns A formatted error message
|
4204
4259
|
*/
|
4260
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
4205
4261
|
static formatErrors(errors: ModelValidationError.Errors): string;
|
4206
4262
|
}
|
4207
4263
|
|
@@ -4228,7 +4284,7 @@ declare class _InternalJavaScriptField<
|
|
4228
4284
|
}
|
4229
4285
|
|
4230
4286
|
/**
|
4231
|
-
* A subclass of {@link StringField} which contains JavaScript code.
|
4287
|
+
* A subclass of {@link StringField | `StringField`} which contains JavaScript code.
|
4232
4288
|
*/
|
4233
4289
|
declare class JavaScriptField<
|
4234
4290
|
const Options extends JavaScriptField.Options = JavaScriptField.DefaultOptions,
|
@@ -4255,7 +4311,7 @@ declare class JavaScriptField<
|
|
4255
4311
|
|
4256
4312
|
declare namespace JavaScriptField {
|
4257
4313
|
// TODO(LukeAbby): `choices` is effectively deleted due to being unconditionally set to `undefined` in the constructor.
|
4258
|
-
type Options =
|
4314
|
+
type Options = StringField.Options & {
|
4259
4315
|
/**
|
4260
4316
|
* Does the field allow async code?
|
4261
4317
|
* @defaultValue `false`
|
@@ -4264,7 +4320,7 @@ declare namespace JavaScriptField {
|
|
4264
4320
|
};
|
4265
4321
|
|
4266
4322
|
type DefaultOptions = SimpleMerge<
|
4267
|
-
|
4323
|
+
StringField.Options,
|
4268
4324
|
{
|
4269
4325
|
async: false;
|
4270
4326
|
}
|