From 9a8569ab98480ad96b53a7104366640c66343aa2 Mon Sep 17 00:00:00 2001
From: AllanZhengYP Credentials for the provided identity ID. The Access Key portion of the credentials. The Secret Access Key portion of the credentials The Session Token portion of the credentials The date at which these credentials will expire. Input to the A unique identifier in the format REGION:GUID. A set of optional name-value pairs that map provider names to provider tokens. The
+ * name-value pair will follow the syntax "provider_name":
+ * "provider_user_identifier". Logins should not be specified when trying to get credentials for an unauthenticated
+ * identity. The Logins parameter is required when using identities associated with external
+ * identity providers such as Facebook. For examples of The Amazon Resource Name (ARN) of the role to be assumed when multiple roles were
+ * received in the token from the identity provider. For example, a SAML-based identity
+ * provider. This parameter is optional for identity providers that do not support role
+ * customization. Returned in response to a successful A unique identifier in the format REGION:GUID. Credentials for the provided identity ID. Input to the GetId action. A standard AWS account ID (9+ digits). An identity pool ID in the format REGION:GUID. A set of optional name-value pairs that map provider names to provider tokens. The
+ * available provider names for Facebook: Amazon Cognito user pool:
+ * Google: Amazon: Twitter: Digits: Returned in response to a GetId request. A unique identifier in the format REGION:GUID. Specifies attribute-based criteria for including or excluding endpoints from a segment. The type of segment dimension to use. Valid values are: GetCredentialsForIdentity
action.Logins
maps, see the code
+ * examples in the External Identity Providers section of the Amazon Cognito Developer
+ * Guide.GetCredentialsForIdentity
+ * operation.Logins
are as follows:
+ *
+ */
+ Logins?: Recordgraph.facebook.com
+ * cognito-idp.
,
+ * for example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789
.
+ * accounts.google.com
+ * www.amazon.com
+ * api.twitter.com
+ * www.digits.com
+ *
The criteria values to use for the segment dimension. Depending on the value of the AttributeType property, endpoints are included or excluded from the segment if their attribute values match the criteria values.
+ */ + Values: string[] | undefined; +} +/** + * @public + *Specifies the settings for events that cause a campaign to be sent.
+ */ +export interface CampaignEventFilter { + /** + *The dimension settings of the event filter for the campaign.
+ */ + Dimensions: EventDimensions | undefined; + /** + *The type of event that causes the campaign to be sent. Valid values are: SYSTEM, sends the campaign when a system event occurs; and, ENDPOINT, sends the campaign when an endpoint event (Events resource) occurs.
+ */ + FilterType: FilterType | string | undefined; +} +/** + * @public + *Default button configuration.
+ */ +export interface DefaultButtonConfiguration { + /** + *The background color of the button.
+ */ + BackgroundColor?: string; + /** + *The border radius of the button.
+ */ + BorderRadius?: number; + /** + *Action triggered by the button.
+ */ + ButtonAction: ButtonAction | string | undefined; + /** + *Button destination.
+ */ + Link?: string; + /** + *Button text.
+ */ + Text: string | undefined; + /** + *The text color of the button.
+ */ + TextColor?: string; +} +/** + * @public + *Specifies demographic information about an endpoint, such as the applicable time zone and platform.
+ */ +export interface EndpointDemographic { + /** + *The version of the app that's associated with the endpoint.
+ */ + AppVersion?: string; + /** + *The locale of the endpoint, in the following format: the ISO 639-1 alpha-2 code, followed by an underscore (_), followed by an ISO 3166-1 alpha-2 value.
+ */ + Locale?: string; + /** + *The manufacturer of the endpoint device, such as apple or samsung.
+ */ + Make?: string; + /** + *The model name or number of the endpoint device, such as iPhone or SM-G900F.
+ */ + Model?: string; + /** + *The model version of the endpoint device.
+ */ + ModelVersion?: string; + /** + *The platform of the endpoint device, such as ios.
+ */ + Platform?: string; + /** + *The platform version of the endpoint device.
+ */ + PlatformVersion?: string; + /** + *The time zone of the endpoint, specified as a tz database name value, such as America/Los_Angeles.
+ */ + Timezone?: string; +} +/** + * @public + *Provides the status code and message that result from processing data for an endpoint.
+ */ +export interface EndpointItemResponse { + /** + *The custom message that's returned in the response as a result of processing the endpoint data.
+ */ + Message?: string; + /** + *The status code that's returned in the response as a result of processing the endpoint data.
+ */ + StatusCode?: number; +} +/** + * @public + *Specifies geographic information about an endpoint.
+ */ +export interface EndpointLocation { + /** + *The name of the city where the endpoint is located.
+ */ + City?: string; + /** + *The two-character code, in ISO 3166-1 alpha-2 format, for the country or region where the endpoint is located. For example, US for the United States.
+ */ + Country?: string; + /** + *The latitude coordinate of the endpoint location, rounded to one decimal place.
+ */ + Latitude?: number; + /** + *The longitude coordinate of the endpoint location, rounded to one decimal place.
+ */ + Longitude?: number; + /** + *The postal or ZIP code for the area where the endpoint is located.
+ */ + PostalCode?: string; + /** + *The name of the region where the endpoint is located. For locations in the United States, this value is the name of a state.
+ */ + Region?: string; +} +/** + * @public + *Specifies the channel type and other settings for an endpoint.
+ */ +export interface EndpointRequest { + /** + *The destination address for messages or push notifications that you send to the endpoint. The address varies by channel. For a push-notification channel, use the token provided by the push notification service, such as an Apple Push Notification service (APNs) device token or a Firebase Cloud Messaging (FCM) registration token. For the SMS channel, use a phone number in E.164 format, such as +12065550100. For the email channel, use an email address.
+ */ + Address?: string; + /** + *One or more custom attributes that describe the endpoint by associating a name with an array of values. For example, the value of a custom attribute named Interests might be: ["Science", "Music", "Travel"]. You can use these attributes as filter criteria when you create segments. Attribute names are case sensitive.
An attribute name can contain up to 50 characters. An attribute value can contain up to 100 characters. When you define the name of a custom attribute, avoid using the following characters: number sign (#), colon (:), question mark (?), backslash (\), and slash (/). The Amazon Pinpoint console can't display attribute names that contain these characters. This restriction doesn't apply to attribute values.
+ */ + Attributes?: RecordThe channel to use when sending messages or push notifications to the endpoint.
+ */ + ChannelType?: ChannelType | string; + /** + *The demographic information for the endpoint, such as the time zone and platform.
+ */ + Demographic?: EndpointDemographic; + /** + *The date and time, in ISO 8601 format, when the endpoint is updated.
+ */ + EffectiveDate?: string; + /** + *Specifies whether to send messages or push notifications to the endpoint. Valid values are: ACTIVE, messages are sent to the endpoint; and, INACTIVE, messages aren’t sent to the endpoint.
Amazon Pinpoint automatically sets this value to ACTIVE when you create an endpoint or update an existing endpoint. Amazon Pinpoint automatically sets this value to INACTIVE if you update another endpoint that has the same address specified by the Address property.
+ */ + EndpointStatus?: string; + /** + *The geographic information for the endpoint.
+ */ + Location?: EndpointLocation; + /** + *One or more custom metrics that your app reports to Amazon Pinpoint for the endpoint.
+ */ + Metrics?: RecordSpecifies whether the user who's associated with the endpoint has opted out of receiving messages and push notifications from you. Possible values are: ALL, the user has opted out and doesn't want to receive any messages or push notifications; and, NONE, the user hasn't opted out and wants to receive all messages and push notifications.
+ */ + OptOut?: string; + /** + *The unique identifier for the most recent request to update the endpoint.
+ */ + RequestId?: string; + /** + *One or more custom attributes that describe the user who's associated with the endpoint.
+ */ + User?: EndpointUser; +} +/** + * @public + *Specifies data for one or more attributes that describe the user who's associated with an endpoint.
+ */ +export interface EndpointUser { + /** + *One or more custom attributes that describe the user by associating a name with an array of values. For example, the value of an attribute named Interests might be: ["Science", "Music", "Travel"]. You can use these attributes as filter criteria when you create segments. Attribute names are case sensitive.
An attribute name can contain up to 50 characters. An attribute value can contain up to 100 characters. When you define the name of a custom attribute, avoid using the following characters: number sign (#), colon (:), question mark (?), backslash (\), and slash (/). The Amazon Pinpoint console can't display attribute names that contain these characters. This restriction doesn't apply to attribute values.
+ */ + UserAttributes?: RecordThe unique identifier for the user.
+ */ + UserId?: string; +} +/** + * @public + *Specifies information about an event that reports data to Amazon Pinpoint.
+ */ +export interface Event { + /** + *The package name of the app that's recording the event.
+ */ + AppPackageName?: string; + /** + *The title of the app that's recording the event.
+ */ + AppTitle?: string; + /** + *The version number of the app that's recording the event.
+ */ + AppVersionCode?: string; + /** + *One or more custom attributes that are associated with the event.
+ */ + Attributes?: RecordThe version of the SDK that's running on the client device.
+ */ + ClientSdkVersion?: string; + /** + *The name of the event.
+ */ + EventType: string | undefined; + /** + *One or more custom metrics that are associated with the event.
+ */ + Metrics?: RecordThe name of the SDK that's being used to record the event.
+ */ + SdkName?: string; + /** + *Information about the session in which the event occurred.
+ */ + Session?: Session; + /** + *The date and time, in ISO 8601 format, when the event occurred.
+ */ + Timestamp: string | undefined; +} +/** + * @public + *Specifies the dimensions for an event filter that determines when a campaign is sent or a journey activity is performed.
+ */ +export interface EventDimensions { + /** + *One or more custom attributes that your application reports to Amazon Pinpoint. You can use these attributes as selection criteria when you create an event filter.
+ */ + Attributes?: RecordThe name of the event that causes the campaign to be sent or the journey activity to be performed. This can be a standard event that Amazon Pinpoint generates, such as _email.delivered. For campaigns, this can also be a custom event that's specific to your application. For information about standard events, see Streaming Amazon Pinpoint Events in the Amazon Pinpoint Developer Guide.
+ */ + EventType?: SetDimension; + /** + *One or more custom metrics that your application reports to Amazon Pinpoint. You can use these metrics as selection criteria when you create an event filter.
+ */ + Metrics?: RecordProvides the status code and message that result from processing an event.
+ */ +export interface EventItemResponse { + /** + *A custom message that's returned in the response as a result of processing the event.
+ */ + Message?: string; + /** + *The status code that's returned in the response as a result of processing the event. Possible values are: 202, for events that were accepted; and, 400, for events that weren't valid.
+ */ + StatusCode?: number; +} +/** + * @public + *Specifies a batch of endpoints and events to process.
+ */ +export interface EventsBatch { + /** + *A set of properties and attributes that are associated with the endpoint.
+ */ + Endpoint: PublicEndpoint | undefined; + /** + *A set of properties that are associated with the event.
+ */ + Events: RecordSpecifies a batch of events to process.
+ */ +export interface EventsRequest { + /** + *The batch of events to process. For each item in a batch, the endpoint ID acts as a key that has an EventsBatch object as its value.
+ */ + BatchItem: RecordProvides information about endpoints and the events that they're associated with.
+ */ +export interface EventsResponse { + /** + *A map that contains a multipart response for each endpoint. For each item in this object, the endpoint ID is the key and the item response is the value. If no item response exists, the value can also be one of the following: 202, the request was processed successfully; or 400, the payload wasn't valid or required fields were missing.
+ */ + Results?: RecordThe unique identifier for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.
+ */ + ApplicationId: string | undefined; + /** + *The unique identifier for the endpoint.
+ */ + EndpointId: string | undefined; +} +/** + * @public + */ +export interface GetInAppMessagesResponse { + /** + *Get in-app messages response object.
+ */ + InAppMessagesResponse: InAppMessagesResponse | undefined; +} +/** + * @public + *Schedule of the campaign.
+ */ +export interface InAppCampaignSchedule { + /** + *The scheduled time after which the in-app message should not be shown. Timestamp is in ISO 8601 format.
+ */ + EndDate?: string; + /** + *The event filter the SDK has to use to show the in-app message in the application.
+ */ + EventFilter?: CampaignEventFilter; + /** + *Time during which the in-app message should not be shown to the user.
+ */ + QuietTime?: QuietTime; +} +/** + * @public + *Provides all fields required for building an in-app message.
+ */ +export interface InAppMessage { + /** + *In-app message content.
+ */ + Content?: InAppMessageContent[]; + /** + *Custom config to be sent to SDK.
+ */ + CustomConfig?: RecordThe layout of the message.
+ */ + Layout?: Layout | string; +} +/** + * @public + *Text config for Message Body.
+ */ +export interface InAppMessageBodyConfig { + /** + *The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
+ */ + Alignment: Alignment | string | undefined; + /** + *Message Body.
+ */ + Body: string | undefined; + /** + *The text color.
+ */ + TextColor: string | undefined; +} +/** + * @public + *Button Config for an in-app message.
+ */ +export interface InAppMessageButton { + /** + *Default button content.
+ */ + Android?: OverrideButtonConfiguration; + /** + *Default button content.
+ */ + DefaultConfig?: DefaultButtonConfiguration; + /** + *Default button content.
+ */ + IOS?: OverrideButtonConfiguration; + /** + *Default button content.
+ */ + Web?: OverrideButtonConfiguration; +} +/** + * @public + *Targeted in-app message campaign.
+ */ +export interface InAppMessageCampaign { + /** + *Campaign id of the corresponding campaign.
+ */ + CampaignId?: string; + /** + *Daily cap which controls the number of times any in-app messages can be shown to the endpoint during a day.
+ */ + DailyCap?: number; + /** + *In-app message content with all fields required for rendering an in-app message.
+ */ + InAppMessage?: InAppMessage; + /** + *Priority of the in-app message.
+ */ + Priority?: number; + /** + *Schedule of the campaign.
+ */ + Schedule?: InAppCampaignSchedule; + /** + *Session cap which controls the number of times an in-app message can be shown to the endpoint during an application session.
+ */ + SessionCap?: number; + /** + *Total cap which controls the number of times an in-app message can be shown to the endpoint.
+ */ + TotalCap?: number; + /** + *Treatment id of the campaign.
+ */ + TreatmentId?: string; +} +/** + * @public + *The configuration for the message content.
+ */ +export interface InAppMessageContent { + /** + *The background color for the message.
+ */ + BackgroundColor?: string; + /** + *The configuration for the message body.
+ */ + BodyConfig?: InAppMessageBodyConfig; + /** + *The configuration for the message header.
+ */ + HeaderConfig?: InAppMessageHeaderConfig; + /** + *The image url for the background of message.
+ */ + ImageUrl?: string; + /** + *The first button inside the message.
+ */ + PrimaryBtn?: InAppMessageButton; + /** + *The second button inside message.
+ */ + SecondaryBtn?: InAppMessageButton; +} +/** + * @public + *Text config for Message Header.
+ */ +export interface InAppMessageHeaderConfig { + /** + *The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
+ */ + Alignment: Alignment | string | undefined; + /** + *Message Header.
+ */ + Header: string | undefined; + /** + *The text color.
+ */ + TextColor: string | undefined; +} +/** + * @public + *Get in-app messages response object.
+ */ +export interface InAppMessagesResponse { + /** + *List of targeted in-app message campaigns.
+ */ + InAppMessageCampaigns?: InAppMessageCampaign[]; +} +/** + * @public + *Provides information about the results of a request to create or update an endpoint that's associated with an event.
+ */ +export interface ItemResponse { + /** + *The response that was received after the endpoint data was accepted.
+ */ + EndpointItemResponse?: EndpointItemResponse; + /** + *A multipart response object that contains a key and a value for each event in the request. In each object, the event ID is the key and an EventItemResponse object is the value.
+ */ + EventsItemResponse?: RecordProvides information about an API request or response.
+ */ +export interface MessageBody { + /** + *The message that's returned from the API.
+ */ + Message?: string; + /** + *The unique identifier for the request or response.
+ */ + RequestID?: string; +} +/** + * @public + *Specifies metric-based criteria for including or excluding endpoints from a segment. These criteria derive from custom metrics that you define for endpoints.
+ */ +export interface MetricDimension { + /** + *The operator to use when comparing metric values. Valid values are: GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, and EQUAL.
+ */ + ComparisonOperator: string | undefined; + /** + *The value to compare.
+ */ + Value: number | undefined; +} +/** + * @public + *Override button configuration.
+ */ +export interface OverrideButtonConfiguration { + /** + *Action triggered by the button.
+ */ + ButtonAction: ButtonAction | string | undefined; + /** + *Button destination.
+ */ + Link?: string; +} +/** + * @public + *Specifies the properties and attributes of an endpoint that's associated with an event.
+ */ +export interface PublicEndpoint { + /** + *The unique identifier for the recipient, such as a device token, email address, or mobile phone number.
+ */ + Address?: string; + /** + *One or more custom attributes that describe the endpoint by associating a name with an array of values. You can use these attributes as filter criteria when you create segments.
+ */ + Attributes?: RecordThe channel that's used when sending messages or push notifications to the endpoint.
+ */ + ChannelType?: ChannelType | string; + /** + *The demographic information for the endpoint, such as the time zone and platform.
+ */ + Demographic?: EndpointDemographic; + /** + *The date and time, in ISO 8601 format, when the endpoint was last updated.
+ */ + EffectiveDate?: string; + /** + *Specifies whether to send messages or push notifications to the endpoint. Valid values are: ACTIVE, messages are sent to the endpoint; and, INACTIVE, messages aren’t sent to the endpoint.
Amazon Pinpoint automatically sets this value to ACTIVE when you create an endpoint or update an existing endpoint. Amazon Pinpoint automatically sets this value to INACTIVE if you update another endpoint that has the same address specified by the Address property.
+ */ + EndpointStatus?: string; + /** + *The geographic information for the endpoint.
+ */ + Location?: EndpointLocation; + /** + *One or more custom metrics that your app reports to Amazon Pinpoint for the endpoint.
+ */ + Metrics?: RecordSpecifies whether the user who's associated with the endpoint has opted out of receiving messages and push notifications from you. Possible values are: ALL, the user has opted out and doesn't want to receive any messages or push notifications; and, NONE, the user hasn't opted out and wants to receive all messages and push notifications.
+ */ + OptOut?: string; + /** + *A unique identifier that's generated each time the endpoint is updated.
+ */ + RequestId?: string; + /** + *One or more custom user attributes that your app reports to Amazon Pinpoint for the user who's associated with the endpoint.
+ */ + User?: EndpointUser; +} +/** + * @public + * + * The input for {@link PutEventsCommand}. + */ +export interface PutEventsCommandInput extends PutEventsRequest {} +/** + * @public + * + * The output of {@link PutEventsCommand}. + */ +export interface PutEventsCommandOutput + extends PutEventsResponse, + __MetadataBearer {} +/** + * @public + */ +export interface PutEventsRequest { + /** + *The unique identifier for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.
+ */ + ApplicationId: string | undefined; + /** + *Specifies a batch of events to process.
+ */ + EventsRequest: EventsRequest | undefined; +} +/** + * @public + */ +export interface PutEventsResponse { + /** + *Provides information about endpoints and the events that they're associated with.
+ */ + EventsResponse: EventsResponse | undefined; +} +/** + * @public + *Specifies the start and end times that define a time range when messages aren't sent to endpoints.
+ */ +export interface QuietTime { + /** + *The specific time when quiet time ends. This value has to use 24-hour notation and be in HH:MM format, where HH is the hour (with a leading zero, if applicable) and MM is the minutes. For example, use 02:30 to represent 2:30 AM, or 14:30 to represent 2:30 PM.
+ */ + End?: string; + /** + *The specific time when quiet time begins. This value has to use 24-hour notation and be in HH:MM format, where HH is the hour (with a leading zero, if applicable) and MM is the minutes. For example, use 02:30 to represent 2:30 AM, or 14:30 to represent 2:30 PM.
+ */ + Start?: string; +} +/** + * @public + *Provides information about a session.
+ */ +export interface Session { + /** + *The duration of the session, in milliseconds.
+ */ + Duration?: number; + /** + *The unique identifier for the session.
+ */ + Id: string | undefined; + /** + *The date and time when the session began.
+ */ + StartTimestamp: string | undefined; + /** + *The date and time when the session ended.
+ */ + StopTimestamp?: string; +} +/** + * @public + *Specifies the dimension type and values for a segment dimension.
+ */ +export interface SetDimension { + /** + *The type of segment dimension to use. Valid values are: INCLUSIVE, endpoints that match the criteria are included in the segment; and, EXCLUSIVE, endpoints that match the criteria are excluded from the segment.
+ */ + DimensionType?: DimensionType | string; + /** + *The criteria values to use for the segment dimension. Depending on the value of the DimensionType property, endpoints are included or excluded from the segment if their values match the criteria values.
+ */ + Values: string[] | undefined; +} +/** + * @public + * + * The input for {@link UpdateEndpointCommand}. + */ +export interface UpdateEndpointCommandInput extends UpdateEndpointRequest {} +/** + * @public + * + * The output of {@link UpdateEndpointCommand}. + */ +export interface UpdateEndpointCommandOutput + extends UpdateEndpointResponse, + __MetadataBearer {} +/** + * @public + */ +export interface UpdateEndpointRequest { + /** + *The unique identifier for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.
+ */ + ApplicationId: string | undefined; + /** + *The unique identifier for the endpoint.
+ */ + EndpointId: string | undefined; + /** + *Specifies the channel type and other settings for an endpoint.
+ */ + EndpointRequest: EndpointRequest | undefined; +} +/** + * @public + */ +export interface UpdateEndpointResponse { + /** + *Provides information about an API request or response.
+ */ + MessageBody: MessageBody | undefined; +} +/** + * @public + */ +export type Alignment = (typeof Alignment)[keyof typeof Alignment]; +/** + * @public + */ +export type AttributeType = (typeof AttributeType)[keyof typeof AttributeType]; +/** + * @public + */ +export type ButtonAction = (typeof ButtonAction)[keyof typeof ButtonAction]; +/** + * @public + */ +export type ChannelType = (typeof ChannelType)[keyof typeof ChannelType]; +/** + * @public + */ +export type DimensionType = (typeof DimensionType)[keyof typeof DimensionType]; +/** + * @public + */ +export type FilterType = (typeof FilterType)[keyof typeof FilterType]; +/** + * @public + */ +export type Layout = (typeof Layout)[keyof typeof Layout]; + +export {}; diff --git a/packages/core/src/AwsClients/Pinpoint/updateEndpoint.ts b/packages/core/src/AwsClients/Pinpoint/updateEndpoint.ts index 99ebc4e9a1d..cf7f30216a9 100644 --- a/packages/core/src/AwsClients/Pinpoint/updateEndpoint.ts +++ b/packages/core/src/AwsClients/Pinpoint/updateEndpoint.ts @@ -1,10 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import type { - UpdateEndpointCommandInput as UpdateEndpointInput, - UpdateEndpointCommandOutput as UpdateEndpointOutput, -} from '@aws-sdk/client-pinpoint'; import { authenticatedHandler } from '../../clients/handlers/authenticated'; import { composeServiceApi } from '../../clients/internal/composeServiceApi'; import { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent'; @@ -15,6 +11,10 @@ import { } from '../../clients/serde'; import { Endpoint, HttpRequest, HttpResponse } from '../../clients/types'; import { defaultConfig, getSharedHeaders } from './base'; +import type { + UpdateEndpointCommandInput as UpdateEndpointInput, + UpdateEndpointCommandOutput as UpdateEndpointOutput, +} from './types'; export type { UpdateEndpointInput, UpdateEndpointOutput }; diff --git a/packages/core/tslint.json b/packages/core/tslint.json index 9ede9f85fac..f4f64297075 100644 --- a/packages/core/tslint.json +++ b/packages/core/tslint.json @@ -12,7 +12,7 @@ "limit": 120 } ], - "no-empty-interface": true, + "no-empty-interface": false, "no-var-keyword": true, "object-literal-shorthand": true, "no-eval": true, diff --git a/packages/notifications/__mocks__/data.ts b/packages/notifications/__mocks__/data.ts index a6ddd2c8b40..8edd8de5adb 100644 --- a/packages/notifications/__mocks__/data.ts +++ b/packages/notifications/__mocks__/data.ts @@ -4,7 +4,7 @@ import type { Event, InAppMessageCampaign as PinpointInAppMessage, -} from '@aws-sdk/client-pinpoint'; +} from '@aws-amplify/core/internals/aws-clients/pinpoint'; import { InAppMessage, InAppMessagingEvent } from '../src/InAppMessaging'; import { PushNotificationMessage } from '../src/PushNotification'; import { UserInfo } from '../src'; diff --git a/packages/notifications/__tests__/InAppMessaging/Providers/AWSPinpointProvider/utils.test.ts b/packages/notifications/__tests__/InAppMessaging/Providers/AWSPinpointProvider/utils.test.ts index 43ec20a04fa..c5df3686df1 100644 --- a/packages/notifications/__tests__/InAppMessaging/Providers/AWSPinpointProvider/utils.test.ts +++ b/packages/notifications/__tests__/InAppMessaging/Providers/AWSPinpointProvider/utils.test.ts @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import type { InAppMessageCampaign as PinpointInAppMessage } from '@aws-sdk/client-pinpoint'; +import type { InAppMessageCampaign as PinpointInAppMessage } from '@aws-amplify/core/internals/aws-clients/pinpoint'; import { Amplify, ConsoleLogger, Hub } from '@aws-amplify/core'; import cloneDeep from 'lodash/cloneDeep'; diff --git a/packages/notifications/package.json b/packages/notifications/package.json index 6e50ff4d9c7..968e0f41da5 100644 --- a/packages/notifications/package.json +++ b/packages/notifications/package.json @@ -52,7 +52,6 @@ "@aws-amplify/cache": "5.0.32", "@aws-amplify/core": "5.3.0", "@aws-amplify/rtn-push-notification": "1.1.1", - "@aws-sdk/client-pinpoint": "3.186.1", "lodash": "^4.17.21", "uuid": "^3.2.1" }, diff --git a/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts b/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts index fdb8e05a9c7..e00becb7ff1 100644 --- a/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts +++ b/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts @@ -1,12 +1,11 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -// TODO: [v6] do not leak AWS SDK types to public so we can remove it from runtime dependencies. -import type { InAppMessageCampaign as PinpointInAppMessage } from '@aws-sdk/client-pinpoint'; import { getInAppMessages, GetInAppMessagesInput, GetInAppMessagesOutput, + InAppMessageCampaign as PinpointInAppMessage, } from '@aws-amplify/core/internals/aws-clients/pinpoint'; import { addEventListener, AWSPinpointProviderCommon } from '../../../common'; diff --git a/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/utils.ts b/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/utils.ts index e8e869e52a8..29643ff9bcf 100644 --- a/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/utils.ts +++ b/packages/notifications/src/InAppMessaging/Providers/AWSPinpointProvider/utils.ts @@ -2,8 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { Amplify, ConsoleLogger, Hub } from '@aws-amplify/core'; -// TODO: [v6] do not leak AWS SDK types to public so we can remove it from runtime dependencies. -import type { InAppMessageCampaign as PinpointInAppMessage } from '@aws-sdk/client-pinpoint'; +import type { InAppMessageCampaign as PinpointInAppMessage } from '@aws-amplify/core/internals/aws-clients/pinpoint'; import isEmpty from 'lodash/isEmpty'; import { AMPLIFY_SYMBOL } from '../../../common'; import { diff --git a/packages/notifications/src/PushNotification/Providers/AWSPinpointProvider/utils.ts b/packages/notifications/src/PushNotification/Providers/AWSPinpointProvider/utils.ts index 679caa35abd..05d372da2ca 100644 --- a/packages/notifications/src/PushNotification/Providers/AWSPinpointProvider/utils.ts +++ b/packages/notifications/src/PushNotification/Providers/AWSPinpointProvider/utils.ts @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import type { Event as AWSPinpointAnalyticsEvent } from '@aws-sdk/client-pinpoint'; +import type { Event as AWSPinpointAnalyticsEvent } from '@aws-amplify/core/internals/aws-clients/pinpoint'; import { ConsoleLogger, Hub } from '@aws-amplify/core'; import { AMPLIFY_SYMBOL } from '../../../common'; import { PushNotificationMessage } from '../../types'; diff --git a/packages/notifications/src/common/AWSPinpointProviderCommon/index.ts b/packages/notifications/src/common/AWSPinpointProviderCommon/index.ts index 09b3769e388..a1b45d9d63b 100644 --- a/packages/notifications/src/common/AWSPinpointProviderCommon/index.ts +++ b/packages/notifications/src/common/AWSPinpointProviderCommon/index.ts @@ -9,8 +9,8 @@ import { transferKeyToUpperCase, } from '@aws-amplify/core'; import { Cache } from '@aws-amplify/cache'; -import type { Event as AWSPinpointAnalyticsEvent } from '@aws-sdk/client-pinpoint'; import { + Event as AWSPinpointAnalyticsEvent, putEvents, PutEventsInput, updateEndpoint, diff --git a/scripts/dts-bundler/README.md b/scripts/dts-bundler/README.md new file mode 100644 index 00000000000..ce6b8459f27 --- /dev/null +++ b/scripts/dts-bundler/README.md @@ -0,0 +1,10 @@ +This project is used to rollup the TS types from the AWS SDK into the custom AWS clients. You can regenerate them +by running the `build` script in this project, and commit the generated file changes. + +To update the generated types files, you need to: + +1. Update existing `*.d.ts` files in this folder or add new ones. +1. If new `*.d.ts` file is added, update the `dts-bundler.config.js` with additional entries. +1. Run the generating script `yarn && yarn build`. The generated files will be shown in the console. +1. Inspect generated files and make sure headers are not changed. +1. Commit the changes diff --git a/scripts/dts-bundler/cognito-identity.d.ts b/scripts/dts-bundler/cognito-identity.d.ts new file mode 100644 index 00000000000..c53d69e8d03 --- /dev/null +++ b/scripts/dts-bundler/cognito-identity.d.ts @@ -0,0 +1,15 @@ +import { + GetIdCommandInput, + GetIdCommandOutput, + GetCredentialsForIdentityCommandInput, + GetCredentialsForIdentityCommandOutput, + Credentials, +} from '@aws-sdk/client-cognito-identity'; + +export { + GetIdCommandInput, + GetIdCommandOutput, + GetCredentialsForIdentityCommandInput, + GetCredentialsForIdentityCommandOutput, + Credentials, +}; diff --git a/scripts/dts-bundler/dts-bundler.config.js b/scripts/dts-bundler/dts-bundler.config.js new file mode 100644 index 00000000000..b4140b88889 --- /dev/null +++ b/scripts/dts-bundler/dts-bundler.config.js @@ -0,0 +1,32 @@ +const outputConfig = { + sortNodes: true, + respectPreserveConstEnum: true, + noBanner: true, +}; + +/** @type import('dts-bundle-generator/config-schema').BundlerConfig */ +const config = { + compilationOptions: { + preferredConfigPath: '../../packages/tsconfig.base.json', + }, + entries: [ + { + filePath: './pinpoint.d.ts', + outFile: '../../packages/core/src/AwsClients/Pinpoint/types.ts', + libraries: { + inlinedLibraries: ['@aws-sdk/client-pinpoint'], + }, + output: outputConfig, + }, + { + filePath: './cognito-identity.d.ts', + outFile: '../../packages/core/src/AwsClients/CognitoIdentity/types.ts', + libraries: { + inlinedLibraries: ['@aws-sdk/client-cognito-identity'], + }, + output: outputConfig, + }, + ], +}; + +module.exports = config; diff --git a/scripts/dts-bundler/package.json b/scripts/dts-bundler/package.json new file mode 100644 index 00000000000..df674fd7332 --- /dev/null +++ b/scripts/dts-bundler/package.json @@ -0,0 +1,11 @@ +{ + "name": "api-extract-aws-clients", + "devDependencies": { + "@aws-sdk/client-pinpoint": "3.335.0", + "@aws-sdk/client-cognito-identity": "3.335.0", + "dts-bundle-generator": "^8.0.1" + }, + "scripts": { + "build": "dts-bundle-generator --config ./dts-bundler.config.js" + } +} \ No newline at end of file diff --git a/scripts/dts-bundler/pinpoint.d.ts b/scripts/dts-bundler/pinpoint.d.ts new file mode 100644 index 00000000000..9608b781166 --- /dev/null +++ b/scripts/dts-bundler/pinpoint.d.ts @@ -0,0 +1,21 @@ +import { + GetInAppMessagesCommandInput, + GetInAppMessagesCommandOutput, + UpdateEndpointCommandInput, + UpdateEndpointCommandOutput, + PutEventsCommandInput, + PutEventsCommandOutput, + Event, + InAppMessageCampaign, +} from '@aws-sdk/client-pinpoint'; + +export { + GetInAppMessagesCommandInput, + GetInAppMessagesCommandOutput, + UpdateEndpointCommandInput, + UpdateEndpointCommandOutput, + PutEventsCommandInput, + PutEventsCommandOutput, + Event, + InAppMessageCampaign, +}; diff --git a/scripts/dts-bundler/tsconfig.json b/scripts/dts-bundler/tsconfig.json new file mode 100644 index 00000000000..3a236aa798e --- /dev/null +++ b/scripts/dts-bundler/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.base.json" +}