@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.
- package/README.md +62 -14
- package/lib/commonjs/core/OxyServices.js +797 -5
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/index.js +8 -83
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +31 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +12 -12
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +2 -2
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/followStore.js +4 -4
- package/lib/commonjs/ui/stores/followStore.js.map +1 -1
- package/lib/commonjs/utils/s3FileManager.js +243 -0
- package/lib/commonjs/utils/s3FileManager.js.map +1 -0
- package/lib/commonjs/utils/s3FileManagerExample.js +407 -0
- package/lib/commonjs/utils/s3FileManagerExample.js.map +1 -0
- package/lib/commonjs/utils/s3FileManagerRN.js +274 -0
- package/lib/commonjs/utils/s3FileManagerRN.js.map +1 -0
- package/lib/module/core/OxyServices.js +796 -4
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/index.js +9 -24
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +12 -12
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +2 -2
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +1 -1
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/module/ui/stores/followStore.js +4 -4
- package/lib/module/ui/stores/followStore.js.map +1 -1
- package/lib/module/utils/s3FileManager.js +237 -0
- package/lib/module/utils/s3FileManager.js.map +1 -0
- package/lib/module/utils/s3FileManagerExample.js +400 -0
- package/lib/module/utils/s3FileManagerExample.js.map +1 -0
- package/lib/module/utils/s3FileManagerRN.js +268 -0
- package/lib/module/utils/s3FileManagerRN.js.map +1 -0
- package/lib/typescript/core/OxyServices.d.ts +292 -3
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/index.d.ts +7 -16
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/s3FileManager.d.ts +81 -0
- package/lib/typescript/utils/s3FileManager.d.ts.map +1 -0
- package/lib/typescript/utils/s3FileManagerExample.d.ts +87 -0
- package/lib/typescript/utils/s3FileManagerExample.d.ts.map +1 -0
- package/lib/typescript/utils/s3FileManagerRN.d.ts +104 -0
- package/lib/typescript/utils/s3FileManagerRN.d.ts.map +1 -0
- package/package.json +3 -1
- package/src/core/OxyServices.ts +881 -46
- package/src/core/index.ts +9 -24
- package/src/index.ts +17 -1
- package/src/ui/screens/FileManagementScreen.tsx +12 -12
- package/src/ui/screens/ProfileScreen.tsx +3 -3
- package/src/ui/screens/SignInScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +2 -2
- package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
- package/src/ui/stores/followStore.ts +4 -4
- package/src/utils/s3FileManager.ts +281 -0
- package/src/utils/s3FileManagerExample.ts +432 -0
- package/src/utils/s3FileManagerRN.ts +322 -0
- package/lib/commonjs/core/OxyServicesMain.js +0 -51
- package/lib/commonjs/core/OxyServicesMain.js.map +0 -1
- package/lib/commonjs/core/analytics/AnalyticsService.js +0 -67
- package/lib/commonjs/core/analytics/AnalyticsService.js.map +0 -1
- package/lib/commonjs/core/auth/AuthService.js +0 -538
- package/lib/commonjs/core/auth/AuthService.js.map +0 -1
- package/lib/commonjs/core/devices/DeviceService.js +0 -61
- package/lib/commonjs/core/devices/DeviceService.js.map +0 -1
- package/lib/commonjs/core/files/FileService.js +0 -180
- package/lib/commonjs/core/files/FileService.js.map +0 -1
- package/lib/commonjs/core/karma/KarmaService.js +0 -100
- package/lib/commonjs/core/karma/KarmaService.js.map +0 -1
- package/lib/commonjs/core/locations/LocationService.js +0 -131
- package/lib/commonjs/core/locations/LocationService.js.map +0 -1
- package/lib/commonjs/core/payments/PaymentService.js +0 -124
- package/lib/commonjs/core/payments/PaymentService.js.map +0 -1
- package/lib/commonjs/core/users/UserService.js +0 -234
- package/lib/commonjs/core/users/UserService.js.map +0 -1
- package/lib/module/core/OxyServicesMain.js +0 -47
- package/lib/module/core/OxyServicesMain.js.map +0 -1
- package/lib/module/core/analytics/AnalyticsService.js +0 -62
- package/lib/module/core/analytics/AnalyticsService.js.map +0 -1
- package/lib/module/core/auth/AuthService.js +0 -533
- package/lib/module/core/auth/AuthService.js.map +0 -1
- package/lib/module/core/devices/DeviceService.js +0 -57
- package/lib/module/core/devices/DeviceService.js.map +0 -1
- package/lib/module/core/files/FileService.js +0 -175
- package/lib/module/core/files/FileService.js.map +0 -1
- package/lib/module/core/karma/KarmaService.js +0 -95
- package/lib/module/core/karma/KarmaService.js.map +0 -1
- package/lib/module/core/locations/LocationService.js +0 -127
- package/lib/module/core/locations/LocationService.js.map +0 -1
- package/lib/module/core/payments/PaymentService.js +0 -119
- package/lib/module/core/payments/PaymentService.js.map +0 -1
- package/lib/module/core/users/UserService.js +0 -230
- package/lib/module/core/users/UserService.js.map +0 -1
- package/lib/typescript/core/OxyServicesMain.d.ts +0 -33
- package/lib/typescript/core/OxyServicesMain.d.ts.map +0 -1
- package/lib/typescript/core/analytics/AnalyticsService.d.ts +0 -26
- package/lib/typescript/core/analytics/AnalyticsService.d.ts.map +0 -1
- package/lib/typescript/core/auth/AuthService.d.ts +0 -165
- package/lib/typescript/core/auth/AuthService.d.ts.map +0 -1
- package/lib/typescript/core/devices/DeviceService.d.ts +0 -20
- package/lib/typescript/core/devices/DeviceService.d.ts.map +0 -1
- package/lib/typescript/core/files/FileService.d.ts +0 -59
- package/lib/typescript/core/files/FileService.d.ts.map +0 -1
- package/lib/typescript/core/karma/KarmaService.d.ts +0 -50
- package/lib/typescript/core/karma/KarmaService.d.ts.map +0 -1
- package/lib/typescript/core/locations/LocationService.d.ts +0 -39
- package/lib/typescript/core/locations/LocationService.d.ts.map +0 -1
- package/lib/typescript/core/payments/PaymentService.d.ts +0 -50
- package/lib/typescript/core/payments/PaymentService.d.ts.map +0 -1
- package/lib/typescript/core/users/UserService.d.ts +0 -111
- package/lib/typescript/core/users/UserService.d.ts.map +0 -1
- package/src/core/OxyServicesMain.ts +0 -57
- package/src/core/analytics/AnalyticsService.ts +0 -64
- package/src/core/auth/AuthService.ts +0 -560
- package/src/core/devices/DeviceService.ts +0 -55
- package/src/core/files/FileService.ts +0 -198
- package/src/core/karma/KarmaService.ts +0 -104
- package/src/core/locations/LocationService.ts +0 -141
- package/src/core/payments/PaymentService.ts +0 -133
- package/src/core/users/UserService.ts +0 -241
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.OXY_CLOUD_URL = exports.FileService = void 0;
|
|
7
|
-
var _OxyServices = require("../OxyServices");
|
|
8
|
-
/**
|
|
9
|
-
* Default cloud URL for Oxy services, cloud is where the user files are. (e.g. images, videos, etc.). Not the API.
|
|
10
|
-
*/
|
|
11
|
-
const OXY_CLOUD_URL = exports.OXY_CLOUD_URL = 'https://cloud.oxy.so';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* File service for handling file operations and management
|
|
15
|
-
*/
|
|
16
|
-
class FileService extends _OxyServices.OxyServices {
|
|
17
|
-
/**
|
|
18
|
-
* Upload a single file
|
|
19
|
-
* Note: This method is deprecated. Use the new raw upload approach instead.
|
|
20
|
-
*/
|
|
21
|
-
async uploadFile(file,
|
|
22
|
-
// Use 'any' to handle Buffer type in cross-platform scenarios
|
|
23
|
-
filename, metadata) {
|
|
24
|
-
try {
|
|
25
|
-
const formData = new FormData();
|
|
26
|
-
formData.append('file', file, filename);
|
|
27
|
-
if (metadata) {
|
|
28
|
-
formData.append('metadata', JSON.stringify(metadata));
|
|
29
|
-
}
|
|
30
|
-
const res = await this.getClient().post('/files/upload', formData, {
|
|
31
|
-
headers: {
|
|
32
|
-
'Content-Type': 'multipart/form-data'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return res.data;
|
|
36
|
-
} catch (error) {
|
|
37
|
-
throw this.handleError(error);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Upload multiple files
|
|
43
|
-
* Note: This method is deprecated. Use the new raw upload approach instead.
|
|
44
|
-
*/
|
|
45
|
-
async uploadFiles(files, filenames, metadata) {
|
|
46
|
-
try {
|
|
47
|
-
const formData = new FormData();
|
|
48
|
-
files.forEach((file, index) => {
|
|
49
|
-
formData.append('files', file, filenames[index]);
|
|
50
|
-
});
|
|
51
|
-
if (metadata) {
|
|
52
|
-
formData.append('metadata', JSON.stringify(metadata));
|
|
53
|
-
}
|
|
54
|
-
const res = await this.getClient().post('/files/upload-multiple', formData, {
|
|
55
|
-
headers: {
|
|
56
|
-
'Content-Type': 'multipart/form-data'
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return res.data;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
throw this.handleError(error);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Get file metadata
|
|
67
|
-
*/
|
|
68
|
-
async getFileMetadata(fileId) {
|
|
69
|
-
try {
|
|
70
|
-
const res = await this.getClient().get(`/api/files/meta/${fileId}`);
|
|
71
|
-
return res.data;
|
|
72
|
-
} catch (error) {
|
|
73
|
-
throw this.handleError(error);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Update file metadata
|
|
79
|
-
*/
|
|
80
|
-
async updateFileMetadata(fileId, updates) {
|
|
81
|
-
try {
|
|
82
|
-
const res = await this.getClient().put(`/api/files/meta/${fileId}`, updates);
|
|
83
|
-
return res.data;
|
|
84
|
-
} catch (error) {
|
|
85
|
-
throw this.handleError(error);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Delete file
|
|
91
|
-
*/
|
|
92
|
-
async deleteFile(fileId) {
|
|
93
|
-
try {
|
|
94
|
-
const res = await this.getClient().delete(`/api/files/${fileId}`);
|
|
95
|
-
return res.data;
|
|
96
|
-
} catch (error) {
|
|
97
|
-
throw this.handleError(error);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Get file download URL
|
|
103
|
-
*/
|
|
104
|
-
getFileDownloadUrl(fileId) {
|
|
105
|
-
return `${OXY_CLOUD_URL}/files/${fileId}/download`;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Get file stream URL
|
|
110
|
-
*/
|
|
111
|
-
getFileStreamUrl(fileId) {
|
|
112
|
-
return `${OXY_CLOUD_URL}/files/${fileId}/stream`;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* List user files
|
|
117
|
-
*/
|
|
118
|
-
async listUserFiles(userId, limit, offset, filters) {
|
|
119
|
-
try {
|
|
120
|
-
const params = new URLSearchParams();
|
|
121
|
-
if (limit) params.append('limit', limit.toString());
|
|
122
|
-
if (offset) params.append('offset', offset.toString());
|
|
123
|
-
if (filters) {
|
|
124
|
-
Object.entries(filters).forEach(([key, value]) => {
|
|
125
|
-
params.append(key, value.toString());
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
const res = await this.getClient().get(`/api/files/list/${userId}?${params.toString()}`);
|
|
129
|
-
return res.data;
|
|
130
|
-
} catch (error) {
|
|
131
|
-
throw this.handleError(error);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Download file content
|
|
137
|
-
*/
|
|
138
|
-
async downloadFileContent(fileId) {
|
|
139
|
-
try {
|
|
140
|
-
const res = await this.getClient().get(`/api/files/${fileId}`, {
|
|
141
|
-
responseType: 'blob'
|
|
142
|
-
});
|
|
143
|
-
return res.data;
|
|
144
|
-
} catch (error) {
|
|
145
|
-
throw this.handleError(error);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Get file content as text
|
|
151
|
-
*/
|
|
152
|
-
async getFileContentAsText(fileId) {
|
|
153
|
-
try {
|
|
154
|
-
const res = await this.getClient().get(`/api/files/${fileId}`, {
|
|
155
|
-
headers: {
|
|
156
|
-
'Accept': 'text/plain'
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return res.data;
|
|
160
|
-
} catch (error) {
|
|
161
|
-
throw this.handleError(error);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Get file content as blob
|
|
167
|
-
*/
|
|
168
|
-
async getFileContentAsBlob(fileId) {
|
|
169
|
-
try {
|
|
170
|
-
const res = await this.getClient().get(`/api/files/${fileId}`, {
|
|
171
|
-
responseType: 'blob'
|
|
172
|
-
});
|
|
173
|
-
return res.data;
|
|
174
|
-
} catch (error) {
|
|
175
|
-
throw this.handleError(error);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
exports.FileService = FileService;
|
|
180
|
-
//# sourceMappingURL=FileService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_OxyServices","require","OXY_CLOUD_URL","exports","FileService","OxyServices","uploadFile","file","filename","metadata","formData","FormData","append","JSON","stringify","res","getClient","post","headers","data","error","handleError","uploadFiles","files","filenames","forEach","index","getFileMetadata","fileId","get","updateFileMetadata","updates","put","deleteFile","delete","getFileDownloadUrl","getFileStreamUrl","listUserFiles","userId","limit","offset","filters","params","URLSearchParams","toString","Object","entries","key","value","downloadFileContent","responseType","getFileContentAsText","getFileContentAsBlob"],"sourceRoot":"../../../../src","sources":["core/files/FileService.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA;AACA;AACA;AACO,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,sBAAsB;;AAEnD;AACA;AACA;AACO,MAAME,WAAW,SAASC,wBAAW,CAAC;EAC3C;AACF;AACA;AACA;EACE,MAAMC,UAAUA,CACdC,IAAuB;EAAE;EACzBC,QAAgB,EAChBC,QAA8B,EACP;IACvB,IAAI;MACF,MAAMC,QAAQ,GAAG,IAAIC,QAAQ,CAAC,CAAC;MAC/BD,QAAQ,CAACE,MAAM,CAAC,MAAM,E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C,CAAC,CAACa,GAAG,CAAC,cAAcD,MAAM,EAAE,EAAE;QAC7DV,OAAO,EAAE;UACP,QAAQ,EAAE;QACZ;MACF,CAAC,CAAC;MACF,OAAOH,GAAG,CAACI,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAMgC,oBAAoBA,CAACxB,MAAc,EAAiB;IACxD,IAAI;MACF,MAAMb,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACa,GAAG,CAAC,cAAcD,MAAM,EAAE,EAAE;QAC7DsB,YAAY,EAAE;MAChB,CAAC,CAAC;MACF,OAAOnC,GAAG,CAACI,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;AACF;AAACjB,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.KarmaService = void 0;
|
|
7
|
-
var _OxyServices = require("../OxyServices");
|
|
8
|
-
/**
|
|
9
|
-
* Karma service for handling karma system operations
|
|
10
|
-
*/
|
|
11
|
-
class KarmaService extends _OxyServices.OxyServices {
|
|
12
|
-
/**
|
|
13
|
-
* Get karma leaderboard
|
|
14
|
-
*/
|
|
15
|
-
async getKarmaLeaderboard() {
|
|
16
|
-
try {
|
|
17
|
-
const res = await this.getClient().get('/karma/leaderboard');
|
|
18
|
-
return res.data;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
throw this.handleError(error);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get karma rules
|
|
26
|
-
*/
|
|
27
|
-
async getKarmaRules() {
|
|
28
|
-
try {
|
|
29
|
-
const res = await this.getClient().get('/karma/rules');
|
|
30
|
-
return res.data;
|
|
31
|
-
} catch (error) {
|
|
32
|
-
throw this.handleError(error);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get user karma total
|
|
38
|
-
*/
|
|
39
|
-
async getUserKarmaTotal(userId) {
|
|
40
|
-
try {
|
|
41
|
-
const res = await this.getClient().get(`/api/karma/${userId}/total`);
|
|
42
|
-
return res.data;
|
|
43
|
-
} catch (error) {
|
|
44
|
-
throw this.handleError(error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get user karma history
|
|
50
|
-
*/
|
|
51
|
-
async getUserKarmaHistory(userId, limit, offset) {
|
|
52
|
-
try {
|
|
53
|
-
const params = new URLSearchParams();
|
|
54
|
-
if (limit) params.append('limit', limit.toString());
|
|
55
|
-
if (offset) params.append('offset', offset.toString());
|
|
56
|
-
const res = await this.getClient().get(`/api/karma/${userId}/history?${params.toString()}`);
|
|
57
|
-
return res.data;
|
|
58
|
-
} catch (error) {
|
|
59
|
-
throw this.handleError(error);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Award karma to user
|
|
65
|
-
*/
|
|
66
|
-
async awardKarma(data) {
|
|
67
|
-
try {
|
|
68
|
-
const res = await this.getClient().post('/karma/award', data);
|
|
69
|
-
return res.data;
|
|
70
|
-
} catch (error) {
|
|
71
|
-
throw this.handleError(error);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Deduct karma from user
|
|
77
|
-
*/
|
|
78
|
-
async deductKarma(data) {
|
|
79
|
-
try {
|
|
80
|
-
const res = await this.getClient().post('/karma/deduct', data);
|
|
81
|
-
return res.data;
|
|
82
|
-
} catch (error) {
|
|
83
|
-
throw this.handleError(error);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Create or update karma rule
|
|
89
|
-
*/
|
|
90
|
-
async createOrUpdateKarmaRule(data) {
|
|
91
|
-
try {
|
|
92
|
-
const res = await this.getClient().post('/karma/rules', data);
|
|
93
|
-
return res.data;
|
|
94
|
-
} catch (error) {
|
|
95
|
-
throw this.handleError(error);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.KarmaService = KarmaService;
|
|
100
|
-
//# sourceMappingURL=KarmaService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_OxyServices","require","KarmaService","OxyServices","getKarmaLeaderboard","res","getClient","get","data","error","handleError","getKarmaRules","getUserKarmaTotal","userId","getUserKarmaHistory","limit","offset","params","URLSearchParams","append","toString","awardKarma","post","deductKarma","createOrUpdateKarmaRule","exports"],"sourceRoot":"../../../../src","sources":["core/karma/KarmaService.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACO,MAAMC,YAAY,SAASC,wBAAW,CAAC;EAC5C;AACF;AACA;EACE,MAAMC,mBAAmBA,CAAA,EAAqC;IAC5D,IAAI;MACF,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,oBAAoB,CAAC;MAC5D,OAAOF,GAAG,CAACG,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAME,aAAaA,CAAA,EAAyB;IAC1C,IAAI;MACF,MAAMN,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,cAAc,CAAC;MACtD,OAAOF,GAAG,CAACG,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MAC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AM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAMc,WAAWA,CAACf,IAAuB,EAAyE;IAChH,IAAI;MACF,MAAMH,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACgB,IAAI,CAAC,eAAe,EAAEd,IAAI,CAAC;MAC9D,OAAOH,GAAG,CAACG,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAMe,uBAAuBA,CAAChB,IAAwB,EAAsB;IAC1E,IAAI;MACF,MAAMH,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACgB,IAAI,CAAC,cAAc,EAAEd,IAAI,CAAC;MAC7D,OAAOH,GAAG,CAACG,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;AACF;AAACgB,OAAA,CAAAvB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LocationService = void 0;
|
|
7
|
-
var _OxyServices = require("../OxyServices");
|
|
8
|
-
/**
|
|
9
|
-
* Location service for handling location search and geolocation features
|
|
10
|
-
*/
|
|
11
|
-
class LocationService extends _OxyServices.OxyServices {
|
|
12
|
-
/**
|
|
13
|
-
* Search locations
|
|
14
|
-
*/
|
|
15
|
-
async searchLocations(query, limit = 5, countrycodes) {
|
|
16
|
-
try {
|
|
17
|
-
const params = new URLSearchParams({
|
|
18
|
-
query,
|
|
19
|
-
limit: limit.toString()
|
|
20
|
-
});
|
|
21
|
-
if (countrycodes) {
|
|
22
|
-
params.append('countrycodes', countrycodes);
|
|
23
|
-
}
|
|
24
|
-
const res = await this.getClient().get(`/api/location-search/search?${params.toString()}`);
|
|
25
|
-
return res.data;
|
|
26
|
-
} catch (error) {
|
|
27
|
-
throw this.handleError(error);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Get location details by coordinates
|
|
33
|
-
*/
|
|
34
|
-
async getLocationDetails(lat, lon) {
|
|
35
|
-
try {
|
|
36
|
-
const res = await this.getClient().get(`/api/location-search/reverse?lat=${lat}&lon=${lon}`);
|
|
37
|
-
return res.data;
|
|
38
|
-
} catch (error) {
|
|
39
|
-
throw this.handleError(error);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Find locations near coordinates
|
|
45
|
-
*/
|
|
46
|
-
async findLocationsNear(lat, lon, maxDistance = 10000, limit = 10, skip = 0) {
|
|
47
|
-
try {
|
|
48
|
-
const params = new URLSearchParams({
|
|
49
|
-
lat: lat.toString(),
|
|
50
|
-
lon: lon.toString(),
|
|
51
|
-
maxDistance: maxDistance.toString(),
|
|
52
|
-
limit: limit.toString(),
|
|
53
|
-
skip: skip.toString()
|
|
54
|
-
});
|
|
55
|
-
const res = await this.getClient().get(`/api/location-search/near?${params.toString()}`);
|
|
56
|
-
return res.data;
|
|
57
|
-
} catch (error) {
|
|
58
|
-
throw this.handleError(error);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Search locations in database
|
|
64
|
-
*/
|
|
65
|
-
async searchLocationsInDB(query, limit = 10, skip = 0, type, country, city) {
|
|
66
|
-
try {
|
|
67
|
-
const params = new URLSearchParams({
|
|
68
|
-
query,
|
|
69
|
-
limit: limit.toString(),
|
|
70
|
-
skip: skip.toString()
|
|
71
|
-
});
|
|
72
|
-
if (type) params.append('type', type);
|
|
73
|
-
if (country) params.append('country', country);
|
|
74
|
-
if (city) params.append('city', city);
|
|
75
|
-
const res = await this.getClient().get(`/api/location-search/db-search?${params.toString()}`);
|
|
76
|
-
return res.data;
|
|
77
|
-
} catch (error) {
|
|
78
|
-
throw this.handleError(error);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Get location statistics
|
|
84
|
-
*/
|
|
85
|
-
async getLocationStats() {
|
|
86
|
-
try {
|
|
87
|
-
const res = await this.getClient().get('/location-search/stats');
|
|
88
|
-
return res.data.stats;
|
|
89
|
-
} catch (error) {
|
|
90
|
-
throw this.handleError(error);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Get cache statistics
|
|
96
|
-
*/
|
|
97
|
-
async getLocationCacheStats() {
|
|
98
|
-
try {
|
|
99
|
-
const res = await this.getClient().get('/location-search/cache/stats');
|
|
100
|
-
return res.data.stats;
|
|
101
|
-
} catch (error) {
|
|
102
|
-
throw this.handleError(error);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Clear location cache
|
|
108
|
-
*/
|
|
109
|
-
async clearLocationCache() {
|
|
110
|
-
try {
|
|
111
|
-
const res = await this.getClient().delete('/location-search/cache');
|
|
112
|
-
return res.data;
|
|
113
|
-
} catch (error) {
|
|
114
|
-
throw this.handleError(error);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Get performance statistics
|
|
120
|
-
*/
|
|
121
|
-
async getLocationPerformanceStats() {
|
|
122
|
-
try {
|
|
123
|
-
const res = await this.getClient().get('/location-search/performance');
|
|
124
|
-
return res.data;
|
|
125
|
-
} catch (error) {
|
|
126
|
-
throw this.handleError(error);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
exports.LocationService = LocationService;
|
|
131
|
-
//# sourceMappingURL=LocationService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_OxyServices","require","LocationService","OxyServices","searchLocations","query","limit","countrycodes","params","URLSearchParams","toString","append","res","getClient","get","data","error","handleError","getLocationDetails","lat","lon","findLocationsNear","maxDistance","skip","searchLocationsInDB","type","country","city","getLocationStats","stats","getLocationCacheStats","clearLocationCache","delete","getLocationPerformanceStats","exports"],"sourceRoot":"../../../../src","sources":["core/locations/LocationService.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,MAAMC,eAAe,SAASC,wBAAW,CAAC;EAC/C;AACF;AACA;EACE,MAAMC,eAAeA,CAACC,KAAa,EAAEC,KAAa,GAAG,CAAC,EAAEC,YAAqB,EAAkB;IAC7F,IAAI;MACF,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;QACjCJ,KAAK;QACLC,KAAK,EAAEA,KAAK,CAACI,QAAQ,CAAC;MACxB,CAAC,CAAC;MAEF,IAAIH,YAAY,EAAE;QAChBC,MAAM,CAACG,MAAM,CAAC,cAAc,EAAEJ,YAAY,CAAC;MAC7C;MAEA,MAAMK,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,+BAA+BN,MAAM,CAACE,QAAQ,CAAC,CAAC,EAAE,CAAC;MAC1F,OAAOE,GAAG,CAACG,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAME,kBAAkBA,CAACC,GAAW,EAAEC,GAAW,EAAgB;IAC/D,IAAI;MACF,MAAMR,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,oCAAoCK,GAAG,QAAQC,GAAG,EAAE,CAAC;MAC5F,OAAOR,GAAG,CAACG,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WA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IAC/B;EACF;;EAEA;AACF;AACA;EACE,MAAMiB,2BAA2BA,CAAA,EAAiB;IAChD,IAAI;MACF,MAAMrB,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,GAAG,CAAC,8BAA8B,CAAC;MACtE,OAAOF,GAAG,CAACG,IAAI;IACjB,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IAC/B;EACF;AACF;AAACkB,OAAA,CAAAhC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PaymentService = void 0;
|
|
7
|
-
var _OxyServices = require("../OxyServices");
|
|
8
|
-
/**
|
|
9
|
-
* Payment service for handling payments, wallet operations, and transactions
|
|
10
|
-
*/
|
|
11
|
-
class PaymentService extends _OxyServices.OxyServices {
|
|
12
|
-
/**
|
|
13
|
-
* Process payment
|
|
14
|
-
*/
|
|
15
|
-
async processPayment(data) {
|
|
16
|
-
try {
|
|
17
|
-
const res = await this.getClient().post('/payments/process', data);
|
|
18
|
-
return res.data;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
throw this.handleError(error);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Validate payment method
|
|
26
|
-
*/
|
|
27
|
-
async validatePaymentMethod(paymentMethod) {
|
|
28
|
-
try {
|
|
29
|
-
const res = await this.getClient().post('/payments/validate-method', paymentMethod);
|
|
30
|
-
return res.data;
|
|
31
|
-
} catch (error) {
|
|
32
|
-
throw this.handleError(error);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get payment methods for user
|
|
38
|
-
*/
|
|
39
|
-
async getPaymentMethods(userId) {
|
|
40
|
-
try {
|
|
41
|
-
const res = await this.getClient().get(`/api/payments/methods/${userId}`);
|
|
42
|
-
return res.data;
|
|
43
|
-
} catch (error) {
|
|
44
|
-
throw this.handleError(error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get user wallet
|
|
50
|
-
*/
|
|
51
|
-
async getWallet(userId) {
|
|
52
|
-
try {
|
|
53
|
-
const res = await this.getClient().get(`/api/wallet/${userId}`);
|
|
54
|
-
return res.data;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
throw this.handleError(error);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Get transaction history
|
|
62
|
-
*/
|
|
63
|
-
async getTransactionHistory(userId, limit, offset) {
|
|
64
|
-
try {
|
|
65
|
-
const params = new URLSearchParams();
|
|
66
|
-
if (limit) params.append('limit', limit.toString());
|
|
67
|
-
if (offset) params.append('offset', offset.toString());
|
|
68
|
-
const res = await this.getClient().get(`/api/wallet/${userId}/transactions?${params.toString()}`);
|
|
69
|
-
return res.data;
|
|
70
|
-
} catch (error) {
|
|
71
|
-
throw this.handleError(error);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Get specific transaction
|
|
77
|
-
*/
|
|
78
|
-
async getTransaction(transactionId) {
|
|
79
|
-
try {
|
|
80
|
-
const res = await this.getClient().get(`/api/transactions/${transactionId}`);
|
|
81
|
-
return res.data;
|
|
82
|
-
} catch (error) {
|
|
83
|
-
throw this.handleError(error);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Transfer funds between users
|
|
89
|
-
*/
|
|
90
|
-
async transferFunds(data) {
|
|
91
|
-
try {
|
|
92
|
-
const res = await this.getClient().post('/wallet/transfer', data);
|
|
93
|
-
return res.data;
|
|
94
|
-
} catch (error) {
|
|
95
|
-
throw this.handleError(error);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Process purchase
|
|
101
|
-
*/
|
|
102
|
-
async processPurchase(data) {
|
|
103
|
-
try {
|
|
104
|
-
const res = await this.getClient().post('/wallet/purchase', data);
|
|
105
|
-
return res.data;
|
|
106
|
-
} catch (error) {
|
|
107
|
-
throw this.handleError(error);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Request withdrawal
|
|
113
|
-
*/
|
|
114
|
-
async requestWithdrawal(data) {
|
|
115
|
-
try {
|
|
116
|
-
const res = await this.getClient().post('/wallet/withdraw', data);
|
|
117
|
-
return res.data;
|
|
118
|
-
} catch (error) {
|
|
119
|
-
throw this.handleError(error);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
exports.PaymentService = PaymentService;
|
|
124
|
-
//# sourceMappingURL=PaymentService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_OxyServices","require","PaymentService","OxyServices","processPayment","data","res","getClient","post","error","handleError","validatePaymentMethod","paymentMethod","getPaymentMethods","userId","get","getWallet","getTransactionHistory","limit","offset","params","URLSearchParams","append","toString","getTransaction","transactionId","transferFunds","processPurchase","requestWithdrawal","exports"],"sourceRoot":"../../../../src","sources":["core/payments/PaymentService.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAaA;AACA;AACA;AACO,MAAMC,cAAc,SAASC,wBAAW,CAAC;EAC9C;AACF;AACA;EACE,MAAMC,cAAcA,CAACC,IAAoB,EAA4B;IACnE,IAAI;MACF,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,IAAI,CAAC,mBAAmB,EAAEH,IAAI,CAAC;MAClE,OAAOC,GAAG,CAACD,IAAI;IACjB,CAAC,CAAC,OAAOI,KAAK,EAAE;MACd,MAAM,IAAI,CAAC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