@memberjunction/communication-gmail 6.2.0-edge.4 → 6.2.0-edge.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GmailProvider.d.ts +70 -3
- package/dist/GmailProvider.d.ts.map +1 -1
- package/dist/GmailProvider.js +588 -13
- package/dist/GmailProvider.js.map +1 -1
- package/dist/__tests__/GmailCalendar.test.d.ts +2 -0
- package/dist/__tests__/GmailCalendar.test.d.ts.map +1 -0
- package/dist/__tests__/GmailCalendar.test.js +292 -0
- package/dist/__tests__/GmailCalendar.test.js.map +1 -0
- package/dist/__tests__/GmailCalendarAndPreflight.test.d.ts +2 -0
- package/dist/__tests__/GmailCalendarAndPreflight.test.d.ts.map +1 -0
- package/dist/__tests__/GmailCalendarAndPreflight.test.js +251 -0
- package/dist/__tests__/GmailCalendarAndPreflight.test.js.map +1 -0
- package/dist/calendar.d.ts +25 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +119 -0
- package/dist/calendar.js.map +1 -0
- package/package.json +4 -4
package/dist/GmailProvider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseCommunicationProvider, MessageRetrievalCapabilities, CreateDraftParams, CreateDraftResult, ForwardMessageParams, ForwardMessageResult, GetMessagesParams, GetMessagesResult, MessageResult, ProcessedMessage, ProviderCredentialsBase, ReplyToMessageParams, ReplyToMessageResult, ProviderOperation, GetSingleMessageParams, GetSingleMessageResult, DeleteMessageParams, DeleteMessageResult, MoveMessageParams, MoveMessageResult, ListFoldersParams, ListFoldersResult, MarkAsReadParams, MarkAsReadResult, ArchiveMessageParams, ArchiveMessageResult, SearchMessagesParams, SearchMessagesResult, ListAttachmentsParams, ListAttachmentsResult, DownloadAttachmentParams, DownloadAttachmentResult, CreateSubscriptionParams, RenewSubscriptionParams, DeleteSubscriptionParams, SubscriptionResult, SubscriptionCapabilities, WebhookNotificationInput, ParseNotificationResult, BaseMessageResult } from "@memberjunction/communication-types";
|
|
1
|
+
import { BaseCommunicationProvider, MessageRetrievalCapabilities, CreateDraftParams, CreateDraftResult, ForwardMessageParams, ForwardMessageResult, GetMessagesParams, GetMessagesResult, MessageResult, ProcessedMessage, ProviderCredentialsBase, ReplyToMessageParams, ReplyToMessageResult, ProviderOperation, GetSingleMessageParams, GetSingleMessageResult, DeleteMessageParams, DeleteMessageResult, MoveMessageParams, MoveMessageResult, ListFoldersParams, ListFoldersResult, MarkAsReadParams, MarkAsReadResult, ArchiveMessageParams, ArchiveMessageResult, SearchMessagesParams, SearchMessagesResult, ListAttachmentsParams, ListAttachmentsResult, DownloadAttachmentParams, DownloadAttachmentResult, CreateSubscriptionParams, RenewSubscriptionParams, DeleteSubscriptionParams, SubscriptionResult, SubscriptionCapabilities, WebhookNotificationInput, ParseNotificationResult, BaseMessageResult, CalendarEventResult, CancelEventParams, CreateEventParams, GetEventParams, SyncEventsParams, SyncEventsResult, UpdateEventParams, GetEventsParams, GetEventsResult, GetFreeBusyParams, GetFreeBusyResult, CreateCalendarEventParams, CreateCalendarEventResult, UpdateCalendarEventParams, UpdateCalendarEventResult, RespondToCalendarEventParams, RespondToCalendarEventResult, CancelCalendarEventParams, CancelCalendarEventResult, VerifyMailboxAccessParams, VerifyMailboxAccessResult } from "@memberjunction/communication-types";
|
|
2
2
|
/**
|
|
3
3
|
* Credentials for Gmail provider using OAuth2.
|
|
4
4
|
* Extend ProviderCredentialsBase to support per-request credential override.
|
|
@@ -38,7 +38,7 @@ export declare class GmailProvider extends BaseCommunicationProvider {
|
|
|
38
38
|
*/
|
|
39
39
|
private resolveCredentials;
|
|
40
40
|
/**
|
|
41
|
-
* Creates a Gmail client with the given credentials
|
|
41
|
+
* Creates a Gmail client with the given credentials, keeping its OAuth2 client for the calendar
|
|
42
42
|
*/
|
|
43
43
|
private createGmailClient;
|
|
44
44
|
/**
|
|
@@ -105,9 +105,76 @@ export declare class GmailProvider extends BaseCommunicationProvider {
|
|
|
105
105
|
CreateDraft(params: CreateDraftParams, credentials?: GmailCredentials): Promise<CreateDraftResult>;
|
|
106
106
|
/**
|
|
107
107
|
* Returns the list of operations supported by the Gmail provider.
|
|
108
|
-
* Gmail supports all
|
|
108
|
+
* Gmail supports all mailbox and Google Calendar v3 operations.
|
|
109
109
|
*/
|
|
110
110
|
getSupportedOperations(): ProviderOperation[];
|
|
111
|
+
/**
|
|
112
|
+
* Creates an authenticated Google Calendar v3 client using the same OAuth2 credentials.
|
|
113
|
+
*/
|
|
114
|
+
private createCalendarClient;
|
|
115
|
+
/**
|
|
116
|
+
* Normalizes a Google Calendar v3 event into MJ's GetEventsEvent format.
|
|
117
|
+
*/
|
|
118
|
+
private toGetEventsEvent;
|
|
119
|
+
/**
|
|
120
|
+
* Lists calendar events from Google Calendar v3 (`calendar.events.list`).
|
|
121
|
+
*/
|
|
122
|
+
GetEvents(params: GetEventsParams, credentials?: GmailCredentials): Promise<GetEventsResult>;
|
|
123
|
+
/**
|
|
124
|
+
* Queries free/busy schedule intervals across one or more Google Calendars
|
|
125
|
+
* via `calendar.freebusy.query`.
|
|
126
|
+
*/
|
|
127
|
+
GetFreeBusy(params: GetFreeBusyParams, credentials?: GmailCredentials): Promise<GetFreeBusyResult>;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a Google Calendar event via `calendar.events.insert`.
|
|
130
|
+
*/
|
|
131
|
+
CreateCalendarEvent(params: CreateCalendarEventParams, credentials?: GmailCredentials): Promise<CreateCalendarEventResult>;
|
|
132
|
+
/**
|
|
133
|
+
* Updates an existing Google Calendar event via `calendar.events.patch`.
|
|
134
|
+
*/
|
|
135
|
+
UpdateCalendarEvent(params: UpdateCalendarEventParams, credentials?: GmailCredentials): Promise<UpdateCalendarEventResult>;
|
|
136
|
+
/**
|
|
137
|
+
* Responds to a Google Calendar event invitation by updating the attendee's responseStatus.
|
|
138
|
+
*/
|
|
139
|
+
RespondToCalendarEvent(params: RespondToCalendarEventParams, credentials?: GmailCredentials): Promise<RespondToCalendarEventResult>;
|
|
140
|
+
/**
|
|
141
|
+
* Cancels (deletes) a Google Calendar event via `calendar.events.delete`.
|
|
142
|
+
*/
|
|
143
|
+
CancelCalendarEvent(params: CancelCalendarEventParams, credentials?: GmailCredentials): Promise<CancelCalendarEventResult>;
|
|
144
|
+
/**
|
|
145
|
+
* Verifies whether the active Gmail / Google Workspace credential has access to
|
|
146
|
+
* the specified mailbox and/or calendar.
|
|
147
|
+
*/
|
|
148
|
+
VerifyMailboxAccess(params: VerifyMailboxAccessParams, credentials?: GmailCredentials): Promise<VerifyMailboxAccessResult>;
|
|
149
|
+
/** Inserts an event and sends invitations to its attendees (`sendUpdates: 'all'`). */
|
|
150
|
+
CreateEvent(params: CreateEventParams, credentials?: GmailCredentials): Promise<CalendarEventResult>;
|
|
151
|
+
/** Patches the given fields and sends the update to attendees. */
|
|
152
|
+
UpdateEvent(params: UpdateEventParams, credentials?: GmailCredentials): Promise<CalendarEventResult>;
|
|
153
|
+
/**
|
|
154
|
+
* Deletes the event with `sendUpdates: 'all'`: from the organizer's calendar that cancels it for
|
|
155
|
+
* everyone; from an attendee's it removes that copy only. Google has no cancellation comment, so
|
|
156
|
+
* `Comment` is not sent. An event already gone (404 or 410) counts as cancelled.
|
|
157
|
+
*/
|
|
158
|
+
CancelEvent(params: CancelEventParams, credentials?: GmailCredentials): Promise<BaseMessageResult>;
|
|
159
|
+
/** Reads one event with each attendee's response. */
|
|
160
|
+
GetEvent(params: GetEventParams, credentials?: GmailCredentials): Promise<CalendarEventResult>;
|
|
161
|
+
/**
|
|
162
|
+
* Incremental sync through `events.list`. With no token, a full read of the window (open-ended when
|
|
163
|
+
* the window is not given); with one, only what changed. Recurring events are expanded
|
|
164
|
+
* (`singleEvents`), on every request, since Google wants the same parameters on the incremental
|
|
165
|
+
* reads as on the full one. Pages are followed until the `nextSyncToken`. An expired token is a
|
|
166
|
+
* 410 Gone: that comes back as `ResyncRequired`.
|
|
167
|
+
*/
|
|
168
|
+
SyncEvents(params: SyncEventsParams, credentials?: GmailCredentials): Promise<SyncEventsResult>;
|
|
169
|
+
/** The `events.list` parameters for one page. A sync token excludes the window, as Google requires. */
|
|
170
|
+
private syncListParams;
|
|
171
|
+
/**
|
|
172
|
+
* The shared shape of every calendar call: refuse a missing target before any I/O, build the
|
|
173
|
+
* calendar client from the account's OAuth2 client, and turn a thrown error into a result.
|
|
174
|
+
*/
|
|
175
|
+
private calendarCall;
|
|
176
|
+
/** The HTTP status on a googleapis (Gaxios) error: `.code`, `.status` or `.response.status`. */
|
|
177
|
+
private httpStatus;
|
|
111
178
|
/**
|
|
112
179
|
* Creates a Gmail mailbox watch so change notifications are published to a Google Cloud
|
|
113
180
|
* Pub/Sub topic. Gmail delivers via Pub/Sub (not an HTTP endpoint), so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GmailProvider.d.ts","sourceRoot":"","sources":["../src/GmailProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,yBAAyB,EAEzB,4BAA4B,EAC5B,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EAEpB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EAIpB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAEjB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EAErB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EAExB,uBAAuB,EACvB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"GmailProvider.d.ts","sourceRoot":"","sources":["../src/GmailProvider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