@aws-amplify/analytics 7.0.1-console-preview.67f944e.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.
Files changed (73) hide show
  1. package/kinesis-firehose/package.json +7 -0
  2. package/lib/errors/validation.d.ts +0 -1
  3. package/lib/errors/validation.js +0 -4
  4. package/lib/providers/kinesis-firehose/apis/index.d.ts +1 -0
  5. package/lib/providers/kinesis-firehose/apis/index.js +7 -0
  6. package/lib/providers/kinesis-firehose/apis/record.d.ts +2 -0
  7. package/lib/providers/kinesis-firehose/apis/record.js +9 -0
  8. package/lib/providers/kinesis-firehose/index.d.ts +1 -0
  9. package/lib/providers/kinesis-firehose/index.js +6 -0
  10. package/lib/providers/kinesis-firehose/types/index.d.ts +1 -0
  11. package/lib/providers/kinesis-firehose/types/index.js +6 -0
  12. package/lib/providers/kinesis-firehose/types/inputs.d.ts +1 -0
  13. package/lib/providers/kinesis-firehose/types/inputs.js +4 -0
  14. package/lib/providers/pinpoint/apis/identifyUser.d.ts +7 -5
  15. package/lib/providers/pinpoint/apis/identifyUser.js +14 -9
  16. package/lib/providers/pinpoint/apis/record.d.ts +8 -14
  17. package/lib/providers/pinpoint/apis/record.js +11 -19
  18. package/lib/providers/pinpoint/types/index.d.ts +1 -0
  19. package/lib/providers/pinpoint/types/inputs.d.ts +4 -17
  20. package/lib/providers/pinpoint/types/options.d.ts +5 -0
  21. package/lib/providers/pinpoint/types/options.js +4 -0
  22. package/lib/tsconfig.tsbuildinfo +1 -1
  23. package/lib/types/analytics.d.ts +1 -1
  24. package/lib/types/index.d.ts +3 -1
  25. package/lib/types/index.js +0 -2
  26. package/lib/types/inputs.d.ts +21 -0
  27. package/lib/types/inputs.js +4 -0
  28. package/lib/types/options.d.ts +4 -0
  29. package/lib/types/options.js +4 -0
  30. package/lib-esm/errors/validation.d.ts +0 -1
  31. package/lib-esm/errors/validation.js +0 -4
  32. package/lib-esm/providers/kinesis-firehose/apis/index.d.ts +1 -0
  33. package/lib-esm/providers/kinesis-firehose/apis/index.js +3 -0
  34. package/lib-esm/providers/kinesis-firehose/apis/record.d.ts +2 -0
  35. package/lib-esm/providers/kinesis-firehose/apis/record.js +5 -0
  36. package/lib-esm/providers/kinesis-firehose/index.d.ts +1 -0
  37. package/lib-esm/providers/kinesis-firehose/index.js +3 -0
  38. package/lib-esm/providers/kinesis-firehose/types/index.d.ts +1 -0
  39. package/lib-esm/providers/kinesis-firehose/types/index.js +3 -0
  40. package/lib-esm/providers/kinesis-firehose/types/inputs.d.ts +1 -0
  41. package/lib-esm/providers/kinesis-firehose/types/inputs.js +3 -0
  42. package/lib-esm/providers/pinpoint/apis/identifyUser.d.ts +7 -5
  43. package/lib-esm/providers/pinpoint/apis/identifyUser.js +14 -9
  44. package/lib-esm/providers/pinpoint/apis/record.d.ts +8 -14
  45. package/lib-esm/providers/pinpoint/apis/record.js +11 -19
  46. package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
  47. package/lib-esm/providers/pinpoint/types/inputs.d.ts +4 -17
  48. package/lib-esm/providers/pinpoint/types/options.d.ts +5 -0
  49. package/lib-esm/providers/pinpoint/types/options.js +3 -0
  50. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  51. package/lib-esm/types/analytics.d.ts +1 -1
  52. package/lib-esm/types/index.d.ts +3 -1
  53. package/lib-esm/types/index.js +1 -1
  54. package/lib-esm/types/inputs.d.ts +21 -0
  55. package/lib-esm/types/inputs.js +3 -0
  56. package/lib-esm/types/options.d.ts +4 -0
  57. package/lib-esm/types/options.js +3 -0
  58. package/package.json +15 -5
  59. package/src/errors/validation.ts +0 -4
  60. package/src/providers/kinesis-firehose/apis/index.ts +4 -0
  61. package/src/providers/kinesis-firehose/apis/record.ts +8 -0
  62. package/src/providers/kinesis-firehose/index.ts +4 -0
  63. package/src/providers/kinesis-firehose/types/index.ts +4 -0
  64. package/src/providers/kinesis-firehose/types/inputs.ts +4 -0
  65. package/src/providers/pinpoint/apis/identifyUser.ts +13 -8
  66. package/src/providers/pinpoint/apis/record.ts +13 -20
  67. package/src/providers/pinpoint/types/index.ts +1 -0
  68. package/src/providers/pinpoint/types/inputs.ts +4 -18
  69. package/src/providers/pinpoint/types/options.ts +12 -0
  70. package/src/types/analytics.ts +1 -1
  71. package/src/types/index.ts +15 -1
  72. package/src/types/inputs.ts +29 -0
  73. package/src/types/options.ts +7 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@aws-amplify/analytics/kinesis-firehose",
3
+ "main": "../lib/providers/kinesis-firehose/index.js",
4
+ "browser": "../lib-esm/providers/kinesis-firehose/index.js",
5
+ "module": "../lib-esm/providers/kinesis-firehose/index.js",
6
+ "typings": "../lib-esm/providers/kinesis-firehose/index.d.ts"
7
+ }
@@ -2,7 +2,6 @@ import { AmplifyErrorMap } from '@aws-amplify/core/internals/utils';
2
2
  export declare enum AnalyticsValidationErrorCode {
3
3
  NoAppId = "NoAppId",
4
4
  NoCredentials = "NoCredentials",
5
- NoEvent = "NoEvent",
6
5
  NoEventName = "NoEventName",
7
6
  NoRegion = "NoRegion"
8
7
  }
@@ -8,7 +8,6 @@ var AnalyticsValidationErrorCode;
8
8
  (function (AnalyticsValidationErrorCode) {
9
9
  AnalyticsValidationErrorCode["NoAppId"] = "NoAppId";
10
10
  AnalyticsValidationErrorCode["NoCredentials"] = "NoCredentials";
11
- AnalyticsValidationErrorCode["NoEvent"] = "NoEvent";
12
11
  AnalyticsValidationErrorCode["NoEventName"] = "NoEventName";
13
12
  AnalyticsValidationErrorCode["NoRegion"] = "NoRegion";
14
13
  })(AnalyticsValidationErrorCode = exports.AnalyticsValidationErrorCode || (exports.AnalyticsValidationErrorCode = {}));
@@ -19,9 +18,6 @@ exports.validationErrorMap = (_a = {},
19
18
  _a[AnalyticsValidationErrorCode.NoCredentials] = {
20
19
  message: 'Credentials should not be empty.',
21
20
  },
22
- _a[AnalyticsValidationErrorCode.NoEvent] = {
23
- message: 'An event is required to record.',
24
- },
25
21
  _a[AnalyticsValidationErrorCode.NoEventName] = {
26
22
  message: 'Events must specify a name.',
27
23
  },
@@ -0,0 +1 @@
1
+ export { record } from './record';
@@ -0,0 +1,7 @@
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.record = void 0;
6
+ var record_1 = require("./record");
7
+ Object.defineProperty(exports, "record", { enumerable: true, get: function () { return record_1.record; } });
@@ -0,0 +1,2 @@
1
+ import { RecordInput } from '../types';
2
+ export declare const record: (input: RecordInput) => void;
@@ -0,0 +1,9 @@
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.record = void 0;
6
+ var record = function (input) {
7
+ throw new Error('Not Yet Implemented');
8
+ };
9
+ exports.record = record;
@@ -0,0 +1 @@
1
+ export * from './apis';
@@ -0,0 +1,6 @@
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
+ var tslib_1 = require("tslib");
6
+ tslib_1.__exportStar(require("./apis"), exports);
@@ -0,0 +1 @@
1
+ export * from './inputs';
@@ -0,0 +1,6 @@
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
+ var tslib_1 = require("tslib");
6
+ tslib_1.__exportStar(require("./inputs"), exports);
@@ -0,0 +1 @@
1
+ export type RecordInput = {};
@@ -0,0 +1,4 @@
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 });
@@ -19,8 +19,9 @@ import { IdentifyUserInput } from '../types';
19
19
  * await identifyUser({
20
20
  * userId,
21
21
  * userProfile: {
22
- * attributes: {
23
- * email: [userEmail],
22
+ * email: [userEmail]
23
+ * customProperties: {
24
+ * phoneNumber: ['555-555-5555'],
24
25
  * },
25
26
  * }
26
27
  * });
@@ -32,8 +33,9 @@ import { IdentifyUserInput } from '../types';
32
33
  * await identifyUser({
33
34
  * userId,
34
35
  * userProfile: {
35
- * attributes: {
36
- * email: [userEmail],
36
+ * email: [userEmail]
37
+ * customProperties: {
38
+ * phoneNumber: ['555-555-5555'],
37
39
  * },
38
40
  * demographic: {
39
41
  * platform: 'ios',
@@ -42,4 +44,4 @@ import { IdentifyUserInput } from '../types';
42
44
  * }
43
45
  * });
44
46
  */
45
- export declare const identifyUser: ({ userId, userProfile, }: IdentifyUserInput) => Promise<void>;
47
+ export declare const identifyUser: ({ userId, userProfile, options, }: IdentifyUserInput) => Promise<void>;
@@ -28,8 +28,9 @@ var utils_2 = require("../utils");
28
28
  * await identifyUser({
29
29
  * userId,
30
30
  * userProfile: {
31
- * attributes: {
32
- * email: [userEmail],
31
+ * email: [userEmail]
32
+ * customProperties: {
33
+ * phoneNumber: ['555-555-5555'],
33
34
  * },
34
35
  * }
35
36
  * });
@@ -41,8 +42,9 @@ var utils_2 = require("../utils");
41
42
  * await identifyUser({
42
43
  * userId,
43
44
  * userProfile: {
44
- * attributes: {
45
- * email: [userEmail],
45
+ * email: [userEmail]
46
+ * customProperties: {
47
+ * phoneNumber: ['555-555-5555'],
46
48
  * },
47
49
  * demographic: {
48
50
  * platform: 'ios',
@@ -52,21 +54,24 @@ var utils_2 = require("../utils");
52
54
  * });
53
55
  */
54
56
  var identifyUser = function (_a) {
55
- var userId = _a.userId, userProfile = _a.userProfile;
57
+ var userId = _a.userId, userProfile = _a.userProfile, options = _a.options;
56
58
  return tslib_1.__awaiter(void 0, void 0, void 0, function () {
57
- var _b, credentials, identityId, _c, appId, region;
58
- return tslib_1.__generator(this, function (_d) {
59
- switch (_d.label) {
59
+ var _b, credentials, identityId, _c, appId, region, userAttributes;
60
+ var _d;
61
+ return tslib_1.__generator(this, function (_e) {
62
+ switch (_e.label) {
60
63
  case 0: return [4 /*yield*/, (0, utils_2.resolveCredentials)()];
61
64
  case 1:
62
- _b = _d.sent(), credentials = _b.credentials, identityId = _b.identityId;
65
+ _b = _e.sent(), credentials = _b.credentials, identityId = _b.identityId;
63
66
  _c = (0, utils_2.resolveConfig)(), appId = _c.appId, region = _c.region;
67
+ userAttributes = ((_d = options === null || options === void 0 ? void 0 : options.serviceOptions) !== null && _d !== void 0 ? _d : {}).userAttributes;
64
68
  (0, pinpoint_1.updateEndpoint)({
65
69
  appId: appId,
66
70
  category: 'Analytics',
67
71
  credentials: credentials,
68
72
  identityId: identityId,
69
73
  region: region,
74
+ userAttributes: userAttributes,
70
75
  userId: userId,
71
76
  userProfile: userProfile,
72
77
  userAgentValue: (0, userAgent_1.getAnalyticsUserAgentString)(utils_1.AnalyticsAction.UpdateEndpoint),
@@ -10,27 +10,21 @@ import { RecordInput } from '../types';
10
10
  * @example
11
11
  * ```ts
12
12
  * // Send an event to Pinpoint
13
- * record({
14
- * event: {
15
- * name: eventName,
16
- * }
17
- * })
13
+ * record({ name: eventName })
18
14
  * ```
19
15
  *
20
16
  * @example
21
17
  * ```ts
22
18
  * // Send an event to Pinpoint with metrics & custom attributes
23
19
  * record({
24
- * event: {
25
- * name: eventName,
26
- * attributes: {
27
- * 'my-attribute': attributeValue
28
- * },
29
- * metrics: {
30
- * 'my-metric': metricValue
31
- * }
20
+ * name: eventName,
21
+ * attributes: {
22
+ * 'my-attribute': attributeValue
23
+ * },
24
+ * metrics: {
25
+ * 'my-metric': metricValue
32
26
  * }
33
27
  * })
34
28
  * ```
35
29
  */
36
- export declare const record: ({ event }: RecordInput) => void;
30
+ export declare const record: (input: RecordInput) => void;
@@ -20,34 +20,26 @@ var logger = new utils_1.ConsoleLogger('Analytics');
20
20
  * @example
21
21
  * ```ts
22
22
  * // Send an event to Pinpoint
23
- * record({
24
- * event: {
25
- * name: eventName,
26
- * }
27
- * })
23
+ * record({ name: eventName })
28
24
  * ```
29
25
  *
30
26
  * @example
31
27
  * ```ts
32
28
  * // Send an event to Pinpoint with metrics & custom attributes
33
29
  * record({
34
- * event: {
35
- * name: eventName,
36
- * attributes: {
37
- * 'my-attribute': attributeValue
38
- * },
39
- * metrics: {
40
- * 'my-metric': metricValue
41
- * }
30
+ * name: eventName,
31
+ * attributes: {
32
+ * 'my-attribute': attributeValue
33
+ * },
34
+ * metrics: {
35
+ * 'my-metric': metricValue
42
36
  * }
43
37
  * })
44
38
  * ```
45
39
  */
46
- var record = function (_a) {
47
- var event = _a.event;
48
- var _b = (0, utils_2.resolveConfig)(), appId = _b.appId, region = _b.region;
49
- (0, errors_1.assertValidationError)(!!event, errors_1.AnalyticsValidationErrorCode.NoEvent);
50
- (0, errors_1.assertValidationError)(!!event.name, errors_1.AnalyticsValidationErrorCode.NoEventName);
40
+ var record = function (input) {
41
+ var _a = (0, utils_2.resolveConfig)(), appId = _a.appId, region = _a.region;
42
+ (0, errors_1.assertValidationError)(!!input.name, errors_1.AnalyticsValidationErrorCode.NoEventName);
51
43
  (0, utils_2.resolveCredentials)()
52
44
  .then(function (_a) {
53
45
  var credentials = _a.credentials, identityId = _a.identityId;
@@ -55,7 +47,7 @@ var record = function (_a) {
55
47
  appId: appId,
56
48
  category: 'Analytics',
57
49
  credentials: credentials,
58
- event: event,
50
+ event: input,
59
51
  identityId: identityId,
60
52
  region: region,
61
53
  userAgentValue: (0, userAgent_1.getAnalyticsUserAgentString)(utils_1.AnalyticsAction.Record),
@@ -1,2 +1,3 @@
1
1
  export { UpdateEndpointException } from './errors';
2
2
  export { RecordInput, IdentifyUserInput } from './inputs';
3
+ export { IdentifyUserOptions } from './options';
@@ -1,24 +1,11 @@
1
- import { UserProfile } from '@aws-amplify/core';
2
1
  import { PinpointAnalyticsEvent } from '@aws-amplify/core/internals/providers/pinpoint';
2
+ import { IdentifyUserOptions } from '.';
3
+ import { AnalyticsIdentifyUserInput } from '../../../types';
3
4
  /**
4
5
  * Input type for Pinpoint record API.
5
6
  */
6
- export type RecordInput = {
7
- /**
8
- * An event to send to the default Analytics provider.
9
- */
10
- event: PinpointAnalyticsEvent;
11
- };
7
+ export type RecordInput = PinpointAnalyticsEvent;
12
8
  /**
13
9
  * Input type for Pinpoint identifyUser API.
14
10
  */
15
- export type IdentifyUserInput = {
16
- /**
17
- * A User ID associated to the current device.
18
- */
19
- userId: string;
20
- /**
21
- * Additional information about the user and their device.
22
- */
23
- userProfile: UserProfile;
24
- };
11
+ export type IdentifyUserInput = AnalyticsIdentifyUserInput<IdentifyUserOptions>;
@@ -0,0 +1,5 @@
1
+ import { PinpointServiceOptions } from '@aws-amplify/core/internals/providers/pinpoint';
2
+ /**
3
+ * Options specific to Pinpoint identityUser.
4
+ */
5
+ export type IdentifyUserOptions = Pick<PinpointServiceOptions, 'userAttributes'>;
@@ -0,0 +1,4 @@
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 });