getBlob Issue
This example is a test for PR #301 to fix getBlob
error on conflict strategy update
.
👉 Edit this example in the playground.
- Config
- Script
{
"description": "Tests a fix for `getBlob` error on conflict strategy `update`.",
"settings": {
"logSheetLocation": "/GmailProcessor-Tests/logsheet-${date.now:date::yyyy-MM}",
"markProcessedMethod": "mark-read",
"timezone": "Etc/UTC"
},
"global": {
"thread": {
"match": {
"query": "has:attachment -in:trash -in:drafts -in:spam after:${date.now:date::yyyy-MM-dd} is:unread subject:\"[GmailProcessor-Test] issue301\"",
"maxMessageCount": -1,
"minMessageCount": 1
}
}
},
"threads": [
{
"match": {
"query": "from:${user.email} to:${user.email} subject:'Test with office attachments'"
},
"attachments": [
{
"description": "Process *.docx attachment files",
"match": {
"name": "(?<basename>.+)\\.docx$"
},
"actions": [
{
"description": "Store original docx file",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/${attachment.name}"
}
},
{
"description": "Store docx file converted to Google Docs format",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/${attachment.name.match.basename}",
"toMimeType": "application/vnd.google-apps.document"
}
}
]
},
{
"description": "Process *.pptx attachment files",
"match": {
"name": "(?<basename>.+)\\.pptx$"
},
"actions": [
{
"description": "Store original pptx file",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/${attachment.name}"
}
},
{
"description": "Store pptx file converted to Google Presentations format",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/${attachment.name.match.basename}",
"toMimeType": "application/vnd.google-apps.presentation"
}
}
]
},
{
"description": "Process *.xlsx attachment files",
"match": {
"name": "(?<basename>.+)\\.xlsx$"
},
"actions": [
{
"description": "Store original xlsx file",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/${attachment.name}"
}
},
{
"description": "Store xlsx file converted to Google Spreadsheet format",
"name": "attachment.store",
"args": {
"conflictStrategy": "replace",
"location": "/GmailProcessor-Tests/e2e/${attachment.name.match.basename}",
"toMimeType": "application/vnd.google-apps.spreadsheet"
}
}
]
}
]
}
]
}
function issue301Run() {
const config = {
description:
"Tests a fix for `getBlob` error on conflict strategy `update`.",
settings: {
logSheetLocation:
"/GmailProcessor-Tests/logsheet-${date.now:date::yyyy-MM}",
markProcessedMethod: "mark-read",
timezone: "Etc/UTC",
},
global: {
thread: {
match: {
query:
'has:attachment -in:trash -in:drafts -in:spam after:${date.now:date::yyyy-MM-dd} is:unread subject:"[GmailProcessor-Test] issue301"',
maxMessageCount: -1,
minMessageCount: 1,
},
},
},
threads: [
{
match: {
query:
"from:${user.email} to:${user.email} subject:'Test with office attachments'",
},
attachments: [
{
description: "Process *.docx attachment files",
match: {
name: "(?<basename>.+)\\.docx$",
},
actions: [
{
description: "Store original docx file",
name: "attachment.store",
args: {
conflictStrategy: "replace",
location: "/GmailProcessor-Tests/e2e/${attachment.name}",
},
},
{
description: "Store docx file converted to Google Docs format",
name: "attachment.store",
args: {
conflictStrategy: "replace",
location:
"/GmailProcessor-Tests/e2e/${attachment.name.match.basename}",
toMimeType: "application/vnd.google-apps.document",
},
},
],
},
{
description: "Process *.pptx attachment files",
match: {
name: "(?<basename>.+)\\.pptx$",
},
actions: [
{
description: "Store original pptx file",
name: "attachment.store",
args: {
conflictStrategy: "replace",
location: "/GmailProcessor-Tests/e2e/${attachment.name}",
},
},
{
description:
"Store pptx file converted to Google Presentations format",
name: "attachment.store",
args: {
conflictStrategy: "replace",
location:
"/GmailProcessor-Tests/e2e/${attachment.name.match.basename}",
toMimeType: "application/vnd.google-apps.presentation",
},
},
],
},
{
description: "Process *.xlsx attachment files",
match: {
name: "(?<basename>.+)\\.xlsx$",
},
actions: [
{
description: "Store original xlsx file",
name: "attachment.store",
args: {
conflictStrategy: "replace",
location: "/GmailProcessor-Tests/e2e/${attachment.name}",
},
},
{
description:
"Store xlsx file converted to Google Spreadsheet format",
name: "attachment.store",
args: {
conflictStrategy: "replace",
location:
"/GmailProcessor-Tests/e2e/${attachment.name.match.basename}",
toMimeType: "application/vnd.google-apps.spreadsheet",
},
},
],
},
],
},
],
}
return GmailProcessorLib.run(config, "dry-run")
}
Source: issue301.ts | Issues: #300 | PRs: #301