Skip to content

cupertino-files / IwaObject

Class: IwaObject ​

Defined in: src/tsp/iwa.ts:41

One object inside an IWA component.

Constructors ​

Constructor ​

new IwaObject(archiveInfo, payloads): IwaObject

Defined in: src/tsp/iwa.ts:49

Parameters ​

archiveInfo ​

RawMessage

payloads ​

Uint8Array<ArrayBufferLike>[]

Returns ​

IwaObject

Properties ​

archiveInfo ​

archiveInfo: RawMessage

Defined in: src/tsp/iwa.ts:45


payloads ​

payloads: Uint8Array<ArrayBufferLike>[]

Defined in: src/tsp/iwa.ts:47

Raw payload bytes, one per MessageInfo (usually exactly one).

Accessors ​

hasCompatibilityPatches ​

Get Signature ​

get hasCompatibilityPatches(): boolean

Defined in: src/tsp/iwa.ts:131

True when editing this object's primary payload would leave its older-reader compatibility diffs stale. This library preserves those diffs verbatim; it does not recompute them.

Returns ​

boolean


identifier ​

Get Signature ​

get identifier(): bigint

Defined in: src/tsp/iwa.ts:54

Returns ​

bigint

Set Signature ​

set identifier(id): void

Defined in: src/tsp/iwa.ts:58

Parameters ​
id ​

bigint

Returns ​

void


isDirty ​

Get Signature ​

get isDirty(): boolean

Defined in: src/tsp/iwa.ts:146

Returns ​

boolean


isPatchArchive ​

Get Signature ​

get isPatchArchive(): boolean

Defined in: src/tsp/iwa.ts:98

True for merge/patch archives: ArchiveInfo.should_merge is set, or a MessageInfo carries type == 0, meaning its payload is a diff against the message named by base_message_index.

Multiple MessageInfos alone do NOT make a patch archive — modern Pages routinely writes archives holding several complete messages of the same type (observed on TST.TableStyleNetworkArchive in 14.5 documents).

Returns ​

boolean


message ​

Get Signature ​

get message(): RawMessage

Defined in: src/tsp/iwa.ts:73

Parse the primary payload as a protobuf message (cached; edits track dirty).

Returns ​

RawMessage


messageInfos ​

Get Signature ​

get messageInfos(): RawMessage[]

Defined in: src/tsp/iwa.ts:62

Returns ​

RawMessage[]


payloadCount ​

Get Signature ​

get payloadCount(): number

Defined in: src/tsp/iwa.ts:85

Number of payloads in this archive. Almost always 1; archives with more are either multi-message (each payload a full message, with its own MessageInfo.type) or merge/patch archives (see isPatchArchive).

Returns ​

number


payloadTypes ​

Get Signature ​

get payloadTypes(): number[]

Defined in: src/tsp/iwa.ts:104

Message types of every payload, in order.

Returns ​

number[]


type ​

Get Signature ​

get type(): number

Defined in: src/tsp/iwa.ts:67

Message type of the primary payload (0 if absent).

Returns ​

number

Methods ​

compatibilityPatchVersions() ​

compatibilityPatchVersions(): number[][]

Defined in: src/tsp/iwa.ts:117

Reader versions targeted by this archive's compatibility diffs.

Apple stores, alongside the current message, one type-0 patch per older reader version (MessageInfo.diff_merge_version), so an older app opening the document applies the diff matching its own version — the object-level counterpart of the styles_for_* stylesheet snapshots. Observed on TN.UIStateArchive targeting 11.0 / 10.1 / 10.0.

Returns ​

number[][]


copyVersionsFrom() ​

copyVersionsFrom(other): void

Defined in: src/tsp/iwa.ts:218

Copy the packed version list from another MessageInfo (compatibility).

Parameters ​

other ​

IwaObject

Returns ​

void


getDataReferences() ​

getDataReferences(): bigint[]

Defined in: src/tsp/iwa.ts:163

Returns ​

bigint[]


getObjectReferences() ​

getObjectReferences(): bigint[]

Defined in: src/tsp/iwa.ts:151

Object identifiers referenced by the primary payload, per MessageInfo.

Returns ​

bigint[]


payloadMessage() ​

payloadMessage(index): RawMessage | undefined

Defined in: src/tsp/iwa.ts:139

Parse a secondary payload (index ≥ 1). These are preserved verbatim on save unless replaced; only the primary payload is edit-tracked.

Parameters ​

index ​

number

Returns ​

RawMessage | undefined


serialize() ​

serialize(): Uint8Array

Defined in: src/tsp/iwa.ts:183

Serialize this object's archive (ArchiveInfo length + info + payloads).

Returns ​

Uint8Array


setDataReferences() ​

setDataReferences(ids): void

Defined in: src/tsp/iwa.ts:168

Parameters ​

ids ​

readonly bigint[]

Returns ​

void


setMessageBytes() ​

setMessageBytes(bytes): void

Defined in: src/tsp/iwa.ts:176

Replace the primary payload with a parsed copy of the given bytes.

Parameters ​

bytes ​

Uint8Array

Returns ​

void


setObjectReferences() ​

setObjectReferences(ids): void

Defined in: src/tsp/iwa.ts:156

Parameters ​

ids ​

readonly bigint[]

Returns ​

void


create() ​

static create(identifier, type, versions?): IwaObject

Defined in: src/tsp/iwa.ts:204

Create a fresh object with a single MessageInfo of the given type. versions defaults to a conservative singleton [1] and should normally be copied from a sibling object of the same type in the same document.

Parameters ​

identifier ​

bigint

type ​

number

versions? ​

readonly number[] = ...

Returns ​

IwaObject

MIT licensed. Independently made — not by Apple in California. Not affiliated with or endorsed by Apple Inc.