@explorins/pers-sdk 1.1.2 → 1.1.3

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 (291) hide show
  1. package/dist/analytics/api/analytics-api.d.ts +17 -0
  2. package/dist/analytics/api/analytics-api.d.ts.map +1 -0
  3. package/{src/analytics/index.ts → dist/analytics/index.d.ts} +28 -52
  4. package/dist/analytics/index.d.ts.map +1 -0
  5. package/dist/analytics/models/index.d.ts +61 -0
  6. package/dist/analytics/models/index.d.ts.map +1 -0
  7. package/dist/analytics/services/analytics-service.d.ts +19 -0
  8. package/dist/analytics/services/analytics-service.d.ts.map +1 -0
  9. package/dist/analytics.cjs +76 -0
  10. package/dist/analytics.cjs.map +1 -0
  11. package/dist/analytics.d.ts +28 -0
  12. package/dist/analytics.js +72 -0
  13. package/dist/analytics.js.map +1 -0
  14. package/dist/auth-admin/api/auth-admin-api.d.ts +27 -0
  15. package/dist/auth-admin/api/auth-admin-api.d.ts.map +1 -0
  16. package/dist/auth-admin/index.d.ts +26 -0
  17. package/dist/auth-admin/index.d.ts.map +1 -0
  18. package/dist/auth-admin/services/auth-admin-service.d.ts +23 -0
  19. package/dist/auth-admin/services/auth-admin-service.d.ts.map +1 -0
  20. package/dist/auth-admin.cjs +96 -0
  21. package/dist/auth-admin.cjs.map +1 -0
  22. package/dist/auth-admin.d.ts +26 -0
  23. package/dist/auth-admin.js +92 -0
  24. package/dist/auth-admin.js.map +1 -0
  25. package/dist/business/api/business-api.d.ts +133 -0
  26. package/dist/business/api/business-api.d.ts.map +1 -0
  27. package/dist/business/index.d.ts +34 -0
  28. package/dist/business/index.d.ts.map +1 -0
  29. package/dist/business/models/index.d.ts +8 -0
  30. package/dist/business/models/index.d.ts.map +1 -0
  31. package/dist/business/services/business-service.d.ts +51 -0
  32. package/dist/business/services/business-service.d.ts.map +1 -0
  33. package/dist/business.cjs +303 -0
  34. package/dist/business.cjs.map +1 -0
  35. package/dist/business.d.ts +34 -0
  36. package/dist/business.js +299 -0
  37. package/dist/business.js.map +1 -0
  38. package/dist/campaign/api/campaign-api.d.ts +213 -0
  39. package/dist/campaign/api/campaign-api.d.ts.map +1 -0
  40. package/dist/campaign/index.d.ts +44 -0
  41. package/dist/campaign/index.d.ts.map +1 -0
  42. package/dist/campaign/services/campaign-service.d.ts +88 -0
  43. package/dist/campaign/services/campaign-service.d.ts.map +1 -0
  44. package/dist/campaign.cjs +506 -0
  45. package/dist/campaign.cjs.map +1 -0
  46. package/dist/campaign.d.ts +44 -0
  47. package/dist/campaign.js +502 -0
  48. package/dist/campaign.js.map +1 -0
  49. package/dist/core/abstractions/http-client.d.ts +22 -0
  50. package/dist/core/abstractions/http-client.d.ts.map +1 -0
  51. package/dist/core/auth/auth-provider.interface.d.ts +12 -0
  52. package/dist/core/auth/auth-provider.interface.d.ts.map +1 -0
  53. package/dist/core/auth/create-auth-provider.d.ts +27 -0
  54. package/dist/core/auth/create-auth-provider.d.ts.map +1 -0
  55. package/dist/core/auth/simple-auth-config.interface.d.ts +15 -0
  56. package/dist/core/auth/simple-auth-config.interface.d.ts.map +1 -0
  57. package/dist/core/index.d.ts +13 -0
  58. package/dist/core/index.d.ts.map +1 -0
  59. package/dist/core/pers-api-client.d.ts +54 -0
  60. package/dist/core/pers-api-client.d.ts.map +1 -0
  61. package/dist/core/pers-config.d.ts +38 -0
  62. package/dist/core/pers-config.d.ts.map +1 -0
  63. package/dist/core/utils/jwt.function.d.ts +2 -0
  64. package/dist/core/utils/jwt.function.d.ts.map +1 -0
  65. package/dist/core.cjs +506 -0
  66. package/dist/core.cjs.map +1 -0
  67. package/dist/core.d.ts +13 -0
  68. package/dist/core.js +497 -0
  69. package/dist/core.js.map +1 -0
  70. package/dist/donation/api/donation-api.d.ts +18 -0
  71. package/dist/donation/api/donation-api.d.ts.map +1 -0
  72. package/dist/donation/index.d.ts +25 -0
  73. package/dist/donation/index.d.ts.map +1 -0
  74. package/{src/donation/models/index.ts → dist/donation/models/index.d.ts} +8 -11
  75. package/dist/donation/models/index.d.ts.map +1 -0
  76. package/dist/donation/services/donation-service.d.ts +19 -0
  77. package/dist/donation/services/donation-service.d.ts.map +1 -0
  78. package/dist/donation.cjs +78 -0
  79. package/dist/donation.cjs.map +1 -0
  80. package/dist/donation.d.ts +25 -0
  81. package/dist/donation.js +74 -0
  82. package/dist/donation.js.map +1 -0
  83. package/dist/index.cjs +4217 -0
  84. package/dist/index.cjs.map +1 -0
  85. package/dist/index.d.ts +21 -0
  86. package/dist/index.d.ts.map +1 -0
  87. package/dist/index.js +4164 -0
  88. package/dist/index.js.map +1 -0
  89. package/dist/package.json +148 -0
  90. package/dist/payment/api/payment-api.d.ts +105 -0
  91. package/dist/payment/api/payment-api.d.ts.map +1 -0
  92. package/dist/payment/index.d.ts +36 -0
  93. package/dist/payment/index.d.ts.map +1 -0
  94. package/dist/payment/models/index.d.ts +12 -0
  95. package/dist/payment/models/index.d.ts.map +1 -0
  96. package/dist/payment/services/payment-service.d.ts +40 -0
  97. package/dist/payment/services/payment-service.d.ts.map +1 -0
  98. package/dist/payment.cjs +258 -0
  99. package/dist/payment.cjs.map +1 -0
  100. package/dist/payment.d.ts +36 -0
  101. package/dist/payment.js +254 -0
  102. package/dist/payment.js.map +1 -0
  103. package/dist/pers-sdk.d.ts +29 -0
  104. package/dist/pers-sdk.d.ts.map +1 -0
  105. package/dist/redemption/api/redemption-api.d.ts +147 -0
  106. package/dist/redemption/api/redemption-api.d.ts.map +1 -0
  107. package/dist/redemption/index.d.ts +35 -0
  108. package/dist/redemption/index.d.ts.map +1 -0
  109. package/dist/redemption/models/index.d.ts +8 -0
  110. package/dist/redemption/models/index.d.ts.map +1 -0
  111. package/dist/redemption/services/redemption-service.d.ts +56 -0
  112. package/dist/redemption/services/redemption-service.d.ts.map +1 -0
  113. package/dist/redemption.cjs +333 -0
  114. package/dist/redemption.cjs.map +1 -0
  115. package/dist/redemption.d.ts +35 -0
  116. package/dist/redemption.js +329 -0
  117. package/dist/redemption.js.map +1 -0
  118. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +18 -0
  119. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -0
  120. package/dist/tenant/api/tenant-api.d.ts +56 -0
  121. package/dist/tenant/api/tenant-api.d.ts.map +1 -0
  122. package/dist/tenant/index.d.ts +34 -0
  123. package/dist/tenant/index.d.ts.map +1 -0
  124. package/dist/tenant/models/index.d.ts +11 -0
  125. package/dist/tenant/models/index.d.ts.map +1 -0
  126. package/dist/tenant/services/tenant-service.d.ts +46 -0
  127. package/dist/tenant/services/tenant-service.d.ts.map +1 -0
  128. package/dist/tenant.cjs +177 -0
  129. package/dist/tenant.cjs.map +1 -0
  130. package/dist/tenant.d.ts +34 -0
  131. package/dist/tenant.js +173 -0
  132. package/dist/tenant.js.map +1 -0
  133. package/dist/token/api/token-api.d.ts +64 -0
  134. package/dist/token/api/token-api.d.ts.map +1 -0
  135. package/dist/token/base/base-token-service.d.ts +87 -0
  136. package/dist/token/base/base-token-service.d.ts.map +1 -0
  137. package/dist/token/index.d.ts +13 -0
  138. package/dist/token/index.d.ts.map +1 -0
  139. package/dist/token/models/index.d.ts +18 -0
  140. package/dist/token/models/index.d.ts.map +1 -0
  141. package/dist/token/services/token-service.d.ts +68 -0
  142. package/dist/token/services/token-service.d.ts.map +1 -0
  143. package/dist/token/token-sdk.d.ts +140 -0
  144. package/dist/token/token-sdk.d.ts.map +1 -0
  145. package/dist/token.cjs +537 -0
  146. package/dist/token.cjs.map +1 -0
  147. package/dist/token.d.ts +13 -0
  148. package/dist/token.js +532 -0
  149. package/dist/token.js.map +1 -0
  150. package/dist/transaction/api/transaction-api.d.ts +133 -0
  151. package/dist/transaction/api/transaction-api.d.ts.map +1 -0
  152. package/dist/transaction/index.d.ts +38 -0
  153. package/dist/transaction/index.d.ts.map +1 -0
  154. package/dist/transaction/models/index.d.ts +42 -0
  155. package/dist/transaction/models/index.d.ts.map +1 -0
  156. package/dist/transaction/services/transaction-service.d.ts +56 -0
  157. package/dist/transaction/services/transaction-service.d.ts.map +1 -0
  158. package/dist/transaction.cjs +394 -0
  159. package/dist/transaction.cjs.map +1 -0
  160. package/dist/transaction.d.ts +38 -0
  161. package/dist/transaction.js +390 -0
  162. package/dist/transaction.js.map +1 -0
  163. package/dist/user/api/user-api.d.ts +56 -0
  164. package/dist/user/api/user-api.d.ts.map +1 -0
  165. package/dist/user/index.d.ts +36 -0
  166. package/dist/user/index.d.ts.map +1 -0
  167. package/{src/user/models/index.ts → dist/user/models/index.d.ts} +12 -10
  168. package/dist/user/models/index.d.ts.map +1 -0
  169. package/dist/user/services/user-service.d.ts +46 -0
  170. package/dist/user/services/user-service.d.ts.map +1 -0
  171. package/dist/user-status/api/user-status-api.d.ts +37 -0
  172. package/dist/user-status/api/user-status-api.d.ts.map +1 -0
  173. package/dist/user-status/index.d.ts +28 -0
  174. package/dist/user-status/index.d.ts.map +1 -0
  175. package/{src/user-status/models/index.ts → dist/user-status/models/index.d.ts} +8 -11
  176. package/dist/user-status/models/index.d.ts.map +1 -0
  177. package/dist/user-status/services/user-status-service.d.ts +26 -0
  178. package/dist/user-status/services/user-status-service.d.ts.map +1 -0
  179. package/dist/user-status.cjs +147 -0
  180. package/dist/user-status.cjs.map +1 -0
  181. package/dist/user-status.d.ts +28 -0
  182. package/dist/user-status.js +143 -0
  183. package/dist/user-status.js.map +1 -0
  184. package/dist/user.cjs +188 -0
  185. package/dist/user.cjs.map +1 -0
  186. package/dist/user.d.ts +36 -0
  187. package/dist/user.js +184 -0
  188. package/dist/user.js.map +1 -0
  189. package/dist/web3/api/web3-api.d.ts +27 -0
  190. package/dist/web3/api/web3-api.d.ts.map +1 -0
  191. package/dist/web3/index.d.ts +16 -0
  192. package/dist/web3/index.d.ts.map +1 -0
  193. package/dist/web3/models/index.d.ts +92 -0
  194. package/dist/web3/models/index.d.ts.map +1 -0
  195. package/dist/web3/services/web3-service.d.ts +21 -0
  196. package/dist/web3/services/web3-service.d.ts.map +1 -0
  197. package/dist/web3-chain/api/web3-chain-api.d.ts +19 -0
  198. package/dist/web3-chain/api/web3-chain-api.d.ts.map +1 -0
  199. package/dist/web3-chain/index.d.ts +17 -0
  200. package/dist/web3-chain/index.d.ts.map +1 -0
  201. package/{src/web3-chain/models/index.ts → dist/web3-chain/models/index.d.ts} +38 -45
  202. package/dist/web3-chain/models/index.d.ts.map +1 -0
  203. package/dist/web3-chain/services/getWeb3FCD.service.d.ts +8 -0
  204. package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -0
  205. package/dist/web3-chain/services/provider.service.d.ts +15 -0
  206. package/dist/web3-chain/services/provider.service.d.ts.map +1 -0
  207. package/dist/web3-chain/services/public-http-provider.service.d.ts +8 -0
  208. package/dist/web3-chain/services/public-http-provider.service.d.ts.map +1 -0
  209. package/dist/web3-chain/services/web3-chain-service.d.ts +17 -0
  210. package/dist/web3-chain/services/web3-chain-service.d.ts.map +1 -0
  211. package/dist/web3-chain.cjs +316 -0
  212. package/dist/web3-chain.cjs.map +1 -0
  213. package/dist/web3-chain.d.ts +17 -0
  214. package/dist/web3-chain.js +310 -0
  215. package/dist/web3-chain.js.map +1 -0
  216. package/dist/web3.cjs +516 -0
  217. package/dist/web3.cjs.map +1 -0
  218. package/dist/web3.d.ts +16 -0
  219. package/dist/web3.js +513 -0
  220. package/dist/web3.js.map +1 -0
  221. package/package.json +70 -67
  222. package/config/domains.js +0 -22
  223. package/explorins-pers-sdk-1.0.0-alpha.1.tgz +0 -0
  224. package/rollup.config.js +0 -74
  225. package/scripts/copy-declarations.js +0 -147
  226. package/src/analytics/api/analytics-api.ts +0 -24
  227. package/src/analytics/models/index.ts +0 -74
  228. package/src/analytics/services/analytics-service.ts +0 -28
  229. package/src/auth-admin/api/auth-admin-api.ts +0 -42
  230. package/src/auth-admin/index.ts +0 -47
  231. package/src/auth-admin/services/auth-admin-service.ts +0 -36
  232. package/src/business/api/business-api.ts +0 -234
  233. package/src/business/index.ts +0 -53
  234. package/src/business/models/index.ts +0 -13
  235. package/src/business/services/business-service.ts +0 -88
  236. package/src/campaign/api/campaign-api.ts +0 -376
  237. package/src/campaign/index.ts +0 -67
  238. package/src/campaign/services/campaign-service.ts +0 -164
  239. package/src/core/abstractions/http-client.ts +0 -24
  240. package/src/core/auth/auth-provider.interface.ts +0 -16
  241. package/src/core/auth/create-auth-provider.ts +0 -136
  242. package/src/core/auth/simple-auth-config.interface.ts +0 -15
  243. package/src/core/index.ts +0 -33
  244. package/src/core/pers-api-client.ts +0 -343
  245. package/src/core/pers-config.ts +0 -65
  246. package/src/core/utils/jwt.function.ts +0 -24
  247. package/src/donation/api/donation-api.ts +0 -24
  248. package/src/donation/index.ts +0 -47
  249. package/src/donation/services/donation-service.ts +0 -25
  250. package/src/index.ts +0 -55
  251. package/src/payment/api/payment-api.ts +0 -185
  252. package/src/payment/index.ts +0 -64
  253. package/src/payment/models/index.ts +0 -29
  254. package/src/payment/services/payment-service.ts +0 -70
  255. package/src/pers-sdk.ts +0 -45
  256. package/src/redemption/api/redemption-api.ts +0 -241
  257. package/src/redemption/index.ts +0 -60
  258. package/src/redemption/models/index.ts +0 -17
  259. package/src/redemption/services/redemption-service.ts +0 -103
  260. package/src/shared/interfaces/pers-shared-lib.interfaces.ts +0 -99
  261. package/src/tenant/api/tenant-api.ts +0 -92
  262. package/src/tenant/index.ts +0 -61
  263. package/src/tenant/models/index.ts +0 -20
  264. package/src/tenant/services/tenant-service.ts +0 -78
  265. package/src/token/api/token-api.ts +0 -129
  266. package/src/token/base/base-token-service.ts +0 -167
  267. package/src/token/index.ts +0 -38
  268. package/src/token/models/index.ts +0 -30
  269. package/src/token/services/token-service.ts +0 -125
  270. package/src/token/token-sdk.ts +0 -231
  271. package/src/transaction/api/transaction-api.ts +0 -296
  272. package/src/transaction/index.ts +0 -65
  273. package/src/transaction/models/index.ts +0 -60
  274. package/src/transaction/services/transaction-service.ts +0 -104
  275. package/src/user/api/user-api.ts +0 -98
  276. package/src/user/index.ts +0 -62
  277. package/src/user/services/user-service.ts +0 -75
  278. package/src/user-status/api/user-status-api.ts +0 -78
  279. package/src/user-status/index.ts +0 -55
  280. package/src/user-status/services/user-status-service.ts +0 -51
  281. package/src/web3/api/web3-api.ts +0 -68
  282. package/src/web3/index.ts +0 -38
  283. package/src/web3/models/index.ts +0 -150
  284. package/src/web3/services/web3-service.ts +0 -338
  285. package/src/web3-chain/api/web3-chain-api.ts +0 -42
  286. package/src/web3-chain/index.ts +0 -27
  287. package/src/web3-chain/services/getWeb3FCD.service.ts +0 -47
  288. package/src/web3-chain/services/provider.service.ts +0 -123
  289. package/src/web3-chain/services/public-http-provider.service.ts +0 -26
  290. package/src/web3-chain/services/web3-chain-service.ts +0 -131
  291. package/tsconfig.json +0 -28
@@ -1,104 +0,0 @@
1
- import { TransactionDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
2
- import { TransactionApi } from '../api/transaction-api';
3
- import {
4
- TransactionRequestDTO,
5
- ClientTransactionRequestDTO,
6
- ClientTransactionRequestResponseDto,
7
- TransactionPaginationParams,
8
- TransactionPaginationResponse,
9
- UserBurnTokenRequestDTO
10
- } from '../models';
11
-
12
- /**
13
- * Platform-Agnostic Transaction Service
14
- *
15
- * Contains transaction business logic and operations that work across platforms.
16
- * No framework dependencies - pure TypeScript business logic.
17
- *
18
- * Focuses only on actual backend capabilities.
19
- */
20
- export class TransactionService {
21
- constructor(private transactionApi: TransactionApi) {}
22
-
23
- /**
24
- * Get transaction by ID
25
- */
26
- async getTransactionById(transactionId: string): Promise<TransactionDTO> {
27
- return this.transactionApi.getTransactionById(transactionId);
28
- }
29
-
30
- // ==========================================
31
- // AUTHENTICATED OPERATIONS
32
- // ==========================================
33
-
34
- /**
35
- * AUTH: Create authenticated transaction
36
- */
37
- async createAuthTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
38
- return this.transactionApi.createAuthTransaction(request);
39
- }
40
-
41
- /**
42
- * AUTH: Get user transaction history by type
43
- */
44
- async getUserTransactionHistory(type: string): Promise<TransactionDTO[]> {
45
- return this.transactionApi.getUserTransactionHistory(type);
46
- }
47
-
48
- /**
49
- * AUTH: Prepare client signed transaction
50
- */
51
- async prepareClientSignedTransaction(request: ClientTransactionRequestDTO): Promise<ClientTransactionRequestResponseDto> {
52
- return this.transactionApi.prepareClientSignedTransaction(request);
53
- }
54
-
55
- /**
56
- * AUTH: Burn user tokens
57
- */
58
- async burnUserTokens(request: UserBurnTokenRequestDTO): Promise<TransactionDTO> {
59
- return this.transactionApi.burnUserTokens(request);
60
- }
61
-
62
- // ==========================================
63
- // BUSINESS OPERATIONS
64
- // ==========================================
65
-
66
- /**
67
- * BUSINESS: Create business transaction
68
- */
69
- async createBusinessTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
70
- return this.transactionApi.createBusinessTransaction(request);
71
- }
72
-
73
- // ==========================================
74
- // ADMIN OPERATIONS
75
- // ==========================================
76
-
77
- /**
78
- * ADMIN: Create admin transaction
79
- */
80
- async createAdminTransaction(request: TransactionRequestDTO): Promise<TransactionDTO> {
81
- return this.transactionApi.createAdminTransaction(request);
82
- }
83
-
84
- /**
85
- * ADMIN: Get all tenant transactions
86
- */
87
- async getTenantTransactions(): Promise<TransactionDTO[]> {
88
- return this.transactionApi.getTenantTransactions();
89
- }
90
-
91
- /**
92
- * ADMIN: Get paginated transactions with filtering and sorting
93
- */
94
- async getPaginatedTransactions(params: TransactionPaginationParams): Promise<TransactionPaginationResponse> {
95
- return this.transactionApi.getPaginatedTransactions(params);
96
- }
97
-
98
- /**
99
- * ADMIN: Export transactions to CSV
100
- */
101
- async exportTransactionsCSV(): Promise<Blob> {
102
- return this.transactionApi.exportTransactionsCSV();
103
- }
104
- }
@@ -1,98 +0,0 @@
1
- import { UserDTO, UserCreateRequestDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
2
- import { PersApiClient } from '../../core/pers-api-client';
3
- import { UserPublicProfileDTO } from '../models';
4
-
5
- /**
6
- * Platform-Agnostic User API Client
7
- *
8
- * Handles user operations using the PERS backend RESTful API.
9
- * Updated to use new /users endpoints with enhanced security and consistency.
10
- * Maintains framework UserApiService method compatibility.
11
- */
12
- export class UserApi {
13
- constructor(private apiClient: PersApiClient) {}
14
-
15
- private readonly basePath = '/users';
16
-
17
- // ==========================================
18
- // PUBLIC OPERATIONS
19
- // ==========================================
20
-
21
- /**
22
- * PUBLIC: Get all users public profiles with optional filtering
23
- * ✅ UPDATED: Uses new RESTful /users/public endpoint
24
- */
25
- async getAllUsersPublicProfiles(filter: {key: string, value: string} | null = null): Promise<UserPublicProfileDTO[]> {
26
- let url = `${this.basePath}/public`;
27
-
28
- if (filter) {
29
- // ✅ MAINTAINED: Same parameter pattern for compatibility
30
- const params = new URLSearchParams();
31
- params.set('filterKey', filter.key);
32
- params.set('filterValue', filter.value);
33
- url += `?${params.toString()}`;
34
- }
35
-
36
- return this.apiClient.get<UserPublicProfileDTO[]>(url);
37
- }
38
-
39
- // ==========================================
40
- // AUTHENTICATED OPERATIONS
41
- // ==========================================
42
-
43
- /**
44
- * AUTH: Get current authenticated user
45
- * ✅ UPDATED: Uses new RESTful /users/me endpoint
46
- */
47
- async getRemoteUser(): Promise<UserDTO> {
48
- return this.apiClient.get<UserDTO>(`${this.basePath}/me`);
49
- }
50
-
51
- /**
52
- * AUTH: Update current authenticated user
53
- * ✅ UPDATED: Uses new RESTful /users/me endpoint
54
- */
55
- async updateRemoteUser(updateRequest: UserCreateRequestDTO): Promise<UserDTO> {
56
- return this.apiClient.put<UserDTO>(`${this.basePath}/me`, updateRequest);
57
- }
58
-
59
- // ==========================================
60
- // ADMIN OPERATIONS
61
- // ==========================================
62
-
63
- /**
64
- * ADMIN: Get all remote users with query parameters
65
- * ✅ UPDATED: Uses new RESTful /users endpoint with role-based access
66
- * Note: Admin users get full data, non-admin users get public profiles only
67
- */
68
- async getAllRemoteUsers(): Promise<UserDTO[]> {
69
- // ✅ MAINTAINED: Same merge=soft parameter for compatibility
70
- const url = `${this.basePath}?merge=soft`;
71
- return this.apiClient.get<UserDTO[]>(url);
72
- }
73
-
74
- /**
75
- * ADMIN: Update user as admin
76
- * ✅ UPDATED: Uses new RESTful /users/{id} endpoint
77
- */
78
- async updateUserAsAdmin(id: string, userData: UserCreateRequestDTO): Promise<UserDTO> {
79
- return this.apiClient.put<UserDTO>(`${this.basePath}/${id}`, userData);
80
- }
81
-
82
- /**
83
- * ADMIN: Toggle user active status
84
- * ✅ UPDATED: Uses new consistent /users/{id}/status endpoint
85
- * Enhanced: Follows RESTful status management pattern across all domains
86
- */
87
- async toggleUserActiveStatusByUser(user: UserDTO): Promise<UserDTO> {
88
- return this.apiClient.put<UserDTO>(`${this.basePath}/${user.id}/status`, {});
89
- }
90
-
91
- /**
92
- * ADMIN: Get user by unique identifier
93
- * ✅ UPDATED: Uses new RESTful /users/{id} endpoint
94
- */
95
- async getUserByUniqueIdentifier(id: string): Promise<UserDTO> {
96
- return this.apiClient.get<UserDTO>(`${this.basePath}/${id}`);
97
- }
98
- }
package/src/user/index.ts DELETED
@@ -1,62 +0,0 @@
1
- /**
2
- * @explorins/pers-sdk-user
3
- *
4
- * Platform-agnostic User Domain SDK for PERS ecosystem
5
- * Handles user management, profiles, and authentication operations
6
- */
7
-
8
- // API Layer
9
- export { UserApi } from './api/user-api';
10
-
11
- // Service Layer
12
- export { UserService } from './services/user-service';
13
-
14
- // Models & Types
15
- export * from './models';
16
- export * from '../shared/interfaces/pers-shared-lib.interfaces';
17
-
18
- // Factory function for creating user SDK instance
19
- import { PersApiClient } from '../core/pers-api-client';
20
- import { UserApi } from './api/user-api';
21
- import { UserService } from './services/user-service';
22
- import { UserDTO, UserCreateRequestDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
23
-
24
- /**
25
- * Create a complete User SDK instance
26
- *
27
- * @param apiClient - Configured PERS API client
28
- * @returns User SDK with flattened structure for better DX
29
- */
30
- export function createUserSDK(apiClient: PersApiClient) {
31
- const userApi = new UserApi(apiClient);
32
- const userService = new UserService(userApi);
33
-
34
- return {
35
- // Direct access to service methods (primary interface)
36
-
37
- // Public methods - matches framework exactly
38
- getAllUsersPublicProfiles: (filter: {key: string, value: string} | null = null) =>
39
- userService.getAllUsersPublicProfiles(filter),
40
-
41
- // Auth methods - matches framework exactly
42
- getRemoteUser: () => userService.getRemoteUser(),
43
- updateRemoteUser: (updateRequest: UserCreateRequestDTO) =>
44
- userService.updateRemoteUser(updateRequest),
45
-
46
- // Admin methods - matches framework exactly
47
- getAllRemoteUsers: () => userService.getAllRemoteUsers(),
48
- updateUserAsAdmin: (id: string, userData: UserCreateRequestDTO) =>
49
- userService.updateUserAsAdmin(id, userData),
50
- toggleUserActiveStatusByUser: (user: UserDTO) =>
51
- userService.toggleUserActiveStatusByUser(user),
52
-
53
- getUserByUniqueIdentifier: (id: string) =>
54
- userService.getUserByUniqueIdentifier(id),
55
-
56
- // Advanced access for edge cases
57
- api: userApi,
58
- service: userService
59
- };
60
- }
61
-
62
- export type UserSDK = ReturnType<typeof createUserSDK>;
@@ -1,75 +0,0 @@
1
- import { UserDTO, UserCreateRequestDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
2
- import { UserApi } from '../api/user-api';
3
- import { UserPublicProfileDTO } from '../models';
4
-
5
- /**
6
- * Platform-Agnostic User Service
7
- *
8
- * Contains user business logic and operations that work across platforms.
9
- * No framework dependencies - pure TypeScript business logic.
10
- * Matches framework UserApiService capabilities exactly.
11
- */
12
- export class UserService {
13
- constructor(private userApi: UserApi) {}
14
-
15
- // ==========================================
16
- // PUBLIC OPERATIONS
17
- // ==========================================
18
-
19
- /**
20
- * PUBLIC: Get all users public profiles with optional filtering
21
- * ✅ FIXED: Uses framework-compatible inline filter type
22
- */
23
- async getAllUsersPublicProfiles(filter: {key: string, value: string} | null = null): Promise<UserPublicProfileDTO[]> {
24
- return this.userApi.getAllUsersPublicProfiles(filter);
25
- }
26
-
27
- // ==========================================
28
- // AUTHENTICATED OPERATIONS
29
- // ==========================================
30
-
31
- /**
32
- * AUTH: Get current authenticated user
33
- */
34
- async getRemoteUser(): Promise<UserDTO> {
35
- return this.userApi.getRemoteUser();
36
- }
37
-
38
- /**
39
- * AUTH: Update current authenticated user
40
- */
41
- async updateRemoteUser(updateRequest: UserCreateRequestDTO): Promise<UserDTO> {
42
- return this.userApi.updateRemoteUser(updateRequest);
43
- }
44
-
45
- // ==========================================
46
- // ADMIN OPERATIONS
47
- // ==========================================
48
-
49
- /**
50
- * ADMIN: Get all remote users
51
- * ✅ FIXED: Matches API method signature (no parameters needed)
52
- */
53
- async getAllRemoteUsers(): Promise<UserDTO[]> {
54
- return this.userApi.getAllRemoteUsers();
55
- }
56
-
57
- /**
58
- * ADMIN: Update user as admin
59
- */
60
- async updateUserAsAdmin(id: string, userData: UserCreateRequestDTO): Promise<UserDTO> {
61
- return this.userApi.updateUserAsAdmin(id, userData);
62
- }
63
-
64
- async getUserByUniqueIdentifier(id: string): Promise<UserDTO> {
65
- return this.userApi.getUserByUniqueIdentifier(id);
66
- }
67
-
68
- /**
69
- * ADMIN: Toggle user active status by user object
70
- * ✅ FIXED: Matches API method signature exactly
71
- */
72
- async toggleUserActiveStatusByUser(user: UserDTO): Promise<UserDTO> {
73
- return this.userApi.toggleUserActiveStatusByUser(user);
74
- }
75
- }
@@ -1,78 +0,0 @@
1
- import { PersApiClient } from '../../core/pers-api-client';
2
- import { UserStatusTypeDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
3
-
4
- /**
5
- * Platform-Agnostic User Status API Client
6
- *
7
- * Handles user status operations using the PERS backend.
8
- * Matches framework UserStatusApiService methods exactly.
9
- *
10
- * ✅ UPDATED: All endpoints updated to new RESTful /users patterns
11
- *
12
- * Error handling patterns follow framework implementation:
13
- * - getRemoteEarnedUserStatus() uses silent fallback (empty array)
14
- * - Other operations throw errors for proper error handling
15
- */
16
- export class UserStatusApi {
17
- constructor(private apiClient: PersApiClient) {}
18
-
19
- private readonly basePath = '/users';
20
-
21
- // ==========================================
22
- // PUBLIC OPERATIONS
23
- // ==========================================
24
-
25
- /**
26
- * PUBLIC: Get remote user status types
27
- * ✅ UPDATED: /user/status-type → /users/status-types
28
- */
29
- async getRemoteUserStatusTypes(): Promise<UserStatusTypeDTO[]> {
30
- try {
31
- return await this.apiClient.get<UserStatusTypeDTO[]>(`${this.basePath}/status-types`);
32
- } catch (error) {
33
- console.error('Error getting user status types', error);
34
- throw error;
35
- }
36
- }
37
-
38
- // ==========================================
39
- // AUTHENTICATED OPERATIONS
40
- // ==========================================
41
-
42
- /**
43
- * AUTH: Get earned user status for authenticated user
44
- * ✅ UPDATED: /user/auth/status → /users/me/status
45
- * ✅ FIXED: Returns UserStatusTypeDTO[] to match framework exactly
46
- * Note: Uses silent fallback pattern from framework - returns empty array on error
47
- */
48
- async getRemoteEarnedUserStatus(): Promise<UserStatusTypeDTO[]> {
49
- try {
50
- return await this.apiClient.get<UserStatusTypeDTO[]>(`${this.basePath}/me/status`);
51
- } catch (error) {
52
- console.error('Error getting user status', error);
53
- // ✅ FIXED: Silent fallback pattern from framework implementation
54
- return [];
55
- }
56
- }
57
-
58
- // ==========================================
59
- // ADMIN OPERATIONS
60
- // ==========================================
61
-
62
- /**
63
- * ADMIN: Create user status type
64
- * ✅ UPDATED: /user/admin/status-type → /users/status-types
65
- */
66
- async createUserStatusType(userStatusType: UserStatusTypeDTO): Promise<UserStatusTypeDTO> {
67
- try {
68
- return await this.apiClient.post<UserStatusTypeDTO>(`${this.basePath}/status-types`, userStatusType);
69
- } catch (error) {
70
- console.error('Error creating user status type', error);
71
- throw error;
72
- }
73
- }
74
-
75
- // ❌ REMOVED: Methods not present in framework
76
- // - updateUserStatusType() - Framework doesn't have this operation
77
- // - toggleUserStatusTypeActive() - Framework doesn't have this operation
78
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * @explorins/pers-sdk-user-status
3
- *
4
- * Platform-agnostic User Status Domain SDK for PERS ecosystem
5
- * Handles user status management and type operations
6
- */
7
-
8
- // API Layer
9
- export { UserStatusApi } from './api/user-status-api';
10
-
11
- // Service Layer
12
- export { UserStatusService } from './services/user-status-service';
13
-
14
- // Models & Types - re-export all centralized interfaces
15
- export * from '../shared/interfaces/pers-shared-lib.interfaces';
16
-
17
- // Models & Types - imported from centralized interfaces
18
-
19
- // Factory function for creating user-status SDK instance
20
- import { PersApiClient } from '../core/pers-api-client';
21
- import { UserStatusApi } from './api/user-status-api';
22
- import { UserStatusService } from './services/user-status-service';
23
- import { UserStatusTypeDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
24
-
25
- /**
26
- * Create a complete User Status SDK instance
27
- *
28
- * @param apiClient - Configured PERS API client
29
- * @returns User Status SDK with flattened structure for better DX
30
- */
31
- export function createUserStatusSDK(apiClient: PersApiClient) {
32
- const userStatusApi = new UserStatusApi(apiClient);
33
- const userStatusService = new UserStatusService(userStatusApi);
34
-
35
- return {
36
- // Direct access to service methods (primary interface)
37
- // ✅ FRAMEWORK ALIGNED: Only methods actually used by framework
38
-
39
- // Public methods
40
- getRemoteUserStatusTypes: () => userStatusService.getRemoteUserStatusTypes(),
41
-
42
- // Auth methods
43
- getRemoteEarnedUserStatus: () => userStatusService.getRemoteEarnedUserStatus(),
44
-
45
- // Admin methods
46
- createUserStatusType: (userStatusType: UserStatusTypeDTO) =>
47
- userStatusService.createUserStatusType(userStatusType),
48
-
49
- // Advanced access for edge cases
50
- api: userStatusApi,
51
- service: userStatusService
52
- };
53
- }
54
-
55
- export type UserStatusSDK = ReturnType<typeof createUserStatusSDK>;
@@ -1,51 +0,0 @@
1
- import { UserStatusApi } from '../api/user-status-api';
2
- import { UserStatusTypeDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
3
-
4
- /**
5
- * Platform-Agnostic User Status Service
6
- *
7
- * Contains user status business logic and operations that work across platforms.
8
- * No framework dependencies - pure TypeScript business logic.
9
- * Matches framework UserStatusApiService capabilities exactly.
10
- */
11
- export class UserStatusService {
12
- constructor(private userStatusApi: UserStatusApi) {}
13
-
14
- // ==========================================
15
- // PUBLIC OPERATIONS
16
- // ==========================================
17
-
18
- /**
19
- * PUBLIC: Get remote user status types
20
- */
21
- async getRemoteUserStatusTypes(): Promise<UserStatusTypeDTO[]> {
22
- return this.userStatusApi.getRemoteUserStatusTypes();
23
- }
24
-
25
- // ==========================================
26
- // AUTHENTICATED OPERATIONS
27
- // ==========================================
28
-
29
- /**
30
- * AUTH: Get earned user status for authenticated user
31
- */
32
- async getRemoteEarnedUserStatus(): Promise<UserStatusTypeDTO[]> {
33
- return this.userStatusApi.getRemoteEarnedUserStatus();
34
- }
35
-
36
- // ==========================================
37
- // ADMIN OPERATIONS
38
- // ==========================================
39
-
40
- /**
41
- * ADMIN: Create user status type
42
- */
43
- async createUserStatusType(userStatusType: UserStatusTypeDTO): Promise<UserStatusTypeDTO> {
44
- return this.userStatusApi.createUserStatusType(userStatusType);
45
- }
46
-
47
- // ❌ REMOVED: Business logic methods not present in framework
48
- // - hasUserReachedStatusLevel() - Framework doesn't need this logic
49
- // - getUserHighestStatusLevel() - Framework doesn't need this logic
50
- // These can be added later if actually needed
51
- }
@@ -1,68 +0,0 @@
1
- import { Web3ChainService } from '../../web3-chain/services/web3-chain-service';
2
- import type { ContractAbi } from 'web3';
3
- import {
4
- getAddressTokenBalanceByContract,
5
- getSmartContractInstance,
6
- getTokenOfOwnerByIndex,
7
- getTokenUri
8
- } from '@explorins/web3-ts';
9
-
10
-
11
- export class Web3Api {
12
-
13
- constructor(
14
- private web3ChainService: Web3ChainService,
15
- ) {}
16
-
17
- async getTokenBalance(request: {
18
- accountAddress: string;
19
- contractAddress: string;
20
- abi: ContractAbi;
21
- tokenId: string | null;
22
- chainId: number;
23
- }): Promise<number> {
24
- const web3 = await this.web3ChainService.getWeb3ByChainId(request.chainId);
25
-
26
- const tokenContract = getSmartContractInstance(request.contractAddress, request.abi, web3);
27
- const balance = await getAddressTokenBalanceByContract(
28
- tokenContract,
29
- request.accountAddress,
30
- request.tokenId
31
- );
32
-
33
- return Number(balance);
34
- }
35
-
36
- async getTokenUri(request: {
37
- contractAddress: string;
38
- abi: ContractAbi;
39
- tokenId: string;
40
- chainId: number;
41
- }): Promise<string> {
42
- const web3 = await this.web3ChainService.getWeb3ByChainId(request.chainId);
43
-
44
- // ✅ DIRECT: Use web3-ts functions directly
45
- const tokenContract = getSmartContractInstance(request.contractAddress, request.abi, web3);
46
- const tokenId = Number(request.tokenId);
47
- const tokenUri = await getTokenUri(tokenContract, tokenId);
48
-
49
- return String(tokenUri);
50
- }
51
-
52
-
53
- async getTokenOfOwnerByIndex(request: {
54
- contractAddress: string;
55
- abi: ContractAbi;
56
- accountAddress: string;
57
- tokenIndex: number;
58
- chainId: number;
59
- }): Promise<string> {
60
- const web3 = await this.web3ChainService.getWeb3ByChainId(request.chainId);
61
-
62
- // ✅ DIRECT: Use web3-ts functions directly
63
- const tokenContract = getSmartContractInstance(request.contractAddress, request.abi, web3);
64
- const tokenId = await getTokenOfOwnerByIndex(tokenContract, request.accountAddress, request.tokenIndex);
65
-
66
- return String(tokenId);
67
- }
68
- }
package/src/web3/index.ts DELETED
@@ -1,38 +0,0 @@
1
- import { PersApiClient } from '../core/pers-api-client';
2
- import { Web3Api } from './api/web3-api';
3
- import { Web3Service } from './services/web3-service';
4
- import { createWeb3ChainSDK } from '../web3-chain';
5
- import { ContractAbi, ERC1155CollectionRequest, ERC20BalanceRequest, ERC721CollectionRequest, ERC721CollectionResponse, Web3BalanceRequest, Web3BalanceResponse, Web3TokenListRequest, Web3TokenListResponse } from './models';
6
- import { Web3ProviderService } from '../web3-chain/services/provider.service';
7
-
8
- export function createWeb3SDK(
9
- apiClient: PersApiClient,
10
- web3ProviderService: Web3ProviderService,
11
- ) {
12
- const web3ChainSDK = createWeb3ChainSDK(apiClient, web3ProviderService);
13
-
14
- const web3Api = new Web3Api(
15
- web3ChainSDK.service,
16
- );
17
-
18
- const web3Service = new Web3Service(web3Api, web3ChainSDK.service);
19
-
20
- return {
21
-
22
- getCreditsBalance: (request: ERC20BalanceRequest): Promise<Web3BalanceResponse> =>
23
- web3Service.getERC20Balance(request),
24
-
25
- getRewardsCollection: (request: ERC1155CollectionRequest): Promise<Web3TokenListResponse> =>
26
- web3Service.getERC1155Collection(request),
27
-
28
- getStampsCollection: (request: ERC721CollectionRequest): Promise<ERC721CollectionResponse> =>
29
- web3Service.getERC721Collection(request),
30
-
31
- api: web3Api,
32
- service: web3Service
33
- };
34
- }
35
-
36
- export * from './models';
37
- export type { ERC20BalanceRequest, ERC1155CollectionRequest, ERC721CollectionRequest, ERC721CollectionResponse, NFTItem } from './models';
38
- export * from '../shared/interfaces/pers-shared-lib.interfaces';