@aws-amplify/analytics 7.0.1-console-preview.431c340.0 → 7.0.1-console-preview.0bbe168.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/kinesis-firehose/package.json +7 -0
- package/lib/errors/validation.d.ts +0 -1
- package/lib/errors/validation.js +0 -4
- package/lib/providers/kinesis-firehose/apis/index.d.ts +1 -0
- package/lib/providers/kinesis-firehose/apis/index.js +7 -0
- package/lib/providers/kinesis-firehose/apis/record.d.ts +2 -0
- package/lib/providers/kinesis-firehose/apis/record.js +9 -0
- package/lib/providers/kinesis-firehose/index.d.ts +1 -0
- package/lib/providers/kinesis-firehose/index.js +6 -0
- package/lib/providers/kinesis-firehose/types/index.d.ts +1 -0
- package/lib/providers/kinesis-firehose/types/index.js +6 -0
- package/lib/providers/kinesis-firehose/types/inputs.d.ts +1 -0
- package/lib/providers/kinesis-firehose/types/inputs.js +4 -0
- package/lib/providers/pinpoint/apis/record.d.ts +8 -14
- package/lib/providers/pinpoint/apis/record.js +11 -19
- package/lib/providers/pinpoint/types/inputs.d.ts +4 -6
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/inputs.d.ts +1 -1
- package/lib-esm/errors/validation.d.ts +0 -1
- package/lib-esm/errors/validation.js +0 -4
- package/lib-esm/providers/kinesis-firehose/apis/index.d.ts +1 -0
- package/lib-esm/providers/kinesis-firehose/apis/index.js +3 -0
- package/lib-esm/providers/kinesis-firehose/apis/record.d.ts +2 -0
- package/lib-esm/providers/kinesis-firehose/apis/record.js +5 -0
- package/lib-esm/providers/kinesis-firehose/index.d.ts +1 -0
- package/lib-esm/providers/kinesis-firehose/index.js +3 -0
- package/lib-esm/providers/kinesis-firehose/types/index.d.ts +1 -0
- package/lib-esm/providers/kinesis-firehose/types/index.js +3 -0
- package/lib-esm/providers/kinesis-firehose/types/inputs.d.ts +1 -0
- package/lib-esm/providers/kinesis-firehose/types/inputs.js +3 -0
- package/lib-esm/providers/pinpoint/apis/record.d.ts +8 -14
- package/lib-esm/providers/pinpoint/apis/record.js +11 -19
- package/lib-esm/providers/pinpoint/types/inputs.d.ts +4 -6
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/inputs.d.ts +1 -1
- package/package.json +15 -5
- package/src/errors/validation.ts +0 -4
- package/src/providers/kinesis-firehose/apis/index.ts +4 -0
- package/src/providers/kinesis-firehose/apis/record.ts +8 -0
- package/src/providers/kinesis-firehose/index.ts +4 -0
- package/src/providers/kinesis-firehose/types/index.ts +4 -0
- package/src/providers/kinesis-firehose/types/inputs.ts +4 -0
- package/src/providers/pinpoint/apis/record.ts +13 -20
- package/src/providers/pinpoint/types/inputs.ts +4 -6
- package/src/types/inputs.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/analytics",
|
|
3
|
-
"version": "7.0.1-console-preview.
|
|
3
|
+
"version": "7.0.1-console-preview.0bbe168.0+0bbe168",
|
|
4
4
|
"description": "Analytics category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
],
|
|
36
36
|
"kinesis": [
|
|
37
37
|
"./lib-esm/providers/kinesis/index.d.ts"
|
|
38
|
+
],
|
|
39
|
+
"kinesis-firehose": [
|
|
40
|
+
"./lib-esm/providers/kinesis-firehose/index.d.ts"
|
|
38
41
|
]
|
|
39
42
|
}
|
|
40
43
|
},
|
|
@@ -54,6 +57,11 @@
|
|
|
54
57
|
"import": "./lib-esm/providers/kinesis/index.js",
|
|
55
58
|
"require": "./lib/providers/kinesis/index.js"
|
|
56
59
|
},
|
|
60
|
+
"./kinesis-firehose": {
|
|
61
|
+
"types": "./lib-esm/providers/kinesis-firehose/index.d.ts",
|
|
62
|
+
"import": "./lib-esm/providers/kinesis-firehose/index.js",
|
|
63
|
+
"require": "./lib/providers/kinesis-firehose/index.js"
|
|
64
|
+
},
|
|
57
65
|
"./package.json": "./package.json"
|
|
58
66
|
},
|
|
59
67
|
"repository": {
|
|
@@ -71,17 +79,19 @@
|
|
|
71
79
|
"lib-esm",
|
|
72
80
|
"src",
|
|
73
81
|
"pinpoint",
|
|
74
|
-
"kinesis"
|
|
82
|
+
"kinesis",
|
|
83
|
+
"kinesis-firehose"
|
|
75
84
|
],
|
|
76
85
|
"dependencies": {
|
|
77
86
|
"tslib": "^2.5.0",
|
|
78
87
|
"uuid": "^9.0.0"
|
|
79
88
|
},
|
|
80
89
|
"peerDependencies": {
|
|
81
|
-
"@aws-amplify/core": "6.0.1-console-preview.
|
|
90
|
+
"@aws-amplify/core": "6.0.1-console-preview.0bbe168.0+0bbe168"
|
|
82
91
|
},
|
|
83
92
|
"devDependencies": {
|
|
84
|
-
"@aws-amplify/core": "6.0.1-console-preview.
|
|
93
|
+
"@aws-amplify/core": "6.0.1-console-preview.0bbe168.0+0bbe168",
|
|
94
|
+
"@aws-sdk/client-firehose": "3.398.0",
|
|
85
95
|
"@aws-sdk/client-kinesis": "3.398.0",
|
|
86
96
|
"@aws-sdk/types": "3.398.0",
|
|
87
97
|
"@types/uuid": "^9.0.0",
|
|
@@ -131,5 +141,5 @@
|
|
|
131
141
|
"<rootDir>/src/setupTests.ts"
|
|
132
142
|
]
|
|
133
143
|
},
|
|
134
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "0bbe168c66929877174b331c71f7666bb16529d6"
|
|
135
145
|
}
|
package/src/errors/validation.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { AmplifyErrorMap } from '@aws-amplify/core/internals/utils';
|
|
|
6
6
|
export enum AnalyticsValidationErrorCode {
|
|
7
7
|
NoAppId = 'NoAppId',
|
|
8
8
|
NoCredentials = 'NoCredentials',
|
|
9
|
-
NoEvent = 'NoEvent',
|
|
10
9
|
NoEventName = 'NoEventName',
|
|
11
10
|
NoRegion = 'NoRegion',
|
|
12
11
|
}
|
|
@@ -19,9 +18,6 @@ export const validationErrorMap: AmplifyErrorMap<AnalyticsValidationErrorCode> =
|
|
|
19
18
|
[AnalyticsValidationErrorCode.NoCredentials]: {
|
|
20
19
|
message: 'Credentials should not be empty.',
|
|
21
20
|
},
|
|
22
|
-
[AnalyticsValidationErrorCode.NoEvent]: {
|
|
23
|
-
message: 'An event is required to record.',
|
|
24
|
-
},
|
|
25
21
|
[AnalyticsValidationErrorCode.NoEventName]: {
|
|
26
22
|
message: 'Events must specify a name.',
|
|
27
23
|
},
|
|
@@ -21,40 +21,33 @@ const logger = new Logger('Analytics');
|
|
|
21
21
|
*
|
|
22
22
|
* @param {RecordInput} params The input object used to construct the request.
|
|
23
23
|
*
|
|
24
|
-
* @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
|
|
24
|
+
* @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
|
|
25
25
|
* configuration is incorrect.
|
|
26
|
-
*
|
|
26
|
+
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```ts
|
|
29
29
|
* // Send an event to Pinpoint
|
|
30
|
-
* record({
|
|
31
|
-
* event: {
|
|
32
|
-
* name: eventName,
|
|
33
|
-
* }
|
|
34
|
-
* })
|
|
30
|
+
* record({ name: eventName })
|
|
35
31
|
* ```
|
|
36
|
-
*
|
|
32
|
+
*
|
|
37
33
|
* @example
|
|
38
34
|
* ```ts
|
|
39
35
|
* // Send an event to Pinpoint with metrics & custom attributes
|
|
40
36
|
* record({
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* 'my-metric': metricValue
|
|
48
|
-
* }
|
|
37
|
+
* name: eventName,
|
|
38
|
+
* attributes: {
|
|
39
|
+
* 'my-attribute': attributeValue
|
|
40
|
+
* },
|
|
41
|
+
* metrics: {
|
|
42
|
+
* 'my-metric': metricValue
|
|
49
43
|
* }
|
|
50
44
|
* })
|
|
51
45
|
* ```
|
|
52
46
|
*/
|
|
53
|
-
export const record = (
|
|
47
|
+
export const record = (input: RecordInput): void => {
|
|
54
48
|
const { appId, region } = resolveConfig();
|
|
55
49
|
|
|
56
|
-
assertValidationError(!!
|
|
57
|
-
assertValidationError(!!event.name, AnalyticsValidationErrorCode.NoEventName);
|
|
50
|
+
assertValidationError(!!input.name, AnalyticsValidationErrorCode.NoEventName);
|
|
58
51
|
|
|
59
52
|
resolveCredentials()
|
|
60
53
|
.then(({ credentials, identityId }) => {
|
|
@@ -62,7 +55,7 @@ export const record = ({ event }: RecordInput): void => {
|
|
|
62
55
|
appId,
|
|
63
56
|
category: 'Analytics',
|
|
64
57
|
credentials,
|
|
65
|
-
event,
|
|
58
|
+
event: input,
|
|
66
59
|
identityId,
|
|
67
60
|
region,
|
|
68
61
|
userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),
|
|
@@ -8,11 +8,9 @@ import { AnalyticsIdentifyUserInput } from '../../../types';
|
|
|
8
8
|
/**
|
|
9
9
|
* Input type for Pinpoint record API.
|
|
10
10
|
*/
|
|
11
|
-
export type RecordInput =
|
|
12
|
-
/**
|
|
13
|
-
* An event to send to the default Analytics provider.
|
|
14
|
-
*/
|
|
15
|
-
event: PinpointAnalyticsEvent;
|
|
16
|
-
};
|
|
11
|
+
export type RecordInput = PinpointAnalyticsEvent;
|
|
17
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Input type for Pinpoint identifyUser API.
|
|
15
|
+
*/
|
|
18
16
|
export type IdentifyUserInput = AnalyticsIdentifyUserInput<IdentifyUserOptions>;
|
package/src/types/inputs.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { UserProfile } from '@aws-amplify/core';
|
|
|
5
5
|
import { AnalyticsServiceOptions } from '.';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Input type for `identifyUser`.
|
|
9
9
|
*/
|
|
10
10
|
export type AnalyticsIdentifyUserInput<
|
|
11
11
|
ServiceOptions extends AnalyticsServiceOptions = AnalyticsServiceOptions
|