@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/dist/types.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Message type constants
3
3
  */
4
4
  export declare const MessageTypes: {
5
+ readonly BACKEND_LOGGING_EVENT: "backend-logging-event";
5
6
  readonly ETSY_ANALYTICS_SYNC_COMPLETED: "etsy-analytics-sync-completed";
6
7
  readonly ETSY_ANALYTICS_SYNC_REQUEST: "etsy-analytics-sync-request";
7
8
  readonly ETSY_PUBLISH_LISTING_COMPLETED: "etsy-publish-listing-completed";
@@ -10,12 +11,19 @@ export declare const MessageTypes: {
10
11
  readonly FILE_DOWNLOAD_REQUEST: "file-download-request";
11
12
  readonly MARKETPLACE_ANALYTICS_SYNC_COMPLETED: "marketplace-analytics-sync-completed";
12
13
  readonly MARKETPLACE_ANALYTICS_SYNC_REQUEST: "marketplace-analytics-sync-request";
14
+ readonly MARKETPLACE_CONNECTION_SYNC_COMPLETED: "marketplace-connection-sync-completed";
15
+ readonly MARKETPLACE_CONNECTION_SYNC_REQUEST: "marketplace-connection-sync-request";
16
+ readonly MARKETPLACE_CREDENTIAL_ROTATION_COMPLETED: "marketplace-credential-rotation-completed";
17
+ readonly MARKETPLACE_CREDENTIAL_ROTATION_REQUEST: "marketplace-credential-rotation-request";
18
+ readonly MARKETPLACE_LISTING_SYNC_COMPLETED: "marketplace-listing-sync-completed";
19
+ readonly MARKETPLACE_LISTING_SYNC_REQUEST: "marketplace-listing-sync-request";
13
20
  readonly MARKETPLACE_PUBLISH_LISTING_COMPLETED: "marketplace-publish-listing-completed";
14
21
  readonly MARKETPLACE_PUBLISH_LISTING_REQUEST: "marketplace-publish-listing-request";
15
22
  readonly MEDIA_BATCH_DOWNLOAD_COMPLETED: "media-batch-download-completed";
16
23
  readonly MEDIA_BATCH_DOWNLOAD_REQUEST: "media-batch-download-request";
17
24
  readonly METAMODEL_METADATA_GENERATION_COMPLETED: "metamodel-metadata-generation-completed";
18
25
  readonly METAMODEL_METADATA_GENERATION_REQUEST: "metamodel-metadata-generation-request";
26
+ readonly MODEL_ANALYTICS_COLLECTION_REQUEST: "model-analytics-collection-request";
19
27
  readonly MODEL_DISCOVERY_FOLDER_PROCESSED_EVENT: "model-discovery-folder-processed-event";
20
28
  readonly MODEL_DISCOVERY_SCAN_FOUND_EVENT: "model-discovery-scan-found-event";
21
29
  readonly MODEL_DISCOVERY_SCAN_PROGRESS_EVENT: "model-discovery-scan-progress-event";
@@ -26,12 +34,72 @@ export declare const MessageTypes: {
26
34
  readonly MODEL_METAMODEL_DETECTION_REQUEST: "model-metamodel-detection-request";
27
35
  readonly MODEL_SELLABILITY_ANALYSIS_COMPLETED: "model-sellability-analysis-completed";
28
36
  readonly MODEL_SELLABILITY_ANALYSIS_REQUEST: "model-sellability-analysis-request";
37
+ readonly MODEL_SEMANTIC_ANALYSIS_COMPLETED: "model-semantic-analysis-completed";
38
+ readonly MODEL_SEMANTIC_ANALYSIS_REQUEST: "model-semantic-analysis-request";
29
39
  readonly MODEL_TECHNICAL_METADATA_COMPLETED: "model-technical-metadata-completed";
30
40
  readonly MODEL_TECHNICAL_METADATA_REQUEST: "model-technical-metadata-request";
31
41
  readonly THUMBNAIL_GENERATION_COMPLETED: "thumbnail-generation-completed";
32
42
  readonly THUMBNAIL_GENERATION_REQUEST: "thumbnail-generation-request";
43
+ readonly USER_ENGAGEMENT_EVENT: "user-engagement-event";
44
+ readonly WORKER_ANALYTICS_EVENT: "worker-analytics-event";
33
45
  };
34
46
  export type MessageType = typeof MessageTypes[keyof typeof MessageTypes];
47
+ /**
48
+ * Centralized logging event for capturing all warn/error/failure logs from meshsync-backend.
49
+ This event is sent to ELK for centralized monitoring, alerting, and debugging.
50
+
51
+ Automatically emitted by the custom Pino logger interceptor when:
52
+ - logger.warn() is called
53
+ - logger.error() is called
54
+ - uncaught exceptions occur
55
+ - request failures happen (4xx, 5xx responses)
56
+
57
+ Used for:
58
+ - System health monitoring
59
+ - Error tracking and alerting
60
+ - Performance degradation detection
61
+ - Security incident tracking
62
+ - Compliance and audit trails
63
+
64
+ */
65
+ export interface BackendLoggingEventMessage {
66
+ /** Type of logging event */
67
+ eventType: string;
68
+ /** ISO 8601 timestamp when the log was generated */
69
+ timestamp: string;
70
+ /** Log level severity */
71
+ level: string;
72
+ /** Human-readable log message */
73
+ message: string;
74
+ /** Logger context (typically the class/service name) */
75
+ context: string;
76
+ /** Unique request ID for correlation (X-Request-Id header) */
77
+ requestId?: string;
78
+ /** ID of the authenticated user (if available) */
79
+ userId?: string;
80
+ /** HTTP method of the request */
81
+ httpMethod?: string;
82
+ /** Request URL path (without query params for privacy) */
83
+ httpUrl?: string;
84
+ /** HTTP response status code */
85
+ httpStatusCode?: string | number | boolean;
86
+ /** Error class/type name */
87
+ errorType?: string;
88
+ /** Stack trace (sanitized, no sensitive data) */
89
+ errorStack?: string;
90
+ /** Application-specific error code for categorization */
91
+ errorCode?: string;
92
+ /** Additional structured context (sanitized, no PII) */
93
+ metadata?: Record<string, string | number | boolean>;
94
+ /** Deployment environment */
95
+ environment?: string;
96
+ /** Backend service version */
97
+ serviceVersion?: string;
98
+ /** Server hostname/pod name */
99
+ hostname?: string;
100
+ /** Operation duration in milliseconds (if applicable) */
101
+ durationMs?: number;
102
+ }
35
103
  /**
36
104
  * Contains synced analytics data for Etsy listings. Backend stores this in etsy_analytics_snapshots table and indexes to ELK.
37
105
 
@@ -147,13 +215,23 @@ export interface FileDownloadCompletedMessage {
147
215
  downloadedAt?: string;
148
216
  }
149
217
  /**
150
- * Handles file download requests.
218
+ * Downloads model file from storage provider to MinIO for processing pipeline. Acts as parent job for thumbnail generation, technical metadata analysis, and metadata generation.
151
219
  */
152
220
  export interface FileDownloadRequestMessage {
153
221
  /** The unique identifier for the model to be downloaded. */
154
222
  modelId?: string;
223
+ /** The identifier of the user who owns the model. */
224
+ ownerId?: string;
155
225
  /** The storage location of the model. */
156
226
  storageLocation?: Record<string, string | number | boolean>;
227
+ /** Destination in MinIO where file will be uploaded after download. */
228
+ minioDestination?: Record<string, string | number | boolean>;
229
+ /** Automatically enqueue thumbnail generation, technical metadata analysis, and metadata generation jobs after download completes. */
230
+ autoEnqueueChildren?: boolean;
231
+ /** Preview type for thumbnail generation (passed to child job). */
232
+ previewType?: string;
233
+ /** Generate 16 angle views for 360° preview (passed to child job). */
234
+ generate360Views?: boolean;
157
235
  }
158
236
  /**
159
237
  * Contains synced analytics data for marketplace listings. Backend stores this in marketplace_analytics_snapshots table and indexes to ELK. Works with any marketplace provider.
@@ -201,6 +279,184 @@ export interface MarketplaceAnalyticsSyncRequestMessage {
201
279
  /** Callback URL for completion notification */
202
280
  webhookUrl?: string;
203
281
  }
282
+ /**
283
+ * Notification that marketplace connection sync has completed. Contains updated connection metadata, profile information, and sync statistics.
284
+
285
+ */
286
+ export interface MarketplaceConnectionSyncCompletedMessage {
287
+ /** Original request ID for correlation */
288
+ requestId?: string;
289
+ /** Marketplace connection that was synced */
290
+ connectionId?: string;
291
+ /** Marketplace provider ID */
292
+ marketplaceId?: string;
293
+ /** Connection owner user ID */
294
+ userId?: string;
295
+ /** Overall sync result status */
296
+ status?: string;
297
+ /** Type of sync that was performed */
298
+ syncType?: string;
299
+ /** Updated connection information */
300
+ connectionData?: Record<string, string | number | boolean>;
301
+ /** Available marketplace categories */
302
+ categories?: Array<Record<string, string | number | boolean>>;
303
+ /** Sync operation statistics */
304
+ statistics?: Record<string, string | number | boolean>;
305
+ /** When sync completed */
306
+ completedAt?: string;
307
+ /** Error details if sync failed */
308
+ error?: Record<string, string | number | boolean>;
309
+ }
310
+ /**
311
+ * 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
312
+ This is typically triggered after initial connection or periodically to keep marketplace metadata up to date.
313
+
314
+ */
315
+ export interface MarketplaceConnectionSyncRequestMessage {
316
+ /** Internal marketplace connection ID */
317
+ connectionId?: string;
318
+ /** Marketplace provider ID (etsy, ebay, etc.) */
319
+ marketplaceId?: string;
320
+ /** User who owns this connection */
321
+ userId?: string;
322
+ /** Type of sync to perform */
323
+ syncType?: string;
324
+ /** Processing priority */
325
+ priority?: string;
326
+ /** Unique request identifier for tracking */
327
+ requestId?: string;
328
+ /** Webhook URL to call when sync completes */
329
+ webhookUrl?: string;
330
+ /** Additional context data */
331
+ metadata?: Record<string, string | number | boolean>;
332
+ }
333
+ /**
334
+ * Notification that marketplace credential rotation has completed. Contains the rotation results, new credential metadata, and any issues encountered.
335
+
336
+ */
337
+ export interface MarketplaceCredentialRotationCompletedMessage {
338
+ /** Original rotation request ID */
339
+ requestId?: string;
340
+ /** Marketplace connection that was rotated */
341
+ connectionId?: string;
342
+ /** Marketplace provider ID */
343
+ marketplaceId?: string;
344
+ /** Connection owner user ID */
345
+ userId?: string;
346
+ /** Overall rotation operation status */
347
+ status?: string;
348
+ /** Type of rotation that was performed */
349
+ rotationType?: string;
350
+ /** Original reason for rotation */
351
+ reason?: string;
352
+ /** Metadata about new credentials */
353
+ newCredentials?: Record<string, string | number | boolean>;
354
+ /** Status of previous credentials */
355
+ oldCredentials?: Record<string, string | number | boolean>;
356
+ /** Details of the rotation operation */
357
+ operationDetails?: Record<string, string | number | boolean>;
358
+ /** Connection status after credential rotation */
359
+ connectionStatus?: Record<string, string | number | boolean>;
360
+ /** Information about next scheduled rotation */
361
+ nextRotation?: Record<string, string | number | boolean>;
362
+ /** Error details if rotation failed */
363
+ error?: Record<string, string | number | boolean>;
364
+ /** Notifications sent as part of rotation */
365
+ notifications?: Array<Record<string, string | number | boolean>>;
366
+ }
367
+ /**
368
+ * 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
369
+
370
+ */
371
+ export interface MarketplaceCredentialRotationRequestMessage {
372
+ /** Marketplace connection ID requiring credential rotation */
373
+ connectionId?: string;
374
+ /** Marketplace provider ID (etsy, ebay, etc.) */
375
+ marketplaceId?: string;
376
+ /** User who owns the connection */
377
+ userId?: string;
378
+ /** Type of credential rotation to perform */
379
+ rotationType?: string;
380
+ /** Reason for credential rotation */
381
+ reason?: string;
382
+ /** How urgently the rotation is needed */
383
+ urgency?: string;
384
+ /** Current credential metadata (no actual secrets) */
385
+ currentCredentials?: Record<string, string | number | boolean>;
386
+ /** Rotation configuration options */
387
+ options?: Record<string, string | number | boolean>;
388
+ /** Unique request identifier */
389
+ requestId?: string;
390
+ /** Webhook URL for completion notification */
391
+ webhookUrl?: string;
392
+ /** When this rotation was scheduled (if scheduled) */
393
+ scheduledAt?: string;
394
+ /** Additional request context */
395
+ metadata?: Record<string, string | number | boolean>;
396
+ }
397
+ /**
398
+ * Notification that marketplace listing sync operation has completed. Contains detailed results of the sync including created/updated listings, errors encountered, and performance statistics.
399
+
400
+ */
401
+ export interface MarketplaceListingSyncCompletedMessage {
402
+ /** Original request ID for correlation */
403
+ requestId?: string;
404
+ /** Marketplace connection that was synced */
405
+ connectionId?: string;
406
+ /** Marketplace provider ID */
407
+ marketplaceId?: string;
408
+ /** Connection owner user ID */
409
+ userId?: string;
410
+ /** Overall sync operation status */
411
+ status?: string;
412
+ /** Direction of sync that was performed */
413
+ syncDirection?: string;
414
+ /** Detailed sync operation statistics */
415
+ statistics?: Record<string, string | number | boolean>;
416
+ /** Detailed sync results by operation */
417
+ results?: Record<string, string | number | boolean>;
418
+ /** Details of successfully processed listings */
419
+ successfulListings?: Array<Record<string, string | number | boolean>>;
420
+ /** Details of listings that failed to sync */
421
+ failedListings?: Array<Record<string, string | number | boolean>>;
422
+ /** Non-listing-specific errors encountered */
423
+ errors?: Array<Record<string, string | number | boolean>>;
424
+ /** When sync operation completed */
425
+ completedAt?: string;
426
+ /** When next sync is recommended */
427
+ nextSyncRecommendedAt?: string;
428
+ }
429
+ /**
430
+ * Requests synchronization of marketplace listings for a connection. Can sync specific listings or all listings for a marketplace connection.
431
+ 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
432
+
433
+ */
434
+ export interface MarketplaceListingSyncRequestMessage {
435
+ /** Marketplace connection ID */
436
+ connectionId?: string;
437
+ /** Marketplace provider ID (etsy, ebay, etc.) */
438
+ marketplaceId?: string;
439
+ /** User who owns the connection */
440
+ userId?: string;
441
+ /** Direction of sync operation */
442
+ syncDirection?: string;
443
+ /** Scope of listings to sync */
444
+ syncScope?: string;
445
+ /** Specific listing IDs to sync (if syncScope=specific) */
446
+ listingIds?: Array<Record<string, string | number | boolean>>;
447
+ /** External marketplace listing IDs to sync */
448
+ externalListingIds?: Array<Record<string, string | number | boolean>>;
449
+ /** Sync configuration options */
450
+ options?: Record<string, string | number | boolean>;
451
+ /** Processing priority */
452
+ priority?: string;
453
+ /** Unique request identifier */
454
+ requestId?: string;
455
+ /** Webhook URL for completion notification */
456
+ webhookUrl?: string;
457
+ /** Additional request context */
458
+ metadata?: Record<string, string | number | boolean>;
459
+ }
204
460
  /**
205
461
  * 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.).
206
462
  */
@@ -322,6 +578,36 @@ export interface MetamodelMetadataGenerationRequestMessage {
322
578
  /** Optional webhook URL for async completion notification */
323
579
  webhookUrl?: string;
324
580
  }
581
+ /**
582
+ * Request to collect marketplace analytics for a specific metamodel.
583
+ Triggered by backend scheduler every 6 hours for popular/tagged metamodels.
584
+
585
+ Worker performs targeted market searches based on metamodel metadata
586
+ and stores aggregated statistics in Elasticsearch for trend analysis.
587
+
588
+ */
589
+ export interface ModelAnalyticsCollectionRequestMessage {
590
+ /** The metamodel ID to collect analytics for */
591
+ metamodelId: string;
592
+ /** Owner user ID for audit trail */
593
+ ownerId: string;
594
+ /** Primary classification category (e.g., "miniature", "terrain") */
595
+ primaryCategory?: string;
596
+ /** Sub-category for more specific targeting */
597
+ subCategory?: string;
598
+ /** Relevant tags from metamodel metadata (max 10) */
599
+ tags?: Array<Record<string, string | number | boolean>>;
600
+ /** Franchise name if detected (e.g., "Dungeons & Dragons") */
601
+ franchise?: string;
602
+ /** Classification confidence score */
603
+ confidence?: number;
604
+ /** Collection priority level */
605
+ priority?: string;
606
+ /** Source of trigger (e.g., "backend-scheduler", "manual") */
607
+ triggeredBy?: string;
608
+ /** Timestamp when collection was triggered */
609
+ triggeredAt?: string;
610
+ }
325
611
  /**
326
612
  * Handles model discovery folder processed events.
327
613
  */
@@ -392,15 +678,19 @@ export interface ModelMetadataGenerationCompletedMessage {
392
678
  metadata: Record<string, string | number | boolean>;
393
679
  }
394
680
  /**
395
- * Handles model metadata generation requests.
681
+ * Handles model metadata generation requests. Supports both storage provider downloads and MinIO-cached files.
396
682
  */
397
683
  export interface ModelMetadataGenerationRequestMessage {
398
684
  /** The unique identifier for the model. */
399
685
  modelId?: string;
400
- /** The ID of the storage connection. */
686
+ /** The identifier of the user who owns the model. */
687
+ ownerId?: string;
688
+ /** The ID of the storage connection (legacy - used if minioPath not provided). */
401
689
  storageConnectionId?: string;
402
- /** The path to the model file. */
690
+ /** The path to the model file (legacy - used if minioPath not provided). */
403
691
  filePath?: string;
692
+ /** 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. */
693
+ minioPath?: string;
404
694
  /** The name of the model file. */
405
695
  fileName?: string;
406
696
  /** The size of the model file in bytes. */
@@ -409,6 +699,8 @@ export interface ModelMetadataGenerationRequestMessage {
409
699
  fileLastModified?: string;
410
700
  /** The type of the storage provider. */
411
701
  storageProviderType?: string;
702
+ /** ID of parent file-download job (for BullMQ dependency tracking). */
703
+ parentJobId?: string;
412
704
  /** The URL of the model thumbnail. */
413
705
  modelThumbnailUrl?: string;
414
706
  /** The metamodel of the model. */
@@ -476,6 +768,54 @@ export interface ModelSellabilityAnalysisRequestMessage {
476
768
  /** Optional analysis configuration */
477
769
  analysisOptions?: Record<string, string | number | boolean>;
478
770
  }
771
+ /**
772
+ * Handles completion of 3D model semantic analysis with generated tags and similarity results.
773
+ */
774
+ export interface ModelSemanticAnalysisCompletedMessage {
775
+ /** The unique identifier for the model. */
776
+ modelId?: string;
777
+ /** The user ID who owns the model. */
778
+ userId?: string;
779
+ /** Final processing status. */
780
+ processingStatus?: string;
781
+ /** Generated semantic metadata and analysis results. */
782
+ semanticMetadata?: Record<string, string | number | boolean>;
783
+ /** Processing performance metrics. */
784
+ processingTime?: Record<string, string | number | boolean>;
785
+ /** Processing quality and confidence metrics. */
786
+ qualityMetrics?: Record<string, string | number | boolean>;
787
+ /** Error information if processing failed. */
788
+ error?: Record<string, string | number | boolean>;
789
+ /** Additional debug information for troubleshooting. */
790
+ debugInfo?: Record<string, string | number | boolean>;
791
+ }
792
+ /**
793
+ * Handles 3D model semantic analysis requests using ULIP-2 neural networks and FAISS vector similarity search.
794
+ */
795
+ export interface ModelSemanticAnalysisRequestMessage {
796
+ /** The unique identifier for the model. */
797
+ modelId?: string;
798
+ /** The user ID who owns the model. */
799
+ userId?: string;
800
+ /** The ID of the storage connection. */
801
+ storageConnectionId?: string;
802
+ /** The path to the 3D model file in storage. */
803
+ filePath?: string;
804
+ /** The name of the model file. */
805
+ fileName?: string;
806
+ /** The size of the model file in bytes. */
807
+ fileSize?: number;
808
+ /** The type of the storage provider (S3, GoogleDrive, SFTP, etc). */
809
+ storageProviderType?: string;
810
+ /** Configuration options for semantic analysis. */
811
+ processingOptions?: Record<string, string | number | boolean>;
812
+ /** Processing priority (1=highest, 10=lowest). */
813
+ priority?: number;
814
+ /** Optional webhook URL for completion notification. */
815
+ webhookUrl?: string;
816
+ /** Current retry attempt number. */
817
+ retryCount?: number;
818
+ }
479
819
  /**
480
820
  * Reports comprehensive results of technical metadata analysis including geometry, quality metrics, and print-readiness assessment
481
821
  */
@@ -565,8 +905,12 @@ export interface ModelTechnicalMetadataRequestMessage {
565
905
  modelId?: string;
566
906
  /** User ID who owns the model */
567
907
  ownerId?: string;
568
- /** Location of the 3D model file */
908
+ /** Location of the 3D model file (legacy - used for direct download if minioPath not provided) */
569
909
  storageLocation?: Record<string, string | number | boolean>;
910
+ /** 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. */
911
+ minioPath?: string;
912
+ /** ID of parent file-download job (for BullMQ dependency tracking). */
913
+ parentJobId?: string;
570
914
  /** Optional analysis configuration parameters */
571
915
  analysisOptions?: Record<string, string | number | boolean>;
572
916
  }
@@ -588,17 +932,118 @@ export interface ThumbnailGenerationCompletedMessage {
588
932
  storageLocation?: Record<string, string | number | boolean>;
589
933
  }
590
934
  /**
591
- * Handles thumbnail generation requests with customization options.
935
+ * Handles thumbnail generation requests with customization options. Supports both storage provider downloads and MinIO-cached files.
592
936
  */
593
937
  export interface ThumbnailGenerationRequestMessage {
594
938
  /** The unique identifier for the model requiring a thumbnail. */
595
939
  modelId?: string;
596
940
  /** The identifier of the user who owns the entity. */
597
941
  ownerId?: string;
598
- /** The storage location of the model. */
942
+ /** The storage location of the model (legacy - used for direct download if minioPath not provided). */
599
943
  storageLocation?: Record<string, string | number | boolean>;
944
+ /** 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. */
945
+ minioPath?: string;
600
946
  /** The type of preview to generate, e.g., 'default', 'static', 'glb'. */
601
947
  previewType?: string;
948
+ /** Generate 16 angle views for 360° preview (4 horizontal x 4 vertical angles). */
949
+ generate360Views?: boolean;
950
+ /** ID of parent file-download job (for BullMQ dependency tracking). */
951
+ parentJobId?: string;
602
952
  /** User-defined customizations for the thumbnail. */
603
953
  customization?: Record<string, string | number | boolean>;
604
954
  }
955
+ /**
956
+ * User engagement and onboarding tracking events for analytics and behavioral insights.
957
+
958
+ Captures key user actions throughout their journey:
959
+ - Account creation and onboarding steps
960
+ - Feature usage and adoption
961
+ - Model management activities
962
+ - Marketplace interactions
963
+ - Subscription changes
964
+
965
+ Used for:
966
+ - User onboarding funnel analysis
967
+ - Feature adoption tracking
968
+ - User retention metrics
969
+ - A/B testing and experimentation
970
+ - Personalization and recommendations
971
+ - Product analytics dashboards
972
+
973
+ */
974
+ export interface UserEngagementEventMessage {
975
+ /** Category of user engagement event */
976
+ eventType: string;
977
+ /** Specific user action performed */
978
+ action: string;
979
+ /** ISO 8601 timestamp when the action occurred */
980
+ timestamp: string;
981
+ /** Unique identifier of the user */
982
+ userId: string;
983
+ /** User's email (hashed for privacy in analytics) */
984
+ userEmail?: string;
985
+ /** When the user account was created (for cohort analysis) */
986
+ userCreatedAt?: string;
987
+ /** Current subscription plan tier */
988
+ userPlanTier?: string;
989
+ /** User session identifier for grouping actions */
990
+ sessionId?: string;
991
+ /** Request ID for correlation with logs */
992
+ requestId?: string;
993
+ /** Additional context about the action */
994
+ actionDetails?: Record<string, string | number | boolean>;
995
+ /** Where the action originated */
996
+ source?: string;
997
+ /** HTTP method used */
998
+ httpMethod?: string;
999
+ /** API endpoint path */
1000
+ httpUrl?: string;
1001
+ /** HTTP response status code */
1002
+ httpStatusCode?: string | number | boolean;
1003
+ /** Action duration in milliseconds */
1004
+ durationMs?: number;
1005
+ /** A/B test or experiment ID */
1006
+ experimentId?: string;
1007
+ /** Experiment variant/group */
1008
+ experimentVariant?: string;
1009
+ /** Deployment environment */
1010
+ environment?: string;
1011
+ /** Client/browser information (anonymized) */
1012
+ clientInfo?: Record<string, string | number | boolean>;
1013
+ }
1014
+ /**
1015
+ * Analytics event emitted by workers for tracking processing metrics, user behavior,
1016
+ and model statistics. Consumed by worker-analytic-collector and forwarded to ELK.
1017
+
1018
+ All workers MUST emit this event upon job completion (success or failure).
1019
+ Each worker includes its specific metrics in the `metrics` object.
1020
+
1021
+ */
1022
+ export interface WorkerAnalyticsEventMessage {
1023
+ /** Type of analytics event */
1024
+ eventType: string;
1025
+ /** Identifier of the worker that processed the job */
1026
+ workerId: string;
1027
+ /** Unique job identifier from BullMQ */
1028
+ jobId: string;
1029
+ /** ISO 8601 timestamp of event emission */
1030
+ timestamp: string;
1031
+ /** User who owns the model/triggered the job */
1032
+ userId?: string;
1033
+ /** Model identifier (if applicable) */
1034
+ modelId?: string;
1035
+ /** Metamodel identifier (if applicable) */
1036
+ metamodelId?: string;
1037
+ /** Storage item identifier (for download events) */
1038
+ storageItemId?: string;
1039
+ /** Job completion status */
1040
+ status?: string;
1041
+ /** Error code if status is failure */
1042
+ errorCode?: string;
1043
+ /** Error message if status is failure */
1044
+ errorMessage?: string;
1045
+ /** Processing time metrics in milliseconds */
1046
+ timing?: Record<string, string | number | boolean>;
1047
+ /** Worker-specific metrics. Structure varies by eventType. */
1048
+ metrics?: Record<string, string | number | boolean>;
1049
+ }
package/dist/types.js CHANGED
@@ -3,6 +3,7 @@
3
3
  * Message type constants
4
4
  */
5
5
  export const MessageTypes = {
6
+ BACKEND_LOGGING_EVENT: 'backend-logging-event',
6
7
  ETSY_ANALYTICS_SYNC_COMPLETED: 'etsy-analytics-sync-completed',
7
8
  ETSY_ANALYTICS_SYNC_REQUEST: 'etsy-analytics-sync-request',
8
9
  ETSY_PUBLISH_LISTING_COMPLETED: 'etsy-publish-listing-completed',
@@ -11,12 +12,19 @@ export const MessageTypes = {
11
12
  FILE_DOWNLOAD_REQUEST: 'file-download-request',
12
13
  MARKETPLACE_ANALYTICS_SYNC_COMPLETED: 'marketplace-analytics-sync-completed',
13
14
  MARKETPLACE_ANALYTICS_SYNC_REQUEST: 'marketplace-analytics-sync-request',
15
+ MARKETPLACE_CONNECTION_SYNC_COMPLETED: 'marketplace-connection-sync-completed',
16
+ MARKETPLACE_CONNECTION_SYNC_REQUEST: 'marketplace-connection-sync-request',
17
+ MARKETPLACE_CREDENTIAL_ROTATION_COMPLETED: 'marketplace-credential-rotation-completed',
18
+ MARKETPLACE_CREDENTIAL_ROTATION_REQUEST: 'marketplace-credential-rotation-request',
19
+ MARKETPLACE_LISTING_SYNC_COMPLETED: 'marketplace-listing-sync-completed',
20
+ MARKETPLACE_LISTING_SYNC_REQUEST: 'marketplace-listing-sync-request',
14
21
  MARKETPLACE_PUBLISH_LISTING_COMPLETED: 'marketplace-publish-listing-completed',
15
22
  MARKETPLACE_PUBLISH_LISTING_REQUEST: 'marketplace-publish-listing-request',
16
23
  MEDIA_BATCH_DOWNLOAD_COMPLETED: 'media-batch-download-completed',
17
24
  MEDIA_BATCH_DOWNLOAD_REQUEST: 'media-batch-download-request',
18
25
  METAMODEL_METADATA_GENERATION_COMPLETED: 'metamodel-metadata-generation-completed',
19
26
  METAMODEL_METADATA_GENERATION_REQUEST: 'metamodel-metadata-generation-request',
27
+ MODEL_ANALYTICS_COLLECTION_REQUEST: 'model-analytics-collection-request',
20
28
  MODEL_DISCOVERY_FOLDER_PROCESSED_EVENT: 'model-discovery-folder-processed-event',
21
29
  MODEL_DISCOVERY_SCAN_FOUND_EVENT: 'model-discovery-scan-found-event',
22
30
  MODEL_DISCOVERY_SCAN_PROGRESS_EVENT: 'model-discovery-scan-progress-event',
@@ -27,8 +35,12 @@ export const MessageTypes = {
27
35
  MODEL_METAMODEL_DETECTION_REQUEST: 'model-metamodel-detection-request',
28
36
  MODEL_SELLABILITY_ANALYSIS_COMPLETED: 'model-sellability-analysis-completed',
29
37
  MODEL_SELLABILITY_ANALYSIS_REQUEST: 'model-sellability-analysis-request',
38
+ MODEL_SEMANTIC_ANALYSIS_COMPLETED: 'model-semantic-analysis-completed',
39
+ MODEL_SEMANTIC_ANALYSIS_REQUEST: 'model-semantic-analysis-request',
30
40
  MODEL_TECHNICAL_METADATA_COMPLETED: 'model-technical-metadata-completed',
31
41
  MODEL_TECHNICAL_METADATA_REQUEST: 'model-technical-metadata-request',
32
42
  THUMBNAIL_GENERATION_COMPLETED: 'thumbnail-generation-completed',
33
43
  THUMBNAIL_GENERATION_REQUEST: 'thumbnail-generation-request',
44
+ USER_ENGAGEMENT_EVENT: 'user-engagement-event',
45
+ WORKER_ANALYTICS_EVENT: 'worker-analytics-event',
34
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mesh-sync/worker-backend-client",
3
- "version": "1.0.6",
3
+ "version": "4.0.2",
4
4
  "description": "Auto-generated TypeScript client for worker-backend - provides type-safe methods for enqueueing jobs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",