@league-of-foundry-developers/foundry-vtt-types 0.8.9-4 → 0.8.9-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +41 -13
  2. package/index-lenient.d.ts +10 -0
  3. package/package.json +10 -1
  4. package/src/foundry/common/abstract/backend.mjs.d.ts +14 -15
  5. package/src/foundry/common/abstract/document.mjs.d.ts +6 -2
  6. package/src/foundry/common/data/data.mjs/drawingData.d.ts +8 -3
  7. package/src/foundry/common/data/data.mjs/index.d.ts +2 -0
  8. package/src/foundry/common/data/data.mjs/playlistData.d.ts +171 -0
  9. package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +143 -0
  10. package/src/foundry/common/data/fields.mjs.d.ts +2 -2
  11. package/src/foundry/common/documents.mjs/basePlaylist.d.ts +11 -1
  12. package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +21 -2
  13. package/src/foundry/common/types.mjs.d.ts +5 -0
  14. package/src/foundry/foundry.js/application.d.ts +2 -5
  15. package/src/foundry/foundry.js/applications/cameraViews.d.ts +36 -31
  16. package/src/foundry/foundry.js/applications/compendium.d.ts +5 -2
  17. package/src/foundry/foundry.js/applications/filePicker.d.ts +114 -114
  18. package/src/foundry/foundry.js/applications/formApplication.d.ts +3 -11
  19. package/src/foundry/foundry.js/applications/formApplications/combatTrackerConfig.d.ts +20 -27
  20. package/src/foundry/foundry.js/applications/formApplications/defaultTokenConfig.d.ts +66 -0
  21. package/src/foundry/foundry.js/applications/formApplications/documentSheet.d.ts +1 -1
  22. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +2 -2
  23. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +5 -2
  24. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientSoundConfig.d.ts +57 -0
  25. package/src/foundry/foundry.js/applications/formApplications/{folderConfig.d.ts → documentSheets/folderConfig.d.ts} +2 -2
  26. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +7 -0
  27. package/src/foundry/foundry.js/applications/formApplications/documentSheets/lightConfig.d.ts +84 -0
  28. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +60 -0
  29. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +72 -0
  30. package/src/foundry/foundry.js/applications/formApplications/documentSheets/permissionControl.d.ts +54 -60
  31. package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistConfig.d.ts +41 -28
  32. package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistSoundConfig.d.ts +75 -0
  33. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +190 -148
  34. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +133 -110
  35. package/src/foundry/foundry.js/applications/formApplications/documentSheets/tileConfig.d.ts +66 -0
  36. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +93 -95
  37. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +163 -147
  38. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -7
  39. package/src/foundry/foundry.js/applications/formApplications/moduleManagement.d.ts +41 -23
  40. package/src/foundry/foundry.js/applications/formApplications/settingsConfig.d.ts +95 -86
  41. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +146 -158
  42. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +60 -70
  43. package/src/foundry/foundry.js/applications/formApplications/worldConfig.d.ts +25 -17
  44. package/src/foundry/foundry.js/applications/headsUpDisplay.d.ts +11 -5
  45. package/src/foundry/foundry.js/applications/hotbar.d.ts +5 -4
  46. package/src/foundry/foundry.js/applications/sceneControls.d.ts +13 -3
  47. package/src/foundry/foundry.js/applications/sceneNavigation.d.ts +90 -71
  48. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/actorDirectory.d.ts +13 -56
  49. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/itemDirectory.d.ts +7 -30
  50. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/journalDirectory.d.ts +14 -34
  51. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/macroDirectory.d.ts +6 -52
  52. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/playlistDirectory.d.ts +249 -139
  53. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/sceneDirectory.d.ts +6 -23
  54. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +3 -5
  55. package/src/foundry/foundry.js/cameraPopoutAppWrapper.d.ts +12 -7
  56. package/src/foundry/foundry.js/canvas.d.ts +2 -1
  57. package/src/foundry/foundry.js/clientDatabaseBackend.d.ts +210 -0
  58. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +1 -1
  59. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/index.d.ts +8 -0
  60. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/tokenDocument.d.ts +1 -1
  61. package/src/foundry/foundry.js/clientDocuments/index.d.ts +19 -0
  62. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +195 -6
  63. package/src/foundry/foundry.js/clientDocuments/playlistSound.d.ts +113 -0
  64. package/src/foundry/foundry.js/clientDocuments/prototypeToken.d.ts +15 -0
  65. package/src/foundry/foundry.js/clientSettings.d.ts +14 -1
  66. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +44 -8
  67. package/src/foundry/foundry.js/config.d.ts +85 -71
  68. package/src/foundry/foundry.js/dragDrop.d.ts +17 -14
  69. package/src/foundry/foundry.js/globalVariables.d.ts +7 -4
  70. package/src/foundry/foundry.js/mouseInteractionManager.d.ts +78 -34
  71. package/src/foundry/foundry.js/pixi/containers/canvasLayer.d.ts +2 -1
  72. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayer.d.ts +10 -19
  73. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/backgroundLayer.d.ts +6 -2
  74. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/mapLayers/foregroundLayer.d.ts +2 -2
  75. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +1 -1
  76. package/src/foundry/foundry.js/pixi/containers/doorControl.d.ts +53 -35
  77. package/src/foundry/foundry.js/pixi/containers/placeableObject.d.ts +6 -2
  78. package/src/foundry/foundry.js/pixi/containers/placeableObjects/ambientLight.d.ts +38 -40
  79. package/src/foundry/foundry.js/pixi/containers/placeableObjects/ambientSound.d.ts +56 -56
  80. package/src/foundry/foundry.js/pixi/containers/placeableObjects/note.d.ts +9 -50
  81. package/src/foundry/foundry.js/pixi/containers/placeableObjects/tile.d.ts +166 -47
  82. package/src/foundry/foundry.js/pixi/containers/placeableObjects/wall.d.ts +1 -1
  83. package/src/foundry/foundry.js/pixi/containers/ruler.d.ts +11 -7
  84. package/src/foundry/foundry.js/pixi/graphics/gridHighlight.d.ts +4 -9
  85. package/src/foundry/foundry.js/pointSource.d.ts +173 -85
  86. package/src/foundry/foundry.js/textEditor.d.ts +39 -8
  87. package/src/foundry/index.d.ts +2 -25
  88. package/src/foundry/foundry.js/applications/formApplications/ambientSoundConfig.d.ts +0 -68
  89. package/src/foundry/foundry.js/applications/formApplications/lightConfig.d.ts +0 -98
  90. package/src/foundry/foundry.js/applications/formApplications/measuredTemplateConfig.d.ts +0 -61
  91. package/src/foundry/foundry.js/applications/formApplications/noteConfig.d.ts +0 -77
  92. package/src/foundry/foundry.js/applications/formApplications/playlistSoundConfig.d.ts +0 -70
  93. package/src/foundry/foundry.js/applications/formApplications/tileConfig.d.ts +0 -73
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # foundry-vtt-types
2
2
 
3
-
4
-
5
3
  <div align=center>
6
4
 
7
5
  TypeScript type definitions for [Foundry Virtual Tabletop](https://foundryvtt.com/) (unofficial)
@@ -19,10 +17,16 @@ TypeScript type definitions for [Foundry Virtual Tabletop](https://foundryvtt.co
19
17
 
20
18
  We aim to support the latest patch release of minor versions of Foundry VTT, starting with 0.7.
21
19
 
22
- At the moment, the latest 0.7.x and 0.8.x versions are supported. However, note that work on 0.8.x has not been completed yet, so there are still quite a few things which are either missing or typed incorrectly. Take a look at [0.8.x issues](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues?q=is%3Aopen+is%3Aissue+label%3A%22foundry+0.8.x%22) to see what still needs to be done.
20
+ At the moment, the latest 0.7.x and 0.8.x versions are supported. However, note that work on 0.8.x has not been
21
+ completed yet, so there are still quite a few things which are either missing or typed incorrectly. Take a look at
22
+ [0.8.x issues](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/issues?q=is%3Aopen+is%3Aissue+label%3A%22foundry+0.8.x%22)
23
+ to see what still needs to be done.
24
+
23
25
  ## Installation
24
26
 
25
- You can install foundry-vtt-types from the [npm registry](https://npmjs.org/). We provide distribution tags for the different supported Foundry VTT versions that have the form `fvtt-<foundry-version>`. For example, the distribution tag for Foundry VTT 0.8.8 is `fvtt-0.8.8`.
27
+ You can install foundry-vtt-types from the [npm registry](https://npmjs.org/). We provide distribution tags for the
28
+ different supported Foundry VTT versions that have the form `fvtt-<foundry-version>`. For example, the distribution tag
29
+ for Foundry VTT 0.8.8 is `fvtt-0.8.8`.
26
30
 
27
31
  In order to install the desired version, run
28
32
 
@@ -36,7 +40,8 @@ For example, to install the type definitions for Foundry VTT 0.8.8 run
36
40
  npm install --save-dev @league-of-foundry-developers/foundry-vtt-types@fvtt-0.8.8
37
41
  ```
38
42
 
39
- You can then update foundry-vtt-types using the regular update mechanism for npm (see [npm update](https://docs.npmjs.com/cli/v7/commands/npm-update)).
43
+ You can then update foundry-vtt-types using the regular update mechanism for npm
44
+ (see [npm update](https://docs.npmjs.com/cli/v7/commands/npm-update)).
40
45
 
41
46
  ## Usage
42
47
 
@@ -54,29 +59,42 @@ Add foundry-vtt-types to your types section in your `tsconfig.json`:
54
59
 
55
60
  This will make the type definitions available globally in your project.
56
61
 
57
- Make sure you are using `"moduleResolution": "node"`, too. It is required for some dependencies to be resolved correctly.
62
+ Make sure you are using `"moduleResolution": "node"`, too. It is required for some dependencies to be resolved
63
+ correctly.
58
64
 
59
- Also make sure to set `"strictNullChecks": true` because otherwise, some of the conditional types used in the type definitions resolve incorrectly and you will see a lot of errors.
65
+ Also make sure to set `"strictNullChecks": true` because otherwise, some of the conditional types used in the type
66
+ definitions resolve incorrectly and you will see a lot of errors.
60
67
 
61
- You can find some information about how to actually work with the type definitions in the [Wiki](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki). If you are working with Foundry VTT 0.8.x, a good starting point is [[0.8.x] FAQ](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki/%5B0.8.x%5D-FAQ).
68
+ You can find some information about how to actually work with the type definitions in the
69
+ [Wiki](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki). If you are working with Foundry VTT
70
+ 0.8.x, a good starting point is
71
+ [[0.8.x] FAQ](https://github.com/League-of-Foundry-Developers/foundry-vtt-types/wiki/%5B0.8.x%5D-FAQ).
62
72
 
63
73
  ## Acknowledgments
64
74
 
65
- Originally forked from [Foundry Project Creator Types](https://gitlab.com/foundry-projects/foundry-pc/foundry-pc-types) by [@NickEastNL](https://gitlab.com/NvanOosten)
75
+ Originally forked from [Foundry Project Creator Types](https://gitlab.com/foundry-projects/foundry-pc/foundry-pc-types)
76
+ by [@NickEastNL](https://gitlab.com/NvanOosten)
66
77
 
67
78
  ## Contributing
68
79
 
69
- Contributions are very welcome in order to decrease the individual workload. Filing issues for wrong / missing types is also a great way to help us improve the type definitions.
80
+ Contributions are very welcome in order to decrease the individual workload. Filing issues for wrong / missing types is
81
+ also a great way to help us improve the type definitions.
70
82
 
71
- There are individual branches for the different supported Foundry VTT versions that are being worked on. They are named according to the minor version of the Foundry VTT version, e.g. the branch for Foundry VTT 0.8 is called `foundry-0.8.x`. All work to improve the type definitions for a specific version needs to be done through Pull Requests to the corresponding branch.
83
+ There are individual branches for the different supported Foundry VTT versions that are being worked on. They are named
84
+ according to the minor version of the Foundry VTT version, e.g. the branch for Foundry VTT 0.8 is called
85
+ `foundry-0.8.x`. All work to improve the type definitions for a specific version needs to be done through Pull Requests
86
+ to the corresponding branch.
72
87
 
73
88
  Please read [CONTRIBUTING.md](CONTRIBUTING.md) for more details on how to contribute.
74
89
 
75
- If you have any specific questions, feel free to contact us in the [League of Extraordinary Foundry Developers Discord](https://discord.gg/52DNPzqm2Z).
90
+ If you have any specific questions, feel free to contact us in the
91
+ [League of Extraordinary Foundry Developers Discord](https://discord.gg/52DNPzqm2Z).
76
92
 
77
93
  ## Type-Checking, Linting, Testing
78
94
 
79
- When contributing, make sure sure that the type checks pass, the linter is green and the tests are green. We _do_ have checks in the CI but running this locally also helps you while developing and saves you time as you don't have to wait for the CI.
95
+ When contributing, make sure sure that the type checks pass, the linter is green and the tests are green. We _do_ have
96
+ checks in the CI but running this locally also helps you while developing and saves you time as you don't have to wait
97
+ for the CI.
80
98
 
81
99
  You can run type checking and linting with the following command:
82
100
 
@@ -90,6 +108,16 @@ You can run the tests with
90
108
  npm run test
91
109
  ```
92
110
 
111
+ ## Creating a release
112
+
113
+ To create a release, you have to create a new release commit, tag it and create a GitHub release from that. The CI will
114
+ handle the rest.
115
+
116
+ ```
117
+ npm version prerelease
118
+ git push --follow-tags
119
+ ```
120
+
93
121
  ## License
94
122
 
95
123
  This project is licensed under the MIT license. You can find a copy at [LICENSE](LICENSE).
@@ -0,0 +1,10 @@
1
+ import './index';
2
+
3
+ declare global {
4
+ interface LenientGlobalVariableTypes {
5
+ canvas: never;
6
+ game: never;
7
+ socket: never;
8
+ ui: never;
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@league-of-foundry-developers/foundry-vtt-types",
3
- "version": "0.8.9-4",
3
+ "version": "0.8.9-8",
4
4
  "description": "TypeScript type definitions for Foundry VTT",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./index.d.ts"
8
+ },
9
+ "./lenient": {
10
+ "types": "./index-lenient.d.ts"
11
+ }
12
+ },
5
13
  "scripts": {
6
14
  "lint": "./node_modules/typescript/bin/tsc && eslint --ext .d.ts,.test-d.ts .",
7
15
  "lint:fix": "eslint --fix --ext .d.ts,.test-d.ts .",
@@ -60,6 +68,7 @@
60
68
  },
61
69
  "files": [
62
70
  "index.d.ts",
71
+ "index-lenient.d.ts",
63
72
  "src"
64
73
  ],
65
74
  "publishConfig": {
@@ -27,22 +27,28 @@ declare abstract class DatabaseBackend {
27
27
 
28
28
  /**
29
29
  * Get primary Document instances
30
+ * @remarks
31
+ * foundry actually declares this function to take parameters `documentClass`, `query`, `options`, and `user` but
32
+ * that's not how it is called and also not how the subclasses implement it.
33
+ * See https://gitlab.com/foundrynet/foundryvtt/-/issues/6177
30
34
  */
31
35
  protected abstract _getDocuments<T extends Document<any, any>>(
32
36
  documentClass: ConstructorOf<T>,
33
- query: Request,
34
- options: RequestOptions,
37
+ request: Request,
35
38
  user: BaseUser
36
39
  ): Promise<T[]>;
37
40
 
38
41
  /**
39
42
  * Get embedded Document instances
43
+ * @remarks
44
+ * foundry actually declares this function to take parameters `documentClass`, `parent`, `query`, `options`, and
45
+ * `user` but that's not how it is called and also not how the subclasses implement it.
46
+ * See https://gitlab.com/foundrynet/foundryvtt/-/issues/6177
40
47
  */
41
48
  protected abstract _getEmbeddedDocuments<T extends Document<any, any>>(
42
49
  documentClass: ConstructorOf<T>,
43
50
  parent: T extends Document<any, infer U> ? U : never,
44
- query: Request,
45
- options: RequestOptions,
51
+ request: Request,
46
52
  user: BaseUser
47
53
  ): Promise<T[]>;
48
54
 
@@ -198,7 +204,8 @@ declare abstract class DatabaseBackend {
198
204
  * @param action - The action performed
199
205
  * @param type - The document type
200
206
  * @param documents - The documents modified
201
- * @param info - The logging level
207
+ * @param level - The logging level
208
+ * (default: `'info'`)
202
209
  * @param parent - A parent document
203
210
  * @param pack - A compendium pack within which the operation occurred
204
211
  */
@@ -225,24 +232,16 @@ declare abstract class DatabaseBackend {
225
232
  protected _logContext({ parent, pack }?: { parent?: Document<any, any>; pack?: string }): string;
226
233
  }
227
234
 
228
- interface Request {
235
+ export interface Request {
229
236
  data?: AnyDocumentData[];
230
237
  updates?: AnyDocumentData[];
231
238
  ids?: string[];
232
239
  parent?: Document<any, any>;
233
- query?: object | IdQuery | SceneIdUserQuery;
240
+ query?: Record<string, unknown>;
234
241
  options?: RequestOptions;
235
242
  pack?: string;
236
243
  }
237
244
 
238
- export interface IdQuery {
239
- _id: string;
240
- }
241
- export interface SceneIdUserQuery {
242
- sceneId: string;
243
- user: string;
244
- }
245
-
246
245
  export interface RequestOptions {
247
246
  index?: boolean;
248
247
  broadcast?: boolean;
@@ -1,5 +1,4 @@
1
1
  import { BaseUser } from '../documents.mjs';
2
- import DatabaseBackend from './backend.mjs';
3
2
  import { AnyDocumentData } from './data.mjs';
4
3
  import {
5
4
  ConfiguredDocumentClass,
@@ -82,7 +81,7 @@ declare abstract class Document<
82
81
  /**
83
82
  * The database backend used to execute operations and handle results
84
83
  */
85
- static get database(): DatabaseBackend; // TODO: Reference type defined in CONFIG
84
+ static get database(): CONFIG['DatabaseBackend'];
86
85
 
87
86
  /**
88
87
  * Return a reference to the implemented subclass of this base document type.
@@ -703,6 +702,11 @@ export interface DocumentModificationOptions {
703
702
  */
704
703
  index?: boolean;
705
704
 
705
+ /**
706
+ * An array of fields to retrieve when indexing the collection
707
+ */
708
+ indexFields?: string[];
709
+
706
710
  /**
707
711
  * When performing a creation operation, keep the provided _id instead of clearing it.
708
712
  * @defaultValue `false`
@@ -3,7 +3,12 @@ import { BaseUser } from '../../documents.mjs';
3
3
  import { ForeignDocumentField } from '../fields.mjs';
4
4
  import * as fields from '../fields.mjs';
5
5
  import * as documents from '../../documents.mjs';
6
- import { ConfiguredDocumentClass, FieldReturnType, PropertiesToSource } from '../../../../types/helperTypes';
6
+ import {
7
+ ConfiguredDocumentClass,
8
+ ConfiguredFlags,
9
+ FieldReturnType,
10
+ PropertiesToSource
11
+ } from '../../../../types/helperTypes';
7
12
 
8
13
  interface DrawingDataSchema extends DocumentSchema {
9
14
  _id: typeof fields.DOCUMENT_ID;
@@ -211,7 +216,7 @@ interface DrawingDataProperties {
211
216
  * An object of optional key/value flags
212
217
  * @defaultValue `{}`
213
218
  */
214
- flags: Record<string, unknown>;
219
+ flags: ConfiguredFlags<'Drawing'>;
215
220
  }
216
221
 
217
222
  interface DrawingDataConstructorData {
@@ -365,7 +370,7 @@ interface DrawingDataConstructorData {
365
370
  * An object of optional key/value flags
366
371
  * @defaultValue `{}`
367
372
  */
368
- flags?: Record<string, unknown> | null;
373
+ flags?: ConfiguredFlags<'Drawing'> | null;
369
374
  }
370
375
 
371
376
  /**
@@ -13,6 +13,8 @@ export { JournalEntryData } from './journalEntryData';
13
13
  export { MacroData } from './macroData';
14
14
  export { MeasuredTemplateData } from './measuredTemplateData';
15
15
  export { NoteData } from './noteData';
16
+ export { PlaylistData } from './playlistData';
17
+ export { PlaylistSoundData } from './playlistSoundData';
16
18
  export { PrototypeTokenData } from './prototypeTokenData';
17
19
  export { RollTableData } from './rollTableData';
18
20
  export { SceneData } from './sceneData';
@@ -0,0 +1,171 @@
1
+ import * as documents from '../../documents.mjs';
2
+ import * as fields from '../fields.mjs';
3
+
4
+ import type { ConfiguredDocumentClass, ConfiguredFlags, PropertiesToSource } from '../../../../types/helperTypes';
5
+ import type EmbeddedCollection from '../../abstract/embedded-collection.mjs';
6
+ import type DocumentData from '../../abstract/data.mjs';
7
+
8
+ interface PlaylistDataSchema extends DocumentSchema {
9
+ _id: typeof fields.DOCUMENT_ID;
10
+ name: typeof fields.REQUIRED_STRING;
11
+ description: typeof fields.BLANK_STRING;
12
+ sounds: fields.EmbeddedCollectionField<typeof documents.BasePlaylistSound>;
13
+ mode: DocumentField<foundry.CONST.PlaylistMode> & {
14
+ type: typeof Number;
15
+ required: true;
16
+ default: typeof CONST.PLAYLIST_MODES.SEQUENTIAL;
17
+ validate: (m: unknown) => m is foundry.CONST.PlaylistMode;
18
+ validationError: 'Invalid {name} {field} provided which must be a value from CONST.PLAYLIST_MODES';
19
+ };
20
+ playing: typeof fields.BOOLEAN_FIELD;
21
+ fade: typeof fields.INTEGER_FIELD;
22
+ folder: fields.ForeignDocumentField<{ type: typeof documents.BaseFolder }>;
23
+ sort: typeof fields.INTEGER_SORT_FIELD;
24
+ seed: typeof fields.NONNEGATIVE_INTEGER_FIELD;
25
+ permission: typeof fields.DOCUMENT_PERMISSIONS;
26
+ flags: typeof fields.OBJECT_FIELD;
27
+ }
28
+
29
+ interface PlaylistDataProperties {
30
+ /**
31
+ * The _id which uniquely identifies this Playlist document
32
+ */
33
+ _id: string | null;
34
+
35
+ /**
36
+ * The name of this playlist
37
+ */
38
+ name: string;
39
+
40
+ /**
41
+ * @defaultValue `''`
42
+ */
43
+ description: string;
44
+
45
+ /**
46
+ * A Collection of PlaylistSounds embedded documents which belong to this playlist
47
+ */
48
+ sounds: EmbeddedCollection<ConfiguredDocumentClass<typeof documents.BasePlaylistSound>, PlaylistData>;
49
+
50
+ /**
51
+ * The playback mode for sounds in this playlist
52
+ * @defaultValue `CONST.PLAYLIST_MODES.SEQUENTIAL`
53
+ */
54
+ mode: foundry.CONST.PlaylistMode;
55
+
56
+ /**
57
+ * Is this playlist currently playing?
58
+ * @defaultValue `false`
59
+ */
60
+ playing: boolean;
61
+
62
+ fade: number | undefined;
63
+
64
+ /**
65
+ * The _id of a Folder which contains this playlist
66
+ * @defaultValue `null`
67
+ */
68
+ folder: string | null;
69
+
70
+ /**
71
+ * The numeric sort value which orders this playlist relative to its siblings
72
+ * @defaultValue `0`
73
+ */
74
+ sort: number;
75
+
76
+ seed: number | undefined;
77
+
78
+ /**
79
+ * An object which configures user permissions to this playlist
80
+ * @defaultValue `{ default: CONST.ENTITY_PERMISSIONS.NONE }`
81
+ */
82
+ permission: Record<string, foundry.CONST.EntityPermission>;
83
+
84
+ /**
85
+ * An object of optional key/value flags
86
+ * @defaultValue `{}`
87
+ */
88
+ flags: ConfiguredFlags<'Playlist'>;
89
+ }
90
+
91
+ interface PlaylistDataConstructorData {
92
+ /**
93
+ * The _id which uniquely identifies this Playlist document
94
+ */
95
+ _id?: string | null | undefined;
96
+
97
+ /**
98
+ * The name of this playlist
99
+ */
100
+ name: string;
101
+
102
+ /**
103
+ * @defaultValue `''`
104
+ */
105
+ description?: string | null | undefined;
106
+
107
+ /**
108
+ * A Collection of PlaylistSounds embedded documents which belong to this playlist
109
+ */
110
+ sounds?:
111
+ | EmbeddedCollection<ConfiguredDocumentClass<typeof documents.BasePlaylistSound>, PlaylistData>
112
+ | null
113
+ | undefined;
114
+
115
+ /**
116
+ * The playback mode for sounds in this playlist
117
+ * @defaultValue `CONST.PLAYLIST_MODES.SEQUENTIAL`
118
+ */
119
+ mode?: foundry.CONST.PlaylistMode | null | undefined;
120
+
121
+ /**
122
+ * Is this playlist currently playing?
123
+ * @defaultValue `false`
124
+ */
125
+ playing?: boolean | null | undefined;
126
+
127
+ fade?: number | undefined | null;
128
+
129
+ /**
130
+ * The _id of a Folder which contains this playlist
131
+ * @defaultValue `null`
132
+ */
133
+ folder?: string | null | undefined;
134
+
135
+ /**
136
+ * The numeric sort value which orders this playlist relative to its siblings
137
+ * @defaultValue `0`
138
+ */
139
+ sort?: number | null | undefined;
140
+
141
+ seed?: number | undefined | null;
142
+
143
+ /**
144
+ * An object which configures user permissions to this playlist
145
+ * @defaultValue `{ default: CONST.ENTITY_PERMISSIONS.NONE }`
146
+ */
147
+ permission?: Record<string, foundry.CONST.EntityPermission> | undefined | null;
148
+
149
+ /**
150
+ * An object of optional key/value flags
151
+ * @defaultValue `{}`
152
+ */
153
+ flags?: ConfiguredFlags<'Playlist'> | null | undefined;
154
+ }
155
+
156
+ /**
157
+ * The data schema for a Playlist document.
158
+ * @see BasePlaylist
159
+ */
160
+ export declare class PlaylistData extends DocumentData<
161
+ PlaylistDataSchema,
162
+ PlaylistDataProperties,
163
+ PropertiesToSource<PlaylistDataProperties>,
164
+ PlaylistDataConstructorData,
165
+ documents.BasePlaylist
166
+ > {
167
+ static defineSchema(): PlaylistDataSchema;
168
+ }
169
+
170
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
171
+ export interface PlaylistData extends PlaylistDataProperties {}
@@ -0,0 +1,143 @@
1
+ import * as fields from '../fields.mjs';
2
+ import type { ConfiguredFlags, FieldReturnType, PropertiesToSource } from '../../../../types/helperTypes';
3
+ import type DocumentData from '../../abstract/data.mjs';
4
+ import type { documents } from '../../module.mjs';
5
+
6
+ interface PlaylistSoundDataSchema extends DocumentSchema {
7
+ _id: typeof fields.DOCUMENT_ID;
8
+ name: typeof fields.REQUIRED_STRING;
9
+ description: typeof fields.BLANK_STRING;
10
+ path: typeof fields.AUDIO_FIELD;
11
+ playing: typeof fields.BOOLEAN_FIELD;
12
+ pausedTime: FieldReturnType<typeof fields.NUMERIC_FIELD, { default: null }>;
13
+ repeat: typeof fields.BOOLEAN_FIELD;
14
+ volume: FieldReturnType<typeof fields.ALPHA_FIELD, { default: 0.5 }>;
15
+ fade: typeof fields.INTEGER_FIELD;
16
+ flags: typeof fields.OBJECT_FIELD;
17
+ }
18
+
19
+ interface PlaylistSoundDataProperties {
20
+ /**
21
+ * The _id which uniquely identifies this PlaylistSound document
22
+ */
23
+ _id: string | null;
24
+
25
+ /**
26
+ * The name of this sound track
27
+ */
28
+ name: string;
29
+
30
+ /**
31
+ * @defaultValue `''`
32
+ */
33
+ description: string;
34
+
35
+ /**
36
+ * The audio file path that is played by this sound
37
+ */
38
+ path: string | undefined | null;
39
+
40
+ /**
41
+ * Is this sound currently playing?
42
+ * @defaultValue `false`
43
+ */
44
+ playing: boolean;
45
+
46
+ /**
47
+ * @defaultValue `null`
48
+ */
49
+ pausedTime: number | null;
50
+
51
+ /**
52
+ * Does this sound loop?
53
+ * @defaultValue `false`
54
+ */
55
+ repeat: boolean;
56
+
57
+ /**
58
+ * The audio volume of the sound, from 0 to 1
59
+ * @defaultValue `0.5`
60
+ */
61
+ volume: number;
62
+
63
+ fade: number | undefined;
64
+
65
+ /**
66
+ * An object of optional key/value flags
67
+ * @defaultValue `{}`
68
+ */
69
+ flags: ConfiguredFlags<'PlaylistSound'>;
70
+ }
71
+
72
+ interface PlaylistSoundDataConstructorData {
73
+ /**
74
+ * The _id which uniquely identifies this PlaylistSound document
75
+ */
76
+ _id?: string | null | undefined;
77
+
78
+ /**
79
+ * The name of this sound track
80
+ */
81
+ name: string;
82
+
83
+ /**
84
+ * @defaultValue `''`
85
+ */
86
+ description?: string | null | undefined;
87
+
88
+ /**
89
+ * The audio file path that is played by this sound
90
+ */
91
+ path?: string | undefined | null;
92
+
93
+ /**
94
+ * Is this sound currently playing?
95
+ * @defaultValue `false`
96
+ */
97
+ playing?: boolean | null | undefined;
98
+
99
+ /**
100
+ * @defaultValue `null`
101
+ */
102
+ pausedTime?: number | null | undefined;
103
+
104
+ /**
105
+ * Does this sound loop?
106
+ * @defaultValue `false`
107
+ */
108
+ repeat?: boolean | null | undefined;
109
+
110
+ /**
111
+ * The audio volume of the sound, from 0 to 1
112
+ * @defaultValue `0.5`
113
+ */
114
+ volume?: number | null | undefined;
115
+
116
+ fade?: number | null | undefined;
117
+
118
+ /**
119
+ * An object of optional key/value flags
120
+ * @defaultValue `{}`
121
+ */
122
+ flags?: ConfiguredFlags<'PlaylistSound'> | null | undefined;
123
+ }
124
+
125
+ /**
126
+ * The data schema for a PlaylistSound embedded document.
127
+ * @see BasePlaylistSound
128
+ */
129
+ export declare class PlaylistSoundData extends DocumentData<
130
+ PlaylistSoundDataSchema,
131
+ PlaylistSoundDataProperties,
132
+ PropertiesToSource<PlaylistSoundDataProperties>,
133
+ PlaylistSoundDataConstructorData,
134
+ documents.BasePlaylistSound
135
+ > {
136
+ static defineSchema(): PlaylistSoundDataSchema;
137
+
138
+ /** @override */
139
+ protected _initialize(): void;
140
+ }
141
+
142
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
143
+ export interface PlaylistSoundData extends PlaylistSoundDataProperties {}
@@ -80,8 +80,8 @@ interface AudioField extends DocumentField<string> {
80
80
  /**
81
81
  * A standard integer field which may be used in a Document.
82
82
  * @remarks
83
- * Property type: `string | undefined`
84
- * Constructor type: `string | undefined | null`
83
+ * Property type: `number | undefined`
84
+ * Constructor type: `number | undefined | null`
85
85
  */
86
86
  export declare const INTEGER_FIELD: IntegerField;
87
87
  interface IntegerField extends DocumentField<number> {
@@ -1,11 +1,16 @@
1
1
  import { DocumentMetadata } from '../abstract/document.mjs';
2
2
  import { Document } from '../abstract/module.mjs';
3
+ import * as data from '../data/data.mjs';
3
4
  import { BasePlaylistSound } from './basePlaylistSound';
4
5
 
5
6
  /**
6
7
  * The base Playlist model definition which defines common behavior of an Playlist document between both client and server.
7
8
  */
8
- export declare class BasePlaylist extends Document<any, any> {
9
+ export declare class BasePlaylist extends Document<data.PlaylistData> {
10
+ /** @override */
11
+ static get schema(): typeof data.PlaylistData;
12
+
13
+ /** @override */
9
14
  static get metadata(): Merge<
10
15
  DocumentMetadata,
11
16
  {
@@ -18,4 +23,9 @@ export declare class BasePlaylist extends Document<any, any> {
18
23
  isPrimary: true;
19
24
  }
20
25
  >;
26
+
27
+ /**
28
+ * A reference to the Collection of ActiveEffect instances in the Actor document, indexed by _id.
29
+ */
30
+ get sounds(): this['data']['sounds'];
21
31
  }
@@ -1,10 +1,22 @@
1
- import { DocumentMetadata } from '../abstract/document.mjs';
2
1
  import { Document } from '../abstract/module.mjs';
2
+ import * as data from '../data/data.mjs';
3
+
4
+ import type { BasePlaylist } from './basePlaylist';
5
+ import type { BaseUser } from './baseUser';
6
+ import type { DocumentMetadata } from '../abstract/document.mjs';
7
+ import type { ConfiguredDocumentClass } from '../../../types/helperTypes';
3
8
 
4
9
  /**
5
10
  * The PlaylistSound model definition which defines common behaviour of a PlaylistSound document between both client and server.
6
11
  */
7
- export declare class BasePlaylistSound extends Document<any, any> {
12
+ export declare class BasePlaylistSound extends Document<
13
+ data.PlaylistSoundData,
14
+ InstanceType<ConfiguredDocumentClass<typeof BasePlaylist>>
15
+ > {
16
+ /** @override */
17
+ static get schema(): typeof data.PlaylistSoundData;
18
+
19
+ /** @override */
8
20
  static get metadata(): Merge<
9
21
  DocumentMetadata,
10
22
  {
@@ -14,4 +26,11 @@ export declare class BasePlaylistSound extends Document<any, any> {
14
26
  isEmbedded: true;
15
27
  }
16
28
  >;
29
+
30
+ /** @override */
31
+ testUserPermission(
32
+ user: BaseUser,
33
+ permission: keyof typeof foundry.CONST.ENTITY_PERMISSIONS | foundry.CONST.EntityPermission,
34
+ { exact }?: { exact?: boolean }
35
+ ): boolean;
17
36
  }
@@ -84,4 +84,9 @@ interface SocketResponse {
84
84
  * Data returned as a result of the request
85
85
  */
86
86
  data?: RequestData;
87
+
88
+ /**
89
+ * An Array of created data objects
90
+ */
91
+ result?: object[];
87
92
  }