@aws-amplify/analytics 7.0.1-api-v6-models.8035dfc.0 → 7.0.1-api-v6-models.3eb7748.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.
Files changed (154) hide show
  1. package/lib/errors/validation.d.ts +2 -0
  2. package/lib/errors/validation.js +8 -0
  3. package/lib/index.d.ts +1 -1
  4. package/lib/index.js +2 -1
  5. package/lib/providers/kinesis/apis/flushEvents.js +2 -1
  6. package/lib/providers/kinesis/apis/record.js +2 -1
  7. package/lib/providers/kinesis/types/buffer.d.ts +2 -2
  8. package/lib/providers/kinesis-firehose/apis/flushEvents.js +2 -1
  9. package/lib/providers/kinesis-firehose/apis/record.js +2 -1
  10. package/lib/providers/kinesis-firehose/types/buffer.d.ts +2 -2
  11. package/lib/providers/personalize/apis/flushEvents.js +2 -1
  12. package/lib/providers/personalize/apis/record.js +61 -46
  13. package/lib/providers/personalize/types/buffer.d.ts +2 -2
  14. package/lib/providers/personalize/utils/autoTrackMedia.js +2 -1
  15. package/lib/providers/personalize/utils/cachedSession.d.ts +2 -2
  16. package/lib/providers/personalize/utils/cachedSession.js +23 -14
  17. package/lib/providers/pinpoint/apis/configureAutoTrack.d.ts +15 -0
  18. package/lib/providers/pinpoint/apis/configureAutoTrack.js +35 -0
  19. package/lib/providers/pinpoint/apis/flushEvents.js +2 -1
  20. package/lib/providers/pinpoint/apis/identifyUser.js +4 -5
  21. package/lib/providers/pinpoint/apis/index.d.ts +1 -0
  22. package/lib/providers/pinpoint/apis/index.js +3 -1
  23. package/lib/providers/pinpoint/apis/record.js +1 -1
  24. package/lib/providers/pinpoint/index.d.ts +2 -2
  25. package/lib/providers/pinpoint/index.js +2 -1
  26. package/lib/providers/pinpoint/types/index.d.ts +1 -2
  27. package/lib/providers/pinpoint/types/index.js +0 -3
  28. package/lib/providers/pinpoint/types/inputs.d.ts +5 -1
  29. package/lib/providers/pinpoint/utils/resolveCredentials.d.ts +1 -6
  30. package/lib/trackers/EventTracker.d.ts +10 -0
  31. package/lib/trackers/EventTracker.js +104 -0
  32. package/lib/trackers/PageViewTracker.d.ts +18 -0
  33. package/lib/trackers/PageViewTracker.js +116 -0
  34. package/lib/trackers/SessionTracker.d.ts +13 -0
  35. package/lib/trackers/SessionTracker.js +73 -0
  36. package/lib/trackers/SessionTracker.native.d.ts +13 -0
  37. package/lib/trackers/SessionTracker.native.js +73 -0
  38. package/lib/trackers/index.d.ts +3 -0
  39. package/lib/trackers/index.js +11 -0
  40. package/lib/tsconfig.tsbuildinfo +1 -1
  41. package/lib/types/index.d.ts +1 -2
  42. package/lib/types/inputs.d.ts +17 -3
  43. package/lib/types/options.d.ts +1 -1
  44. package/lib/types/trackers.d.ts +22 -0
  45. package/lib/utils/eventBuffer/EventBuffer.js +2 -2
  46. package/lib/utils/index.d.ts +2 -0
  47. package/lib/utils/index.js +5 -1
  48. package/lib/utils/resolveCredentials.d.ts +1 -6
  49. package/lib/utils/trackerConfigHelpers.d.ts +5 -0
  50. package/lib/utils/trackerConfigHelpers.js +15 -0
  51. package/lib/utils/trackerConfigHelpers.native.d.ts +5 -0
  52. package/lib/utils/trackerConfigHelpers.native.js +14 -0
  53. package/lib/utils/trackerHelpers.d.ts +9 -0
  54. package/lib/utils/trackerHelpers.js +44 -0
  55. package/lib-esm/errors/validation.d.ts +2 -0
  56. package/lib-esm/errors/validation.js +8 -0
  57. package/lib-esm/index.d.ts +1 -1
  58. package/lib-esm/index.js +1 -1
  59. package/lib-esm/providers/kinesis/apis/flushEvents.js +2 -1
  60. package/lib-esm/providers/kinesis/apis/record.js +2 -1
  61. package/lib-esm/providers/kinesis/types/buffer.d.ts +2 -2
  62. package/lib-esm/providers/kinesis-firehose/apis/flushEvents.js +2 -1
  63. package/lib-esm/providers/kinesis-firehose/apis/record.js +3 -2
  64. package/lib-esm/providers/kinesis-firehose/types/buffer.d.ts +2 -2
  65. package/lib-esm/providers/personalize/apis/flushEvents.js +2 -1
  66. package/lib-esm/providers/personalize/apis/record.js +61 -46
  67. package/lib-esm/providers/personalize/types/buffer.d.ts +2 -2
  68. package/lib-esm/providers/personalize/utils/autoTrackMedia.js +2 -1
  69. package/lib-esm/providers/personalize/utils/cachedSession.d.ts +2 -2
  70. package/lib-esm/providers/personalize/utils/cachedSession.js +24 -15
  71. package/lib-esm/providers/pinpoint/apis/configureAutoTrack.d.ts +15 -0
  72. package/lib-esm/providers/pinpoint/apis/configureAutoTrack.js +31 -0
  73. package/lib-esm/providers/pinpoint/apis/flushEvents.js +2 -1
  74. package/lib-esm/providers/pinpoint/apis/identifyUser.js +5 -6
  75. package/lib-esm/providers/pinpoint/apis/index.d.ts +1 -0
  76. package/lib-esm/providers/pinpoint/apis/index.js +1 -0
  77. package/lib-esm/providers/pinpoint/apis/record.js +3 -3
  78. package/lib-esm/providers/pinpoint/index.d.ts +2 -2
  79. package/lib-esm/providers/pinpoint/index.js +1 -1
  80. package/lib-esm/providers/pinpoint/types/index.d.ts +1 -2
  81. package/lib-esm/providers/pinpoint/types/index.js +1 -1
  82. package/lib-esm/providers/pinpoint/types/inputs.d.ts +5 -1
  83. package/lib-esm/providers/pinpoint/utils/resolveCredentials.d.ts +1 -6
  84. package/lib-esm/trackers/EventTracker.d.ts +10 -0
  85. package/lib-esm/trackers/EventTracker.js +101 -0
  86. package/lib-esm/trackers/PageViewTracker.d.ts +18 -0
  87. package/lib-esm/trackers/PageViewTracker.js +113 -0
  88. package/lib-esm/trackers/SessionTracker.d.ts +13 -0
  89. package/lib-esm/trackers/SessionTracker.js +70 -0
  90. package/lib-esm/trackers/SessionTracker.native.d.ts +13 -0
  91. package/lib-esm/trackers/SessionTracker.native.js +70 -0
  92. package/lib-esm/trackers/index.d.ts +3 -0
  93. package/lib-esm/trackers/index.js +5 -0
  94. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  95. package/lib-esm/types/index.d.ts +1 -2
  96. package/lib-esm/types/inputs.d.ts +17 -3
  97. package/lib-esm/types/options.d.ts +1 -1
  98. package/lib-esm/types/trackers.d.ts +22 -0
  99. package/lib-esm/utils/eventBuffer/EventBuffer.js +1 -1
  100. package/lib-esm/utils/index.d.ts +2 -0
  101. package/lib-esm/utils/index.js +2 -0
  102. package/lib-esm/utils/resolveCredentials.d.ts +1 -6
  103. package/lib-esm/utils/trackerConfigHelpers.d.ts +5 -0
  104. package/lib-esm/utils/trackerConfigHelpers.js +11 -0
  105. package/lib-esm/utils/trackerConfigHelpers.native.d.ts +5 -0
  106. package/lib-esm/utils/trackerConfigHelpers.native.js +10 -0
  107. package/lib-esm/utils/trackerHelpers.d.ts +9 -0
  108. package/lib-esm/utils/trackerHelpers.js +40 -0
  109. package/package.json +6 -7
  110. package/src/errors/validation.ts +8 -0
  111. package/src/index.ts +3 -1
  112. package/src/providers/kinesis/apis/flushEvents.ts +2 -4
  113. package/src/providers/kinesis/apis/record.ts +2 -4
  114. package/src/providers/kinesis/types/buffer.ts +2 -2
  115. package/src/providers/kinesis-firehose/apis/flushEvents.ts +2 -4
  116. package/src/providers/kinesis-firehose/apis/record.ts +3 -5
  117. package/src/providers/kinesis-firehose/types/buffer.ts +2 -2
  118. package/src/providers/personalize/apis/flushEvents.ts +2 -4
  119. package/src/providers/personalize/apis/record.ts +5 -7
  120. package/src/providers/personalize/types/buffer.ts +2 -2
  121. package/src/providers/personalize/utils/autoTrackMedia.ts +2 -1
  122. package/src/providers/personalize/utils/cachedSession.ts +8 -7
  123. package/src/providers/pinpoint/apis/configureAutoTrack.ts +49 -0
  124. package/src/providers/pinpoint/apis/flushEvents.ts +2 -4
  125. package/src/providers/pinpoint/apis/identifyUser.ts +6 -3
  126. package/src/providers/pinpoint/apis/index.ts +1 -0
  127. package/src/providers/pinpoint/apis/record.ts +2 -3
  128. package/src/providers/pinpoint/index.ts +6 -2
  129. package/src/providers/pinpoint/types/index.ts +5 -2
  130. package/src/providers/pinpoint/types/inputs.ts +9 -1
  131. package/src/trackers/EventTracker.ts +135 -0
  132. package/src/trackers/PageViewTracker.ts +160 -0
  133. package/src/trackers/SessionTracker.native.ts +106 -0
  134. package/src/trackers/SessionTracker.ts +106 -0
  135. package/src/trackers/index.ts +6 -0
  136. package/src/types/index.ts +4 -13
  137. package/src/types/inputs.ts +26 -3
  138. package/src/types/options.ts +1 -1
  139. package/src/types/trackers.ts +35 -0
  140. package/src/utils/eventBuffer/EventBuffer.ts +1 -1
  141. package/src/utils/index.ts +2 -0
  142. package/src/utils/trackerConfigHelpers.native.ts +18 -0
  143. package/src/utils/trackerConfigHelpers.ts +19 -0
  144. package/src/utils/trackerHelpers.ts +57 -0
  145. package/lib/providers/pinpoint/types/errors.d.ts +0 -9
  146. package/lib/providers/pinpoint/types/errors.js +0 -15
  147. package/lib/types/analytics.d.ts +0 -50
  148. package/lib-esm/providers/pinpoint/types/errors.d.ts +0 -9
  149. package/lib-esm/providers/pinpoint/types/errors.js +0 -12
  150. package/lib-esm/types/analytics.d.ts +0 -50
  151. package/src/providers/pinpoint/types/errors.ts +0 -12
  152. package/src/types/analytics.ts +0 -70
  153. /package/lib/types/{analytics.js → trackers.js} +0 -0
  154. /package/lib-esm/types/{analytics.js → trackers.js} +0 -0
@@ -0,0 +1,57 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import {
5
+ TrackerAttributes,
6
+ TrackerEventRecorder,
7
+ TrackerInterface,
8
+ TrackerType,
9
+ } from '../types/trackers';
10
+ import { EventTracker, PageViewTracker, SessionTracker } from '../trackers';
11
+ import { ConfigureAutoTrackInput } from '../providers/pinpoint';
12
+
13
+ /**
14
+ * Updates a provider's trackers as appropriate for the provided auto-track configuration.
15
+ *
16
+ * @remark
17
+ * This utility will mutate the provider's configured trackers via `providerTrackers`.
18
+ */
19
+ export const updateProviderTrackers = (
20
+ input: ConfigureAutoTrackInput,
21
+ providerEventRecorder: TrackerEventRecorder,
22
+ providerTrackers: Partial<Record<TrackerType, TrackerInterface>>
23
+ ) => {
24
+ let trackerInstance;
25
+ const trackerType = input.type;
26
+ const currentTracker = providerTrackers[trackerType];
27
+
28
+ // Check if the tracker was disabled & should be cleaned up
29
+ if (!input.enable) {
30
+ if (currentTracker) {
31
+ currentTracker.cleanup();
32
+ delete providerTrackers[trackerType];
33
+ }
34
+
35
+ return;
36
+ }
37
+
38
+ // Re-configure the existing tracker, or create & configure an instance if it doesn't exist yet
39
+ if (currentTracker) {
40
+ currentTracker.configure(providerEventRecorder, input.options);
41
+
42
+ return;
43
+ }
44
+
45
+ // Create a new tracker instance for the type
46
+ if (trackerType === 'event') {
47
+ trackerInstance = new EventTracker(providerEventRecorder, input.options);
48
+ } else if (trackerType === 'pageView') {
49
+ trackerInstance = new PageViewTracker(providerEventRecorder, input.options);
50
+ } else if (trackerType === 'session') {
51
+ trackerInstance = new SessionTracker(providerEventRecorder, input.options);
52
+ }
53
+
54
+ if (trackerInstance) {
55
+ providerTrackers[trackerType] = trackerInstance;
56
+ }
57
+ };
@@ -1,9 +0,0 @@
1
- export declare enum UpdateEndpointException {
2
- BadRequestException = "BadRequestException",
3
- ForbiddenException = "ForbiddenException",
4
- InternalServerErrorException = "InternalServerErrorException",
5
- MethodNotAllowedException = "MethodNotAllowedException",
6
- NotFoundException = "NotFoundException",
7
- PayloadTooLargeException = "PayloadTooLargeException",
8
- TooManyRequestsException = "TooManyRequestsException"
9
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.UpdateEndpointException = void 0;
6
- var UpdateEndpointException;
7
- (function (UpdateEndpointException) {
8
- UpdateEndpointException["BadRequestException"] = "BadRequestException";
9
- UpdateEndpointException["ForbiddenException"] = "ForbiddenException";
10
- UpdateEndpointException["InternalServerErrorException"] = "InternalServerErrorException";
11
- UpdateEndpointException["MethodNotAllowedException"] = "MethodNotAllowedException";
12
- UpdateEndpointException["NotFoundException"] = "NotFoundException";
13
- UpdateEndpointException["PayloadTooLargeException"] = "PayloadTooLargeException";
14
- UpdateEndpointException["TooManyRequestsException"] = "TooManyRequestsException";
15
- })(UpdateEndpointException = exports.UpdateEndpointException || (exports.UpdateEndpointException = {}));
@@ -1,50 +0,0 @@
1
- /**
2
- * Analytics instance options
3
- */
4
- export interface EventAttributes {
5
- [key: string]: string;
6
- }
7
- export interface EventMetrics {
8
- [key: string]: number;
9
- }
10
- export interface PageViewTrackOpts {
11
- enable: boolean;
12
- type?: string;
13
- eventName?: string;
14
- provider?: string;
15
- attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
16
- getUrl?: () => string;
17
- }
18
- export interface EventTrackOpts {
19
- enable: boolean;
20
- events?: Array<string>;
21
- selectorPrefix?: string;
22
- provider?: string;
23
- attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
24
- }
25
- export interface SessionTrackOpts {
26
- enable: boolean;
27
- attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
28
- provider?: string;
29
- }
30
- export type AutoTrackAttributes = (() => EventAttributes | Promise<EventAttributes>) | EventAttributes;
31
- export interface AutoTrackSessionOpts {
32
- enable: boolean;
33
- attributes?: AutoTrackAttributes;
34
- provider?: string;
35
- }
36
- export interface AutoTrackPageViewOpts {
37
- enable: boolean;
38
- eventName?: string;
39
- attributes?: AutoTrackAttributes;
40
- type?: 'SPA' | 'multiPageApp';
41
- provider?: string;
42
- getUrl?: () => string;
43
- }
44
- export interface AutoTrackEventOpts {
45
- enable: boolean;
46
- events?: string[];
47
- selectorPrefix?: string;
48
- provider?: string;
49
- attributes?: AutoTrackAttributes;
50
- }
@@ -1,9 +0,0 @@
1
- export declare enum UpdateEndpointException {
2
- BadRequestException = "BadRequestException",
3
- ForbiddenException = "ForbiddenException",
4
- InternalServerErrorException = "InternalServerErrorException",
5
- MethodNotAllowedException = "MethodNotAllowedException",
6
- NotFoundException = "NotFoundException",
7
- PayloadTooLargeException = "PayloadTooLargeException",
8
- TooManyRequestsException = "TooManyRequestsException"
9
- }
@@ -1,12 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- export var UpdateEndpointException;
4
- (function (UpdateEndpointException) {
5
- UpdateEndpointException["BadRequestException"] = "BadRequestException";
6
- UpdateEndpointException["ForbiddenException"] = "ForbiddenException";
7
- UpdateEndpointException["InternalServerErrorException"] = "InternalServerErrorException";
8
- UpdateEndpointException["MethodNotAllowedException"] = "MethodNotAllowedException";
9
- UpdateEndpointException["NotFoundException"] = "NotFoundException";
10
- UpdateEndpointException["PayloadTooLargeException"] = "PayloadTooLargeException";
11
- UpdateEndpointException["TooManyRequestsException"] = "TooManyRequestsException";
12
- })(UpdateEndpointException || (UpdateEndpointException = {}));
@@ -1,50 +0,0 @@
1
- /**
2
- * Analytics instance options
3
- */
4
- export interface EventAttributes {
5
- [key: string]: string;
6
- }
7
- export interface EventMetrics {
8
- [key: string]: number;
9
- }
10
- export interface PageViewTrackOpts {
11
- enable: boolean;
12
- type?: string;
13
- eventName?: string;
14
- provider?: string;
15
- attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
16
- getUrl?: () => string;
17
- }
18
- export interface EventTrackOpts {
19
- enable: boolean;
20
- events?: Array<string>;
21
- selectorPrefix?: string;
22
- provider?: string;
23
- attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
24
- }
25
- export interface SessionTrackOpts {
26
- enable: boolean;
27
- attributes?: EventAttributes | (() => EventAttributes | Promise<EventAttributes>);
28
- provider?: string;
29
- }
30
- export type AutoTrackAttributes = (() => EventAttributes | Promise<EventAttributes>) | EventAttributes;
31
- export interface AutoTrackSessionOpts {
32
- enable: boolean;
33
- attributes?: AutoTrackAttributes;
34
- provider?: string;
35
- }
36
- export interface AutoTrackPageViewOpts {
37
- enable: boolean;
38
- eventName?: string;
39
- attributes?: AutoTrackAttributes;
40
- type?: 'SPA' | 'multiPageApp';
41
- provider?: string;
42
- getUrl?: () => string;
43
- }
44
- export interface AutoTrackEventOpts {
45
- enable: boolean;
46
- events?: string[];
47
- selectorPrefix?: string;
48
- provider?: string;
49
- attributes?: AutoTrackAttributes;
50
- }
@@ -1,12 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export enum UpdateEndpointException {
5
- BadRequestException = 'BadRequestException',
6
- ForbiddenException = 'ForbiddenException',
7
- InternalServerErrorException = 'InternalServerErrorException',
8
- MethodNotAllowedException = 'MethodNotAllowedException',
9
- NotFoundException = 'NotFoundException',
10
- PayloadTooLargeException = 'PayloadTooLargeException',
11
- TooManyRequestsException = 'TooManyRequestsException',
12
- }
@@ -1,70 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- /**
5
- * Analytics instance options
6
- */
7
-
8
- export interface EventAttributes {
9
- [key: string]: string;
10
- }
11
-
12
- export interface EventMetrics {
13
- [key: string]: number;
14
- }
15
-
16
- export interface PageViewTrackOpts {
17
- enable: boolean;
18
- type?: string;
19
- eventName?: string;
20
- provider?: string;
21
- attributes?:
22
- | EventAttributes
23
- | (() => EventAttributes | Promise<EventAttributes>);
24
- getUrl?: () => string;
25
- }
26
-
27
- export interface EventTrackOpts {
28
- enable: boolean;
29
- events?: Array<string>;
30
- selectorPrefix?: string;
31
- provider?: string;
32
- attributes?:
33
- | EventAttributes
34
- | (() => EventAttributes | Promise<EventAttributes>);
35
- }
36
-
37
- export interface SessionTrackOpts {
38
- enable: boolean;
39
- attributes?:
40
- | EventAttributes
41
- | (() => EventAttributes | Promise<EventAttributes>);
42
- provider?: string;
43
- }
44
-
45
- export type AutoTrackAttributes =
46
- | (() => EventAttributes | Promise<EventAttributes>)
47
- | EventAttributes;
48
-
49
- export interface AutoTrackSessionOpts {
50
- enable: boolean;
51
- attributes?: AutoTrackAttributes;
52
- provider?: string;
53
- }
54
-
55
- export interface AutoTrackPageViewOpts {
56
- enable: boolean;
57
- eventName?: string;
58
- attributes?: AutoTrackAttributes;
59
- type?: 'SPA' | 'multiPageApp';
60
- provider?: string;
61
- getUrl?: () => string;
62
- }
63
-
64
- export interface AutoTrackEventOpts {
65
- enable: boolean;
66
- events?: string[];
67
- selectorPrefix?: string;
68
- provider?: string;
69
- attributes?: AutoTrackAttributes;
70
- }
File without changes
File without changes