@league-of-foundry-developers/foundry-vtt-types 9.249.0 → 9.249.4

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 (121) hide show
  1. package/package.json +2 -2
  2. package/src/foundry/common/abstract/data.mjs.d.ts +2 -2
  3. package/src/foundry/common/abstract/document.mjs.d.ts +20 -9
  4. package/src/foundry/common/config.mjs/releaseData.d.ts +3 -1
  5. package/src/foundry/common/data/data.mjs/activeEffectData.d.ts +3 -1
  6. package/src/foundry/common/data/data.mjs/actorData.d.ts +1 -1
  7. package/src/foundry/common/data/data.mjs/adventureData.d.ts +14 -12
  8. package/src/foundry/common/data/data.mjs/ambientLightData.d.ts +5 -3
  9. package/src/foundry/common/data/data.mjs/ambientSoundData.d.ts +62 -16
  10. package/src/foundry/common/data/data.mjs/animationData.d.ts +13 -5
  11. package/src/foundry/common/data/data.mjs/cardData.d.ts +4 -4
  12. package/src/foundry/common/data/data.mjs/cardFaceData.d.ts +5 -3
  13. package/src/foundry/common/data/data.mjs/cardsData.d.ts +3 -3
  14. package/src/foundry/common/data/data.mjs/chatMessageData.d.ts +3 -1
  15. package/src/foundry/common/data/data.mjs/chatSpeakerData.d.ts +3 -1
  16. package/src/foundry/common/data/data.mjs/combatData.d.ts +3 -1
  17. package/src/foundry/common/data/data.mjs/combatantData.d.ts +3 -1
  18. package/src/foundry/common/data/data.mjs/darknessActivation.d.ts +3 -1
  19. package/src/foundry/common/data/data.mjs/drawingData.d.ts +3 -1
  20. package/src/foundry/common/data/data.mjs/effectChangeData.d.ts +3 -1
  21. package/src/foundry/common/data/data.mjs/effectDurationData.d.ts +3 -1
  22. package/src/foundry/common/data/data.mjs/fogExplorationData.d.ts +3 -1
  23. package/src/foundry/common/data/data.mjs/folderData.d.ts +3 -1
  24. package/src/foundry/common/data/data.mjs/journalEntryData.d.ts +3 -1
  25. package/src/foundry/common/data/data.mjs/lightData.d.ts +7 -5
  26. package/src/foundry/common/data/data.mjs/macroData.d.ts +3 -1
  27. package/src/foundry/common/data/data.mjs/measuredTemplateData.d.ts +3 -1
  28. package/src/foundry/common/data/data.mjs/noteData.d.ts +3 -1
  29. package/src/foundry/common/data/data.mjs/playlistData.d.ts +3 -1
  30. package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +3 -1
  31. package/src/foundry/common/data/data.mjs/prototypeTokenData.d.ts +6 -4
  32. package/src/foundry/common/data/data.mjs/rollTableData.d.ts +3 -1
  33. package/src/foundry/common/data/data.mjs/sceneData.d.ts +3 -1
  34. package/src/foundry/common/data/data.mjs/settingData.d.ts +3 -1
  35. package/src/foundry/common/data/data.mjs/tableResultData.d.ts +3 -1
  36. package/src/foundry/common/data/data.mjs/tileData.d.ts +4 -2
  37. package/src/foundry/common/data/data.mjs/tileOcclusion.d.ts +4 -2
  38. package/src/foundry/common/data/data.mjs/tokenBarData.d.ts +4 -2
  39. package/src/foundry/common/data/data.mjs/tokenData.d.ts +5 -3
  40. package/src/foundry/common/data/data.mjs/userData.d.ts +3 -1
  41. package/src/foundry/common/data/data.mjs/videoData.d.ts +4 -2
  42. package/src/foundry/common/data/data.mjs/wallData.d.ts +4 -2
  43. package/src/foundry/common/documents.mjs/baseActiveEffect.d.ts +15 -12
  44. package/src/foundry/common/documents.mjs/baseActor.d.ts +24 -21
  45. package/src/foundry/common/documents.mjs/baseAdventure.d.ts +14 -12
  46. package/src/foundry/common/documents.mjs/baseAmbientLight.d.ts +14 -11
  47. package/src/foundry/common/documents.mjs/baseAmbientSound.d.ts +14 -11
  48. package/src/foundry/common/documents.mjs/baseCard.d.ts +27 -28
  49. package/src/foundry/common/documents.mjs/baseCards.d.ts +18 -16
  50. package/src/foundry/common/documents.mjs/baseChatMessage.d.ts +24 -17
  51. package/src/foundry/common/documents.mjs/baseCombat.d.ts +21 -20
  52. package/src/foundry/common/documents.mjs/baseCombatant.d.ts +25 -18
  53. package/src/foundry/common/documents.mjs/baseDrawing.d.ts +26 -23
  54. package/src/foundry/common/documents.mjs/baseFogExploration.d.ts +19 -17
  55. package/src/foundry/common/documents.mjs/baseFolder.d.ts +14 -12
  56. package/src/foundry/common/documents.mjs/baseItem.d.ts +25 -19
  57. package/src/foundry/common/documents.mjs/baseJournalEntry.d.ts +16 -14
  58. package/src/foundry/common/documents.mjs/baseMacro.d.ts +21 -18
  59. package/src/foundry/common/documents.mjs/baseMeasuredTemplate.d.ts +34 -18
  60. package/src/foundry/common/documents.mjs/baseNote.d.ts +20 -14
  61. package/src/foundry/common/documents.mjs/basePlaylist.d.ts +16 -14
  62. package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +14 -11
  63. package/src/foundry/common/documents.mjs/baseRollTable.d.ts +16 -14
  64. package/src/foundry/common/documents.mjs/baseScene.d.ts +23 -21
  65. package/src/foundry/common/documents.mjs/baseSetting.d.ts +18 -16
  66. package/src/foundry/common/documents.mjs/baseTableResult.d.ts +27 -19
  67. package/src/foundry/common/documents.mjs/baseTile.d.ts +17 -11
  68. package/src/foundry/common/documents.mjs/baseToken.d.ts +20 -16
  69. package/src/foundry/common/documents.mjs/baseUser.d.ts +45 -11
  70. package/src/foundry/common/documents.mjs/baseWall.d.ts +17 -15
  71. package/src/foundry/common/packages.mjs/packageAuthorData.d.ts +3 -1
  72. package/src/foundry/common/packages.mjs/packageCompendiumData.d.ts +4 -2
  73. package/src/foundry/common/packages.mjs/packageData.d.ts +3 -4
  74. package/src/foundry/common/packages.mjs/packageDependencyData.d.ts +3 -1
  75. package/src/foundry/common/packages.mjs/packageLanguageData.d.ts +3 -1
  76. package/src/foundry/common/utils/primitives.mjs.d.ts +1 -1
  77. package/src/foundry/foundry.js/application.d.ts +1 -1
  78. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientLightConfig.d.ts +2 -2
  79. package/src/foundry/foundry.js/applications/formApplications/documentSheets/itemSheet.d.ts +1 -1
  80. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +1 -1
  81. package/src/foundry/foundry.js/applications/formApplications/entitySheetConfig.d.ts +2 -2
  82. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +1 -1
  83. package/src/foundry/foundry.js/applications/sidebarTabs/chatLog.d.ts +1 -1
  84. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +1 -1
  85. package/src/foundry/foundry.js/avSettings.d.ts +11 -0
  86. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +36 -34
  87. package/src/foundry/foundry.js/clientDocuments/activeEffect.d.ts +1 -1
  88. package/src/foundry/foundry.js/clientDocuments/actor.d.ts +1 -1
  89. package/src/foundry/foundry.js/clientDocuments/chatMessage.d.ts +1 -1
  90. package/src/foundry/foundry.js/clientDocuments/combat.d.ts +5 -5
  91. package/src/foundry/foundry.js/clientDocuments/item.d.ts +2 -2
  92. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +1 -1
  93. package/src/foundry/foundry.js/clientDocuments/scene.d.ts +39 -38
  94. package/src/foundry/foundry.js/clientDocuments/user.d.ts +27 -35
  95. package/src/foundry/foundry.js/clientSettings.d.ts +1 -1
  96. package/src/foundry/foundry.js/collections/documentCollection.d.ts +65 -11
  97. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +78 -67
  98. package/src/foundry/foundry.js/collections/documentCollections/worldCollection.d.ts +73 -32
  99. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/actors.d.ts +3 -37
  100. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/combatEncounters.d.ts +5 -2
  101. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/fogExplorations.d.ts +0 -2
  102. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/folders.d.ts +1 -1
  103. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/items.d.ts +1 -22
  104. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/journal.d.ts +1 -1
  105. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/macros.d.ts +3 -8
  106. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/messages.d.ts +7 -2
  107. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/playlists.d.ts +5 -5
  108. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/rollTables.d.ts +1 -1
  109. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/scenes.d.ts +3 -2
  110. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/users.d.ts +7 -4
  111. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/worldSettings.d.ts +2 -2
  112. package/src/foundry/foundry.js/hooks.d.ts +3 -3
  113. package/src/foundry/foundry.js/pixi/containers/ruler.d.ts +18 -7
  114. package/src/foundry/foundry.js/pixi/points/wallEndpoint.d.ts +1 -1
  115. package/src/foundry/foundry.js/pixi/polygons/pointSourcePolygons/clockwiseSweepPolygon.d.ts +1 -1
  116. package/src/foundry/foundry.js/pointSources/lightSource.d.ts +1 -1
  117. package/src/foundry/foundry.js/pointSources/soundSource.d.ts +1 -1
  118. package/src/foundry/foundry.js/pointSources/visionSource.d.ts +1 -1
  119. package/src/foundry/foundry.js/polygonEdge.d.ts +1 -1
  120. package/src/foundry/foundry.js/ray.d.ts +1 -1
  121. package/src/types/helperTypes.d.ts +31 -13
@@ -2,6 +2,32 @@ import { ConfiguredDocumentClass } from '../../../types/helperTypes';
2
2
  import { DocumentDataType, DocumentModificationOptions } from '../../common/abstract/document.mjs';
3
3
 
4
4
  declare global {
5
+ interface ActivityData {
6
+ /** The ID of the scene that the user is viewing. */
7
+ sceneId?: string | null | undefined;
8
+
9
+ /** The position of the user's cursor. */
10
+ cursor?: { x: number; y: number } | null | undefined;
11
+
12
+ /** The state of the user's ruler, if they are currently using one. */
13
+ ruler?: RulerData | null | undefined;
14
+
15
+ /** The IDs of the tokens the user has targeted in the currently viewed */
16
+ targets?: string[] | undefined;
17
+
18
+ /** Whether the user has an open WS connection to the server or not. */
19
+ active?: boolean | undefined;
20
+
21
+ /** Is the user pulling focus to the cursor coordinates? */
22
+ focus?: boolean | undefined;
23
+
24
+ /** Is the user emitting a ping at the cursor coordinates? */
25
+ ping?: boolean | undefined;
26
+
27
+ /** The state of the user's AV settings. */
28
+ av?: AVSettingsData | undefined;
29
+ }
30
+
5
31
  /**
6
32
  * The client-side User document which extends the common BaseUser model.
7
33
  * Each User document contains UserData which defines its data schema.
@@ -91,7 +117,7 @@ declare global {
91
117
  * @param activityData - An object of User activity data to submit to the server for broadcast.
92
118
  * (default: `{}`)
93
119
  */
94
- broadcastActivity(activityData?: User.ActivityData): void;
120
+ broadcastActivity(activityData?: ActivityData): void;
95
121
 
96
122
  /**
97
123
  * Get an Array of Macro Entities on this User's Hotbar by page
@@ -138,38 +164,4 @@ declare global {
138
164
  /** @remarks This property is set by PlayerList.getData() */
139
165
  border?: string;
140
166
  }
141
-
142
- namespace User {
143
- interface ActivityData {
144
- /**
145
- * The coordinates of the user's cursor
146
- */
147
- cursor?: boolean;
148
-
149
- /**
150
- * Is the user pulling focus to the cursor coordinates?
151
- */
152
- focus?: boolean;
153
-
154
- /**
155
- * Is the user emitting a ping at the cursor coordinates?
156
- */
157
- ping?: boolean;
158
-
159
- /**
160
- * Serialized Ruler coordinate data in JSON format
161
- */
162
- ruler?: string;
163
-
164
- /**
165
- * The id of the Scene currently being viewed by the User
166
- */
167
- sceneId?: string;
168
-
169
- /**
170
- * An array of Token ids which are targeted by the User
171
- */
172
- targets?: string[];
173
- }
174
- }
175
167
  }
@@ -211,7 +211,7 @@ declare namespace ClientSettings {
211
211
  label?: string;
212
212
  name?: string;
213
213
  restricted: boolean;
214
- type: ConstructorOf<FormApplication<FormApplicationOptions, object>>;
214
+ type: ConstructorOf<FormApplication<FormApplicationOptions, object, undefined>>;
215
215
  }
216
216
 
217
217
  interface RegisteredMenuSettings {
@@ -47,7 +47,7 @@ declare global {
47
47
  * @param transformation - An object of data or function to apply to all matched objects
48
48
  * @param condition - A function which tests whether to target each object
49
49
  * (default: `null`)
50
- * @param options - Additional options passed to Entity.update
50
+ * @param options - Additional options passed to Document.update
51
51
  * (default: `{}`)
52
52
  * @returns An array of updated data once the operation is complete
53
53
  */
@@ -67,8 +67,8 @@ declare global {
67
67
  * @param options - Options which modified the creation operation
68
68
  * @param userId - The ID of the User who triggered the operation
69
69
  */
70
- _preCreateDocuments(
71
- result: InstanceType<ConfiguredDocumentClass<T>>['data']['_source'][],
70
+ protected _preCreateDocuments(
71
+ result: (InstanceType<T>['data']['_source'] & { _id: string })[],
72
72
  options: DocumentModificationOptions,
73
73
  userId: string
74
74
  ): void;
@@ -80,9 +80,9 @@ declare global {
80
80
  * @param options - Options which modified the creation operation
81
81
  * @param userId - The ID of the User who triggered the operation
82
82
  */
83
- _onCreateDocuments(
83
+ protected _onCreateDocuments(
84
84
  documents: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>[],
85
- result: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>['data']['_source'][],
85
+ result: (InstanceType<T>['data']['_source'] & { _id: string })[],
86
86
  options: DocumentModificationOptions,
87
87
  userId: string
88
88
  ): void;
@@ -93,8 +93,8 @@ declare global {
93
93
  * @param options - Options which modified the update operation
94
94
  * @param userId - The ID of the User who triggered the operation
95
95
  */
96
- _preUpdateDocuments(
97
- result: DeepPartial<StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>>[],
96
+ protected _preUpdateDocuments(
97
+ result: (DeepPartial<InstanceType<T>['data']['_source']> & { _id: string })[],
98
98
  options: DocumentModificationOptions,
99
99
  userId: string
100
100
  ): void;
@@ -106,9 +106,9 @@ declare global {
106
106
  * @param options - Options which modified the update operation
107
107
  * @param userId - The ID of the User who triggered the operation
108
108
  */
109
- _onUpdateDocuments(
109
+ protected _onUpdateDocuments(
110
110
  documents: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>[],
111
- result: DeepPartial<StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>>[],
111
+ result: (DeepPartial<InstanceType<T>['data']['_source']> & { _id: string })[],
112
112
  options: DocumentModificationOptions,
113
113
  userId: string
114
114
  ): void;
@@ -119,7 +119,7 @@ declare global {
119
119
  * @param options - Options which modified the deletion operation
120
120
  * @param userId - The ID of the User who triggered the operation
121
121
  */
122
- _preDeleteDocuments(result: string[], options: DocumentModificationOptions, userId: string): void;
122
+ protected _preDeleteDocuments(result: string[], options: DocumentModificationOptions, userId: string): void;
123
123
 
124
124
  /**
125
125
  * Follow-up actions taken after a set of Documents in this Collection are deleted.
@@ -128,11 +128,65 @@ declare global {
128
128
  * @param options - Options which modified the deletion operation
129
129
  * @param userId - The ID of the User who triggered the operation
130
130
  */
131
- _onDeleteDocuments(
131
+ protected _onDeleteDocuments(
132
132
  documents: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>[],
133
133
  result: string[],
134
134
  options: DocumentModificationOptions,
135
135
  userId: string
136
136
  ): void;
137
+
138
+ /**
139
+ * Generate the render context information provided for CRUD operations.
140
+ * @param action - The CRUD operation.
141
+ * @param documents - The documents being operated on.
142
+ * @param data - An array of creation or update objects, or an array of document IDs, depending on
143
+ * the operation.
144
+ * @internal
145
+ */
146
+ protected _getRenderContext(
147
+ action: DocumentCollection.RenderContext.Create<T>['action'],
148
+ documents: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>[],
149
+ data: (InstanceType<T>['data']['_source'] & { _id: string })[]
150
+ ): DocumentCollection.RenderContext.Create<T>;
151
+ protected _getRenderContext(
152
+ action: DocumentCollection.RenderContext.Update<T>['action'],
153
+ documents: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>[],
154
+ data: (DeepPartial<InstanceType<T>['data']['_source']> & { _id: string })[]
155
+ ): DocumentCollection.RenderContext.Update<T>;
156
+ protected _getRenderContext(
157
+ action: DocumentCollection.RenderContext.Delete<T>['action'],
158
+ documents: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>[],
159
+ data: string[]
160
+ ): DocumentCollection.RenderContext.Delete<T>;
161
+ }
162
+
163
+ namespace DocumentCollection {
164
+ namespace RenderContext {
165
+ interface Base<T extends DocumentConstructor> {
166
+ documentType: T['metadata']['name'];
167
+ documents: StoredDocument<InstanceType<ConfiguredDocumentClass<T>>>[];
168
+
169
+ /** @deprecated The 'entities' render context is deprecated. Please use 'documents' instead. */
170
+ get entities(): this['documents'];
171
+
172
+ /** @deprecated The 'entityType' render context is deprecated. Please use 'documentType' instead. */
173
+ get entityType(): this['documentType'];
174
+ }
175
+
176
+ interface Create<T extends DocumentConstructor> extends Base<T> {
177
+ action: 'create';
178
+ data: (InstanceType<T>['data']['_source'] & { _id: string })[];
179
+ }
180
+
181
+ interface Update<T extends DocumentConstructor> extends Base<T> {
182
+ action: 'update';
183
+ data: (DeepPartial<InstanceType<T>['data']['_source']> & { _id: string })[];
184
+ }
185
+
186
+ interface Delete<T extends DocumentConstructor> extends Base<T> {
187
+ action: 'delete';
188
+ data: string[];
189
+ }
190
+ }
137
191
  }
138
192
  }
@@ -1,4 +1,4 @@
1
- import { ConfiguredDocumentClassForName, ConstructorDataType } from '../../../../types/helperTypes';
1
+ import { ConfiguredDocumentClassForName } from '../../../../types/helperTypes';
2
2
  import { DocumentModificationOptions } from '../../../common/abstract/document.mjs';
3
3
 
4
4
  declare global {
@@ -16,12 +16,18 @@ declare global {
16
16
  constructor(metadata: T);
17
17
 
18
18
  /** The compendium metadata which defines the compendium content and location */
19
- metadata: T;
19
+ metadata: T & {
20
+ /** @deprecated "The 'entity' field of compendium metadata is deprecated. Please use CompendiumCollection#documentName instead." */
21
+ get entity(): T['type'];
22
+ };
20
23
 
21
24
  /** A subsidiary collection which contains the more minimal index of the pack */
22
25
  index: IndexTypeForMetadata<T>;
23
26
 
24
- /** A debounced function which will clear the contents of the Compendium pack if it is not accessed frequently. */
27
+ /**
28
+ * A debounced function which will clear the contents of the Compendium pack if it is not accessed frequently.
29
+ * @internal
30
+ */
25
31
  _flush: () => void;
26
32
 
27
33
  /**
@@ -44,14 +50,21 @@ declare global {
44
50
 
45
51
  /**
46
52
  * The default index fields which should be retrieved for each Compendium document type
53
+ * @remarks TODO: We should also allow nested paths
47
54
  */
48
55
  static INDEX_FIELDS: {
49
56
  /** @defaultValue `["name", "img", "type"]` */
50
57
  Actor: (keyof foundry.data.ActorData['_source'])[];
51
58
 
59
+ /** @defaultValue `["name", "img"]` */
60
+ Adventure: (keyof foundry.data.AdventureData['_source'])[];
61
+
52
62
  /** @defaultValue `["name", "img", "type"]` */
53
63
  Item: (keyof foundry.data.ItemData['_source'])[];
54
64
 
65
+ /** @defaultValue `["name", "img", "type"]` */
66
+ Cards: (keyof foundry.data.CardsData['_source'])[];
67
+
55
68
  /** @defaultValue `["name", "thumb"]` */
56
69
  Scene: (keyof foundry.data.SceneData['_source'])[];
57
70
 
@@ -74,7 +87,7 @@ declare global {
74
87
  /** Access the compendium configuration data for this pack */
75
88
  get config(): CompendiumCollection.Configuration | {};
76
89
 
77
- get documentName(): this['metadata']['entity'];
90
+ get documentName(): this['metadata']['type'];
78
91
 
79
92
  /** Track whether the Compendium Collection is locked for editing */
80
93
  get locked(): boolean;
@@ -88,7 +101,7 @@ declare global {
88
101
  get(key: string, { strict }: { strict: true }): StoredDocument<DocumentInstanceForCompendiumMetadata<T>>;
89
102
  get(
90
103
  key: string,
91
- { strict }?: { strict?: false }
104
+ { strict }?: { strict?: false | undefined } | undefined
92
105
  ): StoredDocument<DocumentInstanceForCompendiumMetadata<T>> | undefined;
93
106
 
94
107
  set(id: string, document: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>): this;
@@ -99,7 +112,7 @@ declare global {
99
112
  * Load the Compendium index and cache it as the keys and values of the Collection.
100
113
  * @param options - Options which customize how the index is created
101
114
  */
102
- getIndex(options?: CompendiumCollection.GetIndexOptions<T>): Promise<this['index']>;
115
+ getIndex(options?: CompendiumCollection.GetIndexOptions<T> | undefined): Promise<this['index']>;
103
116
 
104
117
  /**
105
118
  * Get a single Document from this Compendium by ID.
@@ -115,26 +128,47 @@ declare global {
115
128
  * default: `{}`
116
129
  * @returns The retrieved Document instances
117
130
  */
118
- getDocuments(query?: Record<string, unknown>): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[]>;
131
+ getDocuments(
132
+ query?: Record<string, unknown> | undefined
133
+ ): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[]>;
119
134
 
120
135
  /**
121
136
  * Import a Document into this Compendium Collection.
122
137
  * @param document - The existing Document you wish to import
138
+ * @param options - Additional options which modify how the data is imported. See {@link ClientDocumentMixin#toCompendium}
139
+ * (default: `{}`)
123
140
  * @returns The imported Document instance
124
141
  */
125
142
  importDocument(
126
- document: DocumentInstanceForCompendiumMetadata<T>
143
+ document: DocumentInstanceForCompendiumMetadata<T>,
144
+ options?: ClientDocumentMixin.CompendiumExportOptions | undefined
127
145
  ): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>> | undefined>;
128
146
 
129
147
  /**
130
148
  * Fully import the contents of a Compendium pack into a World folder.
149
+ * @param folderId - An existing Folder _id to use.
150
+ * (default: `null`)
151
+ * @param folderName - A new Folder name to create.
152
+ * (default: `''`)
153
+ * @param options - Additional options forwarded to {@link WorldCollection#fromCompendium} and {@link Document.createDocuments}
154
+ * (default: `{}`)
131
155
  * @returns The imported Documents, now existing within the World
132
156
  */
133
157
  importAll({
134
158
  folderId,
135
159
  folderName,
136
160
  options
137
- }: ImportAllOptions): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[]>;
161
+ }?: ImportAllOptions | undefined): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[]>;
162
+
163
+ /**
164
+ * Provide a dialog form that prompts the user to import the full contents of a Compendium pack into the World.
165
+ * @param options - Additional options passed to the Dialog.confirm method
166
+ * (default: `{}`)
167
+ * @returns A Promise which resolves or rejects once the dialog has been submitted or closed
168
+ */
169
+ importDialog(
170
+ options?: Dialog.Options | undefined
171
+ ): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[] | null | false>;
138
172
 
139
173
  /**
140
174
  * Add a Document to the index, capturing it's relevant index attributes
@@ -150,7 +184,7 @@ declare global {
150
184
  */
151
185
  static createCompendium<T extends CompendiumCollection.Metadata>(
152
186
  metadata: T,
153
- options?: Partial<DocumentModificationOptions>
187
+ options?: Partial<DocumentModificationOptions> | undefined
154
188
  ): Promise<CompendiumCollection<T>>;
155
189
 
156
190
  /**
@@ -159,7 +193,9 @@ declare global {
159
193
  * default: `{}`
160
194
  * @returns A Promise which resolves once the setting is updated
161
195
  */
162
- configure(settings?: Partial<CompendiumCollection.Configuration>): Promise<CompendiumCollection.Configuration>;
196
+ configure(
197
+ settings?: Partial<CompendiumCollection.Configuration> | undefined
198
+ ): Promise<CompendiumCollection.Configuration>;
163
199
 
164
200
  /**
165
201
  * Delete an existing world-level Compendium Collection.
@@ -171,35 +207,49 @@ declare global {
171
207
  * Duplicate a compendium pack to the current World.
172
208
  * @param label - A new Compendium label
173
209
  */
174
- duplicateCompendium({ label }?: { label?: string }): Promise<this>;
210
+ duplicateCompendium({ label }?: { label?: string | undefined }): Promise<this>;
175
211
 
176
212
  /**
177
213
  * Validate that the current user is able to modify content of this Compendium pack
178
214
  * @param requireUnlocked - `(default: true)`
215
+ * @internal
179
216
  */
180
- protected _assertUserCanModify({ requireUnlocked }?: { requireUnlocked?: boolean }): true;
217
+ protected _assertUserCanModify({ requireUnlocked }?: { requireUnlocked?: boolean | undefined } | undefined): true;
181
218
 
182
219
  /**
183
220
  * Request that a Compendium pack be migrated to the latest System data template
184
- * TODO: find better type for options, used in socket dispatch
221
+ * @remarks
222
+ * Currently, there are no options that are being considered by foundry when migrating a
223
+ * a compendium pack.
185
224
  */
186
- migrate(options?: object): Promise<this>;
187
-
188
- _onCreateDocuments(
225
+ migrate(options?: Record<string, unknown> | undefined): Promise<this>;
226
+
227
+ /** @override */
228
+ updateAll(
229
+ transformation:
230
+ | DeepPartial<DocumentInstanceForCompendiumMetadata<T>['data']['_source']>
231
+ | ((
232
+ doc: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>
233
+ ) => DeepPartial<DocumentInstanceForCompendiumMetadata<T>['data']['_source']>),
234
+ condition?: ((obj: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>) => boolean) | null,
235
+ options?: DocumentModificationContext
236
+ ): ReturnType<this['documentClass']['updateDocuments']>;
237
+
238
+ protected _onCreateDocuments(
189
239
  documents: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[],
190
- result: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>['data']['_source'][],
240
+ result: (DocumentInstanceForCompendiumMetadata<T>['data']['_source'] & { _id: string })[],
191
241
  options: DocumentModificationOptions,
192
242
  userId: string
193
243
  ): void;
194
244
 
195
- _onUpdateDocuments(
245
+ protected _onUpdateDocuments(
196
246
  documents: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[],
197
- result: DeepPartial<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>>[],
247
+ result: (DeepPartial<DocumentInstanceForCompendiumMetadata<T>['data']['_source']> & { _id: string })[],
198
248
  options: DocumentModificationOptions,
199
249
  userId: string
200
250
  ): void;
201
251
 
202
- _onDeleteDocuments(
252
+ protected _onDeleteDocuments(
203
253
  documents: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[],
204
254
  result: string[],
205
255
  options: DocumentModificationOptions,
@@ -208,52 +258,13 @@ declare global {
208
258
 
209
259
  /**
210
260
  * Follow-up actions taken when Documents within this Compendium pack are modified
261
+ * @internal
211
262
  */
212
263
  protected _onModifyContents(
213
264
  documents: StoredDocument<DocumentInstanceForCompendiumMetadata<T>>[],
214
265
  options: DocumentModificationOptions,
215
266
  userId: string
216
267
  ): void;
217
-
218
- /** @deprecated since 0.8.0 */
219
- get entity(): this['documentClass']['documentName'];
220
-
221
- /** @deprecated since 0.8.0 */
222
- getContent(): ReturnType<this['getDocuments']>;
223
-
224
- /** @deprecated since 0.8.0 */
225
- getEntry(id: string): Promise<StoredDocument<DocumentInstanceForCompendiumMetadata<T>>['data']>;
226
-
227
- /** @deprecated since 0.8.0 */
228
- getEntity(id: string): ReturnType<this['getDocument']>;
229
-
230
- /** @deprecated since 0.8.0 */
231
- importEntity(document: DocumentInstanceForCompendiumMetadata<T>): ReturnType<this['importDocument']>;
232
-
233
- /** @deprecated since 0.8.0 */
234
- createEntity(
235
- data:
236
- | ConstructorDataType<DocumentInstanceForCompendiumMetadata<T>['data']>
237
- | (ConstructorDataType<DocumentInstanceForCompendiumMetadata<T>['data']> & Record<string, unknown>),
238
- options?: Partial<DocumentModificationOptions>
239
- ): ReturnType<this['documentClass']['create']>;
240
-
241
- /** @deprecated since 0.8.0 */
242
- updateEntity(
243
- data: DeepPartial<
244
- | ConstructorDataType<DocumentInstanceForCompendiumMetadata<T>['data']>
245
- | (ConstructorDataType<DocumentInstanceForCompendiumMetadata<T>['data']> & Record<string, unknown>)
246
- > & {
247
- _id: string;
248
- },
249
- options?: Partial<DocumentModificationOptions>
250
- ): ReturnType<DocumentInstanceForCompendiumMetadata<T>['update']>;
251
-
252
- /** @deprecated since 0.8.0 */
253
- deleteEntity(
254
- id: string,
255
- options?: Partial<DocumentModificationOptions>
256
- ): ReturnType<DocumentInstanceForCompendiumMetadata<T>['delete']>;
257
268
  }
258
269
 
259
270
  namespace CompendiumCollection {
@@ -262,7 +273,7 @@ declare global {
262
273
  locked: boolean;
263
274
  }
264
275
  interface Metadata {
265
- entity: 'Actor' | 'Item' | 'JournalEntry' | 'Macro' | 'Playlist' | 'RollTable' | 'Scene';
276
+ type: foundry.CONST.COMPENDIUM_DOCUMENT_TYPES;
266
277
  name: string;
267
278
  label: string;
268
279
  path: string;
@@ -283,21 +294,21 @@ interface ImportAllOptions {
283
294
  * An existing Folder _id to use.
284
295
  * @defaultValue `null`
285
296
  * */
286
- folderId?: string | null;
297
+ folderId?: string | null | undefined;
287
298
  /**
288
299
  * A new Folder name to create.
289
300
  * @defaultValue `""`
290
301
  * */
291
- folderName?: string;
302
+ folderName?: string | undefined;
292
303
  /**
293
- * Additional options forwarded to Document.createDocuments
304
+ * Additional options forwarded to {@link WorldCollection#fromCompendium} and {@link Document.createDocuments}
294
305
  * @defaultValue `{}`
295
306
  */
296
- options?: DocumentModificationContext;
307
+ options?: (DocumentModificationContext & WorldCollection.FromCompendiumOptions) | undefined;
297
308
  }
298
309
 
299
310
  type DocumentClassForCompendiumMetadata<T extends CompendiumCollection.Metadata> = ConfiguredDocumentClassForName<
300
- T['entity']
311
+ T['type']
301
312
  >;
302
313
 
303
314
  type DocumentInstanceForCompendiumMetadata<T extends CompendiumCollection.Metadata> = InstanceType<