@hatsuboshi/types
    Preparing search index...

    Class PItem

    A P-Item / produce item (Pアイテム).

    These are items that can be obtained throughout the duration of a produce run that provide effects to both the produce run itself, as well as during lesson/audition gameplay sectors (e.g. "あの日の約束" / "The promise of that day", "ピッグドリーム貯金箱" / "Piggybank of Big Dreams", "「Pっち」" / "'P-cchi'", etc.).

    Tip

    See PItemFilter for the list of filtering options.

    See IPItem for the list of fields that can be used for sorting.

    Hierarchy (View Summary)

    Implements

    Index
    • Constructs a PItem instance from an optional IPItem object, at a specified level.

      If obj, or any of its required fields are undefined, the default value of each property's type will be used to construct the object.

      if upgradeLevel is undefined, the constructed instance will have a currentUpgradeLevel of 0.

      Parameters

      • Optionalobj: Partial<IPItem>

        Data to construct the object from.

      • OptionalupgradeLevel: number

        The upgrade level to set for the constructed instance.

      Returns PItem

      // Default instance
      new PItem()

      // From partial data
      new PItem({ name: { ja: "Hello" } })

      // From JSON data returned by an API
      const res = await fetch(...)
      const data = new PItem(await res.json())

      // From JSON data returned by an API, at a specified level
      const res = await fetch(...)
      const data = new PItem(await res.json(), 1)
    • Constructs a PItem instance from a DBPItem object by rehydrating missing fields using populate methods, at a specified training & potential level.

      if upgradeLevel is undefined, the constructed instance will have a currentUpgradeLevel of 0.

      Parameters

      • obj: DBPItem

        Data to construct the object from.

      • populate: PopulateEffectReference

        Methods used to rehydrate fields overridden by DBPItem.

      • OptionalupgradeLevel: number

        The upgrade level to set for the constructed instance.

      Returns Promise<PItem>

      // From JSON data returned by a document store repository
      const res = await collection.findOne({ ... })
      const data = await PItem.fromDB(res, { ... })

      // From JSON data returned by a document store repository, at a specified level
      const res = await collection.findOne({ ... })
      const data = await PItem.fromDB(res, { ... }, 1)
    • Set the upgrade level of this P-Idol instance, up to its maximum upgrade level.

      Parameters

      • level: number

      Returns this

    • Returns the document-store representation of this object.

      Caution

      Unlike toJSON(), the resulting document-store representation may be in a significantly different shape to that of its implementing class, and it cannot be passed back into the constructor to reconstruct an equivalent instance.

      Use fromDB() instead, which reconstructs the instance and rehydrates any fields truncated by the conversion.

      Returns DBPItem

    • Returns the JSON-serializable representation of this object.

      Tip

      The result can be passed back into the constructor to reconstruct an equivalent instance.

      Returns IPItem

      // t1 and t2 are deeply equal
      const t1: T = new T({ ... })
      const t2: T = new T(t1.toJSON())
    • get dbRef(): string

      The unique reference to this object in persistent storage.

      Returns string

    assetUrl: string

    The URL to the main visual asset (image) of the P-Item.

    createdAt: string

    The time the object was created, as an ISO 8601 (RFC 3339) timestamp.

    ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?(Z|[+-]\d{2}:\d{2})$

    "2026-07-08T07:35:46.741Z"
    
    currentEffect: Effect

    The effects this P-Item instance has (including any level upgrades).

    currentUpgradeLevel: number

    The current upgrade level of this P-Item instance.

    id: string

    An ID associated with the object.

    index: number = 0

    An auto-incremented index to keep object IDs unique during runtime.

    initialEffect: Effect

    The effects of the P-Item, at upgrade level 0 (unupgraded). Use PItem.currentEffect for the effects including any level upgrades.

    The name of the P-Item.

    plan: Plan

    The produce plan(s) the P-Item can be used on.

    rarity: Rarity

    The rarity of the P-Item.

    sortableFields: readonly [
        "id",
        "createdAt",
        "updatedAt",
        "name",
        "plan",
        "rarity",
        "unlockLevel",
        "source",
    ] = ...
    source: PItemSource

    The source of the P-Item.

    unlockLevel: number

    The produce level at which the P-Item is unlocked at.

    Note

    This field exists to match the in-game data format, however as of update v3.3.0 of the game, all P-Items have an unlock level of 0.

    updatedAt: string

    The time the object was last updated, as an ISO 8601 (RFC 3339) timestamp.

    ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?(Z|[+-]\d{2}:\d{2})$

    "2026-07-09T14:02:11.508Z"
    
    upgradeLevels: AbilityLevel[]

    A list of upgrade level effects for the P-Item. Use upgradeLevels.length for its maximum upgrade level.