@progalaxyelabs/ngx-stonescriptphp-client 1.5.0 → 1.6.0

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
@@ -150,6 +150,14 @@ declare class MyEnvironmentModel {
150
150
  chatServer: {
151
151
  host: string;
152
152
  };
153
+ /**
154
+ * Files service server configuration
155
+ * Used by FilesService for file upload/download operations
156
+ * @example { host: 'https://files.progalaxyelabs.com/api/' }
157
+ */
158
+ filesServer?: {
159
+ host: string;
160
+ };
153
161
  /**
154
162
  * Authentication configuration
155
163
  * @default { mode: 'cookie', refreshEndpoint: '/auth/refresh', useCsrf: true }
@@ -243,12 +251,12 @@ declare class ApiConnectionService {
243
251
 
244
252
  type AuthProvider = 'google' | 'linkedin' | 'apple' | 'microsoft' | 'github' | 'zoho' | 'emailPassword';
245
253
  interface User {
246
- user_id?: number;
247
- id?: string;
254
+ user_id: number;
255
+ id: string;
248
256
  email: string;
249
- display_name?: string;
257
+ display_name: string;
250
258
  photo_url?: string;
251
- is_email_verified?: boolean;
259
+ is_email_verified: boolean;
252
260
  }
253
261
  interface AuthResult {
254
262
  success: boolean;
@@ -546,6 +554,122 @@ declare class DbService {
546
554
  static ɵprov: i0.ɵɵInjectableDeclaration<DbService>;
547
555
  }
548
556
 
557
+ /**
558
+ * Result of a file upload operation
559
+ */
560
+ interface FileUploadResult {
561
+ /** Unique file identifier (UUID) */
562
+ id: string;
563
+ /** Original file name */
564
+ name: string;
565
+ /** MIME content type */
566
+ contentType: string;
567
+ /** File size in bytes */
568
+ size: number;
569
+ /** ISO timestamp of upload */
570
+ uploadedAt: string;
571
+ /** Tenant ID (present when tenant-scoped) */
572
+ tenantId?: string;
573
+ }
574
+ /**
575
+ * File metadata as returned by the list endpoint
576
+ */
577
+ interface FileMetadata {
578
+ /** Unique file identifier (UUID) */
579
+ fileId: string;
580
+ /** Original file name */
581
+ fileName: string;
582
+ /** MIME content type */
583
+ contentType: string;
584
+ /** File size in bytes */
585
+ size: number;
586
+ /** ISO timestamp of upload */
587
+ uploadedAt: string;
588
+ }
589
+ /**
590
+ * Response from the file list endpoint
591
+ */
592
+ interface FileListResponse {
593
+ success: boolean;
594
+ count: number;
595
+ files: FileMetadata[];
596
+ }
597
+ /**
598
+ * Response from the file upload endpoint
599
+ */
600
+ interface FileUploadResponse {
601
+ success: boolean;
602
+ file: FileUploadResult;
603
+ }
604
+ /**
605
+ * Response from the file delete endpoint
606
+ */
607
+ interface FileDeleteResponse {
608
+ success: boolean;
609
+ message: string;
610
+ }
611
+
612
+ /**
613
+ * Service for interacting with the stonescriptphp-files server.
614
+ * Handles file upload, download, list, and delete operations
615
+ * with automatic Bearer token injection and 401 refresh handling.
616
+ */
617
+ declare class FilesService {
618
+ private tokens;
619
+ private signinStatus;
620
+ private environment;
621
+ private csrf;
622
+ private host;
623
+ private apiHost;
624
+ private authConfig;
625
+ constructor(tokens: TokenService, signinStatus: SigninStatusService, environment: MyEnvironmentModel, csrf: CsrfService);
626
+ /**
627
+ * Check if the files server is configured.
628
+ */
629
+ isConfigured(): boolean;
630
+ /**
631
+ * Upload a file to the files service.
632
+ * Uses FormData — does NOT set Content-Type header (browser sets multipart boundary).
633
+ *
634
+ * @param file The File object to upload
635
+ * @param entityType Optional entity type for server-side reference linking
636
+ * @param entityId Optional entity ID for server-side reference linking
637
+ * @returns Promise resolving to the upload result
638
+ */
639
+ upload(file: File, entityType?: string, entityId?: string): Promise<FileUploadResult>;
640
+ /**
641
+ * Download a file from the files service.
642
+ * Returns a Blob suitable for URL.createObjectURL().
643
+ *
644
+ * @param fileId UUID of the file to download
645
+ * @returns Promise resolving to the file Blob
646
+ */
647
+ download(fileId: string): Promise<Blob>;
648
+ /**
649
+ * List all files for the current user.
650
+ *
651
+ * @returns Promise resolving to array of file metadata
652
+ */
653
+ list(): Promise<FileMetadata[]>;
654
+ /**
655
+ * Delete a file from the files service.
656
+ *
657
+ * @param fileId UUID of the file to delete
658
+ * @returns Promise resolving to true on success
659
+ */
660
+ delete(fileId: string): Promise<boolean>;
661
+ /**
662
+ * Make a request with automatic Bearer token injection and 401 retry.
663
+ */
664
+ private requestWithRetry;
665
+ private includeAccessToken;
666
+ private refreshAccessToken;
667
+ private refreshAccessTokenCookieMode;
668
+ private refreshAccessTokenBodyMode;
669
+ static ɵfac: i0.ɵɵFactoryDeclaration<FilesService, never>;
670
+ static ɵprov: i0.ɵɵInjectableDeclaration<FilesService>;
671
+ }
672
+
549
673
  declare class NgxStoneScriptPhpClientModule {
550
674
  static forRoot(environment: MyEnvironmentModel): ModuleWithProviders<NgxStoneScriptPhpClientModule>;
551
675
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxStoneScriptPhpClientModule, never>;
@@ -826,5 +950,5 @@ declare class TenantRegisterDialogComponent {
826
950
  static ɵcmp: i0.ɵɵComponentDeclaration<TenantRegisterDialogComponent, "lib-tenant-register-dialog", never, {}, {}, never, never, true, never>;
827
951
  }
828
952
 
829
- export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, LoginDialogComponent, MyEnvironmentModel, NgxStoneScriptPhpClientModule, RegisterComponent, SigninStatusService, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus };
830
- export type { AuthConfig, AuthMode, AuthProvider, AuthResult, AuthServerConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
953
+ export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, NgxStoneScriptPhpClientModule, RegisterComponent, SigninStatusService, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus };
954
+ export type { AuthConfig, AuthMode, AuthProvider, AuthResult, AuthServerConfig, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progalaxyelabs/ngx-stonescriptphp-client",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Angular client library for StoneScriptPHP backend framework",
5
5
  "keywords": [
6
6
  "angular",