@mapier/imsg-sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +68 -0
- package/dist/gateway/external-ids.d.ts +3 -0
- package/dist/gateway/external-ids.js +37 -0
- package/dist/gateway/external-ids.js.map +1 -0
- package/dist/gateway/fake.d.ts +161 -0
- package/dist/gateway/fake.js +870 -0
- package/dist/gateway/fake.js.map +1 -0
- package/dist/gateway/imsg.d.ts +77 -0
- package/dist/gateway/imsg.js +676 -0
- package/dist/gateway/imsg.js.map +1 -0
- package/dist/gateway/portable-chat.d.ts +65 -0
- package/dist/gateway/portable-chat.js +118 -0
- package/dist/gateway/portable-chat.js.map +1 -0
- package/dist/gateway/types.d.ts +169 -0
- package/dist/gateway/types.js +16 -0
- package/dist/gateway/types.js.map +1 -0
- package/dist/imsg/binary.d.ts +1 -0
- package/dist/imsg/binary.js +4 -0
- package/dist/imsg/binary.js.map +1 -0
- package/dist/imsg/react.d.ts +2 -0
- package/dist/imsg/react.js +24 -0
- package/dist/imsg/react.js.map +1 -0
- package/dist/imsg/rpc.d.ts +145 -0
- package/dist/imsg/rpc.js +227 -0
- package/dist/imsg/rpc.js.map +1 -0
- package/dist/imsg/status.d.ts +9 -0
- package/dist/imsg/status.js +37 -0
- package/dist/imsg/status.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/interactions/catalog.d.ts +2 -0
- package/dist/interactions/catalog.js +98 -0
- package/dist/interactions/catalog.js.map +1 -0
- package/dist/interactions/harness.d.ts +25 -0
- package/dist/interactions/harness.js +69 -0
- package/dist/interactions/harness.js.map +1 -0
- package/dist/interactions/index.d.ts +5 -0
- package/dist/interactions/index.js +5 -0
- package/dist/interactions/index.js.map +1 -0
- package/dist/interactions/registry.d.ts +9 -0
- package/dist/interactions/registry.js +33 -0
- package/dist/interactions/registry.js.map +1 -0
- package/dist/interactions/types.d.ts +28 -0
- package/dist/interactions/types.js +5 -0
- package/dist/interactions/types.js.map +1 -0
- package/dist/polls.d.ts +12 -0
- package/dist/polls.js +102 -0
- package/dist/polls.js.map +1 -0
- package/dist/runtime-report.d.ts +3 -0
- package/dist/runtime-report.js +10 -0
- package/dist/runtime-report.js.map +1 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
package/dist/polls.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ImsgMessage, MessagePoll, PollOption } from './types.js';
|
|
2
|
+
export type PollEventKind = 'created' | 'options-changed' | 'vote';
|
|
3
|
+
export declare function pollEventKind(poll: MessagePoll): PollEventKind;
|
|
4
|
+
export declare function pollOriginGuid(msg: ImsgMessage): string | undefined;
|
|
5
|
+
export interface PollSnapshot {
|
|
6
|
+
originGuid: string;
|
|
7
|
+
question?: string;
|
|
8
|
+
options: PollOption[];
|
|
9
|
+
votesByParticipant: Record<string, string[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare function aggregatePolls(messages: ImsgMessage[]): PollSnapshot[];
|
|
12
|
+
export declare function renderPollEvent(msg: ImsgMessage, history: ImsgMessage[]): string | undefined;
|
package/dist/polls.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Vote rows usually carry votes[]; older/edge payloads may only fill vote.
|
|
2
|
+
function pollVotes(poll) {
|
|
3
|
+
return poll.votes ?? (poll.vote ? [poll.vote] : []);
|
|
4
|
+
}
|
|
5
|
+
// Discriminators surfaced by imsg in poll.metadata: 2 = option update,
|
|
6
|
+
// 4000 = vote. Balloon rows usually read 3 but were observed as 0 right
|
|
7
|
+
// after send (Messages restamps the column) — so classification keys only
|
|
8
|
+
// on kind, type 2, and original_guid, never on the balloon's value.
|
|
9
|
+
export function pollEventKind(poll) {
|
|
10
|
+
if (poll.kind === 'vote')
|
|
11
|
+
return 'vote';
|
|
12
|
+
if (poll.metadata?.associated_message_type === 2 ||
|
|
13
|
+
(poll.original_guid !== undefined && poll.original_guid !== poll.poll_guid)) {
|
|
14
|
+
return 'options-changed';
|
|
15
|
+
}
|
|
16
|
+
return 'created';
|
|
17
|
+
}
|
|
18
|
+
// The guid of the poll's original balloon row — the join key for question
|
|
19
|
+
// resolution and state aggregation. Original rows carry no original_guid.
|
|
20
|
+
export function pollOriginGuid(msg) {
|
|
21
|
+
if (!msg.poll)
|
|
22
|
+
return undefined;
|
|
23
|
+
return msg.poll.original_guid ?? msg.poll.poll_guid ?? msg.guid;
|
|
24
|
+
}
|
|
25
|
+
// messages must be oldest-first by id — the order history() and the fake
|
|
26
|
+
// store already guarantee.
|
|
27
|
+
export function aggregatePolls(messages) {
|
|
28
|
+
const byOrigin = new Map();
|
|
29
|
+
for (const m of messages) {
|
|
30
|
+
if (!m.poll)
|
|
31
|
+
continue;
|
|
32
|
+
const originGuid = pollOriginGuid(m);
|
|
33
|
+
if (!originGuid)
|
|
34
|
+
continue;
|
|
35
|
+
const kind = pollEventKind(m.poll);
|
|
36
|
+
if (kind === 'created') {
|
|
37
|
+
byOrigin.set(originGuid, {
|
|
38
|
+
originGuid,
|
|
39
|
+
question: m.poll.question,
|
|
40
|
+
options: m.poll.options ?? [],
|
|
41
|
+
votesByParticipant: {},
|
|
42
|
+
});
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const snap = byOrigin.get(originGuid);
|
|
46
|
+
if (!snap)
|
|
47
|
+
continue; // origin outside this window — nothing to attribute to
|
|
48
|
+
if (kind === 'options-changed') {
|
|
49
|
+
if (m.poll.options?.length)
|
|
50
|
+
snap.options = m.poll.options;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const votes = pollVotes(m.poll);
|
|
54
|
+
const participant = votes.find((v) => v.participant)?.participant ?? m.sender;
|
|
55
|
+
if (!participant)
|
|
56
|
+
continue;
|
|
57
|
+
snap.votesByParticipant[participant] = votes.map((v) => v.option_id).filter((id) => id !== undefined);
|
|
58
|
+
}
|
|
59
|
+
return [...byOrigin.values()];
|
|
60
|
+
}
|
|
61
|
+
function quoteList(texts) {
|
|
62
|
+
return texts.map((t) => `"${t}"`).join(', ');
|
|
63
|
+
}
|
|
64
|
+
// Render one poll row as a bracketed transcript note, in the voice of the
|
|
65
|
+
// row's sender ("[voted "yes" on the poll …]"). history provides the
|
|
66
|
+
// question join via original_guid; pass just [msg] when no window is at
|
|
67
|
+
// hand and the note degrades to "the poll".
|
|
68
|
+
export function renderPollEvent(msg, history) {
|
|
69
|
+
const poll = msg.poll;
|
|
70
|
+
if (!poll)
|
|
71
|
+
return undefined;
|
|
72
|
+
const kind = pollEventKind(poll);
|
|
73
|
+
if (kind === 'created') {
|
|
74
|
+
const q = poll.question?.trim();
|
|
75
|
+
const options = (poll.options ?? []).map((o) => o.text);
|
|
76
|
+
return `[sent a poll${q ? ` "${q}"` : ''} — options: ${quoteList(options)}]`;
|
|
77
|
+
}
|
|
78
|
+
const originGuid = pollOriginGuid(msg);
|
|
79
|
+
const origin = history.find((m) => m.guid === originGuid && m.poll && pollEventKind(m.poll) === 'created');
|
|
80
|
+
const q = origin?.poll?.question?.trim();
|
|
81
|
+
const label = q ? `the poll "${q}"` : 'the poll';
|
|
82
|
+
if (kind === 'vote') {
|
|
83
|
+
const picked = pollVotes(poll)
|
|
84
|
+
.map((v) => v.option_text ?? v.option_id)
|
|
85
|
+
.filter((t) => t !== undefined);
|
|
86
|
+
if (!picked.length)
|
|
87
|
+
return `[cleared their vote on ${label}]`;
|
|
88
|
+
return `[voted ${quoteList(picked)} on ${label}]`;
|
|
89
|
+
}
|
|
90
|
+
// options-changed: name the additions when the prior option set is in the
|
|
91
|
+
// window; otherwise fall back to the full updated list.
|
|
92
|
+
const prior = history
|
|
93
|
+
.filter((m) => m.id < msg.id && m.poll && pollOriginGuid(m) === originGuid && pollEventKind(m.poll) !== 'vote')
|
|
94
|
+
.at(-1);
|
|
95
|
+
const before = new Set((prior?.poll?.options ?? []).map((o) => o.id));
|
|
96
|
+
const added = (poll.options ?? []).filter((o) => !before.has(o.id));
|
|
97
|
+
if (prior && added.length) {
|
|
98
|
+
return `[added ${added.map((o) => `option "${o.text}"`).join(', ')} to ${label}]`;
|
|
99
|
+
}
|
|
100
|
+
return `[updated the options on ${label} to: ${quoteList((poll.options ?? []).map((o) => o.text))}]`;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=polls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polls.js","sourceRoot":"","sources":["../src/polls.ts"],"names":[],"mappings":"AAWA,2EAA2E;AAC3E,SAAS,SAAS,CAAC,IAAiB;IAClC,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACtD,CAAC;AAID,uEAAuE;AACvE,wEAAwE;AACxE,0EAA0E;AAC1E,oEAAoE;AACpE,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACxC,IACE,IAAI,CAAC,QAAQ,EAAE,uBAAuB,KAAK,CAAC;QAC5C,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,SAAS,CAAC,EAC3E,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,0EAA0E;AAC1E,0EAA0E;AAC1E,MAAM,UAAU,cAAc,CAAC,GAAgB;IAC7C,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAChC,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI,CAAC;AAClE,CAAC;AAYD,yEAA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,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,UAAU,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,KAAK,GAAG,CAAC;IACpF,CAAC;IACD,OAAO,2BAA2B,KAAK,QAAQ,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;AACvG,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
let reporter = () => { };
|
|
2
|
+
export function setRuntimeIssueReporter(next) {
|
|
3
|
+
reporter = next;
|
|
4
|
+
}
|
|
5
|
+
// Intentionally carries a closed code only. Hosted service graphs prohibit
|
|
6
|
+
// ambient output because raw errors can contain message/profile content.
|
|
7
|
+
export function reportRuntimeIssue(code) {
|
|
8
|
+
reporter(code);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=runtime-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-report.js","sourceRoot":"","sources":["../src/runtime-report.ts"],"names":[],"mappings":"AAEA,IAAI,QAAQ,GAAyB,GAAG,EAAE,GAAE,CAAC,CAAC;AAE9C,MAAM,UAAU,uBAAuB,CAAC,IAA0B;IAChE,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC;AAED,2EAA2E;AAC3E,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface MessageReaction {
|
|
2
|
+
id: number;
|
|
3
|
+
type: string;
|
|
4
|
+
emoji?: string;
|
|
5
|
+
is_from_me: boolean;
|
|
6
|
+
sender?: string;
|
|
7
|
+
created_at?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PollOption {
|
|
10
|
+
id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PollVote {
|
|
14
|
+
event_type?: string;
|
|
15
|
+
option_id?: string;
|
|
16
|
+
option_text?: string;
|
|
17
|
+
participant?: string;
|
|
18
|
+
server_time?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface MessagePoll {
|
|
21
|
+
kind: string;
|
|
22
|
+
event?: string;
|
|
23
|
+
question?: string;
|
|
24
|
+
options?: PollOption[];
|
|
25
|
+
vote?: PollVote;
|
|
26
|
+
votes?: PollVote[];
|
|
27
|
+
creator?: string;
|
|
28
|
+
participants?: string[];
|
|
29
|
+
poll_guid?: string;
|
|
30
|
+
original_guid?: string;
|
|
31
|
+
metadata?: {
|
|
32
|
+
associated_message_type?: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface MessageAttachment {
|
|
36
|
+
filename?: string;
|
|
37
|
+
original_path?: string;
|
|
38
|
+
transfer_name?: string;
|
|
39
|
+
mime_type?: string;
|
|
40
|
+
uti?: string;
|
|
41
|
+
total_bytes?: number;
|
|
42
|
+
missing?: boolean;
|
|
43
|
+
is_sticker?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface ImsgMessage {
|
|
46
|
+
id: number;
|
|
47
|
+
chat_id: number;
|
|
48
|
+
chat_guid?: string;
|
|
49
|
+
chat_identifier?: string;
|
|
50
|
+
chat_name?: string;
|
|
51
|
+
participants?: string[];
|
|
52
|
+
is_group: boolean;
|
|
53
|
+
guid: string;
|
|
54
|
+
sender?: string;
|
|
55
|
+
sender_name?: string;
|
|
56
|
+
is_from_me: boolean;
|
|
57
|
+
text?: string;
|
|
58
|
+
created_at?: string;
|
|
59
|
+
reply_to_guid?: string;
|
|
60
|
+
reactions?: MessageReaction[];
|
|
61
|
+
attachments?: MessageAttachment[];
|
|
62
|
+
poll?: MessagePoll;
|
|
63
|
+
is_reaction?: boolean;
|
|
64
|
+
reaction_type?: string;
|
|
65
|
+
reaction_emoji?: string;
|
|
66
|
+
is_reaction_add?: boolean;
|
|
67
|
+
reacted_to_guid?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface SendResult {
|
|
70
|
+
ok: boolean;
|
|
71
|
+
id?: number;
|
|
72
|
+
guid?: string;
|
|
73
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mapier/imsg-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for iMessage automation on macOS: the Gateway contract, ImsgGateway (real), and a device-free FakeGateway.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Mapier-Labs/imsg-sdk.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/Mapier-Labs/imsg-sdk#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Mapier-Labs/imsg-sdk/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"imessage",
|
|
16
|
+
"macos",
|
|
17
|
+
"gateway",
|
|
18
|
+
"sdk",
|
|
19
|
+
"automation"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"packageManager": "pnpm@10.30.3",
|
|
26
|
+
"pnpm": {
|
|
27
|
+
"onlyBuiltDependencies": [
|
|
28
|
+
"esbuild"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"main": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc -p tsconfig.build.json",
|
|
47
|
+
"test": "tsx --test tests/*.test.ts",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"lint": "biome check .",
|
|
50
|
+
"format": "biome check --write .",
|
|
51
|
+
"prepublishOnly": "pnpm build && pnpm lint && pnpm typecheck && pnpm test"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@biomejs/biome": "2.5.2",
|
|
55
|
+
"@types/node": "^24",
|
|
56
|
+
"tsx": "^4",
|
|
57
|
+
"typescript": "^5.6"
|
|
58
|
+
}
|
|
59
|
+
}
|