@arela/uploader 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arela/uploader",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "CLI to upload files/directories to Arela",
5
5
  "bin": {
6
6
  "arela": "./src/index.js"
@@ -37,10 +37,10 @@ class Config {
37
37
  const __dirname = path.dirname(__filename);
38
38
  const packageJsonPath = path.resolve(__dirname, '../../package.json');
39
39
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
40
- return packageJson.version || '1.1.3';
40
+ return packageJson.version || '1.1.4';
41
41
  } catch (error) {
42
42
  console.warn('⚠️ Could not read package.json version, using fallback');
43
- return '1.1.3';
43
+ return '1.1.4';
44
44
  }
45
45
  }
46
46
 
@@ -100,7 +100,7 @@ export function extractDocumentFields(source, fileExtension, filePath) {
100
100
 
101
101
  // Resolve final type if the definition supports it (e.g., pedimento_simplificado vs proforma)
102
102
  const resolvedType = docType.resolveType
103
- ? docType.resolveType(fields)
103
+ ? docType.resolveType(fields, filePath)
104
104
  : docType.type;
105
105
 
106
106
  console.log(` → Resolved type: ${resolvedType}`);
@@ -74,8 +74,15 @@ export const pedimentoCompletoDefinition = {
74
74
  * - R1 rectifications require fechaPagoRectificacion
75
75
  * - Everything else requires paymentDate
76
76
  * No payment evidence ⇒ proforma_completo.
77
+ *
78
+ * Exception: the "CoveFact" annex (…-CoveFact.pdf) doesn't always print the
79
+ * payment section, so the payment-based demotion misfires and the file gets
80
+ * stuck as proforma_completo (NON_PUSHABLE) forever — the CLI never
81
+ * re-identifies rows that already have a detected_type. The filename is the
82
+ * payment-independent signal for this variant.
77
83
  */
78
- resolveType: (fields) => {
84
+ resolveType: (fields, filePath) => {
85
+ if (/covefact/i.test(filePath ?? '')) return 'pedimento_completo';
79
86
  const clavePedimento =
80
87
  fields?.find((f) => f.name === 'clavePedimento')?.value ?? null;
81
88
  const paymentDate =
@@ -56,6 +56,15 @@ function composeArelaPath(
56
56
  return null;
57
57
  }
58
58
 
59
+ // The CoveFact annex resolves to pedimento_completo without payment
60
+ // evidence (see pedimento-completo.js resolveType), so it must never anchor
61
+ // an operation on its own: with no self-composed path it only becomes
62
+ // pushable when a PAID sibling pedimento propagates the folder's
63
+ // arela_path. Unpaid operations therefore never reach Arela through it.
64
+ if (/covefact/i.test(filePath ?? '')) {
65
+ return null;
66
+ }
67
+
59
68
  const rfc = fields?.find((f) => f.name === 'rfc')?.value;
60
69
  let patente = fields?.find((f) => f.name === 'patente')?.value;
61
70
  const aduana = fields?.find((f) => f.name === 'aduanaEntradaSalida')?.value;
@@ -225,7 +225,7 @@ export function classifyDocument(matchers, { source, extension, filePath }) {
225
225
  }
226
226
 
227
227
  const resolvedType = def.resolveType
228
- ? def.resolveType(fields)
228
+ ? def.resolveType(fields, filePath)
229
229
  : def.documentType;
230
230
  const pedimento = def.extractNumPedimento
231
231
  ? def.extractNumPedimento(source, fields, filePath)