@oxyhq/services 5.16.42 → 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 +23 -25
- package/lib/commonjs/adapters/index.js.map +1 -1
- package/lib/module/adapters/index.js +23 -25
- package/lib/module/adapters/index.js.map +1 -1
- package/lib/typescript/adapters/index.d.ts +4 -6
- package/lib/typescript/adapters/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/index.ts +24 -23
|
@@ -8,43 +8,41 @@ var _expo = require("./expo");
|
|
|
8
8
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
|
|
9
9
|
* Platform Adapters
|
|
10
10
|
*
|
|
11
|
-
* Factory function to create the appropriate platform adapter
|
|
12
|
-
*
|
|
13
|
-
* Uses dynamic imports for Node.js adapter to avoid Metro bundling Node-specific code
|
|
14
|
-
* in React Native environments.
|
|
11
|
+
* Factory function to create the appropriate platform adapter.
|
|
12
|
+
* Supports Expo 54 (frontend) and Node.js (backend).
|
|
15
13
|
*/
|
|
16
14
|
/**
|
|
17
15
|
* Detect platform and create appropriate adapter
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
18
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
21
19
|
*/
|
|
22
20
|
async function createPlatformAdapter() {
|
|
23
|
-
// Detect
|
|
24
|
-
const isNode = typeof process !== 'undefined' && process.versions?.node != null;
|
|
25
|
-
|
|
26
|
-
// Detect if we're in React Native
|
|
21
|
+
// Detect React Native/Expo first (frontend)
|
|
27
22
|
const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
23
|
+
if (isReactNative) {
|
|
24
|
+
return await (0, _expo.createExpoAdapter)();
|
|
25
|
+
}
|
|
28
26
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
// Check if we can import react-native (Expo Web)
|
|
28
|
+
try {
|
|
29
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require('react-native')));
|
|
30
|
+
return await (0, _expo.createExpoAdapter)();
|
|
31
|
+
} catch {
|
|
32
|
+
// Not Expo, must be Node.js (backend)
|
|
33
|
+
// Metro will return empty module for this path (configured in metro.config.js)
|
|
33
34
|
try {
|
|
34
|
-
|
|
35
|
-
|
|
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)
|
|
36
41
|
return await (0, _expo.createExpoAdapter)();
|
|
37
42
|
} catch {
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
const {
|
|
41
|
-
createNodeAdapter
|
|
42
|
-
} = await Promise.resolve().then(() => _interopRequireWildcard(require('./node/index.js')));
|
|
43
|
-
return await createNodeAdapter();
|
|
43
|
+
// Import failed, fallback to Expo adapter
|
|
44
|
+
return await (0, _expo.createExpoAdapter)();
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
// Default: Expo adapter (React Native or Web)
|
|
48
|
-
return await (0, _expo.createExpoAdapter)();
|
|
49
47
|
}
|
|
50
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,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAA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Factory function to create the appropriate platform adapter
|
|
7
|
-
*
|
|
8
|
-
* Uses dynamic imports for Node.js adapter to avoid Metro bundling Node-specific code
|
|
9
|
-
* in React Native environments.
|
|
6
|
+
* Factory function to create the appropriate platform adapter.
|
|
7
|
+
* Supports Expo 54 (frontend) and Node.js (backend).
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
10
|
import { createExpoAdapter } from './expo';
|
|
13
11
|
/**
|
|
14
12
|
* Detect platform and create appropriate adapter
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
15
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
18
16
|
*/
|
|
19
17
|
export async function createPlatformAdapter() {
|
|
20
|
-
// Detect
|
|
21
|
-
const isNode = typeof process !== 'undefined' && process.versions?.node != null;
|
|
22
|
-
|
|
23
|
-
// Detect if we're in React Native
|
|
18
|
+
// Detect React Native/Expo first (frontend)
|
|
24
19
|
const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
20
|
+
if (isReactNative) {
|
|
21
|
+
return await createExpoAdapter();
|
|
22
|
+
}
|
|
25
23
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
// Check if we can import react-native (Expo Web)
|
|
25
|
+
try {
|
|
26
|
+
await import('react-native');
|
|
27
|
+
return await createExpoAdapter();
|
|
28
|
+
} catch {
|
|
29
|
+
// Not Expo, must be Node.js (backend)
|
|
30
|
+
// Metro will return empty module for this path (configured in metro.config.js)
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
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)
|
|
33
38
|
return await createExpoAdapter();
|
|
34
39
|
} catch {
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
const {
|
|
38
|
-
createNodeAdapter
|
|
39
|
-
} = await import('./node/index.js');
|
|
40
|
-
return await createNodeAdapter();
|
|
40
|
+
// Import failed, fallback to Expo adapter
|
|
41
|
+
return await createExpoAdapter();
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
// Default: Expo adapter (React Native or Web)
|
|
45
|
-
return await createExpoAdapter();
|
|
46
44
|
}
|
|
47
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createExpoAdapter","createPlatformAdapter","
|
|
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":[]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Platform Adapters
|
|
3
3
|
*
|
|
4
|
-
* Factory function to create the appropriate platform adapter
|
|
5
|
-
*
|
|
6
|
-
* Uses dynamic imports for Node.js adapter to avoid Metro bundling Node-specific code
|
|
7
|
-
* in React Native environments.
|
|
4
|
+
* Factory function to create the appropriate platform adapter.
|
|
5
|
+
* Supports Expo 54 (frontend) and Node.js (backend).
|
|
8
6
|
*/
|
|
9
7
|
import { type PlatformAdapter as ExpoPlatformAdapter } from './expo';
|
|
10
8
|
import type { PlatformAdapter as NodePlatformAdapter } from './node';
|
|
@@ -12,8 +10,8 @@ export type PlatformAdapter = ExpoPlatformAdapter | NodePlatformAdapter;
|
|
|
12
10
|
/**
|
|
13
11
|
* Detect platform and create appropriate adapter
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
14
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
17
15
|
*/
|
|
18
16
|
export declare function createPlatformAdapter(): Promise<PlatformAdapter>;
|
|
19
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA
|
|
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
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Platform Adapters
|
|
3
3
|
*
|
|
4
|
-
* Factory function to create the appropriate platform adapter
|
|
5
|
-
*
|
|
6
|
-
* Uses dynamic imports for Node.js adapter to avoid Metro bundling Node-specific code
|
|
7
|
-
* in React Native environments.
|
|
4
|
+
* Factory function to create the appropriate platform adapter.
|
|
5
|
+
* Supports Expo 54 (frontend) and Node.js (backend).
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import { createExpoAdapter, type PlatformAdapter as ExpoPlatformAdapter } from './expo';
|
|
@@ -15,33 +13,36 @@ export type PlatformAdapter = ExpoPlatformAdapter | NodePlatformAdapter;
|
|
|
15
13
|
/**
|
|
16
14
|
* Detect platform and create appropriate adapter
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Simple detection: Expo (frontend) or Node.js (backend)
|
|
17
|
+
* Uses synchronous detection first to prevent Metro from analyzing Node imports
|
|
20
18
|
*/
|
|
21
19
|
export async function createPlatformAdapter(): Promise<PlatformAdapter> {
|
|
22
|
-
// Detect
|
|
23
|
-
const isNode = typeof process !== 'undefined' && process.versions?.node != null;
|
|
24
|
-
|
|
25
|
-
// Detect if we're in React Native
|
|
20
|
+
// Detect React Native/Expo first (frontend)
|
|
26
21
|
const isReactNative = typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
if (isReactNative) {
|
|
24
|
+
return await createExpoAdapter();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check if we can import react-native (Expo Web)
|
|
28
|
+
try {
|
|
29
|
+
await import('react-native');
|
|
30
|
+
return await createExpoAdapter();
|
|
31
|
+
} catch {
|
|
32
|
+
// Not Expo, must be Node.js (backend)
|
|
33
|
+
// Metro will return empty module for this path (configured in metro.config.js)
|
|
32
34
|
try {
|
|
33
|
-
|
|
34
|
-
|
|
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)
|
|
35
41
|
return await createExpoAdapter();
|
|
36
42
|
} catch {
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
const { createNodeAdapter } = await import('./node/index.js');
|
|
40
|
-
return await createNodeAdapter();
|
|
43
|
+
// Import failed, fallback to Expo adapter
|
|
44
|
+
return await createExpoAdapter();
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
|
|
44
|
-
// Default: Expo adapter (React Native or Web)
|
|
45
|
-
return await createExpoAdapter();
|
|
46
47
|
}
|
|
47
48
|
|