@oxyhq/services 5.16.41 → 5.16.43

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.
@@ -5,37 +5,33 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createPlatformAdapter = createPlatformAdapter;
7
7
  var _expo = require("./expo");
8
- var _node = require("./node");
9
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); } /**
10
9
  * Platform Adapters
11
10
  *
12
- * Factory function to create the appropriate platform adapter
11
+ * Factory function to create the appropriate platform adapter.
12
+ * Supports Expo 54 (frontend) and Node.js (backend).
13
13
  */
14
14
  /**
15
15
  * Detect platform and create appropriate adapter
16
+ *
17
+ * Simple detection: Expo (frontend) or Node.js (backend)
18
+ * Uses dynamic import with constructed path to avoid Metro static analysis
16
19
  */
17
20
  async function createPlatformAdapter() {
18
- // Check if we're in Node.js
19
- if (typeof process !== 'undefined' && process.versions != null && process.versions.node != null) {
20
- // Check if we're in a React Native/Expo environment
21
- try {
22
- // Try to detect React Native
23
- if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
24
- return await (0, _expo.createExpoAdapter)();
25
- }
26
-
27
- // Check for Expo in Node (unlikely but possible)
28
- const Platform = await Promise.resolve().then(() => _interopRequireWildcard(require('react-native'))).then(m => m.Platform).catch(() => null);
29
- if (Platform) {
30
- return await (0, _expo.createExpoAdapter)();
31
- }
32
- } catch {
33
- // Not React Native, use Node adapter
34
- }
35
- return await (0, _node.createNodeAdapter)();
21
+ // Detect React Native/Expo first (frontend)
22
+ // If we can import react-native, we're in Expo environment
23
+ try {
24
+ await Promise.resolve().then(() => _interopRequireWildcard(require('react-native')));
25
+ // Expo (React Native or Web)
26
+ return await (0, _expo.createExpoAdapter)();
27
+ } catch {
28
+ // Not Expo, must be Node.js (backend)
29
+ // Construct path dynamically to avoid Metro static analysis
30
+ const nodePath = './node' + '/index.js';
31
+ const {
32
+ createNodeAdapter
33
+ } = await (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(nodePath);
34
+ return await createNodeAdapter();
36
35
  }
37
-
38
- // Default to Expo adapter (React Native or Web)
39
- return await (0, _expo.createExpoAdapter)();
40
36
  }
41
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_expo","require","_node","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","createPlatformAdapter","process","versions","node","navigator","product","createExpoAdapter","Platform","Promise","resolve","then","m","catch","createNodeAdapter"],"sourceRoot":"../../../src","sources":["adapters/index.ts"],"mappings":";;;;;;AAMA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAwF,SAAAE,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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IAAAO,uBAAiB,EAAC,CAAC;EAClC;;EAEA;EACA,OAAO,MAAM,IAAAP,uBAAiB,EAAC,CAAC;AAClC","ignoreList":[]}
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","Promise","resolve","then","createExpoAdapter","nodePath","createNodeAdapter","specifier","s"],"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,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA,KAPxF;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACO,eAAekB,qBAAqBA,CAAA,EAA6B;EACtE;EACA;EACA,IAAI;IACF,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAAvB,uBAAA,CAAAD,OAAA,CAAa,cAAc,GAAC;IAC5B;IACA,OAAO,MAAM,IAAAyB,uBAAiB,EAAC,CAAC;EAClC,CAAC,CAAC,MAAM;IACN;IACA;IACA,MAAMC,QAAQ,GAAG,QAAQ,GAAG,WAAW;IACvC,MAAM;MAAEC;IAAkB,CAAC,GAAG,OAAAC,SAAA,QAAAN,OAAA,CAAAjB,CAAA,IAAAA,CAAA,IAAAuB,SAAA,KAAAJ,IAAA,CAAAK,CAAA,IAAA5B,uBAAA,CAAAD,OAAA,CAAA6B,CAAA,KAAaH,QAAQ,CAAC;IACpD,OAAO,MAAMC,iBAAiB,CAAC,CAAC;EAClC;AACF","ignoreList":[]}
@@ -3,36 +3,32 @@
3
3
  /**
4
4
  * Platform Adapters
5
5
  *
6
- * Factory function to create the appropriate platform adapter
6
+ * Factory function to create the appropriate platform adapter.
7
+ * Supports Expo 54 (frontend) and Node.js (backend).
7
8
  */
8
9
 
9
10
  import { createExpoAdapter } from './expo';
10
- import { createNodeAdapter } from './node';
11
11
  /**
12
12
  * Detect platform and create appropriate adapter
13
+ *
14
+ * Simple detection: Expo (frontend) or Node.js (backend)
15
+ * Uses dynamic import with constructed path to avoid Metro static analysis
13
16
  */
14
17
  export async function createPlatformAdapter() {
15
- // Check if we're in Node.js
16
- if (typeof process !== 'undefined' && process.versions != null && process.versions.node != null) {
17
- // Check if we're in a React Native/Expo environment
18
- try {
19
- // Try to detect React Native
20
- if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
21
- return await createExpoAdapter();
22
- }
23
-
24
- // Check for Expo in Node (unlikely but possible)
25
- const Platform = await import('react-native').then(m => m.Platform).catch(() => null);
26
- if (Platform) {
27
- return await createExpoAdapter();
28
- }
29
- } catch {
30
- // Not React Native, use Node adapter
31
- }
18
+ // Detect React Native/Expo first (frontend)
19
+ // If we can import react-native, we're in Expo environment
20
+ try {
21
+ await import('react-native');
22
+ // Expo (React Native or Web)
23
+ return await createExpoAdapter();
24
+ } catch {
25
+ // Not Expo, must be Node.js (backend)
26
+ // Construct path dynamically to avoid Metro static analysis
27
+ const nodePath = './node' + '/index.js';
28
+ const {
29
+ createNodeAdapter
30
+ } = await import(nodePath);
32
31
  return await createNodeAdapter();
33
32
  }
34
-
35
- // Default to Expo adapter (React Native or Web)
36
- return await createExpoAdapter();
37
33
  }
38
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createExpoAdapter","createNodeAdapter","createPlatformAdapter","process","versions","node","navigator","product","Platform","then","m","catch"],"sourceRoot":"../../../src","sources":["adapters/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAqD,QAAQ;AACvF,SAASC,iBAAiB,QAAqD,QAAQ;AAIvF;AACA;AACA;AACA,OAAO,eAAeC,qBAAqBA,CAAA,EAA6B;EACtE;EACA,IAAI,OAAOC,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACC,QAAQ,IAAI,IAAI,IAAID,OAAO,CAACC,QAAQ,CAACC,IAAI,IAAI,IAAI,EAAE;IAC/F;IACA,IAAI;MACF;MACA,IAAI,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,CAACC,OAAO,KAAK,aAAa,EAAE;QAC3E,OAAO,MAAMP,iBAAiB,CAAC,CAAC;MAClC;;MAEA;MACA,MAAMQ,QAAQ,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACF,QAAQ,CAAC,CAACG,KAAK,CAAC,MAAM,IAAI,CAAC;MACrF,IAAIH,QAAQ,EAAE;QACZ,OAAO,MAAMR,iBAAiB,CAAC,CAAC;MAClC;IACF,CAAC,CAAC,MAAM;MACN;IAAA;IAGF,OAAO,MAAMC,iBAAiB,CAAC,CAAC;EAClC;;EAEA;EACA,OAAO,MAAMD,iBAAiB,CAAC,CAAC;AAClC","ignoreList":[]}
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;IACA,OAAO,MAAMD,iBAAiB,CAAC,CAAC;EAClC,CAAC,CAAC,MAAM;IACN;IACA;IACA,MAAME,QAAQ,GAAG,QAAQ,GAAG,WAAW;IACvC,MAAM;MAAEC;IAAkB,CAAC,GAAG,MAAM,MAAM,CAACD,QAAQ,CAAC;IACpD,OAAO,MAAMC,iBAAiB,CAAC,CAAC;EAClC;AACF","ignoreList":[]}
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * Platform Adapters
3
3
  *
4
- * Factory function to create the appropriate platform adapter
4
+ * Factory function to create the appropriate platform adapter.
5
+ * Supports Expo 54 (frontend) and Node.js (backend).
5
6
  */
6
7
  import { type PlatformAdapter as ExpoPlatformAdapter } from './expo';
7
- import { type PlatformAdapter as NodePlatformAdapter } from './node';
8
+ import type { PlatformAdapter as NodePlatformAdapter } from './node';
8
9
  export type PlatformAdapter = ExpoPlatformAdapter | NodePlatformAdapter;
9
10
  /**
10
11
  * Detect platform and create appropriate adapter
12
+ *
13
+ * Simple detection: Expo (frontend) or Node.js (backend)
14
+ * Uses dynamic import with constructed path to avoid Metro static analysis
11
15
  */
12
16
  export declare function createPlatformAdapter(): Promise<PlatformAdapter>;
13
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,KAAK,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AACxF,OAAO,EAAqB,KAAK,eAAe,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAExF,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAExE;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CAwBtE"}
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,CActE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "5.16.41",
3
+ "version": "5.16.43",
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",
@@ -1,40 +1,34 @@
1
1
  /**
2
2
  * Platform Adapters
3
3
  *
4
- * Factory function to create the appropriate platform adapter
4
+ * Factory function to create the appropriate platform adapter.
5
+ * Supports Expo 54 (frontend) and Node.js (backend).
5
6
  */
6
7
 
7
8
  import { createExpoAdapter, type PlatformAdapter as ExpoPlatformAdapter } from './expo';
8
- import { createNodeAdapter, type PlatformAdapter as NodePlatformAdapter } from './node';
9
+ import type { PlatformAdapter as NodePlatformAdapter } from './node';
9
10
 
10
11
  export type PlatformAdapter = ExpoPlatformAdapter | NodePlatformAdapter;
11
12
 
12
13
  /**
13
14
  * Detect platform and create appropriate adapter
15
+ *
16
+ * Simple detection: Expo (frontend) or Node.js (backend)
17
+ * Uses dynamic import with constructed path to avoid Metro static analysis
14
18
  */
15
19
  export async function createPlatformAdapter(): Promise<PlatformAdapter> {
16
- // Check if we're in Node.js
17
- if (typeof process !== 'undefined' && process.versions != null && process.versions.node != null) {
18
- // Check if we're in a React Native/Expo environment
19
- try {
20
- // Try to detect React Native
21
- if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
22
- return await createExpoAdapter();
23
- }
24
-
25
- // Check for Expo in Node (unlikely but possible)
26
- const Platform = await import('react-native').then(m => m.Platform).catch(() => null);
27
- if (Platform) {
28
- return await createExpoAdapter();
29
- }
30
- } catch {
31
- // Not React Native, use Node adapter
32
- }
33
-
20
+ // Detect React Native/Expo first (frontend)
21
+ // If we can import react-native, we're in Expo environment
22
+ try {
23
+ await import('react-native');
24
+ // Expo (React Native or Web)
25
+ return await createExpoAdapter();
26
+ } catch {
27
+ // Not Expo, must be Node.js (backend)
28
+ // Construct path dynamically to avoid Metro static analysis
29
+ const nodePath = './node' + '/index.js';
30
+ const { createNodeAdapter } = await import(nodePath);
34
31
  return await createNodeAdapter();
35
32
  }
36
-
37
- // Default to Expo adapter (React Native or Web)
38
- return await createExpoAdapter();
39
33
  }
40
34