@sazabi/react-native 0.0.0-stage → 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.
@@ -0,0 +1,108 @@
1
+ import type { ConsoleCaptureConfig, NetworkCaptureConfig as CoreNetworkCaptureConfig, PointerCaptureConfig } from "./client-sdk-core/index.js";
2
+ export type { AttributeValue, ClientEvent, ClientEventType, ConsoleCaptureConfig, ConsoleCaptureLevel, EventAttributes, EventSeverity, PointerCaptureConfig, } from "./client-sdk-core/index.js";
3
+ /**
4
+ * Persistent key-value storage the SDK writes sessions, identity, and the
5
+ * crash outbox to. `@react-native-async-storage/async-storage`, MMKV
6
+ * wrappers, and `expo-sqlite/kv-store` all satisfy it; a synchronous store
7
+ * makes the crash outbox reliable on a fatal error.
8
+ */
9
+ export interface StorageAdapter {
10
+ getItem(key: string): string | null | Promise<string | null>;
11
+ setItem(key: string, value: string): void | Promise<void>;
12
+ removeItem(key: string): void | Promise<void>;
13
+ /**
14
+ * Every key the store holds (AsyncStorage's `getAllKeys`, MMKV's
15
+ * `getAllKeys`). Optional: with it, a launch recovers a crash report whose
16
+ * own key was written but whose index entry never landed because the
17
+ * process died between the two writes. Without it such a report is lost.
18
+ */
19
+ getAllKeys?(): readonly string[] | Promise<readonly string[]>;
20
+ }
21
+ export interface NetworkCaptureConfig extends CoreNetworkCaptureConfig {
22
+ /**
23
+ * Requests eligible for `traceparent` injection. A string is a host
24
+ * (`api.example.com`), a domain with every subdomain (`.example.com`), or
25
+ * an origin with an optional path prefix (`https://api.example.com`); a
26
+ * RegExp is tested against the full URL. Default: every request except
27
+ * the intake endpoint. A native app has no origin and no CORS preflight,
28
+ * so injection is on everywhere unless narrowed here.
29
+ */
30
+ allowlist?: (string | RegExp)[];
31
+ }
32
+ /**
33
+ * What `HermesInternal.enablePromiseRejectionTracker` takes: the shape every
34
+ * React Native crash reporter installs.
35
+ */
36
+ export interface RejectionTracker {
37
+ allRejections: boolean;
38
+ onUnhandled(id: number, rejection: unknown): void;
39
+ onHandled?(id: number): void;
40
+ }
41
+ export interface ErrorCaptureConfig {
42
+ /**
43
+ * Track unhandled promise rejections through Hermes's rejection tracker.
44
+ * Hermes has one tracker slot, so turn this off when another SDK owns it.
45
+ * Default true.
46
+ */
47
+ unhandledRejections?: boolean;
48
+ /**
49
+ * The tracker another library installed before `init()`, to run after the
50
+ * SDK's own on every rejection. Hermes gives no way to read the slot's
51
+ * occupant (`HermesInternal` is frozen and its global pinned), so `init()`
52
+ * replaces whatever holds it; hand that tracker over here to keep it
53
+ * running. A tracker installed after `init()` replaces the SDK's instead.
54
+ */
55
+ previousRejectionTracker?: RejectionTracker;
56
+ }
57
+ /** The subset of a React Navigation container ref the SDK subscribes to. */
58
+ export interface NavigationContainerRefLike {
59
+ addListener(type: "state", listener: () => void): () => void;
60
+ getCurrentRoute(): {
61
+ key?: string | undefined;
62
+ name: string;
63
+ params?: object | undefined;
64
+ path?: string | undefined;
65
+ } | undefined;
66
+ }
67
+ export interface ReactNativeSdkConfig {
68
+ /**
69
+ * The project's intake URL, exactly as the log source issues it, e.g.
70
+ * `https://<key>.us-west-2.intake.sazabi.com`. The credential is embedded in
71
+ * the hostname, so this is normally the only endpoint config needed; `/v1/logs`
72
+ * may be included or omitted.
73
+ */
74
+ intakeUrl?: string;
75
+ /**
76
+ * Public ingest key (`sazabi_public_...`). Optional: derived from `intakeUrl`
77
+ * when that URL is a keyed intake host. Set it only for a proxy or custom
78
+ * endpoint whose hostname carries no key.
79
+ */
80
+ publicKey?: string;
81
+ /** Logical service name for the app. */
82
+ serviceName: string;
83
+ /** App version (e.g. the marketing version or a git SHA). */
84
+ serviceVersion?: string;
85
+ /** Deployment environment (e.g. "production"). */
86
+ environment?: string;
87
+ /** Session persistence and the crash outbox. Without it, sessions last one launch. */
88
+ storage?: StorageAdapter;
89
+ network?: NetworkCaptureConfig;
90
+ console?: ConsoleCaptureConfig;
91
+ pointer?: PointerCaptureConfig;
92
+ errors?: ErrorCaptureConfig;
93
+ /**
94
+ * Consent gate: capture holds until this resolves true. When it resolves
95
+ * false the SDK stays dormant.
96
+ */
97
+ consent?: () => boolean | Promise<boolean>;
98
+ /** Batch flush cadence in ms. Default 5000. */
99
+ flushIntervalMs?: number;
100
+ /** Soft cap per OTLP request body in bytes. Default 57344. */
101
+ maxBatchBytes?: number;
102
+ /**
103
+ * Max buffered events (and at most 1 MiB) while the intake is unreachable;
104
+ * the oldest are dropped first and counted in `app.sdk.dropped_events`.
105
+ * Default 500.
106
+ */
107
+ maxQueuedEvents?: number;
108
+ }
@@ -0,0 +1,4 @@
1
+ export declare const SDK_NAME = "@sazabi/react-native";
2
+ export declare const SDK_VERSION = "0.1.0";
3
+ /** SDK-emitted console lines carry this prefix and are never re-captured. */
4
+ export declare const SDK_CONSOLE_PREFIX = "[@sazabi/react-native]";
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@sazabi/react-native",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Sazabi React Native observability SDK — semantic event stream capture with W3C trace context propagation",
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./register": {
14
+ "types": "./dist/register.d.ts",
15
+ "default": "./dist/register.js"
16
+ },
17
+ "./dist/register.js": {
18
+ "types": "./dist/register.d.ts",
19
+ "default": "./dist/register.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "react-native": {
24
+ "./register": "./dist/register.js"
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "peerDependencies": {
30
+ "react": ">=18",
31
+ "react-native": ">=0.76"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "react-native": {
35
+ "optional": true
36
+ }
37
+ },
38
+ "sideEffects": [
39
+ "./dist/register.js"
40
+ ],
41
+ "license": "Apache-2.0",
42
+ "homepage": "https://github.com/sazabi/react-native",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/sazabi/react-native.git"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public",
49
+ "registry": "https://registry.npmjs.org"
50
+ }
51
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.