@aws-amplify/analytics 7.0.13 → 7.0.14-unstable.278776f.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 (25) hide show
  1. package/dist/cjs/providers/kinesis/apis/record.js +21 -0
  2. package/dist/cjs/providers/kinesis/apis/record.js.map +1 -1
  3. package/dist/cjs/providers/kinesis-firehose/apis/record.js +17 -0
  4. package/dist/cjs/providers/kinesis-firehose/apis/record.js.map +1 -1
  5. package/dist/cjs/providers/personalize/apis/record.js +25 -0
  6. package/dist/cjs/providers/personalize/apis/record.js.map +1 -1
  7. package/dist/cjs/providers/pinpoint/apis/record.js +1 -1
  8. package/dist/cjs/providers/pinpoint/apis/record.js.map +1 -1
  9. package/dist/esm/providers/kinesis/apis/record.d.ts +21 -0
  10. package/dist/esm/providers/kinesis/apis/record.mjs +21 -0
  11. package/dist/esm/providers/kinesis/apis/record.mjs.map +1 -1
  12. package/dist/esm/providers/kinesis-firehose/apis/record.d.ts +17 -0
  13. package/dist/esm/providers/kinesis-firehose/apis/record.mjs +17 -0
  14. package/dist/esm/providers/kinesis-firehose/apis/record.mjs.map +1 -1
  15. package/dist/esm/providers/personalize/apis/record.d.ts +25 -0
  16. package/dist/esm/providers/personalize/apis/record.mjs +25 -0
  17. package/dist/esm/providers/personalize/apis/record.mjs.map +1 -1
  18. package/dist/esm/providers/pinpoint/apis/record.d.ts +1 -1
  19. package/dist/esm/providers/pinpoint/apis/record.mjs +1 -1
  20. package/dist/esm/providers/pinpoint/apis/record.mjs.map +1 -1
  21. package/package.json +113 -113
  22. package/src/providers/kinesis/apis/record.ts +21 -0
  23. package/src/providers/kinesis-firehose/apis/record.ts +17 -0
  24. package/src/providers/personalize/apis/record.ts +25 -0
  25. package/src/providers/pinpoint/apis/record.ts +1 -1
@@ -11,6 +11,27 @@ const util_utf8_1 = require("@smithy/util-utf8");
11
11
  const utils_2 = require("@aws-amplify/core/internals/utils");
12
12
  const core_1 = require("@aws-amplify/core");
13
13
  const logger = new core_1.ConsoleLogger('Kinesis');
14
+ /**
15
+ * Record one analytic event and send it to Kinesis. Events will be buffered and periodically sent to
16
+ * Kinesis.
17
+ *
18
+ * @param params The input object used to construct the request.
19
+ *
20
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
21
+ * configuration is incorrect.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * record({
26
+ * streamName: 'myKinesisStream',
27
+ * partitionKey: 'myPartitionKey',
28
+ * data: { } // The data blob to put into the record
29
+ * });
30
+ * ```
31
+ * @param input - The event to record.
32
+ *
33
+ * @returns void
34
+ */
14
35
  const record = ({ streamName, partitionKey, data, }) => {
15
36
  if (!(0, utils_1.isAnalyticsEnabled)()) {
16
37
  logger.debug('Analytics is disabled, event will not be recorded.');
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sources":["../../../../../src/providers/kinesis/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst getEventBuffer_1 = require(\"../utils/getEventBuffer\");\nconst resolveConfig_1 = require(\"../utils/resolveConfig\");\nconst utils_1 = require(\"../../../utils\");\nconst util_utf8_1 = require(\"@smithy/util-utf8\");\nconst utils_2 = require(\"@aws-amplify/core/internals/utils\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst logger = new core_1.ConsoleLogger('Kinesis');\nconst record = ({ streamName, partitionKey, data, }) => {\n if (!(0, utils_1.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = (0, resolveConfig_1.resolveConfig)();\n (0, utils_1.resolveCredentials)()\n .then(({ credentials, identityId }) => {\n const buffer = (0, getEventBuffer_1.getEventBuffer)({\n region,\n bufferSize,\n flushSize,\n flushInterval,\n credentials,\n identityId,\n resendLimit,\n userAgentValue: (0, utils_1.getAnalyticsUserAgentString)(utils_2.AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n partitionKey,\n event: ArrayBuffer.isView(data) ? data : (0, util_utf8_1.fromUtf8)(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,gBAAgB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAC1D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACjD,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;AACnD,MAAM,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,GAAG,KAAK;AACxD,IAAI,IAAI,CAAC,IAAI,OAAO,CAAC,kBAAkB,GAAG,EAAE;AAC5C,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,IAAI,eAAe,CAAC,aAAa,GAAG,CAAC;AAC/G,IAAI,IAAI,OAAO,CAAC,kBAAkB,GAAG;AACrC,SAAS,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK;AAC/C,QAAQ,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,cAAc,EAAE;AAC5D,YAAY,MAAM;AAClB,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,WAAW;AACvB,YAAY,cAAc,EAAE,IAAI,OAAO,CAAC,2BAA2B,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;AACpG,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,CAAC,MAAM,CAAC;AACtB,YAAY,MAAM;AAClB,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,YAAY,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACpG,YAAY,SAAS;AACrB,YAAY,UAAU,EAAE,CAAC;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB;AACA,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"record.js","sources":["../../../../../src/providers/kinesis/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst getEventBuffer_1 = require(\"../utils/getEventBuffer\");\nconst resolveConfig_1 = require(\"../utils/resolveConfig\");\nconst utils_1 = require(\"../../../utils\");\nconst util_utf8_1 = require(\"@smithy/util-utf8\");\nconst utils_2 = require(\"@aws-amplify/core/internals/utils\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst logger = new core_1.ConsoleLogger('Kinesis');\n/**\n * Record one analytic event and send it to Kinesis. Events will be buffered and periodically sent to\n * Kinesis.\n *\n * @param params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * record({\n * streamName: 'myKinesisStream',\n * partitionKey: 'myPartitionKey',\n * data: { } // The data blob to put into the record\n * });\n * ```\n * @param input - The event to record.\n *\n * @returns void\n */\nconst record = ({ streamName, partitionKey, data, }) => {\n if (!(0, utils_1.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = (0, resolveConfig_1.resolveConfig)();\n (0, utils_1.resolveCredentials)()\n .then(({ credentials, identityId }) => {\n const buffer = (0, getEventBuffer_1.getEventBuffer)({\n region,\n bufferSize,\n flushSize,\n flushInterval,\n credentials,\n identityId,\n resendLimit,\n userAgentValue: (0, utils_1.getAnalyticsUserAgentString)(utils_2.AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n partitionKey,\n event: ArrayBuffer.isView(data) ? data : (0, util_utf8_1.fromUtf8)(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,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AW;AACvB,YAAY,cAAc,EAAE,IAAI,OAAO,CAAC,2BAA2B,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;AACpG,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,CAAC,MAAM,CAAC;AACtB,YAAY,MAAM;AAClB,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,YAAY,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACpG,YAAY,SAAS;AACrB,YAAY,UAAU,EAAE,CAAC;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB;AACA,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -10,6 +10,23 @@ const util_utf8_1 = require("@smithy/util-utf8");
10
10
  const utils_3 = require("@aws-amplify/core/internals/utils");
11
11
  const core_1 = require("@aws-amplify/core");
12
12
  const logger = new core_1.ConsoleLogger('KinesisFirehose');
13
+ /**
14
+ * Record one analytic event and send it to Kinesis Data Firehose. Events will be buffered and periodically sent to
15
+ * Kinesis Data Firehose.
16
+ *
17
+ * @param params The input object used to construct the request.
18
+ *
19
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
20
+ * configuration is incorrect.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * record({
25
+ * streamName: 'myFirehoseStream',
26
+ * data: { } // The data blob to put into the record
27
+ * });
28
+ * ```
29
+ */
13
30
  const record = ({ streamName, data }) => {
14
31
  if (!(0, utils_2.isAnalyticsEnabled)()) {
15
32
  logger.debug('Analytics is disabled, event will not be recorded.');
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sources":["../../../../../src/providers/kinesis-firehose/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst utils_1 = require(\"../utils\");\nconst utils_2 = require(\"../../../utils\");\nconst util_utf8_1 = require(\"@smithy/util-utf8\");\nconst utils_3 = require(\"@aws-amplify/core/internals/utils\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst logger = new core_1.ConsoleLogger('KinesisFirehose');\nconst record = ({ streamName, data }) => {\n if (!(0, utils_2.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = (0, utils_1.resolveConfig)();\n (0, utils_2.resolveCredentials)()\n .then(({ credentials, identityId }) => {\n const buffer = (0, utils_1.getEventBuffer)({\n region,\n credentials,\n identityId,\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_3.AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n event: ArrayBuffer.isView(data) ? data : (0, util_utf8_1.fromUtf8)(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACjD,MAAM,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AY,SAAS;AACrB,YAAY,UAAU,EAAE,CAAC;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"record.js","sources":["../../../../../src/providers/kinesis-firehose/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst utils_1 = require(\"../utils\");\nconst utils_2 = require(\"../../../utils\");\nconst util_utf8_1 = require(\"@smithy/util-utf8\");\nconst utils_3 = require(\"@aws-amplify/core/internals/utils\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst logger = new core_1.ConsoleLogger('KinesisFirehose');\n/**\n * Record one analytic event and send it to Kinesis Data Firehose. Events will be buffered and periodically sent to\n * Kinesis Data Firehose.\n *\n * @param params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * record({\n * streamName: 'myFirehoseStream',\n * data: { } // The data blob to put into the record\n * });\n * ```\n */\nconst record = ({ streamName, data }) => {\n if (!(0, utils_2.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = (0, utils_1.resolveConfig)();\n (0, utils_2.resolveCredentials)()\n .then(({ credentials, identityId }) => {\n const buffer = (0, utils_1.getEventBuffer)({\n region,\n credentials,\n identityId,\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_3.AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n event: ArrayBuffer.isView(data) ? data : (0, util_utf8_1.fromUtf8)(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACjD,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK;AACzC,IAAI,IAAI,CAAC,IAAI,OAAO,CAAC,kBAAkB,GAAG,EAAE;AAC5C,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,IAAI,OAAO,CAAC,aAAa,GAAG,CAAC;AACvG,IAAI,IAAI,OAAO,CAAC,kBAAkB,GAAG;AACrC,SAAS,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK;AAC/C,QAAQ,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,cAAc,EAAE;AACnD,YAAY,MAAM;AAClB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,cAAc,EAAE,IAAI,OAAO,CAAC,2BAA2B,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;AACpG,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,CAAC,MAAM,CAAC;AACtB,YAAY,MAAM;AAClB,YAAY,UAAU;AACtB,YAAY,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACpG,YAAY,SAAS;AACrB,YAAY,UAAU,EAAE,CAAC;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -10,6 +10,31 @@ const utils_3 = require("@aws-amplify/core/internals/utils");
10
10
  const core_1 = require("@aws-amplify/core");
11
11
  const constants_1 = require("../utils/constants");
12
12
  const logger = new core_1.ConsoleLogger('Personalize');
13
+ /**
14
+ * Record one analytic event and send it to Personalize. Events will be buffered and periodically sent to Amazon
15
+ * Personalize.
16
+ *
17
+ * For more examples, you can refer to {@link https://docs.amplify.aws/javascript/build-a-backend/more-features/analytics/personalize-recommendations/#working-with-the-api the API usage guidance.}
18
+ *
19
+ * @param input The input object used to construct the request.
20
+ *
21
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
22
+ * configuration is incorrect.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * // Record an `Identify` event to Personalize.
27
+ * record({
28
+ * eventType: "Identify",
29
+ * properties: {
30
+ * userId: "<USER_ID>"
31
+ * }
32
+ * });
33
+ * ```
34
+ * @param input - The event to record.
35
+ *
36
+ * @returns void
37
+ */
13
38
  const record = ({ userId, eventId, eventType, properties, }) => {
14
39
  if (!(0, utils_2.isAnalyticsEnabled)()) {
15
40
  logger.debug('Analytics is disabled, event will not be recorded.');
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sources":["../../../../../src/providers/personalize/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst utils_1 = require(\"../utils\");\nconst utils_2 = require(\"../../../utils\");\nconst utils_3 = require(\"@aws-amplify/core/internals/utils\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst constants_1 = require(\"../utils/constants\");\nconst logger = new core_1.ConsoleLogger('Personalize');\nconst record = ({ userId, eventId, eventType, properties, }) => {\n if (!(0, utils_2.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const { region, trackingId, bufferSize, flushSize, flushInterval } = (0, utils_1.resolveConfig)();\n (0, utils_2.resolveCredentials)()\n .then(async ({ credentials, identityId }) => {\n const timestamp = Date.now();\n const { sessionId: cachedSessionId, userId: cachedUserId } = await (0, utils_1.resolveCachedSession)();\n if (eventType === constants_1.IDENTIFY_EVENT_TYPE) {\n (0, utils_1.updateCachedSession)(typeof properties.userId === 'string' ? properties.userId : '', cachedSessionId, cachedUserId);\n }\n else if (!!userId) {\n (0, utils_1.updateCachedSession)(userId, cachedSessionId, cachedUserId);\n }\n const { sessionId: updatedSessionId, userId: updatedUserId } = await (0, utils_1.resolveCachedSession)();\n const eventBuffer = (0, utils_1.getEventBuffer)({\n region,\n flushSize,\n flushInterval,\n bufferSize,\n credentials,\n identityId,\n userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_3.AnalyticsAction.Record),\n });\n if (eventType === constants_1.MEDIA_AUTO_TRACK_EVENT_TYPE) {\n (0, utils_1.autoTrackMedia)({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n }, eventBuffer);\n }\n else {\n eventBuffer.append({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n timestamp,\n });\n }\n if (eventBuffer.length >= bufferSize) {\n eventBuffer.flushAll();\n }\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;AACvD,MAAM,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK;AAChE,IAAI,IAAI,CAAC,IAAI,OAAO,CAAC,kBAAkB,GAAG,EAAE;AAC5C,QAAQ,MAAM,CAAC,KAAK,CAA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ACpG,SAAS,CAAC,CAAC;AACX,QAAQ,IAAI,SAAS,KAAK,WAAW,CAAC,2BAA2B,EAAE;AACnE,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE;AACxC,gBAAgB,UAAU;AAC1B,gBAAgB,SAAS,EAAE,gBAAgB;AAC3C,gBAAgB,MAAM,EAAE,aAAa;AACrC,gBAAgB,KAAK,EAAE;AACvB,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,UAAU;AAC9B,iBAAiB;AACjB,aAAa,EAAE,WAAW,CAAC,CAAC;AAC5B,SAAS;AACT,aAAa;AACb,YAAY,WAAW,CAAC,MAAM,CAAC;AAC/B,gBAAgB,UAAU;AAC1B,gBAAgB,SAAS,EAAE,gBAAgB;AAC3C,gBAAgB,MAAM,EAAE,aAAa;AACrC,gBAAgB,KAAK,EAAE;AACvB,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,UAAU;AAC9B,iBAAiB;AACjB,gBAAgB,SAAS;AACzB,aAAa,CAAC,CAAC;AACf,SAAS;AACT,QAAQ,IAAI,WAAW,CAAC,MAAM,IAAI,UAAU,EAAE;AAC9C,YAAY,WAAW,CAAC,QAAQ,EAAE,CAAC;AACnC,SAAS;AACT,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"record.js","sources":["../../../../../src/providers/personalize/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst utils_1 = require(\"../utils\");\nconst utils_2 = require(\"../../../utils\");\nconst utils_3 = require(\"@aws-amplify/core/internals/utils\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst constants_1 = require(\"../utils/constants\");\nconst logger = new core_1.ConsoleLogger('Personalize');\n/**\n * Record one analytic event and send it to Personalize. Events will be buffered and periodically sent to Amazon\n * Personalize.\n *\n * For more examples, you can refer to {@link https://docs.amplify.aws/javascript/build-a-backend/more-features/analytics/personalize-recommendations/#working-with-the-api the API usage guidance.}\n *\n * @param input The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * // Record an `Identify` event to Personalize.\n * record({\n * eventType: \"Identify\",\n * properties: {\n * userId: \"<USER_ID>\"\n * }\n * });\n * ```\n * @param input - The event to record.\n *\n * @returns void\n */\nconst record = ({ userId, eventId, eventType, properties, }) => {\n if (!(0, utils_2.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const { region, trackingId, bufferSize, flushSize, flushInterval } = (0, utils_1.resolveConfig)();\n (0, utils_2.resolveCredentials)()\n .then(async ({ credentials, identityId }) => {\n const timestamp = Date.now();\n const { sessionId: cachedSessionId, userId: cachedUserId } = await (0, utils_1.resolveCachedSession)();\n if (eventType === constants_1.IDENTIFY_EVENT_TYPE) {\n (0, utils_1.updateCachedSession)(typeof properties.userId === 'string' ? properties.userId : '', cachedSessionId, cachedUserId);\n }\n else if (!!userId) {\n (0, utils_1.updateCachedSession)(userId, cachedSessionId, cachedUserId);\n }\n const { sessionId: updatedSessionId, userId: updatedUserId } = await (0, utils_1.resolveCachedSession)();\n const eventBuffer = (0, utils_1.getEventBuffer)({\n region,\n flushSize,\n flushInterval,\n bufferSize,\n credentials,\n identityId,\n userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_3.AnalyticsAction.Record),\n });\n if (eventType === constants_1.MEDIA_AUTO_TRACK_EVENT_TYPE) {\n (0, utils_1.autoTrackMedia)({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n }, eventBuffer);\n }\n else {\n eventBuffer.append({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n timestamp,\n });\n }\n if (eventBuffer.length >= bufferSize) {\n eventBuffer.flushAll();\n }\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK;AAChE,IAAI,IAAI,CAAC,IAAI,OAAO,CAAC,kBAAkB,GAAG,EAAE;AAC5C,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,aA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gBAAgB,UAAU;AAC1B,gBAAgB,SAAS,EAAE,gBAAgB;AAC3C,gBAAgB,MAAM,EAAE,aAAa;AACrC,gBAAgB,KAAK,EAAE;AACvB,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,UAAU;AAC9B,iBAAiB;AACjB,aAAa,EAAE,WAAW,CAAC,CAAC;AAC5B,SAAS;AACT,aAAa;AACb,YAAY,WAAW,CAAC,MAAM,CAAC;AAC/B,gBAAgB,UAAU;AAC1B,gBAAgB,SAAS,EAAE,gBAAgB;AAC3C,gBAAgB,MAAM,EAAE,aAAa;AACrC,gBAAgB,KAAK,EAAE;AACvB,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,UAAU;AAC9B,iBAAiB;AACjB,gBAAgB,SAAS;AACzB,aAAa,CAAC,CAAC;AACf,SAAS;AACT,QAAQ,IAAI,WAAW,CAAC,MAAM,IAAI,UAAU,EAAE;AAC9C,YAAY,WAAW,CAAC,QAAQ,EAAE,CAAC;AACnC,SAAS;AACT,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -14,7 +14,7 @@ const logger = new core_1.ConsoleLogger('Analytics');
14
14
  /**
15
15
  * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
16
16
  *
17
- * @param {RecordInput} params The input object used to construct the request.
17
+ * @param params The input object used to construct the request.
18
18
  *
19
19
  * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
20
20
  * configuration is incorrect.
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst pinpoint_1 = require(\"@aws-amplify/core/internals/providers/pinpoint\");\nconst errors_1 = require(\"../../../errors\");\nconst utils_2 = require(\"../../../utils\");\nconst utils_3 = require(\"../utils\");\nconst logger = new core_1.ConsoleLogger('Analytics');\n/**\n * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.\n *\n * @param {RecordInput} params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint\n * record({ name: eventName })\n * ```\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint with metrics & custom attributes\n * record({\n * name: eventName,\n * attributes: {\n * 'my-attribute': attributeValue\n * },\n * metrics: {\n * 'my-metric': metricValue\n * }\n * })\n * ```\n */\nconst record = (input) => {\n const { appId, region, bufferSize, flushSize, flushInterval, resendLimit } = (0, utils_3.resolveConfig)();\n if (!(0, utils_2.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n (0, errors_1.assertValidationError)(!!input.name, errors_1.AnalyticsValidationErrorCode.NoEventName);\n (0, utils_3.resolveCredentials)()\n .then(({ credentials, identityId }) => {\n core_1.Hub.dispatch('analytics', { event: 'record', data: input, message: 'Recording Analytics event' }, 'Analytics', utils_1.AMPLIFY_SYMBOL);\n (0, pinpoint_1.record)({\n appId,\n category: 'Analytics',\n credentials,\n event: input,\n identityId,\n region,\n userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_1.AnalyticsAction.Record),\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;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ACrC,SAAS,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK;AAC/C,QAAQ,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,2BAA2B,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;AACtJ,QAAQ,IAAI,UAAU,CAAC,MAAM,EAAE;AAC/B,YAAY,KAAK;AACjB,YAAY,QAAQ,EAAE,WAAW;AACjC,YAAY,WAAW;AACvB,YAAY,KAAK,EAAE,KAAK;AACxB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc,EAAE,IAAI,OAAO,CAAC,2BAA2B,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;AACpG,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB;AACA,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"record.js","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.record = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst pinpoint_1 = require(\"@aws-amplify/core/internals/providers/pinpoint\");\nconst errors_1 = require(\"../../../errors\");\nconst utils_2 = require(\"../../../utils\");\nconst utils_3 = require(\"../utils\");\nconst logger = new core_1.ConsoleLogger('Analytics');\n/**\n * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.\n *\n * @param params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint\n * record({ name: eventName })\n * ```\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint with metrics & custom attributes\n * record({\n * name: eventName,\n * attributes: {\n * 'my-attribute': attributeValue\n * },\n * metrics: {\n * 'my-metric': metricValue\n * }\n * })\n * ```\n */\nconst record = (input) => {\n const { appId, region, bufferSize, flushSize, flushInterval, resendLimit } = (0, utils_3.resolveConfig)();\n if (!(0, utils_2.isAnalyticsEnabled)()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n (0, errors_1.assertValidationError)(!!input.name, errors_1.AnalyticsValidationErrorCode.NoEventName);\n (0, utils_3.resolveCredentials)()\n .then(({ credentials, identityId }) => {\n core_1.Hub.dispatch('analytics', { event: 'record', data: input, message: 'Recording Analytics event' }, 'Analytics', utils_1.AMPLIFY_SYMBOL);\n (0, pinpoint_1.record)({\n appId,\n category: 'Analytics',\n credentials,\n event: input,\n identityId,\n region,\n userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_1.AnalyticsAction.Record),\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\n};\nexports.record = record;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACxB,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7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AAM,EAAE;AAC/B,YAAY,KAAK;AACjB,YAAY,QAAQ,EAAE,WAAW;AACjC,YAAY,WAAW;AACvB,YAAY,KAAK,EAAE,KAAK;AACxB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc,EAAE,IAAI,OAAO,CAAC,2BAA2B,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;AACpG,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB;AACA,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -1,2 +1,23 @@
1
1
  import { RecordInput } from '../types';
2
+ /**
3
+ * Record one analytic event and send it to Kinesis. Events will be buffered and periodically sent to
4
+ * Kinesis.
5
+ *
6
+ * @param params The input object used to construct the request.
7
+ *
8
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
9
+ * configuration is incorrect.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * record({
14
+ * streamName: 'myKinesisStream',
15
+ * partitionKey: 'myPartitionKey',
16
+ * data: { } // The data blob to put into the record
17
+ * });
18
+ * ```
19
+ * @param input - The event to record.
20
+ *
21
+ * @returns void
22
+ */
2
23
  export declare const record: ({ streamName, partitionKey, data, }: RecordInput) => void;
@@ -15,6 +15,27 @@ import { ConsoleLogger } from '@aws-amplify/core';
15
15
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
  const logger = new ConsoleLogger('Kinesis');
18
+ /**
19
+ * Record one analytic event and send it to Kinesis. Events will be buffered and periodically sent to
20
+ * Kinesis.
21
+ *
22
+ * @param params The input object used to construct the request.
23
+ *
24
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
25
+ * configuration is incorrect.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * record({
30
+ * streamName: 'myKinesisStream',
31
+ * partitionKey: 'myPartitionKey',
32
+ * data: { } // The data blob to put into the record
33
+ * });
34
+ * ```
35
+ * @param input - The event to record.
36
+ *
37
+ * @returns void
38
+ */
18
39
  const record = ({ streamName, partitionKey, data, }) => {
19
40
  if (!isAnalyticsEnabled()) {
20
41
  logger.debug('Analytics is disabled, event will not be recorded.');
@@ -1 +1 @@
1
- {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/kinesis/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getEventBuffer } from '../utils/getEventBuffer';\nimport { resolveConfig } from '../utils/resolveConfig';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, resolveCredentials, } from '../../../utils';\nimport { fromUtf8 } from '@smithy/util-utf8';\nimport { AnalyticsAction } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger } from '@aws-amplify/core';\nconst logger = new ConsoleLogger('Kinesis');\nexport const record = ({ streamName, partitionKey, data, }) => {\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = resolveConfig();\n resolveCredentials()\n .then(({ credentials, identityId }) => {\n const buffer = getEventBuffer({\n region,\n bufferSize,\n flushSize,\n flushInterval,\n credentials,\n identityId,\n resendLimit,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n partitionKey,\n event: ArrayBuffer.isView(data) ? data : fromUtf8(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\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BAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/kinesis/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getEventBuffer } from '../utils/getEventBuffer';\nimport { resolveConfig } from '../utils/resolveConfig';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, resolveCredentials, } from '../../../utils';\nimport { fromUtf8 } from '@smithy/util-utf8';\nimport { AnalyticsAction } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger } from '@aws-amplify/core';\nconst logger = new ConsoleLogger('Kinesis');\n/**\n * Record one analytic event and send it to Kinesis. Events will be buffered and periodically sent to\n * Kinesis.\n *\n * @param params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * record({\n * streamName: 'myKinesisStream',\n * partitionKey: 'myPartitionKey',\n * data: { } // The data blob to put into the record\n * });\n * ```\n * @param input - The event to record.\n *\n * @returns void\n */\nexport const record = ({ streamName, partitionKey, data, }) => {\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = resolveConfig();\n resolveCredentials()\n .then(({ credentials, identityId }) => {\n const buffer = getEventBuffer({\n region,\n bufferSize,\n flushSize,\n flushInterval,\n credentials,\n identityId,\n resendLimit,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n partitionKey,\n event: ArrayBuffer.isView(data) ? data : fromUtf8(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\n};\n"],"names":[],"mappings":";;;;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AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB;AACA,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
@@ -1,2 +1,19 @@
1
1
  import { RecordInput } from '../types';
2
+ /**
3
+ * Record one analytic event and send it to Kinesis Data Firehose. Events will be buffered and periodically sent to
4
+ * Kinesis Data Firehose.
5
+ *
6
+ * @param params The input object used to construct the request.
7
+ *
8
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
9
+ * configuration is incorrect.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * record({
14
+ * streamName: 'myFirehoseStream',
15
+ * data: { } // The data blob to put into the record
16
+ * });
17
+ * ```
18
+ */
2
19
  export declare const record: ({ streamName, data }: RecordInput) => void;
@@ -15,6 +15,23 @@ import { ConsoleLogger } from '@aws-amplify/core';
15
15
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
16
16
  // SPDX-License-Identifier: Apache-2.0
17
17
  const logger = new ConsoleLogger('KinesisFirehose');
18
+ /**
19
+ * Record one analytic event and send it to Kinesis Data Firehose. Events will be buffered and periodically sent to
20
+ * Kinesis Data Firehose.
21
+ *
22
+ * @param params The input object used to construct the request.
23
+ *
24
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
25
+ * configuration is incorrect.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * record({
30
+ * streamName: 'myFirehoseStream',
31
+ * data: { } // The data blob to put into the record
32
+ * });
33
+ * ```
34
+ */
18
35
  const record = ({ streamName, data }) => {
19
36
  if (!isAnalyticsEnabled()) {
20
37
  logger.debug('Analytics is disabled, event will not be recorded.');
@@ -1 +1 @@
1
- {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/kinesis-firehose/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getEventBuffer, resolveConfig } from '../utils';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, resolveCredentials, } from '../../../utils';\nimport { fromUtf8 } from '@smithy/util-utf8';\nimport { AnalyticsAction } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger } from '@aws-amplify/core';\nconst logger = new ConsoleLogger('KinesisFirehose');\nexport const record = ({ streamName, data }) => {\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = resolveConfig();\n resolveCredentials()\n .then(({ credentials, identityId }) => {\n const buffer = getEventBuffer({\n region,\n credentials,\n identityId,\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n event: ArrayBuffer.isView(data) ? data : fromUtf8(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AAMA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC,CAAC;AACxC,MAAC,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK;AAChD,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;AAC/B,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAC;AAC1F,IAAI,kBAAkB,EAAE;AACxB,SAAS,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK;AAC/C,QAAQ,MAAM,MAAM,GAAG,cAAc,CAAC;AACtC,YAAY,MAAM;AAClB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,cAAc,EAAE,2BAA2B,CAAC,eAAe,CAAC,MAAM,CAAC;AAC/E,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,CAAC,MAAM,CAAC;AACtB,YAAY,MAAM;AAClB,YAAY,UAAU;AACtB,YAAY,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACnF,YAAY,SAAS;AACrB,YAAY,UAAU,EAAE,CAAC;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/kinesis-firehose/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getEventBuffer, resolveConfig } from '../utils';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, resolveCredentials, } from '../../../utils';\nimport { fromUtf8 } from '@smithy/util-utf8';\nimport { AnalyticsAction } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger } from '@aws-amplify/core';\nconst logger = new ConsoleLogger('KinesisFirehose');\n/**\n * Record one analytic event and send it to Kinesis Data Firehose. Events will be buffered and periodically sent to\n * Kinesis Data Firehose.\n *\n * @param params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * record({\n * streamName: 'myFirehoseStream',\n * data: { } // The data blob to put into the record\n * });\n * ```\n */\nexport const record = ({ streamName, data }) => {\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const timestamp = Date.now();\n const { region, bufferSize, flushSize, flushInterval, resendLimit } = resolveConfig();\n resolveCredentials()\n .then(({ credentials, identityId }) => {\n const buffer = getEventBuffer({\n region,\n credentials,\n identityId,\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n });\n buffer.append({\n region,\n streamName,\n event: ArrayBuffer.isView(data) ? data : fromUtf8(JSON.stringify(data)),\n timestamp,\n retryCount: 0,\n });\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AAMA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK;AAChD,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;AAC/B,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACjC,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAC;AAC1F,IAAI,kBAAkB,EAAE;AACxB,SAAS,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK;AAC/C,QAAQ,MAAM,MAAM,GAAG,cAAc,CAAC;AACtC,YAAY,MAAM;AAClB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,YAAY,cAAc,EAAE,2BAA2B,CAAC,eAAe,CAAC,MAAM,CAAC;AAC/E,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,CAAC,MAAM,CAAC;AACtB,YAAY,MAAM;AAClB,YAAY,UAAU;AACtB,YAAY,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACnF,YAAY,SAAS;AACrB,YAAY,UAAU,EAAE,CAAC;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
@@ -1,2 +1,27 @@
1
1
  import { RecordInput } from '../types';
2
+ /**
3
+ * Record one analytic event and send it to Personalize. Events will be buffered and periodically sent to Amazon
4
+ * Personalize.
5
+ *
6
+ * For more examples, you can refer to {@link https://docs.amplify.aws/javascript/build-a-backend/more-features/analytics/personalize-recommendations/#working-with-the-api the API usage guidance.}
7
+ *
8
+ * @param input The input object used to construct the request.
9
+ *
10
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
11
+ * configuration is incorrect.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * // Record an `Identify` event to Personalize.
16
+ * record({
17
+ * eventType: "Identify",
18
+ * properties: {
19
+ * userId: "<USER_ID>"
20
+ * }
21
+ * });
22
+ * ```
23
+ * @param input - The event to record.
24
+ *
25
+ * @returns void
26
+ */
2
27
  export declare const record: ({ userId, eventId, eventType, properties, }: RecordInput) => void;
@@ -17,6 +17,31 @@ import { ConsoleLogger } from '@aws-amplify/core';
17
17
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
18
18
  // SPDX-License-Identifier: Apache-2.0
19
19
  const logger = new ConsoleLogger('Personalize');
20
+ /**
21
+ * Record one analytic event and send it to Personalize. Events will be buffered and periodically sent to Amazon
22
+ * Personalize.
23
+ *
24
+ * For more examples, you can refer to {@link https://docs.amplify.aws/javascript/build-a-backend/more-features/analytics/personalize-recommendations/#working-with-the-api the API usage guidance.}
25
+ *
26
+ * @param input The input object used to construct the request.
27
+ *
28
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
29
+ * configuration is incorrect.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // Record an `Identify` event to Personalize.
34
+ * record({
35
+ * eventType: "Identify",
36
+ * properties: {
37
+ * userId: "<USER_ID>"
38
+ * }
39
+ * });
40
+ * ```
41
+ * @param input - The event to record.
42
+ *
43
+ * @returns void
44
+ */
20
45
  const record = ({ userId, eventId, eventType, properties, }) => {
21
46
  if (!isAnalyticsEnabled()) {
22
47
  logger.debug('Analytics is disabled, event will not be recorded.');
@@ -1 +1 @@
1
- {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/personalize/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { autoTrackMedia, getEventBuffer, resolveCachedSession, resolveConfig, updateCachedSession, } from '../utils';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, resolveCredentials, } from '../../../utils';\nimport { AnalyticsAction } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger } from '@aws-amplify/core';\nimport { IDENTIFY_EVENT_TYPE, MEDIA_AUTO_TRACK_EVENT_TYPE, } from '../utils/constants';\nconst logger = new ConsoleLogger('Personalize');\nexport const record = ({ userId, eventId, eventType, properties, }) => {\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const { region, trackingId, bufferSize, flushSize, flushInterval } = resolveConfig();\n resolveCredentials()\n .then(async ({ credentials, identityId }) => {\n const timestamp = Date.now();\n const { sessionId: cachedSessionId, userId: cachedUserId } = await resolveCachedSession();\n if (eventType === IDENTIFY_EVENT_TYPE) {\n updateCachedSession(typeof properties.userId === 'string' ? properties.userId : '', cachedSessionId, cachedUserId);\n }\n else if (!!userId) {\n updateCachedSession(userId, cachedSessionId, cachedUserId);\n }\n const { sessionId: updatedSessionId, userId: updatedUserId } = await resolveCachedSession();\n const eventBuffer = getEventBuffer({\n region,\n flushSize,\n flushInterval,\n bufferSize,\n credentials,\n identityId,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n });\n if (eventType === MEDIA_AUTO_TRACK_EVENT_TYPE) {\n autoTrackMedia({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n }, eventBuffer);\n }\n else {\n eventBuffer.append({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n timestamp,\n });\n }\n if (eventBuffer.length >= bufferSize) {\n eventBuffer.flushAll();\n }\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AAMA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,aAAa,CAAC,CAAC;AACpC,MAAC,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK;AACvE,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;AAC/B,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAAC;AACzF,IAAI,kBAAkB,EAAE;AACxB,SAAS,IAAI,CAAC,OAAO,EAAE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,gBAAgB,UAAU;AAC1B,gBAAgB,SAAS,EAAE,gBAAgB;AAC3C,gBAAgB,MAAM,EAAE,aAAa;AACrC,gBAAgB,KAAK,EAAE;AACvB,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,UAAU;AAC9B,iBAAiB;AACjB,gBAAgB,SAAS;AACzB,aAAa,CAAC,CAAC;AACf,SAAS;AACT,QAAQ,IAAI,WAAW,CAAC,MAAM,IAAI,UAAU,EAAE;AAC9C,YAAY,WAAW,CAAC,QAAQ,EAAE,CAAC;AACnC,SAAS;AACT,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/personalize/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { autoTrackMedia, getEventBuffer, resolveCachedSession, resolveConfig, updateCachedSession, } from '../utils';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, resolveCredentials, } from '../../../utils';\nimport { AnalyticsAction } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger } from '@aws-amplify/core';\nimport { IDENTIFY_EVENT_TYPE, MEDIA_AUTO_TRACK_EVENT_TYPE, } from '../utils/constants';\nconst logger = new ConsoleLogger('Personalize');\n/**\n * Record one analytic event and send it to Personalize. Events will be buffered and periodically sent to Amazon\n * Personalize.\n *\n * For more examples, you can refer to {@link https://docs.amplify.aws/javascript/build-a-backend/more-features/analytics/personalize-recommendations/#working-with-the-api the API usage guidance.}\n *\n * @param input The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * // Record an `Identify` event to Personalize.\n * record({\n * eventType: \"Identify\",\n * properties: {\n * userId: \"<USER_ID>\"\n * }\n * });\n * ```\n * @param input - The event to record.\n *\n * @returns void\n */\nexport const record = ({ userId, eventId, eventType, properties, }) => {\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n const { region, trackingId, bufferSize, flushSize, flushInterval } = resolveConfig();\n resolveCredentials()\n .then(async ({ credentials, identityId }) => {\n const timestamp = Date.now();\n const { sessionId: cachedSessionId, userId: cachedUserId } = await resolveCachedSession();\n if (eventType === IDENTIFY_EVENT_TYPE) {\n updateCachedSession(typeof properties.userId === 'string' ? properties.userId : '', cachedSessionId, cachedUserId);\n }\n else if (!!userId) {\n updateCachedSession(userId, cachedSessionId, cachedUserId);\n }\n const { sessionId: updatedSessionId, userId: updatedUserId } = await resolveCachedSession();\n const eventBuffer = getEventBuffer({\n region,\n flushSize,\n flushInterval,\n bufferSize,\n credentials,\n identityId,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n });\n if (eventType === MEDIA_AUTO_TRACK_EVENT_TYPE) {\n autoTrackMedia({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n }, eventBuffer);\n }\n else {\n eventBuffer.append({\n trackingId,\n sessionId: updatedSessionId,\n userId: updatedUserId,\n event: {\n eventId,\n eventType,\n properties,\n },\n timestamp,\n });\n }\n if (eventBuffer.length >= bufferSize) {\n eventBuffer.flushAll();\n }\n })\n .catch(e => {\n logger.warn('Failed to record event.', e);\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AAMA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,aAAa,CAAC,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,EAAE,MAAM,E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,SAAS,KAAK,2BAA2B,EAAE;AACvD,YAAY,cAAc,CAAC;AAC3B,gBAAgB,UAAU;AAC1B,gBAAgB,SAAS,EAAE,gBAAgB;AAC3C,gBAAgB,MAAM,EAAE,aAAa;AACrC,gBAAgB,KAAK,EAAE;AACvB,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,UAAU;AAC9B,iBAAiB;AACjB,aAAa,EAAE,WAAW,CAAC,CAAC;AAC5B,SAAS;AACT,aAAa;AACb,YAAY,WAAW,CAAC,MAAM,CAAC;AAC/B,gBAAgB,UAAU;AAC1B,gBAAgB,SAAS,EAAE,gBAAgB;AAC3C,gBAAgB,MAAM,EAAE,aAAa;AACrC,gBAAgB,KAAK,EAAE;AACvB,oBAAoB,OAAO;AAC3B,oBAAoB,SAAS;AAC7B,oBAAoB,UAAU;AAC9B,iBAAiB;AACjB,gBAAgB,SAAS;AACzB,aAAa,CAAC,CAAC;AACf,SAAS;AACT,QAAQ,IAAI,WAAW,CAAC,MAAM,IAAI,UAAU,EAAE;AAC9C,YAAY,WAAW,CAAC,QAAQ,EAAE,CAAC;AACnC,SAAS;AACT,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
@@ -2,7 +2,7 @@ import { RecordInput } from '../types';
2
2
  /**
3
3
  * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
4
4
  *
5
- * @param {RecordInput} params The input object used to construct the request.
5
+ * @param params The input object used to construct the request.
6
6
  *
7
7
  * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
8
8
  * configuration is incorrect.
@@ -18,7 +18,7 @@ const logger = new ConsoleLogger('Analytics');
18
18
  /**
19
19
  * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
20
20
  *
21
- * @param {RecordInput} params The input object used to construct the request.
21
+ * @param params The input object used to construct the request.
22
22
  *
23
23
  * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
24
24
  * configuration is incorrect.
@@ -1 +1 @@
1
- {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Hub, ConsoleLogger } from '@aws-amplify/core';\nimport { AMPLIFY_SYMBOL, AnalyticsAction, } from '@aws-amplify/core/internals/utils';\nimport { record as recordCore } from '@aws-amplify/core/internals/providers/pinpoint';\nimport { AnalyticsValidationErrorCode, assertValidationError, } from '../../../errors';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, } from '../../../utils';\nimport { resolveConfig, resolveCredentials } from '../utils';\nconst logger = new ConsoleLogger('Analytics');\n/**\n * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.\n *\n * @param {RecordInput} params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint\n * record({ name: eventName })\n * ```\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint with metrics & custom attributes\n * record({\n * name: eventName,\n * attributes: {\n * 'my-attribute': attributeValue\n * },\n * metrics: {\n * 'my-metric': metricValue\n * }\n * })\n * ```\n */\nexport const record = (input) => {\n const { appId, region, bufferSize, flushSize, flushInterval, resendLimit } = resolveConfig();\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n assertValidationError(!!input.name, AnalyticsValidationErrorCode.NoEventName);\n resolveCredentials()\n .then(({ credentials, identityId }) => {\n Hub.dispatch('analytics', { event: 'record', data: input, message: 'Recording Analytics event' }, 'Analytics', AMPLIFY_SYMBOL);\n recordCore({\n appId,\n category: 'Analytics',\n credentials,\n event: input,\n identityId,\n region,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\n};\n"],"names":["recordCore"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,KAAK,KAAK;AACjC,IAAI,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAC;AACjG,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;AAC/B,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,4BAA4B,CAAC,WAAW,CAAC,CAAC;AAClF,IAAI,kBAAkB,EAAE;AACxB,SAAS,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK;AAC/C,QAAQ,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,2BAA2B,EAAE,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AACvI,QAAQA,QAAU,CAAC;AACnB,YAAY,KAAK;AACjB,YAAY,QAAQ,EAAE,WAAW;AACjC,YAAY,WAAW;AACvB,YAAY,KAAK,EAAE,KAAK;AACxB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc,EAAE,2BAA2B,CAAC,eAAe,CAAC,MAAM,CAAC;AAC/E,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB;AACA,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Hub, ConsoleLogger } from '@aws-amplify/core';\nimport { AMPLIFY_SYMBOL, AnalyticsAction, } from '@aws-amplify/core/internals/utils';\nimport { record as recordCore } from '@aws-amplify/core/internals/providers/pinpoint';\nimport { AnalyticsValidationErrorCode, assertValidationError, } from '../../../errors';\nimport { getAnalyticsUserAgentString, isAnalyticsEnabled, } from '../../../utils';\nimport { resolveConfig, resolveCredentials } from '../utils';\nconst logger = new ConsoleLogger('Analytics');\n/**\n * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.\n *\n * @param params The input object used to construct the request.\n *\n * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect.\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint\n * record({ name: eventName })\n * ```\n *\n * @example\n * ```ts\n * // Send an event to Pinpoint with metrics & custom attributes\n * record({\n * name: eventName,\n * attributes: {\n * 'my-attribute': attributeValue\n * },\n * metrics: {\n * 'my-metric': metricValue\n * }\n * })\n * ```\n */\nexport const record = (input) => {\n const { appId, region, bufferSize, flushSize, flushInterval, resendLimit } = resolveConfig();\n if (!isAnalyticsEnabled()) {\n logger.debug('Analytics is disabled, event will not be recorded.');\n return;\n }\n assertValidationError(!!input.name, AnalyticsValidationErrorCode.NoEventName);\n resolveCredentials()\n .then(({ credentials, identityId }) => {\n Hub.dispatch('analytics', { event: 'record', data: input, message: 'Recording Analytics event' }, 'Analytics', AMPLIFY_SYMBOL);\n recordCore({\n appId,\n category: 'Analytics',\n credentials,\n event: input,\n identityId,\n region,\n userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.Record),\n bufferSize,\n flushSize,\n flushInterval,\n resendLimit,\n });\n })\n .catch(e => {\n // An error occured while fetching credentials or persisting the event to the buffer\n logger.warn('Failed to record event.', e);\n });\n};\n"],"names":["recordCore"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,MAAM,GAAG,CAAC,KAAK,KAAK;AACjC,IAAI,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAC;AACjG,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;AAC/B,QAAQ,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;AAC3E,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,4BAA4B,CAAC,WAAW,CAAC,CAAC;AAClF,IAAI,kBAAkB,EAAE;AACxB,SAAS,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK;AAC/C,QAAQ,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,2BAA2B,EAAE,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AACvI,QAAQA,QAAU,CAAC;AACnB,YAAY,KAAK;AACjB,YAAY,QAAQ,EAAE,WAAW;AACjC,YAAY,WAAW;AACvB,YAAY,KAAK,EAAE,KAAK;AACxB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc,EAAE,2BAA2B,CAAC,eAAe,CAAC,MAAM,CAAC;AAC/E,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,aAAa;AACzB,YAAY,WAAW;AACvB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,SAAS,KAAK,CAAC,CAAC,IAAI;AACpB;AACA,QAAQ,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;AAClD,KAAK,CAAC,CAAC;AACP;;;;"}
package/package.json CHANGED
@@ -1,115 +1,115 @@
1
1
  {
2
- "name": "@aws-amplify/analytics",
3
- "version": "7.0.13",
4
- "description": "Analytics category of aws-amplify",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.mjs",
7
- "react-native": "./src/index.ts",
8
- "typings": "./dist/esm/index.d.ts",
9
- "sideEffects": false,
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "scripts": {
14
- "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
15
- "test:watch": "tslint 'src/**/*.ts' && jest -w 1 --watch",
16
- "build-with-test": "npm run clean && npm run test && npm run build",
17
- "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
18
- "build:esm-cjs": "rollup -c rollup.config.mjs",
19
- "build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
20
- "build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
21
- "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
22
- "clean": "npm run clean:size && rimraf dist lib lib-esm",
23
- "clean:size": "rimraf dual-publish-tmp tmp*",
24
- "format": "echo \"Not implemented\"",
25
- "lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
26
- "ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 71.4"
27
- },
28
- "typesVersions": {
29
- ">=4.2": {
30
- "pinpoint": [
31
- "./dist/esm/providers/pinpoint/index.d.ts"
32
- ],
33
- "kinesis": [
34
- "./dist/esm/providers/kinesis/index.d.ts"
35
- ],
36
- "kinesis-firehose": [
37
- "./dist/esm/providers/kinesis-firehose/index.d.ts"
38
- ],
39
- "personalize": [
40
- "./dist/esm/providers/personalize/index.d.ts"
41
- ]
42
- }
43
- },
44
- "exports": {
45
- ".": {
46
- "types": "./dist/esm/index.d.ts",
47
- "import": "./dist/esm/index.mjs",
48
- "require": "./dist/cjs/index.js",
49
- "react-native": "./src/index.ts"
50
- },
51
- "./pinpoint": {
52
- "types": "./dist/esm/providers/pinpoint/index.d.ts",
53
- "import": "./dist/esm/providers/pinpoint/index.mjs",
54
- "require": "./dist/cjs/providers/pinpoint/index.js",
55
- "react-native": "./src/providers/pinpoint/index.ts"
56
- },
57
- "./kinesis": {
58
- "types": "./dist/esm/providers/kinesis/index.d.ts",
59
- "import": "./dist/esm/providers/kinesis/index.mjs",
60
- "require": "./dist/cjs/providers/kinesis/index.js",
61
- "react-native": "./src/providers/kinesis/index.ts"
62
- },
63
- "./kinesis-firehose": {
64
- "types": "./dist/esm/providers/kinesis-firehose/index.d.ts",
65
- "import": "./dist/esm/providers/kinesis-firehose/index.mjs",
66
- "require": "./dist/cjs/providers/kinesis-firehose/index.js",
67
- "react-native": "./src/providers/kinesis-firehose/index.ts"
68
- },
69
- "./personalize": {
70
- "types": "./dist/esm/providers/personalize/index.d.ts",
71
- "import": "./dist/esm/providers/personalize/index.mjs",
72
- "require": "./dist/cjs/providers/personalize/index.js",
73
- "react-native": "./src/providers/personalize/index.ts"
74
- },
75
- "./package.json": "./package.json"
76
- },
77
- "repository": {
78
- "type": "git",
79
- "url": "https://github.com/aws-amplify/amplify-js.git"
80
- },
81
- "author": "Amazon Web Services",
82
- "license": "Apache-2.0",
83
- "bugs": {
84
- "url": "https://github.com/aws/aws-amplify/issues"
85
- },
86
- "homepage": "https://aws-amplify.github.io/",
87
- "files": [
88
- "dist/cjs",
89
- "dist/esm",
90
- "src",
91
- "pinpoint",
92
- "kinesis",
93
- "kinesis-firehose",
94
- "personalize"
95
- ],
96
- "dependencies": {
97
- "@aws-sdk/client-firehose": "3.398.0",
98
- "@aws-sdk/client-kinesis": "3.398.0",
99
- "@aws-sdk/client-personalize-events": "3.398.0",
100
- "@smithy/util-utf8": "2.0.0",
101
- "tslib": "^2.5.0"
102
- },
103
- "peerDependencies": {
104
- "@aws-amplify/core": "^6.0.0"
105
- },
106
- "devDependencies": {
107
- "@aws-amplify/core": "6.0.13",
108
- "@aws-amplify/react-native": "1.0.13",
109
- "@aws-sdk/types": "3.398.0",
110
- "@rollup/plugin-typescript": "11.1.5",
111
- "rollup": "3.29.4",
112
- "typescript": "5.0.2"
113
- },
114
- "gitHead": "09816e5dfe231f71e4ce766428ac5997538f87be"
2
+ "name": "@aws-amplify/analytics",
3
+ "version": "7.0.14-unstable.278776f.0+278776f",
4
+ "description": "Analytics category of aws-amplify",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.mjs",
7
+ "react-native": "./src/index.ts",
8
+ "typings": "./dist/esm/index.d.ts",
9
+ "sideEffects": false,
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "scripts": {
14
+ "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
15
+ "test:watch": "tslint 'src/**/*.ts' && jest -w 1 --watch",
16
+ "build-with-test": "npm run clean && npm run test && npm run build",
17
+ "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
18
+ "build:esm-cjs": "rollup -c rollup.config.mjs",
19
+ "build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
20
+ "build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
21
+ "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
22
+ "clean": "npm run clean:size && rimraf dist lib lib-esm",
23
+ "clean:size": "rimraf dual-publish-tmp tmp*",
24
+ "format": "echo \"Not implemented\"",
25
+ "lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
26
+ "ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 71.4"
27
+ },
28
+ "typesVersions": {
29
+ ">=4.2": {
30
+ "pinpoint": [
31
+ "./dist/esm/providers/pinpoint/index.d.ts"
32
+ ],
33
+ "kinesis": [
34
+ "./dist/esm/providers/kinesis/index.d.ts"
35
+ ],
36
+ "kinesis-firehose": [
37
+ "./dist/esm/providers/kinesis-firehose/index.d.ts"
38
+ ],
39
+ "personalize": [
40
+ "./dist/esm/providers/personalize/index.d.ts"
41
+ ]
42
+ }
43
+ },
44
+ "exports": {
45
+ ".": {
46
+ "types": "./dist/esm/index.d.ts",
47
+ "import": "./dist/esm/index.mjs",
48
+ "require": "./dist/cjs/index.js",
49
+ "react-native": "./src/index.ts"
50
+ },
51
+ "./pinpoint": {
52
+ "types": "./dist/esm/providers/pinpoint/index.d.ts",
53
+ "import": "./dist/esm/providers/pinpoint/index.mjs",
54
+ "require": "./dist/cjs/providers/pinpoint/index.js",
55
+ "react-native": "./src/providers/pinpoint/index.ts"
56
+ },
57
+ "./kinesis": {
58
+ "types": "./dist/esm/providers/kinesis/index.d.ts",
59
+ "import": "./dist/esm/providers/kinesis/index.mjs",
60
+ "require": "./dist/cjs/providers/kinesis/index.js",
61
+ "react-native": "./src/providers/kinesis/index.ts"
62
+ },
63
+ "./kinesis-firehose": {
64
+ "types": "./dist/esm/providers/kinesis-firehose/index.d.ts",
65
+ "import": "./dist/esm/providers/kinesis-firehose/index.mjs",
66
+ "require": "./dist/cjs/providers/kinesis-firehose/index.js",
67
+ "react-native": "./src/providers/kinesis-firehose/index.ts"
68
+ },
69
+ "./personalize": {
70
+ "types": "./dist/esm/providers/personalize/index.d.ts",
71
+ "import": "./dist/esm/providers/personalize/index.mjs",
72
+ "require": "./dist/cjs/providers/personalize/index.js",
73
+ "react-native": "./src/providers/personalize/index.ts"
74
+ },
75
+ "./package.json": "./package.json"
76
+ },
77
+ "repository": {
78
+ "type": "git",
79
+ "url": "https://github.com/aws-amplify/amplify-js.git"
80
+ },
81
+ "author": "Amazon Web Services",
82
+ "license": "Apache-2.0",
83
+ "bugs": {
84
+ "url": "https://github.com/aws/aws-amplify/issues"
85
+ },
86
+ "homepage": "https://aws-amplify.github.io/",
87
+ "files": [
88
+ "dist/cjs",
89
+ "dist/esm",
90
+ "src",
91
+ "pinpoint",
92
+ "kinesis",
93
+ "kinesis-firehose",
94
+ "personalize"
95
+ ],
96
+ "dependencies": {
97
+ "@aws-sdk/client-firehose": "3.398.0",
98
+ "@aws-sdk/client-kinesis": "3.398.0",
99
+ "@aws-sdk/client-personalize-events": "3.398.0",
100
+ "@smithy/util-utf8": "2.0.0",
101
+ "tslib": "^2.5.0"
102
+ },
103
+ "peerDependencies": {
104
+ "@aws-amplify/core": "6.0.14-unstable.278776f.0+278776f"
105
+ },
106
+ "devDependencies": {
107
+ "@aws-amplify/core": "6.0.14-unstable.278776f.0+278776f",
108
+ "@aws-amplify/react-native": "1.0.14-unstable.278776f.0+278776f",
109
+ "@aws-sdk/types": "3.398.0",
110
+ "@rollup/plugin-typescript": "11.1.5",
111
+ "rollup": "3.29.4",
112
+ "typescript": "5.0.2"
113
+ },
114
+ "gitHead": "278776f84b5eea768ea36949a7dc38543bc4d50d"
115
115
  }
@@ -15,6 +15,27 @@ import { ConsoleLogger } from '@aws-amplify/core';
15
15
 
16
16
  const logger = new ConsoleLogger('Kinesis');
17
17
 
18
+ /**
19
+ * Record one analytic event and send it to Kinesis. Events will be buffered and periodically sent to
20
+ * Kinesis.
21
+ *
22
+ * @param params The input object used to construct the request.
23
+ *
24
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
25
+ * configuration is incorrect.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * record({
30
+ * streamName: 'myKinesisStream',
31
+ * partitionKey: 'myPartitionKey',
32
+ * data: { } // The data blob to put into the record
33
+ * });
34
+ * ```
35
+ * @param input - The event to record.
36
+ *
37
+ * @returns void
38
+ */
18
39
  export const record = ({
19
40
  streamName,
20
41
  partitionKey,
@@ -14,6 +14,23 @@ import { ConsoleLogger } from '@aws-amplify/core';
14
14
 
15
15
  const logger = new ConsoleLogger('KinesisFirehose');
16
16
 
17
+ /**
18
+ * Record one analytic event and send it to Kinesis Data Firehose. Events will be buffered and periodically sent to
19
+ * Kinesis Data Firehose.
20
+ *
21
+ * @param params The input object used to construct the request.
22
+ *
23
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
24
+ * configuration is incorrect.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * record({
29
+ * streamName: 'myFirehoseStream',
30
+ * data: { } // The data blob to put into the record
31
+ * });
32
+ * ```
33
+ */
17
34
  export const record = ({ streamName, data }: RecordInput): void => {
18
35
  if (!isAnalyticsEnabled()) {
19
36
  logger.debug('Analytics is disabled, event will not be recorded.');
@@ -23,6 +23,31 @@ import {
23
23
 
24
24
  const logger = new ConsoleLogger('Personalize');
25
25
 
26
+ /**
27
+ * Record one analytic event and send it to Personalize. Events will be buffered and periodically sent to Amazon
28
+ * Personalize.
29
+ *
30
+ * For more examples, you can refer to {@link https://docs.amplify.aws/javascript/build-a-backend/more-features/analytics/personalize-recommendations/#working-with-the-api the API usage guidance.}
31
+ *
32
+ * @param input The input object used to construct the request.
33
+ *
34
+ * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
35
+ * configuration is incorrect.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // Record an `Identify` event to Personalize.
40
+ * record({
41
+ * eventType: "Identify",
42
+ * properties: {
43
+ * userId: "<USER_ID>"
44
+ * }
45
+ * });
46
+ * ```
47
+ * @param input - The event to record.
48
+ *
49
+ * @returns void
50
+ */
26
51
  export const record = ({
27
52
  userId,
28
53
  eventId,
@@ -23,7 +23,7 @@ const logger = new ConsoleLogger('Analytics');
23
23
  /**
24
24
  * Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
25
25
  *
26
- * @param {RecordInput} params The input object used to construct the request.
26
+ * @param params The input object used to construct the request.
27
27
  *
28
28
  * @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
29
29
  * configuration is incorrect.