@drakkar.software/sunglasses-core 0.7.0 → 0.8.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/dist/index.d.mts CHANGED
@@ -11,7 +11,7 @@ interface IStorageAdapter {
11
11
  }
12
12
  /**
13
13
  * Output destination that receives batches of sanitized, consented events.
14
- * Implementations: HttpStorageAdapter, StarfishAnalyticsAdapter, console (debug).
14
+ * Implementations include `HttpStorageAdapter` and any custom adapter.
15
15
  */
16
16
  interface IAnalyticsAdapter {
17
17
  /**
@@ -27,7 +27,7 @@ interface IAnalyticsAdapter {
27
27
  /**
28
28
  * Called after a successful flush with the events that were delivered.
29
29
  * Use this to archive or remove old events from the remote store.
30
- * Implement this in adapters that accumulate data (e.g. StarfishAnalyticsAdapter).
30
+ * Implement in adapters that accumulate data and need post-flush pruning.
31
31
  */
32
32
  cleanupAfterFlush?(delivered: ReadonlyArray<SunglassesEvent>, config: CleanupConfig): Promise<void>;
33
33
  }
@@ -366,54 +366,6 @@ interface HttpAdapterConfig {
366
366
  /** Request timeout in ms. Default: 10_000. */
367
367
  timeout?: number;
368
368
  }
369
- interface StarfishAdapterConfig {
370
- /** Base URL of the Starfish sync server, e.g. https://sync.example.com */
371
- serverUrl: string;
372
- /**
373
- * Path template for the event document.
374
- * Use `{identity}` as a placeholder — it is replaced with `distinctId ?? anonymousId`.
375
- * Example: "analytics/{identity}/events"
376
- */
377
- storagePath: string;
378
- /** Bearer token for Authorization header. */
379
- authToken?: string;
380
- /** Max retries on 409 Conflict (optimistic locking). Default: 3. */
381
- maxRetries?: number;
382
- /**
383
- * When true, each successful push creates a **new** Starfish document using
384
- * a rotating path suffix (e.g. `events-0001`, `events-0002`…).
385
- *
386
- * Benefits:
387
- * - No pull step needed — each push is always a fresh document
388
- * - No growing single document — each file stays small
389
- * - Old documents accumulate on Starfish (combine with `cleanupAfterFlush` to prune)
390
- *
391
- * Requires `pathStorage` to persist the current path generation counter.
392
- * Works best with `enableLocalArchive: true` in `SunglassesConfig` so the
393
- * complete event history is kept locally even across many push generations.
394
- */
395
- rotatePathOnSuccess?: boolean;
396
- /**
397
- * Storage adapter used to persist the current path generation counter.
398
- * Required when `rotatePathOnSuccess: true`.
399
- * Can be the same adapter as `SunglassesConfig.storage`.
400
- */
401
- pathStorage?: IStorageAdapter;
402
- /**
403
- * When `true`, events are pushed directly without a prior pull.
404
- * No merge, no optimistic locking, no conflict detection.
405
- *
406
- * Use this for Starfish collections configured with `queueOnly: true` —
407
- * the server ignores `baseHash` and returns no stored data on pull,
408
- * so a pull round-trip is always wasted.
409
- *
410
- * On push failure the adapter **throws**, allowing SunglassesCore to keep
411
- * events in the local queue and retry on the next flush interval.
412
- *
413
- * Cannot be combined with `rotatePathOnSuccess`.
414
- */
415
- pushOnly?: boolean;
416
- }
417
369
  /**
418
370
  * In-memory + persisted session state.
419
371
  * Session IDs are random UUIDs — they never contain PII.
@@ -1165,4 +1117,4 @@ declare function sha256Hex(input: string): Promise<string>;
1165
1117
  */
1166
1118
  declare function nowISO(): string;
1167
1119
 
1168
- export { type CleanupConfig, type ConsentHistoryEntry, ConsentManager, type ConsentState, type ConsentStatus, type ErrorEventProperties, type EventContext, type EventCountPeriod, EventCounter, type EventMap, EventQueue, type EventType, FrequencyMiddleware, type FrequencyMiddlewareOptions, type HttpAdapterConfig, type IAnalyticsAdapter, type IEventCounter, type IMiddleware, type IStorageAdapter, type ISunglassesClient, type ISunglassesTypedClient, IdentityManager, type IdentityState, LocalEventArchive, type Logger, type MiddlewareNext, MiddlewarePipeline, PiiSanitizer, SamplingMiddleware, type SamplingMiddlewareOptions, type ScreenTrackingOptions, SessionManager, type SessionState, type StarfishAdapterConfig, type SunglassesConfig, SunglassesCore, type SunglassesEvent, TraitManager, type UserDataExport, asTyped, createLazyClient, createLogger, generateUUID, nowISO, sha256Hex };
1120
+ export { type CleanupConfig, type ConsentHistoryEntry, ConsentManager, type ConsentState, type ConsentStatus, type ErrorEventProperties, type EventContext, type EventCountPeriod, EventCounter, type EventMap, EventQueue, type EventType, FrequencyMiddleware, type FrequencyMiddlewareOptions, type HttpAdapterConfig, type IAnalyticsAdapter, type IEventCounter, type IMiddleware, type IStorageAdapter, type ISunglassesClient, type ISunglassesTypedClient, IdentityManager, type IdentityState, LocalEventArchive, type Logger, type MiddlewareNext, MiddlewarePipeline, PiiSanitizer, SamplingMiddleware, type SamplingMiddlewareOptions, type ScreenTrackingOptions, SessionManager, type SessionState, type SunglassesConfig, SunglassesCore, type SunglassesEvent, TraitManager, type UserDataExport, asTyped, createLazyClient, createLogger, generateUUID, nowISO, sha256Hex };
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ interface IStorageAdapter {
11
11
  }
12
12
  /**
13
13
  * Output destination that receives batches of sanitized, consented events.
14
- * Implementations: HttpStorageAdapter, StarfishAnalyticsAdapter, console (debug).
14
+ * Implementations include `HttpStorageAdapter` and any custom adapter.
15
15
  */
16
16
  interface IAnalyticsAdapter {
17
17
  /**
@@ -27,7 +27,7 @@ interface IAnalyticsAdapter {
27
27
  /**
28
28
  * Called after a successful flush with the events that were delivered.
29
29
  * Use this to archive or remove old events from the remote store.
30
- * Implement this in adapters that accumulate data (e.g. StarfishAnalyticsAdapter).
30
+ * Implement in adapters that accumulate data and need post-flush pruning.
31
31
  */
32
32
  cleanupAfterFlush?(delivered: ReadonlyArray<SunglassesEvent>, config: CleanupConfig): Promise<void>;
33
33
  }
@@ -366,54 +366,6 @@ interface HttpAdapterConfig {
366
366
  /** Request timeout in ms. Default: 10_000. */
367
367
  timeout?: number;
368
368
  }
369
- interface StarfishAdapterConfig {
370
- /** Base URL of the Starfish sync server, e.g. https://sync.example.com */
371
- serverUrl: string;
372
- /**
373
- * Path template for the event document.
374
- * Use `{identity}` as a placeholder — it is replaced with `distinctId ?? anonymousId`.
375
- * Example: "analytics/{identity}/events"
376
- */
377
- storagePath: string;
378
- /** Bearer token for Authorization header. */
379
- authToken?: string;
380
- /** Max retries on 409 Conflict (optimistic locking). Default: 3. */
381
- maxRetries?: number;
382
- /**
383
- * When true, each successful push creates a **new** Starfish document using
384
- * a rotating path suffix (e.g. `events-0001`, `events-0002`…).
385
- *
386
- * Benefits:
387
- * - No pull step needed — each push is always a fresh document
388
- * - No growing single document — each file stays small
389
- * - Old documents accumulate on Starfish (combine with `cleanupAfterFlush` to prune)
390
- *
391
- * Requires `pathStorage` to persist the current path generation counter.
392
- * Works best with `enableLocalArchive: true` in `SunglassesConfig` so the
393
- * complete event history is kept locally even across many push generations.
394
- */
395
- rotatePathOnSuccess?: boolean;
396
- /**
397
- * Storage adapter used to persist the current path generation counter.
398
- * Required when `rotatePathOnSuccess: true`.
399
- * Can be the same adapter as `SunglassesConfig.storage`.
400
- */
401
- pathStorage?: IStorageAdapter;
402
- /**
403
- * When `true`, events are pushed directly without a prior pull.
404
- * No merge, no optimistic locking, no conflict detection.
405
- *
406
- * Use this for Starfish collections configured with `queueOnly: true` —
407
- * the server ignores `baseHash` and returns no stored data on pull,
408
- * so a pull round-trip is always wasted.
409
- *
410
- * On push failure the adapter **throws**, allowing SunglassesCore to keep
411
- * events in the local queue and retry on the next flush interval.
412
- *
413
- * Cannot be combined with `rotatePathOnSuccess`.
414
- */
415
- pushOnly?: boolean;
416
- }
417
369
  /**
418
370
  * In-memory + persisted session state.
419
371
  * Session IDs are random UUIDs — they never contain PII.
@@ -1165,4 +1117,4 @@ declare function sha256Hex(input: string): Promise<string>;
1165
1117
  */
1166
1118
  declare function nowISO(): string;
1167
1119
 
1168
- export { type CleanupConfig, type ConsentHistoryEntry, ConsentManager, type ConsentState, type ConsentStatus, type ErrorEventProperties, type EventContext, type EventCountPeriod, EventCounter, type EventMap, EventQueue, type EventType, FrequencyMiddleware, type FrequencyMiddlewareOptions, type HttpAdapterConfig, type IAnalyticsAdapter, type IEventCounter, type IMiddleware, type IStorageAdapter, type ISunglassesClient, type ISunglassesTypedClient, IdentityManager, type IdentityState, LocalEventArchive, type Logger, type MiddlewareNext, MiddlewarePipeline, PiiSanitizer, SamplingMiddleware, type SamplingMiddlewareOptions, type ScreenTrackingOptions, SessionManager, type SessionState, type StarfishAdapterConfig, type SunglassesConfig, SunglassesCore, type SunglassesEvent, TraitManager, type UserDataExport, asTyped, createLazyClient, createLogger, generateUUID, nowISO, sha256Hex };
1120
+ export { type CleanupConfig, type ConsentHistoryEntry, ConsentManager, type ConsentState, type ConsentStatus, type ErrorEventProperties, type EventContext, type EventCountPeriod, EventCounter, type EventMap, EventQueue, type EventType, FrequencyMiddleware, type FrequencyMiddlewareOptions, type HttpAdapterConfig, type IAnalyticsAdapter, type IEventCounter, type IMiddleware, type IStorageAdapter, type ISunglassesClient, type ISunglassesTypedClient, IdentityManager, type IdentityState, LocalEventArchive, type Logger, type MiddlewareNext, MiddlewarePipeline, PiiSanitizer, SamplingMiddleware, type SamplingMiddlewareOptions, type ScreenTrackingOptions, SessionManager, type SessionState, type SunglassesConfig, SunglassesCore, type SunglassesEvent, TraitManager, type UserDataExport, asTyped, createLazyClient, createLogger, generateUUID, nowISO, sha256Hex };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drakkar.software/sunglasses-core",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Platform-agnostic event tracking engine for SunGlasses",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",