@nagoorkani/session-capture-expo 0.1.0
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/LICENSE +25 -0
- package/README.md +112 -0
- package/dist/device.d.ts +23 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.js +1824 -0
- package/dist/index.mjs +1801 -0
- package/dist/lifecycle.d.ts +20 -0
- package/dist/store-expo.d.ts +35 -0
- package/package.json +60 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native lifecycle glue.
|
|
3
|
+
*
|
|
4
|
+
* Device-only, like `device.ts`, and for the same reason: `react-native` is
|
|
5
|
+
* imported statically because Metro does not expose `require` as a global. The
|
|
6
|
+
* previous dynamic lookup meant `AppState` was never actually subscribed on a
|
|
7
|
+
* real device, so background and foreground transitions — and therefore
|
|
8
|
+
* timeout-based session rotation — silently never fired.
|
|
9
|
+
*
|
|
10
|
+
* Only `index.ts` imports this. Tests drive `core.onAppStateChange` directly.
|
|
11
|
+
*/
|
|
12
|
+
export type AppStateKind = 'active' | 'background';
|
|
13
|
+
export type Unsubscribe = () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Subscribe to foreground/background transitions.
|
|
16
|
+
*
|
|
17
|
+
* Returns a no-op unsubscribe if subscribing fails. A telemetry SDK must never
|
|
18
|
+
* be the reason an app fails to start.
|
|
19
|
+
*/
|
|
20
|
+
export declare function installLifecycleListener(onChange: (state: AppStateKind) => void): Unsubscribe;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent storage backed by `expo-file-system`.
|
|
3
|
+
*
|
|
4
|
+
* Device-only, like `device.ts` and `lifecycle.ts`: the import is static
|
|
5
|
+
* because Metro does not expose `require` as a global, and a dynamic lookup
|
|
6
|
+
* would silently yield nothing on a real device — which is exactly the class of
|
|
7
|
+
* bug that shipped undetected through two phases.
|
|
8
|
+
*
|
|
9
|
+
* Stored under the document directory rather than the cache directory. The OS
|
|
10
|
+
* empties the cache under storage pressure, and losing the queue at precisely
|
|
11
|
+
* the moment the device is struggling is the wrong trade.
|
|
12
|
+
*/
|
|
13
|
+
import { type FileStore } from '@nagoorkani/session-capture-core';
|
|
14
|
+
export declare class ExpoFileStore implements FileStore {
|
|
15
|
+
private readonly dir;
|
|
16
|
+
/**
|
|
17
|
+
* `directory` is a parameter because the queue and the remote-config cache
|
|
18
|
+
* must not share one. `SendQueue.peek()` treats every file it can see as a
|
|
19
|
+
* queued batch and *deletes* whatever fails to parse as one, so a config
|
|
20
|
+
* file stored alongside the queue would vanish on the first drain.
|
|
21
|
+
*/
|
|
22
|
+
constructor(directory?: string);
|
|
23
|
+
list(): Promise<string[]>;
|
|
24
|
+
read(name: string): Promise<string | null>;
|
|
25
|
+
write(name: string, contents: string): Promise<void>;
|
|
26
|
+
remove(name: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build the persistent store, or return null if it is unavailable.
|
|
30
|
+
*
|
|
31
|
+
* A telemetry SDK must never prevent an app from starting. Callers fall back
|
|
32
|
+
* to memory: events are then lost on process death, which is bad — but not as
|
|
33
|
+
* bad as refusing to run inside someone else's application.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createPersistentStore(directory?: string): FileStore | null;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nagoorkani/session-capture-expo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lightweight session capture and observability for Expo / React Native",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"expo",
|
|
17
|
+
"react-native",
|
|
18
|
+
"observability",
|
|
19
|
+
"session-replay",
|
|
20
|
+
"analytics"
|
|
21
|
+
],
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"expo": ">=50",
|
|
24
|
+
"expo-file-system": "*",
|
|
25
|
+
"react-native": ">=0.73"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^22.0.0",
|
|
29
|
+
"esbuild": "^0.24.2",
|
|
30
|
+
"typescript": "^5.6.0",
|
|
31
|
+
"expo-file-system": "~57.0.2",
|
|
32
|
+
"@nagoorkani/session-capture-core": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"expo-file-system": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/Nagoorkani2393/session-capture.git",
|
|
45
|
+
"directory": "sdk/expo"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/Nagoorkani2393/session-capture/tree/main/sdk/expo#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/Nagoorkani2393/session-capture/issues"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsc -p tsconfig.build.json --emitDeclarationOnly && esbuild src/index.ts --bundle --platform=neutral --target=es2020 --external:react-native --external:expo --external:expo-file-system --external:expo-modules-core --format=cjs --outfile=dist/index.js && esbuild src/index.ts --bundle --platform=neutral --target=es2020 --external:react-native --external:expo --external:expo-file-system --external:expo-modules-core --format=esm --outfile=dist/index.mjs",
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"test": "echo 'The suite lives in @nagoorkani/session-capture-core; what remains here needs a device.' && exit 0",
|
|
58
|
+
"size": "node scripts/size.mjs"
|
|
59
|
+
}
|
|
60
|
+
}
|