@oxyhq/services 5.16.43 → 5.16.44
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/lib/commonjs/adapters/index.js +20 -9
- package/lib/commonjs/adapters/index.js.map +1 -1
- package/lib/module/adapters/index.js +20 -9
- package/lib/module/adapters/index.js.map +1 -1
- package/lib/typescript/adapters/index.d.ts +1 -1
- package/lib/typescript/adapters/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/index.ts +21 -7
|
@@ -15,23 +15,34 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
15
15
|
* Detect platform and create appropriate adapter
|
|
16
16
|
*
|
|
17
17
|
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
18
|
-
* Uses
|
|
18
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
19
19
|
*/
|
|
20
20
|
async function createPlatformAdapter() {
|
|
21
21
|
// Detect React Native/Expo first (frontend)
|
|
22
|
-
|
|
22
|
+
const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
23
|
+
if (isReactNative) {
|
|
24
|
+
return await (0, _expo.createExpoAdapter)();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check if we can import react-native (Expo Web)
|
|
23
28
|
try {
|
|
24
29
|
await Promise.resolve().then(() => _interopRequireWildcard(require('react-native')));
|
|
25
|
-
// Expo (React Native or Web)
|
|
26
30
|
return await (0, _expo.createExpoAdapter)();
|
|
27
31
|
} catch {
|
|
28
32
|
// Not Expo, must be Node.js (backend)
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// Metro will return empty module for this path (configured in metro.config.js)
|
|
34
|
+
try {
|
|
35
|
+
const nodePath = './node' + '/index.js';
|
|
36
|
+
const nodeModule = await (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(nodePath);
|
|
37
|
+
if (nodeModule.createNodeAdapter) {
|
|
38
|
+
return await nodeModule.createNodeAdapter();
|
|
39
|
+
}
|
|
40
|
+
// If Metro returned empty module, fallback to Expo (shouldn't happen in Node.js)
|
|
41
|
+
return await (0, _expo.createExpoAdapter)();
|
|
42
|
+
} catch {
|
|
43
|
+
// Import failed, fallback to Expo adapter
|
|
44
|
+
return await (0, _expo.createExpoAdapter)();
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_expo","require","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createPlatformAdapter","
|
|
1
|
+
{"version":3,"names":["_expo","require","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createPlatformAdapter","isReactNative","navigator","product","createExpoAdapter","Promise","resolve","then","nodePath","nodeModule","specifier","s","createNodeAdapter"],"sourceRoot":"../../../src","sources":["adapters/index.ts"],"mappings":";;;;;;AAOA,IAAAA,KAAA,GAAAC,OAAA;AAAwF,SAAAC,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,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CAACG,iBAAiB,EAAE;QAChC,OAAO,MAAMH,UAAU,CAACG,iBAAiB,CAAC,CAAC;MAC7C;MACA;MACA,OAAO,MAAM,IAAAR,uBAAiB,EAAC,CAAC;IAClC,CAAC,CAAC,MAAM;MACN;MACA,OAAO,MAAM,IAAAA,uBAAiB,EAAC,CAAC;IAClC;EACF;AACF","ignoreList":[]}
|
|
@@ -12,23 +12,34 @@ import { createExpoAdapter } from './expo';
|
|
|
12
12
|
* Detect platform and create appropriate adapter
|
|
13
13
|
*
|
|
14
14
|
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
15
|
-
* Uses
|
|
15
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
16
16
|
*/
|
|
17
17
|
export async function createPlatformAdapter() {
|
|
18
18
|
// Detect React Native/Expo first (frontend)
|
|
19
|
-
|
|
19
|
+
const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
20
|
+
if (isReactNative) {
|
|
21
|
+
return await createExpoAdapter();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Check if we can import react-native (Expo Web)
|
|
20
25
|
try {
|
|
21
26
|
await import('react-native');
|
|
22
|
-
// Expo (React Native or Web)
|
|
23
27
|
return await createExpoAdapter();
|
|
24
28
|
} catch {
|
|
25
29
|
// Not Expo, must be Node.js (backend)
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
// Metro will return empty module for this path (configured in metro.config.js)
|
|
31
|
+
try {
|
|
32
|
+
const nodePath = './node' + '/index.js';
|
|
33
|
+
const nodeModule = await import(nodePath);
|
|
34
|
+
if (nodeModule.createNodeAdapter) {
|
|
35
|
+
return await nodeModule.createNodeAdapter();
|
|
36
|
+
}
|
|
37
|
+
// If Metro returned empty module, fallback to Expo (shouldn't happen in Node.js)
|
|
38
|
+
return await createExpoAdapter();
|
|
39
|
+
} catch {
|
|
40
|
+
// Import failed, fallback to Expo adapter
|
|
41
|
+
return await createExpoAdapter();
|
|
42
|
+
}
|
|
32
43
|
}
|
|
33
44
|
}
|
|
34
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createExpoAdapter","createPlatformAdapter","nodePath","createNodeAdapter"],"sourceRoot":"../../../src","sources":["adapters/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAqD,QAAQ;AAKvF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,qBAAqBA,CAAA,EAA6B;EACtE;EACA;EACA,IAAI;IACF,MAAM,MAAM,CAAC,cAAc,CAAC;IAC5B
|
|
1
|
+
{"version":3,"names":["createExpoAdapter","createPlatformAdapter","isReactNative","navigator","product","nodePath","nodeModule","createNodeAdapter"],"sourceRoot":"../../../src","sources":["adapters/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAqD,QAAQ;AAKvF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,qBAAqBA,CAAA,EAA6B;EACtE;EACA,MAAMC,aAAa,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,OAAO,KAAK,aAAa;EAE7F,IAAIF,aAAa,EAAE;IACjB,OAAO,MAAMF,iBAAiB,CAAC,CAAC;EAClC;;EAEA;EACA,IAAI;IACF,MAAM,MAAM,CAAC,cAAc,CAAC;IAC5B,OAAO,MAAMA,iBAAiB,CAAC,CAAC;EAClC,CAAC,CAAC,MAAM;IACN;IACA;IACA,IAAI;MACF,MAAMK,QAAQ,GAAG,QAAQ,GAAG,WAAW;MACvC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAACD,QAAQ,CAAC;MACzC,IAAIC,UAAU,CAACC,iBAAiB,EAAE;QAChC,OAAO,MAAMD,UAAU,CAACC,iBAAiB,CAAC,CAAC;MAC7C;MACA;MACA,OAAO,MAAMP,iBAAiB,CAAC,CAAC;IAClC,CAAC,CAAC,MAAM;MACN;MACA,OAAO,MAAMA,iBAAiB,CAAC,CAAC;IAClC;EACF;AACF","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ export type PlatformAdapter = ExpoPlatformAdapter | NodePlatformAdapter;
|
|
|
11
11
|
* Detect platform and create appropriate adapter
|
|
12
12
|
*
|
|
13
13
|
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
14
|
-
* Uses
|
|
14
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
15
15
|
*/
|
|
16
16
|
export declare function createPlatformAdapter(): Promise<PlatformAdapter>;
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAExE;;;;;GAKG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqB,KAAK,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAExE;;;;;GAKG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CA4BtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "5.16.
|
|
3
|
+
"version": "5.16.44",
|
|
4
4
|
"description": "Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
package/src/adapters/index.ts
CHANGED
|
@@ -14,21 +14,35 @@ export type PlatformAdapter = ExpoPlatformAdapter | NodePlatformAdapter;
|
|
|
14
14
|
* Detect platform and create appropriate adapter
|
|
15
15
|
*
|
|
16
16
|
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
17
|
-
* Uses
|
|
17
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
18
18
|
*/
|
|
19
19
|
export async function createPlatformAdapter(): Promise<PlatformAdapter> {
|
|
20
20
|
// Detect React Native/Expo first (frontend)
|
|
21
|
-
|
|
21
|
+
const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
22
|
+
|
|
23
|
+
if (isReactNative) {
|
|
24
|
+
return await createExpoAdapter();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check if we can import react-native (Expo Web)
|
|
22
28
|
try {
|
|
23
29
|
await import('react-native');
|
|
24
|
-
// Expo (React Native or Web)
|
|
25
30
|
return await createExpoAdapter();
|
|
26
31
|
} catch {
|
|
27
32
|
// Not Expo, must be Node.js (backend)
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
// Metro will return empty module for this path (configured in metro.config.js)
|
|
34
|
+
try {
|
|
35
|
+
const nodePath = './node' + '/index.js';
|
|
36
|
+
const nodeModule = await import(nodePath);
|
|
37
|
+
if (nodeModule.createNodeAdapter) {
|
|
38
|
+
return await nodeModule.createNodeAdapter();
|
|
39
|
+
}
|
|
40
|
+
// If Metro returned empty module, fallback to Expo (shouldn't happen in Node.js)
|
|
41
|
+
return await createExpoAdapter();
|
|
42
|
+
} catch {
|
|
43
|
+
// Import failed, fallback to Expo adapter
|
|
44
|
+
return await createExpoAdapter();
|
|
45
|
+
}
|
|
32
46
|
}
|
|
33
47
|
}
|
|
34
48
|
|