@nuwah/vertical-sdk 0.0.0-stage → 0.2.0-rc.1

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 (239) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +229 -2
  3. package/bin/nuwah-contract-check-rules.d.mts +41 -0
  4. package/bin/nuwah-contract-check-rules.mjs +333 -0
  5. package/bin/nuwah-contract-check.mjs +64 -0
  6. package/dist/accounting.d.ts +1417 -0
  7. package/dist/accounting.js +274 -0
  8. package/dist/active-org.d.ts +13 -0
  9. package/dist/active-org.js +59 -0
  10. package/dist/actors.d.ts +448 -0
  11. package/dist/actors.js +143 -0
  12. package/dist/ai.d.ts +359 -0
  13. package/dist/ai.js +229 -0
  14. package/dist/analytics.d.ts +37 -0
  15. package/dist/analytics.js +8 -0
  16. package/dist/atlas.d.ts +291 -0
  17. package/dist/atlas.js +78 -0
  18. package/dist/audit.d.ts +193 -0
  19. package/dist/audit.js +26 -0
  20. package/dist/authentication.d.ts +119 -0
  21. package/dist/authentication.js +83 -0
  22. package/dist/awards.d.ts +38 -0
  23. package/dist/awards.js +10 -0
  24. package/dist/blueprint/document.d.ts +178 -0
  25. package/dist/blueprint/document.js +17 -0
  26. package/dist/blueprint/index.d.ts +3 -0
  27. package/dist/blueprint/index.js +5 -0
  28. package/dist/blueprint/manifest.d.ts +105 -0
  29. package/dist/blueprint/manifest.js +11 -0
  30. package/dist/blueprint/validate.d.ts +14 -0
  31. package/dist/blueprint/validate.js +416 -0
  32. package/dist/bookings-directory.d.ts +118 -0
  33. package/dist/bookings-directory.js +289 -0
  34. package/dist/bookings-extra.d.ts +1448 -0
  35. package/dist/bookings-extra.js +582 -0
  36. package/dist/bookings.d.ts +1365 -0
  37. package/dist/bookings.js +305 -0
  38. package/dist/builder-code.d.ts +164 -0
  39. package/dist/builder-code.js +12 -0
  40. package/dist/builder-core-gaps.d.ts +83 -0
  41. package/dist/builder-core-gaps.js +8 -0
  42. package/dist/builder-repos.d.ts +73 -0
  43. package/dist/builder-repos.js +37 -0
  44. package/dist/builder.d.ts +730 -0
  45. package/dist/builder.js +105 -0
  46. package/dist/campaigns.d.ts +105 -0
  47. package/dist/campaigns.js +25 -0
  48. package/dist/catalogs.d.ts +188 -0
  49. package/dist/catalogs.js +36 -0
  50. package/dist/commerce-ai.d.ts +182 -0
  51. package/dist/commerce-ai.js +27 -0
  52. package/dist/connections.d.ts +278 -0
  53. package/dist/connections.js +96 -0
  54. package/dist/content-control.d.ts +121 -0
  55. package/dist/content-control.js +23 -0
  56. package/dist/contributions.d.ts +560 -0
  57. package/dist/contributions.js +140 -0
  58. package/dist/conversation-assist.d.ts +154 -0
  59. package/dist/conversation-assist.js +51 -0
  60. package/dist/conversation-info.d.ts +219 -0
  61. package/dist/conversation-info.js +43 -0
  62. package/dist/crm.d.ts +533 -0
  63. package/dist/crm.js +142 -0
  64. package/dist/dashboards.d.ts +119 -0
  65. package/dist/dashboards.js +22 -0
  66. package/dist/delegations.d.ts +161 -0
  67. package/dist/delegations.js +39 -0
  68. package/dist/docs.d.ts +289 -0
  69. package/dist/docs.js +49 -0
  70. package/dist/documents.d.ts +317 -0
  71. package/dist/documents.js +84 -0
  72. package/dist/drafts.d.ts +132 -0
  73. package/dist/drafts.js +56 -0
  74. package/dist/engagements.d.ts +133 -0
  75. package/dist/engagements.js +15 -0
  76. package/dist/event-stream.d.ts +54 -0
  77. package/dist/event-stream.js +228 -0
  78. package/dist/exchanges.d.ts +447 -0
  79. package/dist/exchanges.js +145 -0
  80. package/dist/exports.d.ts +113 -0
  81. package/dist/exports.js +81 -0
  82. package/dist/feeds.d.ts +228 -0
  83. package/dist/feeds.js +52 -0
  84. package/dist/files.d.ts +56 -0
  85. package/dist/files.js +55 -0
  86. package/dist/finance-insights.d.ts +41 -0
  87. package/dist/finance-insights.js +61 -0
  88. package/dist/fixed-assets.d.ts +155 -0
  89. package/dist/fixed-assets.js +28 -0
  90. package/dist/fulfilment-jobs.d.ts +405 -0
  91. package/dist/fulfilment-jobs.js +76 -0
  92. package/dist/fulfilment.d.ts +205 -0
  93. package/dist/fulfilment.js +39 -0
  94. package/dist/hr.d.ts +350 -0
  95. package/dist/hr.js +94 -0
  96. package/dist/http.d.ts +124 -0
  97. package/dist/http.js +392 -0
  98. package/dist/inbox.d.ts +206 -0
  99. package/dist/inbox.js +36 -0
  100. package/dist/index.d.ts +384 -0
  101. package/dist/index.js +294 -0
  102. package/dist/insights.d.ts +176 -0
  103. package/dist/insights.js +52 -0
  104. package/dist/inventory.d.ts +797 -0
  105. package/dist/inventory.js +120 -0
  106. package/dist/list-query.d.ts +211 -0
  107. package/dist/list-query.js +158 -0
  108. package/dist/listings.d.ts +381 -0
  109. package/dist/listings.js +173 -0
  110. package/dist/location-sharing.d.ts +83 -0
  111. package/dist/location-sharing.js +20 -0
  112. package/dist/marketplace.d.ts +268 -0
  113. package/dist/marketplace.js +59 -0
  114. package/dist/matching.d.ts +103 -0
  115. package/dist/matching.js +22 -0
  116. package/dist/media.d.ts +221 -0
  117. package/dist/media.js +239 -0
  118. package/dist/metrics.d.ts +125 -0
  119. package/dist/metrics.js +45 -0
  120. package/dist/moderation.d.ts +240 -0
  121. package/dist/moderation.js +40 -0
  122. package/dist/money.d.ts +41 -0
  123. package/dist/money.js +79 -0
  124. package/dist/my-data.d.ts +266 -0
  125. package/dist/my-data.js +32 -0
  126. package/dist/names.d.ts +14 -0
  127. package/dist/names.js +17 -0
  128. package/dist/occasions.d.ts +256 -0
  129. package/dist/occasions.js +40 -0
  130. package/dist/onboarding.d.ts +88 -0
  131. package/dist/onboarding.js +38 -0
  132. package/dist/pagination.d.ts +204 -0
  133. package/dist/pagination.js +141 -0
  134. package/dist/party-baseline-attributes.d.ts +245 -0
  135. package/dist/party-baseline-attributes.js +36 -0
  136. package/dist/party.d.ts +401 -0
  137. package/dist/party.js +56 -0
  138. package/dist/patient.d.ts +161 -0
  139. package/dist/patient.js +45 -0
  140. package/dist/payroll.d.ts +378 -0
  141. package/dist/payroll.js +60 -0
  142. package/dist/person-addresses.d.ts +88 -0
  143. package/dist/person-addresses.js +18 -0
  144. package/dist/person-cart.d.ts +250 -0
  145. package/dist/person-cart.js +63 -0
  146. package/dist/person-chat-assist.d.ts +47 -0
  147. package/dist/person-chat-assist.js +13 -0
  148. package/dist/person-data-webhooks.d.ts +72 -0
  149. package/dist/person-data-webhooks.js +86 -0
  150. package/dist/person-data.d.ts +212 -0
  151. package/dist/person-data.js +162 -0
  152. package/dist/person-locations.d.ts +54 -0
  153. package/dist/person-locations.js +6 -0
  154. package/dist/person-messaging.d.ts +405 -0
  155. package/dist/person-messaging.js +112 -0
  156. package/dist/person-notifications.d.ts +319 -0
  157. package/dist/person-notifications.js +164 -0
  158. package/dist/personalisation.d.ts +21 -0
  159. package/dist/personalisation.js +8 -0
  160. package/dist/platform.d.ts +63 -0
  161. package/dist/platform.js +45 -0
  162. package/dist/portfolio.d.ts +163 -0
  163. package/dist/portfolio.js +28 -0
  164. package/dist/pos.d.ts +743 -0
  165. package/dist/pos.js +129 -0
  166. package/dist/procurement.d.ts +664 -0
  167. package/dist/procurement.js +157 -0
  168. package/dist/promotions.d.ts +169 -0
  169. package/dist/promotions.js +39 -0
  170. package/dist/publications.d.ts +583 -0
  171. package/dist/publications.js +164 -0
  172. package/dist/ranking.d.ts +43 -0
  173. package/dist/ranking.js +34 -0
  174. package/dist/ratings.d.ts +293 -0
  175. package/dist/ratings.js +109 -0
  176. package/dist/reactions.d.ts +123 -0
  177. package/dist/reactions.js +41 -0
  178. package/dist/recipient-orders.d.ts +294 -0
  179. package/dist/recipient-orders.js +73 -0
  180. package/dist/relationships.d.ts +18 -0
  181. package/dist/relationships.js +8 -0
  182. package/dist/reporting.d.ts +107 -0
  183. package/dist/reporting.js +56 -0
  184. package/dist/sales.d.ts +270 -0
  185. package/dist/sales.js +66 -0
  186. package/dist/shares.d.ts +105 -0
  187. package/dist/shares.js +27 -0
  188. package/dist/shop.d.ts +993 -0
  189. package/dist/shop.js +215 -0
  190. package/dist/shopping-assistant.d.ts +65 -0
  191. package/dist/shopping-assistant.js +14 -0
  192. package/dist/spaces.d.ts +422 -0
  193. package/dist/spaces.js +118 -0
  194. package/dist/stored-value.d.ts +754 -0
  195. package/dist/stored-value.js +177 -0
  196. package/dist/types.d.ts +83 -0
  197. package/dist/types.js +2 -0
  198. package/dist/vault.d.ts +290 -0
  199. package/dist/vault.js +55 -0
  200. package/dist/vertical-runtime.d.ts +17 -0
  201. package/dist/vertical-runtime.js +8 -0
  202. package/dist/vite/build-manifest-plugin.d.ts +42 -0
  203. package/dist/vite/build-manifest-plugin.js +42 -0
  204. package/dist/vite/first-paint-plugin.d.ts +26 -0
  205. package/dist/vite/first-paint-plugin.js +57 -0
  206. package/dist/wishlists.d.ts +591 -0
  207. package/dist/wishlists.js +188 -0
  208. package/dist/workbench.d.ts +114 -0
  209. package/dist/workbench.js +22 -0
  210. package/dist/workspace.d.ts +190 -0
  211. package/dist/workspace.js +41 -0
  212. package/package.json +52 -4
  213. package/templates/extension-image.Dockerfile +38 -0
  214. package/templates/nuwah-vertical.yml +102 -0
  215. package/templates/vertical-app/.env.example +34 -0
  216. package/templates/vertical-app/README.md +108 -0
  217. package/templates/vertical-app/github/workflows/ci.yml +51 -0
  218. package/templates/vertical-app/gitignore +5 -0
  219. package/templates/vertical-app/index.html +12 -0
  220. package/templates/vertical-app/package.json +28 -0
  221. package/templates/vertical-app/src/App.tsx +64 -0
  222. package/templates/vertical-app/src/blueprint/blueprint.ts +45 -0
  223. package/templates/vertical-app/src/blueprint/screens.ts +15 -0
  224. package/templates/vertical-app/src/env.d.ts +18 -0
  225. package/templates/vertical-app/src/index.css +139 -0
  226. package/templates/vertical-app/src/lib/i18n.ts +5 -0
  227. package/templates/vertical-app/src/lib/iam.ts +19 -0
  228. package/templates/vertical-app/src/lib/operations.ts +93 -0
  229. package/templates/vertical-app/src/lib/router.ts +24 -0
  230. package/templates/vertical-app/src/lib/sdk.ts +21 -0
  231. package/templates/vertical-app/src/lib/theme.ts +18 -0
  232. package/templates/vertical-app/src/lib/words.ts +39 -0
  233. package/templates/vertical-app/src/main.tsx +25 -0
  234. package/templates/vertical-app/src/pages/AppScreens.tsx +71 -0
  235. package/templates/vertical-app/src/pages/AuthCallback.tsx +44 -0
  236. package/templates/vertical-app/src/pages/Home.tsx +36 -0
  237. package/templates/vertical-app/tsconfig.json +24 -0
  238. package/templates/vertical-app/vite.config.ts +23 -0
  239. package/templates/vertical-ci.yml +192 -0
@@ -0,0 +1,583 @@
1
+ import type { Http } from './http.js';
2
+ import { type ListPage, type ListQueryState } from './list-query.js';
3
+ import type { MediaAsset } from './media.js';
4
+ import type { EngagementSubject } from './engagements.js';
5
+ import { type BilingualText, type PartyReference, type PartyReferenceString, type PersonDomainCallOptions, type PersonDomainCursorPage, type PersonDomainEnvelope } from './actors.js';
6
+ export type PublicationAudience = 'private' | 'circle' | 'link' | 'public';
7
+ export type PublicationStatus = 'draft' | 'scheduled' | 'published' | 'hidden' | 'removed';
8
+ export type PublicationModerationState = 'not_required' | 'pending' | 'approved' | 'rejected';
9
+ export type PublicationReplyPermission = 'everyone' | 'connections' | 'mentioned_only' | 'nobody';
10
+ export type PublicationMediaScanStatus = 'pending' | 'clean' | 'infected' | 'error';
11
+ export type PublicationReportReason = 'spam' | 'harassment' | 'hate' | 'violence' | 'sexual_content' | 'misinformation' | 'intellectual_property' | 'other';
12
+ export interface PublicationMediaFile {
13
+ id: string;
14
+ position: number;
15
+ mime_type: string;
16
+ size_bytes: number;
17
+ alt_text: {
18
+ en: string | null;
19
+ ar: string | null;
20
+ };
21
+ scan_status: PublicationMediaScanStatus;
22
+ /** Core's media route for this file — opens with the bearer token only. */
23
+ path: string;
24
+ /**
25
+ * The same file as a RELATIVE link that opens without a token (for an `<img src>` or a native
26
+ * image cache): prefix core's base URL. Minted per read for a clean file, valid fifteen
27
+ * minutes; null when the file is not clean. Re-read the item for a fresh one.
28
+ */
29
+ signed_path: string | null;
30
+ }
31
+ /** One declared kind and the limits a composer renders from (`GET /kinds`). */
32
+ export interface PublicationKind {
33
+ key: string;
34
+ label: {
35
+ en: string | null;
36
+ ar: string | null;
37
+ };
38
+ vertical_key: string | null;
39
+ is_reply_kind: boolean;
40
+ reply_kind_key: string | null;
41
+ body_required: boolean;
42
+ maximum_body_length: number;
43
+ allowed_media_types: string[];
44
+ minimum_media: number;
45
+ maximum_media: number;
46
+ lifetime_seconds: number | null;
47
+ allows_replies: boolean;
48
+ allows_reposts: boolean;
49
+ allows_reactions: boolean;
50
+ appears_in_distribution: boolean;
51
+ default_audience: PublicationAudience;
52
+ default_connection_kind: string | null;
53
+ default_reply_permission: PublicationReplyPermission;
54
+ maximum_thread_depth: number;
55
+ }
56
+ export interface Publication {
57
+ id: string;
58
+ author: PartyReference;
59
+ kind: string;
60
+ body: string | null;
61
+ language: string | null;
62
+ /** Render the body in an isolate with this base direction. */
63
+ body_direction: 'ltr' | 'rtl' | null;
64
+ parent_id: string | null;
65
+ root_id: string | null;
66
+ depth: number;
67
+ quoted_item_id: string | null;
68
+ audience: PublicationAudience;
69
+ connection_kind: string | null;
70
+ reply_permission: PublicationReplyPermission;
71
+ status: PublicationStatus;
72
+ moderation_state: PublicationModerationState;
73
+ publish_at: string | null;
74
+ published_at: string | null;
75
+ /** Set for kinds with a lifetime. */
76
+ expires_at: string | null;
77
+ edited_at: string | null;
78
+ media: PublicationMediaFile[];
79
+ tags: string[];
80
+ mentions: PartyReference[];
81
+ attributes: Record<string, unknown>;
82
+ allows_replies: boolean;
83
+ allows_reposts: boolean;
84
+ allows_reactions: boolean;
85
+ /** Send back as `expected_version` when editing; a stale one answers 409. */
86
+ version: number;
87
+ /** Show edit controls only when true. */
88
+ viewer_is_author_side: boolean;
89
+ /** A provider-owned audience (`publications.close_circle`, `spaces.space`…); null otherwise. */
90
+ audience_key?: string | null;
91
+ audience_id?: string | null;
92
+ /** The poll attached to this item, or null. Results are read separately (`pollResults`). */
93
+ poll?: PublicationPoll | null;
94
+ /** People tagged on the files. Others see approved tags only; the author and the tagged party see pending ones too. */
95
+ media_tags?: PublicationMediaTag[];
96
+ /** What `quoted_item_id` is: a plain `repost`, a `quote` with the author's own words, or null (an original). */
97
+ reference_kind?: PublicationReferenceKind | null;
98
+ /** Public engagement counts; null when a policy hides them from this viewer (not zero). */
99
+ counts?: PublicationEngagementCounts | null;
100
+ /** True when the acting viewer has reposted this item (the pressed state of a repost button). */
101
+ viewer_has_reposted?: boolean;
102
+ viewer_has_saved?: boolean;
103
+ /** Files from the media pipeline (`media_asset_ids` on create), in position order, as this viewer may receive them. */
104
+ media_assets?: PublicationMediaAsset[];
105
+ subject?: EngagementSubject | null;
106
+ }
107
+ /** `GET ?ids[]=` — the items the viewer may see, in the order asked, and the ids that are gone for them. */
108
+ export interface PublicationBatch {
109
+ data: Publication[];
110
+ /** Missing, private, blocked, expired or removed — one answer for all of them. */
111
+ missing: string[];
112
+ }
113
+ /** The most ids one batch read takes. */
114
+ export declare const PUBLICATION_BATCH_MAXIMUM = 50;
115
+ /** How an item refers to another: a plain repost, or a quote that adds words. */
116
+ export type PublicationReferenceKind = 'repost' | 'quote';
117
+ /** Folded asynchronously: they trail a write by about a minute. */
118
+ export interface PublicationEngagementCounts {
119
+ replies: number;
120
+ reposts: number;
121
+ quotes: number;
122
+ /** Times shared into a conversation (SharedCards). */
123
+ shares: number;
124
+ }
125
+ /**
126
+ * A pipeline file attached to an item: core's `MediaAssetResource` v1 plus its position. Fields
127
+ * only the media namespace answers (purpose, subject, timestamps) may be absent here.
128
+ */
129
+ export type PublicationMediaAsset = Omit<MediaAsset, 'owner' | 'purpose' | 'subject' | 'created_at' | 'ready_at'> & Partial<Pick<MediaAsset, 'owner' | 'purpose' | 'subject' | 'created_at' | 'ready_at'>> & {
130
+ position: number;
131
+ };
132
+ /** The Media purpose publications declare (`client.media` uploads with it). */
133
+ export declare const PUBLICATION_MEDIA_PURPOSE = "publications.item_media";
134
+ /** Notification keys a profile receives when its items are shared on. */
135
+ export declare const PUBLICATION_REFERENCE_NOTIFICATION_KEYS: readonly ["publications.item.reposted", "publications.item.quoted"];
136
+ export type PublicationReferenceNotificationKey = (typeof PUBLICATION_REFERENCE_NOTIFICATION_KEYS)[number];
137
+ /** How many options a voter may pick. */
138
+ export type PollSelection = 'single' | 'multiple';
139
+ /** When results are shown to a viewer: always, once they voted, or once the poll closed. */
140
+ export type PollResultsVisibility = 'always' | 'after_vote' | 'after_close';
141
+ export interface PublicationPollOption {
142
+ id: string;
143
+ position: number;
144
+ label: string;
145
+ }
146
+ export interface PublicationPoll {
147
+ selection: PollSelection;
148
+ closes_at: string | null;
149
+ results_visibility: PollResultsVisibility;
150
+ is_closed: boolean;
151
+ options: PublicationPollOption[];
152
+ }
153
+ /** A poll as the composer sends it on create. 2–10 options, each at most 80 characters. */
154
+ export interface CreatePublicationPoll {
155
+ options: string[];
156
+ selection: PollSelection;
157
+ /** ISO 8601, 5 minutes to 30 days ahead. Omit for a poll that never closes. */
158
+ closes_at?: string | null;
159
+ results_visibility?: PollResultsVisibility;
160
+ }
161
+ /** One option's count; `votes` is null while the results are hidden from this viewer. */
162
+ export interface PollOptionResult {
163
+ id: string;
164
+ votes: number | null;
165
+ }
166
+ export interface PollResults {
167
+ item_id: string;
168
+ is_closed: boolean;
169
+ closes_at: string | null;
170
+ results_visible: boolean;
171
+ total_voters: number | null;
172
+ options: PollOptionResult[];
173
+ viewer_option_ids: string[];
174
+ }
175
+ export type MediaTagState = 'pending' | 'approved';
176
+ /** A party tagged at a point on a file; x and y are 0–1 fractions of the file's width and height. */
177
+ export interface PublicationMediaTag {
178
+ id: string;
179
+ media_id: string;
180
+ party: PartyReference;
181
+ x: number;
182
+ y: number;
183
+ state: MediaTagState;
184
+ }
185
+ export interface CreatePublicationMediaTag {
186
+ media_id: string;
187
+ party: PartyReferenceString;
188
+ x: number;
189
+ y: number;
190
+ }
191
+ /** A tag waiting for the acting profile's approval, with the item it is on (as the profile may see it). */
192
+ export interface PendingMediaTag {
193
+ id: string;
194
+ item_id: string;
195
+ /** A legacy staged file or a media-pipeline asset of the item (both are `media_id` on the wire). */
196
+ media_id: string;
197
+ x: number;
198
+ y: number;
199
+ state: MediaTagState;
200
+ created_at: string | null;
201
+ item?: Publication;
202
+ }
203
+ /** A family of provider-owned audiences the author may publish to (close circle, spaces…). */
204
+ export interface PublicationAudienceFamily {
205
+ audience_key: string;
206
+ label: BilingualText;
207
+ }
208
+ /** One audience of a family, for the picker. `name` is user text — render it isolated. */
209
+ export interface PublicationAudienceOption {
210
+ audience_key: string;
211
+ audience_id: string;
212
+ label: BilingualText;
213
+ name: string | null;
214
+ member_count: number | null;
215
+ }
216
+ /** The text an item had BEFORE an edit. */
217
+ export interface PublicationRevision {
218
+ revision_number: number;
219
+ body: string | null;
220
+ language: string | null;
221
+ audience: PublicationAudience;
222
+ created_at: string | null;
223
+ }
224
+ export interface PublicationViewer {
225
+ party: PartyReference;
226
+ viewed_at: string;
227
+ }
228
+ /** Who viewed an ephemeral item — the author side only. `hidden_viewers` chose not to be named. */
229
+ export interface PublicationViewersPage extends PersonDomainCursorPage<PublicationViewer> {
230
+ total_viewers: number;
231
+ hidden_viewers: number;
232
+ }
233
+ export interface PublicationHighlight {
234
+ id: string;
235
+ title: string;
236
+ cover_item_id: string | null;
237
+ item_count: number;
238
+ position: number;
239
+ version: number;
240
+ }
241
+ export interface TrendingTag {
242
+ tag: string;
243
+ folded: string;
244
+ uses: number;
245
+ rank: number;
246
+ }
247
+ export type TrendingWindow = '24h' | '7d';
248
+ export interface TrendingTagsAnswer {
249
+ data: TrendingTag[];
250
+ window: TrendingWindow;
251
+ }
252
+ export interface SuggestedTag {
253
+ tag: string;
254
+ folded: string;
255
+ uses: number;
256
+ }
257
+ /** A saved item: the publication as the saver may see it NOW, plus when it was saved. */
258
+ export type SavedPublication = Publication & {
259
+ saved_at: string;
260
+ };
261
+ export interface SavedCollection {
262
+ id: string;
263
+ name: string;
264
+ item_count: number;
265
+ cover_item_id: string | null;
266
+ /** The saver's own place for it; null until they order their collections (absent on older servers). */
267
+ position?: number | null;
268
+ version: number;
269
+ created_at: string | null;
270
+ }
271
+ export interface CloseCircleMember {
272
+ party: PartyReference;
273
+ added_at: string | null;
274
+ }
275
+ export interface CloseCirclePage extends PersonDomainCursorPage<CloseCircleMember> {
276
+ member_count: number;
277
+ }
278
+ /** Counters for one item — the author side only. They lag writes by a queue hop. */
279
+ export interface PublicationInsights {
280
+ item_id: string;
281
+ views: number;
282
+ reach: number;
283
+ reactions: number;
284
+ replies: number;
285
+ reposts: number;
286
+ saves: number;
287
+ poll_voters: number;
288
+ updated_at: string | null;
289
+ }
290
+ export interface PublicationDailyInsights {
291
+ day: string;
292
+ published: number;
293
+ views: number;
294
+ reach: number;
295
+ reactions: number;
296
+ replies: number;
297
+ reposts: number;
298
+ saves: number;
299
+ }
300
+ /** The close circle is a provider audience keyed by the profile's own id. */
301
+ export declare const CLOSE_CIRCLE_AUDIENCE_KEY = "publications.close_circle";
302
+ export interface CreatePublicationRequest {
303
+ /** Required unless `parent_id` is set (a reply's kind follows its parent's). */
304
+ kind?: string | null;
305
+ body?: string | null;
306
+ language?: string | null;
307
+ audience?: PublicationAudience | null;
308
+ connection_kind?: string | null;
309
+ reply_permission?: PublicationReplyPermission | null;
310
+ parent_id?: string | null;
311
+ quoted_item_id?: string | null;
312
+ /** ISO 8601 with offset — a future time schedules the item. */
313
+ publish_at?: string | null;
314
+ draft?: boolean;
315
+ /** Older staged files (`uploadMedia` / `requestMediaUpload`). */
316
+ media_ids?: string[];
317
+ /** Media-pipeline files (uploaded with purpose {@link PUBLICATION_MEDIA_PURPOSE}), in display order. */
318
+ media_asset_ids?: string[];
319
+ subject?: {
320
+ type: string;
321
+ id: string;
322
+ } | null;
323
+ /** Explicit tags beside the body's `#words`. */
324
+ tags?: string[];
325
+ mentions?: PartyReferenceString[];
326
+ attributes?: Record<string, unknown>;
327
+ /** With `audience: 'circle'`: a provider-owned audience instead of a connection kind. */
328
+ audience_key?: string | null;
329
+ audience_id?: string | null;
330
+ poll?: CreatePublicationPoll | null;
331
+ media_tags?: CreatePublicationMediaTag[];
332
+ }
333
+ /** Only the fields sent change. Widening the audience after publishing is refused. */
334
+ export interface EditPublicationRequest {
335
+ expected_version: number;
336
+ body?: string | null;
337
+ language?: string | null;
338
+ audience?: PublicationAudience;
339
+ connection_kind?: string | null;
340
+ reply_permission?: PublicationReplyPermission;
341
+ tags?: string[];
342
+ mentions?: PartyReferenceString[];
343
+ attributes?: Record<string, unknown>;
344
+ }
345
+ export interface SchedulePublicationRequest {
346
+ expected_version: number;
347
+ /** Omit to publish now. */
348
+ publish_at?: string | null;
349
+ to_draft?: boolean;
350
+ }
351
+ /** A staged file, as its uploader sees it. */
352
+ export interface PublicationMedia {
353
+ id: string;
354
+ item_id: string | null;
355
+ mime_type: string;
356
+ size_bytes: number;
357
+ alt_text: {
358
+ en: string | null;
359
+ ar: string | null;
360
+ };
361
+ scan_status: PublicationMediaScanStatus;
362
+ created_at: string | null;
363
+ }
364
+ export interface PublicationMediaUploadSlot {
365
+ data: PublicationMedia;
366
+ upload_url: string;
367
+ upload_method: 'PUT';
368
+ expires_in: number;
369
+ }
370
+ export interface PublicationReport {
371
+ id: string;
372
+ item_id: string;
373
+ reason: PublicationReportReason;
374
+ reason_label: BilingualText | null;
375
+ status: string;
376
+ created_at: string | null;
377
+ reviewed_at: string | null;
378
+ }
379
+ export interface PublicationModerationDecision {
380
+ id: string;
381
+ item_id: string;
382
+ decision: string;
383
+ reason: string | null;
384
+ reason_label: BilingualText | null;
385
+ decided_at: string | null;
386
+ appeal_state: string;
387
+ appealed_at: string | null;
388
+ appeal_decided_at: string | null;
389
+ }
390
+ export interface PublicationPageQuery {
391
+ cursor?: string | null;
392
+ limit?: number;
393
+ }
394
+ /** A day range (`YYYY-MM-DD`, read in `time_zone`). */
395
+ export interface PublicationDayRange {
396
+ from?: string | null;
397
+ to?: string | null;
398
+ time_zone?: string | null;
399
+ }
400
+ /** A declared list's question, typed to the sorts and filters that list declares. */
401
+ export type DeclaredPublicationQuery<Sort extends string, Filter> = Omit<ListQueryState, 'sort' | 'filter'> & {
402
+ sort?: Sort | `-${Sort}` | null;
403
+ filter?: Filter;
404
+ };
405
+ /** `publications.authored` — what one profile published. */
406
+ export type PublicationAuthoredListQuery = DeclaredPublicationQuery<'posted_at', {
407
+ kind?: string[] | null;
408
+ /** `original`: neither a repost nor a quote. */
409
+ reference?: Array<'original' | PublicationReferenceKind> | null;
410
+ has_media?: boolean | null;
411
+ posted_at?: PublicationDayRange | null;
412
+ }>;
413
+ /** `publications.drafts` — the acting profile's drafts and scheduled items. */
414
+ export type PublicationDraftListQuery = DeclaredPublicationQuery<'created_at' | 'publish_at', {
415
+ status?: Array<'draft' | 'scheduled'> | null;
416
+ kind?: string[] | null;
417
+ }>;
418
+ /** `publications.replies` — the default order is a policy (oldest first unless the product chose otherwise). */
419
+ export type PublicationReplyListQuery = DeclaredPublicationQuery<'created_at' | 'reactions', {
420
+ has_media?: boolean | null;
421
+ }>;
422
+ /** `publications.quotes` — quote posts of one item the viewer may see. */
423
+ export type PublicationQuoteListQuery = DeclaredPublicationQuery<'published_at', Record<string, never>>;
424
+ /** `publications.tag` — public items carrying one tag. */
425
+ export type PublicationTagListQuery = DeclaredPublicationQuery<'published_at', {
426
+ kind?: string[] | null;
427
+ has_media?: boolean | null;
428
+ }>;
429
+ /** `publications.search` — needs `search` or `filter.tag`. */
430
+ export type PublicationSearchQuery = DeclaredPublicationQuery<'published_at', {
431
+ kind?: string[] | null;
432
+ tag?: string | null;
433
+ }>;
434
+ /** `publications.saved` — the saver's own saved items. */
435
+ export type SavedPublicationListQuery = DeclaredPublicationQuery<'saved_at', {
436
+ collection?: string | null;
437
+ kind?: string[] | null;
438
+ }>;
439
+ /** `publications.saved_collections` — the saver's collections, paged. */
440
+ export type SavedCollectionsListQuery = DeclaredPublicationQuery<'created_at' | 'name' | 'item_count' | 'position', Record<string, never>>;
441
+ /** What `repost()` may say about the repost itself. */
442
+ export interface PublicationRepostRequest {
443
+ audience?: PublicationAudience | null;
444
+ connection_kind?: string | null;
445
+ }
446
+ export declare function createPublicationsNamespace(http: Http): {
447
+ /** GET /kinds — every declared kind with its limits, for the composer. */
448
+ kinds: (options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationKind[]>>;
449
+ /** POST — create. 201 when new, 200 when the idempotency key replays the first item. */
450
+ create: (request: CreatePublicationRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Publication>>;
451
+ /** GET /{item}. */
452
+ show: (itemId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Publication>>;
453
+ /**
454
+ * GET ?ids[]= — up to {@link PUBLICATION_BATCH_MAXIMUM} items in ONE read (quoted posts on a
455
+ * page, a space's posts, notification targets), each decided like `show`. More ids are read
456
+ * in further batches and merged, in the order asked; `missing` is everything gone for this viewer.
457
+ */
458
+ many: (itemIds: string[], options?: PersonDomainCallOptions) => Promise<PublicationBatch>;
459
+ /** PATCH /{item}. */
460
+ edit: (itemId: string, request: EditPublicationRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Publication>>;
461
+ /** DELETE /{item} — the author removes it. */
462
+ remove: (itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
463
+ /** POST /{item}/schedule — schedule a draft, publish it now, or return it to draft. */
464
+ schedule: (itemId: string, request: SchedulePublicationRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Publication>>;
465
+ /** GET /{item}/replies — a declared list (`publications.replies`). */
466
+ replies: (itemId: string, query?: PublicationReplyListQuery, options?: PersonDomainCallOptions) => Promise<ListPage<Publication>>;
467
+ /** GET /{item}/quotes — quote posts of an item, as the viewer may see them (`publications.quotes`). */
468
+ quotes: (itemId: string, query?: PublicationQuoteListQuery, options?: PersonDomainCallOptions) => Promise<ListPage<Publication>>;
469
+ /**
470
+ * POST /{item}/repost — share it as-is. 201 with the new repost, 200 with the existing one
471
+ * when this profile already reposted it (one repost per profile). 404 when not visible;
472
+ * 422 `reposts_not_allowed` for a kind that cannot be reposted or an item that is not public.
473
+ */
474
+ repost: (itemId: string, request?: PublicationRepostRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Publication>>;
475
+ /** DELETE /{item}/repost — undo this profile's repost. Idempotent (204 when there was none). */
476
+ undoRepost: (itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
477
+ /** POST — a quote post: your words above the quoted item (`create` with `quoted_item_id`). */
478
+ quote: (itemId: string, request: Omit<CreatePublicationRequest, "quoted_item_id" | "parent_id">, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Publication>>;
479
+ /** GET /by/{actor} — what one profile published, as the viewer may see it (`publications.authored`). */
480
+ authored: (actorId: string, query?: PublicationAuthoredListQuery, options?: PersonDomainCallOptions) => Promise<ListPage<Publication>>;
481
+ /** POST /{item}/reports — reporting the same item again answers the first report (200). */
482
+ report: (itemId: string, reason: PublicationReportReason, notes?: string | null, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationReport>>;
483
+ /** GET /{item}/decisions — the author's own item only. */
484
+ decisions: (itemId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationModerationDecision[]>>;
485
+ /** POST /decisions/{decision}/appeal. */
486
+ appeal: (decisionId: string, note?: string | null, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationModerationDecision>>;
487
+ /** POST /media — a small file (≤ 10 MB) as multipart `file`, scanned before it answers. */
488
+ uploadMedia: (file: Blob, altText?: {
489
+ en?: string | null;
490
+ ar?: string | null;
491
+ }, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationMedia>>;
492
+ /** POST /media/uploads — a presigned slot for one large file. */
493
+ requestMediaUpload: (request: {
494
+ mime_type: string;
495
+ size_bytes: number;
496
+ alt_text?: {
497
+ en?: string | null;
498
+ ar?: string | null;
499
+ };
500
+ }, options?: PersonDomainCallOptions) => Promise<PublicationMediaUploadSlot>;
501
+ /** POST /media/{media}/complete — after the bytes were PUT to the slot. */
502
+ completeMediaUpload: (mediaId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationMedia>>;
503
+ /** GET /audiences — the provider audience families the acting profile may publish to. */
504
+ audienceFamilies: (options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationAudienceFamily[]>>;
505
+ /** GET /audiences/{key}/options — one family's audiences, a cursor page. */
506
+ audienceOptions: (audienceKey: string, query?: PublicationPageQuery, options?: PersonDomainCallOptions) => Promise<PersonDomainCursorPage<PublicationAudienceOption>>;
507
+ /**
508
+ * GET /drafts — the acting profile's unpublished items (`publications.drafts`). Pass a
509
+ * status word (the older form: `'draft'` by default, `'scheduled'`, or `'all'`), or a
510
+ * {@link PublicationDraftListQuery}; a word and a query merge into `filter.status`.
511
+ */
512
+ drafts: (statusOrQuery?: "draft" | "scheduled" | "all" | PublicationDraftListQuery, query?: PublicationDraftListQuery, options?: PersonDomainCallOptions) => Promise<ListPage<Publication>>;
513
+ /** GET /{item}/revisions — earlier text, oldest first. 404 when the policy hides it from this viewer. */
514
+ revisions: (itemId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationRevision[]>>;
515
+ /** POST /{item}/pin — refused `pin_limit_reached` past the policy's maximum. */
516
+ pin: (itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
517
+ unpin: (itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
518
+ /** GET /by/{actor}/pinned — in pin order. */
519
+ pinned: (actorId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Publication[]>>;
520
+ /** POST /{item}/views — record that the acting viewer saw it. Idempotent. */
521
+ recordView: (itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
522
+ /** GET /{item}/viewers — the author side only. */
523
+ viewers: (itemId: string, query?: PublicationPageQuery, options?: PersonDomainCallOptions) => Promise<PublicationViewersPage>;
524
+ /** POST /{item}/private-replies — a reply delivered as a private message (202). */
525
+ privateReply: (itemId: string, body: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<{
526
+ message_id: string;
527
+ }>>;
528
+ highlights: (actorId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationHighlight[]>>;
529
+ createHighlight: (title: string, itemIds: string[], options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationHighlight>>;
530
+ editHighlight: (highlightId: string, request: {
531
+ expected_version: number;
532
+ title?: string;
533
+ position?: number;
534
+ }, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationHighlight>>;
535
+ removeHighlight: (highlightId: string, options?: PersonDomainCallOptions) => Promise<void>;
536
+ addToHighlight: (highlightId: string, itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
537
+ removeFromHighlight: (highlightId: string, itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
538
+ highlightItems: (highlightId: string, query?: PublicationPageQuery, options?: PersonDomainCallOptions) => Promise<PersonDomainCursorPage<Publication>>;
539
+ /** GET /tags/{tag} — public items carrying the tag (matched folded, so spellings meet). */
540
+ tagged: (tag: string, query?: PublicationTagListQuery, options?: PersonDomainCallOptions) => Promise<ListPage<Publication>>;
541
+ trendingTags: (window?: TrendingWindow, limit?: number, options?: PersonDomainCallOptions) => Promise<TrendingTagsAnswer>;
542
+ suggestTags: (text: string, limit?: number, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<SuggestedTag[]>>;
543
+ /**
544
+ * GET /search (`publications.search`) — body and tags, folded (أحمد finds احمد). Text
545
+ * starting with `#` searches that tag only (sent as `filter[tag]`). Pass `null` text with
546
+ * `filter.tag` to page one tag through search's filters.
547
+ */
548
+ search: (text: string | null, query?: PublicationSearchQuery, options?: PersonDomainCallOptions) => Promise<ListPage<Publication>>;
549
+ pendingMediaTags: (query?: PublicationPageQuery, options?: PersonDomainCallOptions) => Promise<PersonDomainCursorPage<PendingMediaTag>>;
550
+ approveMediaTag: (tagId: string, options?: PersonDomainCallOptions) => Promise<void>;
551
+ /** The tagged party removes themselves, or the author removes the tag. */
552
+ removeMediaTag: (tagId: string, options?: PersonDomainCallOptions) => Promise<void>;
553
+ /** PUT /{item}/poll/votes — replaces the viewer's choice; a retry with the same key is one vote. */
554
+ vote: (itemId: string, optionIds: string[], options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PollResults>>;
555
+ /** DELETE /{item}/poll/votes — refused `poll_vote_locked` when the policy locks votes. */
556
+ retractVote: (itemId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PollResults>>;
557
+ /** GET /polls/results — up to 100 items in one call. */
558
+ pollResults: (itemIds: string[], options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PollResults[]>>;
559
+ save: (itemId: string, collectionId?: string | null, options?: PersonDomainCallOptions) => Promise<void>;
560
+ unsave: (itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
561
+ /** GET /saved (`publications.saved`) — a collection id (the older form) or a {@link SavedPublicationListQuery}. */
562
+ saved: (collectionOrQuery?: string | null | SavedPublicationListQuery, query?: SavedPublicationListQuery, options?: PersonDomainCallOptions) => Promise<ListPage<SavedPublication>>;
563
+ /** GET /saved/collections — the first page (the older form; see `savedCollectionsPage`). */
564
+ savedCollections: (options?: PersonDomainCallOptions) => Promise<ListPage<SavedCollection>>;
565
+ /** GET /saved/collections (`publications.saved_collections`) — sorted, searched, paged. */
566
+ savedCollectionsPage: (query?: SavedCollectionsListQuery, options?: PersonDomainCallOptions) => Promise<ListPage<SavedCollection>>;
567
+ createSavedCollection: (name: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<SavedCollection>>;
568
+ renameSavedCollection: (collectionId: string, name: string, expectedVersion: number, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<SavedCollection>>;
569
+ removeSavedCollection: (collectionId: string, options?: PersonDomainCallOptions) => Promise<void>;
570
+ /** PUT /saved/collections/order — the saver's own order, first to last; answers every collection in it. */
571
+ reorderSavedCollections: (collectionIds: string[], options?: PersonDomainCallOptions) => Promise<ListPage<SavedCollection>>;
572
+ removeFromSavedCollection: (collectionId: string, itemId: string, options?: PersonDomainCallOptions) => Promise<void>;
573
+ closeCircle: (query?: PublicationPageQuery, options?: PersonDomainCallOptions) => Promise<CloseCirclePage>;
574
+ addToCloseCircle: (parties: PartyReferenceString[], options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<{
575
+ added: number;
576
+ member_count: number;
577
+ }>>;
578
+ removeFromCloseCircle: (party: PartyReference, options?: PersonDomainCallOptions) => Promise<void>;
579
+ insights: (itemId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationInsights>>;
580
+ /** GET /insights/daily — at most 92 days, `YYYY-MM-DD` both ends. */
581
+ dailyInsights: (from: string, to: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<PublicationDailyInsights[]>>;
582
+ };
583
+ export type PublicationsNamespace = ReturnType<typeof createPublicationsNamespace>;