@mesh-sync/worker-backend-client 1.0.6 → 4.0.2

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/README.md CHANGED
@@ -100,6 +100,69 @@ await client.sendToQueue(MessageTypes.FILE_DOWNLOAD_REQUEST, {
100
100
  ## Available Message Types
101
101
 
102
102
 
103
+ ### backend-logging-event
104
+
105
+ **Description:** Centralized logging event for capturing all warn/error/failure logs from meshsync-backend.
106
+ This event is sent to ELK for centralized monitoring, alerting, and debugging.
107
+
108
+ Automatically emitted by the custom Pino logger interceptor when:
109
+ - logger.warn() is called
110
+ - logger.error() is called
111
+ - uncaught exceptions occur
112
+ - request failures happen (4xx, 5xx responses)
113
+
114
+ Used for:
115
+ - System health monitoring
116
+ - Error tracking and alerting
117
+ - Performance degradation detection
118
+ - Security incident tracking
119
+ - Compliance and audit trails
120
+
121
+
122
+ **Method:** `client.backendLoggingEvent(data)`
123
+
124
+ **Payload Type:** `BackendLoggingEventMessage`
125
+
126
+ **Fields:**
127
+
128
+ - `eventType` (string) [✓]: Type of logging event
129
+
130
+ - `timestamp` (string) [✓]: ISO 8601 timestamp when the log was generated
131
+
132
+ - `level` (string) [✓]: Log level severity
133
+
134
+ - `message` (string) [✓]: Human-readable log message
135
+
136
+ - `context` (string) [✓]: Logger context (typically the class/service name)
137
+
138
+ - `requestId` (string) [✗]: Unique request ID for correlation (X-Request-Id header)
139
+
140
+ - `userId` (string) [✗]: ID of the authenticated user (if available)
141
+
142
+ - `httpMethod` (string) [✗]: HTTP method of the request
143
+
144
+ - `httpUrl` (string) [✗]: Request URL path (without query params for privacy)
145
+
146
+ - `httpStatusCode` (integer) [✗]: HTTP response status code
147
+
148
+ - `errorType` (string) [✗]: Error class/type name
149
+
150
+ - `errorStack` (string) [✗]: Stack trace (sanitized, no sensitive data)
151
+
152
+ - `errorCode` (string) [✗]: Application-specific error code for categorization
153
+
154
+ - `metadata` (object) [✗]: Additional structured context (sanitized, no PII)
155
+
156
+ - `environment` (string) [✗]: Deployment environment
157
+
158
+ - `serviceVersion` (string) [✗]: Backend service version
159
+
160
+ - `hostname` (string) [✗]: Server hostname/pod name
161
+
162
+ - `durationMs` (number) [✗]: Operation duration in milliseconds (if applicable)
163
+
164
+
165
+
103
166
  ### etsy-analytics-sync-completed
104
167
 
105
168
  **Description:** Contains synced analytics data for Etsy listings. Backend stores this in etsy_analytics_snapshots table and indexes to ELK.
@@ -251,7 +314,7 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
251
314
 
252
315
  ### file-download-request
253
316
 
254
- **Description:** Handles file download requests.
317
+ **Description:** Downloads model file from storage provider to MinIO for processing pipeline. Acts as parent job for thumbnail generation, technical metadata analysis, and metadata generation.
255
318
 
256
319
  **Method:** `client.fileDownloadRequest(data)`
257
320
 
@@ -261,8 +324,18 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
261
324
 
262
325
  - `modelId` (string) [✗]: The unique identifier for the model to be downloaded.
263
326
 
327
+ - `ownerId` (string) [✗]: The identifier of the user who owns the model.
328
+
264
329
  - `storageLocation` (object) [✗]: The storage location of the model.
265
330
 
331
+ - `minioDestination` (object) [✗]: Destination in MinIO where file will be uploaded after download.
332
+
333
+ - `autoEnqueueChildren` (boolean) [✗]: Automatically enqueue thumbnail generation, technical metadata analysis, and metadata generation jobs after download completes.
334
+
335
+ - `previewType` (string) [✗]: Preview type for thumbnail generation (passed to child job).
336
+
337
+ - `generate360Views` (boolean) [✗]: Generate 16 angle views for 360° preview (passed to child job).
338
+
266
339
 
267
340
 
268
341
  ### marketplace-analytics-sync-completed
@@ -325,6 +398,226 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
325
398
 
326
399
 
327
400
 
401
+ ### marketplace-connection-sync-completed
402
+
403
+ **Description:** Notification that marketplace connection sync has completed. Contains updated connection metadata, profile information, and sync statistics.
404
+
405
+
406
+ **Method:** `client.marketplaceConnectionSyncCompleted(data)`
407
+
408
+ **Payload Type:** `MarketplaceConnectionSyncCompletedMessage`
409
+
410
+ **Fields:**
411
+
412
+ - `requestId` (string) [✗]: Original request ID for correlation
413
+
414
+ - `connectionId` (string) [✗]: Marketplace connection that was synced
415
+
416
+ - `marketplaceId` (string) [✗]: Marketplace provider ID
417
+
418
+ - `userId` (string) [✗]: Connection owner user ID
419
+
420
+ - `status` (string) [✗]: Overall sync result status
421
+
422
+ - `syncType` (string) [✗]: Type of sync that was performed
423
+
424
+ - `connectionData` (object) [✗]: Updated connection information
425
+
426
+ - `categories` (array) [✗]: Available marketplace categories
427
+
428
+ - `statistics` (object) [✗]: Sync operation statistics
429
+
430
+ - `completedAt` (string) [✗]: When sync completed
431
+
432
+ - `error` (object) [✗]: Error details if sync failed
433
+
434
+
435
+
436
+ ### marketplace-connection-sync-request
437
+
438
+ **Description:** Requests synchronization of marketplace connection data including: - Profile information and shop details - Account status and permissions - Available categories and shipping profiles - Rate limits and API quotas
439
+ This is typically triggered after initial connection or periodically to keep marketplace metadata up to date.
440
+
441
+
442
+ **Method:** `client.marketplaceConnectionSyncRequest(data)`
443
+
444
+ **Payload Type:** `MarketplaceConnectionSyncRequestMessage`
445
+
446
+ **Fields:**
447
+
448
+ - `connectionId` (string) [✗]: Internal marketplace connection ID
449
+
450
+ - `marketplaceId` (string) [✗]: Marketplace provider ID (etsy, ebay, etc.)
451
+
452
+ - `userId` (string) [✗]: User who owns this connection
453
+
454
+ - `syncType` (string) [✗]: Type of sync to perform
455
+
456
+ - `priority` (string) [✗]: Processing priority
457
+
458
+ - `requestId` (string) [✗]: Unique request identifier for tracking
459
+
460
+ - `webhookUrl` (string) [✗]: Webhook URL to call when sync completes
461
+
462
+ - `metadata` (object) [✗]: Additional context data
463
+
464
+
465
+
466
+ ### marketplace-credential-rotation-completed
467
+
468
+ **Description:** Notification that marketplace credential rotation has completed. Contains the rotation results, new credential metadata, and any issues encountered.
469
+
470
+
471
+ **Method:** `client.marketplaceCredentialRotationCompleted(data)`
472
+
473
+ **Payload Type:** `MarketplaceCredentialRotationCompletedMessage`
474
+
475
+ **Fields:**
476
+
477
+ - `requestId` (string) [✗]: Original rotation request ID
478
+
479
+ - `connectionId` (string) [✗]: Marketplace connection that was rotated
480
+
481
+ - `marketplaceId` (string) [✗]: Marketplace provider ID
482
+
483
+ - `userId` (string) [✗]: Connection owner user ID
484
+
485
+ - `status` (string) [✗]: Overall rotation operation status
486
+
487
+ - `rotationType` (string) [✗]: Type of rotation that was performed
488
+
489
+ - `reason` (string) [✗]: Original reason for rotation
490
+
491
+ - `newCredentials` (object) [✗]: Metadata about new credentials
492
+
493
+ - `oldCredentials` (object) [✗]: Status of previous credentials
494
+
495
+ - `operationDetails` (object) [✗]: Details of the rotation operation
496
+
497
+ - `connectionStatus` (object) [✗]: Connection status after credential rotation
498
+
499
+ - `nextRotation` (object) [✗]: Information about next scheduled rotation
500
+
501
+ - `error` (object) [✗]: Error details if rotation failed
502
+
503
+ - `notifications` (array) [✗]: Notifications sent as part of rotation
504
+
505
+
506
+
507
+ ### marketplace-credential-rotation-request
508
+
509
+ **Description:** Requests rotation/refresh of marketplace connection credentials. This is used for: - OAuth token refresh when tokens are near expiry - API key rotation for enhanced security - Re-authentication after connection errors - Scheduled credential updates
510
+
511
+
512
+ **Method:** `client.marketplaceCredentialRotationRequest(data)`
513
+
514
+ **Payload Type:** `MarketplaceCredentialRotationRequestMessage`
515
+
516
+ **Fields:**
517
+
518
+ - `connectionId` (string) [✗]: Marketplace connection ID requiring credential rotation
519
+
520
+ - `marketplaceId` (string) [✗]: Marketplace provider ID (etsy, ebay, etc.)
521
+
522
+ - `userId` (string) [✗]: User who owns the connection
523
+
524
+ - `rotationType` (string) [✗]: Type of credential rotation to perform
525
+
526
+ - `reason` (string) [✗]: Reason for credential rotation
527
+
528
+ - `urgency` (string) [✗]: How urgently the rotation is needed
529
+
530
+ - `currentCredentials` (object) [✗]: Current credential metadata (no actual secrets)
531
+
532
+ - `options` (object) [✗]: Rotation configuration options
533
+
534
+ - `requestId` (string) [✗]: Unique request identifier
535
+
536
+ - `webhookUrl` (string) [✗]: Webhook URL for completion notification
537
+
538
+ - `scheduledAt` (string) [✗]: When this rotation was scheduled (if scheduled)
539
+
540
+ - `metadata` (object) [✗]: Additional request context
541
+
542
+
543
+
544
+ ### marketplace-listing-sync-completed
545
+
546
+ **Description:** Notification that marketplace listing sync operation has completed. Contains detailed results of the sync including created/updated listings, errors encountered, and performance statistics.
547
+
548
+
549
+ **Method:** `client.marketplaceListingSyncCompleted(data)`
550
+
551
+ **Payload Type:** `MarketplaceListingSyncCompletedMessage`
552
+
553
+ **Fields:**
554
+
555
+ - `requestId` (string) [✗]: Original request ID for correlation
556
+
557
+ - `connectionId` (string) [✗]: Marketplace connection that was synced
558
+
559
+ - `marketplaceId` (string) [✗]: Marketplace provider ID
560
+
561
+ - `userId` (string) [✗]: Connection owner user ID
562
+
563
+ - `status` (string) [✗]: Overall sync operation status
564
+
565
+ - `syncDirection` (string) [✗]: Direction of sync that was performed
566
+
567
+ - `statistics` (object) [✗]: Detailed sync operation statistics
568
+
569
+ - `results` (object) [✗]: Detailed sync results by operation
570
+
571
+ - `successfulListings` (array) [✗]: Details of successfully processed listings
572
+
573
+ - `failedListings` (array) [✗]: Details of listings that failed to sync
574
+
575
+ - `errors` (array) [✗]: Non-listing-specific errors encountered
576
+
577
+ - `completedAt` (string) [✗]: When sync operation completed
578
+
579
+ - `nextSyncRecommendedAt` (string) [✗]: When next sync is recommended
580
+
581
+
582
+
583
+ ### marketplace-listing-sync-request
584
+
585
+ **Description:** Requests synchronization of marketplace listings for a connection. Can sync specific listings or all listings for a marketplace connection.
586
+ Includes bidirectional sync: - Pull: Fetch listings from marketplace to update local database - Push: Update marketplace listings with local changes - Full: Both pull and push operations
587
+
588
+
589
+ **Method:** `client.marketplaceListingSyncRequest(data)`
590
+
591
+ **Payload Type:** `MarketplaceListingSyncRequestMessage`
592
+
593
+ **Fields:**
594
+
595
+ - `connectionId` (string) [✗]: Marketplace connection ID
596
+
597
+ - `marketplaceId` (string) [✗]: Marketplace provider ID (etsy, ebay, etc.)
598
+
599
+ - `userId` (string) [✗]: User who owns the connection
600
+
601
+ - `syncDirection` (string) [✗]: Direction of sync operation
602
+
603
+ - `syncScope` (string) [✗]: Scope of listings to sync
604
+
605
+ - `listingIds` (array) [✗]: Specific listing IDs to sync (if syncScope=specific)
606
+
607
+ - `externalListingIds` (array) [✗]: External marketplace listing IDs to sync
608
+
609
+ - `options` (object) [✗]: Sync configuration options
610
+
611
+ - `priority` (string) [✗]: Processing priority
612
+
613
+ - `requestId` (string) [✗]: Unique request identifier
614
+
615
+ - `webhookUrl` (string) [✗]: Webhook URL for completion notification
616
+
617
+ - `metadata` (object) [✗]: Additional request context
618
+
619
+
620
+
328
621
  ### marketplace-publish-listing-completed
329
622
 
330
623
  **Description:** Indicates completion of marketplace listing publication. Contains external listing ID and URL, or error details if failed. Works with any marketplace provider (etsy, ebay, etc.).
@@ -488,6 +781,43 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
488
781
 
489
782
 
490
783
 
784
+ ### model-analytics-collection-request
785
+
786
+ **Description:** Request to collect marketplace analytics for a specific metamodel.
787
+ Triggered by backend scheduler every 6 hours for popular/tagged metamodels.
788
+
789
+ Worker performs targeted market searches based on metamodel metadata
790
+ and stores aggregated statistics in Elasticsearch for trend analysis.
791
+
792
+
793
+ **Method:** `client.modelAnalyticsCollectionRequest(data)`
794
+
795
+ **Payload Type:** `ModelAnalyticsCollectionRequestMessage`
796
+
797
+ **Fields:**
798
+
799
+ - `metamodelId` (string) [✓]: The metamodel ID to collect analytics for
800
+
801
+ - `ownerId` (string) [✓]: Owner user ID for audit trail
802
+
803
+ - `primaryCategory` (string) [✗]: Primary classification category (e.g., "miniature", "terrain")
804
+
805
+ - `subCategory` (string) [✗]: Sub-category for more specific targeting
806
+
807
+ - `tags` (array) [✗]: Relevant tags from metamodel metadata (max 10)
808
+
809
+ - `franchise` (string) [✗]: Franchise name if detected (e.g., "Dungeons & Dragons")
810
+
811
+ - `confidence` (number) [✗]: Classification confidence score
812
+
813
+ - `priority` (string) [✗]: Collection priority level
814
+
815
+ - `triggeredBy` (string) [✗]: Source of trigger (e.g., "backend-scheduler", "manual")
816
+
817
+ - `triggeredAt` (string) [✗]: Timestamp when collection was triggered
818
+
819
+
820
+
491
821
  ### model-discovery-folder-processed-event
492
822
 
493
823
  **Description:** Handles model discovery folder processed events.
@@ -594,7 +924,7 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
594
924
 
595
925
  ### model-metadata-generation-request
596
926
 
597
- **Description:** Handles model metadata generation requests.
927
+ **Description:** Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
598
928
 
599
929
  **Method:** `client.modelMetadataGenerationRequest(data)`
600
930
 
@@ -604,9 +934,13 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
604
934
 
605
935
  - `modelId` (string) [✗]: The unique identifier for the model.
606
936
 
607
- - `storageConnectionId` (string) [✗]: The ID of the storage connection.
937
+ - `ownerId` (string) [✗]: The identifier of the user who owns the model.
938
+
939
+ - `storageConnectionId` (string) [✗]: The ID of the storage connection (legacy - used if minioPath not provided).
608
940
 
609
- - `filePath` (string) [✗]: The path to the model file.
941
+ - `filePath` (string) [✗]: The path to the model file (legacy - used if minioPath not provided).
942
+
943
+ - `minioPath` (string) [✗]: Path to model in MinIO (e.g., 'raw_models/{modelId}/original.glb'). If provided, file will be read from MinIO instead of downloading from storage provider.
610
944
 
611
945
  - `fileName` (string) [✗]: The name of the model file.
612
946
 
@@ -616,6 +950,8 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
616
950
 
617
951
  - `storageProviderType` (string) [✗]: The type of the storage provider.
618
952
 
953
+ - `parentJobId` (string) [✗]: ID of parent file-download job (for BullMQ dependency tracking).
954
+
619
955
  - `modelThumbnailUrl` (string) [✗]: The URL of the model thumbnail.
620
956
 
621
957
  - `metamodel` (object) [✗]: The metamodel of the model.
@@ -712,6 +1048,68 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
712
1048
 
713
1049
 
714
1050
 
1051
+ ### model-semantic-analysis-completed
1052
+
1053
+ **Description:** Handles completion of 3D model semantic analysis with generated tags and similarity results.
1054
+
1055
+ **Method:** `client.modelSemanticAnalysisCompleted(data)`
1056
+
1057
+ **Payload Type:** `ModelSemanticAnalysisCompletedMessage`
1058
+
1059
+ **Fields:**
1060
+
1061
+ - `modelId` (string) [✗]: The unique identifier for the model.
1062
+
1063
+ - `userId` (string) [✗]: The user ID who owns the model.
1064
+
1065
+ - `processingStatus` (string) [✗]: Final processing status.
1066
+
1067
+ - `semanticMetadata` (object) [✗]: Generated semantic metadata and analysis results.
1068
+
1069
+ - `processingTime` (object) [✗]: Processing performance metrics.
1070
+
1071
+ - `qualityMetrics` (object) [✗]: Processing quality and confidence metrics.
1072
+
1073
+ - `error` (object) [✗]: Error information if processing failed.
1074
+
1075
+ - `debugInfo` (object) [✗]: Additional debug information for troubleshooting.
1076
+
1077
+
1078
+
1079
+ ### model-semantic-analysis-request
1080
+
1081
+ **Description:** Handles 3D model semantic analysis requests using ULIP-2 neural networks and FAISS vector similarity search.
1082
+
1083
+ **Method:** `client.modelSemanticAnalysisRequest(data)`
1084
+
1085
+ **Payload Type:** `ModelSemanticAnalysisRequestMessage`
1086
+
1087
+ **Fields:**
1088
+
1089
+ - `modelId` (string) [✗]: The unique identifier for the model.
1090
+
1091
+ - `userId` (string) [✗]: The user ID who owns the model.
1092
+
1093
+ - `storageConnectionId` (string) [✗]: The ID of the storage connection.
1094
+
1095
+ - `filePath` (string) [✗]: The path to the 3D model file in storage.
1096
+
1097
+ - `fileName` (string) [✗]: The name of the model file.
1098
+
1099
+ - `fileSize` (number) [✗]: The size of the model file in bytes.
1100
+
1101
+ - `storageProviderType` (string) [✗]: The type of the storage provider (S3, GoogleDrive, SFTP, etc).
1102
+
1103
+ - `processingOptions` (object) [✗]: Configuration options for semantic analysis.
1104
+
1105
+ - `priority` (number) [✗]: Processing priority (1=highest, 10=lowest).
1106
+
1107
+ - `webhookUrl` (string) [✗]: Optional webhook URL for completion notification.
1108
+
1109
+ - `retryCount` (number) [✗]: Current retry attempt number.
1110
+
1111
+
1112
+
715
1113
  ### model-technical-metadata-completed
716
1114
 
717
1115
  **Description:** Reports comprehensive results of technical metadata analysis including geometry, quality metrics, and print-readiness assessment
@@ -814,7 +1212,11 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
814
1212
 
815
1213
  - `ownerId` (string) [✗]: User ID who owns the model
816
1214
 
817
- - `storageLocation` (object) [✗]: Location of the 3D model file
1215
+ - `storageLocation` (object) [✗]: Location of the 3D model file (legacy - used for direct download if minioPath not provided)
1216
+
1217
+ - `minioPath` (string) [✗]: Path to model in MinIO (e.g., 'raw_models/{modelId}/original.glb'). If provided, file will be read from MinIO instead of downloading from storage provider.
1218
+
1219
+ - `parentJobId` (string) [✗]: ID of parent file-download job (for BullMQ dependency tracking).
818
1220
 
819
1221
  - `analysisOptions` (object) [✗]: Optional analysis configuration parameters
820
1222
 
@@ -846,7 +1248,7 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
846
1248
 
847
1249
  ### thumbnail-generation-request
848
1250
 
849
- **Description:** Handles thumbnail generation requests with customization options.
1251
+ **Description:** Handles thumbnail generation requests with customization options. Supports both storage provider downloads and MinIO-cached files.
850
1252
 
851
1253
  **Method:** `client.thumbnailGenerationRequest(data)`
852
1254
 
@@ -858,14 +1260,129 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
858
1260
 
859
1261
  - `ownerId` (string) [✗]: The identifier of the user who owns the entity.
860
1262
 
861
- - `storageLocation` (object) [✗]: The storage location of the model.
1263
+ - `storageLocation` (object) [✗]: The storage location of the model (legacy - used for direct download if minioPath not provided).
1264
+
1265
+ - `minioPath` (string) [✗]: Path to model in MinIO (e.g., 'raw_models/{modelId}/original.glb'). If provided, file will be read from MinIO instead of downloading from storage provider.
862
1266
 
863
1267
  - `previewType` (string) [✗]: The type of preview to generate, e.g., 'default', 'static', 'glb'.
864
1268
 
1269
+ - `generate360Views` (boolean) [✗]: Generate 16 angle views for 360° preview (4 horizontal x 4 vertical angles).
1270
+
1271
+ - `parentJobId` (string) [✗]: ID of parent file-download job (for BullMQ dependency tracking).
1272
+
865
1273
  - `customization` (object) [✗]: User-defined customizations for the thumbnail.
866
1274
 
867
1275
 
868
1276
 
1277
+ ### user-engagement-event
1278
+
1279
+ **Description:** User engagement and onboarding tracking events for analytics and behavioral insights.
1280
+
1281
+ Captures key user actions throughout their journey:
1282
+ - Account creation and onboarding steps
1283
+ - Feature usage and adoption
1284
+ - Model management activities
1285
+ - Marketplace interactions
1286
+ - Subscription changes
1287
+
1288
+ Used for:
1289
+ - User onboarding funnel analysis
1290
+ - Feature adoption tracking
1291
+ - User retention metrics
1292
+ - A/B testing and experimentation
1293
+ - Personalization and recommendations
1294
+ - Product analytics dashboards
1295
+
1296
+
1297
+ **Method:** `client.userEngagementEvent(data)`
1298
+
1299
+ **Payload Type:** `UserEngagementEventMessage`
1300
+
1301
+ **Fields:**
1302
+
1303
+ - `eventType` (string) [✓]: Category of user engagement event
1304
+
1305
+ - `action` (string) [✓]: Specific user action performed
1306
+
1307
+ - `timestamp` (string) [✓]: ISO 8601 timestamp when the action occurred
1308
+
1309
+ - `userId` (string) [✓]: Unique identifier of the user
1310
+
1311
+ - `userEmail` (string) [✗]: User's email (hashed for privacy in analytics)
1312
+
1313
+ - `userCreatedAt` (string) [✗]: When the user account was created (for cohort analysis)
1314
+
1315
+ - `userPlanTier` (string) [✗]: Current subscription plan tier
1316
+
1317
+ - `sessionId` (string) [✗]: User session identifier for grouping actions
1318
+
1319
+ - `requestId` (string) [✗]: Request ID for correlation with logs
1320
+
1321
+ - `actionDetails` (object) [✗]: Additional context about the action
1322
+
1323
+ - `source` (string) [✗]: Where the action originated
1324
+
1325
+ - `httpMethod` (string) [✗]: HTTP method used
1326
+
1327
+ - `httpUrl` (string) [✗]: API endpoint path
1328
+
1329
+ - `httpStatusCode` (integer) [✗]: HTTP response status code
1330
+
1331
+ - `durationMs` (number) [✗]: Action duration in milliseconds
1332
+
1333
+ - `experimentId` (string) [✗]: A/B test or experiment ID
1334
+
1335
+ - `experimentVariant` (string) [✗]: Experiment variant/group
1336
+
1337
+ - `environment` (string) [✗]: Deployment environment
1338
+
1339
+ - `clientInfo` (object) [✗]: Client/browser information (anonymized)
1340
+
1341
+
1342
+
1343
+ ### worker-analytics-event
1344
+
1345
+ **Description:** Analytics event emitted by workers for tracking processing metrics, user behavior,
1346
+ and model statistics. Consumed by worker-analytic-collector and forwarded to ELK.
1347
+
1348
+ All workers MUST emit this event upon job completion (success or failure).
1349
+ Each worker includes its specific metrics in the `metrics` object.
1350
+
1351
+
1352
+ **Method:** `client.workerAnalyticsEvent(data)`
1353
+
1354
+ **Payload Type:** `WorkerAnalyticsEventMessage`
1355
+
1356
+ **Fields:**
1357
+
1358
+ - `eventType` (string) [✓]: Type of analytics event
1359
+
1360
+ - `workerId` (string) [✓]: Identifier of the worker that processed the job
1361
+
1362
+ - `jobId` (string) [✓]: Unique job identifier from BullMQ
1363
+
1364
+ - `timestamp` (string) [✓]: ISO 8601 timestamp of event emission
1365
+
1366
+ - `userId` (string) [✗]: User who owns the model/triggered the job
1367
+
1368
+ - `modelId` (string) [✗]: Model identifier (if applicable)
1369
+
1370
+ - `metamodelId` (string) [✗]: Metamodel identifier (if applicable)
1371
+
1372
+ - `storageItemId` (string) [✗]: Storage item identifier (for download events)
1373
+
1374
+ - `status` (string) [✗]: Job completion status
1375
+
1376
+ - `errorCode` (string) [✗]: Error code if status is failure
1377
+
1378
+ - `errorMessage` (string) [✗]: Error message if status is failure
1379
+
1380
+ - `timing` (object) [✗]: Processing time metrics in milliseconds
1381
+
1382
+ - `metrics` (object) [✗]: Worker-specific metrics. Structure varies by eventType.
1383
+
1384
+
1385
+
869
1386
  ## Configuration
870
1387
 
871
1388
  ### Environment Variables
@@ -904,6 +1421,24 @@ new WorkerClient(config: WorkerClientConfig)
904
1421
  - Get the current status of a job
905
1422
 
906
1423
 
1424
+ - `backendLoggingEvent(data: BackendLoggingEventMessage): Promise<JobResponse>`
1425
+ - Centralized logging event for capturing all warn/error/failure logs from meshsync-backend.
1426
+ This event is sent to ELK for centralized monitoring, alerting, and debugging.
1427
+
1428
+ Automatically emitted by the custom Pino logger interceptor when:
1429
+ - logger.warn() is called
1430
+ - logger.error() is called
1431
+ - uncaught exceptions occur
1432
+ - request failures happen (4xx, 5xx responses)
1433
+
1434
+ Used for:
1435
+ - System health monitoring
1436
+ - Error tracking and alerting
1437
+ - Performance degradation detection
1438
+ - Security incident tracking
1439
+ - Compliance and audit trails
1440
+
1441
+
907
1442
  - `etsyAnalyticsSyncCompleted(data: EtsyAnalyticsSyncCompletedMessage): Promise<JobResponse>`
908
1443
  - Contains synced analytics data for Etsy listings. Backend stores this in etsy_analytics_snapshots table and indexes to ELK.
909
1444
 
@@ -927,7 +1462,7 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
927
1462
  - Notifies that a file download has been processed, indicating success or failure.
928
1463
 
929
1464
  - `fileDownloadRequest(data: FileDownloadRequestMessage): Promise<JobResponse>`
930
- - Handles file download requests.
1465
+ - Downloads model file from storage provider to MinIO for processing pipeline. Acts as parent job for thumbnail generation, technical metadata analysis, and metadata generation.
931
1466
 
932
1467
  - `marketplaceAnalyticsSyncCompleted(data: MarketplaceAnalyticsSyncCompletedMessage): Promise<JobResponse>`
933
1468
  - Contains synced analytics data for marketplace listings. Backend stores this in marketplace_analytics_snapshots table and indexes to ELK. Works with any marketplace provider.
@@ -935,6 +1470,32 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
935
1470
  - `marketplaceAnalyticsSyncRequest(data: MarketplaceAnalyticsSyncRequestMessage): Promise<JobResponse>`
936
1471
  - Syncs analytics data from marketplace API for one or more listings. Fetches views, favorites, sales, revenue, and traffic source data. Can sync: specific listings, all user listings, or shop-level analytics. Works with any marketplace provider that supports analytics (etsy, ebay, etc.).
937
1472
 
1473
+ - `marketplaceConnectionSyncCompleted(data: MarketplaceConnectionSyncCompletedMessage): Promise<JobResponse>`
1474
+ - Notification that marketplace connection sync has completed. Contains updated connection metadata, profile information, and sync statistics.
1475
+
1476
+
1477
+ - `marketplaceConnectionSyncRequest(data: MarketplaceConnectionSyncRequestMessage): Promise<JobResponse>`
1478
+ - Requests synchronization of marketplace connection data including: - Profile information and shop details - Account status and permissions - Available categories and shipping profiles - Rate limits and API quotas
1479
+ This is typically triggered after initial connection or periodically to keep marketplace metadata up to date.
1480
+
1481
+
1482
+ - `marketplaceCredentialRotationCompleted(data: MarketplaceCredentialRotationCompletedMessage): Promise<JobResponse>`
1483
+ - Notification that marketplace credential rotation has completed. Contains the rotation results, new credential metadata, and any issues encountered.
1484
+
1485
+
1486
+ - `marketplaceCredentialRotationRequest(data: MarketplaceCredentialRotationRequestMessage): Promise<JobResponse>`
1487
+ - Requests rotation/refresh of marketplace connection credentials. This is used for: - OAuth token refresh when tokens are near expiry - API key rotation for enhanced security - Re-authentication after connection errors - Scheduled credential updates
1488
+
1489
+
1490
+ - `marketplaceListingSyncCompleted(data: MarketplaceListingSyncCompletedMessage): Promise<JobResponse>`
1491
+ - Notification that marketplace listing sync operation has completed. Contains detailed results of the sync including created/updated listings, errors encountered, and performance statistics.
1492
+
1493
+
1494
+ - `marketplaceListingSyncRequest(data: MarketplaceListingSyncRequestMessage): Promise<JobResponse>`
1495
+ - Requests synchronization of marketplace listings for a connection. Can sync specific listings or all listings for a marketplace connection.
1496
+ Includes bidirectional sync: - Pull: Fetch listings from marketplace to update local database - Push: Update marketplace listings with local changes - Full: Both pull and push operations
1497
+
1498
+
938
1499
  - `marketplacePublishListingCompleted(data: MarketplacePublishListingCompletedMessage): Promise<JobResponse>`
939
1500
  - Indicates completion of marketplace listing publication. Contains external listing ID and URL, or error details if failed. Works with any marketplace provider (etsy, ebay, etc.).
940
1501
 
@@ -954,6 +1515,14 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
954
1515
  - `metamodelMetadataGenerationRequest(data: MetamodelMetadataGenerationRequestMessage): Promise<JobResponse>`
955
1516
  - Handles metamodel metadata generation requests via Ollama. Aggregates data from constituent models and generates AI-enhanced metadata.
956
1517
 
1518
+ - `modelAnalyticsCollectionRequest(data: ModelAnalyticsCollectionRequestMessage): Promise<JobResponse>`
1519
+ - Request to collect marketplace analytics for a specific metamodel.
1520
+ Triggered by backend scheduler every 6 hours for popular/tagged metamodels.
1521
+
1522
+ Worker performs targeted market searches based on metamodel metadata
1523
+ and stores aggregated statistics in Elasticsearch for trend analysis.
1524
+
1525
+
957
1526
  - `modelDiscoveryFolderProcessedEvent(data: ModelDiscoveryFolderProcessedEventMessage): Promise<JobResponse>`
958
1527
  - Handles model discovery folder processed events.
959
1528
 
@@ -970,7 +1539,7 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
970
1539
  - Handles model metadata generation completed.
971
1540
 
972
1541
  - `modelMetadataGenerationRequest(data: ModelMetadataGenerationRequestMessage): Promise<JobResponse>`
973
- - Handles model metadata generation requests.
1542
+ - Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
974
1543
 
975
1544
  - `modelMetamodelDetectionFound(data: ModelMetamodelDetectionFoundMessage): Promise<JobResponse>`
976
1545
  - Handles model metamodel detection found with hierarchical relationships.
@@ -984,6 +1553,12 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
984
1553
  - `modelSellabilityAnalysisRequest(data: ModelSellabilityAnalysisRequestMessage): Promise<JobResponse>`
985
1554
  - Analyzes a metamodel to determine sellability score, pricing recommendations, and optimal marketplace selection. Enhanced with Etsy-specific analysis including competitor pricing, category demand trends, and material suitability.
986
1555
 
1556
+ - `modelSemanticAnalysisCompleted(data: ModelSemanticAnalysisCompletedMessage): Promise<JobResponse>`
1557
+ - Handles completion of 3D model semantic analysis with generated tags and similarity results.
1558
+
1559
+ - `modelSemanticAnalysisRequest(data: ModelSemanticAnalysisRequestMessage): Promise<JobResponse>`
1560
+ - Handles 3D model semantic analysis requests using ULIP-2 neural networks and FAISS vector similarity search.
1561
+
987
1562
  - `modelTechnicalMetadataCompleted(data: ModelTechnicalMetadataCompletedMessage): Promise<JobResponse>`
988
1563
  - Reports comprehensive results of technical metadata analysis including geometry, quality metrics, and print-readiness assessment
989
1564
 
@@ -994,7 +1569,34 @@ Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.
994
1569
  - Handles thumbnail generation completed.
995
1570
 
996
1571
  - `thumbnailGenerationRequest(data: ThumbnailGenerationRequestMessage): Promise<JobResponse>`
997
- - Handles thumbnail generation requests with customization options.
1572
+ - Handles thumbnail generation requests with customization options. Supports both storage provider downloads and MinIO-cached files.
1573
+
1574
+ - `userEngagementEvent(data: UserEngagementEventMessage): Promise<JobResponse>`
1575
+ - User engagement and onboarding tracking events for analytics and behavioral insights.
1576
+
1577
+ Captures key user actions throughout their journey:
1578
+ - Account creation and onboarding steps
1579
+ - Feature usage and adoption
1580
+ - Model management activities
1581
+ - Marketplace interactions
1582
+ - Subscription changes
1583
+
1584
+ Used for:
1585
+ - User onboarding funnel analysis
1586
+ - Feature adoption tracking
1587
+ - User retention metrics
1588
+ - A/B testing and experimentation
1589
+ - Personalization and recommendations
1590
+ - Product analytics dashboards
1591
+
1592
+
1593
+ - `workerAnalyticsEvent(data: WorkerAnalyticsEventMessage): Promise<JobResponse>`
1594
+ - Analytics event emitted by workers for tracking processing metrics, user behavior,
1595
+ and model statistics. Consumed by worker-analytic-collector and forwarded to ELK.
1596
+
1597
+ All workers MUST emit this event upon job completion (success or failure).
1598
+ Each worker includes its specific metrics in the `metrics` object.
1599
+
998
1600
 
999
1601
 
1000
1602
  ### Response Types