litesoc 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 LiteSOC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,388 @@
1
+ # LiteSOC Node.js SDK
2
+
3
+ Official Node.js/TypeScript SDK for [LiteSOC](https://litesoc.io) - Security event tracking and threat detection.
4
+
5
+ [![npm version](https://badge.fury.io/js/litesoc.svg)](https://www.npmjs.com/package/litesoc)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Features
10
+
11
+ - 🔒 **Type-safe** - Full TypeScript support with predefined event types
12
+ - ⚡ **Batching** - Automatic event batching to reduce network calls
13
+ - 🌐 **Universal** - Works in Node.js, Next.js (Server Side), and Edge runtimes
14
+ - 🔄 **Auto-retry** - Automatic retry on network failures
15
+ - 🤫 **Silent mode** - Fail silently without crashing your application
16
+ - 📦 **Zero dependencies** - Pure TypeScript, no external dependencies
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install litesoc
22
+ # or
23
+ yarn add litesoc
24
+ # or
25
+ pnpm add litesoc
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ```typescript
31
+ import { LiteSOC } from 'litesoc';
32
+
33
+ // Initialize the SDK
34
+ const litesoc = new LiteSOC({
35
+ apiKey: 'your-api-key',
36
+ });
37
+
38
+ // Track a login failure
39
+ await litesoc.track('auth.login_failed', {
40
+ actor: { id: 'user_123', email: 'user@example.com' },
41
+ userIp: '192.168.1.1',
42
+ metadata: { reason: 'invalid_password' },
43
+ });
44
+
45
+ // Flush remaining events before shutdown
46
+ await litesoc.flush();
47
+ ```
48
+
49
+ ## Configuration
50
+
51
+ ```typescript
52
+ const litesoc = new LiteSOC({
53
+ // Required: Your LiteSOC API key
54
+ apiKey: 'your-api-key',
55
+
56
+ // Optional: Custom API endpoint (default: https://www.litesoc.io/api/v1/collect)
57
+ endpoint: 'https://www.litesoc.io/api/v1/collect',
58
+
59
+ // Optional: Enable event batching (default: true)
60
+ batching: true,
61
+
62
+ // Optional: Batch size before auto-flush (default: 10)
63
+ batchSize: 10,
64
+
65
+ // Optional: Batch flush interval in ms (default: 5000)
66
+ flushInterval: 5000,
67
+
68
+ // Optional: Enable debug logging (default: false)
69
+ debug: false,
70
+
71
+ // Optional: Fail silently on errors (default: true)
72
+ silent: true,
73
+
74
+ // Optional: Custom fetch implementation for Edge runtimes
75
+ fetch: customFetch,
76
+ });
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ ### Basic Event Tracking
82
+
83
+ ```typescript
84
+ // Track with full options
85
+ await litesoc.track('auth.login_failed', {
86
+ actor: { id: 'user_123', email: 'user@example.com' },
87
+ userIp: '192.168.1.1',
88
+ metadata: { reason: 'invalid_password', attempts: 3 },
89
+ });
90
+
91
+ // Track with shorthand actor (just ID)
92
+ await litesoc.track('user.created', {
93
+ actor: 'user_456',
94
+ actorEmail: 'newuser@example.com',
95
+ });
96
+
97
+ // Track with custom event type
98
+ await litesoc.track('custom.event_type', {
99
+ actor: 'system',
100
+ metadata: { custom_field: 'value' },
101
+ });
102
+ ```
103
+
104
+ ### Convenience Methods
105
+
106
+ ```typescript
107
+ // Login events
108
+ await litesoc.trackLoginFailed('user_123', { userIp: '192.168.1.1' });
109
+ await litesoc.trackLoginSuccess('user_123', { userIp: '192.168.1.1' });
110
+
111
+ // Security events
112
+ await litesoc.trackPrivilegeEscalation('user_123', {
113
+ userIp: '192.168.1.1'
114
+ });
115
+
116
+ // Data events
117
+ await litesoc.trackSensitiveAccess('user_123', 'users.ssn', {
118
+ userIp: '192.168.1.1'
119
+ });
120
+
121
+ await litesoc.trackBulkDelete('user_123', 1000, {
122
+ metadata: { table: 'orders' }
123
+ });
124
+
125
+ // Authorization events
126
+ await litesoc.trackRoleChanged('user_123', 'user', 'admin', {
127
+ userIp: '192.168.1.1',
128
+ });
129
+
130
+ await litesoc.trackAccessDenied('user_123', '/admin/settings', {
131
+ userIp: '192.168.1.1',
132
+ });
133
+ ```
134
+
135
+ ### Batching
136
+
137
+ Events are automatically batched to reduce network calls:
138
+
139
+ ```typescript
140
+ // These will be batched together
141
+ litesoc.track('auth.login_failed', { actor: 'user_1' });
142
+ litesoc.track('auth.login_failed', { actor: 'user_2' });
143
+ litesoc.track('auth.login_failed', { actor: 'user_3' });
144
+
145
+ // Manually flush when needed
146
+ await litesoc.flush();
147
+
148
+ // Check queue size
149
+ console.log(litesoc.getQueueSize()); // 0
150
+
151
+ // Clear queue without sending
152
+ litesoc.clearQueue();
153
+ ```
154
+
155
+ ### Graceful Shutdown
156
+
157
+ ```typescript
158
+ // Flush remaining events before shutdown
159
+ process.on('beforeExit', async () => {
160
+ await litesoc.shutdown();
161
+ });
162
+
163
+ // Or in Next.js API routes
164
+ export async function POST(request: Request) {
165
+ // ... your logic
166
+
167
+ await litesoc.track('api.request', { ... });
168
+ await litesoc.flush(); // Ensure events are sent before response
169
+
170
+ return Response.json({ success: true });
171
+ }
172
+ ```
173
+
174
+ ## Event Types
175
+
176
+ ### Authentication Events
177
+
178
+ | Event | Description |
179
+ |-------|-------------|
180
+ | `auth.login_success` | Successful login |
181
+ | `auth.login_failed` | Failed login attempt |
182
+ | `auth.logout` | User logged out |
183
+ | `auth.password_changed` | Password was changed |
184
+ | `auth.password_reset_requested` | Password reset requested |
185
+ | `auth.password_reset_completed` | Password reset completed |
186
+ | `auth.mfa_enabled` | MFA was enabled |
187
+ | `auth.mfa_disabled` | MFA was disabled |
188
+ | `auth.mfa_challenge_success` | MFA challenge passed |
189
+ | `auth.mfa_challenge_failed` | MFA challenge failed |
190
+ | `auth.session_created` | New session created |
191
+ | `auth.session_revoked` | Session was revoked |
192
+
193
+ ### Authorization Events
194
+
195
+ | Event | Description |
196
+ |-------|-------------|
197
+ | `authz.role_assigned` | Role was assigned |
198
+ | `authz.role_removed` | Role was removed |
199
+ | `authz.role_changed` | Role was changed |
200
+ | `authz.permission_granted` | Permission was granted |
201
+ | `authz.permission_revoked` | Permission was revoked |
202
+ | `authz.access_denied` | Access was denied |
203
+ | `authz.access_granted` | Access was granted |
204
+
205
+ ### Admin Events (Critical)
206
+
207
+ | Event | Description |
208
+ |-------|-------------|
209
+ | `admin.privilege_escalation` | Privilege escalation detected |
210
+ | `admin.user_impersonation` | Admin impersonated a user |
211
+ | `admin.settings_changed` | System settings changed |
212
+ | `admin.api_key_created` | API key was created |
213
+ | `admin.api_key_revoked` | API key was revoked |
214
+
215
+ ### Data Events
216
+
217
+ | Event | Description |
218
+ |-------|-------------|
219
+ | `data.export` | Data was exported |
220
+ | `data.import` | Data was imported |
221
+ | `data.bulk_delete` | Bulk data deletion |
222
+ | `data.sensitive_access` | Sensitive data accessed |
223
+ | `data.download` | File was downloaded |
224
+
225
+ ### Security Events
226
+
227
+ | Event | Description |
228
+ |-------|-------------|
229
+ | `security.suspicious_activity` | Suspicious activity detected |
230
+ | `security.rate_limit_exceeded` | Rate limit exceeded |
231
+ | `security.ip_blocked` | IP was blocked |
232
+ | `security.account_locked` | Account was locked |
233
+
234
+ ## Next.js Integration
235
+
236
+ ### Server Components / API Routes
237
+
238
+ ```typescript
239
+ // app/api/login/route.ts
240
+ import { LiteSOC } from 'litesoc';
241
+ import { headers } from 'next/headers';
242
+
243
+ const litesoc = new LiteSOC({
244
+ apiKey: process.env.LITESOC_API_KEY!,
245
+ batching: false, // Disable batching for API routes
246
+ });
247
+
248
+ export async function POST(request: Request) {
249
+ const headersList = headers();
250
+ const userIp = headersList.get('x-forwarded-for')?.split(',')[0] ||
251
+ headersList.get('x-real-ip') ||
252
+ 'unknown';
253
+
254
+ const { email, password } = await request.json();
255
+
256
+ try {
257
+ // Your login logic...
258
+ const user = await authenticate(email, password);
259
+
260
+ await litesoc.track('auth.login_success', {
261
+ actor: { id: user.id, email: user.email },
262
+ userIp,
263
+ });
264
+
265
+ return Response.json({ success: true });
266
+ } catch (error) {
267
+ await litesoc.track('auth.login_failed', {
268
+ actor: email,
269
+ userIp,
270
+ metadata: { reason: error.message },
271
+ });
272
+
273
+ return Response.json({ error: 'Invalid credentials' }, { status: 401 });
274
+ }
275
+ }
276
+ ```
277
+
278
+ ### Edge Runtime
279
+
280
+ ```typescript
281
+ // app/api/edge/route.ts
282
+ import { LiteSOC } from 'litesoc';
283
+
284
+ export const runtime = 'edge';
285
+
286
+ const litesoc = new LiteSOC({
287
+ apiKey: process.env.LITESOC_API_KEY!,
288
+ batching: false,
289
+ });
290
+
291
+ export async function GET(request: Request) {
292
+ const userIp = request.headers.get('cf-connecting-ip') || 'unknown';
293
+
294
+ await litesoc.track('api.request', {
295
+ userIp,
296
+ metadata: { path: '/api/edge' },
297
+ });
298
+
299
+ return Response.json({ hello: 'world' });
300
+ }
301
+ ```
302
+
303
+ ## Express.js Integration
304
+
305
+ ```typescript
306
+ import express from 'express';
307
+ import { LiteSOC } from 'litesoc';
308
+
309
+ const app = express();
310
+ const litesoc = new LiteSOC({ apiKey: process.env.LITESOC_API_KEY! });
311
+
312
+ // Middleware to track all requests
313
+ app.use((req, res, next) => {
314
+ litesoc.track('api.request', {
315
+ userIp: req.ip,
316
+ metadata: {
317
+ method: req.method,
318
+ path: req.path,
319
+ userAgent: req.get('user-agent'),
320
+ },
321
+ });
322
+ next();
323
+ });
324
+
325
+ // Graceful shutdown
326
+ process.on('SIGTERM', async () => {
327
+ await litesoc.shutdown();
328
+ process.exit(0);
329
+ });
330
+ ```
331
+
332
+ ## Error Handling
333
+
334
+ By default, the SDK operates in silent mode - errors are logged but don't crash your application:
335
+
336
+ ```typescript
337
+ // Silent mode (default)
338
+ const litesoc = new LiteSOC({
339
+ apiKey: 'invalid-key',
340
+ silent: true, // Errors are logged, not thrown
341
+ });
342
+
343
+ // Strict mode - errors are thrown
344
+ const litesocStrict = new LiteSOC({
345
+ apiKey: 'invalid-key',
346
+ silent: false, // Errors are thrown
347
+ });
348
+
349
+ try {
350
+ await litesocStrict.track('auth.login_failed', { actor: 'user_123' });
351
+ } catch (error) {
352
+ console.error('Failed to track event:', error);
353
+ }
354
+ ```
355
+
356
+ ## TypeScript
357
+
358
+ The SDK is written in TypeScript and provides full type definitions:
359
+
360
+ ```typescript
361
+ import {
362
+ LiteSOC,
363
+ LiteSOCOptions,
364
+ EventType,
365
+ TrackOptions,
366
+ Actor,
367
+ AuthEvent,
368
+ SecurityEvent,
369
+ // ... and more
370
+ } from 'litesoc';
371
+
372
+ // Type-safe event names
373
+ const event: EventType = 'auth.login_failed'; // ✅
374
+ const invalid: EventType = 'invalid'; // ❌ Type error
375
+
376
+ // Custom events are also supported
377
+ const custom: EventType = 'my.custom_event'; // ✅
378
+ ```
379
+
380
+ ## License
381
+
382
+ MIT License - see [LICENSE](LICENSE) for details.
383
+
384
+ ## Support
385
+
386
+ - 📧 Email: support@litesoc.io
387
+ - 📖 Docs: https://litesoc.io/docs
388
+ - 🐛 Issues: https://github.com/litesoc/litesoc-node/issues
@@ -0,0 +1,260 @@
1
+ /**
2
+ * LiteSOC Node.js/TypeScript SDK
3
+ * Official SDK for security event tracking and threat detection
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ /** Fetch function type for cross-environment compatibility */
8
+ type FetchFunction = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
9
+ /**
10
+ * Authentication events
11
+ */
12
+ type AuthEvent = "auth.login_success" | "auth.login_failed" | "auth.logout" | "auth.password_changed" | "auth.password_reset_requested" | "auth.password_reset_completed" | "auth.mfa_enabled" | "auth.mfa_disabled" | "auth.mfa_challenge_success" | "auth.mfa_challenge_failed" | "auth.session_created" | "auth.session_revoked" | "auth.token_refreshed" | "auth.failed";
13
+ /**
14
+ * User events
15
+ */
16
+ type UserEvent = "user.created" | "user.updated" | "user.deleted" | "user.email_changed" | "user.email_verified" | "user.phone_changed" | "user.phone_verified" | "user.profile_updated" | "user.avatar_changed" | "user.login_failed" | "user.login.failed";
17
+ /**
18
+ * Authorization events
19
+ */
20
+ type AuthzEvent = "authz.role_assigned" | "authz.role_removed" | "authz.role_changed" | "authz.permission_granted" | "authz.permission_revoked" | "authz.access_denied" | "authz.access_granted";
21
+ /**
22
+ * Admin events
23
+ */
24
+ type AdminEvent = "admin.privilege_escalation" | "admin.user_impersonation" | "admin.settings_changed" | "admin.api_key_created" | "admin.api_key_revoked" | "admin.invite_sent" | "admin.invite_accepted" | "admin.member_removed";
25
+ /**
26
+ * Data events
27
+ */
28
+ type DataEvent = "data.export" | "data.import" | "data.bulk_delete" | "data.bulk_update" | "data.sensitive_access" | "data.download" | "data.upload" | "data.shared" | "data.unshared";
29
+ /**
30
+ * Security events
31
+ */
32
+ type SecurityEvent = "security.suspicious_activity" | "security.rate_limit_exceeded" | "security.ip_blocked" | "security.ip_unblocked" | "security.account_locked" | "security.account_unlocked" | "security.brute_force_detected" | "security.impossible_travel" | "security.geo_anomaly";
33
+ /**
34
+ * API events
35
+ */
36
+ type ApiEvent = "api.key_used" | "api.rate_limited" | "api.error" | "api.webhook_sent" | "api.webhook_failed";
37
+ /**
38
+ * Billing events
39
+ */
40
+ type BillingEvent = "billing.subscription_created" | "billing.subscription_updated" | "billing.subscription_cancelled" | "billing.payment_succeeded" | "billing.payment_failed" | "billing.invoice_created" | "billing.invoice_paid";
41
+ /**
42
+ * All predefined event types
43
+ */
44
+ type PredefinedEventType = AuthEvent | UserEvent | AuthzEvent | AdminEvent | DataEvent | SecurityEvent | ApiEvent | BillingEvent;
45
+ /**
46
+ * Custom event type (string pattern: category.action)
47
+ */
48
+ type CustomEventType = `${string}.${string}`;
49
+ /**
50
+ * All supported event types
51
+ */
52
+ type EventType = PredefinedEventType | CustomEventType;
53
+ /**
54
+ * Event severity levels
55
+ */
56
+ type EventSeverity = "low" | "medium" | "high" | "critical";
57
+ /**
58
+ * Actor information
59
+ */
60
+ interface Actor {
61
+ /** Unique identifier for the actor (user ID, API key ID, etc.) */
62
+ id: string;
63
+ /** Actor's email address (optional) */
64
+ email?: string;
65
+ }
66
+ /**
67
+ * Event metadata (arbitrary key-value pairs)
68
+ */
69
+ type EventMetadata = Record<string, unknown>;
70
+ /**
71
+ * Options for tracking an event
72
+ */
73
+ interface TrackOptions {
74
+ /** The actor (user) performing the action */
75
+ actor?: Actor | string;
76
+ /** Actor's email address (shorthand for actor.email) */
77
+ actorEmail?: string;
78
+ /** End-user's IP address (the user making the request) */
79
+ userIp?: string;
80
+ /** Event severity (optional, auto-detected for known events) */
81
+ severity?: EventSeverity;
82
+ /** Additional metadata for the event */
83
+ metadata?: EventMetadata;
84
+ /** Custom timestamp (defaults to now) */
85
+ timestamp?: Date | string;
86
+ }
87
+ /**
88
+ * SDK configuration options
89
+ */
90
+ interface LiteSOCOptions {
91
+ /** Your LiteSOC API key */
92
+ apiKey: string;
93
+ /** API endpoint (defaults to https://www.litesoc.io/api/v1/collect) */
94
+ endpoint?: string;
95
+ /** Enable batching (defaults to true) */
96
+ batching?: boolean;
97
+ /** Batch size before auto-flush (defaults to 10) */
98
+ batchSize?: number;
99
+ /** Batch flush interval in milliseconds (defaults to 5000ms) */
100
+ flushInterval?: number;
101
+ /** Enable debug logging (defaults to false) */
102
+ debug?: boolean;
103
+ /** Fail silently on errors (defaults to true) */
104
+ silent?: boolean;
105
+ /** Custom fetch implementation (for Edge runtimes) */
106
+ fetch?: FetchFunction;
107
+ }
108
+ /**
109
+ * LiteSOC SDK for tracking security events
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * import { LiteSOC } from 'litesoc';
114
+ *
115
+ * const litesoc = new LiteSOC({ apiKey: 'your-api-key' });
116
+ *
117
+ * // Track a login failure
118
+ * await litesoc.track('auth.login_failed', {
119
+ * actor: { id: 'user_123', email: 'user@example.com' },
120
+ * userIp: '192.168.1.1',
121
+ * metadata: { reason: 'invalid_password' }
122
+ * });
123
+ *
124
+ * // Flush remaining events before shutdown
125
+ * await litesoc.flush();
126
+ * ```
127
+ */
128
+ declare class LiteSOC {
129
+ private readonly apiKey;
130
+ private readonly endpoint;
131
+ private readonly batching;
132
+ private readonly batchSize;
133
+ private readonly flushInterval;
134
+ private readonly debug;
135
+ private readonly silent;
136
+ private readonly fetchFn;
137
+ private queue;
138
+ private flushTimer;
139
+ private isFlushing;
140
+ /**
141
+ * Create a new LiteSOC SDK instance
142
+ *
143
+ * @param options - SDK configuration options
144
+ * @throws Error if apiKey is not provided
145
+ */
146
+ constructor(options: LiteSOCOptions);
147
+ /**
148
+ * Track a security event
149
+ *
150
+ * @param eventName - The event type (e.g., 'auth.login_failed')
151
+ * @param options - Event options including actor, IP, and metadata
152
+ * @returns Promise that resolves when the event is queued or sent
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * // Track with full options
157
+ * await litesoc.track('auth.login_failed', {
158
+ * actor: { id: 'user_123', email: 'user@example.com' },
159
+ * userIp: '192.168.1.1',
160
+ * metadata: { reason: 'invalid_password', attempts: 3 }
161
+ * });
162
+ *
163
+ * // Track with shorthand actor
164
+ * await litesoc.track('user.created', {
165
+ * actor: 'user_456',
166
+ * actorEmail: 'newuser@example.com'
167
+ * });
168
+ * ```
169
+ */
170
+ track(eventName: EventType, options?: TrackOptions): Promise<void>;
171
+ /**
172
+ * Flush all queued events to the server
173
+ *
174
+ * @returns Promise that resolves when all events are sent
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // Flush before application shutdown
179
+ * process.on('beforeExit', async () => {
180
+ * await litesoc.flush();
181
+ * });
182
+ * ```
183
+ */
184
+ flush(): Promise<void>;
185
+ /**
186
+ * Get the current queue size
187
+ *
188
+ * @returns Number of events in the queue
189
+ */
190
+ getQueueSize(): number;
191
+ /**
192
+ * Clear all queued events without sending
193
+ */
194
+ clearQueue(): void;
195
+ /**
196
+ * Shutdown the SDK gracefully
197
+ * Flushes remaining events and clears timers
198
+ */
199
+ shutdown(): Promise<void>;
200
+ /**
201
+ * Track a login failure event
202
+ */
203
+ trackLoginFailed(actorId: string, options?: Omit<TrackOptions, "actor">): Promise<void>;
204
+ /**
205
+ * Track a login success event
206
+ */
207
+ trackLoginSuccess(actorId: string, options?: Omit<TrackOptions, "actor">): Promise<void>;
208
+ /**
209
+ * Track a privilege escalation event
210
+ */
211
+ trackPrivilegeEscalation(actorId: string, options?: Omit<TrackOptions, "actor">): Promise<void>;
212
+ /**
213
+ * Track a sensitive data access event
214
+ */
215
+ trackSensitiveAccess(actorId: string, resource: string, options?: Omit<TrackOptions, "actor">): Promise<void>;
216
+ /**
217
+ * Track a bulk delete event
218
+ */
219
+ trackBulkDelete(actorId: string, recordCount: number, options?: Omit<TrackOptions, "actor">): Promise<void>;
220
+ /**
221
+ * Track a role change event
222
+ */
223
+ trackRoleChanged(actorId: string, oldRole: string, newRole: string, options?: Omit<TrackOptions, "actor">): Promise<void>;
224
+ /**
225
+ * Track an access denied event
226
+ */
227
+ trackAccessDenied(actorId: string, resource: string, options?: Omit<TrackOptions, "actor">): Promise<void>;
228
+ /**
229
+ * Schedule a flush after the flush interval
230
+ */
231
+ private scheduleFlush;
232
+ /**
233
+ * Send events to the LiteSOC API
234
+ */
235
+ private sendEvents;
236
+ /**
237
+ * Handle errors based on silent mode
238
+ */
239
+ private handleError;
240
+ /**
241
+ * Log debug messages
242
+ */
243
+ private log;
244
+ }
245
+ /**
246
+ * Create a new LiteSOC SDK instance
247
+ *
248
+ * @param options - SDK configuration options
249
+ * @returns LiteSOC SDK instance
250
+ *
251
+ * @example
252
+ * ```typescript
253
+ * import { createLiteSOC } from 'litesoc';
254
+ *
255
+ * const litesoc = createLiteSOC({ apiKey: 'your-api-key' });
256
+ * ```
257
+ */
258
+ declare function createLiteSOC(options: LiteSOCOptions): LiteSOC;
259
+
260
+ export { type Actor, type AdminEvent, type ApiEvent, type AuthEvent, type AuthzEvent, type BillingEvent, type CustomEventType, type DataEvent, type EventMetadata, type EventSeverity, type EventType, LiteSOC, type LiteSOCOptions, type PredefinedEventType, type SecurityEvent, type TrackOptions, type UserEvent, createLiteSOC, LiteSOC as default };