@oxyhq/services 5.9.1 → 5.9.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 (195) hide show
  1. package/README.md +1 -33
  2. package/lib/commonjs/core/OxyServices.js +159 -0
  3. package/lib/commonjs/core/OxyServices.js.map +1 -0
  4. package/lib/commonjs/core/OxyServicesMain.js +51 -0
  5. package/lib/commonjs/core/OxyServicesMain.js.map +1 -0
  6. package/lib/commonjs/core/analytics/AnalyticsService.js +67 -0
  7. package/lib/commonjs/core/analytics/AnalyticsService.js.map +1 -0
  8. package/lib/commonjs/core/auth/AuthService.js +526 -0
  9. package/lib/commonjs/core/auth/AuthService.js.map +1 -0
  10. package/lib/commonjs/core/devices/DeviceService.js +61 -0
  11. package/lib/commonjs/core/devices/DeviceService.js.map +1 -0
  12. package/lib/commonjs/core/files/FileService.js +176 -0
  13. package/lib/commonjs/core/files/FileService.js.map +1 -0
  14. package/lib/commonjs/core/index.js +103 -1707
  15. package/lib/commonjs/core/index.js.map +1 -1
  16. package/lib/commonjs/core/karma/KarmaService.js +100 -0
  17. package/lib/commonjs/core/karma/KarmaService.js.map +1 -0
  18. package/lib/commonjs/core/locations/LocationService.js +131 -0
  19. package/lib/commonjs/core/locations/LocationService.js.map +1 -0
  20. package/lib/commonjs/core/payments/PaymentService.js +124 -0
  21. package/lib/commonjs/core/payments/PaymentService.js.map +1 -0
  22. package/lib/commonjs/core/users/UserService.js +234 -0
  23. package/lib/commonjs/core/users/UserService.js.map +1 -0
  24. package/lib/commonjs/index.js +164 -2
  25. package/lib/commonjs/index.js.map +1 -1
  26. package/lib/commonjs/models/session.js +2 -0
  27. package/lib/{module/types/middleware.js.map → commonjs/models/session.js.map} +1 -1
  28. package/lib/commonjs/ui/context/OxyContext.js +28 -24
  29. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  30. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +2 -2
  31. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  32. package/lib/commonjs/ui/screens/FileManagementScreen.js +12 -12
  33. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  34. package/lib/commonjs/ui/screens/ProfileScreen.js +2 -2
  35. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  36. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  37. package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
  38. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  39. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
  40. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  41. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  42. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  43. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
  44. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  45. package/lib/commonjs/ui/stores/followStore.js +4 -4
  46. package/lib/commonjs/ui/stores/followStore.js.map +1 -1
  47. package/lib/commonjs/utils/apiUtils.js +93 -0
  48. package/lib/commonjs/utils/apiUtils.js.map +1 -0
  49. package/lib/commonjs/utils/asyncUtils.js +219 -0
  50. package/lib/commonjs/utils/asyncUtils.js.map +1 -0
  51. package/lib/commonjs/utils/errorUtils.js +148 -0
  52. package/lib/commonjs/utils/errorUtils.js.map +1 -0
  53. package/lib/commonjs/utils/hookUtils.js +399 -0
  54. package/lib/commonjs/utils/hookUtils.js.map +1 -0
  55. package/lib/commonjs/utils/loggerUtils.js +160 -0
  56. package/lib/commonjs/utils/loggerUtils.js.map +1 -0
  57. package/lib/commonjs/utils/validationUtils.js +174 -0
  58. package/lib/commonjs/utils/validationUtils.js.map +1 -0
  59. package/lib/module/core/OxyServices.js +153 -0
  60. package/lib/module/core/OxyServices.js.map +1 -0
  61. package/lib/module/core/OxyServicesMain.js +47 -0
  62. package/lib/module/core/OxyServicesMain.js.map +1 -0
  63. package/lib/module/core/analytics/AnalyticsService.js +62 -0
  64. package/lib/module/core/analytics/AnalyticsService.js.map +1 -0
  65. package/lib/module/core/auth/AuthService.js +521 -0
  66. package/lib/module/core/auth/AuthService.js.map +1 -0
  67. package/lib/module/core/devices/DeviceService.js +57 -0
  68. package/lib/module/core/devices/DeviceService.js.map +1 -0
  69. package/lib/module/core/files/FileService.js +171 -0
  70. package/lib/module/core/files/FileService.js.map +1 -0
  71. package/lib/module/core/index.js +25 -1694
  72. package/lib/module/core/index.js.map +1 -1
  73. package/lib/module/core/karma/KarmaService.js +95 -0
  74. package/lib/module/core/karma/KarmaService.js.map +1 -0
  75. package/lib/module/core/locations/LocationService.js +127 -0
  76. package/lib/module/core/locations/LocationService.js.map +1 -0
  77. package/lib/module/core/payments/PaymentService.js +119 -0
  78. package/lib/module/core/payments/PaymentService.js.map +1 -0
  79. package/lib/module/core/users/UserService.js +230 -0
  80. package/lib/module/core/users/UserService.js.map +1 -0
  81. package/lib/module/index.js +8 -4
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/models/session.js +2 -0
  84. package/lib/{commonjs/types/middleware.js.map → module/models/session.js.map} +1 -1
  85. package/lib/module/ui/context/OxyContext.js +28 -24
  86. package/lib/module/ui/context/OxyContext.js.map +1 -1
  87. package/lib/module/ui/screens/AccountSwitcherScreen.js +2 -2
  88. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  89. package/lib/module/ui/screens/FileManagementScreen.js +12 -12
  90. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  91. package/lib/module/ui/screens/ProfileScreen.js +2 -2
  92. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  93. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  94. package/lib/module/ui/screens/SignInScreen.js +1 -1
  95. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  96. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
  97. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  98. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  99. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  100. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
  101. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  102. package/lib/module/ui/stores/followStore.js +4 -4
  103. package/lib/module/ui/stores/followStore.js.map +1 -1
  104. package/lib/module/utils/apiUtils.js +85 -0
  105. package/lib/module/utils/apiUtils.js.map +1 -0
  106. package/lib/module/utils/asyncUtils.js +202 -0
  107. package/lib/module/utils/asyncUtils.js.map +1 -0
  108. package/lib/module/utils/errorUtils.js +139 -0
  109. package/lib/module/utils/errorUtils.js.map +1 -0
  110. package/lib/module/utils/hookUtils.js +381 -0
  111. package/lib/module/utils/hookUtils.js.map +1 -0
  112. package/lib/module/utils/loggerUtils.js +149 -0
  113. package/lib/module/utils/loggerUtils.js.map +1 -0
  114. package/lib/module/utils/validationUtils.js +154 -0
  115. package/lib/module/utils/validationUtils.js.map +1 -0
  116. package/lib/typescript/core/OxyServices.d.ts +64 -0
  117. package/lib/typescript/core/OxyServices.d.ts.map +1 -0
  118. package/lib/typescript/core/OxyServicesMain.d.ts +33 -0
  119. package/lib/typescript/core/OxyServicesMain.d.ts.map +1 -0
  120. package/lib/typescript/core/analytics/AnalyticsService.d.ts +26 -0
  121. package/lib/typescript/core/analytics/AnalyticsService.d.ts.map +1 -0
  122. package/lib/typescript/core/auth/AuthService.d.ts +165 -0
  123. package/lib/typescript/core/auth/AuthService.d.ts.map +1 -0
  124. package/lib/typescript/core/devices/DeviceService.d.ts +20 -0
  125. package/lib/typescript/core/devices/DeviceService.d.ts.map +1 -0
  126. package/lib/typescript/core/files/FileService.d.ts +59 -0
  127. package/lib/typescript/core/files/FileService.d.ts.map +1 -0
  128. package/lib/typescript/core/index.d.ts +19 -657
  129. package/lib/typescript/core/index.d.ts.map +1 -1
  130. package/lib/typescript/core/karma/KarmaService.d.ts +50 -0
  131. package/lib/typescript/core/karma/KarmaService.d.ts.map +1 -0
  132. package/lib/typescript/core/locations/LocationService.d.ts +39 -0
  133. package/lib/typescript/core/locations/LocationService.d.ts.map +1 -0
  134. package/lib/typescript/core/payments/PaymentService.d.ts +50 -0
  135. package/lib/typescript/core/payments/PaymentService.d.ts.map +1 -0
  136. package/lib/typescript/core/users/UserService.d.ts +111 -0
  137. package/lib/typescript/core/users/UserService.d.ts.map +1 -0
  138. package/lib/typescript/index.d.ts +7 -3
  139. package/lib/typescript/index.d.ts.map +1 -1
  140. package/lib/typescript/models/{secureSession.d.ts → session.d.ts} +4 -4
  141. package/lib/typescript/models/session.d.ts.map +1 -0
  142. package/lib/typescript/ui/context/OxyContext.d.ts +2 -2
  143. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  144. package/lib/typescript/utils/apiUtils.d.ts +61 -0
  145. package/lib/typescript/utils/apiUtils.d.ts.map +1 -0
  146. package/lib/typescript/utils/asyncUtils.d.ts +64 -0
  147. package/lib/typescript/utils/asyncUtils.d.ts.map +1 -0
  148. package/lib/typescript/utils/errorUtils.d.ts +45 -0
  149. package/lib/typescript/utils/errorUtils.d.ts.map +1 -0
  150. package/lib/typescript/utils/hookUtils.d.ts +102 -0
  151. package/lib/typescript/utils/hookUtils.d.ts.map +1 -0
  152. package/lib/typescript/utils/loggerUtils.d.ts +49 -0
  153. package/lib/typescript/utils/loggerUtils.d.ts.map +1 -0
  154. package/lib/typescript/utils/validationUtils.d.ts +80 -0
  155. package/lib/typescript/utils/validationUtils.d.ts.map +1 -0
  156. package/package.json +2 -8
  157. package/src/core/OxyServices.ts +168 -0
  158. package/src/core/OxyServicesMain.ts +57 -0
  159. package/src/core/analytics/AnalyticsService.ts +64 -0
  160. package/src/core/auth/AuthService.ts +544 -0
  161. package/src/core/devices/DeviceService.ts +55 -0
  162. package/src/core/files/FileService.ts +194 -0
  163. package/src/core/index.ts +26 -1769
  164. package/src/core/karma/KarmaService.ts +104 -0
  165. package/src/core/locations/LocationService.ts +141 -0
  166. package/src/core/payments/PaymentService.ts +133 -0
  167. package/src/core/users/UserService.ts +241 -0
  168. package/src/index.ts +29 -8
  169. package/src/models/{secureSession.ts → session.ts} +5 -5
  170. package/src/ui/context/OxyContext.tsx +34 -30
  171. package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
  172. package/src/ui/screens/FileManagementScreen.tsx +12 -12
  173. package/src/ui/screens/ProfileScreen.tsx +3 -3
  174. package/src/ui/screens/SessionManagementScreen.tsx +2 -2
  175. package/src/ui/screens/SignInScreen.tsx +1 -1
  176. package/src/ui/screens/karma/KarmaCenterScreen.tsx +2 -2
  177. package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +3 -3
  178. package/src/ui/screens/karma/KarmaRulesScreen.tsx +3 -3
  179. package/src/ui/stores/followStore.ts +4 -4
  180. package/src/utils/apiUtils.ts +102 -0
  181. package/src/utils/asyncUtils.ts +265 -0
  182. package/src/utils/errorUtils.ts +172 -0
  183. package/src/utils/hookUtils.ts +397 -0
  184. package/src/utils/loggerUtils.ts +153 -0
  185. package/src/utils/validationUtils.ts +158 -0
  186. package/lib/commonjs/models/secureSession.js +0 -2
  187. package/lib/commonjs/models/secureSession.js.map +0 -1
  188. package/lib/commonjs/types/middleware.js +0 -6
  189. package/lib/module/models/secureSession.js +0 -2
  190. package/lib/module/models/secureSession.js.map +0 -1
  191. package/lib/module/types/middleware.js +0 -4
  192. package/lib/typescript/models/secureSession.d.ts.map +0 -1
  193. package/lib/typescript/types/middleware.d.ts +0 -19
  194. package/lib/typescript/types/middleware.d.ts.map +0 -1
  195. package/src/types/middleware.ts +0 -20
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LogLevel","Logger","level","INFO","isDevelopment","process","env","NODE_ENV","setLevel","shouldLog","formatMessage","message","context","timestamp","Date","toISOString","contextStr","Object","entries","map","k","v","join","debug","args","DEBUG","formattedMessage","console","log","info","warn","WARN","error","ERROR","auth","category","api","session","user","device","payment","performance","operation","duration","errorWithStack","stack","group","label","fn","groupEnd","logger","logAuth","logApi","logSession","logUser","logDevice","logPayment","logError","logPerformance"],"sourceRoot":"../../../src","sources":["utils/loggerUtils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAiBpB,MAAMC,MAAM,CAAC;EACHC,KAAK,GAAaF,QAAQ,CAACG,IAAI;EAC/BC,aAAa,GAAYC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa;EAEvEC,QAAQA,CAACN,KAAe,EAAQ;IAC9B,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEQO,SAASA,CAACP,KAAe,EAAW;IAC1C,OAAOA,KAAK,IAAI,IAAI,CAACA,KAAK;EAC5B;EAEQQ,aAAaA,CAACR,KAAa,EAAES,OAAe,EAAEC,OAAoB,EAAU;IAClF,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;IAC1C,MAAMC,UAAU,GAAGJ,OAAO,GAAG,KAAKK,MAAM,CAACC,OAAO,CAACN,OAAO,CAAC,CAACO,GAAG,CAAC,CAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,KAAK,GAAGD,CAAC,IAAIC,CAAC,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE;IACzG,OAAO,IAAIT,SAAS,KAAKX,KAAK,GAAGc,UAAU,KAAKL,OAAO,EAAE;EAC3D;EAEAY,KAAKA,CAACZ,OAAe,EAAEC,OAAoB,EAAE,GAAGY,IAAW,EAAQ;IACjE,IAAI,IAAI,CAACf,SAAS,CAACT,QAAQ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ChB,SAAiB,EAAEC,QAAgB,EAAE/B,OAAoB,KACtFsC,MAAM,CAACT,WAAW,CAACC,SAAS,EAAEC,QAAQ,EAAE/B,OAAO,CAAC","ignoreList":[]}
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Validation utilities for common data validation patterns
5
+ */
6
+
7
+ /**
8
+ * Email validation regex
9
+ */
10
+ export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
11
+
12
+ /**
13
+ * Username validation regex (alphanumeric, underscore, dash, 3-30 chars)
14
+ */
15
+ export const USERNAME_REGEX = /^[a-zA-Z0-9_-]{3,30}$/;
16
+
17
+ /**
18
+ * Password validation regex (at least 8 chars, 1 uppercase, 1 lowercase, 1 number)
19
+ */
20
+ export const PASSWORD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d@$!%*?&]{8,}$/;
21
+
22
+ /**
23
+ * Validate email format
24
+ */
25
+ export function isValidEmail(email) {
26
+ return EMAIL_REGEX.test(email);
27
+ }
28
+
29
+ /**
30
+ * Validate username format
31
+ */
32
+ export function isValidUsername(username) {
33
+ return USERNAME_REGEX.test(username);
34
+ }
35
+
36
+ /**
37
+ * Validate password strength
38
+ */
39
+ export function isValidPassword(password) {
40
+ return PASSWORD_REGEX.test(password);
41
+ }
42
+
43
+ /**
44
+ * Validate required string
45
+ */
46
+ export function isRequiredString(value) {
47
+ return typeof value === 'string' && value.trim().length > 0;
48
+ }
49
+
50
+ /**
51
+ * Validate required number
52
+ */
53
+ export function isRequiredNumber(value) {
54
+ return typeof value === 'number' && !isNaN(value);
55
+ }
56
+
57
+ /**
58
+ * Validate required boolean
59
+ */
60
+ export function isRequiredBoolean(value) {
61
+ return typeof value === 'boolean';
62
+ }
63
+
64
+ /**
65
+ * Validate array
66
+ */
67
+ export function isValidArray(value) {
68
+ return Array.isArray(value);
69
+ }
70
+
71
+ /**
72
+ * Validate object
73
+ */
74
+ export function isValidObject(value) {
75
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
76
+ }
77
+
78
+ /**
79
+ * Validate UUID format
80
+ */
81
+ export function isValidUUID(uuid) {
82
+ const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
83
+ return UUID_REGEX.test(uuid);
84
+ }
85
+
86
+ /**
87
+ * Validate URL format
88
+ */
89
+ export function isValidURL(url) {
90
+ try {
91
+ new URL(url);
92
+ return true;
93
+ } catch {
94
+ return false;
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Validate date string
100
+ */
101
+ export function isValidDate(dateString) {
102
+ const date = new Date(dateString);
103
+ return !isNaN(date.getTime());
104
+ }
105
+
106
+ /**
107
+ * Validate file size (in bytes)
108
+ */
109
+ export function isValidFileSize(size, maxSize) {
110
+ return size > 0 && size <= maxSize;
111
+ }
112
+
113
+ /**
114
+ * Validate file type
115
+ */
116
+ export function isValidFileType(filename, allowedTypes) {
117
+ const extension = filename.split('.').pop()?.toLowerCase();
118
+ return extension ? allowedTypes.includes(extension) : false;
119
+ }
120
+
121
+ /**
122
+ * Sanitize string input
123
+ */
124
+ export function sanitizeString(input) {
125
+ return input.trim().replace(/[<>]/g, '');
126
+ }
127
+
128
+ /**
129
+ * Sanitize HTML input
130
+ */
131
+ export function sanitizeHTML(input) {
132
+ return input.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
133
+ }
134
+
135
+ /**
136
+ * Validate and sanitize user input
137
+ */
138
+ export function validateAndSanitizeUserInput(input, type) {
139
+ if (typeof input !== 'string') {
140
+ return null;
141
+ }
142
+ const sanitized = sanitizeString(input);
143
+ switch (type) {
144
+ case 'email':
145
+ return isValidEmail(sanitized) ? sanitized : null;
146
+ case 'username':
147
+ return isValidUsername(sanitized) ? sanitized : null;
148
+ case 'string':
149
+ return isRequiredString(sanitized) ? sanitized : null;
150
+ default:
151
+ return null;
152
+ }
153
+ }
154
+ //# sourceMappingURL=validationUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EMAIL_REGEX","USERNAME_REGEX","PASSWORD_REGEX","isValidEmail","email","test","isValidUsername","username","isValidPassword","password","isRequiredString","value","trim","length","isRequiredNumber","isNaN","isRequiredBoolean","isValidArray","Array","isArray","isValidObject","isValidUUID","uuid","UUID_REGEX","isValidURL","url","URL","isValidDate","dateString","date","Date","getTime","isValidFileSize","size","maxSize","isValidFileType","filename","allowedTypes","extension","split","pop","toLowerCase","includes","sanitizeString","input","replace","sanitizeHTML","validateAndSanitizeUserInput","type","sanitized"],"sourceRoot":"../../../src","sources":["utils/validationUtils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,4BAA4B;;AAEvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,uBAAuB;;AAErD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,uDAAuD;;AAErF;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAa,EAAW;EACnD,OAAOJ,WAAW,CAACK,IAAI,CAACD,KAAK,CAAC;AAChC;;AAEA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAACC,QAAgB,EAAW;EACzD,OAAON,cAAc,CAACI,IAAI,CAACE,QAAQ,CAAC;AACtC;;AAEA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,QAAgB,EAAW;EACzD,OAAOP,cAAc,CAACG,IAAI,CAACI,QAAQ,CAAC;AACtC;;AAEA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,KAAU,EAAW;EACpD,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACC,IAAI,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC;AAC7D;;AAEA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACH,KAAU,EAAW;EACpD,OA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OxyServices - Base client library for interacting with the Oxy API
5
+ *
6
+ * This class provides the core HTTP client setup, token management, and error handling.
7
+ * Specific functionality is delegated to focused service modules.
8
+ */
9
+ export declare class OxyServices {
10
+ protected client: AxiosInstance;
11
+ private accessToken;
12
+ private refreshToken;
13
+ /**
14
+ * Creates a new instance of the OxyServices client
15
+ * @param config - Configuration for the client
16
+ */
17
+ constructor(config: OxyConfig);
18
+ /**
19
+ * Setup axios interceptors for authentication and error handling
20
+ */
21
+ private setupInterceptors;
22
+ /**
23
+ * Get the configured base URL
24
+ */
25
+ getBaseURL(): string;
26
+ /**
27
+ * Set authentication tokens
28
+ */
29
+ setTokens(accessToken: string, refreshToken?: string): void;
30
+ /**
31
+ * Clear stored authentication tokens
32
+ */
33
+ clearTokens(): void;
34
+ /**
35
+ * Get the current user ID from the access token
36
+ */
37
+ getCurrentUserId(): string | null;
38
+ /**
39
+ * Check if the client has a valid access token
40
+ */
41
+ private hasAccessToken;
42
+ /**
43
+ * Validate the current access token with the server
44
+ */
45
+ validate(): Promise<boolean>;
46
+ /**
47
+ * Get the HTTP client instance (protected for use by service modules)
48
+ */
49
+ protected getClient(): AxiosInstance;
50
+ /**
51
+ * Centralized error handling
52
+ */
53
+ protected handleError(error: any): ApiError;
54
+ /**
55
+ * Health check endpoint
56
+ */
57
+ healthCheck(): Promise<{
58
+ status: string;
59
+ users?: number;
60
+ timestamp?: string;
61
+ [key: string]: any;
62
+ }>;
63
+ }
64
+ //# sourceMappingURL=OxyServices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OxyServices.d.ts","sourceRoot":"","sources":["../../../src/core/OxyServices.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAA8B,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAS3D;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;IAChC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,YAAY,CAAuB;IAE3C;;;OAGG;gBACS,MAAM,EAAE,SAAS;IAS7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAqCzB;;OAEG;IACI,UAAU,IAAI,MAAM;IAI3B;;OAEG;IACI,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,IAAI;IAKtE;;OAEG;IACI,WAAW,IAAI,IAAI;IAK1B;;OAEG;IACI,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAaxC;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAalC;;OAEG;IACH,SAAS,CAAC,SAAS,IAAI,aAAa;IAIpC;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,QAAQ;IAI3C;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAC;CAQH"}
@@ -0,0 +1,33 @@
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 } from './files/FileService';
7
+ import { LocationService } from './locations/LocationService';
8
+ import { AnalyticsService } from './analytics/AnalyticsService';
9
+ import { DeviceService } from './devices/DeviceService';
10
+ /**
11
+ * Main OxyServices class that combines all individual services
12
+ *
13
+ * This class provides a unified interface to all Oxy API services while maintaining
14
+ * backward compatibility with the original monolithic structure.
15
+ */
16
+ export declare class OxyServicesMain extends AuthService {
17
+ readonly users: UserService;
18
+ readonly payments: PaymentService;
19
+ readonly karma: KarmaService;
20
+ readonly files: FileService;
21
+ readonly locations: LocationService;
22
+ readonly analytics: AnalyticsService;
23
+ readonly devices: DeviceService;
24
+ constructor(config: OxyConfig);
25
+ static readonly OXY_CLOUD_URL = "https://cloud.oxy.so";
26
+ fetchLinkMetadata(url: string): Promise<{
27
+ url: string;
28
+ title: string;
29
+ description: string;
30
+ image?: string;
31
+ }>;
32
+ }
33
+ //# sourceMappingURL=OxyServicesMain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OxyServicesMain.d.ts","sourceRoot":"","sources":["../../../src/core/OxyServicesMain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAiB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAE9C,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,QAAQ,EAAE,cAAc,CAAC;IACzC,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,KAAK,EAAE,WAAW,CAAC;IACnC,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,SAAS,EAAE,gBAAgB,CAAC;IAC5C,SAAgB,OAAO,EAAE,aAAa,CAAC;gBAE3B,MAAM,EAAE,SAAS;IAc7B,MAAM,CAAC,QAAQ,CAAC,aAAa,0BAAiB;IAGxC,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAC5C,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CAQH"}
@@ -0,0 +1,26 @@
1
+ import { OxyServices } from '../OxyServices';
2
+ import { AnalyticsData, FollowerDetails, ContentViewer } from '../../models/interfaces';
3
+ /**
4
+ * Analytics service for handling analytics and content viewer operations
5
+ */
6
+ export declare class AnalyticsService extends OxyServices {
7
+ /**
8
+ * Get analytics data for user
9
+ */
10
+ getAnalytics(userId: string, period?: string): Promise<AnalyticsData>;
11
+ /**
12
+ * Update analytics data
13
+ */
14
+ updateAnalytics(userId: string, type: string, data: Record<string, any>): Promise<{
15
+ message: string;
16
+ }>;
17
+ /**
18
+ * Get content viewers for user
19
+ */
20
+ getContentViewers(userId: string, period?: string): Promise<ContentViewer[]>;
21
+ /**
22
+ * Get follower details for user
23
+ */
24
+ getFollowerDetails(userId: string, period?: string): Promise<FollowerDetails>;
25
+ }
26
+ //# sourceMappingURL=AnalyticsService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsService.d.ts","sourceRoot":"","sources":["../../../../src/core/analytics/AnalyticsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAY3E;;OAEG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAS5G;;OAEG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAYlF;;OAEG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAWpF"}
@@ -0,0 +1,165 @@
1
+ import { OxyServices } from '../OxyServices';
2
+ import { User, ApiError } from '../../models/interfaces';
3
+ import { SessionLoginResponse } from '../../models/session';
4
+ /**
5
+ * Authentication service for handling login, signup, and session management
6
+ */
7
+ export declare class AuthService extends OxyServices {
8
+ /**
9
+ * Sign up a new user
10
+ */
11
+ signUp(username: string, email: string, password: string): Promise<{
12
+ message: string;
13
+ token: string;
14
+ user: User;
15
+ }>;
16
+ /**
17
+ * Sign in with device management
18
+ */
19
+ signIn(username: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<SessionLoginResponse>;
20
+ /**
21
+ * Get user by session ID
22
+ */
23
+ getUserBySession(sessionId: string): Promise<User>;
24
+ /**
25
+ * Get access token by session ID
26
+ */
27
+ getTokenBySession(sessionId: string): Promise<{
28
+ accessToken: string;
29
+ expiresAt: string;
30
+ }>;
31
+ /**
32
+ * Get sessions by session ID
33
+ */
34
+ getSessionsBySessionId(sessionId: string): Promise<any[]>;
35
+ /**
36
+ * Logout from a specific session
37
+ */
38
+ logoutSession(sessionId: string, targetSessionId?: string): Promise<void>;
39
+ /**
40
+ * Logout from all sessions
41
+ */
42
+ logoutAllSessions(sessionId: string): Promise<void>;
43
+ /**
44
+ * Validate a session with optional device fingerprint
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * // Basic session validation
49
+ * const result = await authService.validateSession('session-id');
50
+ *
51
+ * // With device fingerprint for enhanced security
52
+ * const result = await authService.validateSession('session-id', {
53
+ * deviceFingerprint: 'device-fingerprint',
54
+ * useHeaderValidation: true
55
+ * });
56
+ * ```
57
+ *
58
+ * @param sessionId The session ID to validate
59
+ * @param options Validation options
60
+ * @param options.deviceFingerprint Optional device fingerprint for enhanced validation
61
+ * @param options.useHeaderValidation Whether to use header-based validation (default: false)
62
+ * @returns Session validation result
63
+ */
64
+ validateSession(sessionId: string, options?: {
65
+ deviceFingerprint?: string;
66
+ useHeaderValidation?: boolean;
67
+ }): Promise<{
68
+ valid: boolean;
69
+ expiresAt: string;
70
+ lastActivity: string;
71
+ user: User;
72
+ sessionId?: string;
73
+ source?: string;
74
+ }>;
75
+ /**
76
+ * Express.js authentication middleware
77
+ *
78
+ * A simple, efficient, and debuggable authentication middleware that supports both
79
+ * session-based and legacy token-based authentication.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * // Basic usage
84
+ * app.use('/api/protected', authService.authenticateToken());
85
+ *
86
+ * // With debug logging
87
+ * app.use('/api/protected', authService.authenticateToken({ debug: true }));
88
+ *
89
+ * // Without loading full user data (faster)
90
+ * app.use('/api/protected', authService.authenticateToken({ loadFullUser: false }));
91
+ *
92
+ * // With custom error handling
93
+ * app.use('/api/protected', authService.authenticateToken({
94
+ * onError: (error) => {
95
+ * console.error('Auth error:', error);
96
+ * // Custom error handling logic
97
+ * }
98
+ * }));
99
+ * ```
100
+ *
101
+ * @param options Configuration options
102
+ * @param options.loadFullUser Whether to load complete user data (default: true)
103
+ * @param options.onError Custom error handler function
104
+ * @param options.debug Enable debug logging (default: false)
105
+ * @returns Express middleware function
106
+ */
107
+ authenticateToken(options?: {
108
+ loadFullUser?: boolean;
109
+ onError?: (error: ApiError) => any;
110
+ debug?: boolean;
111
+ }): (req: any, res: any, next: any) => Promise<any>;
112
+ /**
113
+ * Helper method for validating tokens without Express middleware
114
+ *
115
+ * Use this method when you need to validate tokens programmatically
116
+ * outside of Express middleware context.
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const result = await authService.validateToken(token);
121
+ * if (result.valid) {
122
+ * console.log('User ID:', result.userId);
123
+ * console.log('User data:', result.user);
124
+ * } else {
125
+ * console.log('Validation failed:', result.error);
126
+ * }
127
+ * ```
128
+ *
129
+ * @param token JWT token to validate
130
+ * @returns Validation result with user data if valid
131
+ */
132
+ validateToken(token: string): Promise<{
133
+ valid: boolean;
134
+ userId?: string;
135
+ user?: any;
136
+ error?: string;
137
+ }>;
138
+ /**
139
+ * Get device sessions (delegates to DeviceService)
140
+ */
141
+ getDeviceSessions(sessionId: string): Promise<any[]>;
142
+ /**
143
+ * Logout from all device sessions (delegates to DeviceService)
144
+ */
145
+ logoutAllDeviceSessions(sessionId: string): Promise<void>;
146
+ /**
147
+ * Update device name (delegates to DeviceService)
148
+ */
149
+ updateDeviceName(sessionId: string, deviceName: string): Promise<void>;
150
+ /**
151
+ * Check username availability
152
+ */
153
+ checkUsernameAvailability(username: string): Promise<{
154
+ available: boolean;
155
+ message: string;
156
+ }>;
157
+ /**
158
+ * Check email availability
159
+ */
160
+ checkEmailAvailability(email: string): Promise<{
161
+ available: boolean;
162
+ message: string;
163
+ }>;
164
+ }
165
+ //# sourceMappingURL=AuthService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthService.d.ts","sourceRoot":"","sources":["../../../../src/core/auth/AuthService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAiB,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAU5D;;GAEG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAA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,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC;QACnC,KAAK,CAAC,EAAE,OAAO,CAAC;KACZ,IAGU,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG;IAqJ7C;;;;;;;;;;;;;;;;;;;OAmBG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAC1C,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAoFF;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAS1D;;OAEG;IACG,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/D;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5E;;OAEG;IACG,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAoBnG;;OAEG;IACG,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAsB9F"}
@@ -0,0 +1,20 @@
1
+ import { OxyServices } from '../OxyServices';
2
+ import { DeviceSession, DeviceSessionLogoutResponse, UpdateDeviceNameResponse } from '../../models/interfaces';
3
+ /**
4
+ * Device service for handling device session management
5
+ */
6
+ export declare class DeviceService extends OxyServices {
7
+ /**
8
+ * Get device sessions
9
+ */
10
+ getDeviceSessions(sessionId: string, deviceId?: string): Promise<DeviceSession[]>;
11
+ /**
12
+ * Logout from all device sessions
13
+ */
14
+ logoutAllDeviceSessions(sessionId: string, deviceId?: string, excludeCurrent?: boolean): Promise<DeviceSessionLogoutResponse>;
15
+ /**
16
+ * Update device name
17
+ */
18
+ updateDeviceName(sessionId: string, deviceName: string): Promise<UpdateDeviceNameResponse>;
19
+ }
20
+ //# sourceMappingURL=DeviceService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceService.d.ts","sourceRoot":"","sources":["../../../../src/core/devices/DeviceService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,aAAa,EAEb,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAGjC;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAYvF;;OAEG;IACG,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAYnI;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAQjG"}
@@ -0,0 +1,59 @@
1
+ import { OxyServices } from '../OxyServices';
2
+ import { FileMetadata, FileUploadResponse, FileListResponse, FileUpdateRequest, FileDeleteResponse } from '../../models/interfaces';
3
+ /**
4
+ * Default cloud URL for Oxy services, cloud is where the user files are. (e.g. images, videos, etc.). Not the API.
5
+ */
6
+ export declare const OXY_CLOUD_URL = "https://cloud.oxy.so";
7
+ /**
8
+ * File service for handling file operations and management
9
+ */
10
+ export declare class FileService extends OxyServices {
11
+ /**
12
+ * Upload a single file
13
+ * Note: This method is deprecated. Use the new raw upload approach instead.
14
+ */
15
+ uploadFile(file: File | Blob | any, // Use 'any' to handle Buffer type in cross-platform scenarios
16
+ filename: string, metadata?: Record<string, any>): Promise<FileMetadata>;
17
+ /**
18
+ * Upload multiple files
19
+ * Note: This method is deprecated. Use the new raw upload approach instead.
20
+ */
21
+ uploadFiles(files: (File | Blob | any)[], filenames: string[], metadata?: Record<string, any>): Promise<FileUploadResponse>;
22
+ /**
23
+ * Get file metadata
24
+ */
25
+ getFileMetadata(fileId: string): Promise<FileMetadata>;
26
+ /**
27
+ * Update file metadata
28
+ */
29
+ updateFileMetadata(fileId: string, updates: FileUpdateRequest): Promise<FileMetadata>;
30
+ /**
31
+ * Delete file
32
+ */
33
+ deleteFile(fileId: string): Promise<FileDeleteResponse>;
34
+ /**
35
+ * Get file download URL
36
+ */
37
+ getFileDownloadUrl(fileId: string): string;
38
+ /**
39
+ * Get file stream URL
40
+ */
41
+ getFileStreamUrl(fileId: string): string;
42
+ /**
43
+ * List user files
44
+ */
45
+ listUserFiles(userId: string, limit?: number, offset?: number, filters?: Record<string, any>): Promise<FileListResponse>;
46
+ /**
47
+ * Download file content
48
+ */
49
+ downloadFileContent(fileId: string): Promise<Response>;
50
+ /**
51
+ * Get file content as text
52
+ */
53
+ getFileContentAsText(fileId: string): Promise<string>;
54
+ /**
55
+ * Get file content as blob
56
+ */
57
+ getFileContentAsBlob(fileId: string): Promise<Blob>;
58
+ }
59
+ //# sourceMappingURL=FileService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileService.d.ts","sourceRoot":"","sources":["../../../../src/core/files/FileService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAEpD;;GAEG;AACH,qBAAa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