@nadohq/mobile-client 0.64.0 → 0.65.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 (177) hide show
  1. package/README.md +20 -2
  2. package/dist/{MobileClient-aDxiM_Kf.cjs → MobileClient-CfVZXTcz.cjs} +298 -1
  3. package/dist/MobileClient-CfVZXTcz.cjs.map +1 -0
  4. package/dist/MobileClient.cjs +1 -1
  5. package/dist/MobileClient.d.cts +173 -7
  6. package/dist/MobileClient.d.cts.map +1 -1
  7. package/dist/MobileClient.d.ts +173 -7
  8. package/dist/MobileClient.d.ts.map +1 -1
  9. package/dist/MobileClient.js +298 -1
  10. package/dist/MobileClient.js.map +1 -1
  11. package/dist/{MobileServerFailureError-Dd3c6P_Z.d.ts → MobileServerFailureError-BZVwlsMg.d.ts} +3 -3
  12. package/dist/{MobileServerFailureError-Dd3c6P_Z.d.ts.map → MobileServerFailureError-BZVwlsMg.d.ts.map} +1 -1
  13. package/dist/{MobileServerFailureError-Bpa_WA9f.d.cts → MobileServerFailureError-CbtK8kD4.d.cts} +3 -3
  14. package/dist/{MobileServerFailureError-Bpa_WA9f.d.cts.map → MobileServerFailureError-CbtK8kD4.d.cts.map} +1 -1
  15. package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.cts +15 -0
  16. package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.cts.map +1 -0
  17. package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.ts +15 -0
  18. package/dist/MobileUnsupportedFeedItemError-BsZvW8i2.d.ts.map +1 -0
  19. package/dist/{buildSignedMobileRequest-NHbMAPzd.d.cts → buildSignedMobileRequest-C1v0flCR.d.cts} +2 -2
  20. package/dist/{buildSignedMobileRequest-NHbMAPzd.d.cts.map → buildSignedMobileRequest-C1v0flCR.d.cts.map} +1 -1
  21. package/dist/{buildSignedMobileRequest-Cb1T74xV.d.ts → buildSignedMobileRequest-UeeWdYGU.d.ts} +2 -2
  22. package/dist/{buildSignedMobileRequest-Cb1T74xV.d.ts.map → buildSignedMobileRequest-UeeWdYGU.d.ts.map} +1 -1
  23. package/dist/{canonicalize-BBYGh17w.d.ts → canonicalize-5eeZrkzQ.d.ts} +2 -2
  24. package/dist/canonicalize-5eeZrkzQ.d.ts.map +1 -0
  25. package/dist/{canonicalize-BF_SiNvO.d.cts → canonicalize-CBaZprTo.d.cts} +2 -2
  26. package/dist/canonicalize-CBaZprTo.d.cts.map +1 -0
  27. package/dist/{clientTypes-BWFKo9oE.d.cts → clientTypes-C9dJufxk.d.ts} +569 -25
  28. package/dist/clientTypes-C9dJufxk.d.ts.map +1 -0
  29. package/dist/{clientTypes-DCTiUV0H.d.ts → clientTypes-_mEgzmNs.d.cts} +569 -25
  30. package/dist/clientTypes-_mEgzmNs.d.cts.map +1 -0
  31. package/dist/dataMappers.cjs +488 -9
  32. package/dist/dataMappers.cjs.map +1 -1
  33. package/dist/dataMappers.d.cts +190 -7
  34. package/dist/dataMappers.d.cts.map +1 -1
  35. package/dist/dataMappers.d.ts +190 -7
  36. package/dist/dataMappers.d.ts.map +1 -1
  37. package/dist/dataMappers.js +460 -10
  38. package/dist/dataMappers.js.map +1 -1
  39. package/dist/{eip712MethodByType-BSx11xG-.d.cts → eip712MethodByType-D8jLoxDu.d.cts} +2 -2
  40. package/dist/eip712MethodByType-D8jLoxDu.d.cts.map +1 -0
  41. package/dist/{eip712MethodByType-DkiAjCLs.d.ts → eip712MethodByType-DcUh8h-l.d.ts} +2 -2
  42. package/dist/eip712MethodByType-DcUh8h-l.d.ts.map +1 -0
  43. package/dist/index.cjs +3 -1
  44. package/dist/index.d.cts +16 -15
  45. package/dist/index.d.ts +16 -15
  46. package/dist/index.js +2 -1
  47. package/dist/{mobileErrorCodes-3LtreeZM.d.ts → mobileErrorCodes-CmjYEIYm.d.cts} +18 -4
  48. package/dist/mobileErrorCodes-CmjYEIYm.d.cts.map +1 -0
  49. package/dist/{mobileErrorCodes-3LtreeZM.d.cts → mobileErrorCodes-CmjYEIYm.d.ts} +18 -4
  50. package/dist/mobileErrorCodes-CmjYEIYm.d.ts.map +1 -0
  51. package/dist/{payloadHash-BOWGjqdb.d.cts → payloadHash-DhHmgRqL.d.cts} +2 -2
  52. package/dist/payloadHash-DhHmgRqL.d.cts.map +1 -0
  53. package/dist/{payloadHash-Bzf4CtjV.d.ts → payloadHash-E1_8fpLW.d.ts} +2 -2
  54. package/dist/payloadHash-E1_8fpLW.d.ts.map +1 -0
  55. package/dist/{serverBaseTypes-KREDe2M9.d.cts → serverBaseTypes-B5J1_TyC.d.cts} +2 -2
  56. package/dist/{serverBaseTypes-KREDe2M9.d.cts.map → serverBaseTypes-B5J1_TyC.d.cts.map} +1 -1
  57. package/dist/{serverBaseTypes-DWf3iGWy.d.ts → serverBaseTypes-DnLzsdm-.d.ts} +2 -2
  58. package/dist/{serverBaseTypes-DWf3iGWy.d.ts.map → serverBaseTypes-DnLzsdm-.d.ts.map} +1 -1
  59. package/dist/serverExecuteTypes-B-OJok19.d.cts +162 -0
  60. package/dist/serverExecuteTypes-B-OJok19.d.cts.map +1 -0
  61. package/dist/serverExecuteTypes-BwWGspOg.d.ts +162 -0
  62. package/dist/serverExecuteTypes-BwWGspOg.d.ts.map +1 -0
  63. package/dist/{serverModelTypes-DAqEyYtB.d.cts → serverModelTypes-CiA-dy1R.d.cts} +299 -24
  64. package/dist/serverModelTypes-CiA-dy1R.d.cts.map +1 -0
  65. package/dist/{serverModelTypes-DAqEyYtB.d.ts → serverModelTypes-CiA-dy1R.d.ts} +299 -24
  66. package/dist/serverModelTypes-CiA-dy1R.d.ts.map +1 -0
  67. package/dist/{serverQueryTypes-DNdMpmDr.d.cts → serverQueryTypes-CJcjLB7n.d.ts} +117 -5
  68. package/dist/serverQueryTypes-CJcjLB7n.d.ts.map +1 -0
  69. package/dist/{serverQueryTypes-BFdwq0Z2.d.ts → serverQueryTypes-V1f9yE7L.d.cts} +117 -5
  70. package/dist/serverQueryTypes-V1f9yE7L.d.cts.map +1 -0
  71. package/dist/{serverRequestTypes-CxDRFKfv.d.cts → serverRequestTypes-CRlkNSu5.d.cts} +77 -7
  72. package/dist/serverRequestTypes-CRlkNSu5.d.cts.map +1 -0
  73. package/dist/{serverRequestTypes-BNA7FCY6.d.ts → serverRequestTypes-DZoOhV2o.d.ts} +77 -7
  74. package/dist/serverRequestTypes-DZoOhV2o.d.ts.map +1 -0
  75. package/dist/{serverResponseGuards-Dkdok0Sm.d.cts → serverResponseGuards-BW69PS7O.d.cts} +2 -2
  76. package/dist/{serverResponseGuards-Dkdok0Sm.d.cts.map → serverResponseGuards-BW69PS7O.d.cts.map} +1 -1
  77. package/dist/{serverResponseGuards-BU1Xv_tG.d.ts → serverResponseGuards-CShiXpHT.d.ts} +2 -2
  78. package/dist/{serverResponseGuards-BU1Xv_tG.d.ts.map → serverResponseGuards-CShiXpHT.d.ts.map} +1 -1
  79. package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
  80. package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
  81. package/dist/signing/canonicalize.cjs +37 -0
  82. package/dist/signing/canonicalize.cjs.map +1 -1
  83. package/dist/signing/canonicalize.d.cts +1 -1
  84. package/dist/signing/canonicalize.d.ts +1 -1
  85. package/dist/signing/canonicalize.js +37 -0
  86. package/dist/signing/canonicalize.js.map +1 -1
  87. package/dist/signing/eip712MethodByType.cjs +5 -0
  88. package/dist/signing/eip712MethodByType.cjs.map +1 -1
  89. package/dist/signing/eip712MethodByType.d.cts +1 -1
  90. package/dist/signing/eip712MethodByType.d.ts +1 -1
  91. package/dist/signing/eip712MethodByType.js +5 -0
  92. package/dist/signing/eip712MethodByType.js.map +1 -1
  93. package/dist/signing/index.d.cts +5 -5
  94. package/dist/signing/index.d.ts +5 -5
  95. package/dist/signing/payloadHash.d.cts +1 -1
  96. package/dist/signing/payloadHash.d.ts +1 -1
  97. package/dist/signing/types.d.cts +1 -1
  98. package/dist/signing/types.d.ts +1 -1
  99. package/dist/types/MobileServerFailureError.d.cts +1 -1
  100. package/dist/types/MobileServerFailureError.d.ts +1 -1
  101. package/dist/types/MobileUnsupportedFeedItemError.cjs +19 -0
  102. package/dist/types/MobileUnsupportedFeedItemError.cjs.map +1 -0
  103. package/dist/types/MobileUnsupportedFeedItemError.d.cts +2 -0
  104. package/dist/types/MobileUnsupportedFeedItemError.d.ts +2 -0
  105. package/dist/types/MobileUnsupportedFeedItemError.js +18 -0
  106. package/dist/types/MobileUnsupportedFeedItemError.js.map +1 -0
  107. package/dist/types/clientTypes.d.cts +2 -2
  108. package/dist/types/clientTypes.d.ts +2 -2
  109. package/dist/types/index.cjs +2 -0
  110. package/dist/types/index.d.cts +10 -9
  111. package/dist/types/index.d.ts +10 -9
  112. package/dist/types/index.js +2 -1
  113. package/dist/types/mobileErrorCodes.cjs +28 -0
  114. package/dist/types/mobileErrorCodes.cjs.map +1 -1
  115. package/dist/types/mobileErrorCodes.d.cts +1 -1
  116. package/dist/types/mobileErrorCodes.d.ts +1 -1
  117. package/dist/types/mobileErrorCodes.js +28 -0
  118. package/dist/types/mobileErrorCodes.js.map +1 -1
  119. package/dist/types/serverBaseTypes.d.cts +1 -1
  120. package/dist/types/serverBaseTypes.d.ts +1 -1
  121. package/dist/types/serverExecuteTypes.d.cts +2 -2
  122. package/dist/types/serverExecuteTypes.d.ts +2 -2
  123. package/dist/types/serverModelTypes.cjs.map +1 -1
  124. package/dist/types/serverModelTypes.d.cts +2 -2
  125. package/dist/types/serverModelTypes.d.ts +2 -2
  126. package/dist/types/serverModelTypes.js.map +1 -1
  127. package/dist/types/serverQueryTypes.d.cts +2 -2
  128. package/dist/types/serverQueryTypes.d.ts +2 -2
  129. package/dist/types/serverRequestTypes.d.cts +1 -1
  130. package/dist/types/serverRequestTypes.d.ts +1 -1
  131. package/dist/{types-BCr2G5gS.d.cts → types-BiRmH5Iv.d.cts} +31 -7
  132. package/dist/types-BiRmH5Iv.d.cts.map +1 -0
  133. package/dist/{types-C18k-9Vy.d.ts → types-DoJuq0Ij.d.ts} +31 -7
  134. package/dist/types-DoJuq0Ij.d.ts.map +1 -0
  135. package/dist/utils/index.d.cts +1 -1
  136. package/dist/utils/index.d.ts +1 -1
  137. package/dist/utils/serverResponseGuards.d.cts +1 -1
  138. package/dist/utils/serverResponseGuards.d.ts +1 -1
  139. package/package.json +3 -3
  140. package/src/MobileClient.ts +409 -4
  141. package/src/dataMappers.test.ts +742 -0
  142. package/src/dataMappers.ts +671 -12
  143. package/src/signing/canonicalize.ts +53 -0
  144. package/src/signing/eip712MethodByType.ts +5 -0
  145. package/src/signing/signing.test.ts +347 -0
  146. package/src/signing/types.ts +57 -4
  147. package/src/types/MobileUnsupportedFeedItemError.ts +18 -0
  148. package/src/types/clientTypes.ts +645 -23
  149. package/src/types/index.ts +1 -0
  150. package/src/types/mobileErrorCodes.ts +28 -0
  151. package/src/types/serverExecuteTypes.ts +92 -3
  152. package/src/types/serverModelTypes.ts +376 -22
  153. package/src/types/serverQueryTypes.ts +138 -0
  154. package/src/types/serverRequestTypes.ts +115 -4
  155. package/dist/MobileClient-aDxiM_Kf.cjs.map +0 -1
  156. package/dist/canonicalize-BBYGh17w.d.ts.map +0 -1
  157. package/dist/canonicalize-BF_SiNvO.d.cts.map +0 -1
  158. package/dist/clientTypes-BWFKo9oE.d.cts.map +0 -1
  159. package/dist/clientTypes-DCTiUV0H.d.ts.map +0 -1
  160. package/dist/eip712MethodByType-BSx11xG-.d.cts.map +0 -1
  161. package/dist/eip712MethodByType-DkiAjCLs.d.ts.map +0 -1
  162. package/dist/mobileErrorCodes-3LtreeZM.d.cts.map +0 -1
  163. package/dist/mobileErrorCodes-3LtreeZM.d.ts.map +0 -1
  164. package/dist/payloadHash-BOWGjqdb.d.cts.map +0 -1
  165. package/dist/payloadHash-Bzf4CtjV.d.ts.map +0 -1
  166. package/dist/serverExecuteTypes-DVRa6ifu.d.cts +0 -89
  167. package/dist/serverExecuteTypes-DVRa6ifu.d.cts.map +0 -1
  168. package/dist/serverExecuteTypes-DlYZCp1f.d.ts +0 -89
  169. package/dist/serverExecuteTypes-DlYZCp1f.d.ts.map +0 -1
  170. package/dist/serverModelTypes-DAqEyYtB.d.cts.map +0 -1
  171. package/dist/serverModelTypes-DAqEyYtB.d.ts.map +0 -1
  172. package/dist/serverQueryTypes-BFdwq0Z2.d.ts.map +0 -1
  173. package/dist/serverQueryTypes-DNdMpmDr.d.cts.map +0 -1
  174. package/dist/serverRequestTypes-BNA7FCY6.d.ts.map +0 -1
  175. package/dist/serverRequestTypes-CxDRFKfv.d.cts.map +0 -1
  176. package/dist/types-BCr2G5gS.d.cts.map +0 -1
  177. package/dist/types-C18k-9Vy.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  export * from './clientTypes';
2
2
  export * from './mobileErrorCodes';
3
3
  export * from './MobileServerFailureError';
4
+ export * from './MobileUnsupportedFeedItemError';
4
5
  export * from './serverBaseTypes';
5
6
  export * from './serverExecuteTypes';
6
7
  export * from './serverModelTypes';
@@ -48,6 +48,16 @@ export const MOBILE_ERROR_CODES = {
48
48
  INVALID_FEED_FILTER: 6300,
49
49
  /** Feed cursor is malformed or bound to a different filter. Discard it and restart from the first page. */
50
50
  INVALID_FEED_CURSOR: 6301,
51
+ /** Drawing JSON, outer value, storage representation, or nonce is invalid. */
52
+ INVALID_SOCIAL_FEED_DRAWING: 6302,
53
+ /** Original drawing JSON exceeds 256 KiB UTF-8. */
54
+ SOCIAL_FEED_DRAWING_TOO_LARGE: 6303,
55
+ /** Drawing parent is unavailable, or an update targets a missing drawing. */
56
+ SOCIAL_FEED_DRAWING_UNAVAILABLE: 6304,
57
+ /** A different drawing already exists when first attaching one. */
58
+ SOCIAL_FEED_DRAWING_EXISTS: 6305,
59
+ /** Drawing nonce is stale or reused for different content. Re-read before retrying. */
60
+ STALE_SOCIAL_FEED_DRAWING_UPDATE: 6306,
51
61
  /** Invalid social feed parameters, including missing fields, invalid types/formats, filters, or Content-Type. */
52
62
  INVALID_SOCIAL_FEED_PARAMS: 6310,
53
63
  /** Session, credential, viewing account, cursor, source, or viewport mismatch; also a request sequence or viewport revision rollback. */
@@ -56,8 +66,26 @@ export const MOBILE_ERROR_CODES = {
56
66
  SOCIAL_FEED_SESSION_EXPIRED: 6312,
57
67
  /** Content does not exist or is not currently accessible. */
58
68
  SOCIAL_FEED_CONTENT_UNAVAILABLE: 6313,
69
+ /** Position no longer qualifies for publication or a new attachment. */
70
+ SOCIAL_FEED_POSITION_CLOSED: 6314,
71
+ /** Selected position does not belong to the signed author. */
72
+ SOCIAL_FEED_POSITION_NOT_OWNED: 6315,
73
+ /** Item or action does not support the requested operation. */
74
+ INVALID_SOCIAL_FEED_OPERATION: 6316,
75
+ /** Published body cannot be edited; existing drawings may still be updated. */
76
+ SOCIAL_FEED_CONTENT_ALREADY_PUBLISHED: 6317,
77
+ /** Mention offsets, mentioned identity, or reply relationship is invalid. */
78
+ INVALID_SOCIAL_FEED_MENTION: 6318,
79
+ /** Author-scoped request ID was already used with different content. */
80
+ SOCIAL_FEED_REQUEST_CONFLICT: 6319,
59
81
  /** Required authoritative position, action, cohort, or market data is unavailable. */
60
82
  SOCIAL_FEED_DATA_UNAVAILABLE: 6320,
83
+ /** Text or mention count exceeds the operation's limit. */
84
+ SOCIAL_FEED_CONTENT_TOO_LARGE: 6321,
85
+ /** Like nonce is stale or reused with a different state. */
86
+ STALE_SOCIAL_FEED_LIKE_UPDATE: 6322,
87
+ /** A post has neither nonblank text nor a drawing, or a comment is blank. */
88
+ EMPTY_SOCIAL_FEED_CONTENT: 6323,
61
89
  /** Feed reads are only available through public_query. */
62
90
  SOCIAL_FEED_QUERY_REMOVED: 6325,
63
91
  } as const;
@@ -3,6 +3,12 @@ import {
3
3
  MobileServerFailureResponse,
4
4
  MobileServerSuccessResponse,
5
5
  } from './serverBaseTypes';
6
+ import {
7
+ MobileServerSocialFeedAuthor,
8
+ MobileServerSocialFeedDrawing,
9
+ MobileServerSocialFeedItem,
10
+ MobileServerSocialFeedReply,
11
+ } from './serverModelTypes';
6
12
  import {
7
13
  MobileServerExecuteRequestType,
8
14
  MobileServerPublicExecuteRequestByType,
@@ -75,11 +81,20 @@ export interface MobileServerAvatarUploadResponse {
75
81
  }
76
82
 
77
83
  /**
78
- * Success payloads for each signed `execute`, keyed by request `type`. Most execute routes carry no payload
79
- * beyond the success discriminant and so map to an empty object; `set_follow` and `set_follow_batch` return
80
- * their post-commit relationship state, and `create_avatar_upload` returns a temporary upload grant.
84
+ * Success payloads for each signed `execute`, keyed by request `type`. Mutations return either the success
85
+ * envelope alone or authoritative post-commit state; avatar upload creation returns a temporary grant.
81
86
  */
82
87
  export interface MobileServerExecuteResponseByType {
88
+ /** Published or idempotently recovered item. */
89
+ create_feed_post: MobileServerSocialFeedPostResponse;
90
+ /** Atomically published reply and updated count. */
91
+ create_feed_comment: MobileServerSocialFeedCommentResponse;
92
+ /** First attached drawing. */
93
+ create_feed_chart_drawing: MobileServerSocialFeedDrawingMutationResponse;
94
+ /** Replaced or idempotently recovered drawing. */
95
+ update_feed_chart_drawing: MobileServerSocialFeedDrawingMutationResponse;
96
+ /** Post-mutation like state. */
97
+ set_feed_like: MobileServerSocialFeedLikeResponse;
83
98
  /** Bio writes return only the success envelope. */
84
99
  set_bio: MobileServerEmptyExecuteResponse;
85
100
  /** Avatar writes return only the success envelope. */
@@ -107,3 +122,77 @@ export type MobileServerExecuteSuccessResponse<
107
122
  export type MobileServerExecuteResult =
108
123
  | MobileServerSuccessResponse
109
124
  | MobileServerFailureResponse;
125
+
126
+ /** Atomic publication success; unlike feed_item, this does not issue a read session. */
127
+ export interface MobileServerSocialFeedPostResponse {
128
+ /** Published item. */
129
+ item: MobileServerSocialFeedItem;
130
+ }
131
+
132
+ /** Atomic reply publication and authoritative root count. */
133
+ export interface MobileServerSocialFeedCommentResponse {
134
+ /** Published reply. */
135
+ comment: MobileServerSocialFeedReply;
136
+ /** Post-commit root count. */
137
+ root_comment_count: number;
138
+ }
139
+
140
+ /** Successful drawing mutation always returns a saved drawing. */
141
+ export interface MobileServerSocialFeedDrawingMutationResponse {
142
+ /** Parent UUID. */
143
+ item_id: string;
144
+ /** Display version. */
145
+ item_version: string;
146
+ /** Saved parsed drawing. */
147
+ drawing: MobileServerSocialFeedDrawing;
148
+ }
149
+
150
+ /** Authoritative like state after the mutation. */
151
+ export interface MobileServerSocialFeedLikeResponse {
152
+ /** Item UUID. */
153
+ item_id: string;
154
+ /** Applied relationship state. */
155
+ is_liked: boolean;
156
+ /** Post-mutation count. */
157
+ like_count: number;
158
+ /** Display version. */
159
+ version: string;
160
+ }
161
+
162
+ /** Exposure counts deduplicated by browsing credential, item, and UTC day. */
163
+ export interface MobileServerSocialFeedViewsResponse {
164
+ /** Newly counted items. */
165
+ accepted_item_ids: string[];
166
+ /** Already counted items. */
167
+ duplicate_item_ids: string[];
168
+ }
169
+
170
+ /** Page lease result; this response does not carry as_of_ms. */
171
+ export interface MobileServerSocialFeedPresenceResponse {
172
+ /** Active visitor count. */
173
+ watcher_count: number;
174
+ /** Self-reported public account previews. */
175
+ watcher_preview: MobileServerSocialFeedAuthor[];
176
+ /** Recommended heartbeat interval. */
177
+ heartbeat_interval_seconds: number;
178
+ /** Lease lifetime, bounded by the reading session. */
179
+ expires_in_seconds: number;
180
+ }
181
+
182
+ /** Response payloads for unsigned writes. */
183
+ export interface MobileServerPublicExecuteResponseByType {
184
+ /** Token removal returns only the success envelope. */
185
+ unregister_expo_token: MobileServerEmptyExecuteResponse;
186
+ /** Preference updates return only the success envelope. */
187
+ update_preferences: MobileServerEmptyExecuteResponse;
188
+ /** Exposure deduplication result. */
189
+ record_feed_views: MobileServerSocialFeedViewsResponse;
190
+ /** Page lease result. */
191
+ position_presence: MobileServerSocialFeedPresenceResponse;
192
+ }
193
+
194
+ /** Full success response for an unsigned write. */
195
+ export type MobileServerPublicExecuteSuccessResponse<
196
+ T extends MobileServerPublicExecuteRequestType =
197
+ MobileServerPublicExecuteRequestType,
198
+ > = MobileServerSuccessResponse & MobileServerPublicExecuteResponseByType[T];
@@ -285,7 +285,7 @@ export type MobileSocialFeedTradeCardAction =
285
285
  | MobileSocialFeedTradeSizeChangeAction;
286
286
 
287
287
  /** Whether a reading session was created for a list or a direct item. */
288
- export type MobileSocialFeedReadSessionMode = 'feed' | 'item';
288
+ export type MobileSocialFeedReadSessionMode = 'feed' | 'item' | 'position';
289
289
 
290
290
  /** Kind of feed update target. */
291
291
  export type MobileSocialFeedTargetType = 'item' | 'position';
@@ -356,6 +356,8 @@ export interface MobileServerSocialFeedPnl {
356
356
 
357
357
  /** Complete mutable position fields delivered together at one version. */
358
358
  export interface MobileServerSocialFeedPositionPatch {
359
+ /** Additional metrics for a position history session, when supplied. */
360
+ current_position?: MobileServerSocialFeedHistoryMetrics;
359
361
  /** Position lifecycle UUID. */
360
362
  position_id: string;
361
363
  /** Positive integer string; compare as integers without Number conversion. */
@@ -396,7 +398,7 @@ export interface MobileServerSocialFeedPositionCard extends MobileServerSocialFe
396
398
  direction: MobileFeedTradePositionDirection;
397
399
  }
398
400
 
399
- /** Interaction counters; interaction writes are not currently available. */
401
+ /** Interaction counters and the viewing account's relationship state. */
400
402
  export interface MobileServerSocialFeedInteraction {
401
403
  /** Number of likes. */
402
404
  like_count: number;
@@ -404,7 +406,7 @@ export interface MobileServerSocialFeedInteraction {
404
406
  comment_count: number;
405
407
  /** Number of recorded views. */
406
408
  view_count: number;
407
- /** Null while likes are unavailable, including with a viewing account. */
409
+ /** Null when no viewing account is selected. */
408
410
  liked_by_me: boolean | null;
409
411
  }
410
412
 
@@ -420,8 +422,8 @@ export interface MobileServerSocialFeedCapabilities {
420
422
 
421
423
  /** Comment preview metadata for a social trade card. */
422
424
  export interface MobileServerSocialFeedCommentPreview {
423
- /** Currently empty. */
424
- items: never[];
425
+ /** Most recent readable replies. */
426
+ items: MobileServerSocialFeedReply[];
425
427
  /** Comment count. */
426
428
  total_count: number;
427
429
  /** Comment cursor, if available. */
@@ -458,14 +460,14 @@ export interface MobileServerSocialFeedCohort {
458
460
  coverage: MobileServerSocialFeedCohortCoverage;
459
461
  }
460
462
 
461
- /** Metadata shared by the automatic trade cards and rows available from the social feed. */
463
+ /** Metadata shared by social feed content. */
462
464
  export interface MobileServerSocialFeedItemBase {
463
465
  /** Item UUID. */
464
466
  id: string;
465
467
  /** Whether authored analysis exists. */
466
468
  has_analysis: boolean;
467
- /** Drawings are not currently available. */
468
- drawing: null;
469
+ /** Parsed drawing document, or null when no drawing is readable. */
470
+ drawing: MobileServerSocialFeedDrawing | null;
469
471
  /** Author identity, badge, and follow perspective. */
470
472
  author: MobileServerSocialFeedAuthor;
471
473
  /** Creation time in Unix milliseconds. */
@@ -476,28 +478,32 @@ export interface MobileServerSocialFeedItemBase {
476
478
  version: string;
477
479
  /** Market metadata. */
478
480
  market: MobileServerSocialFeedMarket;
479
- /** Server capability flags; currently all false. */
481
+ /** Server capability flags, subject to the corresponding write switches. */
480
482
  capabilities: MobileServerSocialFeedCapabilities;
481
483
  }
482
484
 
483
- /** Automatic trade card returned by the social feed. */
484
- export interface MobileServerSocialFeedTradeCard extends MobileServerSocialFeedItemBase {
485
- /** Card discriminant. */
486
- kind: 'trade_card';
487
- /** Trading action. */
488
- action: MobileSocialFeedTradeCardAction;
485
+ /** Content shared by authored posts and trade cards. */
486
+ export interface MobileServerSocialFeedContentBase extends MobileServerSocialFeedItemBase {
489
487
  /** Card text, empty for automatic cards. */
490
488
  text: string;
491
- /** Automatic cards have no mentions. */
492
- mentions: never[];
489
+ /** Mentions in the original, unmodified text. */
490
+ mentions: MobileSocialFeedMention[];
493
491
  /** Current or frozen position display. */
494
492
  position: MobileServerSocialFeedPositionCard;
495
493
  /** Interaction counters. */
496
494
  interaction: MobileServerSocialFeedInteraction;
497
- /** Comment content is not currently available. */
495
+ /** Readable comment preview. */
498
496
  comment_preview: MobileServerSocialFeedCommentPreview;
499
497
  }
500
498
 
499
+ /** Trade card with optional authored text and analysis. */
500
+ export interface MobileServerSocialFeedTradeCard extends MobileServerSocialFeedContentBase {
501
+ /** Card discriminant. */
502
+ kind: 'trade_card';
503
+ /** Trading action. */
504
+ action: MobileSocialFeedTradeCardAction;
505
+ }
506
+
501
507
  /** Fields shared by size-change and liquidation trade rows. */
502
508
  export interface MobileServerSocialFeedTradeRowBase extends MobileServerSocialFeedItemBase {
503
509
  /** Row discriminant. */
@@ -546,20 +552,22 @@ export type MobileServerSocialFeedTradeRow =
546
552
  }
547
553
  );
548
554
 
549
- /** Automatic feed content; excludes posts, replies, drawings, and interaction writes. */
555
+ /** Discriminated social feed content. */
550
556
  export type MobileServerSocialFeedItem =
551
557
  | MobileServerSocialFeedTradeCard
552
- | MobileServerSocialFeedTradeRow;
558
+ | MobileServerSocialFeedTradeRow
559
+ | MobileServerSocialFeedPost
560
+ | MobileServerSocialFeedReply;
553
561
 
554
562
  /** Fixed-duration social feed reading session. Credentials and cursors must be returned unchanged. */
555
563
  export interface MobileServerSocialFeedReadSession {
556
564
  /** Session identifier. */
557
565
  session_id: string;
558
- /** Feed or direct item session. */
566
+ /** Feed, item, or full position history session. */
559
567
  mode: MobileSocialFeedReadSessionMode;
560
568
  /** Fixed expiration time in Unix milliseconds; pagination does not extend it. */
561
569
  expires_at_ms: number;
562
- /** Exposure metadata only; recording is not available from the social feed. */
570
+ /** Visibility requirements for explicit exposure reporting. */
563
571
  view_tracking: MobileServerSocialFeedViewTracking;
564
572
  /** Initial update baseline, distinct from the page cursor. */
565
573
  update_cursor: string | null;
@@ -569,6 +577,10 @@ export interface MobileServerSocialFeedReadSession {
569
577
 
570
578
  /** Item delta: omitted means unchanged; explicit null clears a prior value. */
571
579
  export interface MobileServerSocialFeedItemPatch {
580
+ /** Updated reply attachment; null clears it, omission leaves it unchanged. */
581
+ attached_position?: MobileServerSocialFeedPositionCard | null;
582
+ /** Updated reply attachment visibility. */
583
+ attachment_status?: MobileSocialFeedAttachmentStatus;
572
584
  /** Current author identity, follow state, and qualification badge. */
573
585
  author: MobileServerSocialFeedAuthor;
574
586
  /** Target item UUID. */
@@ -610,3 +622,345 @@ export interface MobileSocialFeedUnavailableTarget {
610
622
  /** Uniform reason prevents leaking inaccessible content. */
611
623
  reason: 'unavailable';
612
624
  }
625
+
626
+ /** Readable state of a reply's position attachment. */
627
+ export type MobileSocialFeedAttachmentStatus =
628
+ | 'none'
629
+ | 'visible'
630
+ | 'unavailable';
631
+
632
+ /** Supported chart candle intervals. */
633
+ export type MobileSocialFeedChartInterval =
634
+ | '1m'
635
+ | '5m'
636
+ | '15m'
637
+ | '1h'
638
+ | '4h'
639
+ | '1d';
640
+
641
+ /** Position lifecycle action. */
642
+ export type MobileSocialFeedAction =
643
+ | MobileSocialFeedTradeCardAction
644
+ | 'liquidated';
645
+
646
+ /** Result of resolving a position command. */
647
+ export type MobileSocialFeedPositionResolution =
648
+ | 'resolved'
649
+ | 'choose_position'
650
+ | 'no_open_position'
651
+ | 'unknown_market';
652
+
653
+ /** Resolution of a viewing account's trading targets. */
654
+ export type MobileSocialFeedTradingResolution =
655
+ | 'no_viewing_account'
656
+ | 'none'
657
+ | 'unique'
658
+ | 'choose_position'
659
+ | 'unavailable';
660
+
661
+ /** Price source for a historical action marker. */
662
+ export type MobileSocialFeedActionPriceBasis =
663
+ | 'execution'
664
+ | 'liquidation_oracle';
665
+
666
+ /** Chart source completeness; wholly unavailable sources fail the request. */
667
+ export type MobileSocialFeedChartDataQuality = 'ready' | 'partial';
668
+
669
+ /** Projection state of an order's authoritative action segments. */
670
+ export type MobileSocialFeedActionResolution = 'ready' | 'pending';
671
+
672
+ /** Explanation for an empty position command result. */
673
+ export type MobileSocialFeedPositionResolutionReason =
674
+ | 'no_open_position'
675
+ | 'unknown_market';
676
+
677
+ /** Reason an action cannot be published. */
678
+ export type MobileSocialFeedActionUnavailableReason =
679
+ | 'position_closed'
680
+ | 'already_published'
681
+ | 'unavailable';
682
+
683
+ /** Availability of an estimated liquidation price. */
684
+ export type MobileSocialFeedLiquidationPriceQuality =
685
+ | MobileSocialFeedPnlQuality
686
+ | 'not_applicable';
687
+
688
+ /** Presence lifecycle reported by an individual page. */
689
+ export type MobileSocialFeedPresenceState = 'watching' | 'heartbeat' | 'left';
690
+
691
+ /** Mention offsets refer to Unicode code points in the original text, not UTF-16 indices. */
692
+ export interface MobileSocialFeedMention {
693
+ /** Mentioned identity. */
694
+ subaccount: Hex;
695
+ /** Inclusive code point offset. */
696
+ start: number;
697
+ /** Exclusive code point offset. */
698
+ end: number;
699
+ /** Label matching the original text. */
700
+ label: string;
701
+ }
702
+
703
+ /** Parsed drawing; data is opaque to the SDK and may legitimately be false or zero. */
704
+ export interface MobileServerSocialFeedDrawing {
705
+ /** Already parsed drawing document; do not JSON.parse again. */
706
+ data: unknown;
707
+ /** Original creation time in milliseconds. */
708
+ created_at_ms: number;
709
+ /** Last update time in milliseconds. */
710
+ updated_at_ms: number;
711
+ }
712
+
713
+ /** Nonrecursive root-post preview carried by replies. */
714
+ export interface MobileServerSocialFeedCompactCard {
715
+ /** Root item UUID. */
716
+ id: string;
717
+ /** Root author. */
718
+ author: MobileServerSocialFeedAuthor;
719
+ /** Original text excerpt. */
720
+ text_excerpt: string;
721
+ /** Visible position summary, or null. */
722
+ position: Pick<
723
+ MobileServerSocialFeedPositionCard,
724
+ 'position_id' | 'market' | 'direction' | 'state' | 'notional_x18'
725
+ > | null;
726
+ /** Whether the root has published analysis. */
727
+ has_analysis: boolean;
728
+ }
729
+
730
+ /** Authored position post, including text-only, drawing-only, and combined content. */
731
+ export interface MobileServerSocialFeedPost extends MobileServerSocialFeedContentBase {
732
+ /** Post discriminant. */
733
+ kind: 'post';
734
+ }
735
+
736
+ /** Reply with independently permissioned position attachment and nonrecursive root preview. */
737
+ export interface MobileServerSocialFeedReply extends MobileServerSocialFeedItemBase {
738
+ /** Reply discriminant. */
739
+ kind: 'reply';
740
+ /** Original text. */
741
+ text: string;
742
+ /** Mentions in the text. */
743
+ mentions: MobileSocialFeedMention[];
744
+ /** Actual root item UUID. */
745
+ root_item_id: string;
746
+ /** Omitted for a direct reply to the root. */
747
+ reply_to_item_id?: string;
748
+ /** Author being replied to, or null. */
749
+ reply_to_author: MobileServerSocialFeedAuthor | null;
750
+ /** Readable attachment; null when absent or unavailable. */
751
+ attached_position: MobileServerSocialFeedPositionCard | null;
752
+ /** Distinguishes an absent attachment from an unreadable one. */
753
+ attachment_status: MobileSocialFeedAttachmentStatus;
754
+ /** Root preview; does not register root exposure. */
755
+ original: MobileServerSocialFeedCompactCard;
756
+ /** Reply interaction state. */
757
+ interaction: MobileServerSocialFeedInteraction;
758
+ }
759
+
760
+ /** Current eligibility hints; actual writes still recheck the signed author. */
761
+ export interface MobileServerSocialFeedPublishablePosition {
762
+ /** Candidate position. */
763
+ position: MobileServerSocialFeedPositionCard;
764
+ /** Whether this account can publish. */
765
+ can_publish: boolean;
766
+ /** Whether this account can attach the position to a comment. */
767
+ can_attach_to_comment: boolean;
768
+ /** Whether this account can first add analysis. */
769
+ can_draw_analysis: boolean;
770
+ /** Unavailability explanation, or null. */
771
+ unavailable_reason: string | null;
772
+ }
773
+
774
+ /** An authoritative lifecycle segment of an order. */
775
+ export interface MobileServerSocialFeedActionCandidate {
776
+ /** Action UUID. */
777
+ action_id: string;
778
+ /** Lifecycle UUID. */
779
+ position_id: string;
780
+ /** Lifecycle action. */
781
+ action: MobileSocialFeedAction;
782
+ /** Current publishing eligibility, not proof of caller ownership. */
783
+ can_publish: boolean;
784
+ /** Publication restriction, or null when eligible. */
785
+ unavailable_reason: MobileSocialFeedActionUnavailableReason | null;
786
+ }
787
+
788
+ /** Additional history metrics; unavailable values are not zero. */
789
+ export interface MobileServerSocialFeedHistoryMetrics {
790
+ /** Estimated liquidation price in x18, independent of event Oracle and execution prices. */
791
+ estimated_liquidation_price_x18: string | null;
792
+ /** Availability of the estimated price. */
793
+ liquidation_price_quality: MobileSocialFeedLiquidationPriceQuality;
794
+ /** Source time in milliseconds. */
795
+ liquidation_price_as_of_ms: number | null;
796
+ /** Signed funding amount in x18. */
797
+ funding_pnl_x18: string | null;
798
+ /** Funding availability. */
799
+ funding_quality: MobileSocialFeedPnlQuality;
800
+ /** Funding source time in milliseconds. */
801
+ funding_as_of_ms: number | null;
802
+ }
803
+
804
+ /** Full position card displayed above its historical timeline. */
805
+ export interface MobileServerSocialFeedPositionHistoryCard
806
+ extends
807
+ MobileServerSocialFeedPositionCard,
808
+ MobileServerSocialFeedHistoryMetrics {}
809
+
810
+ /** Persisted action facts, independent of whether a feed item was published. */
811
+ export interface MobileServerSocialFeedPositionAction {
812
+ /** Action UUID. */
813
+ id: string;
814
+ /** Lifecycle UUID. */
815
+ position_id: string;
816
+ /** Lifecycle action. */
817
+ action: MobileSocialFeedAction;
818
+ /** Position direction. */
819
+ direction: MobileFeedTradePositionDirection;
820
+ /** Historical margin mode. */
821
+ margin_mode: MobileFeedMarginMode;
822
+ /** Quantity before the action, in x18. */
823
+ quantity_before_x18: string;
824
+ /** Quantity after the action, in x18. */
825
+ quantity_after_x18: string;
826
+ /** Executed quantity, in x18. */
827
+ executed_quantity_x18: string;
828
+ /** Actual executed notional in x18; may be unknown for liquidation. */
829
+ executed_notional_x18: string | null;
830
+ /** Actual execution price in x18. */
831
+ average_price_x18: string | null;
832
+ /** Entry price before the action, in x18. */
833
+ entry_price_before_x18: string | null;
834
+ /** Liquidation event Oracle price in x18. */
835
+ liquidation_oracle_price_x18: string | null;
836
+ /** Liquidation Oracle-based notional in x18. */
837
+ liquidation_notional_x18: string | null;
838
+ /** Signed realized trading PnL in x18, excluding ordinary fees and funding. */
839
+ realized_pnl_delta_x18: string | null;
840
+ /** Historical effective leverage. */
841
+ leverage: MobileSocialFeedLeverage;
842
+ /** Leverage source time in milliseconds. */
843
+ leverage_at_ms: number | null;
844
+ /** First event time in milliseconds. */
845
+ first_event_at_ms: number;
846
+ /** Last event time in milliseconds. */
847
+ last_event_at_ms: number;
848
+ /** Decimal-string version. */
849
+ version: string;
850
+ }
851
+
852
+ /** Full published content appearing in a position timeline. */
853
+ export type MobileServerSocialFeedHistoryTake =
854
+ | MobileServerSocialFeedTradeCard
855
+ | MobileServerSocialFeedPost;
856
+
857
+ /** A historical action or authored take; preserve service ordering. */
858
+ export type MobileServerSocialFeedTimelineEntry =
859
+ | {
860
+ /** Action entry. */
861
+ kind: 'action';
862
+ /** Full action facts. */
863
+ action: MobileServerSocialFeedPositionAction;
864
+ /** Actually associated feed item, or null. */
865
+ related_item_id: string | null;
866
+ /** Full published trade card, or null. */
867
+ related_take: MobileServerSocialFeedTradeCard | null;
868
+ }
869
+ | {
870
+ /** Published take entry. */
871
+ kind: 'take';
872
+ /** Full published content. */
873
+ item: MobileServerSocialFeedHistoryTake;
874
+ };
875
+
876
+ /** Trusted trading target; this hint does not authorize trading. */
877
+ export interface MobileServerSocialFeedTradingTarget {
878
+ /** Lifecycle UUID. */
879
+ position_id: string;
880
+ /** Parent identity. */
881
+ identity_subaccount: Hex;
882
+ /** Actual trading subaccount, possibly isolated. */
883
+ trading_subaccount: Hex;
884
+ /** Market product ID. */
885
+ product_id: number;
886
+ /** Margin mode. */
887
+ margin_mode: MobileFeedMarginMode;
888
+ /** Isolated name, or null for cross margin. */
889
+ iso_subaccount_name: string | null;
890
+ /** Position direction. */
891
+ direction: MobileFeedTradePositionDirection;
892
+ /** Source time in milliseconds. */
893
+ state_as_of_ms: number;
894
+ }
895
+
896
+ /** Viewing-account trading hints, not authenticated permissions. */
897
+ export interface MobileServerSocialFeedTradingContext {
898
+ /** Market product ID. */
899
+ product_id: number;
900
+ /** Suggested trade direction. */
901
+ suggested_direction: MobileFeedTradePositionDirection;
902
+ /** Resolution of the viewing account's positions. */
903
+ resolution: MobileSocialFeedTradingResolution;
904
+ /** Trusted candidates. */
905
+ candidates: MobileServerSocialFeedTradingTarget[];
906
+ /** Unique candidate, or null. */
907
+ viewer_position_id: string | null;
908
+ /** Whether the selected account has a unique reducible position. */
909
+ can_reduce: boolean;
910
+ }
911
+
912
+ /** Historical candle; volume is a quantity, not a price. */
913
+ export interface MobileServerSocialFeedCandle {
914
+ /** Candle start time in milliseconds. */
915
+ timestamp_ms: number;
916
+ /** Open price in x18. */
917
+ open_x18: string;
918
+ /** High price in x18. */
919
+ high_x18: string;
920
+ /** Low price in x18. */
921
+ low_x18: string;
922
+ /** Close price in x18. */
923
+ close_x18: string;
924
+ /** Base asset volume in x18. */
925
+ volume_x18: string;
926
+ }
927
+
928
+ /** Chart action marker with explicitly identified price basis. */
929
+ export interface MobileServerSocialFeedActionMarker {
930
+ /** Action UUID. */
931
+ action_id: string;
932
+ /** Event time in milliseconds. */
933
+ timestamp_ms: number;
934
+ /** Price in x18; null does not remove the action. */
935
+ price_x18: string | null;
936
+ /** Lifecycle action. */
937
+ action: MobileSocialFeedAction;
938
+ /** Direction. */
939
+ direction: MobileFeedTradePositionDirection;
940
+ /** Never substitute actual execution for a liquidation Oracle. */
941
+ price_basis: MobileSocialFeedActionPriceBasis;
942
+ }
943
+
944
+ /** Counts across the authorized position history. */
945
+ export interface MobileServerSocialFeedHistorySummary {
946
+ /** Action count. */
947
+ action_count: number;
948
+ /** Published take count. */
949
+ take_count: number;
950
+ }
951
+
952
+ /** Estimated liquidation price and its source time. */
953
+ export interface MobileServerSocialFeedEstimatedLiquidationLine {
954
+ /** Estimated price in x18. */
955
+ price_x18: string;
956
+ /** Source time in milliseconds. */
957
+ as_of_ms: number;
958
+ }
959
+
960
+ /** Half-open chart range, preserved across pages. */
961
+ export interface MobileServerSocialFeedChartRange {
962
+ /** Inclusive start in milliseconds. */
963
+ from_ms: number;
964
+ /** Exclusive end in milliseconds. */
965
+ to_ms: number;
966
+ }