@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250922171059 → 13.346.0-beta.20250924172319

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@league-of-foundry-developers/foundry-vtt-types",
4
- "version": "13.346.0-beta.20250922171059",
4
+ "version": "13.346.0-beta.20250924172319",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -372,13 +372,15 @@ declare namespace CompendiumCollection {
372
372
  }
373
373
 
374
374
  // The type that's passed to `new CompendiumCollection(...)`
375
- type ConstructorMetadata<Type extends CompendiumCollection.DocumentName> = Metadata<Type> & {
375
+ interface ConstructorMetadata<Type extends CompendiumCollection.DocumentName> extends Metadata<Type> {
376
376
  index: IndexTypeForMetadata<Type>;
377
- folders: Folder.Implementation[];
378
- };
377
+ }
379
378
 
380
- // The type that appears in `compendium.metadata` after initialization.
381
- interface Metadata<Type extends CompendiumCollection.DocumentName = CompendiumCollection.DocumentName> {
379
+ /** The type that appears in `compendium.metadata` after initialization. */
380
+ // Note that the `Omit` is because `delete metadata.index` and `delete metadata.folder` is called.
381
+ // This also deletes in `game.data` since its passed uncloned.
382
+ interface Metadata<Type extends CompendiumCollection.DocumentName = CompendiumCollection.DocumentName>
383
+ extends Omit<Game.Data.Pack, "index" | "folder"> {
382
384
  type: Type;
383
385
  label: string;
384
386
 
@@ -392,13 +394,6 @@ declare namespace CompendiumCollection {
392
394
  flags: Record<string, never>; // created by the server, but always empty and no way to change it in a way that is s
393
395
  ownership: foundry.packages.BasePackage.OwnershipRecord;
394
396
  path: string;
395
- package: string;
396
- system: string;
397
-
398
- /** Added by PackageCompendiumPacks#initialize */
399
- id: string;
400
- packageType: string;
401
- packageName: string;
402
397
  }
403
398
 
404
399
  interface GetIndexOptions<Type extends DocumentName> {
@@ -716,7 +716,8 @@ declare namespace Game {
716
716
  warning: string[];
717
717
  }
718
718
 
719
- type Data = {
719
+ /** @internal */
720
+ type _Data = {
720
721
  activeUsers: string[];
721
722
  addresses: {
722
723
  local: string;
@@ -755,17 +756,7 @@ declare namespace Game {
755
756
  updateChannel: string;
756
757
  };
757
758
  packageWarnings: Record<string, PackageWarning>;
758
- packs: Array<
759
- PackageCompendiumData & {
760
- /** @deprecated since v11 */
761
- private?: boolean;
762
- system?: string | undefined;
763
- type: foundry.CONST.COMPENDIUM_DOCUMENT_TYPES;
764
- packageName: BasePackage["_source"]["id"];
765
- packageType: BasePackage["type"];
766
- id: string;
767
- }
768
- >;
759
+ packs: Array<Data.Pack>;
769
760
  paused: boolean;
770
761
  release: foundry.config.ReleaseData["_source"];
771
762
  system: foundry.packages.System["_source"];
@@ -788,6 +779,45 @@ declare namespace Game {
788
779
  >["_source"][];
789
780
  };
790
781
 
782
+ interface Data extends _Data {}
783
+
784
+ namespace Data {
785
+ interface Pack extends PackageCompendiumData {
786
+ /** @deprecated since v11 */
787
+ private?: boolean | undefined;
788
+ system?: string | undefined;
789
+ type: foundry.CONST.COMPENDIUM_DOCUMENT_TYPES;
790
+ packageName: BasePackage["_source"]["id"];
791
+ packageType: BasePackage["type"];
792
+ id: string;
793
+
794
+ /**
795
+ * @remarks This property is deleted right before `setup` is called, most likely inadvertently.
796
+ * This is ultimately because `CompendiumCollection` is passed a reference to an object in
797
+ * `game.data.packs` and calls `delete metadata.index` and `delete metadata.folders`.
798
+ *
799
+ * Specifically `Game#setupGame` calls `Game#setupPacks` and initializes `CompendiumCollection`
800
+ * with `new CompendiumCollection(metadata)` where `metadata` is defined from
801
+ * `for ( const metadata of this.data.packs ) {`.
802
+ */
803
+ // TODO(LukeAbby): Technically should be updated with compendium index types.
804
+ // It's probably not worth it because it is deleted after setup.
805
+ index?: { _id: string; uuid: string } & Record<string, unknown>;
806
+
807
+ /**
808
+ * @remarks This property is deleted after `setup`, most likely inadvertently.
809
+ * This is ultimately because `CompendiumCollection` is passed a reference to an object in
810
+ * `game.data.packs` and calls `delete metadata.index` and `delete metadata.folders`.
811
+ *
812
+ * Specifically `Game#setupGame` calls `Game#setupPacks` and initializes `CompendiumCollection`
813
+ * with `new CompendiumCollection(metadata)` where `metadata` is defined from
814
+ * `for ( const metadata of this.data.packs ) {`.
815
+ */
816
+ // TODO(LukeAbby): Technically a bit underspecified; may be more specific, though unlikely.
817
+ folders?: Folder.Source[];
818
+ }
819
+ }
820
+
791
821
  type Permissions = {
792
822
  [Key in keyof typeof foundry.CONST.USER_PERMISSIONS]: foundry.CONST.USER_ROLES[];
793
823
  };