@corsair-dev/gmail 0.1.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.
@@ -0,0 +1,190 @@
1
+ import { z } from 'zod';
2
+ import type { CorsairWebhookMatcher } from 'corsair/core';
3
+ import type { Message } from '../types';
4
+ export declare const PubSubMessageSchema: z.ZodObject<{
5
+ data: z.ZodOptional<z.ZodString>;
6
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
7
+ messageId: z.ZodOptional<z.ZodString>;
8
+ publishTime: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ data?: string | undefined;
11
+ messageId?: string | undefined;
12
+ attributes?: Record<string, string> | undefined;
13
+ publishTime?: string | undefined;
14
+ }, {
15
+ data?: string | undefined;
16
+ messageId?: string | undefined;
17
+ attributes?: Record<string, string> | undefined;
18
+ publishTime?: string | undefined;
19
+ }>;
20
+ export type PubSubMessage = z.infer<typeof PubSubMessageSchema>;
21
+ export declare const PubSubNotificationSchema: z.ZodObject<{
22
+ message: z.ZodOptional<z.ZodObject<{
23
+ data: z.ZodOptional<z.ZodString>;
24
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
25
+ messageId: z.ZodOptional<z.ZodString>;
26
+ publishTime: z.ZodOptional<z.ZodString>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ data?: string | undefined;
29
+ messageId?: string | undefined;
30
+ attributes?: Record<string, string> | undefined;
31
+ publishTime?: string | undefined;
32
+ }, {
33
+ data?: string | undefined;
34
+ messageId?: string | undefined;
35
+ attributes?: Record<string, string> | undefined;
36
+ publishTime?: string | undefined;
37
+ }>>;
38
+ subscription: z.ZodOptional<z.ZodString>;
39
+ event: z.ZodOptional<z.ZodUnknown>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ message?: {
42
+ data?: string | undefined;
43
+ messageId?: string | undefined;
44
+ attributes?: Record<string, string> | undefined;
45
+ publishTime?: string | undefined;
46
+ } | undefined;
47
+ subscription?: string | undefined;
48
+ event?: unknown;
49
+ }, {
50
+ message?: {
51
+ data?: string | undefined;
52
+ messageId?: string | undefined;
53
+ attributes?: Record<string, string> | undefined;
54
+ publishTime?: string | undefined;
55
+ } | undefined;
56
+ subscription?: string | undefined;
57
+ event?: unknown;
58
+ }>;
59
+ export type PubSubNotification<TEvent = unknown> = Omit<z.infer<typeof PubSubNotificationSchema>, 'event'> & {
60
+ event?: TEvent;
61
+ };
62
+ export declare const GmailPushNotificationSchema: z.ZodObject<{
63
+ emailAddress: z.ZodOptional<z.ZodString>;
64
+ historyId: z.ZodOptional<z.ZodString>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ historyId?: string | undefined;
67
+ emailAddress?: string | undefined;
68
+ }, {
69
+ historyId?: string | undefined;
70
+ emailAddress?: string | undefined;
71
+ }>;
72
+ export type GmailPushNotification = z.infer<typeof GmailPushNotificationSchema>;
73
+ export declare const MessageReceivedEventSchema: z.ZodObject<{
74
+ type: z.ZodLiteral<"messageReceived">;
75
+ emailAddress: z.ZodString;
76
+ historyId: z.ZodString;
77
+ message: z.ZodType<Message, z.ZodTypeDef, Message>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ message: Message;
80
+ type: "messageReceived";
81
+ historyId: string;
82
+ emailAddress: string;
83
+ }, {
84
+ message: Message;
85
+ type: "messageReceived";
86
+ historyId: string;
87
+ emailAddress: string;
88
+ }>;
89
+ export type MessageReceivedEvent = z.infer<typeof MessageReceivedEventSchema>;
90
+ export declare const MessageDeletedEventSchema: z.ZodObject<{
91
+ type: z.ZodLiteral<"messageDeleted">;
92
+ emailAddress: z.ZodString;
93
+ historyId: z.ZodString;
94
+ message: z.ZodType<Message, z.ZodTypeDef, Message>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ message: Message;
97
+ type: "messageDeleted";
98
+ historyId: string;
99
+ emailAddress: string;
100
+ }, {
101
+ message: Message;
102
+ type: "messageDeleted";
103
+ historyId: string;
104
+ emailAddress: string;
105
+ }>;
106
+ export type MessageDeletedEvent = z.infer<typeof MessageDeletedEventSchema>;
107
+ export declare const MessageLabelChangedEventSchema: z.ZodObject<{
108
+ type: z.ZodLiteral<"messageLabelChanged">;
109
+ emailAddress: z.ZodString;
110
+ historyId: z.ZodString;
111
+ message: z.ZodType<Message, z.ZodTypeDef, Message>;
112
+ labelsAdded: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
113
+ labelsRemoved: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ message: Message;
116
+ type: "messageLabelChanged";
117
+ historyId: string;
118
+ emailAddress: string;
119
+ labelsAdded?: string[] | undefined;
120
+ labelsRemoved?: string[] | undefined;
121
+ }, {
122
+ message: Message;
123
+ type: "messageLabelChanged";
124
+ historyId: string;
125
+ emailAddress: string;
126
+ labelsAdded?: string[] | undefined;
127
+ labelsRemoved?: string[] | undefined;
128
+ }>;
129
+ export type MessageLabelChangedEvent = z.infer<typeof MessageLabelChangedEventSchema>;
130
+ export declare const GmailWebhookEventSchema: z.ZodUnion<[z.ZodObject<{
131
+ type: z.ZodLiteral<"messageReceived">;
132
+ emailAddress: z.ZodString;
133
+ historyId: z.ZodString;
134
+ message: z.ZodType<Message, z.ZodTypeDef, Message>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ message: Message;
137
+ type: "messageReceived";
138
+ historyId: string;
139
+ emailAddress: string;
140
+ }, {
141
+ message: Message;
142
+ type: "messageReceived";
143
+ historyId: string;
144
+ emailAddress: string;
145
+ }>, z.ZodObject<{
146
+ type: z.ZodLiteral<"messageDeleted">;
147
+ emailAddress: z.ZodString;
148
+ historyId: z.ZodString;
149
+ message: z.ZodType<Message, z.ZodTypeDef, Message>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ message: Message;
152
+ type: "messageDeleted";
153
+ historyId: string;
154
+ emailAddress: string;
155
+ }, {
156
+ message: Message;
157
+ type: "messageDeleted";
158
+ historyId: string;
159
+ emailAddress: string;
160
+ }>, z.ZodObject<{
161
+ type: z.ZodLiteral<"messageLabelChanged">;
162
+ emailAddress: z.ZodString;
163
+ historyId: z.ZodString;
164
+ message: z.ZodType<Message, z.ZodTypeDef, Message>;
165
+ labelsAdded: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
166
+ labelsRemoved: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
167
+ }, "strip", z.ZodTypeAny, {
168
+ message: Message;
169
+ type: "messageLabelChanged";
170
+ historyId: string;
171
+ emailAddress: string;
172
+ labelsAdded?: string[] | undefined;
173
+ labelsRemoved?: string[] | undefined;
174
+ }, {
175
+ message: Message;
176
+ type: "messageLabelChanged";
177
+ historyId: string;
178
+ emailAddress: string;
179
+ labelsAdded?: string[] | undefined;
180
+ labelsRemoved?: string[] | undefined;
181
+ }>]>;
182
+ export type GmailWebhookEvent = z.infer<typeof GmailWebhookEventSchema>;
183
+ export type GmailEventName = 'messageChanged';
184
+ export type GmailWebhookPayload<TEvent = unknown> = PubSubNotification<TEvent>;
185
+ export type GmailWebhookOutputs = {
186
+ messageChanged: MessageReceivedEvent | MessageDeletedEvent | MessageLabelChangedEvent;
187
+ };
188
+ export declare function decodePubSubMessage(data: string): GmailPushNotification;
189
+ export declare function createGmailWebhookMatcher(eventType: GmailEventName): CorsairWebhookMatcher;
190
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACX,qBAAqB,EAErB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAMxC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAA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AAwB,CAAC;CAC5B,CAAC;AAMF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAGvE;AAED,wBAAgB,yBAAyB,CACxC,SAAS,EAAE,cAAc,GACvB,qBAAqB,CAcvB"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@corsair-dev/gmail",
3
+ "version": "0.1.0",
4
+ "description": "Gmail plugin for Corsair",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "dev-source": "./index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "peerDependencies": {
17
+ "corsair": ">=0.1.0",
18
+ "zod": "^3.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "tsup": "^8.0.1",
22
+ "typescript": "^5.9.3",
23
+ "zod": "^3.25.76",
24
+ "corsair": "0.1.48"
25
+ },
26
+ "keywords": [
27
+ "corsair",
28
+ "gmail",
29
+ "plugin"
30
+ ],
31
+ "author": "",
32
+ "license": "Apache-2.0",
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "scripts": {
37
+ "build": "rm -rf dist && tsc --build --force && tsup",
38
+ "typecheck": "tsc --noEmit"
39
+ }
40
+ }