@oxyhq/services 5.10.4 → 5.10.6

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 (142) hide show
  1. package/README.md +62 -14
  2. package/lib/commonjs/core/OxyServices.js +797 -5
  3. package/lib/commonjs/core/OxyServices.js.map +1 -1
  4. package/lib/commonjs/core/index.js +8 -83
  5. package/lib/commonjs/core/index.js.map +1 -1
  6. package/lib/commonjs/index.js +31 -1
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/ui/screens/FileManagementScreen.js +12 -12
  9. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  10. package/lib/commonjs/ui/screens/ProfileScreen.js +2 -2
  11. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  12. package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
  13. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  14. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
  15. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  16. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  17. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  18. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
  19. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  20. package/lib/commonjs/ui/stores/followStore.js +4 -4
  21. package/lib/commonjs/ui/stores/followStore.js.map +1 -1
  22. package/lib/commonjs/utils/s3FileManager.js +243 -0
  23. package/lib/commonjs/utils/s3FileManager.js.map +1 -0
  24. package/lib/commonjs/utils/s3FileManagerExample.js +407 -0
  25. package/lib/commonjs/utils/s3FileManagerExample.js.map +1 -0
  26. package/lib/commonjs/utils/s3FileManagerRN.js +274 -0
  27. package/lib/commonjs/utils/s3FileManagerRN.js.map +1 -0
  28. package/lib/module/core/OxyServices.js +796 -4
  29. package/lib/module/core/OxyServices.js.map +1 -1
  30. package/lib/module/core/index.js +9 -24
  31. package/lib/module/core/index.js.map +1 -1
  32. package/lib/module/index.js +4 -0
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/ui/screens/FileManagementScreen.js +12 -12
  35. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  36. package/lib/module/ui/screens/ProfileScreen.js +2 -2
  37. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  38. package/lib/module/ui/screens/SignInScreen.js +1 -1
  39. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  40. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
  41. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  42. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  43. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  44. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
  45. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  46. package/lib/module/ui/stores/followStore.js +4 -4
  47. package/lib/module/ui/stores/followStore.js.map +1 -1
  48. package/lib/module/utils/s3FileManager.js +237 -0
  49. package/lib/module/utils/s3FileManager.js.map +1 -0
  50. package/lib/module/utils/s3FileManagerExample.js +400 -0
  51. package/lib/module/utils/s3FileManagerExample.js.map +1 -0
  52. package/lib/module/utils/s3FileManagerRN.js +268 -0
  53. package/lib/module/utils/s3FileManagerRN.js.map +1 -0
  54. package/lib/typescript/core/OxyServices.d.ts +292 -3
  55. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  56. package/lib/typescript/core/index.d.ts +7 -16
  57. package/lib/typescript/core/index.d.ts.map +1 -1
  58. package/lib/typescript/index.d.ts +4 -0
  59. package/lib/typescript/index.d.ts.map +1 -1
  60. package/lib/typescript/utils/s3FileManager.d.ts +81 -0
  61. package/lib/typescript/utils/s3FileManager.d.ts.map +1 -0
  62. package/lib/typescript/utils/s3FileManagerExample.d.ts +87 -0
  63. package/lib/typescript/utils/s3FileManagerExample.d.ts.map +1 -0
  64. package/lib/typescript/utils/s3FileManagerRN.d.ts +104 -0
  65. package/lib/typescript/utils/s3FileManagerRN.d.ts.map +1 -0
  66. package/package.json +3 -1
  67. package/src/core/OxyServices.ts +881 -46
  68. package/src/core/index.ts +9 -24
  69. package/src/index.ts +17 -1
  70. package/src/ui/screens/FileManagementScreen.tsx +12 -12
  71. package/src/ui/screens/ProfileScreen.tsx +3 -3
  72. package/src/ui/screens/SignInScreen.tsx +1 -1
  73. package/src/ui/screens/karma/KarmaCenterScreen.tsx +2 -2
  74. package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
  75. package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
  76. package/src/ui/stores/followStore.ts +4 -4
  77. package/src/utils/s3FileManager.ts +281 -0
  78. package/src/utils/s3FileManagerExample.ts +432 -0
  79. package/src/utils/s3FileManagerRN.ts +322 -0
  80. package/lib/commonjs/core/OxyServicesMain.js +0 -51
  81. package/lib/commonjs/core/OxyServicesMain.js.map +0 -1
  82. package/lib/commonjs/core/analytics/AnalyticsService.js +0 -67
  83. package/lib/commonjs/core/analytics/AnalyticsService.js.map +0 -1
  84. package/lib/commonjs/core/auth/AuthService.js +0 -538
  85. package/lib/commonjs/core/auth/AuthService.js.map +0 -1
  86. package/lib/commonjs/core/devices/DeviceService.js +0 -61
  87. package/lib/commonjs/core/devices/DeviceService.js.map +0 -1
  88. package/lib/commonjs/core/files/FileService.js +0 -180
  89. package/lib/commonjs/core/files/FileService.js.map +0 -1
  90. package/lib/commonjs/core/karma/KarmaService.js +0 -100
  91. package/lib/commonjs/core/karma/KarmaService.js.map +0 -1
  92. package/lib/commonjs/core/locations/LocationService.js +0 -131
  93. package/lib/commonjs/core/locations/LocationService.js.map +0 -1
  94. package/lib/commonjs/core/payments/PaymentService.js +0 -124
  95. package/lib/commonjs/core/payments/PaymentService.js.map +0 -1
  96. package/lib/commonjs/core/users/UserService.js +0 -234
  97. package/lib/commonjs/core/users/UserService.js.map +0 -1
  98. package/lib/module/core/OxyServicesMain.js +0 -47
  99. package/lib/module/core/OxyServicesMain.js.map +0 -1
  100. package/lib/module/core/analytics/AnalyticsService.js +0 -62
  101. package/lib/module/core/analytics/AnalyticsService.js.map +0 -1
  102. package/lib/module/core/auth/AuthService.js +0 -533
  103. package/lib/module/core/auth/AuthService.js.map +0 -1
  104. package/lib/module/core/devices/DeviceService.js +0 -57
  105. package/lib/module/core/devices/DeviceService.js.map +0 -1
  106. package/lib/module/core/files/FileService.js +0 -175
  107. package/lib/module/core/files/FileService.js.map +0 -1
  108. package/lib/module/core/karma/KarmaService.js +0 -95
  109. package/lib/module/core/karma/KarmaService.js.map +0 -1
  110. package/lib/module/core/locations/LocationService.js +0 -127
  111. package/lib/module/core/locations/LocationService.js.map +0 -1
  112. package/lib/module/core/payments/PaymentService.js +0 -119
  113. package/lib/module/core/payments/PaymentService.js.map +0 -1
  114. package/lib/module/core/users/UserService.js +0 -230
  115. package/lib/module/core/users/UserService.js.map +0 -1
  116. package/lib/typescript/core/OxyServicesMain.d.ts +0 -33
  117. package/lib/typescript/core/OxyServicesMain.d.ts.map +0 -1
  118. package/lib/typescript/core/analytics/AnalyticsService.d.ts +0 -26
  119. package/lib/typescript/core/analytics/AnalyticsService.d.ts.map +0 -1
  120. package/lib/typescript/core/auth/AuthService.d.ts +0 -165
  121. package/lib/typescript/core/auth/AuthService.d.ts.map +0 -1
  122. package/lib/typescript/core/devices/DeviceService.d.ts +0 -20
  123. package/lib/typescript/core/devices/DeviceService.d.ts.map +0 -1
  124. package/lib/typescript/core/files/FileService.d.ts +0 -59
  125. package/lib/typescript/core/files/FileService.d.ts.map +0 -1
  126. package/lib/typescript/core/karma/KarmaService.d.ts +0 -50
  127. package/lib/typescript/core/karma/KarmaService.d.ts.map +0 -1
  128. package/lib/typescript/core/locations/LocationService.d.ts +0 -39
  129. package/lib/typescript/core/locations/LocationService.d.ts.map +0 -1
  130. package/lib/typescript/core/payments/PaymentService.d.ts +0 -50
  131. package/lib/typescript/core/payments/PaymentService.d.ts.map +0 -1
  132. package/lib/typescript/core/users/UserService.d.ts +0 -111
  133. package/lib/typescript/core/users/UserService.d.ts.map +0 -1
  134. package/src/core/OxyServicesMain.ts +0 -57
  135. package/src/core/analytics/AnalyticsService.ts +0 -64
  136. package/src/core/auth/AuthService.ts +0 -560
  137. package/src/core/devices/DeviceService.ts +0 -55
  138. package/src/core/files/FileService.ts +0 -198
  139. package/src/core/karma/KarmaService.ts +0 -104
  140. package/src/core/locations/LocationService.ts +0 -141
  141. package/src/core/payments/PaymentService.ts +0 -133
  142. package/src/core/users/UserService.ts +0 -241
@@ -1,50 +0,0 @@
1
- import { OxyServices } from '../OxyServices';
2
- import { Wallet, Transaction, TransferFundsRequest, PurchaseRequest, WithdrawalRequest, TransactionResponse, PaymentMethod, PaymentRequest, PaymentResponse } from '../../models/interfaces';
3
- /**
4
- * Payment service for handling payments, wallet operations, and transactions
5
- */
6
- export declare class PaymentService extends OxyServices {
7
- /**
8
- * Process payment
9
- */
10
- processPayment(data: PaymentRequest): Promise<PaymentResponse>;
11
- /**
12
- * Validate payment method
13
- */
14
- validatePaymentMethod(paymentMethod: any): Promise<{
15
- valid: boolean;
16
- }>;
17
- /**
18
- * Get payment methods for user
19
- */
20
- getPaymentMethods(userId: string): Promise<PaymentMethod[]>;
21
- /**
22
- * Get user wallet
23
- */
24
- getWallet(userId: string): Promise<Wallet>;
25
- /**
26
- * Get transaction history
27
- */
28
- getTransactionHistory(userId: string, limit?: number, offset?: number): Promise<{
29
- transactions: Transaction[];
30
- total: number;
31
- hasMore: boolean;
32
- }>;
33
- /**
34
- * Get specific transaction
35
- */
36
- getTransaction(transactionId: string): Promise<Transaction>;
37
- /**
38
- * Transfer funds between users
39
- */
40
- transferFunds(data: TransferFundsRequest): Promise<TransactionResponse>;
41
- /**
42
- * Process purchase
43
- */
44
- processPurchase(data: PurchaseRequest): Promise<TransactionResponse>;
45
- /**
46
- * Request withdrawal
47
- */
48
- requestWithdrawal(data: WithdrawalRequest): Promise<TransactionResponse>;
49
- }
50
- //# sourceMappingURL=PaymentService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PaymentService.d.ts","sourceRoot":"","sources":["../../../../src/core/payments/PaymentService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,MAAM,EACN,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;OAEG;IACG,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IASpE;;OAEG;IACG,qBAAqB,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAS5E;;OAEG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IASjE;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAShD;;OAEG;IACG,qBAAqB,CACzB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,YAAY,EAAE,WAAW,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAa5E;;OAEG;IACG,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IASjE;;OAEG;IACG,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAS7E;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAS1E;;OAEG;IACG,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAQ/E"}
@@ -1,111 +0,0 @@
1
- import { OxyServices } from '../OxyServices';
2
- import { User, Notification } from '../../models/interfaces';
3
- import { PaginationParams } from '../../utils/apiUtils';
4
- /**
5
- * User service for handling user operations, profiles, and social features
6
- */
7
- export declare class UserService extends OxyServices {
8
- /**
9
- * Get profile by username
10
- */
11
- getProfileByUsername(username: string): Promise<User>;
12
- /**
13
- * Search user profiles
14
- */
15
- searchProfiles(query: string, pagination?: PaginationParams): Promise<User[]>;
16
- /**
17
- * Get profile recommendations
18
- */
19
- getProfileRecommendations(): Promise<Array<{
20
- id: string;
21
- username: string;
22
- name?: {
23
- first?: string;
24
- last?: string;
25
- full?: string;
26
- };
27
- description?: string;
28
- _count?: {
29
- followers: number;
30
- following: number;
31
- };
32
- [key: string]: any;
33
- }>>;
34
- /**
35
- * Get user by ID
36
- */
37
- getUserById(userId: string): Promise<User>;
38
- /**
39
- * Get current user
40
- */
41
- getCurrentUser(): Promise<User>;
42
- /**
43
- * Update user profile
44
- */
45
- updateProfile(updates: Record<string, any>): Promise<User>;
46
- /**
47
- * Update user by ID (admin function)
48
- */
49
- updateUser(userId: string, updates: Record<string, any>): Promise<User>;
50
- /**
51
- * Follow a user
52
- */
53
- followUser(userId: string): Promise<{
54
- success: boolean;
55
- message: string;
56
- }>;
57
- /**
58
- * Unfollow a user
59
- */
60
- unfollowUser(userId: string): Promise<{
61
- success: boolean;
62
- message: string;
63
- }>;
64
- /**
65
- * Get follow status
66
- */
67
- getFollowStatus(userId: string): Promise<{
68
- isFollowing: boolean;
69
- }>;
70
- /**
71
- * Get user followers
72
- */
73
- getUserFollowers(userId: string, pagination?: PaginationParams): Promise<{
74
- followers: User[];
75
- total: number;
76
- hasMore: boolean;
77
- }>;
78
- /**
79
- * Get user following
80
- */
81
- getUserFollowing(userId: string, pagination?: PaginationParams): Promise<{
82
- following: User[];
83
- total: number;
84
- hasMore: boolean;
85
- }>;
86
- /**
87
- * Get notifications
88
- */
89
- getNotifications(): Promise<Notification[]>;
90
- /**
91
- * Get unread notification count
92
- */
93
- getUnreadCount(): Promise<number>;
94
- /**
95
- * Create notification
96
- */
97
- createNotification(data: Partial<Notification>): Promise<Notification>;
98
- /**
99
- * Mark notification as read
100
- */
101
- markNotificationAsRead(notificationId: string): Promise<void>;
102
- /**
103
- * Mark all notifications as read
104
- */
105
- markAllNotificationsAsRead(): Promise<void>;
106
- /**
107
- * Delete notification
108
- */
109
- deleteNotification(notificationId: string): Promise<void>;
110
- }
111
- //# sourceMappingURL=UserService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../../../src/core/users/UserService.ts"],"names":[],"mappings":"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"}
@@ -1,57 +0,0 @@
1
- import { OxyConfig } from '../models/interfaces';
2
- import { AuthService } from './auth/AuthService';
3
- import { UserService } from './users/UserService';
4
- import { PaymentService } from './payments/PaymentService';
5
- import { KarmaService } from './karma/KarmaService';
6
- import { FileService, OXY_CLOUD_URL } from './files/FileService';
7
- import { LocationService } from './locations/LocationService';
8
- import { AnalyticsService } from './analytics/AnalyticsService';
9
- import { DeviceService } from './devices/DeviceService';
10
-
11
- /**
12
- * Main OxyServices class that combines all individual services
13
- *
14
- * This class provides a unified interface to all Oxy API services while maintaining
15
- * backward compatibility with the original monolithic structure.
16
- */
17
- export class OxyServicesMain extends AuthService {
18
- // Service instances
19
- public readonly users: UserService;
20
- public readonly payments: PaymentService;
21
- public readonly karma: KarmaService;
22
- public readonly files: FileService;
23
- public readonly locations: LocationService;
24
- public readonly analytics: AnalyticsService;
25
- public readonly devices: DeviceService;
26
-
27
- constructor(config: OxyConfig) {
28
- super(config);
29
-
30
- // Initialize all service instances
31
- this.users = new UserService(config);
32
- this.payments = new PaymentService(config);
33
- this.karma = new KarmaService(config);
34
- this.files = new FileService(config);
35
- this.locations = new LocationService(config);
36
- this.analytics = new AnalyticsService(config);
37
- this.devices = new DeviceService(config);
38
- }
39
-
40
- // Re-export OXY_CLOUD_URL for convenience
41
- static readonly OXY_CLOUD_URL = OXY_CLOUD_URL;
42
-
43
- // Additional utility methods that span multiple services
44
- async fetchLinkMetadata(url: string): Promise<{
45
- url: string;
46
- title: string;
47
- description: string;
48
- image?: string;
49
- }> {
50
- try {
51
- const res = await this.getClient().get(`/api/link-metadata?url=${encodeURIComponent(url)}`);
52
- return res.data;
53
- } catch (error) {
54
- throw this.handleError(error);
55
- }
56
- }
57
- }
@@ -1,64 +0,0 @@
1
- import { OxyServices } from '../OxyServices';
2
- import { AnalyticsData, FollowerDetails, ContentViewer } from '../../models/interfaces';
3
-
4
- /**
5
- * Analytics service for handling analytics and content viewer operations
6
- */
7
- export class AnalyticsService extends OxyServices {
8
- /**
9
- * Get analytics data for user
10
- */
11
- async getAnalytics(userId: string, period?: string): Promise<AnalyticsData> {
12
- try {
13
- const params = new URLSearchParams();
14
- if (period) params.append('period', period);
15
-
16
- const res = await this.getClient().get(`/api/analytics/users/${userId}?${params.toString()}`);
17
- return res.data;
18
- } catch (error) {
19
- throw this.handleError(error);
20
- }
21
- }
22
-
23
- /**
24
- * Update analytics data
25
- */
26
- async updateAnalytics(userId: string, type: string, data: Record<string, any>): Promise<{ message: string }> {
27
- try {
28
- const res = await this.getClient().put(`/api/analytics/users/${userId}/${type}`, data);
29
- return res.data;
30
- } catch (error) {
31
- throw this.handleError(error);
32
- }
33
- }
34
-
35
- /**
36
- * Get content viewers for user
37
- */
38
- async getContentViewers(userId: string, period?: string): Promise<ContentViewer[]> {
39
- try {
40
- const params = new URLSearchParams();
41
- if (period) params.append('period', period);
42
-
43
- const res = await this.getClient().get(`/api/analytics/users/${userId}/viewers?${params.toString()}`);
44
- return res.data;
45
- } catch (error) {
46
- throw this.handleError(error);
47
- }
48
- }
49
-
50
- /**
51
- * Get follower details for user
52
- */
53
- async getFollowerDetails(userId: string, period?: string): Promise<FollowerDetails> {
54
- try {
55
- const params = new URLSearchParams();
56
- if (period) params.append('period', period);
57
-
58
- const res = await this.getClient().get(`/api/analytics/users/${userId}/followers?${params.toString()}`);
59
- return res.data;
60
- } catch (error) {
61
- throw this.handleError(error);
62
- }
63
- }
64
- }