@noatgnu/cupcake-core 1.2.9 → 1.2.11

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/index.d.ts CHANGED
@@ -352,6 +352,25 @@ interface LabGroupPermissionQueryResponse {
352
352
  results: LabGroupPermission[];
353
353
  }
354
354
 
355
+ declare enum AnnotationType {
356
+ Text = "text",
357
+ File = "file",
358
+ Image = "image",
359
+ Video = "video",
360
+ Audio = "audio",
361
+ Sketch = "sketch",
362
+ Other = "other",
363
+ Checklist = "checklist",
364
+ Counter = "counter",
365
+ Table = "table",
366
+ Alignment = "alignment",
367
+ Calculator = "calculator",
368
+ MolarityCalculator = "mcalculator",
369
+ Randomization = "randomization",
370
+ Instrument = "instrument",
371
+ Metadata = "metadata",
372
+ Booking = "booking"
373
+ }
355
374
  interface AnnotationFolder extends BaseResource {
356
375
  folderName: string;
357
376
  parentFolder?: number;
@@ -364,7 +383,7 @@ interface AnnotationFolder extends BaseResource {
364
383
  interface Annotation extends BaseResource {
365
384
  annotation: string;
366
385
  annotationType: string;
367
- file?: number;
386
+ file?: string;
368
387
  fileUrl?: string;
369
388
  fileSize?: number;
370
389
  folder?: number;
@@ -375,6 +394,9 @@ interface Annotation extends BaseResource {
375
394
  translation?: string;
376
395
  scratched: boolean;
377
396
  ownerName?: string;
397
+ canEdit?: boolean;
398
+ canView?: boolean;
399
+ canDelete?: boolean;
378
400
  }
379
401
  interface AnnotationFolderCreateRequest {
380
402
  folderName: string;
@@ -394,9 +416,13 @@ interface AnnotationCreateRequest {
394
416
  annotationType?: string;
395
417
  file?: File;
396
418
  folder?: number;
419
+ transcribed?: boolean;
420
+ transcription?: string;
397
421
  language?: string;
422
+ translation?: string;
398
423
  labGroup?: number;
399
424
  visibility?: string;
425
+ autoTranscribe?: boolean;
400
426
  }
401
427
  interface AnnotationUpdateRequest {
402
428
  annotation?: string;
@@ -462,6 +488,62 @@ interface RemoteHostUpdateRequest {
462
488
  hostToken?: string;
463
489
  }
464
490
 
491
+ interface BaseNotification {
492
+ type: string;
493
+ message: string;
494
+ timestamp: string;
495
+ user_id?: number;
496
+ }
497
+ interface TranscriptionStartedNotification extends BaseNotification {
498
+ type: 'transcription.started';
499
+ annotation_id: number;
500
+ }
501
+ interface TranscriptionCompletedNotification extends BaseNotification {
502
+ type: 'transcription.completed';
503
+ annotation_id: number;
504
+ language?: string;
505
+ has_translation?: boolean;
506
+ }
507
+ interface TranscriptionFailedNotification extends BaseNotification {
508
+ type: 'transcription.failed';
509
+ annotation_id: number;
510
+ error: string;
511
+ }
512
+ interface SystemNotification extends BaseNotification {
513
+ type: 'system.notification';
514
+ level: 'info' | 'warning' | 'error' | 'success';
515
+ title: string;
516
+ }
517
+ interface AsyncTaskUpdateNotification extends BaseNotification {
518
+ type: 'async_task.update';
519
+ task_id: string;
520
+ status: string;
521
+ progress_percentage?: number;
522
+ progress_description?: string;
523
+ error_message?: string;
524
+ result?: any;
525
+ download_url?: string;
526
+ }
527
+ interface MetadataTableUpdateNotification extends BaseNotification {
528
+ type: 'metadata_table.update';
529
+ table_id: number;
530
+ action: string;
531
+ user?: number;
532
+ }
533
+ interface LabGroupUpdateNotification extends BaseNotification {
534
+ type: 'lab_group.update';
535
+ lab_group_id: number;
536
+ action: string;
537
+ }
538
+ interface ConnectionEstablishedNotification {
539
+ type: 'connection.established';
540
+ message: string;
541
+ user_id: number;
542
+ username: string;
543
+ lab_groups: number[];
544
+ }
545
+ type WebSocketNotification = TranscriptionStartedNotification | TranscriptionCompletedNotification | TranscriptionFailedNotification | SystemNotification | AsyncTaskUpdateNotification | MetadataTableUpdateNotification | LabGroupUpdateNotification | ConnectionEstablishedNotification;
546
+
465
547
  interface CupcakeCoreConfig {
466
548
  apiUrl: string;
467
549
  }
@@ -611,6 +693,17 @@ declare class ApiService {
611
693
  createAnnotationFolder(folderData: AnnotationFolderCreateRequest): Observable<AnnotationFolder>;
612
694
  updateAnnotationFolder(id: number, folderData: AnnotationFolderUpdateRequest): Observable<AnnotationFolder>;
613
695
  deleteAnnotationFolder(id: number): Observable<void>;
696
+ /**
697
+ * WARNING: This method accesses the base annotation endpoint and should only be used
698
+ * for standalone annotations that are NOT attached to parent resources.
699
+ *
700
+ * For annotations attached to parent resources, use the specialized services instead:
701
+ * - Instrument annotations: Use InstrumentService from @noatgnu/cupcake-macaron
702
+ * - StoredReagent annotations: Use ReagentService from @noatgnu/cupcake-macaron
703
+ * - Session annotations: Use SessionService from @noatgnu/cupcake-red-velvet
704
+ *
705
+ * These specialized services ensure proper permission checking through parent resources.
706
+ */
614
707
  getAnnotations(params?: {
615
708
  search?: string;
616
709
  annotationType?: string;
@@ -624,9 +717,52 @@ declare class ApiService {
624
717
  count: number;
625
718
  results: Annotation[];
626
719
  }>;
720
+ /**
721
+ * WARNING: This method accesses the base annotation endpoint and should only be used
722
+ * for standalone annotations that are NOT attached to parent resources.
723
+ *
724
+ * For annotations attached to parent resources, use the specialized services instead:
725
+ * - Instrument annotations: Use InstrumentService.getInstrumentAnnotation()
726
+ * - StoredReagent annotations: Use ReagentService.getStoredReagentAnnotation()
727
+ * - Session annotations: Use SessionService (session folder annotations)
728
+ *
729
+ * The backend enforces parent resource permissions, but using specialized services
730
+ * provides cleaner access control and better context.
731
+ */
627
732
  getAnnotation(id: number): Observable<Annotation>;
733
+ /**
734
+ * WARNING: This method accesses the base annotation endpoint and should only be used
735
+ * for standalone annotations that are NOT attached to parent resources.
736
+ *
737
+ * For creating annotations attached to parent resources, use specialized upload methods:
738
+ * - Instrument annotations: Use InstrumentService.uploadAnnotation()
739
+ * - StoredReagent annotations: Use ReagentService.uploadAnnotation()
740
+ * - Session/Step annotations: Use the appropriate chunked upload service
741
+ *
742
+ * These specialized methods provide chunked upload support, progress tracking,
743
+ * and automatic binding to parent resources with proper permission enforcement.
744
+ */
628
745
  createAnnotation(annotationData: AnnotationCreateRequest): Observable<Annotation>;
746
+ /**
747
+ * WARNING: This method accesses the base annotation endpoint and should only be used
748
+ * for standalone annotations that are NOT attached to parent resources.
749
+ *
750
+ * For annotations attached to parent resources, the backend enforces parent resource
751
+ * permissions. However, using specialized services provides better context and access control.
752
+ */
629
753
  updateAnnotation(id: number, annotationData: AnnotationUpdateRequest): Observable<Annotation>;
754
+ /**
755
+ * WARNING: This method accesses the base annotation endpoint and should only be used
756
+ * for standalone annotations that are NOT attached to parent resources.
757
+ *
758
+ * For deleting annotations attached to parent resources, use specialized services:
759
+ * - Instrument annotations: Use InstrumentService.deleteInstrumentAnnotation()
760
+ * - StoredReagent annotations: Use ReagentService.deleteStoredReagentAnnotation()
761
+ * - Session annotations: Use appropriate session/step annotation delete methods
762
+ *
763
+ * The backend enforces parent resource permissions, but using specialized services
764
+ * provides clearer intent and better access control context.
765
+ */
630
766
  deleteAnnotation(id: number): Observable<void>;
631
767
  getResourcePermissions(params?: {
632
768
  user?: number;
@@ -1038,6 +1174,7 @@ declare const authGuard: CanActivateFn;
1038
1174
 
1039
1175
  declare const adminGuard: CanActivateFn;
1040
1176
 
1177
+ declare function resetRefreshState(): void;
1041
1178
  declare const authInterceptor: HttpInterceptorFn;
1042
1179
 
1043
1180
  declare class LoginComponent implements OnInit {
@@ -1388,5 +1525,5 @@ declare class CupcakeCoreModule {
1388
1525
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<CupcakeCoreModule>;
1389
1526
  }
1390
1527
 
1391
- export { ApiService, AuthService, BaseApiService, CUPCAKE_CORE_CONFIG, CupcakeCoreModule, InvitationStatus, InvitationStatusLabels, LabGroupService, LabGroupsComponent, LoginComponent, NotificationService, PoweredByFooterComponent, RegisterComponent, ResourceRole, ResourceRoleLabels, ResourceService, ResourceType, ResourceTypeLabels, ResourceVisibility, ResourceVisibilityLabels, SiteConfigComponent, SiteConfigService, ThemeService, ToastContainerComponent, ToastService, UserManagementComponent, UserManagementService, UserProfileComponent, WEBSOCKET_ENDPOINT, WEBSOCKET_ENDPOINTS, WebSocketConfigService, WebSocketEndpoints, WebSocketService, adminGuard, authGuard, authInterceptor };
1392
- export type { AccountMergeRequest, AdminPasswordResetRequest, Annotation, AnnotationCreateRequest, AnnotationFolder, AnnotationFolderCreateRequest, AnnotationFolderUpdateRequest, AnnotationUpdateRequest, ApiResponse, AuthConfig, AuthResponse, AuthStatus, BaseResource, BaseTimestampedModel, BulkPermissionRequest, CupcakeCoreConfig, EmailChangeConfirmRequest, EmailChangeConfirmResponse, EmailChangeRequest, InvitationResponseRequest, LabGroup, LabGroupCreateRequest, LabGroupInvitation, LabGroupInvitationCreateRequest, LabGroupInvitationQueryParams, LabGroupInvitationQueryResponse, LabGroupInviteRequest, LabGroupMember, LabGroupPathItem, LabGroupPermission, LabGroupPermissionCreateRequest, LabGroupPermissionQueryParams, LabGroupPermissionQueryResponse, LabGroupPermissionUpdateRequest, LabGroupQueryParams, LabGroupQueryResponse, LabGroupUpdateRequest, NotificationAction, NotificationItem, PaginatedResponse, PasswordChangeRequest, PasswordChangeResponse, PasswordResetConfirmRequest, PasswordResetRequest, RegistrationStatus, RemoteHost, RemoteHostCreateRequest, RemoteHostUpdateRequest, ResourcePermission, ResourcePermissionCreateRequest, ResourcePermissionUpdateRequest, ResourceQueryParams, SiteConfig, SiteConfigUpdateRequest, Theme, ToastMessage, User, UserCreateRequest, UserListResponse, UserOrcidProfile, UserProfileUpdateRequest, UserRegistrationRequest, UserResponse, WebSocketConfig, WebSocketEndpointConfig, WebSocketMessage };
1528
+ export { AnnotationType, ApiService, AuthService, BaseApiService, CUPCAKE_CORE_CONFIG, CupcakeCoreModule, InvitationStatus, InvitationStatusLabels, LabGroupService, LabGroupsComponent, LoginComponent, NotificationService, PoweredByFooterComponent, RegisterComponent, ResourceRole, ResourceRoleLabels, ResourceService, ResourceType, ResourceTypeLabels, ResourceVisibility, ResourceVisibilityLabels, SiteConfigComponent, SiteConfigService, ThemeService, ToastContainerComponent, ToastService, UserManagementComponent, UserManagementService, UserProfileComponent, WEBSOCKET_ENDPOINT, WEBSOCKET_ENDPOINTS, WebSocketConfigService, WebSocketEndpoints, WebSocketService, adminGuard, authGuard, authInterceptor, resetRefreshState };
1529
+ export type { AccountMergeRequest, AdminPasswordResetRequest, Annotation, AnnotationCreateRequest, AnnotationFolder, AnnotationFolderCreateRequest, AnnotationFolderUpdateRequest, AnnotationUpdateRequest, ApiResponse, AsyncTaskUpdateNotification, AuthConfig, AuthResponse, AuthStatus, BaseNotification, BaseResource, BaseTimestampedModel, BulkPermissionRequest, ConnectionEstablishedNotification, CupcakeCoreConfig, EmailChangeConfirmRequest, EmailChangeConfirmResponse, EmailChangeRequest, InvitationResponseRequest, LabGroup, LabGroupCreateRequest, LabGroupInvitation, LabGroupInvitationCreateRequest, LabGroupInvitationQueryParams, LabGroupInvitationQueryResponse, LabGroupInviteRequest, LabGroupMember, LabGroupPathItem, LabGroupPermission, LabGroupPermissionCreateRequest, LabGroupPermissionQueryParams, LabGroupPermissionQueryResponse, LabGroupPermissionUpdateRequest, LabGroupQueryParams, LabGroupQueryResponse, LabGroupUpdateNotification, LabGroupUpdateRequest, MetadataTableUpdateNotification, NotificationAction, NotificationItem, PaginatedResponse, PasswordChangeRequest, PasswordChangeResponse, PasswordResetConfirmRequest, PasswordResetRequest, RegistrationStatus, RemoteHost, RemoteHostCreateRequest, RemoteHostUpdateRequest, ResourcePermission, ResourcePermissionCreateRequest, ResourcePermissionUpdateRequest, ResourceQueryParams, SiteConfig, SiteConfigUpdateRequest, SystemNotification, Theme, ToastMessage, TranscriptionCompletedNotification, TranscriptionFailedNotification, TranscriptionStartedNotification, User, UserCreateRequest, UserListResponse, UserOrcidProfile, UserProfileUpdateRequest, UserRegistrationRequest, UserResponse, WebSocketConfig, WebSocketEndpointConfig, WebSocketMessage, WebSocketNotification };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noatgnu/cupcake-core",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "description": "A reusable Angular library that provides user management, authentication, and site configuration functionality for cupcake applications.",
5
5
  "keywords": [
6
6
  "angular",