@arela/uploader 1.0.11 → 1.0.12

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.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "CLI to upload files/directories to Arela",
5
5
  "bin": {
6
6
  "arela": "./src/index.js"
@@ -152,6 +152,7 @@ export class PushCommand {
152
152
  parseInt(options.batchSize),
153
153
  parseInt(options.uploadBatchSize),
154
154
  uploadApiConfig,
155
+ options,
155
156
  );
156
157
 
157
158
  totalResults.processed += results.processed;
@@ -249,6 +250,7 @@ export class PushCommand {
249
250
  batchSize,
250
251
  uploadBatchSize,
251
252
  uploadApiConfig,
253
+ options = {},
252
254
  ) {
253
255
  const results = {
254
256
  processed: 0,
@@ -257,8 +259,11 @@ export class PushCommand {
257
259
  startTime: Date.now(),
258
260
  };
259
261
 
260
- // Get total count first for accurate progress
261
- const initialStats = await this.scanApiService.getPushStats(tableName);
262
+ // Get total count first for accurate progress (filtered by RFC/year)
263
+ const initialStats = await this.scanApiService.getPushStats(
264
+ tableName,
265
+ filters,
266
+ );
262
267
  const totalToProcess = initialStats.pending;
263
268
 
264
269
  let hasMore = true;
@@ -305,6 +310,7 @@ export class PushCommand {
305
310
  tableName,
306
311
  uploadBatch,
307
312
  uploadApiConfig,
313
+ options,
308
314
  );
309
315
 
310
316
  // Update counters from API response
@@ -356,7 +362,7 @@ export class PushCommand {
356
362
  * Note: Scan table is updated separately via scanApi after this batch completes
357
363
  * @private
358
364
  */
359
- async #uploadBatchViaCli(tableName, files, uploadApiConfig) {
365
+ async #uploadBatchViaCli(tableName, files, uploadApiConfig, options = {}) {
360
366
  const pushConfig = appConfig.getPushConfig();
361
367
  const results = [];
362
368
 
@@ -367,6 +373,7 @@ export class PushCommand {
367
373
  file,
368
374
  uploadApiConfig,
369
375
  pushConfig,
376
+ options,
370
377
  );
371
378
  results.push(result);
372
379
  }
@@ -378,7 +385,13 @@ export class PushCommand {
378
385
  * Upload a single file using the CLI upload endpoint
379
386
  * @private
380
387
  */
381
- async #uploadFileViaCli(tableName, file, uploadApiConfig, pushConfig) {
388
+ async #uploadFileViaCli(
389
+ tableName,
390
+ file,
391
+ uploadApiConfig,
392
+ pushConfig,
393
+ options = {},
394
+ ) {
382
395
  const result = {
383
396
  id: file.id,
384
397
  uploaded: false,
@@ -436,7 +449,10 @@ export class PushCommand {
436
449
  form.append('rfc', file.rfc);
437
450
  form.append('bucket', pushConfig.bucket);
438
451
  form.append('autoDetect', 'true');
439
- form.append('autoOrganize', 'false');
452
+ form.append(
453
+ 'autoOrganize',
454
+ options.autoOrganize !== false ? 'true' : 'false',
455
+ );
440
456
  form.append('batchSize', '1');
441
457
  form.append('clientVersion', appConfig.packageVersion);
442
458
 
@@ -34,10 +34,10 @@ class Config {
34
34
  const __dirname = path.dirname(__filename);
35
35
  const packageJsonPath = path.resolve(__dirname, '../../package.json');
36
36
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
37
- return packageJson.version || '1.0.11';
37
+ return packageJson.version || '1.0.12';
38
38
  } catch (error) {
39
39
  console.warn('⚠️ Could not read package.json version, using fallback');
40
- return '1.0.11';
40
+ return '1.0.12';
41
41
  }
42
42
  }
43
43
 
package/src/index.js CHANGED
@@ -415,6 +415,7 @@ class ArelaUploaderCLI {
415
415
  '--folder-structure <path>',
416
416
  'Storage path prefix (overrides PUSH_FOLDER_STRUCTURE env var)',
417
417
  )
418
+ .option('--no-auto-organize', 'Disable automatic file organization')
418
419
  .option('--show-stats', 'Show performance statistics')
419
420
  .action(async (options) => {
420
421
  try {
@@ -629,13 +629,23 @@ export class ScanApiService {
629
629
  /**
630
630
  * Get push statistics
631
631
  * @param {string} tableName - Target table name
632
+ * @param {Object} filters - Optional filters { rfcs: string[], years: string[] }
632
633
  * @returns {Promise<Object>} { totalWithArelaPath, uploaded, pending, errors, maxAttemptsReached, byRfc }
633
634
  */
634
- async getPushStats(tableName) {
635
+ async getPushStats(tableName, filters = {}) {
635
636
  logger.debug('Fetching push statistics...');
636
637
 
638
+ // Build query params
639
+ const params = new URLSearchParams({ tableName });
640
+ if (filters.rfcs && filters.rfcs.length > 0) {
641
+ params.append('rfcs', filters.rfcs.join(','));
642
+ }
643
+ if (filters.years && filters.years.length > 0) {
644
+ params.append('years', filters.years.join(','));
645
+ }
646
+
637
647
  const result = await this.#request(
638
- `/api/uploader/scan/push-stats?tableName=${encodeURIComponent(tableName)}`,
648
+ `/api/uploader/scan/push-stats?${params.toString()}`,
639
649
  'GET',
640
650
  );
641
651