palbase 0.25.1 → 0.27.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.
Files changed (52) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/backend/engine.js +2 -2
  3. package/dist/backend/env.js +1 -1
  4. package/dist/backend/index.js +3 -3
  5. package/dist/backend/stack.js +1 -1
  6. package/dist/backend/test.js +2 -2
  7. package/dist/chunks/{G6HTDGFI.js → 2VZXMKE4.js} +2 -2
  8. package/dist/chunks/{5XNUS4RO.js → 5ETIB37E.js} +2 -2
  9. package/dist/chunks/{JPUEFD5R.js → 5PLOENVJ.js} +1 -1
  10. package/dist/chunks/{RRMYWHH6.js → 7CVC2UYK.js} +2 -2
  11. package/dist/chunks/{FCJKKXVF.js → AVQ7DQA4.js} +1 -1
  12. package/dist/chunks/{3NXLBGEQ.js → BRK5A42K.js} +3 -3
  13. package/dist/chunks/BXJGHBB5.js +2 -0
  14. package/dist/chunks/{IVTH3I2M.js → CTKJ7E5R.js} +2 -2
  15. package/dist/chunks/{JRVM63RG.js → HHQ5RAYH.js} +2 -2
  16. package/dist/chunks/{CIVBMN5Z.js → HKLIKCYR.js} +2 -2
  17. package/dist/chunks/{JN6E6CVV.js → JCS5FSY6.js} +2 -2
  18. package/dist/chunks/{B3UA4AVW.js → LXS4IDDQ.js} +2 -2
  19. package/dist/chunks/{Y5WCHNQI.js → NGAXCQJ4.js} +2 -2
  20. package/dist/chunks/{IERZK64H.js → O5LG6IFL.js} +1 -1
  21. package/dist/chunks/{Q2SNPNA4.js → QL42CXIT.js} +1 -1
  22. package/dist/chunks/{HRPJA5AL.js → R2KG2E4H.js} +2 -2
  23. package/dist/chunks/{7HZ4EKJP.js → UJATFHC4.js} +2 -2
  24. package/dist/chunks/{VFPMVP2K.js → UWZP4YV6.js} +2 -2
  25. package/dist/chunks/{BA4P3PMP.js → XUZ532UW.js} +1 -1
  26. package/dist/chunks/{3SLLOZC4.js → Y2RBMBJB.js} +1 -1
  27. package/dist/chunks/{YE7MYOBE.js → YS5GF7JB.js} +2 -2
  28. package/dist/chunks/ZBY3Q6Q2.js +2 -0
  29. package/dist/chunks/{4CLXBBRV.js → ZN4ELT45.js} +1 -1
  30. package/dist/cli.js +116 -116
  31. package/dist/cloud/index.js +2 -2
  32. package/dist/refuse/ai.js +1 -1
  33. package/dist/refuse/backend.js +1 -1
  34. package/dist/refuse/cloud.js +1 -1
  35. package/dist/refuse/server.js +1 -1
  36. package/dist/server/index.js +2 -2
  37. package/dist/server/testing.js +2 -2
  38. package/dist/web/index.js +2 -2
  39. package/dist/web/message.js +2 -2
  40. package/dist/web/palbe.js +2 -2
  41. package/dist/web/paywall.js +2 -2
  42. package/dist/web/push-sw.js +1 -1
  43. package/dist/web/ssr.js +2 -2
  44. package/dist/web/vite.js +2 -2
  45. package/package.json +2 -2
  46. package/types/cloud/src/generated/project.d.ts +1 -1
  47. package/types/internal/src/modules/events.d.ts +2 -2
  48. package/types/internal/src/modules/messaging.d.ts +311 -16
  49. package/types/server/src/server.d.ts +8 -0
  50. package/types/web/src/messaging.d.ts +47 -6
  51. package/dist/chunks/GP64QR4G.js +0 -2
  52. package/dist/chunks/LSJGREA3.js +0 -2
@@ -80,15 +80,27 @@ export type AdminConversationRequest = {
80
80
  */
81
81
  photo?: string;
82
82
  settings?: GroupSettings;
83
+ /**
84
+ * The place of the app's it belongs to, as the app names it (org:<id>, project:<id>): 1 to 128 letters, digits and : _ . / @ -. Fixed as it is made; absent: none.
85
+ */
86
+ space?: string;
83
87
  /**
84
88
  * A group's title.
85
89
  */
86
90
  title?: string;
91
+ /**
92
+ * open (a space named: required): found in its space's open groups and joined by whom the project's hook lets (POST …/join); closed (the default): joined when someone adds you. A direct conversation is never open.
93
+ */
94
+ visibility?: "open" | "closed";
87
95
  };
88
96
  /**
89
- * A message the project's server says, as the app.
97
+ * A message the project's server says: as the app, or as one of the conversation's people (as_user_id, with via).
90
98
  */
91
99
  export type AdminMessageRequest = {
100
+ /**
101
+ * The person it is written as: one of the conversation's people now. The message is theirs, as if they sent it — what they may send there, their read of it, the others' unread counts and pushes, from them — and says via what wrote it. Each is in the access log, the person named.
102
+ */
103
+ as_user_id?: string;
92
104
  /**
93
105
  * The server's own id of it: sent again with it, it is the same message.
94
106
  */
@@ -101,6 +113,14 @@ export type AdminMessageRequest = {
101
113
  * What it says.
102
114
  */
103
115
  text: string;
116
+ /**
117
+ * The message whose thread it answers.
118
+ */
119
+ thread_id?: string;
120
+ /**
121
+ * What wrote it (as pal), shown with the message (Message.via): 1 to 32 letters, digits and _ . -. Required with as_user_id — the others always know it was not the person's own hand.
122
+ */
123
+ via?: string;
104
124
  };
105
125
  /**
106
126
  * The project's server's word on a person's name and picture.
@@ -115,6 +135,55 @@ export type AdminProfileRequest = {
115
135
  */
116
136
  name?: string | null;
117
137
  };
138
+ /**
139
+ * What the project's server changes in a conversation: what its admins may, and whether it is read-only; what it names changes.
140
+ */
141
+ export type AdminUpdateConversation = {
142
+ /**
143
+ * Who adds people.
144
+ */
145
+ add_policy?: "all" | "admins";
146
+ /**
147
+ * A group's description; null clears it.
148
+ */
149
+ description?: string | null;
150
+ /**
151
+ * Who changes details and timer.
152
+ */
153
+ edit_policy?: "all" | "admins";
154
+ /**
155
+ * Whether someone added reads what was said before them.
156
+ */
157
+ history_for_new_members?: boolean;
158
+ /**
159
+ * Where the app reads a group's picture; null clears it.
160
+ */
161
+ photo?: string | null;
162
+ /**
163
+ * Read-only: its people read what was said in it, nobody writes in it (no message, reaction, edit, file, or change to its details); false makes it writable again. Told in it as read_only_on / read_only_off.
164
+ */
165
+ read_only?: boolean;
166
+ /**
167
+ * Who writes: all or admins.
168
+ */
169
+ send_policy?: "all" | "admins";
170
+ /**
171
+ * How long a new message lives; null: for good.
172
+ */
173
+ timer_seconds?: number | null;
174
+ /**
175
+ * A group's title.
176
+ */
177
+ title?: string | null;
178
+ /**
179
+ * A direct conversation's vanish mode.
180
+ */
181
+ vanish?: boolean;
182
+ /**
183
+ * A group's: open (found in its space's open groups and joined by whom the project's hook lets; the group has a space — 400 space_required otherwise) or closed. Its admins' (or the project's server's); a person opening one is asked of the hook first (open_group): refused, 403 not_allowed. Opened, whoever joins reads what its history shows newcomers (history_for_new_members).
184
+ */
185
+ visibility?: "open" | "closed";
186
+ };
118
187
  /**
119
188
  * A file a message carries.
120
189
  */
@@ -290,6 +359,10 @@ export type Conversation = {
290
359
  */
291
360
  photo: string | null;
292
361
  settings: ConversationSettings;
362
+ /**
363
+ * The place of the app's it belongs to (org:<id>, project:<id>), fixed as it was made; null: none. Always sent; absent (an answer kept from before it was): null.
364
+ */
365
+ space?: string | null;
293
366
  /**
294
367
  * A group's title.
295
368
  */
@@ -298,6 +371,10 @@ export type Conversation = {
298
371
  * How many times it changed.
299
372
  */
300
373
  version: number;
374
+ /**
375
+ * open: a group found in its space's open groups and joined by whom the project's hook lets; closed: joined when someone adds you (every direct conversation). Always sent; absent (an answer kept from before it was): closed.
376
+ */
377
+ visibility?: "open" | "closed";
301
378
  };
302
379
  /**
303
380
  * A conversation made, and whom it did not take.
@@ -329,6 +406,10 @@ export type ConversationCreatedEvent = {
329
406
  * Its people.
330
407
  */
331
408
  member_ids: string[];
409
+ /**
410
+ * Its space; null: none.
411
+ */
412
+ space?: string | null;
332
413
  };
333
414
  /**
334
415
  * messaging.conversation.deleted
@@ -353,6 +434,31 @@ export type ConversationPage = {
353
434
  */
354
435
  next_cursor?: string;
355
436
  };
437
+ /**
438
+ * messaging.conversation.read
439
+ */
440
+ export type ConversationReadEvent = {
441
+ /**
442
+ * The conversation.
443
+ */
444
+ conversation_id: string;
445
+ /**
446
+ * How far they read it (a message's seq).
447
+ */
448
+ read_seq: number;
449
+ /**
450
+ * The conversation's space; null: none.
451
+ */
452
+ space: string | null;
453
+ /**
454
+ * The thread they read; null: the conversation itself.
455
+ */
456
+ thread_id: string | null;
457
+ /**
458
+ * Who read it.
459
+ */
460
+ user_id: string;
461
+ };
356
462
  /**
357
463
  * How a conversation runs.
358
464
  */
@@ -369,6 +475,10 @@ export type ConversationSettings = {
369
475
  * Whether someone added reads what was said before them.
370
476
  */
371
477
  history_for_new_members: boolean;
478
+ /**
479
+ * Read-only (the project's server's word): its people read what was said in it, nobody writes in it — no message, reaction, edit, file, or change to its details; the server still may. Always sent; absent (an answer kept from before it was): false.
480
+ */
481
+ read_only?: boolean;
372
482
  /**
373
483
  * Who writes in the group: all or admins.
374
484
  */
@@ -383,9 +493,13 @@ export type ConversationSettings = {
383
493
  vanish: boolean;
384
494
  };
385
495
  /**
386
- * Opens the direct conversation with a person.
496
+ * Opens the direct conversation with a person, in a space.
387
497
  */
388
498
  export type DirectRequest = {
499
+ /**
500
+ * The space it is in (org:<id>): the pair has one direct conversation in each space, and one with none. 1 to 128 letters, digits and : _ . / @ -; absent: none.
501
+ */
502
+ space?: string;
389
503
  /**
390
504
  * The other person.
391
505
  */
@@ -472,10 +586,18 @@ export type GroupRequest = {
472
586
  */
473
587
  photo?: string;
474
588
  settings?: GroupSettings;
589
+ /**
590
+ * The place of the app's it belongs to, as the app names it (org:<id>, project:<id>): 1 to 128 letters, digits and : _ . / @ -. Fixed as it is made; absent: none.
591
+ */
592
+ space?: string;
475
593
  /**
476
594
  * Its title.
477
595
  */
478
596
  title: string;
597
+ /**
598
+ * open (a space named: required): found in its space's open groups and joined by whom the project's hook lets (POST …/join); closed (the default): joined when someone adds you. A person's open group is asked of the project's hook first (open_group, the space named): refused, 403 not_allowed.
599
+ */
600
+ visibility?: "open" | "closed";
479
601
  };
480
602
  /**
481
603
  * How a group runs, as it is made.
@@ -520,7 +642,7 @@ export type HiddenMessage = {
520
642
  */
521
643
  export type HookSettings = {
522
644
  /**
523
- * When it does not answer: allow everyone, or deny (the client retries).
645
+ * When it does not answer: allow everyone, or deny (the client retries). Allow is for a direct conversation and people added to a group alone: a space's open groups — having one, finding them, joining one — are refused (503 hook_unavailable) while it is silent, whatever this says.
524
646
  */
525
647
  on_error: "allow" | "deny";
526
648
  /**
@@ -537,7 +659,7 @@ export type HookSettings = {
537
659
  */
538
660
  export type HookSettingsRequest = {
539
661
  /**
540
- * allow or deny (default).
662
+ * allow or deny (default). Allow never opens a space's open groups (open_group, list_open, join): those are refused while the hook is silent.
541
663
  */
542
664
  on_error?: "allow" | "deny";
543
665
  /**
@@ -788,11 +910,76 @@ export type Message = {
788
910
  * How many times it changed (a reaction, an answer in its thread, an edit).
789
911
  */
790
912
  version: number;
913
+ /**
914
+ * What the project's server wrote it through, as one of the conversation's people or as the app (as pal): show it beside the message ("sent by Pal"). null: its writer wrote it. Always sent; absent (an answer kept from before it was): null.
915
+ */
916
+ via?: string | null;
791
917
  /**
792
918
  * When it is seen a limited number of times.
793
919
  */
794
920
  view_once: ViewOnce | null;
795
921
  };
922
+ /**
923
+ * messaging.message.created
924
+ */
925
+ export type MessageCreatedEvent = {
926
+ /**
927
+ * The conversation.
928
+ */
929
+ conversation_id: string;
930
+ /**
931
+ * direct or group.
932
+ */
933
+ conversation_kind: string;
934
+ /**
935
+ * When it was written.
936
+ */
937
+ created_at: string;
938
+ /**
939
+ * Whether it carries files.
940
+ */
941
+ has_attachments: boolean;
942
+ /**
943
+ * text or media (files).
944
+ */
945
+ kind: string;
946
+ /**
947
+ * Whom its words name.
948
+ */
949
+ mention_ids: string[];
950
+ /**
951
+ * The message: read it with the secret key (GET /messaging/admin/conversations/{conversation_id}/messages).
952
+ */
953
+ message_id: string;
954
+ /**
955
+ * Whom it is for: the conversation's people but its writer (and one blocking them, whom it never reaches).
956
+ */
957
+ recipient_ids: string[];
958
+ /**
959
+ * Its writer; null: the project's server, as the app.
960
+ */
961
+ sender_id: string | null;
962
+ /**
963
+ * Its place in the conversation.
964
+ */
965
+ seq: number;
966
+ /**
967
+ * The conversation's space; null: none.
968
+ */
969
+ space: string | null;
970
+ /**
971
+ * What it says, when the project lets the event say it (settings.event_text) — never a message meant to go (vanish mode, seen a limited number of times, living a while): the event stream keeps an event 7 days; absent otherwise.
972
+ */
973
+ text?: string;
974
+ /**
975
+ * The message whose thread it answers; null: none.
976
+ */
977
+ thread_id: string | null;
978
+ /**
979
+ * What the project's server wrote it through (as pal); null: its writer wrote it.
980
+ */
981
+ via: string | null;
982
+ };
796
983
  export type MessagePage = {
797
984
  /**
798
985
  * The messages.
@@ -845,9 +1032,9 @@ export type MyProfile = {
845
1032
  */
846
1033
  export type NotAdded = {
847
1034
  /**
848
- * not_allowed (the project's hook did not let them be reached, or they block whoever added them) or group_full.
1035
+ * not_allowed (the project's hook did not let them be reached, or they block whoever added them), group_full, or user_deleted (their account was deleted).
849
1036
  */
850
- reason: "not_allowed" | "group_full";
1037
+ reason: "not_allowed" | "group_full" | "user_deleted";
851
1038
  /**
852
1039
  * The person.
853
1040
  */
@@ -866,6 +1053,54 @@ export type NotificationsRequest = {
866
1053
  */
867
1054
  notify_level?: "all" | "mentions" | "none";
868
1055
  };
1056
+ /**
1057
+ * An open group of a space, as one who may find it reads it.
1058
+ */
1059
+ export type OpenGroup = {
1060
+ /**
1061
+ * When it was made.
1062
+ */
1063
+ created_at: string;
1064
+ /**
1065
+ * Its description.
1066
+ */
1067
+ description: string | null;
1068
+ /**
1069
+ * The group.
1070
+ */
1071
+ id: string;
1072
+ /**
1073
+ * Whether the reader is in it.
1074
+ */
1075
+ joined: boolean;
1076
+ /**
1077
+ * When something was last said in it; null: nothing yet.
1078
+ */
1079
+ last_message_at: string | null;
1080
+ /**
1081
+ * How many people are in it.
1082
+ */
1083
+ member_count: number;
1084
+ /**
1085
+ * Where the app reads its picture.
1086
+ */
1087
+ photo: string | null;
1088
+ /**
1089
+ * Its space.
1090
+ */
1091
+ space: string;
1092
+ /**
1093
+ * Its title.
1094
+ */
1095
+ title: string | null;
1096
+ };
1097
+ export type OpenGroupPage = {
1098
+ data: OpenGroup[];
1099
+ /**
1100
+ * The next page's cursor; absent on the last.
1101
+ */
1102
+ next_cursor?: string;
1103
+ };
869
1104
  /**
870
1105
  * A person as the conversations show them.
871
1106
  */
@@ -1348,6 +1583,10 @@ export type Settings = {
1348
1583
  * A deleted user's messages: keep (their writer anonymous) or delete.
1349
1584
  */
1350
1585
  deleted_user_messages: "keep" | "delete";
1586
+ /**
1587
+ * Whether messaging.message.created says what the message says (text) — never a message meant to go (vanish mode, seen a limited number of times, living a while): the words leave the sealed store for the project's backend, kept on the event stream for 7 days. false: the backend reads the message with the secret key. Always sent; absent: false.
1588
+ */
1589
+ event_text?: boolean;
1351
1590
  /**
1352
1591
  * The hook asked whom one may reach; null: anyone may reach anyone.
1353
1592
  */
@@ -1377,6 +1616,10 @@ export type SettingsRequest = {
1377
1616
  * keep or delete.
1378
1617
  */
1379
1618
  deleted_user_messages?: "keep" | "delete";
1619
+ /**
1620
+ * Whether messaging.message.created says what the message says (text).
1621
+ */
1622
+ event_text?: boolean;
1380
1623
  /**
1381
1624
  * The hook; null removes it.
1382
1625
  */
@@ -1456,7 +1699,7 @@ export type SystemEvent = {
1456
1699
  */
1457
1700
  title?: string;
1458
1701
  /**
1459
- * What happened: created, members_added, member_left, member_removed, role_changed, title_changed, description_changed, photo_changed, timer_changed, vanish_on, vanish_off, settings_changed, screenshot.
1702
+ * What happened: created, members_added, member_joined (one joined an open group by themselves), member_left, member_removed, role_changed, title_changed, description_changed, photo_changed, timer_changed, vanish_on, vanish_off, settings_changed, read_only_on, read_only_off, screenshot. A person whose account was deleted is named deleted_… here, as everywhere.
1460
1703
  */
1461
1704
  type: string;
1462
1705
  /**
@@ -1559,6 +1802,10 @@ export type UpdateConversation = {
1559
1802
  * A direct conversation's vanish mode.
1560
1803
  */
1561
1804
  vanish?: boolean;
1805
+ /**
1806
+ * A group's: open (found in its space's open groups and joined by whom the project's hook lets; the group has a space — 400 space_required otherwise) or closed. Its admins' (or the project's server's); a person opening one is asked of the hook first (open_group): refused, 403 not_allowed. Opened, whoever joins reads what its history shows newcomers (history_for_new_members).
1807
+ */
1808
+ visibility?: "open" | "closed";
1562
1809
  };
1563
1810
  /**
1564
1811
  * Changes a member's role.
@@ -1739,6 +1986,14 @@ export interface Events {
1739
1986
  * messaging.conversation.deleted: a conversation was deleted for everyone.
1740
1987
  */
1741
1988
  "messaging.conversation.deleted": ConversationDeletedEvent;
1989
+ /**
1990
+ * messaging.conversation.read: a person read a conversation, or a thread of it, further (a read receipt, or clearing it). Told only to the endpoints that name it, and written only while one does.
1991
+ */
1992
+ "messaging.conversation.read": ConversationReadEvent;
1993
+ /**
1994
+ * messaging.message.created: a message reached a conversation — a person's, or the project's server's (as the app, or as a person: via) — with whom it is for and whom it names. Told only to the endpoints that name it (an endpoint of every event is not sent it), and written only while one does.
1995
+ */
1996
+ "messaging.message.created": MessageCreatedEvent;
1742
1997
  /**
1743
1998
  * messaging.report.created: a person reported a conversation, someone in it or messages of it; read it with the secret key.
1744
1999
  */
@@ -1761,13 +2016,15 @@ export declare function client(t: Transport): {
1761
2016
  /**
1762
2017
  * The project's conversations
1763
2018
  *
1764
- * The project's conversations (a person's, when `user_id` names one), the latest first.
2019
+ * The project's conversations (a person's, when `user_id` names one; the direct one of two, when `with` names the other), the latest first.
1765
2020
  */
1766
2021
  adminListConversations(input?: {
1767
2022
  query?: {
1768
- user_id?: string; /** How many (1 to 100; 30 when absent). */
2023
+ user_id?: string; /** Another person, beside user_id: the direct conversation of the two (none when they have none): their direct conversations in every space (space narrows them). */
2024
+ with?: string; /** How many (1 to 100; 30 when absent). */
1769
2025
  limit?: number; /** The cursor a page handed out (next_cursor). */
1770
- cursor?: string;
2026
+ cursor?: string; /** Only the conversations of these spaces: one space a parameter, repeated for more, at most 20. */
2027
+ space?: string[];
1771
2028
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1772
2029
  signal?: AbortSignal;
1773
2030
  }): Promise<Reply<200, ConversationPage>>;
@@ -1802,6 +2059,18 @@ export declare function client(t: Transport): {
1802
2059
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1803
2060
  signal?: AbortSignal;
1804
2061
  }): Promise<Reply<204, undefined>>;
2062
+ /**
2063
+ * Change a conversation, or make it read-only
2064
+ *
2065
+ * The project's server changes a conversation as its admins may — a group's title, description, picture, timer and policies; a direct conversation's timer and vanish mode — and makes it read-only, or writable again: its people read what was said in it, nobody writes in it (no message, reaction, edit, file, or change to its details), while the server still may (POST …/messages). Each change is told in the conversation, as a message of the platform's.
2066
+ */
2067
+ adminUpdateConversation(input: {
2068
+ path: {
2069
+ conversation_id: string;
2070
+ };
2071
+ body: AdminUpdateConversation; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2072
+ signal?: AbortSignal;
2073
+ }): Promise<Reply<200, Conversation>>;
1805
2074
  /**
1806
2075
  * Add people to a group
1807
2076
  *
@@ -1844,7 +2113,7 @@ export declare function client(t: Transport): {
1844
2113
  /**
1845
2114
  * Say something in a conversation
1846
2115
  *
1847
- * The project's server says something in a conversation, as the app. Sent again with the same `client_message_id`, it is the same message.
2116
+ * The project's server says something in a conversation — as the app (sender_id null), or as one of its people (as_user_id, with via): the message is theirs, as if they sent it (what they may send there, their read of it, the others' unread counts and pushes, from them), and says what wrote it (Message.via). In a thread too (thread_id). Sent again with the same client_message_id, it is the same message (200).
1848
2117
  */
1849
2118
  adminSendMessage(input: {
1850
2119
  path: {
@@ -1881,7 +2150,7 @@ export declare function client(t: Transport): {
1881
2150
  /**
1882
2151
  * A person's name and picture
1883
2152
  *
1884
- * The project's server names a person and gives their picture, as its own records say.
2153
+ * The project's server names a person and gives their picture, as its own records say. A person whose account was deleted is not given one again (`409 user_deleted`): a sync racing the deletion does not bring them back.
1885
2154
  */
1886
2155
  adminPutProfile(input: {
1887
2156
  path: {
@@ -1975,12 +2244,13 @@ export declare function client(t: Transport): {
1975
2244
  /**
1976
2245
  * The reader's conversations
1977
2246
  *
1978
- * The signed-in person's conversations, the latest first, with their own place in each, what they have not read and the last message each shows. A direct conversation someone else opened shows once something is said in it; one they cleared, once something new is.
2247
+ * The signed-in person's conversations (of the spaces it names, when it names any), the latest first, with their own place in each, what they have not read and the last message each shows. A direct conversation someone else opened shows once something is said in it; one they cleared, once something new is.
1979
2248
  */
1980
2249
  listConversations(input?: {
1981
2250
  query?: {
1982
2251
  limit?: number; /** The cursor a page handed out (next_cursor). */
1983
- cursor?: string;
2252
+ cursor?: string; /** Only the conversations of these spaces: one space a parameter, repeated for more (space=org:a&space=org:b), at most 20. */
2253
+ space?: string[];
1984
2254
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
1985
2255
  signal?: AbortSignal;
1986
2256
  }): Promise<Reply<200, ConversationPage>>;
@@ -2061,6 +2331,17 @@ export declare function client(t: Transport): {
2061
2331
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2062
2332
  signal?: AbortSignal;
2063
2333
  }): Promise<Reply<204, undefined>>;
2334
+ /**
2335
+ * Join an open group
2336
+ *
2337
+ * The reader joins an open group by themselves — when the project's hook lets them (action join, the group and its space named; with no hook, anyone) and it has room. They read it as one added to it does (its history when it shows it to newcomers), and its people are told (member_joined). Joining one they are in answers it as it is. One an admin removed does not join again by themselves.
2338
+ */
2339
+ joinGroup(input: {
2340
+ path: {
2341
+ conversation_id: string;
2342
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2343
+ signal?: AbortSignal;
2344
+ }): Promise<Reply<200, Conversation>>;
2064
2345
  /**
2065
2346
  * A conversation's people
2066
2347
  *
@@ -2309,6 +2590,19 @@ export declare function client(t: Transport): {
2309
2590
  body: UploadRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2310
2591
  signal?: AbortSignal;
2311
2592
  }): Promise<Reply<201, Upload>>;
2593
+ /**
2594
+ * A space's open groups
2595
+ *
2596
+ * A space's open groups, the oldest first, each with whether the reader is in it — when the project's hook lets the reader find them (action list_open, the space named; with no hook, anyone). Join one with POST /messaging/conversations/{conversation_id}/join.
2597
+ */
2598
+ listOpenGroups(input: {
2599
+ query: {
2600
+ space: string; /** How many (1 to 100; 50 when absent). */
2601
+ limit?: number; /** The cursor a page handed out (next_cursor). */
2602
+ cursor?: string;
2603
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2604
+ signal?: AbortSignal;
2605
+ }): Promise<Reply<200, OpenGroupPage>>;
2312
2606
  /**
2313
2607
  * The reader's own profile
2314
2608
  *
@@ -2404,7 +2698,8 @@ export declare function client(t: Transport): {
2404
2698
  by?: "words" | "meaning"; /** Search one conversation of the reader's only. */
2405
2699
  conversation_id?: string; /** How many (1 to 50; 20 when absent). */
2406
2700
  limit?: number; /** The cursor a page handed out (next_cursor). */
2407
- cursor?: string;
2701
+ cursor?: string; /** Search only the conversations of these spaces: one space a parameter, repeated for more, at most 20. */
2702
+ space?: string[];
2408
2703
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
2409
2704
  signal?: AbortSignal;
2410
2705
  }): Promise<Reply<200, SearchPage>>;
@@ -2419,7 +2714,7 @@ export declare function client(t: Transport): {
2419
2714
  /**
2420
2715
  * Change how the project runs its conversations
2421
2716
  *
2422
- * What it names changes: how long messages are kept (null: for good), whether pushes say what a message says, what becomes of a deleted user's messages, and the hook asked whom one may reach (null: none). The hook is POSTed `{event: "messaging.can_message", action: "direct" | "group_add", from_user_id, to_user_ids, conversation_id}`, signed as Standard Webhooks sign (webhook-id, webhook-timestamp, webhook-signature), and answers 200 `{allowed_user_ids: [...]}`. A hook set for the first time is given its signing secret, here, once.
2717
+ * What it names changes: how long messages are kept (null: for good), whether pushes say what a message says, what becomes of a deleted user's messages, the hook asked whom one may reach (null: none), and whether messaging.message.created says what a message says (event_text). The hook is POSTed `{event: "messaging.can_message", action: "direct" | "group_add" | "open_group" | "list_open" | "join", from_user_id, to_user_ids, conversation_id, space}` — whom of to_user_ids from_user_id may reach (a direct conversation, a group they are added to), or, to_user_ids being [from_user_id], whether they may have an open group in a space (open_group: making one, or opening theirs), find a space's open groups (list_open) or join one (join); space is the conversation's (absent: none), signed as Standard Webhooks sign (webhook-id, webhook-timestamp, webhook-signature), and answers 200 `{allowed_user_ids: [...]}`. A hook set for the first time is given its signing secret, here, once.
2423
2718
  */
2424
2719
  putSettings(input: {
2425
2720
  body: SettingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
@@ -35,6 +35,14 @@ export interface PalbaseServer {
35
35
  fields: Fields;
36
36
  flags: ReturnType<typeof modules.flags.client>;
37
37
  machines: ReturnType<typeof modules.machines.client>;
38
+ /**
39
+ * The messaging module's calls as its contract states them. The project's server makes its admin ones with the
40
+ * secret key: a conversation for people (adminCreateConversation, in a space), a message as the app or as one of
41
+ * the conversation's people (adminSendMessage with as_user_id and via: "pal" — the others see it was not their own
42
+ * hand), its conversations by person, pair or space (adminListConversations). A person's own calls are their app's
43
+ * (palbase/web, the iOS and Android SDKs), with their session.
44
+ */
45
+ messaging: ReturnType<typeof modules.messaging.client>;
38
46
  notify: ReturnType<typeof modules.notify.client>;
39
47
  purchases: ReturnType<typeof modules.purchases.client>;
40
48
  realtime: ReturnType<typeof modules.realtime.client>;
@@ -11,6 +11,7 @@ export type Profile = api.Profile;
11
11
  export type ScheduledMessage = api.ScheduledMessage;
12
12
  export type ThreadState = api.ThreadState;
13
13
  export type SearchMatch = api.SearchMatch;
14
+ export type OpenGroup = api.OpenGroup;
14
15
  export type { DeletedGroup, Entry, Hit, OutboxItem } from '../../internal/src/messaging/index.js';
15
16
  export interface MessagingOptions {
16
17
  /**
@@ -117,6 +118,8 @@ export interface SearchOptions {
117
118
  by?: 'words' | 'meaning';
118
119
  /** Search one conversation of the person's only. */
119
120
  conversationId?: string;
121
+ /** Search the conversations of one space only (org:<id>): a place of the app's they belong to. */
122
+ space?: string;
120
123
  /** How many messages a page holds (1 to 50; 20 when absent). */
121
124
  limit?: number;
122
125
  /** The page after the one that handed out this cursor (nextCursor): a search by words alone. */
@@ -256,8 +259,13 @@ export declare class Messaging {
256
259
  private seat;
257
260
  private typed;
258
261
  private tell;
259
- /** The person's conversations, the latest first, kept up to date. */
260
- conversations(): ConversationList;
262
+ /**
263
+ * The person's conversations, the latest first, kept up to date — those of some spaces only (spaces: the places of
264
+ * the app's they belong to, as org:<id>), when it names any.
265
+ */
266
+ conversations(opts?: {
267
+ spaces?: string[];
268
+ }): ConversationList;
261
269
  /**
262
270
  * The groups the person was in that someone deleted, kept up to date while the person may still report them
263
271
  * (reportableUntil, 14 days after), the latest to stop first: report() names one by its id, no message needed. A
@@ -273,15 +281,27 @@ export declare class Messaging {
273
281
  conversation(conversationId: string, opts?: {
274
282
  at?: string;
275
283
  }): ConversationView;
276
- /** The direct conversation with someone — the one there is, or a new one. */
277
- direct(userId: string): Promise<ConversationView>;
278
- /** A new group, the person its owner. */
284
+ /**
285
+ * The direct conversation with someone — the one there is, or a new one — in a space (org:<id>): the two have one in
286
+ * each space, and one with none. The project's hook is asked, the space named.
287
+ */
288
+ direct(userId: string, opts?: {
289
+ space?: string;
290
+ }): Promise<ConversationView>;
291
+ /**
292
+ * A new group, the person its owner — in a space (org:<id>), and open (found in the space's open groups and joined
293
+ * by whom the project's hook lets: openGroups, join) or closed (the default: joined when someone adds you). An open
294
+ * group names its space ('space_required'), and the project's hook is asked whether the person may make one there
295
+ * ('open_group'; refused: 'not_allowed').
296
+ */
279
297
  group(input: {
280
298
  title: string;
281
299
  memberIds?: string[];
282
300
  description?: string;
283
301
  photo?: string;
284
302
  settings?: api.GroupSettings;
303
+ space?: string;
304
+ visibility?: 'open' | 'closed';
285
305
  }): Promise<{
286
306
  conversation: ConversationView;
287
307
  notAdded: api.NotAdded[];
@@ -301,8 +321,26 @@ export declare class Messaging {
301
321
  * means instead, the nearest first, each with its score: one page, no conversations by name. Opened as any find is.
302
322
  */
303
323
  search(query: string, opts?: SearchOptions): Promise<SearchResults>;
304
- /** The person's conversations whose name says every word asked: a group's title, the other person's name. */
324
+ /** The person's conversations (of a space, when one is named) whose name says every word asked: a group's title, the other person's name. */
305
325
  private named;
326
+ /**
327
+ * A space's open groups (org:<id>), the oldest first, a page at a time — each with whether the person is in it
328
+ * (joined) — when the project's hook lets them find them; refused otherwise (a PalbaseError, code 'not_allowed').
329
+ */
330
+ openGroups(space: string, opts?: {
331
+ limit?: number;
332
+ cursor?: string;
333
+ }): Promise<{
334
+ items: OpenGroup[];
335
+ nextCursor: string | null;
336
+ }>;
337
+ /**
338
+ * Joins an open group by themselves — when the project's hook lets them and it has room — and answers it, the person
339
+ * in it. Joining one they are in answers it as it is. Refused (a PalbaseError) when the hook does not let them
340
+ * ('not_allowed'), an admin removed them ('removed'), it is read-only ('read_only') or full ('group_full'); a closed
341
+ * group is not found.
342
+ */
343
+ join(conversationId: string): Promise<ConversationView>;
306
344
  /** The person's messages scheduled for later, kept up to date. */
307
345
  scheduled(): ScheduledList;
308
346
  /** The threads the person follows, the latest answered first. */
@@ -373,6 +411,9 @@ declare abstract class View<S> implements Observed<S> {
373
411
  protected abstract read(): S;
374
412
  }
375
413
  export declare class ConversationList extends View<ConversationListState> {
414
+ /** The spaces it is narrowed to (none: every conversation). */
415
+ readonly spaces: readonly string[];
416
+ constructor(m: Messaging, spaces?: readonly string[]);
376
417
  protected touches(t: Touched): boolean;
377
418
  protected read(): ConversationListState;
378
419
  }