(state: PropertySnapshotState)
| 593 | } |
| 594 | |
| 595 | function serializeSnapshot(state: PropertySnapshotState): { |
| 596 | property: string |
| 597 | entries: Array<[string, string | null]> |
| 598 | } { |
| 599 | let entries = [...state.values.entries()] |
| 600 | // Drop oldest by insertion order; Map preserves it regardless of key type. |
| 601 | if (entries.length > MAX_SNAPSHOT_SIZE) { |
| 602 | entries = entries.slice(entries.length - MAX_SNAPSHOT_SIZE) |
| 603 | } |
| 604 | return { property: state.property, entries } |
| 605 | } |
| 606 | |
| 607 | interface FetchArgs { |
| 608 | accessToken: string |