@credal/actions 0.2.160 → 0.2.161
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/actions/autogen/templates.js +70 -48
- package/dist/actions/autogen/types.d.ts +133 -79
- package/dist/actions/autogen/types.js +19 -13
- package/dist/actions/providers/googlemail/searchGmailMessages.d.ts +0 -14
- package/dist/actions/providers/googlemail/searchGmailMessages.js +44 -43
- package/package.json +1 -1
|
@@ -8827,72 +8827,94 @@ export const googlemailSearchGmailMessagesDefinition = {
|
|
|
8827
8827
|
},
|
|
8828
8828
|
output: {
|
|
8829
8829
|
type: "object",
|
|
8830
|
-
required: ["success", "
|
|
8830
|
+
required: ["success", "results"],
|
|
8831
8831
|
properties: {
|
|
8832
8832
|
success: {
|
|
8833
8833
|
type: "boolean",
|
|
8834
8834
|
},
|
|
8835
|
-
|
|
8835
|
+
error: {
|
|
8836
|
+
type: "string",
|
|
8837
|
+
description: "Error message if search failed",
|
|
8838
|
+
},
|
|
8839
|
+
pageToken: {
|
|
8840
|
+
type: "string",
|
|
8841
|
+
description: "The token to use to get the next page of results",
|
|
8842
|
+
},
|
|
8843
|
+
results: {
|
|
8836
8844
|
type: "array",
|
|
8837
8845
|
description: "List of matching Gmail messages",
|
|
8838
8846
|
items: {
|
|
8839
8847
|
type: "object",
|
|
8840
|
-
required: ["
|
|
8848
|
+
required: ["name", "url", "contents"],
|
|
8841
8849
|
properties: {
|
|
8842
|
-
|
|
8843
|
-
type: "string",
|
|
8844
|
-
description: "The message ID",
|
|
8845
|
-
},
|
|
8846
|
-
threadId: {
|
|
8850
|
+
name: {
|
|
8847
8851
|
type: "string",
|
|
8848
|
-
description: "The
|
|
8852
|
+
description: "The name of the message",
|
|
8849
8853
|
},
|
|
8850
|
-
|
|
8854
|
+
url: {
|
|
8851
8855
|
type: "string",
|
|
8852
|
-
description: "
|
|
8856
|
+
description: "The URL of the message",
|
|
8853
8857
|
},
|
|
8854
|
-
|
|
8855
|
-
type: "
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
+
contents: {
|
|
8859
|
+
type: "object",
|
|
8860
|
+
required: ["id", "threadId"],
|
|
8861
|
+
properties: {
|
|
8862
|
+
id: {
|
|
8863
|
+
type: "string",
|
|
8864
|
+
description: "The message ID",
|
|
8865
|
+
},
|
|
8866
|
+
threadId: {
|
|
8867
|
+
type: "string",
|
|
8868
|
+
description: "The thread ID",
|
|
8869
|
+
},
|
|
8870
|
+
snippet: {
|
|
8871
|
+
type: "string",
|
|
8872
|
+
description: "A short part of the message text",
|
|
8873
|
+
},
|
|
8874
|
+
labels: {
|
|
8875
|
+
type: "array",
|
|
8876
|
+
items: {
|
|
8877
|
+
type: "string",
|
|
8878
|
+
},
|
|
8879
|
+
description: "Labels on the message",
|
|
8880
|
+
},
|
|
8881
|
+
internalDate: {
|
|
8882
|
+
type: "string",
|
|
8883
|
+
description: "Internal timestamp of the message",
|
|
8884
|
+
},
|
|
8885
|
+
body: {
|
|
8886
|
+
type: "string",
|
|
8887
|
+
description: "The body of the message",
|
|
8888
|
+
},
|
|
8889
|
+
from: {
|
|
8890
|
+
type: "string",
|
|
8891
|
+
description: "The from header of the message",
|
|
8892
|
+
},
|
|
8893
|
+
to: {
|
|
8894
|
+
type: "string",
|
|
8895
|
+
description: "The to header of the message",
|
|
8896
|
+
},
|
|
8897
|
+
subject: {
|
|
8898
|
+
type: "string",
|
|
8899
|
+
description: "The subject header of the message",
|
|
8900
|
+
},
|
|
8901
|
+
cc: {
|
|
8902
|
+
type: "string",
|
|
8903
|
+
description: "The cc header of the message",
|
|
8904
|
+
},
|
|
8905
|
+
bcc: {
|
|
8906
|
+
type: "string",
|
|
8907
|
+
description: "The bcc header of the message",
|
|
8908
|
+
},
|
|
8909
|
+
error: {
|
|
8910
|
+
type: "string",
|
|
8911
|
+
description: "Error message if search failed",
|
|
8912
|
+
},
|
|
8858
8913
|
},
|
|
8859
|
-
description: "Labels on the message",
|
|
8860
|
-
},
|
|
8861
|
-
internalDate: {
|
|
8862
|
-
type: "string",
|
|
8863
|
-
description: "Internal timestamp of the message",
|
|
8864
|
-
},
|
|
8865
|
-
emailBody: {
|
|
8866
|
-
type: "string",
|
|
8867
|
-
description: "The body of the message",
|
|
8868
|
-
},
|
|
8869
|
-
from: {
|
|
8870
|
-
type: "string",
|
|
8871
|
-
description: "The from header of the message",
|
|
8872
|
-
},
|
|
8873
|
-
to: {
|
|
8874
|
-
type: "string",
|
|
8875
|
-
description: "The to header of the message",
|
|
8876
|
-
},
|
|
8877
|
-
subject: {
|
|
8878
|
-
type: "string",
|
|
8879
|
-
description: "The subject header of the message",
|
|
8880
|
-
},
|
|
8881
|
-
cc: {
|
|
8882
|
-
type: "string",
|
|
8883
|
-
description: "The cc header of the message",
|
|
8884
|
-
},
|
|
8885
|
-
bcc: {
|
|
8886
|
-
type: "string",
|
|
8887
|
-
description: "The bcc header of the message",
|
|
8888
8914
|
},
|
|
8889
8915
|
},
|
|
8890
8916
|
},
|
|
8891
8917
|
},
|
|
8892
|
-
error: {
|
|
8893
|
-
type: "string",
|
|
8894
|
-
description: "Error message if search failed",
|
|
8895
|
-
},
|
|
8896
8918
|
},
|
|
8897
8919
|
},
|
|
8898
8920
|
name: "searchGmailMessages",
|
|
@@ -6154,76 +6154,130 @@ export declare const googlemailSearchGmailMessagesParamsSchema: z.ZodObject<{
|
|
|
6154
6154
|
export type googlemailSearchGmailMessagesParamsType = z.infer<typeof googlemailSearchGmailMessagesParamsSchema>;
|
|
6155
6155
|
export declare const googlemailSearchGmailMessagesOutputSchema: z.ZodObject<{
|
|
6156
6156
|
success: z.ZodBoolean;
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6157
|
+
error: z.ZodOptional<z.ZodString>;
|
|
6158
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
6159
|
+
results: z.ZodArray<z.ZodObject<{
|
|
6160
|
+
name: z.ZodString;
|
|
6161
|
+
url: z.ZodString;
|
|
6162
|
+
contents: z.ZodObject<{
|
|
6163
|
+
id: z.ZodString;
|
|
6164
|
+
threadId: z.ZodString;
|
|
6165
|
+
snippet: z.ZodOptional<z.ZodString>;
|
|
6166
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6167
|
+
internalDate: z.ZodOptional<z.ZodString>;
|
|
6168
|
+
body: z.ZodOptional<z.ZodString>;
|
|
6169
|
+
from: z.ZodOptional<z.ZodString>;
|
|
6170
|
+
to: z.ZodOptional<z.ZodString>;
|
|
6171
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
6172
|
+
cc: z.ZodOptional<z.ZodString>;
|
|
6173
|
+
bcc: z.ZodOptional<z.ZodString>;
|
|
6174
|
+
error: z.ZodOptional<z.ZodString>;
|
|
6175
|
+
}, "strip", z.ZodTypeAny, {
|
|
6176
|
+
id: string;
|
|
6177
|
+
threadId: string;
|
|
6178
|
+
error?: string | undefined;
|
|
6179
|
+
subject?: string | undefined;
|
|
6180
|
+
body?: string | undefined;
|
|
6181
|
+
to?: string | undefined;
|
|
6182
|
+
snippet?: string | undefined;
|
|
6183
|
+
internalDate?: string | undefined;
|
|
6184
|
+
cc?: string | undefined;
|
|
6185
|
+
bcc?: string | undefined;
|
|
6186
|
+
labels?: string[] | undefined;
|
|
6187
|
+
from?: string | undefined;
|
|
6188
|
+
}, {
|
|
6189
|
+
id: string;
|
|
6190
|
+
threadId: string;
|
|
6191
|
+
error?: string | undefined;
|
|
6192
|
+
subject?: string | undefined;
|
|
6193
|
+
body?: string | undefined;
|
|
6194
|
+
to?: string | undefined;
|
|
6195
|
+
snippet?: string | undefined;
|
|
6196
|
+
internalDate?: string | undefined;
|
|
6197
|
+
cc?: string | undefined;
|
|
6198
|
+
bcc?: string | undefined;
|
|
6199
|
+
labels?: string[] | undefined;
|
|
6200
|
+
from?: string | undefined;
|
|
6201
|
+
}>;
|
|
6169
6202
|
}, "strip", z.ZodTypeAny, {
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6203
|
+
name: string;
|
|
6204
|
+
url: string;
|
|
6205
|
+
contents: {
|
|
6206
|
+
id: string;
|
|
6207
|
+
threadId: string;
|
|
6208
|
+
error?: string | undefined;
|
|
6209
|
+
subject?: string | undefined;
|
|
6210
|
+
body?: string | undefined;
|
|
6211
|
+
to?: string | undefined;
|
|
6212
|
+
snippet?: string | undefined;
|
|
6213
|
+
internalDate?: string | undefined;
|
|
6214
|
+
cc?: string | undefined;
|
|
6215
|
+
bcc?: string | undefined;
|
|
6216
|
+
labels?: string[] | undefined;
|
|
6217
|
+
from?: string | undefined;
|
|
6218
|
+
};
|
|
6181
6219
|
}, {
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6220
|
+
name: string;
|
|
6221
|
+
url: string;
|
|
6222
|
+
contents: {
|
|
6223
|
+
id: string;
|
|
6224
|
+
threadId: string;
|
|
6225
|
+
error?: string | undefined;
|
|
6226
|
+
subject?: string | undefined;
|
|
6227
|
+
body?: string | undefined;
|
|
6228
|
+
to?: string | undefined;
|
|
6229
|
+
snippet?: string | undefined;
|
|
6230
|
+
internalDate?: string | undefined;
|
|
6231
|
+
cc?: string | undefined;
|
|
6232
|
+
bcc?: string | undefined;
|
|
6233
|
+
labels?: string[] | undefined;
|
|
6234
|
+
from?: string | undefined;
|
|
6235
|
+
};
|
|
6193
6236
|
}>, "many">;
|
|
6194
|
-
error: z.ZodOptional<z.ZodString>;
|
|
6195
6237
|
}, "strip", z.ZodTypeAny, {
|
|
6196
6238
|
success: boolean;
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6239
|
+
results: {
|
|
6240
|
+
name: string;
|
|
6241
|
+
url: string;
|
|
6242
|
+
contents: {
|
|
6243
|
+
id: string;
|
|
6244
|
+
threadId: string;
|
|
6245
|
+
error?: string | undefined;
|
|
6246
|
+
subject?: string | undefined;
|
|
6247
|
+
body?: string | undefined;
|
|
6248
|
+
to?: string | undefined;
|
|
6249
|
+
snippet?: string | undefined;
|
|
6250
|
+
internalDate?: string | undefined;
|
|
6251
|
+
cc?: string | undefined;
|
|
6252
|
+
bcc?: string | undefined;
|
|
6253
|
+
labels?: string[] | undefined;
|
|
6254
|
+
from?: string | undefined;
|
|
6255
|
+
};
|
|
6209
6256
|
}[];
|
|
6210
6257
|
error?: string | undefined;
|
|
6258
|
+
pageToken?: string | undefined;
|
|
6211
6259
|
}, {
|
|
6212
6260
|
success: boolean;
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6261
|
+
results: {
|
|
6262
|
+
name: string;
|
|
6263
|
+
url: string;
|
|
6264
|
+
contents: {
|
|
6265
|
+
id: string;
|
|
6266
|
+
threadId: string;
|
|
6267
|
+
error?: string | undefined;
|
|
6268
|
+
subject?: string | undefined;
|
|
6269
|
+
body?: string | undefined;
|
|
6270
|
+
to?: string | undefined;
|
|
6271
|
+
snippet?: string | undefined;
|
|
6272
|
+
internalDate?: string | undefined;
|
|
6273
|
+
cc?: string | undefined;
|
|
6274
|
+
bcc?: string | undefined;
|
|
6275
|
+
labels?: string[] | undefined;
|
|
6276
|
+
from?: string | undefined;
|
|
6277
|
+
};
|
|
6225
6278
|
}[];
|
|
6226
6279
|
error?: string | undefined;
|
|
6280
|
+
pageToken?: string | undefined;
|
|
6227
6281
|
}>;
|
|
6228
6282
|
export type googlemailSearchGmailMessagesOutputType = z.infer<typeof googlemailSearchGmailMessagesOutputSchema>;
|
|
6229
6283
|
export type googlemailSearchGmailMessagesFunction = ActionFunction<googlemailSearchGmailMessagesParamsType, AuthParamsType, googlemailSearchGmailMessagesOutputType>;
|
|
@@ -9219,6 +9273,11 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9219
9273
|
} | undefined;
|
|
9220
9274
|
updatedAt?: string | undefined;
|
|
9221
9275
|
htmlUrl?: string | undefined;
|
|
9276
|
+
labels?: {
|
|
9277
|
+
description?: string | null | undefined;
|
|
9278
|
+
name?: string | undefined;
|
|
9279
|
+
color?: string | undefined;
|
|
9280
|
+
}[] | undefined;
|
|
9222
9281
|
draft?: boolean | undefined;
|
|
9223
9282
|
closedAt?: string | null | undefined;
|
|
9224
9283
|
mergedAt?: string | null | undefined;
|
|
@@ -9228,11 +9287,6 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9228
9287
|
reviewers?: {
|
|
9229
9288
|
login?: string | undefined;
|
|
9230
9289
|
}[] | undefined;
|
|
9231
|
-
labels?: {
|
|
9232
|
-
description?: string | null | undefined;
|
|
9233
|
-
name?: string | undefined;
|
|
9234
|
-
color?: string | undefined;
|
|
9235
|
-
}[] | undefined;
|
|
9236
9290
|
mergeable?: boolean | null | undefined;
|
|
9237
9291
|
mergeableState?: string | null | undefined;
|
|
9238
9292
|
additions?: number | undefined;
|
|
@@ -9280,6 +9334,11 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9280
9334
|
} | undefined;
|
|
9281
9335
|
updatedAt?: string | undefined;
|
|
9282
9336
|
htmlUrl?: string | undefined;
|
|
9337
|
+
labels?: {
|
|
9338
|
+
description?: string | null | undefined;
|
|
9339
|
+
name?: string | undefined;
|
|
9340
|
+
color?: string | undefined;
|
|
9341
|
+
}[] | undefined;
|
|
9283
9342
|
draft?: boolean | undefined;
|
|
9284
9343
|
closedAt?: string | null | undefined;
|
|
9285
9344
|
mergedAt?: string | null | undefined;
|
|
@@ -9289,11 +9348,6 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9289
9348
|
reviewers?: {
|
|
9290
9349
|
login?: string | undefined;
|
|
9291
9350
|
}[] | undefined;
|
|
9292
|
-
labels?: {
|
|
9293
|
-
description?: string | null | undefined;
|
|
9294
|
-
name?: string | undefined;
|
|
9295
|
-
color?: string | undefined;
|
|
9296
|
-
}[] | undefined;
|
|
9297
9351
|
mergeable?: boolean | null | undefined;
|
|
9298
9352
|
mergeableState?: string | null | undefined;
|
|
9299
9353
|
additions?: number | undefined;
|
|
@@ -9345,6 +9399,11 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9345
9399
|
} | undefined;
|
|
9346
9400
|
updatedAt?: string | undefined;
|
|
9347
9401
|
htmlUrl?: string | undefined;
|
|
9402
|
+
labels?: {
|
|
9403
|
+
description?: string | null | undefined;
|
|
9404
|
+
name?: string | undefined;
|
|
9405
|
+
color?: string | undefined;
|
|
9406
|
+
}[] | undefined;
|
|
9348
9407
|
draft?: boolean | undefined;
|
|
9349
9408
|
closedAt?: string | null | undefined;
|
|
9350
9409
|
mergedAt?: string | null | undefined;
|
|
@@ -9354,11 +9413,6 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9354
9413
|
reviewers?: {
|
|
9355
9414
|
login?: string | undefined;
|
|
9356
9415
|
}[] | undefined;
|
|
9357
|
-
labels?: {
|
|
9358
|
-
description?: string | null | undefined;
|
|
9359
|
-
name?: string | undefined;
|
|
9360
|
-
color?: string | undefined;
|
|
9361
|
-
}[] | undefined;
|
|
9362
9416
|
mergeable?: boolean | null | undefined;
|
|
9363
9417
|
mergeableState?: string | null | undefined;
|
|
9364
9418
|
additions?: number | undefined;
|
|
@@ -9410,6 +9464,11 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9410
9464
|
} | undefined;
|
|
9411
9465
|
updatedAt?: string | undefined;
|
|
9412
9466
|
htmlUrl?: string | undefined;
|
|
9467
|
+
labels?: {
|
|
9468
|
+
description?: string | null | undefined;
|
|
9469
|
+
name?: string | undefined;
|
|
9470
|
+
color?: string | undefined;
|
|
9471
|
+
}[] | undefined;
|
|
9413
9472
|
draft?: boolean | undefined;
|
|
9414
9473
|
closedAt?: string | null | undefined;
|
|
9415
9474
|
mergedAt?: string | null | undefined;
|
|
@@ -9419,11 +9478,6 @@ export declare const githubGetPullRequestDetailsOutputSchema: z.ZodObject<{
|
|
|
9419
9478
|
reviewers?: {
|
|
9420
9479
|
login?: string | undefined;
|
|
9421
9480
|
}[] | undefined;
|
|
9422
|
-
labels?: {
|
|
9423
|
-
description?: string | null | undefined;
|
|
9424
|
-
name?: string | undefined;
|
|
9425
|
-
color?: string | undefined;
|
|
9426
|
-
}[] | undefined;
|
|
9427
9481
|
mergeable?: boolean | null | undefined;
|
|
9428
9482
|
mergeableState?: string | null | undefined;
|
|
9429
9483
|
additions?: number | undefined;
|
|
@@ -3253,22 +3253,28 @@ export const googlemailSearchGmailMessagesParamsSchema = z.object({
|
|
|
3253
3253
|
});
|
|
3254
3254
|
export const googlemailSearchGmailMessagesOutputSchema = z.object({
|
|
3255
3255
|
success: z.boolean(),
|
|
3256
|
-
|
|
3256
|
+
error: z.string().describe("Error message if search failed").optional(),
|
|
3257
|
+
pageToken: z.string().describe("The token to use to get the next page of results").optional(),
|
|
3258
|
+
results: z
|
|
3257
3259
|
.array(z.object({
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3260
|
+
name: z.string().describe("The name of the message"),
|
|
3261
|
+
url: z.string().describe("The URL of the message"),
|
|
3262
|
+
contents: z.object({
|
|
3263
|
+
id: z.string().describe("The message ID"),
|
|
3264
|
+
threadId: z.string().describe("The thread ID"),
|
|
3265
|
+
snippet: z.string().describe("A short part of the message text").optional(),
|
|
3266
|
+
labels: z.array(z.string()).describe("Labels on the message").optional(),
|
|
3267
|
+
internalDate: z.string().describe("Internal timestamp of the message").optional(),
|
|
3268
|
+
body: z.string().describe("The body of the message").optional(),
|
|
3269
|
+
from: z.string().describe("The from header of the message").optional(),
|
|
3270
|
+
to: z.string().describe("The to header of the message").optional(),
|
|
3271
|
+
subject: z.string().describe("The subject header of the message").optional(),
|
|
3272
|
+
cc: z.string().describe("The cc header of the message").optional(),
|
|
3273
|
+
bcc: z.string().describe("The bcc header of the message").optional(),
|
|
3274
|
+
error: z.string().describe("Error message if search failed").optional(),
|
|
3275
|
+
}),
|
|
3269
3276
|
}))
|
|
3270
3277
|
.describe("List of matching Gmail messages"),
|
|
3271
|
-
error: z.string().describe("Error message if search failed").optional(),
|
|
3272
3278
|
});
|
|
3273
3279
|
export const googlemailListGmailThreadsParamsSchema = z.object({
|
|
3274
3280
|
query: z.string().describe('Gmail search query (e.g. "from:alice subject:project")'),
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
export interface GmailMessageResult {
|
|
2
|
-
id: string;
|
|
3
|
-
threadId: string;
|
|
4
|
-
snippet: string;
|
|
5
|
-
labelIds?: string[];
|
|
6
|
-
internalDate: string;
|
|
7
|
-
emailBody: string;
|
|
8
|
-
from?: string;
|
|
9
|
-
to?: string;
|
|
10
|
-
subject?: string;
|
|
11
|
-
cc?: string;
|
|
12
|
-
bcc?: string;
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
1
|
import type { googlemailSearchGmailMessagesFunction } from "../../autogen/types.js";
|
|
16
2
|
declare const searchGmailMessages: googlemailSearchGmailMessagesFunction;
|
|
17
3
|
export default searchGmailMessages;
|
|
@@ -40,7 +40,7 @@ function cleanAndTruncateEmail(text, maxLength = 2000) {
|
|
|
40
40
|
}
|
|
41
41
|
const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
42
42
|
if (!authParams.authToken) {
|
|
43
|
-
return { success: false, error: MISSING_AUTH_TOKEN,
|
|
43
|
+
return { success: false, error: MISSING_AUTH_TOKEN, results: [] };
|
|
44
44
|
}
|
|
45
45
|
const { query, maxResults, timeout } = params;
|
|
46
46
|
const max = Math.min(maxResults !== null && maxResults !== void 0 ? maxResults : DEFAULT_EMAIL_CONTENTS_FETCHED, MAX_EMAIL_CONTENTS_FETCHED);
|
|
@@ -63,6 +63,7 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
63
63
|
break;
|
|
64
64
|
const batch = messageList.slice(0, max - allMessages.length);
|
|
65
65
|
const results = yield Promise.allSettled(batch.map((msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
var _a, _b, _c;
|
|
66
67
|
try {
|
|
67
68
|
yield limiter.removeTokens(1);
|
|
68
69
|
const msgRes = yield axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/messages/${msg.id}?format=full`, {
|
|
@@ -73,54 +74,53 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
73
74
|
const { id, threadId, snippet, labelIds, internalDate, payload } = msgRes.data;
|
|
74
75
|
const headers = {};
|
|
75
76
|
for (const header of payload.headers) {
|
|
76
|
-
|
|
77
|
-
if (lowerName === "from" ||
|
|
78
|
-
lowerName === "to" ||
|
|
79
|
-
lowerName === "subject" ||
|
|
80
|
-
lowerName === "cc" ||
|
|
81
|
-
lowerName === "bcc") {
|
|
82
|
-
headers[lowerName] = header.value;
|
|
83
|
-
}
|
|
77
|
+
headers[header.name.toLowerCase()] = header.value;
|
|
84
78
|
}
|
|
85
|
-
|
|
86
|
-
const emailBody = cleanAndTruncateEmail(
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
// Extract and clean the full text
|
|
80
|
+
const emailBody = cleanAndTruncateEmail(getEmailContent(msgRes.data) || "");
|
|
81
|
+
const subject = ((_a = headers.subject) === null || _a === void 0 ? void 0 : _a.trim()) || "(No subject)";
|
|
82
|
+
const from = ((_c = (_b = headers.from) === null || _b === void 0 ? void 0 : _b.split("<")[0]) === null || _c === void 0 ? void 0 : _c.trim()) || "Unknown sender";
|
|
83
|
+
const date = new Date(Number(internalDate)).toLocaleDateString("en-US");
|
|
84
|
+
const name = `${subject} — ${from} (${date})`;
|
|
85
|
+
return {
|
|
86
|
+
name,
|
|
87
|
+
url: `https://mail.google.com/mail/u/0/#inbox/${id}`,
|
|
88
|
+
contents: {
|
|
89
|
+
id,
|
|
90
|
+
from: headers.from,
|
|
91
|
+
to: headers.to,
|
|
92
|
+
cc: headers.cc,
|
|
93
|
+
bcc: headers.bcc,
|
|
94
|
+
snippet,
|
|
95
|
+
body: emailBody, // 👈 your old emailBody now lives here
|
|
96
|
+
labels: labelIds,
|
|
97
|
+
threadId,
|
|
98
|
+
internalDate,
|
|
99
|
+
},
|
|
99
100
|
};
|
|
100
|
-
return message;
|
|
101
101
|
}
|
|
102
102
|
catch (err) {
|
|
103
|
-
const
|
|
104
|
-
errorMessages.push(errorMessage);
|
|
103
|
+
const errorMsg = err instanceof Error ? err.message : "Failed to fetch message details";
|
|
105
104
|
return {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
105
|
+
name: "Error fetching message",
|
|
106
|
+
url: "",
|
|
107
|
+
contents: {
|
|
108
|
+
error: errorMsg,
|
|
109
|
+
id: msg.id,
|
|
110
|
+
threadId: "",
|
|
111
|
+
snippet: "",
|
|
112
|
+
internalDate: "",
|
|
113
|
+
body: "",
|
|
114
|
+
from: "",
|
|
115
|
+
to: "",
|
|
116
|
+
cc: "",
|
|
117
|
+
bcc: "",
|
|
118
|
+
labels: [],
|
|
119
|
+
},
|
|
118
120
|
};
|
|
119
121
|
}
|
|
120
122
|
})));
|
|
121
|
-
const successfulResults = results
|
|
122
|
-
.filter((r) => r.status === "fulfilled")
|
|
123
|
-
.map(r => r.value);
|
|
123
|
+
const successfulResults = results.filter(r => r.status === "fulfilled").map(r => r.value);
|
|
124
124
|
const failedResults = results.filter((r) => r.status === "rejected");
|
|
125
125
|
failedResults.forEach(r => {
|
|
126
126
|
const errorMessage = r.reason instanceof Error ? r.reason.message : "Failed to fetch message details";
|
|
@@ -134,15 +134,16 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
134
134
|
}
|
|
135
135
|
return {
|
|
136
136
|
success: errorMessages.length === 0,
|
|
137
|
-
messages: allMessages,
|
|
138
137
|
error: errorMessages.join("; "),
|
|
138
|
+
results: allMessages,
|
|
139
|
+
pageToken,
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
142
|
catch (err) {
|
|
142
143
|
return {
|
|
143
144
|
success: false,
|
|
144
145
|
error: err instanceof Error ? err.message : "Unknown error searching Gmail",
|
|
145
|
-
|
|
146
|
+
results: [],
|
|
146
147
|
};
|
|
147
148
|
}
|
|
148
149
|
});
|