@proofchain/sdk 2.5.2 → 2.7.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/dist/index.d.mts CHANGED
@@ -1582,61 +1582,49 @@ declare class EndUsersClient {
1582
1582
  */
1583
1583
  list(options?: ListEndUsersOptions): Promise<EndUserListResponse>;
1584
1584
  /**
1585
- * Get an end-user by ID
1585
+ * Get an end-user by external ID
1586
1586
  */
1587
- get(userId: string): Promise<EndUser>;
1587
+ get(externalId: string): Promise<EndUser>;
1588
1588
  /**
1589
- * Get an end-user by external ID
1589
+ * Get an end-user by internal UUID (admin use)
1590
1590
  */
1591
- getByExternalId(externalId: string): Promise<EndUser>;
1591
+ getByInternalId(userId: string): Promise<EndUser>;
1592
1592
  /**
1593
1593
  * Create an end-user manually
1594
1594
  */
1595
1595
  create(data: CreateEndUserRequest): Promise<EndUser>;
1596
1596
  /**
1597
- * Update an end-user profile
1597
+ * Update an end-user profile by external ID
1598
1598
  */
1599
- update(userId: string, data: UpdateEndUserRequest): Promise<EndUser>;
1599
+ update(externalId: string, data: UpdateEndUserRequest): Promise<EndUser>;
1600
1600
  /**
1601
1601
  * Delete an end-user
1602
1602
  */
1603
1603
  delete(userId: string): Promise<void>;
1604
1604
  /**
1605
- * Link a wallet to an end-user
1605
+ * Link a wallet to an end-user by external ID
1606
1606
  */
1607
- linkWallet(userId: string, request: LinkWalletRequest): Promise<EndUser>;
1607
+ linkWallet(externalId: string, request: LinkWalletRequest): Promise<EndUser>;
1608
1608
  /**
1609
- * Unlink wallet from an end-user
1609
+ * Get user activity/events by external ID
1610
1610
  */
1611
- unlinkWallet(userId: string): Promise<EndUser>;
1612
- /**
1613
- * Get user activity/events
1614
- */
1615
- getActivity(userId: string, options?: {
1611
+ getActivity(externalId: string, options?: {
1616
1612
  page?: number;
1617
1613
  page_size?: number;
1618
1614
  event_type?: string;
1619
1615
  }): Promise<UserActivityResponse>;
1620
1616
  /**
1621
- * Add points to a user
1622
- */
1623
- addPoints(userId: string, points: number, reason?: string): Promise<EndUser>;
1624
- /**
1625
- * Add a segment to a user
1626
- */
1627
- addSegment(userId: string, segment: string): Promise<EndUser>;
1628
- /**
1629
- * Remove a segment from a user
1617
+ * Add points to a user by external ID
1630
1618
  */
1631
- removeSegment(userId: string, segment: string): Promise<EndUser>;
1619
+ addPoints(externalId: string, points: number, reason?: string): Promise<EndUser>;
1632
1620
  /**
1633
1621
  * Merge two users (moves all data from source to target)
1634
1622
  */
1635
1623
  merge(request: MergeUsersRequest): Promise<EndUser>;
1636
1624
  /**
1637
- * Update user attributes (convenience method)
1625
+ * Update user attributes (convenience method) by external ID
1638
1626
  */
1639
- updateAttributes(userId: string, attributes: Record<string, any>): Promise<EndUser>;
1627
+ updateAttributes(externalId: string, attributes: Record<string, any>): Promise<EndUser>;
1640
1628
  /**
1641
1629
  * Export users as CSV
1642
1630
  */
@@ -2486,6 +2474,8 @@ interface CohortLeaderboardResponse {
2486
2474
  total_users: number;
2487
2475
  group_stats: CohortGroupStats;
2488
2476
  leaderboard: CohortLeaderboardEntry[];
2477
+ current_user: CohortLeaderboardEntry | null;
2478
+ current_user_in_leaderboard: boolean;
2489
2479
  }
2490
2480
  interface CohortDefinition {
2491
2481
  id: string;
@@ -2523,6 +2513,7 @@ interface CohortLeaderboardOptions {
2523
2513
  limit?: number;
2524
2514
  top_n?: number;
2525
2515
  fresh?: boolean;
2516
+ userId?: string;
2526
2517
  }
2527
2518
  interface ListCohortsOptions {
2528
2519
  status?: 'active' | 'inactive' | 'draft';
@@ -2581,6 +2572,8 @@ interface FanpassLeaderboardResponse {
2581
2572
  total_users: number;
2582
2573
  group_stats: FanpassGroupStats;
2583
2574
  leaderboard: FanpassLeaderboardEntry[];
2575
+ current_user: FanpassLeaderboardEntry | null;
2576
+ current_user_in_leaderboard: boolean;
2584
2577
  }
2585
2578
  interface FanpassUserComparisonResponse {
2586
2579
  user_id: string;
@@ -2594,6 +2587,7 @@ interface FanpassLeaderboardOptions {
2594
2587
  limit?: number;
2595
2588
  top_n?: number;
2596
2589
  fresh?: boolean;
2590
+ userId?: string;
2597
2591
  }
2598
2592
  declare class FanpassLeaderboardClient {
2599
2593
  private http;
package/dist/index.d.ts CHANGED
@@ -1582,61 +1582,49 @@ declare class EndUsersClient {
1582
1582
  */
1583
1583
  list(options?: ListEndUsersOptions): Promise<EndUserListResponse>;
1584
1584
  /**
1585
- * Get an end-user by ID
1585
+ * Get an end-user by external ID
1586
1586
  */
1587
- get(userId: string): Promise<EndUser>;
1587
+ get(externalId: string): Promise<EndUser>;
1588
1588
  /**
1589
- * Get an end-user by external ID
1589
+ * Get an end-user by internal UUID (admin use)
1590
1590
  */
1591
- getByExternalId(externalId: string): Promise<EndUser>;
1591
+ getByInternalId(userId: string): Promise<EndUser>;
1592
1592
  /**
1593
1593
  * Create an end-user manually
1594
1594
  */
1595
1595
  create(data: CreateEndUserRequest): Promise<EndUser>;
1596
1596
  /**
1597
- * Update an end-user profile
1597
+ * Update an end-user profile by external ID
1598
1598
  */
1599
- update(userId: string, data: UpdateEndUserRequest): Promise<EndUser>;
1599
+ update(externalId: string, data: UpdateEndUserRequest): Promise<EndUser>;
1600
1600
  /**
1601
1601
  * Delete an end-user
1602
1602
  */
1603
1603
  delete(userId: string): Promise<void>;
1604
1604
  /**
1605
- * Link a wallet to an end-user
1605
+ * Link a wallet to an end-user by external ID
1606
1606
  */
1607
- linkWallet(userId: string, request: LinkWalletRequest): Promise<EndUser>;
1607
+ linkWallet(externalId: string, request: LinkWalletRequest): Promise<EndUser>;
1608
1608
  /**
1609
- * Unlink wallet from an end-user
1609
+ * Get user activity/events by external ID
1610
1610
  */
1611
- unlinkWallet(userId: string): Promise<EndUser>;
1612
- /**
1613
- * Get user activity/events
1614
- */
1615
- getActivity(userId: string, options?: {
1611
+ getActivity(externalId: string, options?: {
1616
1612
  page?: number;
1617
1613
  page_size?: number;
1618
1614
  event_type?: string;
1619
1615
  }): Promise<UserActivityResponse>;
1620
1616
  /**
1621
- * Add points to a user
1622
- */
1623
- addPoints(userId: string, points: number, reason?: string): Promise<EndUser>;
1624
- /**
1625
- * Add a segment to a user
1626
- */
1627
- addSegment(userId: string, segment: string): Promise<EndUser>;
1628
- /**
1629
- * Remove a segment from a user
1617
+ * Add points to a user by external ID
1630
1618
  */
1631
- removeSegment(userId: string, segment: string): Promise<EndUser>;
1619
+ addPoints(externalId: string, points: number, reason?: string): Promise<EndUser>;
1632
1620
  /**
1633
1621
  * Merge two users (moves all data from source to target)
1634
1622
  */
1635
1623
  merge(request: MergeUsersRequest): Promise<EndUser>;
1636
1624
  /**
1637
- * Update user attributes (convenience method)
1625
+ * Update user attributes (convenience method) by external ID
1638
1626
  */
1639
- updateAttributes(userId: string, attributes: Record<string, any>): Promise<EndUser>;
1627
+ updateAttributes(externalId: string, attributes: Record<string, any>): Promise<EndUser>;
1640
1628
  /**
1641
1629
  * Export users as CSV
1642
1630
  */
@@ -2486,6 +2474,8 @@ interface CohortLeaderboardResponse {
2486
2474
  total_users: number;
2487
2475
  group_stats: CohortGroupStats;
2488
2476
  leaderboard: CohortLeaderboardEntry[];
2477
+ current_user: CohortLeaderboardEntry | null;
2478
+ current_user_in_leaderboard: boolean;
2489
2479
  }
2490
2480
  interface CohortDefinition {
2491
2481
  id: string;
@@ -2523,6 +2513,7 @@ interface CohortLeaderboardOptions {
2523
2513
  limit?: number;
2524
2514
  top_n?: number;
2525
2515
  fresh?: boolean;
2516
+ userId?: string;
2526
2517
  }
2527
2518
  interface ListCohortsOptions {
2528
2519
  status?: 'active' | 'inactive' | 'draft';
@@ -2581,6 +2572,8 @@ interface FanpassLeaderboardResponse {
2581
2572
  total_users: number;
2582
2573
  group_stats: FanpassGroupStats;
2583
2574
  leaderboard: FanpassLeaderboardEntry[];
2575
+ current_user: FanpassLeaderboardEntry | null;
2576
+ current_user_in_leaderboard: boolean;
2584
2577
  }
2585
2578
  interface FanpassUserComparisonResponse {
2586
2579
  user_id: string;
@@ -2594,6 +2587,7 @@ interface FanpassLeaderboardOptions {
2594
2587
  limit?: number;
2595
2588
  top_n?: number;
2596
2589
  fresh?: boolean;
2590
+ userId?: string;
2597
2591
  }
2598
2592
  declare class FanpassLeaderboardClient {
2599
2593
  private http;
package/dist/index.js CHANGED
@@ -1148,16 +1148,16 @@ var EndUsersClient = class {
1148
1148
  return this.http.get(`/end-users?${params.toString()}`);
1149
1149
  }
1150
1150
  /**
1151
- * Get an end-user by ID
1151
+ * Get an end-user by external ID
1152
1152
  */
1153
- async get(userId) {
1154
- return this.http.get(`/end-users/${userId}`);
1153
+ async get(externalId) {
1154
+ return this.http.get(`/end-users/by-external/${encodeURIComponent(externalId)}`);
1155
1155
  }
1156
1156
  /**
1157
- * Get an end-user by external ID
1157
+ * Get an end-user by internal UUID (admin use)
1158
1158
  */
1159
- async getByExternalId(externalId) {
1160
- return this.http.get(`/end-users/by-external/${encodeURIComponent(externalId)}`);
1159
+ async getByInternalId(userId) {
1160
+ return this.http.get(`/end-users/${userId}`);
1161
1161
  }
1162
1162
  /**
1163
1163
  * Create an end-user manually
@@ -1166,10 +1166,10 @@ var EndUsersClient = class {
1166
1166
  return this.http.post("/end-users", data);
1167
1167
  }
1168
1168
  /**
1169
- * Update an end-user profile
1169
+ * Update an end-user profile by external ID
1170
1170
  */
1171
- async update(userId, data) {
1172
- return this.http.patch(`/end-users/${userId}`, data);
1171
+ async update(externalId, data) {
1172
+ return this.http.patch(`/end-users/by-external/${encodeURIComponent(externalId)}`, data);
1173
1173
  }
1174
1174
  /**
1175
1175
  * Delete an end-user
@@ -1178,44 +1178,29 @@ var EndUsersClient = class {
1178
1178
  await this.http.delete(`/end-users/${userId}`);
1179
1179
  }
1180
1180
  /**
1181
- * Link a wallet to an end-user
1181
+ * Link a wallet to an end-user by external ID
1182
1182
  */
1183
- async linkWallet(userId, request) {
1184
- return this.http.post(`/end-users/${userId}/wallet`, request);
1183
+ async linkWallet(externalId, request) {
1184
+ return this.http.post(`/end-users/by-external/${encodeURIComponent(externalId)}/link-wallet`, request);
1185
1185
  }
1186
1186
  /**
1187
- * Unlink wallet from an end-user
1187
+ * Get user activity/events by external ID
1188
1188
  */
1189
- async unlinkWallet(userId) {
1190
- return this.http.delete(`/end-users/${userId}/wallet`);
1191
- }
1192
- /**
1193
- * Get user activity/events
1194
- */
1195
- async getActivity(userId, options = {}) {
1189
+ async getActivity(externalId, options = {}) {
1196
1190
  const params = new URLSearchParams();
1197
1191
  if (options.page) params.append("page", options.page.toString());
1198
1192
  if (options.page_size) params.append("page_size", options.page_size.toString());
1199
1193
  if (options.event_type) params.append("event_type", options.event_type);
1200
- return this.http.get(`/end-users/${userId}/activity?${params.toString()}`);
1201
- }
1202
- /**
1203
- * Add points to a user
1204
- */
1205
- async addPoints(userId, points, reason) {
1206
- return this.http.post(`/end-users/${userId}/points`, { points, reason });
1194
+ return this.http.get(`/end-users/by-external/${encodeURIComponent(externalId)}/activity?${params.toString()}`);
1207
1195
  }
1208
1196
  /**
1209
- * Add a segment to a user
1197
+ * Add points to a user by external ID
1210
1198
  */
1211
- async addSegment(userId, segment) {
1212
- return this.http.post(`/end-users/${userId}/segments`, { segment });
1213
- }
1214
- /**
1215
- * Remove a segment from a user
1216
- */
1217
- async removeSegment(userId, segment) {
1218
- return this.http.delete(`/end-users/${userId}/segments/${encodeURIComponent(segment)}`);
1199
+ async addPoints(externalId, points, reason) {
1200
+ const params = new URLSearchParams();
1201
+ params.append("points", points.toString());
1202
+ if (reason) params.append("reason", reason);
1203
+ return this.http.post(`/end-users/by-external/${encodeURIComponent(externalId)}/add-points?${params.toString()}`, {});
1219
1204
  }
1220
1205
  /**
1221
1206
  * Merge two users (moves all data from source to target)
@@ -1224,10 +1209,10 @@ var EndUsersClient = class {
1224
1209
  return this.http.post("/end-users/merge", request);
1225
1210
  }
1226
1211
  /**
1227
- * Update user attributes (convenience method)
1212
+ * Update user attributes (convenience method) by external ID
1228
1213
  */
1229
- async updateAttributes(userId, attributes) {
1230
- return this.http.patch(`/end-users/${userId}`, { attributes });
1214
+ async updateAttributes(externalId, attributes) {
1215
+ return this.http.patch(`/end-users/by-external/${encodeURIComponent(externalId)}`, { attributes });
1231
1216
  }
1232
1217
  /**
1233
1218
  * Export users as CSV
@@ -1815,6 +1800,7 @@ var CohortLeaderboardClient = class {
1815
1800
  if (options.limit) params.limit = options.limit;
1816
1801
  if (options.top_n) params.top_n = options.top_n;
1817
1802
  if (options.fresh) params.fresh = "true";
1803
+ if (options.userId) params.user_id = options.userId;
1818
1804
  return this.http.get(
1819
1805
  `/cohorts/definitions/${encodeURIComponent(cohortId)}/leaderboard`,
1820
1806
  params
@@ -1852,6 +1838,7 @@ var FanpassLeaderboardClient = class {
1852
1838
  if (options.limit) params.limit = options.limit;
1853
1839
  if (options.top_n) params.top_n = options.top_n;
1854
1840
  if (options.fresh) params.fresh = "true";
1841
+ if (options.userId) params.user_id = options.userId;
1855
1842
  return this.http.get(
1856
1843
  "/passport-v2/fanpass/leaderboard",
1857
1844
  params
package/dist/index.mjs CHANGED
@@ -1094,16 +1094,16 @@ var EndUsersClient = class {
1094
1094
  return this.http.get(`/end-users?${params.toString()}`);
1095
1095
  }
1096
1096
  /**
1097
- * Get an end-user by ID
1097
+ * Get an end-user by external ID
1098
1098
  */
1099
- async get(userId) {
1100
- return this.http.get(`/end-users/${userId}`);
1099
+ async get(externalId) {
1100
+ return this.http.get(`/end-users/by-external/${encodeURIComponent(externalId)}`);
1101
1101
  }
1102
1102
  /**
1103
- * Get an end-user by external ID
1103
+ * Get an end-user by internal UUID (admin use)
1104
1104
  */
1105
- async getByExternalId(externalId) {
1106
- return this.http.get(`/end-users/by-external/${encodeURIComponent(externalId)}`);
1105
+ async getByInternalId(userId) {
1106
+ return this.http.get(`/end-users/${userId}`);
1107
1107
  }
1108
1108
  /**
1109
1109
  * Create an end-user manually
@@ -1112,10 +1112,10 @@ var EndUsersClient = class {
1112
1112
  return this.http.post("/end-users", data);
1113
1113
  }
1114
1114
  /**
1115
- * Update an end-user profile
1115
+ * Update an end-user profile by external ID
1116
1116
  */
1117
- async update(userId, data) {
1118
- return this.http.patch(`/end-users/${userId}`, data);
1117
+ async update(externalId, data) {
1118
+ return this.http.patch(`/end-users/by-external/${encodeURIComponent(externalId)}`, data);
1119
1119
  }
1120
1120
  /**
1121
1121
  * Delete an end-user
@@ -1124,44 +1124,29 @@ var EndUsersClient = class {
1124
1124
  await this.http.delete(`/end-users/${userId}`);
1125
1125
  }
1126
1126
  /**
1127
- * Link a wallet to an end-user
1127
+ * Link a wallet to an end-user by external ID
1128
1128
  */
1129
- async linkWallet(userId, request) {
1130
- return this.http.post(`/end-users/${userId}/wallet`, request);
1129
+ async linkWallet(externalId, request) {
1130
+ return this.http.post(`/end-users/by-external/${encodeURIComponent(externalId)}/link-wallet`, request);
1131
1131
  }
1132
1132
  /**
1133
- * Unlink wallet from an end-user
1133
+ * Get user activity/events by external ID
1134
1134
  */
1135
- async unlinkWallet(userId) {
1136
- return this.http.delete(`/end-users/${userId}/wallet`);
1137
- }
1138
- /**
1139
- * Get user activity/events
1140
- */
1141
- async getActivity(userId, options = {}) {
1135
+ async getActivity(externalId, options = {}) {
1142
1136
  const params = new URLSearchParams();
1143
1137
  if (options.page) params.append("page", options.page.toString());
1144
1138
  if (options.page_size) params.append("page_size", options.page_size.toString());
1145
1139
  if (options.event_type) params.append("event_type", options.event_type);
1146
- return this.http.get(`/end-users/${userId}/activity?${params.toString()}`);
1147
- }
1148
- /**
1149
- * Add points to a user
1150
- */
1151
- async addPoints(userId, points, reason) {
1152
- return this.http.post(`/end-users/${userId}/points`, { points, reason });
1140
+ return this.http.get(`/end-users/by-external/${encodeURIComponent(externalId)}/activity?${params.toString()}`);
1153
1141
  }
1154
1142
  /**
1155
- * Add a segment to a user
1143
+ * Add points to a user by external ID
1156
1144
  */
1157
- async addSegment(userId, segment) {
1158
- return this.http.post(`/end-users/${userId}/segments`, { segment });
1159
- }
1160
- /**
1161
- * Remove a segment from a user
1162
- */
1163
- async removeSegment(userId, segment) {
1164
- return this.http.delete(`/end-users/${userId}/segments/${encodeURIComponent(segment)}`);
1145
+ async addPoints(externalId, points, reason) {
1146
+ const params = new URLSearchParams();
1147
+ params.append("points", points.toString());
1148
+ if (reason) params.append("reason", reason);
1149
+ return this.http.post(`/end-users/by-external/${encodeURIComponent(externalId)}/add-points?${params.toString()}`, {});
1165
1150
  }
1166
1151
  /**
1167
1152
  * Merge two users (moves all data from source to target)
@@ -1170,10 +1155,10 @@ var EndUsersClient = class {
1170
1155
  return this.http.post("/end-users/merge", request);
1171
1156
  }
1172
1157
  /**
1173
- * Update user attributes (convenience method)
1158
+ * Update user attributes (convenience method) by external ID
1174
1159
  */
1175
- async updateAttributes(userId, attributes) {
1176
- return this.http.patch(`/end-users/${userId}`, { attributes });
1160
+ async updateAttributes(externalId, attributes) {
1161
+ return this.http.patch(`/end-users/by-external/${encodeURIComponent(externalId)}`, { attributes });
1177
1162
  }
1178
1163
  /**
1179
1164
  * Export users as CSV
@@ -1761,6 +1746,7 @@ var CohortLeaderboardClient = class {
1761
1746
  if (options.limit) params.limit = options.limit;
1762
1747
  if (options.top_n) params.top_n = options.top_n;
1763
1748
  if (options.fresh) params.fresh = "true";
1749
+ if (options.userId) params.user_id = options.userId;
1764
1750
  return this.http.get(
1765
1751
  `/cohorts/definitions/${encodeURIComponent(cohortId)}/leaderboard`,
1766
1752
  params
@@ -1798,6 +1784,7 @@ var FanpassLeaderboardClient = class {
1798
1784
  if (options.limit) params.limit = options.limit;
1799
1785
  if (options.top_n) params.top_n = options.top_n;
1800
1786
  if (options.fresh) params.fresh = "true";
1787
+ if (options.userId) params.user_id = options.userId;
1801
1788
  return this.http.get(
1802
1789
  "/passport-v2/fanpass/leaderboard",
1803
1790
  params
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proofchain/sdk",
3
- "version": "2.5.2",
3
+ "version": "2.7.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for ProofChain - blockchain-anchored document attestation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",