Files
glm-limpieza-de-temporales-…/glm-limpieza-de-temporales-ir-nicaragua.json
T

410 lines
13 KiB
JSON

{
"updatedAt": "2026-07-25T17:32:10.577Z",
"createdAt": "2026-07-13T15:33:52.678Z",
"id": "4WrHnfh80M7Zewjw",
"name": "GLM - Limpieza de temporales IR Nicaragua",
"description": "Elimina los archivos y recursos temporales creados durante el cálculo de IR, evitando acumulaciones innecesarias en Google Drive después de finalizar el procesamiento.",
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 2
}
]
}
},
"id": "5db07430-0c71-417b-a5d3-3f3aa123051d",
"name": "Limpieza diaria 2 AM",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.3,
"position": [
0,
352
]
},
{
"parameters": {
"url": "https://www.googleapis.com/drive/v3/files",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDriveOAuth2Api",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "name contains 'TMP_IR_NIC_' and trashed = false"
},
{
"name": "fields",
"value": "files(id,name,createdTime)"
},
{
"name": "pageSize",
"value": "1000"
},
{
"name": "orderBy",
"value": "createdTime"
}
]
},
"options": {
"timeout": 120000
}
},
"id": "b30e32d6-1080-43d2-a24a-0649b8ae9c38",
"name": "Buscar temporales IR antiguos",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
240,
352
],
"notesInFlow": true,
"retryOnFail": true,
"maxTries": 3,
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
},
"notes": "Selecciona la misma credencial OAuth2 de Google Drive del workflow principal."
},
{
"parameters": {
"jsCode": "'use strict';\nconst cutoff = Date.now() - 24 * 60 * 60 * 1000;\nconst files = Array.isArray($json.files) ? $json.files : [];\nreturn files.filter((f) => f.id && f.createdTime && new Date(f.createdTime).getTime() < cutoff).map((f) => ({ json: { fileId: f.id, name: f.name, createdTime: f.createdTime } }));\n"
},
"id": "701b29aa-506a-45b8-b1f1-4eeff80326ee",
"name": "Filtrar temporales mayores de 24h",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
512,
352
]
},
{
"parameters": {
"method": "DELETE",
"url": "=https://www.googleapis.com/drive/v3/files/{{ $json.fileId }}",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDriveOAuth2Api",
"options": {
"timeout": 120000
}
},
"id": "0be129cf-e394-4147-a083-c71b1b440fb0",
"name": "Eliminar temporales antiguos",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
768,
352
],
"notesInFlow": true,
"retryOnFail": true,
"maxTries": 3,
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
},
"onError": "continueRegularOutput",
"notes": "Selecciona la misma credencial Google Drive."
},
{
"parameters": {
"content": "# 🧹 LIMPIEZA AUTOMÁTICA DE ARCHIVOS TEMPORALES IR\n\nEjecuta diariamente a las 2:00 a. m. la limpieza de los archivos temporales utilizados por el proceso de IR Nicaragua.\n\nFuncionamiento:\n\n1. Inicia automáticamente según el horario configurado.\n2. Consulta los archivos temporales almacenados para el proceso de IR.\n3. Calcula la antigüedad de cada archivo encontrado.\n4. Conserva únicamente los archivos con más de 24 horas.\n5. Elimina de forma definitiva los temporales antiguos.\n\nObjetivos:\n\n- Evitar la acumulación innecesaria de archivos.\n- Liberar espacio de almacenamiento.\n- Mantener limpia la carpeta temporal.\n- No afectar archivos recientes que todavía puedan estar en uso.\n- Reducir el mantenimiento manual del proceso.\n\nReglas:\n\n- Eliminar solamente archivos identificados como temporales de IR.\n- No borrar archivos con menos de 24 horas.\n- Utilizar la misma credencial autorizada para consultar y eliminar.\n- Una ejecución sin archivos antiguos debe finalizar correctamente.\n- No eliminar documentos finales, plantillas ni reportes entregados.",
"height": 720,
"width": 1088
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-96,
-176
],
"id": "6032c0e1-61a5-4264-9a14-4f7cb364f76a",
"name": "Sticky Note"
}
],
"connections": {
"Limpieza diaria 2 AM": {
"main": [
[
{
"node": "Buscar temporales IR antiguos",
"type": "main",
"index": 0
}
]
]
},
"Buscar temporales IR antiguos": {
"main": [
[
{
"node": "Filtrar temporales mayores de 24h",
"type": "main",
"index": 0
}
]
]
},
"Filtrar temporales mayores de 24h": {
"main": [
[
{
"node": "Eliminar temporales antiguos",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"availableInMCP": true,
"timeSavedMode": "fixed",
"errorWorkflow": "puF4LUczoSz3hcek",
"timezone": "America/Santo_Domingo",
"callerPolicy": "workflowsFromSameOwner"
},
"staticData": {
"node:Limpieza diaria 2 AM": {
"recurrenceRules": []
}
},
"meta": null,
"versionId": "95ecb38e-435f-4222-be28-15059062a9e8",
"activeVersionId": "95ecb38e-435f-4222-be28-15059062a9e8",
"versionCounter": 22,
"triggerCount": 1,
"shared": [
{
"updatedAt": "2026-07-13T15:33:52.681Z",
"createdAt": "2026-07-13T15:33:52.681Z",
"role": "workflow:owner",
"workflowId": "4WrHnfh80M7Zewjw",
"projectId": "PJpTANzTXIFibWsW",
"project": {
"updatedAt": "2026-04-22T14:25:09.686Z",
"createdAt": "2026-04-22T14:22:54.790Z",
"id": "PJpTANzTXIFibWsW",
"name": "Isaac Aracena <iaracena@gomezleemarketing.com>",
"type": "personal",
"icon": null,
"description": null,
"creatorId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
}
}
],
"tags": [],
"activeVersion": {
"updatedAt": "2026-07-21T22:17:07.000Z",
"createdAt": "2026-07-21T22:17:06.518Z",
"versionId": "95ecb38e-435f-4222-be28-15059062a9e8",
"workflowId": "4WrHnfh80M7Zewjw",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 2
}
]
}
},
"id": "5db07430-0c71-417b-a5d3-3f3aa123051d",
"name": "Limpieza diaria 2 AM",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.3,
"position": [
0,
352
]
},
{
"parameters": {
"url": "https://www.googleapis.com/drive/v3/files",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDriveOAuth2Api",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "name contains 'TMP_IR_NIC_' and trashed = false"
},
{
"name": "fields",
"value": "files(id,name,createdTime)"
},
{
"name": "pageSize",
"value": "1000"
},
{
"name": "orderBy",
"value": "createdTime"
}
]
},
"options": {
"timeout": 120000
}
},
"id": "b30e32d6-1080-43d2-a24a-0649b8ae9c38",
"name": "Buscar temporales IR antiguos",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
240,
352
],
"notesInFlow": true,
"retryOnFail": true,
"maxTries": 3,
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
},
"notes": "Selecciona la misma credencial OAuth2 de Google Drive del workflow principal."
},
{
"parameters": {
"jsCode": "'use strict';\nconst cutoff = Date.now() - 24 * 60 * 60 * 1000;\nconst files = Array.isArray($json.files) ? $json.files : [];\nreturn files.filter((f) => f.id && f.createdTime && new Date(f.createdTime).getTime() < cutoff).map((f) => ({ json: { fileId: f.id, name: f.name, createdTime: f.createdTime } }));\n"
},
"id": "701b29aa-506a-45b8-b1f1-4eeff80326ee",
"name": "Filtrar temporales mayores de 24h",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
512,
352
]
},
{
"parameters": {
"method": "DELETE",
"url": "=https://www.googleapis.com/drive/v3/files/{{ $json.fileId }}",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDriveOAuth2Api",
"options": {
"timeout": 120000
}
},
"id": "0be129cf-e394-4147-a083-c71b1b440fb0",
"name": "Eliminar temporales antiguos",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
768,
352
],
"notesInFlow": true,
"retryOnFail": true,
"maxTries": 3,
"credentials": {
"googleDriveOAuth2Api": {
"id": "g23xdGLZRzBGqKgH",
"name": "Isaac - Google Drive"
}
},
"onError": "continueRegularOutput",
"notes": "Selecciona la misma credencial Google Drive."
},
{
"parameters": {
"content": "# 🧹 LIMPIEZA AUTOMÁTICA DE ARCHIVOS TEMPORALES IR\n\nEjecuta diariamente a las 2:00 a. m. la limpieza de los archivos temporales utilizados por el proceso de IR Nicaragua.\n\nFuncionamiento:\n\n1. Inicia automáticamente según el horario configurado.\n2. Consulta los archivos temporales almacenados para el proceso de IR.\n3. Calcula la antigüedad de cada archivo encontrado.\n4. Conserva únicamente los archivos con más de 24 horas.\n5. Elimina de forma definitiva los temporales antiguos.\n\nObjetivos:\n\n- Evitar la acumulación innecesaria de archivos.\n- Liberar espacio de almacenamiento.\n- Mantener limpia la carpeta temporal.\n- No afectar archivos recientes que todavía puedan estar en uso.\n- Reducir el mantenimiento manual del proceso.\n\nReglas:\n\n- Eliminar solamente archivos identificados como temporales de IR.\n- No borrar archivos con menos de 24 horas.\n- Utilizar la misma credencial autorizada para consultar y eliminar.\n- Una ejecución sin archivos antiguos debe finalizar correctamente.\n- No eliminar documentos finales, plantillas ni reportes entregados.",
"height": 720,
"width": 1088
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-96,
-176
],
"id": "6032c0e1-61a5-4264-9a14-4f7cb364f76a",
"name": "Sticky Note"
}
],
"connections": {
"Limpieza diaria 2 AM": {
"main": [
[
{
"node": "Buscar temporales IR antiguos",
"type": "main",
"index": 0
}
]
]
},
"Buscar temporales IR antiguos": {
"main": [
[
{
"node": "Filtrar temporales mayores de 24h",
"type": "main",
"index": 0
}
]
]
},
"Filtrar temporales mayores de 24h": {
"main": [
[
{
"node": "Eliminar temporales antiguos",
"type": "main",
"index": 0
}
]
]
}
},
"authors": "Isaac Aracena",
"name": "Version 95ecb38e",
"description": "",
"autosaved": true,
"workflowPublishHistory": [
{
"createdAt": "2026-07-21T22:17:07.684Z",
"id": 3348,
"workflowId": "4WrHnfh80M7Zewjw",
"versionId": "95ecb38e-435f-4222-be28-15059062a9e8",
"event": "activated",
"userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
},
{
"createdAt": "2026-07-25T17:32:10.682Z",
"id": 3476,
"workflowId": "4WrHnfh80M7Zewjw",
"versionId": "95ecb38e-435f-4222-be28-15059062a9e8",
"event": "activated",
"userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
},
{
"createdAt": "2026-07-25T17:32:10.636Z",
"id": 3475,
"workflowId": "4WrHnfh80M7Zewjw",
"versionId": "95ecb38e-435f-4222-be28-15059062a9e8",
"event": "deactivated",
"userId": "0a88c0b1-928e-4412-896e-c5d1c99b2029"
}
]
}
}