@pmate/chat-sdk 0.13.0-profile.1 → 0.13.0-profile.10

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.
Files changed (37) hide show
  1. package/README.md +26 -0
  2. package/lib/profile.d.ts +4 -1
  3. package/lib/profile.js +4 -1
  4. package/lib/runtime/profileChat.d.ts +118 -1
  5. package/lib/runtime/profileChat.js +98 -30
  6. package/lib/runtime/profileCommitQueue.d.ts +2 -1
  7. package/lib/runtime/profileCommitQueue.js +26 -7
  8. package/lib/runtime/profileCoordinator.d.ts +19 -19
  9. package/lib/runtime/profileCoordinator.js +127 -94
  10. package/lib/runtime/profileDatabase.d.ts +7 -7
  11. package/lib/runtime/profileDatabase.js +57 -42
  12. package/lib/runtime/profileGenerationBuilder.d.ts +2 -3
  13. package/lib/runtime/profileGenerationBuilder.js +60 -26
  14. package/lib/runtime/profileInboxFeed.d.ts +1 -0
  15. package/lib/runtime/profileInboxFeed.js +12 -2
  16. package/lib/runtime/profileLegacyInbox.d.ts +8 -0
  17. package/lib/runtime/profileLegacyInbox.js +114 -0
  18. package/lib/runtime/profileLegacyOutbox.d.ts +7 -0
  19. package/lib/runtime/profileLegacyOutbox.js +106 -0
  20. package/lib/runtime/profileLegacyReading.d.ts +7 -0
  21. package/lib/runtime/profileLegacyReading.js +110 -0
  22. package/lib/runtime/profileMemoryStore.d.ts +22 -2
  23. package/lib/runtime/profileMemoryStore.js +140 -12
  24. package/lib/runtime/profileOutboxDispatcher.d.ts +3 -0
  25. package/lib/runtime/profileOutboxDispatcher.js +41 -5
  26. package/lib/runtime/profileOwner.d.ts +11 -6
  27. package/lib/runtime/profileOwner.js +71 -46
  28. package/lib/runtime/profileProjection.d.ts +54 -5
  29. package/lib/runtime/profileProjection.js +336 -51
  30. package/lib/runtime/profileReadingIndex.d.ts +1 -0
  31. package/lib/runtime/profileReadingIndex.js +17 -1
  32. package/lib/runtime/profileStoreTypes.d.ts +15 -9
  33. package/lib/runtime/{profileReplica.d.ts → profileWorkerClient.d.ts} +10 -26
  34. package/lib/runtime/{profileReplica.js → profileWorkerClient.js} +55 -102
  35. package/lib/runtime/profileWorkerHost.d.ts +4 -6
  36. package/lib/runtime/profileWorkerHost.js +58 -21
  37. package/package.json +2 -2
@@ -1,11 +1,42 @@
1
- import { type InboxEvent, type InboxBootstrap } from "./inboxStore.js";
1
+ import { type InboxEvent, type InboxMessage, type InboxBootstrap } from "./inboxStore.js";
2
2
  import { ProfileReadingIndex } from "./profileReadingIndex.js";
3
3
  import { ProfileWindowDirectory } from "./profileWindows.js";
4
4
  import type { ProfileSnapshot } from "./profileMemoryStore.js";
5
- import type { ProfileCurrentState, ProfileIdentity, ProfileMessage, ProfileOutboxCommand, ProfileThread, ProfileWindow } from "./profileStoreTypes.js";
5
+ import type { ProfileCurrentState, ProfileIdentity, ProfileMessage, ProfileOutboxCommand, ProfileReadingSource, ProfileThread, ProfileWindow } from "./profileStoreTypes.js";
6
6
  import type { ChatRuntimeMessage } from "./protocol.js";
7
7
  export declare const profileDiscussionId: (parent: string, root: string) => string;
8
8
  export type ProfileLocalOperation = {
9
+ type: "restoreReadingSources";
10
+ threadId: string;
11
+ sources: ProfileReadingSource[];
12
+ } | {
13
+ type: "restoreMessageReadingFacts";
14
+ messageId: string;
15
+ facts: ProfileMessage["explicitReadingFacts"];
16
+ } | {
17
+ type: "migrationCompleted";
18
+ id: string;
19
+ } | {
20
+ type: "restoreReadingCommand";
21
+ command: ProfileOutboxCommand;
22
+ } | {
23
+ type: "restoreReadingIntent";
24
+ threadId: string;
25
+ messageId: string;
26
+ commandId: string;
27
+ policy: "visible" | "played";
28
+ createdAt: number;
29
+ defer?: boolean;
30
+ } | {
31
+ type: "restoreEvent";
32
+ event: InboxEvent;
33
+ recalled?: boolean;
34
+ } | {
35
+ type: "restoreInvitation";
36
+ message: InboxMessage;
37
+ acceptedAt: number;
38
+ recalled?: boolean;
39
+ } | {
9
40
  type: "register";
10
41
  threadId: string;
11
42
  kind: "group" | "dm";
@@ -13,14 +44,21 @@ export type ProfileLocalOperation = {
13
44
  teamId: string;
14
45
  title?: string;
15
46
  } | {
16
- type: "revoke";
17
- threadId: string;
47
+ type: "teamAccess";
48
+ teamId: string;
49
+ allowed: false;
50
+ } | {
51
+ type: "teamAccess";
52
+ teamId: string;
53
+ allowed: true;
54
+ expectedAccessRevision: number;
18
55
  } | {
19
56
  type: "send";
20
57
  threadId: string;
21
58
  parentThreadId?: string;
22
59
  message: ChatRuntimeMessage;
23
60
  command: ProfileOutboxCommand;
61
+ preserveWire?: boolean;
24
62
  } | {
25
63
  type: "commandPayload";
26
64
  commandId: string;
@@ -29,6 +67,7 @@ export type ProfileLocalOperation = {
29
67
  type: "observe";
30
68
  threadId: string;
31
69
  messageIds: string[];
70
+ allVisible?: boolean;
32
71
  policy: "visible" | "played";
33
72
  commandId: string;
34
73
  createdAt: number;
@@ -54,6 +93,7 @@ export type PreparedProfileProjection = {
54
93
  readingIndices: Map<string, ProfileReadingIndex>;
55
94
  outbox: ProfileOutboxCommand[];
56
95
  deleteOutbox: string[];
96
+ rejected?: readonly (Error | undefined)[];
57
97
  };
58
98
  /** Committed authority for the replay reducer. Drafts contain only changed rows;
59
99
  * failure discards the draft, leaving both entities and indexes untouched. */
@@ -70,7 +110,16 @@ export declare class ProfileProjection {
70
110
  constructor(identity: ProfileIdentity, snapshot: ProfileSnapshot & {
71
111
  outbox?: ProfileOutboxCommand[];
72
112
  }, windowStart: number);
73
- prepare(events: readonly ProfileOperation[]): PreparedProfileProjection;
113
+ prepare(events: readonly ProfileOperation[]): {
114
+ rejected: (Error | undefined)[];
115
+ current: ProfileCurrentState;
116
+ threads: ProfileThread[];
117
+ windows: ProfileWindow[];
118
+ messages: ProfileMessage[];
119
+ readingIndices: Map<string, ProfileReadingIndex>;
120
+ outbox: ProfileOutboxCommand[];
121
+ deleteOutbox: string[];
122
+ };
74
123
  prepareBasis(bootstrap: InboxBootstrap): PreparedProfileProjection;
75
124
  accept(prepared: PreparedProfileProjection): void;
76
125
  snapshot(): ProfileSnapshot;