@oxyhq/services 5.1.27 → 5.1.28

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 CHANGED
@@ -88,6 +88,37 @@ yarn add react-native-gesture-handler react-native-reanimated react-native-safe-
88
88
 
89
89
  Note: The bottom sheet is now managed internally by the package, so you no longer need to install `@gorhom/bottom-sheet` directly.
90
90
 
91
+ ## Backend Usage (Node.js)
92
+
93
+ For Node.js backend environments, use the backend-specific import to avoid React Native dependencies:
94
+
95
+ ```typescript
96
+ // ✅ Backend-safe import (no React Native dependencies)
97
+ import { OxyServices } from '@oxyhq/services/backend';
98
+
99
+ const oxyServices = new OxyServices({
100
+ baseURL: 'https://your-api.com'
101
+ });
102
+
103
+ // Use in your API routes
104
+ app.post('/api/auth/login', async (req, res) => {
105
+ const { username, password } = req.body;
106
+ const response = await oxyServices.login(username, password);
107
+ res.json(response);
108
+ });
109
+ ```
110
+
111
+ 📖 **See [Backend Usage Guide](docs/BACKEND_USAGE.md) for complete documentation.**
112
+
113
+ ## Frontend Usage (React Native/Web)
114
+
115
+ For React Native and web applications, import the full package:
116
+
117
+ ```typescript
118
+ // ✅ Full package with UI components
119
+ import { OxyServices, OxyProvider, useOxy } from '@oxyhq/services';
120
+ ```
121
+
91
122
  ## Examples
92
123
 
93
124
  ### File Management
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ OxyServices: true,
8
+ OXY_CLOUD_URL: true
9
+ };
10
+ Object.defineProperty(exports, "OXY_CLOUD_URL", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _core.OXY_CLOUD_URL;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "OxyServices", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _core.OxyServices;
20
+ }
21
+ });
22
+ exports.default = void 0;
23
+ var _core = require("./core");
24
+ var _interfaces = require("./models/interfaces");
25
+ Object.keys(_interfaces).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _interfaces[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _interfaces[key];
33
+ }
34
+ });
35
+ });
36
+ /**
37
+ * Backend-only exports for Node.js environments
38
+ * This file exports only the core functionality without React Native dependencies
39
+ */
40
+ // Export core services
41
+ // Export models/interfaces
42
+ // Default export for backward compatibility
43
+ var _default = exports.default = _core.OxyServices;
44
+ //# sourceMappingURL=backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_interfaces","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_default","default","OxyServices"],"sourceRoot":"../../src","sources":["backend.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAVA;AACA;AACA;AACA;AAEA;AAIA;AAGA;AAAA,IAAAS,QAAA,GAAAJ,OAAA,CAAAK,OAAA,GACeC,iBAAW","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ OxyServices: true,
8
+ OXY_CLOUD_URL: true
9
+ };
10
+ Object.defineProperty(exports, "OXY_CLOUD_URL", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _core.OXY_CLOUD_URL;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "OxyServices", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _core.OxyServices;
20
+ }
21
+ });
22
+ exports.default = void 0;
23
+ var _core = require("./core");
24
+ var _interfaces = require("./models/interfaces");
25
+ Object.keys(_interfaces).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _interfaces[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _interfaces[key];
33
+ }
34
+ });
35
+ });
36
+ /**
37
+ * Core OxyServices exports without React Native dependencies
38
+ * Use this import path for Node.js backend environments
39
+ */
40
+ // Export core services only
41
+ // Export models/interfaces
42
+ // Default export for backward compatibility
43
+ var _default = exports.default = _core.OxyServices;
44
+ //# sourceMappingURL=core-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_interfaces","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_default","default","OxyServices"],"sourceRoot":"../../src","sources":["core-only.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAVA;AACA;AACA;AACA;AAEA;AAIA;AAGA;AAAA,IAAAS,QAAA,GAAAJ,OAAA,CAAAK,OAAA,GACeC,iBAAW","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.oxyServices = void 0;
7
+ var _backend = require("./backend");
8
+ /**
9
+ * Test file to verify backend-only imports work in Node.js
10
+ * This should not import any React Native dependencies
11
+ */
12
+
13
+ // Test importing the backend-only version
14
+
15
+ // Test that we can create an instance
16
+ const oxyServices = exports.oxyServices = new _backend.OxyServices({
17
+ baseURL: 'https://api.example.com'
18
+ });
19
+ console.log('Backend import test successful!');
20
+ console.log('OxyServices instance created:', !!oxyServices);
21
+ //# sourceMappingURL=test-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_backend","require","oxyServices","exports","OxyServices","baseURL","console","log"],"sourceRoot":"../../src","sources":["test-backend.ts"],"mappings":";;;;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;;AAEA;;AAGA;AACA,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAIE,oBAAW,CAAC;EAClCC,OAAO,EAAE;AACX,CAAC,CAAC;AAEFC,OAAO,CAACC,GAAG,CAAC,iCAAiC,CAAC;AAC9CD,OAAO,CAACC,GAAG,CAAC,+BAA+B,EAAE,CAAC,CAACL,WAAW,CAAC","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Backend-only exports for Node.js environments
5
+ * This file exports only the core functionality without React Native dependencies
6
+ */
7
+
8
+ // Export core services
9
+ export { OxyServices, OXY_CLOUD_URL } from './core';
10
+ import { OxyServices } from './core';
11
+
12
+ // Export models/interfaces
13
+ export * from './models/interfaces';
14
+
15
+ // Default export for backward compatibility
16
+ export default OxyServices;
17
+ //# sourceMappingURL=backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OxyServices","OXY_CLOUD_URL"],"sourceRoot":"../../src","sources":["backend.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA;AACA,SAASA,WAAW,EAAEC,aAAa,QAAQ,QAAQ;AACnD,SAASD,WAAW,QAAQ,QAAQ;;AAEpC;AACA,cAAc,qBAAqB;;AAEnC;AACA,eAAeA,WAAW","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Core OxyServices exports without React Native dependencies
5
+ * Use this import path for Node.js backend environments
6
+ */
7
+
8
+ // Export core services only
9
+ export { OxyServices, OXY_CLOUD_URL } from './core';
10
+ import { OxyServices } from './core';
11
+
12
+ // Export models/interfaces
13
+ export * from './models/interfaces';
14
+
15
+ // Default export for backward compatibility
16
+ export default OxyServices;
17
+ //# sourceMappingURL=core-only.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OxyServices","OXY_CLOUD_URL"],"sourceRoot":"../../src","sources":["core-only.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA;AACA,SAASA,WAAW,EAAEC,aAAa,QAAQ,QAAQ;AACnD,SAASD,WAAW,QAAQ,QAAQ;;AAEpC;AACA,cAAc,qBAAqB;;AAEnC;AACA,eAAeA,WAAW","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Test file to verify backend-only imports work in Node.js
5
+ * This should not import any React Native dependencies
6
+ */
7
+
8
+ // Test importing the backend-only version
9
+ import { OxyServices } from './backend';
10
+
11
+ // Test that we can create an instance
12
+ const oxyServices = new OxyServices({
13
+ baseURL: 'https://api.example.com'
14
+ });
15
+ console.log('Backend import test successful!');
16
+ console.log('OxyServices instance created:', !!oxyServices);
17
+ export { oxyServices };
18
+ //# sourceMappingURL=test-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OxyServices","oxyServices","baseURL","console","log"],"sourceRoot":"../../src","sources":["test-backend.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA;AACA,SAASA,WAAW,QAAQ,WAAW;;AAEvC;AACA,MAAMC,WAAW,GAAG,IAAID,WAAW,CAAC;EAClCE,OAAO,EAAE;AACX,CAAC,CAAC;AAEFC,OAAO,CAACC,GAAG,CAAC,iCAAiC,CAAC;AAC9CD,OAAO,CAACC,GAAG,CAAC,+BAA+B,EAAE,CAAC,CAACH,WAAW,CAAC;AAE3D,SAASA,WAAW","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Backend-only exports for Node.js environments
3
+ * This file exports only the core functionality without React Native dependencies
4
+ */
5
+ export { OxyServices, OXY_CLOUD_URL } from './core';
6
+ import { OxyServices } from './core';
7
+ export * from './models/interfaces';
8
+ export default OxyServices;
9
+ //# sourceMappingURL=backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,cAAc,qBAAqB,CAAC;AAGpC,eAAe,WAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Core OxyServices exports without React Native dependencies
3
+ * Use this import path for Node.js backend environments
4
+ */
5
+ export { OxyServices, OXY_CLOUD_URL } from './core';
6
+ import { OxyServices } from './core';
7
+ export * from './models/interfaces';
8
+ export default OxyServices;
9
+ //# sourceMappingURL=core-only.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-only.d.ts","sourceRoot":"","sources":["../../src/core-only.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,cAAc,qBAAqB,CAAC;AAGpC,eAAe,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Test file to verify backend-only imports work in Node.js
3
+ * This should not import any React Native dependencies
4
+ */
5
+ import { OxyServices } from './backend';
6
+ declare const oxyServices: OxyServices;
7
+ export { oxyServices };
8
+ //# sourceMappingURL=test-backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-backend.d.ts","sourceRoot":"","sources":["../../src/test-backend.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,QAAA,MAAM,WAAW,aAEf,CAAC;AAKH,OAAO,EAAE,WAAW,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,30 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "5.1.27",
3
+ "version": "5.1.28",
4
4
  "description": "Reusable OxyHQ module to handle authentication, user management, karma system and more 🚀",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
7
7
  "types": "lib/typescript/index.d.ts",
8
8
  "react-native": "src/index.ts",
9
9
  "source": "src/index.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./lib/typescript/index.d.ts",
13
+ "import": "./lib/module/index.js",
14
+ "require": "./lib/commonjs/index.js",
15
+ "react-native": "./src/index.ts"
16
+ },
17
+ "./core": {
18
+ "types": "./lib/typescript/core-only.d.ts",
19
+ "import": "./lib/module/core-only.js",
20
+ "require": "./lib/commonjs/core-only.js"
21
+ },
22
+ "./backend": {
23
+ "types": "./lib/typescript/backend.d.ts",
24
+ "import": "./lib/module/backend.js",
25
+ "require": "./lib/commonjs/backend.js"
26
+ }
27
+ },
10
28
  "files": [
11
29
  "src",
12
30
  "lib",
package/src/backend.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Backend-only exports for Node.js environments
3
+ * This file exports only the core functionality without React Native dependencies
4
+ */
5
+
6
+ // Export core services
7
+ export { OxyServices, OXY_CLOUD_URL } from './core';
8
+ import { OxyServices } from './core';
9
+
10
+ // Export models/interfaces
11
+ export * from './models/interfaces';
12
+
13
+ // Default export for backward compatibility
14
+ export default OxyServices;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Core OxyServices exports without React Native dependencies
3
+ * Use this import path for Node.js backend environments
4
+ */
5
+
6
+ // Export core services only
7
+ export { OxyServices, OXY_CLOUD_URL } from './core';
8
+ import { OxyServices } from './core';
9
+
10
+ // Export models/interfaces
11
+ export * from './models/interfaces';
12
+
13
+ // Default export for backward compatibility
14
+ export default OxyServices;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Test file to verify backend-only imports work in Node.js
3
+ * This should not import any React Native dependencies
4
+ */
5
+
6
+ // Test importing the backend-only version
7
+ import { OxyServices } from './backend';
8
+
9
+ // Test that we can create an instance
10
+ const oxyServices = new OxyServices({
11
+ baseURL: 'https://api.example.com'
12
+ });
13
+
14
+ console.log('Backend import test successful!');
15
+ console.log('OxyServices instance created:', !!oxyServices);
16
+
17
+ export { oxyServices };