@nadohq/mobile-client 0.65.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +202 -10
- package/dist/{MobileClient-CfVZXTcz.cjs → MobileClient-vuI5wlB_.cjs} +303 -21
- package/dist/MobileClient-vuI5wlB_.cjs.map +1 -0
- package/dist/MobileClient.cjs +1 -1
- package/dist/MobileClient.d.cts +175 -20
- package/dist/MobileClient.d.cts.map +1 -1
- package/dist/MobileClient.d.ts +175 -20
- package/dist/MobileClient.d.ts.map +1 -1
- package/dist/MobileClient.js +303 -21
- package/dist/MobileClient.js.map +1 -1
- package/dist/{MobileServerFailureError-BZVwlsMg.d.ts → MobileServerFailureError-BeCCNShj.d.cts} +2 -3
- package/dist/MobileServerFailureError-BeCCNShj.d.cts.map +1 -0
- package/dist/{MobileServerFailureError-CbtK8kD4.d.cts → MobileServerFailureError-hHv28weI.d.ts} +2 -3
- package/dist/MobileServerFailureError-hHv28weI.d.ts.map +1 -0
- package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.cts +15 -0
- package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.cts.map +1 -0
- package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.ts +15 -0
- package/dist/MobileUnsupportedNotificationRouteError-DpiNBvvY.d.ts.map +1 -0
- package/dist/{buildSignedMobileRequest-C1v0flCR.d.cts → buildSignedMobileRequest-DcEMKU_4.d.cts} +2 -2
- package/dist/{buildSignedMobileRequest-C1v0flCR.d.cts.map → buildSignedMobileRequest-DcEMKU_4.d.cts.map} +1 -1
- package/dist/{buildSignedMobileRequest-UeeWdYGU.d.ts → buildSignedMobileRequest-DlTMvoXR.d.ts} +2 -2
- package/dist/{buildSignedMobileRequest-UeeWdYGU.d.ts.map → buildSignedMobileRequest-DlTMvoXR.d.ts.map} +1 -1
- package/dist/{canonicalize-5eeZrkzQ.d.ts → canonicalize-BOZlflI3.d.ts} +2 -2
- package/dist/canonicalize-BOZlflI3.d.ts.map +1 -0
- package/dist/{canonicalize-CBaZprTo.d.cts → canonicalize-BvCozzvJ.d.cts} +2 -2
- package/dist/canonicalize-BvCozzvJ.d.cts.map +1 -0
- package/dist/{clientTypes-_mEgzmNs.d.cts → clientTypes-KpHlCDGZ.d.cts} +341 -38
- package/dist/clientTypes-KpHlCDGZ.d.cts.map +1 -0
- package/dist/{clientTypes-C9dJufxk.d.ts → clientTypes-XRI41VdC.d.ts} +341 -38
- package/dist/clientTypes-XRI41VdC.d.ts.map +1 -0
- package/dist/dataMappers.cjs +257 -20
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +98 -15
- package/dist/dataMappers.d.cts.map +1 -1
- package/dist/dataMappers.d.ts +98 -15
- package/dist/dataMappers.d.ts.map +1 -1
- package/dist/dataMappers.js +242 -20
- package/dist/dataMappers.js.map +1 -1
- package/dist/{eip712MethodByType-D8jLoxDu.d.cts → eip712MethodByType-DyAmzH7b.d.cts} +2 -2
- package/dist/eip712MethodByType-DyAmzH7b.d.cts.map +1 -0
- package/dist/{eip712MethodByType-DcUh8h-l.d.ts → eip712MethodByType-qSSAF6i2.d.ts} +2 -2
- package/dist/eip712MethodByType-qSSAF6i2.d.ts.map +1 -0
- package/dist/feed-BrgkFqP3.d.cts +23 -0
- package/dist/feed-BrgkFqP3.d.cts.map +1 -0
- package/dist/feed-DcbhLoo1.d.ts +23 -0
- package/dist/feed-DcbhLoo1.d.ts.map +1 -0
- package/dist/index-BVVgDSdq.d.cts +1 -0
- package/dist/index-BVVgDSdq.d.ts +1 -0
- package/dist/index.cjs +8 -2
- package/dist/index.d.cts +14 -16
- package/dist/index.d.ts +14 -16
- package/dist/index.js +4 -3
- package/dist/{mobileErrorCodes-CmjYEIYm.d.ts → mobileErrorCodes-CdwX6QTO.d.cts} +8 -3
- package/dist/mobileErrorCodes-CdwX6QTO.d.cts.map +1 -0
- package/dist/{mobileErrorCodes-CmjYEIYm.d.cts → mobileErrorCodes-CdwX6QTO.d.ts} +8 -3
- package/dist/mobileErrorCodes-CdwX6QTO.d.ts.map +1 -0
- package/dist/{payloadHash-DhHmgRqL.d.cts → payloadHash-BgGSZock.d.cts} +2 -2
- package/dist/payloadHash-BgGSZock.d.cts.map +1 -0
- package/dist/{payloadHash-E1_8fpLW.d.ts → payloadHash-Bi6upCLQ.d.ts} +2 -2
- package/dist/payloadHash-Bi6upCLQ.d.ts.map +1 -0
- package/dist/{serverExecuteTypes-BwWGspOg.d.ts → serverExecuteTypes-DuCWe_H_.d.cts} +23 -14
- package/dist/serverExecuteTypes-DuCWe_H_.d.cts.map +1 -0
- package/dist/{serverExecuteTypes-B-OJok19.d.cts → serverExecuteTypes-usJ6HMJv.d.ts} +23 -14
- package/dist/serverExecuteTypes-usJ6HMJv.d.ts.map +1 -0
- package/dist/{serverModelTypes-CiA-dy1R.d.ts → serverModelTypes-CTHMNIQS.d.cts} +170 -13
- package/dist/serverModelTypes-CTHMNIQS.d.cts.map +1 -0
- package/dist/{serverModelTypes-CiA-dy1R.d.cts → serverModelTypes-CTHMNIQS.d.ts} +170 -13
- package/dist/serverModelTypes-CTHMNIQS.d.ts.map +1 -0
- package/dist/{serverResponseGuards-CShiXpHT.d.ts → serverResponseGuards-CzmldAad.d.cts} +2 -2
- package/dist/{serverResponseGuards-BW69PS7O.d.cts.map → serverResponseGuards-CzmldAad.d.cts.map} +1 -1
- package/dist/{serverResponseGuards-BW69PS7O.d.cts → serverResponseGuards-Dvkbjp2_.d.ts} +2 -2
- package/dist/{serverResponseGuards-CShiXpHT.d.ts.map → serverResponseGuards-Dvkbjp2_.d.ts.map} +1 -1
- package/dist/signing/buildSignedMobileRequest.d.cts +1 -1
- package/dist/signing/buildSignedMobileRequest.d.ts +1 -1
- package/dist/signing/canonicalize.cjs +53 -2
- package/dist/signing/canonicalize.cjs.map +1 -1
- package/dist/signing/canonicalize.d.cts +1 -1
- package/dist/signing/canonicalize.d.ts +1 -1
- package/dist/signing/canonicalize.js +53 -2
- package/dist/signing/canonicalize.js.map +1 -1
- package/dist/signing/eip712MethodByType.cjs +7 -0
- package/dist/signing/eip712MethodByType.cjs.map +1 -1
- package/dist/signing/eip712MethodByType.d.cts +1 -1
- package/dist/signing/eip712MethodByType.d.ts +1 -1
- package/dist/signing/eip712MethodByType.js +7 -0
- package/dist/signing/eip712MethodByType.js.map +1 -1
- package/dist/signing/index.d.cts +5 -5
- package/dist/signing/index.d.ts +5 -5
- package/dist/signing/payloadHash.cjs +1 -1
- package/dist/signing/payloadHash.d.cts +1 -1
- package/dist/signing/payloadHash.d.ts +1 -1
- package/dist/signing/payloadHash.js +1 -1
- package/dist/signing/types.d.cts +1 -1
- package/dist/signing/types.d.ts +1 -1
- package/dist/types/MobileServerFailureError.d.cts +1 -1
- package/dist/types/MobileServerFailureError.d.ts +1 -1
- package/dist/types/MobileUnsupportedNotificationRouteError.cjs +19 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.cjs.map +1 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.d.cts +2 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.d.ts +2 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.js +18 -0
- package/dist/types/MobileUnsupportedNotificationRouteError.js.map +1 -0
- package/dist/types/clientTypes.d.cts +2 -2
- package/dist/types/clientTypes.d.ts +2 -2
- package/dist/types/index.cjs +4 -0
- package/dist/types/index.d.cts +8 -9
- package/dist/types/index.d.ts +8 -9
- package/dist/types/index.js +3 -2
- package/dist/types/mobileErrorCodes.cjs +11 -1
- package/dist/types/mobileErrorCodes.cjs.map +1 -1
- package/dist/types/mobileErrorCodes.d.cts +1 -1
- package/dist/types/mobileErrorCodes.d.ts +1 -1
- package/dist/types/mobileErrorCodes.js +11 -1
- package/dist/types/mobileErrorCodes.js.map +1 -1
- package/dist/types/serverBaseTypes.d.cts +1 -1
- package/dist/types/serverBaseTypes.d.ts +1 -1
- package/dist/types/serverExecuteTypes.d.cts +2 -2
- package/dist/types/serverExecuteTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.cjs +15 -0
- package/dist/types/serverModelTypes.cjs.map +1 -1
- package/dist/types/serverModelTypes.d.cts +2 -2
- package/dist/types/serverModelTypes.d.ts +2 -2
- package/dist/types/serverModelTypes.js +14 -1
- package/dist/types/serverModelTypes.js.map +1 -1
- package/dist/types/serverQueryTypes.d.cts +2 -2
- package/dist/types/serverQueryTypes.d.ts +2 -2
- package/dist/types/serverRequestTypes.d.cts +2 -2
- package/dist/types/serverRequestTypes.d.ts +2 -2
- package/dist/types-CByl_NyJ.d.ts +825 -0
- package/dist/types-CByl_NyJ.d.ts.map +1 -0
- package/dist/types-CR5iaKR4.d.cts +825 -0
- package/dist/types-CR5iaKR4.d.cts.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.cjs +31 -0
- package/dist/utils/buildMobileFeedImageMultipart.cjs.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.cts +15 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.cts.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.ts +15 -0
- package/dist/utils/buildMobileFeedImageMultipart.d.ts.map +1 -0
- package/dist/utils/buildMobileFeedImageMultipart.js +30 -0
- package/dist/utils/buildMobileFeedImageMultipart.js.map +1 -0
- package/dist/utils/feed.cjs +12 -0
- package/dist/utils/feed.cjs.map +1 -1
- package/dist/utils/feed.d.cts +2 -2
- package/dist/utils/feed.d.ts +2 -2
- package/dist/utils/feed.js +11 -1
- package/dist/utils/feed.js.map +1 -1
- package/dist/utils/index.cjs +3 -1
- package/dist/utils/index.d.cts +3 -3
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +2 -2
- package/dist/utils/serverResponseGuards.d.cts +1 -1
- package/dist/utils/serverResponseGuards.d.ts +1 -1
- package/package.json +3 -3
- package/src/MobileClient.ts +444 -19
- package/src/dataMappers.test.ts +511 -6
- package/src/dataMappers.ts +325 -24
- package/src/feedImages.test.ts +309 -0
- package/src/notifications.test.ts +950 -0
- package/src/signing/canonicalize.ts +72 -0
- package/src/signing/eip712MethodByType.ts +10 -0
- package/src/signing/signing.test.ts +67 -1
- package/src/signing/types.ts +55 -9
- package/src/socialFeed.test.ts +63 -2
- package/src/types/MobileUnsupportedNotificationRouteError.ts +16 -0
- package/src/types/clientTypes.ts +427 -36
- package/src/types/index.ts +1 -0
- package/src/types/mobileErrorCodes.ts +10 -0
- package/src/types/serverExecuteTypes.ts +22 -10
- package/src/types/serverModelTypes.ts +216 -11
- package/src/types/serverQueryTypes.ts +106 -9
- package/src/types/serverRequestTypes.ts +114 -17
- package/src/utils/buildMobileFeedImageMultipart.test.ts +45 -0
- package/src/utils/buildMobileFeedImageMultipart.ts +36 -0
- package/src/utils/feed.ts +16 -0
- package/dist/MobileClient-CfVZXTcz.cjs.map +0 -1
- package/dist/MobileServerFailureError-BZVwlsMg.d.ts.map +0 -1
- package/dist/MobileServerFailureError-CbtK8kD4.d.cts.map +0 -1
- package/dist/canonicalize-5eeZrkzQ.d.ts.map +0 -1
- package/dist/canonicalize-CBaZprTo.d.cts.map +0 -1
- package/dist/clientTypes-C9dJufxk.d.ts.map +0 -1
- package/dist/clientTypes-_mEgzmNs.d.cts.map +0 -1
- package/dist/eip712MethodByType-D8jLoxDu.d.cts.map +0 -1
- package/dist/eip712MethodByType-DcUh8h-l.d.ts.map +0 -1
- package/dist/feed-DTJlsg8W.d.cts +0 -14
- package/dist/feed-DTJlsg8W.d.cts.map +0 -1
- package/dist/feed-DTJlsg8W.d.ts +0 -14
- package/dist/feed-DTJlsg8W.d.ts.map +0 -1
- package/dist/mobileErrorCodes-CmjYEIYm.d.cts.map +0 -1
- package/dist/mobileErrorCodes-CmjYEIYm.d.ts.map +0 -1
- package/dist/payloadHash-DhHmgRqL.d.cts.map +0 -1
- package/dist/payloadHash-E1_8fpLW.d.ts.map +0 -1
- package/dist/serverBaseTypes-B5J1_TyC.d.cts +0 -25
- package/dist/serverBaseTypes-B5J1_TyC.d.cts.map +0 -1
- package/dist/serverBaseTypes-DnLzsdm-.d.ts +0 -25
- package/dist/serverBaseTypes-DnLzsdm-.d.ts.map +0 -1
- package/dist/serverExecuteTypes-B-OJok19.d.cts.map +0 -1
- package/dist/serverExecuteTypes-BwWGspOg.d.ts.map +0 -1
- package/dist/serverModelTypes-CiA-dy1R.d.cts.map +0 -1
- package/dist/serverModelTypes-CiA-dy1R.d.ts.map +0 -1
- package/dist/serverQueryTypes-CJcjLB7n.d.ts +0 -283
- package/dist/serverQueryTypes-CJcjLB7n.d.ts.map +0 -1
- package/dist/serverQueryTypes-V1f9yE7L.d.cts +0 -283
- package/dist/serverQueryTypes-V1f9yE7L.d.cts.map +0 -1
- package/dist/serverRequestTypes-CRlkNSu5.d.cts +0 -270
- package/dist/serverRequestTypes-CRlkNSu5.d.cts.map +0 -1
- package/dist/serverRequestTypes-DZoOhV2o.d.ts +0 -270
- package/dist/serverRequestTypes-DZoOhV2o.d.ts.map +0 -1
- package/dist/types-BiRmH5Iv.d.cts +0 -108
- package/dist/types-BiRmH5Iv.d.cts.map +0 -1
- package/dist/types-DoJuq0Ij.d.ts +0 -108
- package/dist/types-DoJuq0Ij.d.ts.map +0 -1
package/dist/dataMappers.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_types_MobileUnsupportedFeedItemError = require("./types/MobileUnsupportedFeedItemError.cjs");
|
|
3
|
+
const require_types_MobileUnsupportedNotificationRouteError = require("./types/MobileUnsupportedNotificationRouteError.cjs");
|
|
3
4
|
let _nadohq_shared = require("@nadohq/shared");
|
|
4
5
|
//#region src/dataMappers.ts
|
|
5
6
|
/**
|
|
@@ -22,6 +23,172 @@ function mapMobileAvatarUpload(server) {
|
|
|
22
23
|
expiresInSeconds: server.expires_in_seconds
|
|
23
24
|
};
|
|
24
25
|
}
|
|
26
|
+
/** Maps a saved notification registration to the client model without the response envelope.
|
|
27
|
+
* @param server - Registration payload.
|
|
28
|
+
* @returns Saved generation and capabilities.
|
|
29
|
+
*/
|
|
30
|
+
function mapMobileNotificationRegistrationV2(server) {
|
|
31
|
+
return {
|
|
32
|
+
registrationGeneration: server.registration_generation,
|
|
33
|
+
capabilities: {
|
|
34
|
+
payloadVersions: server.capabilities.payload_versions,
|
|
35
|
+
typeIds: server.capabilities.type_ids,
|
|
36
|
+
routes: server.capabilities.routes
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Maps a v2 capability declaration to the registration wire format.
|
|
41
|
+
* @param capabilities - Device-supported features.
|
|
42
|
+
* @returns V2-only registration capabilities.
|
|
43
|
+
*/
|
|
44
|
+
function mapMobileNotificationCapabilitiesToServer(capabilities) {
|
|
45
|
+
return {
|
|
46
|
+
payload_versions: capabilities.payloadVersions,
|
|
47
|
+
type_ids: capabilities.typeIds,
|
|
48
|
+
routes: capabilities.routes
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Maps complete notification settings to the client model.
|
|
52
|
+
* @param server - Saved settings.
|
|
53
|
+
* @returns CamelCase settings.
|
|
54
|
+
*/
|
|
55
|
+
function mapMobileNotificationSettings(server) {
|
|
56
|
+
return {
|
|
57
|
+
myPositions: server.my_positions,
|
|
58
|
+
positionThresholds: server.position_thresholds,
|
|
59
|
+
myOrders: server.my_orders,
|
|
60
|
+
followingTrades: server.following_trades,
|
|
61
|
+
followingPosts: server.following_posts,
|
|
62
|
+
minTradeSizeUsd: server.min_trade_size_usd,
|
|
63
|
+
newFollowers: server.new_followers,
|
|
64
|
+
announcements: server.announcements,
|
|
65
|
+
discovery: server.discovery
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Maps a complete replacement settings document to wire format.
|
|
69
|
+
* @param settings - Complete client settings.
|
|
70
|
+
* @returns Settings accepted by the service.
|
|
71
|
+
*/
|
|
72
|
+
function mapMobileNotificationSettingsToServer(settings) {
|
|
73
|
+
return {
|
|
74
|
+
my_positions: settings.myPositions,
|
|
75
|
+
position_thresholds: settings.positionThresholds,
|
|
76
|
+
my_orders: settings.myOrders,
|
|
77
|
+
following_trades: settings.followingTrades,
|
|
78
|
+
following_posts: settings.followingPosts,
|
|
79
|
+
min_trade_size_usd: settings.minTradeSizeUsd,
|
|
80
|
+
new_followers: settings.newFollowers,
|
|
81
|
+
announcements: settings.announcements,
|
|
82
|
+
discovery: settings.discovery
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Maps a revisioned settings response without the response envelope.
|
|
86
|
+
* @param server - Versioned settings payload.
|
|
87
|
+
* @returns Client settings and their revision.
|
|
88
|
+
*/
|
|
89
|
+
function mapMobileNotificationSettingsV2(server) {
|
|
90
|
+
return {
|
|
91
|
+
schemaVersion: server.schema_version,
|
|
92
|
+
revision: server.revision,
|
|
93
|
+
settings: mapMobileNotificationSettings(server.settings)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** Maps wallet market subscriptions and Identity bells.
|
|
97
|
+
* @param server - Subscription payload.
|
|
98
|
+
* @returns Client subscription state without the response envelope.
|
|
99
|
+
*/
|
|
100
|
+
function mapMobileNotificationSubscriptions(server) {
|
|
101
|
+
return {
|
|
102
|
+
revision: server.revision,
|
|
103
|
+
favoritesImported: server.favorites_imported,
|
|
104
|
+
marketIds: server.market_ids,
|
|
105
|
+
traderBells: server.trader_bells
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** Maps one subscription operation, explicitly nulling unused wire operations.
|
|
109
|
+
* @param update - Exactly one revision-guarded operation.
|
|
110
|
+
* @returns The complete signed inner operation fields.
|
|
111
|
+
*/
|
|
112
|
+
function mapMobileNotificationSubscriptionsUpdateToServer(update) {
|
|
113
|
+
return {
|
|
114
|
+
expected_revision: update.expectedRevision,
|
|
115
|
+
trader_bell: update.traderBell == null ? null : {
|
|
116
|
+
subaccount: (0, _nadohq_shared.subaccountToHex)(update.traderBell.subaccount),
|
|
117
|
+
enabled: update.traderBell.enabled
|
|
118
|
+
},
|
|
119
|
+
market: update.market == null ? null : {
|
|
120
|
+
product_id: update.market.productId,
|
|
121
|
+
subscribed: update.market.subscribed
|
|
122
|
+
},
|
|
123
|
+
import_markets: update.importMarkets ?? null
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/** Maps an allowlisted notification destination.
|
|
127
|
+
* @param server - Named backend destination.
|
|
128
|
+
* @returns Client navigation data, never an arbitrary URL.
|
|
129
|
+
* @throws {MobileUnsupportedNotificationRouteError} If the service returns an unsupported route name.
|
|
130
|
+
*/
|
|
131
|
+
function mapMobileNotificationRoute(server) {
|
|
132
|
+
const name = server.name;
|
|
133
|
+
switch (name) {
|
|
134
|
+
case "market": return {
|
|
135
|
+
name: server.name,
|
|
136
|
+
productId: server.product_id
|
|
137
|
+
};
|
|
138
|
+
case "profile": return {
|
|
139
|
+
name: server.name,
|
|
140
|
+
subaccount: server.subaccount
|
|
141
|
+
};
|
|
142
|
+
case "portfolio": return { name: server.name };
|
|
143
|
+
default: throw new require_types_MobileUnsupportedNotificationRouteError.MobileUnsupportedNotificationRouteError(name);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** Maps v2 push or inbox navigation data.
|
|
147
|
+
* @param server - Wire-format notification payload.
|
|
148
|
+
* @returns Client notification data.
|
|
149
|
+
* @throws {MobileUnsupportedNotificationRouteError} If the service returns an unsupported route name.
|
|
150
|
+
*/
|
|
151
|
+
function mapMobileNotificationPayloadV2(server) {
|
|
152
|
+
return {
|
|
153
|
+
payloadVersion: server.payload_version,
|
|
154
|
+
notificationId: server.notification_id,
|
|
155
|
+
recipientWallet: server.recipient_wallet,
|
|
156
|
+
typeId: server.type_id,
|
|
157
|
+
templateVersion: server.template_version,
|
|
158
|
+
route: mapMobileNotificationRoute(server.route)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/** Maps a private notification page without the response envelope.
|
|
162
|
+
* @param server - Newest-first inbox payload.
|
|
163
|
+
* @returns Client items, attribution flags, and the next cursor.
|
|
164
|
+
* @throws {MobileUnsupportedNotificationRouteError} If a notification has an unsupported route name.
|
|
165
|
+
*/
|
|
166
|
+
function mapMobileNotificationInboxV2(server) {
|
|
167
|
+
return {
|
|
168
|
+
notifications: server.notifications.map((item) => ({
|
|
169
|
+
notificationId: item.notification_id,
|
|
170
|
+
typeId: item.type_id,
|
|
171
|
+
data: mapMobileNotificationPayloadV2(item.data),
|
|
172
|
+
createdAt: item.created_at,
|
|
173
|
+
tradeWithin24h: item.trade_within_24h
|
|
174
|
+
})),
|
|
175
|
+
nextCursor: server.next_cursor
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/** Maps a typed analytics interaction, nulling unused wire fields.
|
|
179
|
+
* @param event - Event-specific client data.
|
|
180
|
+
* @returns Complete signed wire event.
|
|
181
|
+
*/
|
|
182
|
+
function mapMobileProductEventToServer(event) {
|
|
183
|
+
return {
|
|
184
|
+
client_event_id: event.clientEventId,
|
|
185
|
+
event_name: event.eventName,
|
|
186
|
+
notification_id: event.notificationId ?? null,
|
|
187
|
+
occurred_at: event.occurredAt,
|
|
188
|
+
product_id: event.productId ?? null,
|
|
189
|
+
query: event.query ?? null
|
|
190
|
+
};
|
|
191
|
+
}
|
|
25
192
|
/**
|
|
26
193
|
* Maps a client-side avatar selection to the signed wire payload; null clears the saved avatar.
|
|
27
194
|
*/
|
|
@@ -343,6 +510,35 @@ function mapMobileSocialFeedInteraction(server) {
|
|
|
343
510
|
};
|
|
344
511
|
}
|
|
345
512
|
/**
|
|
513
|
+
* Maps uploaded image metadata; bytes remain behind a protected GET.
|
|
514
|
+
* @param server - The service response.
|
|
515
|
+
* @returns The mapped feed image.
|
|
516
|
+
*/
|
|
517
|
+
function mapMobileSocialFeedUploadedImage(server) {
|
|
518
|
+
return {
|
|
519
|
+
imageId: server.image_id,
|
|
520
|
+
url: server.url,
|
|
521
|
+
width: server.width,
|
|
522
|
+
height: server.height,
|
|
523
|
+
contentType: server.content_type,
|
|
524
|
+
byteSize: server.byte_size,
|
|
525
|
+
thumbnail: {
|
|
526
|
+
url: server.thumbnail.url,
|
|
527
|
+
width: server.thumbnail.width,
|
|
528
|
+
height: server.thumbnail.height
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Maps either protected upload metadata or an external URL without inventing metadata.
|
|
534
|
+
* @param server - The service response.
|
|
535
|
+
* @returns The mapped uploaded image or external URL.
|
|
536
|
+
*/
|
|
537
|
+
function mapMobileSocialFeedImage(server) {
|
|
538
|
+
if ("image_id" in server) return mapMobileSocialFeedUploadedImage(server);
|
|
539
|
+
return { url: server.url };
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
346
542
|
* Maps common item metadata and server capabilities.
|
|
347
543
|
* @param server - The service response.
|
|
348
544
|
* @returns The mapped social feed item base.
|
|
@@ -372,6 +568,7 @@ function mapMobileSocialFeedItemBase(server) {
|
|
|
372
568
|
function mapMobileSocialFeedContentBase(server) {
|
|
373
569
|
return {
|
|
374
570
|
...mapMobileSocialFeedItemBase(server),
|
|
571
|
+
images: server.images.map(mapMobileSocialFeedImage),
|
|
375
572
|
text: server.text,
|
|
376
573
|
mentions: server.mentions,
|
|
377
574
|
position: mapMobileSocialFeedPositionCard(server.position),
|
|
@@ -453,7 +650,7 @@ function mapMobileSocialFeedItem(server) {
|
|
|
453
650
|
}
|
|
454
651
|
}
|
|
455
652
|
/**
|
|
456
|
-
* Maps a
|
|
653
|
+
* Maps a reading session and its current idle expiration, preserving opaque credentials and cursors.
|
|
457
654
|
* @param server - The service response.
|
|
458
655
|
* @returns The mapped feed read session.
|
|
459
656
|
*/
|
|
@@ -462,10 +659,6 @@ function mapMobileSocialFeedReadSession(server) {
|
|
|
462
659
|
sessionId: server.session_id,
|
|
463
660
|
mode: server.mode,
|
|
464
661
|
expiresAtMs: server.expires_at_ms,
|
|
465
|
-
viewTracking: {
|
|
466
|
-
minVisibleRatio: server.view_tracking.min_visible_ratio,
|
|
467
|
-
minDurationMs: server.view_tracking.min_duration_ms
|
|
468
|
-
},
|
|
469
662
|
updateCursor: server.update_cursor,
|
|
470
663
|
viewerToken: server.viewer_token
|
|
471
664
|
};
|
|
@@ -663,6 +856,7 @@ function mapMobileSocialFeedReply(server) {
|
|
|
663
856
|
return {
|
|
664
857
|
...mapMobileSocialFeedItemBase(server),
|
|
665
858
|
kind: server.kind,
|
|
859
|
+
images: server.images.map(mapMobileSocialFeedImage),
|
|
666
860
|
text: server.text,
|
|
667
861
|
mentions: server.mentions,
|
|
668
862
|
rootItemId: server.root_item_id,
|
|
@@ -870,14 +1064,26 @@ function mapMobileSocialFeedDrawingMutationResult(server) {
|
|
|
870
1064
|
};
|
|
871
1065
|
}
|
|
872
1066
|
/**
|
|
873
|
-
* Maps
|
|
1067
|
+
* Maps a top-level comment and its complete flat descendants without sorting or dropping content.
|
|
1068
|
+
* @param server - A comment group from the service thread snapshot.
|
|
1069
|
+
* @returns The mapped top-level comment with each descendant's original parent relationship.
|
|
1070
|
+
*/
|
|
1071
|
+
function mapMobileSocialFeedCommentGroup(server) {
|
|
1072
|
+
return {
|
|
1073
|
+
...mapMobileSocialFeedReply(server),
|
|
1074
|
+
replies: server.replies.map(mapMobileSocialFeedReply)
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Maps complete comment groups in server order and the actual returned session.
|
|
874
1079
|
* @param server - Service payload with its original wire fields.
|
|
875
|
-
* @returns Mapped
|
|
1080
|
+
* @returns Mapped groups, whole-thread counts, bidirectional cursors, nullable anchor, and reading session.
|
|
876
1081
|
*/
|
|
877
1082
|
function mapMobileSocialFeedCommentsPage(server) {
|
|
878
1083
|
return {
|
|
879
|
-
comments: server.comments.map(
|
|
1084
|
+
comments: server.comments.map(mapMobileSocialFeedCommentGroup),
|
|
880
1085
|
totalCount: server.total_count,
|
|
1086
|
+
topLevelCount: server.top_level_count,
|
|
881
1087
|
nextCursor: server.next_cursor,
|
|
882
1088
|
previousCursor: server.previous_cursor,
|
|
883
1089
|
anchorReplyId: server.anchor_reply_id,
|
|
@@ -909,17 +1115,6 @@ function mapMobileSocialFeedLikeResult(server) {
|
|
|
909
1115
|
};
|
|
910
1116
|
}
|
|
911
1117
|
/**
|
|
912
|
-
* Maps exposure deduplication results without adding timestamps.
|
|
913
|
-
* @param server - Service payload with its original wire fields.
|
|
914
|
-
* @returns Newly accepted and duplicate item ID lists without inventing an observation timestamp.
|
|
915
|
-
*/
|
|
916
|
-
function mapMobileSocialFeedViewsResult(server) {
|
|
917
|
-
return {
|
|
918
|
-
acceptedItemIds: server.accepted_item_ids,
|
|
919
|
-
duplicateItemIds: server.duplicate_item_ids
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
1118
|
* Maps a published history take without treating unknown kinds as posts.
|
|
924
1119
|
* @param server - The published service item.
|
|
925
1120
|
* @returns The mapped post or trade card.
|
|
@@ -963,6 +1158,7 @@ function mapMobileSocialFeedTimelineEntry(server) {
|
|
|
963
1158
|
*/
|
|
964
1159
|
function mapMobileSocialFeedPositionHistory(server) {
|
|
965
1160
|
return {
|
|
1161
|
+
owner: mapMobileSocialFeedAuthor(server.owner),
|
|
966
1162
|
position: {
|
|
967
1163
|
...mapMobileSocialFeedPositionCard(server.position),
|
|
968
1164
|
...mapMobileSocialFeedHistoryMetrics(server.position)
|
|
@@ -1021,6 +1217,32 @@ function mapMobileSocialFeedPresence(server) {
|
|
|
1021
1217
|
expiresInSeconds: server.expires_in_seconds
|
|
1022
1218
|
};
|
|
1023
1219
|
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Maps a published thought, keeping its guaranteed analysis flag and drawing.
|
|
1222
|
+
* @param server - Service payload with its original wire fields.
|
|
1223
|
+
* @returns The mapped post or trade card with a non-null drawing.
|
|
1224
|
+
* @throws {MobileUnsupportedFeedItemError} If the service returns an unsupported take kind.
|
|
1225
|
+
*/
|
|
1226
|
+
function mapMobileSocialFeedPositionThought(server) {
|
|
1227
|
+
return {
|
|
1228
|
+
...mapMobileSocialFeedHistoryTake(server),
|
|
1229
|
+
hasAnalysis: server.has_analysis,
|
|
1230
|
+
drawing: mapMobileSocialFeedDrawing(server.drawing)
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Maps a thoughts page in server order, preserving empty pages with continuation cursors.
|
|
1235
|
+
* @param server - Service payload with its original wire fields.
|
|
1236
|
+
* @returns Thoughts, the next cursor, and the position reading session.
|
|
1237
|
+
* @throws {MobileUnsupportedFeedItemError} If an item is not a post or trade card.
|
|
1238
|
+
*/
|
|
1239
|
+
function mapMobileSocialFeedPositionThoughts(server) {
|
|
1240
|
+
return {
|
|
1241
|
+
items: server.items.map(mapMobileSocialFeedPositionThought),
|
|
1242
|
+
nextCursor: server.next_cursor,
|
|
1243
|
+
readSession: mapMobileSocialFeedReadSession(server.read_session)
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1024
1246
|
//#endregion
|
|
1025
1247
|
exports.mapMobileAvatarPreset = mapMobileAvatarPreset;
|
|
1026
1248
|
exports.mapMobileAvatarSelectionToServer = mapMobileAvatarSelectionToServer;
|
|
@@ -1030,8 +1252,19 @@ exports.mapMobileFollowBatchResult = mapMobileFollowBatchResult;
|
|
|
1030
1252
|
exports.mapMobileFollowListPage = mapMobileFollowListPage;
|
|
1031
1253
|
exports.mapMobileFollowListParamsToServer = mapMobileFollowListParamsToServer;
|
|
1032
1254
|
exports.mapMobileFollowMutationResult = mapMobileFollowMutationResult;
|
|
1255
|
+
exports.mapMobileNotificationCapabilitiesToServer = mapMobileNotificationCapabilitiesToServer;
|
|
1256
|
+
exports.mapMobileNotificationInboxV2 = mapMobileNotificationInboxV2;
|
|
1257
|
+
exports.mapMobileNotificationPayloadV2 = mapMobileNotificationPayloadV2;
|
|
1033
1258
|
exports.mapMobileNotificationPreferences = mapMobileNotificationPreferences;
|
|
1034
1259
|
exports.mapMobileNotificationPreferencesToServer = mapMobileNotificationPreferencesToServer;
|
|
1260
|
+
exports.mapMobileNotificationRegistrationV2 = mapMobileNotificationRegistrationV2;
|
|
1261
|
+
exports.mapMobileNotificationRoute = mapMobileNotificationRoute;
|
|
1262
|
+
exports.mapMobileNotificationSettings = mapMobileNotificationSettings;
|
|
1263
|
+
exports.mapMobileNotificationSettingsToServer = mapMobileNotificationSettingsToServer;
|
|
1264
|
+
exports.mapMobileNotificationSettingsV2 = mapMobileNotificationSettingsV2;
|
|
1265
|
+
exports.mapMobileNotificationSubscriptions = mapMobileNotificationSubscriptions;
|
|
1266
|
+
exports.mapMobileNotificationSubscriptionsUpdateToServer = mapMobileNotificationSubscriptionsUpdateToServer;
|
|
1267
|
+
exports.mapMobileProductEventToServer = mapMobileProductEventToServer;
|
|
1035
1268
|
exports.mapMobileProfileSearchPage = mapMobileProfileSearchPage;
|
|
1036
1269
|
exports.mapMobileProfileSearchParamsToServer = mapMobileProfileSearchParamsToServer;
|
|
1037
1270
|
exports.mapMobileProfilesIncludeToServer = mapMobileProfilesIncludeToServer;
|
|
@@ -1042,6 +1275,7 @@ exports.mapMobileSocialFeedActionMarker = mapMobileSocialFeedActionMarker;
|
|
|
1042
1275
|
exports.mapMobileSocialFeedActionResolutionResult = mapMobileSocialFeedActionResolutionResult;
|
|
1043
1276
|
exports.mapMobileSocialFeedAuthor = mapMobileSocialFeedAuthor;
|
|
1044
1277
|
exports.mapMobileSocialFeedCandle = mapMobileSocialFeedCandle;
|
|
1278
|
+
exports.mapMobileSocialFeedCommentGroup = mapMobileSocialFeedCommentGroup;
|
|
1045
1279
|
exports.mapMobileSocialFeedCommentResult = mapMobileSocialFeedCommentResult;
|
|
1046
1280
|
exports.mapMobileSocialFeedCommentsPage = mapMobileSocialFeedCommentsPage;
|
|
1047
1281
|
exports.mapMobileSocialFeedCompactCard = mapMobileSocialFeedCompactCard;
|
|
@@ -1051,6 +1285,7 @@ exports.mapMobileSocialFeedDrawingMutationResult = mapMobileSocialFeedDrawingMut
|
|
|
1051
1285
|
exports.mapMobileSocialFeedDrawingResult = mapMobileSocialFeedDrawingResult;
|
|
1052
1286
|
exports.mapMobileSocialFeedHistoryMetrics = mapMobileSocialFeedHistoryMetrics;
|
|
1053
1287
|
exports.mapMobileSocialFeedHistoryTake = mapMobileSocialFeedHistoryTake;
|
|
1288
|
+
exports.mapMobileSocialFeedImage = mapMobileSocialFeedImage;
|
|
1054
1289
|
exports.mapMobileSocialFeedInteraction = mapMobileSocialFeedInteraction;
|
|
1055
1290
|
exports.mapMobileSocialFeedItem = mapMobileSocialFeedItem;
|
|
1056
1291
|
exports.mapMobileSocialFeedItemBase = mapMobileSocialFeedItemBase;
|
|
@@ -1068,6 +1303,8 @@ exports.mapMobileSocialFeedPositionChart = mapMobileSocialFeedPositionChart;
|
|
|
1068
1303
|
exports.mapMobileSocialFeedPositionHistory = mapMobileSocialFeedPositionHistory;
|
|
1069
1304
|
exports.mapMobileSocialFeedPositionPatch = mapMobileSocialFeedPositionPatch;
|
|
1070
1305
|
exports.mapMobileSocialFeedPositionResolutionResult = mapMobileSocialFeedPositionResolutionResult;
|
|
1306
|
+
exports.mapMobileSocialFeedPositionThought = mapMobileSocialFeedPositionThought;
|
|
1307
|
+
exports.mapMobileSocialFeedPositionThoughts = mapMobileSocialFeedPositionThoughts;
|
|
1071
1308
|
exports.mapMobileSocialFeedPositionsPage = mapMobileSocialFeedPositionsPage;
|
|
1072
1309
|
exports.mapMobileSocialFeedPost = mapMobileSocialFeedPost;
|
|
1073
1310
|
exports.mapMobileSocialFeedPresence = mapMobileSocialFeedPresence;
|
|
@@ -1085,7 +1322,7 @@ exports.mapMobileSocialFeedTraderBadge = mapMobileSocialFeedTraderBadge;
|
|
|
1085
1322
|
exports.mapMobileSocialFeedTradingContext = mapMobileSocialFeedTradingContext;
|
|
1086
1323
|
exports.mapMobileSocialFeedTradingTarget = mapMobileSocialFeedTradingTarget;
|
|
1087
1324
|
exports.mapMobileSocialFeedUpdates = mapMobileSocialFeedUpdates;
|
|
1088
|
-
exports.
|
|
1325
|
+
exports.mapMobileSocialFeedUploadedImage = mapMobileSocialFeedUploadedImage;
|
|
1089
1326
|
exports.mapMobileSocialFeedWatchers = mapMobileSocialFeedWatchers;
|
|
1090
1327
|
|
|
1091
1328
|
//# sourceMappingURL=dataMappers.cjs.map
|