@dereekb/analytics 13.11.14 → 13.11.15

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/index.cjs.js CHANGED
@@ -15,6 +15,10 @@ function _type_of(obj) {
15
15
  * 2. Filters out any values that are not `string`, `number`, or `boolean`
16
16
  * 3. Filters out non-finite numbers (`NaN`, `Infinity`, `-Infinity`)
17
17
  *
18
+ * @param input - The object to convert. If nullish, returns an empty object.
19
+ * @param config - Optional configuration for flattening behavior.
20
+ * @returns A new {@link AnalyticsEventData} object containing only valid analytics values.
21
+ *
18
22
  * @example
19
23
  * ```ts
20
24
  * asAnalyticsEventData({ action: 'click', user: { age: 25, name: 'Jo' }, tags: [1, 2] });
@@ -23,10 +27,6 @@ function _type_of(obj) {
23
27
  * asAnalyticsEventData({ a: 'ok', b: { nested: 1 } }, { flattenObjects: false });
24
28
  * // { a: 'ok' }
25
29
  * ```
26
- *
27
- * @param input - The object to convert. If nullish, returns an empty object.
28
- * @param config - Optional configuration for flattening behavior.
29
- * @returns A new {@link AnalyticsEventData} object containing only valid analytics values.
30
30
  */ function asAnalyticsEventData(input, config) {
31
31
  var result = {};
32
32
  if (input != null) {
package/index.esm.js CHANGED
@@ -13,6 +13,10 @@ function _type_of(obj) {
13
13
  * 2. Filters out any values that are not `string`, `number`, or `boolean`
14
14
  * 3. Filters out non-finite numbers (`NaN`, `Infinity`, `-Infinity`)
15
15
  *
16
+ * @param input - The object to convert. If nullish, returns an empty object.
17
+ * @param config - Optional configuration for flattening behavior.
18
+ * @returns A new {@link AnalyticsEventData} object containing only valid analytics values.
19
+ *
16
20
  * @example
17
21
  * ```ts
18
22
  * asAnalyticsEventData({ action: 'click', user: { age: 25, name: 'Jo' }, tags: [1, 2] });
@@ -21,10 +25,6 @@ function _type_of(obj) {
21
25
  * asAnalyticsEventData({ a: 'ok', b: { nested: 1 } }, { flattenObjects: false });
22
26
  * // { a: 'ok' }
23
27
  * ```
24
- *
25
- * @param input - The object to convert. If nullish, returns an empty object.
26
- * @param config - Optional configuration for flattening behavior.
27
- * @returns A new {@link AnalyticsEventData} object containing only valid analytics values.
28
28
  */ function asAnalyticsEventData(input, config) {
29
29
  var result = {};
30
30
  if (input != null) {
@@ -393,9 +393,8 @@ function _object_spread_props(target, source) {
393
393
  *
394
394
  * In log-only mode, events are logged to the console instead of being sent to Segment.
395
395
  *
396
- * @param userId - the user to associate with the event
397
- * @param event - the track event containing event name, properties, and optional context
398
- *
396
+ * @param userId - The user to associate with the event.
397
+ * @param event - The track event containing event name, properties, and optional context.
399
398
  * @throws {Error} When userId is falsy.
400
399
  *
401
400
  * @example
@@ -429,8 +428,8 @@ function _object_spread_props(target, source) {
429
428
  *
430
429
  * Convenience wrapper around {@link track} for cases where the user may not be authenticated.
431
430
  *
432
- * @param userId - the user to associate with the event, or nullish to skip
433
- * @param event - the track event containing event name, properties, and optional context
431
+ * @param userId - The user to associate with the event, or nullish to skip.
432
+ * @param event - The track event containing event name, properties, and optional context.
434
433
  */ key: "tryTrack",
435
434
  value: function tryTrack(userId, event) {
436
435
  if (userId) {
@@ -444,7 +443,7 @@ function _object_spread_props(target, source) {
444
443
  *
445
444
  * In log-only mode, the identify call is logged to the console instead of being sent.
446
445
  *
447
- * @param params - the identify parameters including userId and optional traits
446
+ * @param params - The identify parameters including userId and optional traits.
448
447
  *
449
448
  * @example
450
449
  * ```ts
@@ -587,13 +586,18 @@ var ANALYTICS_INTERCEPTOR_METADATA_KEY = 'analyticsevent';
587
586
  *
588
587
  * @param config - The analytics event configuration specifying the event name and optional data extractor.
589
588
  * @returns A method decorator that attaches analytics metadata.
589
+ * @throws {Error} When `config.name` is empty.
590
+ *
591
+ * @dbxAllowConstantName NestJS decorator factories conventionally use PascalCase.
590
592
  *
591
593
  * @example
592
- * ```ts
593
- * @EmitAnalyticsEvent({ name: 'User Registered', fn: (result) => ({ userId: result.id }) })
594
- * @Post('register')
595
- * async register(@Body() body: RegisterDto) {
596
- * return this.authService.register(body);
594
+ * ```typescript
595
+ * class AuthController {
596
+ * @EmitAnalyticsEvent({ name: 'User Registered', fn: (result) => ({ userId: result.id }) })
597
+ * @Post('register')
598
+ * async register(@Body() body: RegisterDto) {
599
+ * return this.authService.register(body);
600
+ * }
597
601
  * }
598
602
  * ```
599
603
  */ var EmitAnalyticsEvent = function EmitAnalyticsEvent(config) {
@@ -391,9 +391,8 @@ function _object_spread_props(target, source) {
391
391
  *
392
392
  * In log-only mode, events are logged to the console instead of being sent to Segment.
393
393
  *
394
- * @param userId - the user to associate with the event
395
- * @param event - the track event containing event name, properties, and optional context
396
- *
394
+ * @param userId - The user to associate with the event.
395
+ * @param event - The track event containing event name, properties, and optional context.
397
396
  * @throws {Error} When userId is falsy.
398
397
  *
399
398
  * @example
@@ -427,8 +426,8 @@ function _object_spread_props(target, source) {
427
426
  *
428
427
  * Convenience wrapper around {@link track} for cases where the user may not be authenticated.
429
428
  *
430
- * @param userId - the user to associate with the event, or nullish to skip
431
- * @param event - the track event containing event name, properties, and optional context
429
+ * @param userId - The user to associate with the event, or nullish to skip.
430
+ * @param event - The track event containing event name, properties, and optional context.
432
431
  */ key: "tryTrack",
433
432
  value: function tryTrack(userId, event) {
434
433
  if (userId) {
@@ -442,7 +441,7 @@ function _object_spread_props(target, source) {
442
441
  *
443
442
  * In log-only mode, the identify call is logged to the console instead of being sent.
444
443
  *
445
- * @param params - the identify parameters including userId and optional traits
444
+ * @param params - The identify parameters including userId and optional traits.
446
445
  *
447
446
  * @example
448
447
  * ```ts
@@ -585,13 +584,18 @@ var ANALYTICS_INTERCEPTOR_METADATA_KEY = 'analyticsevent';
585
584
  *
586
585
  * @param config - The analytics event configuration specifying the event name and optional data extractor.
587
586
  * @returns A method decorator that attaches analytics metadata.
587
+ * @throws {Error} When `config.name` is empty.
588
+ *
589
+ * @dbxAllowConstantName NestJS decorator factories conventionally use PascalCase.
588
590
  *
589
591
  * @example
590
- * ```ts
591
- * @EmitAnalyticsEvent({ name: 'User Registered', fn: (result) => ({ userId: result.id }) })
592
- * @Post('register')
593
- * async register(@Body() body: RegisterDto) {
594
- * return this.authService.register(body);
592
+ * ```typescript
593
+ * class AuthController {
594
+ * @EmitAnalyticsEvent({ name: 'User Registered', fn: (result) => ({ userId: result.id }) })
595
+ * @Post('register')
596
+ * async register(@Body() body: RegisterDto) {
597
+ * return this.authService.register(body);
598
+ * }
595
599
  * }
596
600
  * ```
597
601
  */ var EmitAnalyticsEvent = function EmitAnalyticsEvent(config) {
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dereekb/analytics/nestjs",
3
- "version": "13.11.14",
3
+ "version": "13.11.15",
4
4
  "peerDependencies": {
5
- "@dereekb/analytics": "13.11.14",
6
- "@dereekb/nestjs": "13.11.14",
7
- "@dereekb/rxjs": "13.11.14",
8
- "@dereekb/util": "13.11.14",
5
+ "@dereekb/analytics": "13.11.15",
6
+ "@dereekb/nestjs": "13.11.15",
7
+ "@dereekb/rxjs": "13.11.15",
8
+ "@dereekb/util": "13.11.15",
9
9
  "@nestjs/common": "^11.1.19",
10
10
  "@nestjs/config": "^4.0.4",
11
11
  "@nestjs/core": "^11.1.19",
@@ -34,13 +34,18 @@ export interface AnalyticsEventInterceptorConfig<T> {
34
34
  *
35
35
  * @param config - The analytics event configuration specifying the event name and optional data extractor.
36
36
  * @returns A method decorator that attaches analytics metadata.
37
+ * @throws {Error} When `config.name` is empty.
38
+ *
39
+ * @dbxAllowConstantName NestJS decorator factories conventionally use PascalCase.
37
40
  *
38
41
  * @example
39
- * ```ts
40
- * @EmitAnalyticsEvent({ name: 'User Registered', fn: (result) => ({ userId: result.id }) })
41
- * @Post('register')
42
- * async register(@Body() body: RegisterDto) {
43
- * return this.authService.register(body);
42
+ * ```typescript
43
+ * class AuthController {
44
+ * @EmitAnalyticsEvent({ name: 'User Registered', fn: (result) => ({ userId: result.id }) })
45
+ * @Post('register')
46
+ * async register(@Body() body: RegisterDto) {
47
+ * return this.authService.register(body);
48
+ * }
44
49
  * }
45
50
  * ```
46
51
  */
@@ -19,9 +19,8 @@ export declare class SegmentService {
19
19
  *
20
20
  * In log-only mode, events are logged to the console instead of being sent to Segment.
21
21
  *
22
- * @param userId - the user to associate with the event
23
- * @param event - the track event containing event name, properties, and optional context
24
- *
22
+ * @param userId - The user to associate with the event.
23
+ * @param event - The track event containing event name, properties, and optional context.
25
24
  * @throws {Error} When userId is falsy.
26
25
  *
27
26
  * @example
@@ -38,8 +37,8 @@ export declare class SegmentService {
38
37
  *
39
38
  * Convenience wrapper around {@link track} for cases where the user may not be authenticated.
40
39
  *
41
- * @param userId - the user to associate with the event, or nullish to skip
42
- * @param event - the track event containing event name, properties, and optional context
40
+ * @param userId - The user to associate with the event, or nullish to skip.
41
+ * @param event - The track event containing event name, properties, and optional context.
43
42
  */
44
43
  tryTrack(userId: Maybe<AnalyticsUserId>, event: SegmentTrackEvent): void;
45
44
  /**
@@ -47,7 +46,7 @@ export declare class SegmentService {
47
46
  *
48
47
  * In log-only mode, the identify call is logged to the console instead of being sent.
49
48
  *
50
- * @param params - the identify parameters including userId and optional traits
49
+ * @param params - The identify parameters including userId and optional traits.
51
50
  *
52
51
  * @example
53
52
  * ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/analytics",
3
- "version": "13.11.14",
3
+ "version": "13.11.15",
4
4
  "exports": {
5
5
  "./nestjs": {
6
6
  "module": "./nestjs/index.esm.js",
@@ -17,9 +17,9 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@dereekb/nestjs": "13.11.14",
21
- "@dereekb/rxjs": "13.11.14",
22
- "@dereekb/util": "13.11.14",
20
+ "@dereekb/nestjs": "13.11.15",
21
+ "@dereekb/rxjs": "13.11.15",
22
+ "@dereekb/util": "13.11.15",
23
23
  "@nestjs/common": "^11.1.19",
24
24
  "@nestjs/config": "^4.0.4",
25
25
  "@nestjs/core": "^11.1.19",
@@ -1,4 +1,4 @@
1
- import { type Maybe, type PrimativeKey } from '@dereekb/util';
1
+ import { type SuggestedString, type Maybe, type PrimativeKey } from '@dereekb/util';
2
2
  /**
3
3
  * Name identifier for an analytics event (e.g., `'User Registered'`, `'Page Viewed'`).
4
4
  */
@@ -53,7 +53,7 @@ export interface UserAnalyticsEvent extends AnalyticsEvent {
53
53
  /**
54
54
  * Registration method used to create a new user account (e.g., `'facebook'`, `'google'`, `'email'`).
55
55
  */
56
- export type NewUserRegistrationMethod = 'facebook' | 'google' | 'email' | (string & {});
56
+ export type NewUserRegistrationMethod = SuggestedString<'facebook' | 'google' | 'email'>;
57
57
  /**
58
58
  * Event data for new user registration events, requiring the registration method.
59
59
  */
@@ -39,6 +39,10 @@ export interface AsAnalyticsEventDataConfig {
39
39
  * 2. Filters out any values that are not `string`, `number`, or `boolean`
40
40
  * 3. Filters out non-finite numbers (`NaN`, `Infinity`, `-Infinity`)
41
41
  *
42
+ * @param input - The object to convert. If nullish, returns an empty object.
43
+ * @param config - Optional configuration for flattening behavior.
44
+ * @returns A new {@link AnalyticsEventData} object containing only valid analytics values.
45
+ *
42
46
  * @example
43
47
  * ```ts
44
48
  * asAnalyticsEventData({ action: 'click', user: { age: 25, name: 'Jo' }, tags: [1, 2] });
@@ -47,9 +51,5 @@ export interface AsAnalyticsEventDataConfig {
47
51
  * asAnalyticsEventData({ a: 'ok', b: { nested: 1 } }, { flattenObjects: false });
48
52
  * // { a: 'ok' }
49
53
  * ```
50
- *
51
- * @param input - The object to convert. If nullish, returns an empty object.
52
- * @param config - Optional configuration for flattening behavior.
53
- * @returns A new {@link AnalyticsEventData} object containing only valid analytics values.
54
54
  */
55
55
  export declare function asAnalyticsEventData(input: Maybe<Record<string, unknown>>, config?: AsAnalyticsEventDataConfig): AnalyticsEventData;