@progalaxyelabs/ngx-stonescriptphp-client 1.5.1 → 1.8.1
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
|
@@ -108,6 +108,25 @@ interface AuthServerConfig {
|
|
|
108
108
|
/** Whether this is the default server */
|
|
109
109
|
default?: boolean;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Configuration for a custom OAuth provider.
|
|
113
|
+
* Used to register custom providers via the ProviderRegistryService
|
|
114
|
+
* or through the environment's customProviders field.
|
|
115
|
+
*/
|
|
116
|
+
interface OAuthProviderConfig {
|
|
117
|
+
/** Display label for the provider (e.g., "Okta") */
|
|
118
|
+
label: string;
|
|
119
|
+
/** Optional icon character or emoji to display */
|
|
120
|
+
icon?: string;
|
|
121
|
+
/** Optional CSS class to apply to the button (e.g., "btn-okta") */
|
|
122
|
+
cssClass?: string;
|
|
123
|
+
/** Optional inline button styles for custom branding */
|
|
124
|
+
buttonStyle?: {
|
|
125
|
+
borderColor?: string;
|
|
126
|
+
backgroundColor?: string;
|
|
127
|
+
color?: string;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
111
130
|
declare class MyEnvironmentModel {
|
|
112
131
|
production: boolean;
|
|
113
132
|
/**
|
|
@@ -150,11 +169,41 @@ declare class MyEnvironmentModel {
|
|
|
150
169
|
chatServer: {
|
|
151
170
|
host: string;
|
|
152
171
|
};
|
|
172
|
+
/**
|
|
173
|
+
* Accounts/Authentication service server configuration
|
|
174
|
+
* Use this when auth is on a different server than the API
|
|
175
|
+
* Replaces the deprecated accountsUrl string with structured config
|
|
176
|
+
* @example { host: 'https://accounts.progalaxyelabs.com' }
|
|
177
|
+
*/
|
|
178
|
+
accountsServer?: {
|
|
179
|
+
host: string;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Files service server configuration
|
|
183
|
+
* Used by FilesService for file upload/download operations
|
|
184
|
+
* @example { host: 'https://files.progalaxyelabs.com/api/' }
|
|
185
|
+
*/
|
|
186
|
+
filesServer?: {
|
|
187
|
+
host: string;
|
|
188
|
+
};
|
|
153
189
|
/**
|
|
154
190
|
* Authentication configuration
|
|
155
191
|
* @default { mode: 'cookie', refreshEndpoint: '/auth/refresh', useCsrf: true }
|
|
156
192
|
*/
|
|
157
193
|
auth?: AuthConfig;
|
|
194
|
+
/**
|
|
195
|
+
* Custom OAuth provider configurations.
|
|
196
|
+
* Register additional OAuth providers beyond the built-in ones
|
|
197
|
+
* (google, linkedin, apple, microsoft, github, zoho).
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* customProviders: {
|
|
201
|
+
* okta: { label: 'Sign in with Okta', cssClass: 'btn-okta', buttonStyle: { borderColor: '#007dc1' } },
|
|
202
|
+
* keycloak: { label: 'Sign in with Keycloak', icon: '🔑' }
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
customProviders?: Record<string, OAuthProviderConfig>;
|
|
158
207
|
/**
|
|
159
208
|
* Branding configuration for auth components
|
|
160
209
|
* Allows platforms to customize login/register pages without creating wrappers
|
|
@@ -241,7 +290,13 @@ declare class ApiConnectionService {
|
|
|
241
290
|
static ɵprov: i0.ɵɵInjectableDeclaration<ApiConnectionService>;
|
|
242
291
|
}
|
|
243
292
|
|
|
244
|
-
type
|
|
293
|
+
type BuiltInProvider = 'google' | 'linkedin' | 'apple' | 'microsoft' | 'github' | 'zoho' | 'emailPassword';
|
|
294
|
+
/**
|
|
295
|
+
* Authentication provider identifier.
|
|
296
|
+
* Includes all built-in providers plus any custom string identifier.
|
|
297
|
+
* The (string & {}) trick preserves autocomplete for built-in values.
|
|
298
|
+
*/
|
|
299
|
+
type AuthProvider = BuiltInProvider | (string & {});
|
|
245
300
|
interface User {
|
|
246
301
|
user_id: number;
|
|
247
302
|
id: string;
|
|
@@ -546,6 +601,188 @@ declare class DbService {
|
|
|
546
601
|
static ɵprov: i0.ɵɵInjectableDeclaration<DbService>;
|
|
547
602
|
}
|
|
548
603
|
|
|
604
|
+
/**
|
|
605
|
+
* Result of a file upload operation
|
|
606
|
+
*/
|
|
607
|
+
interface FileUploadResult {
|
|
608
|
+
/** Unique file identifier (UUID) */
|
|
609
|
+
id: string;
|
|
610
|
+
/** Original file name */
|
|
611
|
+
name: string;
|
|
612
|
+
/** MIME content type */
|
|
613
|
+
contentType: string;
|
|
614
|
+
/** File size in bytes */
|
|
615
|
+
size: number;
|
|
616
|
+
/** ISO timestamp of upload */
|
|
617
|
+
uploadedAt: string;
|
|
618
|
+
/** Tenant ID (present when tenant-scoped) */
|
|
619
|
+
tenantId?: string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* File metadata as returned by the list endpoint
|
|
623
|
+
*/
|
|
624
|
+
interface FileMetadata {
|
|
625
|
+
/** Unique file identifier (UUID) */
|
|
626
|
+
fileId: string;
|
|
627
|
+
/** Original file name */
|
|
628
|
+
fileName: string;
|
|
629
|
+
/** MIME content type */
|
|
630
|
+
contentType: string;
|
|
631
|
+
/** File size in bytes */
|
|
632
|
+
size: number;
|
|
633
|
+
/** ISO timestamp of upload */
|
|
634
|
+
uploadedAt: string;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Response from the file list endpoint
|
|
638
|
+
*/
|
|
639
|
+
interface FileListResponse {
|
|
640
|
+
success: boolean;
|
|
641
|
+
count: number;
|
|
642
|
+
files: FileMetadata[];
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Response from the file upload endpoint
|
|
646
|
+
*/
|
|
647
|
+
interface FileUploadResponse {
|
|
648
|
+
success: boolean;
|
|
649
|
+
file: FileUploadResult;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Response from the file delete endpoint
|
|
653
|
+
*/
|
|
654
|
+
interface FileDeleteResponse {
|
|
655
|
+
success: boolean;
|
|
656
|
+
message: string;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Service for interacting with the stonescriptphp-files server.
|
|
661
|
+
* Handles file upload, download, list, and delete operations
|
|
662
|
+
* with automatic Bearer token injection and 401 refresh handling.
|
|
663
|
+
*/
|
|
664
|
+
declare class FilesService {
|
|
665
|
+
private tokens;
|
|
666
|
+
private signinStatus;
|
|
667
|
+
private environment;
|
|
668
|
+
private csrf;
|
|
669
|
+
private host;
|
|
670
|
+
private apiHost;
|
|
671
|
+
private authConfig;
|
|
672
|
+
constructor(tokens: TokenService, signinStatus: SigninStatusService, environment: MyEnvironmentModel, csrf: CsrfService);
|
|
673
|
+
/**
|
|
674
|
+
* Check if the files server is configured.
|
|
675
|
+
*/
|
|
676
|
+
isConfigured(): boolean;
|
|
677
|
+
/**
|
|
678
|
+
* Upload a file to the files service.
|
|
679
|
+
* Uses FormData — does NOT set Content-Type header (browser sets multipart boundary).
|
|
680
|
+
*
|
|
681
|
+
* @param file The File object to upload
|
|
682
|
+
* @param entityType Optional entity type for server-side reference linking
|
|
683
|
+
* @param entityId Optional entity ID for server-side reference linking
|
|
684
|
+
* @returns Promise resolving to the upload result
|
|
685
|
+
*/
|
|
686
|
+
upload(file: File, entityType?: string, entityId?: string): Promise<FileUploadResult>;
|
|
687
|
+
/**
|
|
688
|
+
* Download a file from the files service.
|
|
689
|
+
* Returns a Blob suitable for URL.createObjectURL().
|
|
690
|
+
*
|
|
691
|
+
* @param fileId UUID of the file to download
|
|
692
|
+
* @returns Promise resolving to the file Blob
|
|
693
|
+
*/
|
|
694
|
+
download(fileId: string): Promise<Blob>;
|
|
695
|
+
/**
|
|
696
|
+
* List all files for the current user.
|
|
697
|
+
*
|
|
698
|
+
* @returns Promise resolving to array of file metadata
|
|
699
|
+
*/
|
|
700
|
+
list(): Promise<FileMetadata[]>;
|
|
701
|
+
/**
|
|
702
|
+
* Delete a file from the files service.
|
|
703
|
+
*
|
|
704
|
+
* @param fileId UUID of the file to delete
|
|
705
|
+
* @returns Promise resolving to true on success
|
|
706
|
+
*/
|
|
707
|
+
delete(fileId: string): Promise<boolean>;
|
|
708
|
+
/**
|
|
709
|
+
* Make a request with automatic Bearer token injection and 401 retry.
|
|
710
|
+
*/
|
|
711
|
+
private requestWithRetry;
|
|
712
|
+
private includeAccessToken;
|
|
713
|
+
private refreshAccessToken;
|
|
714
|
+
private refreshAccessTokenCookieMode;
|
|
715
|
+
private refreshAccessTokenBodyMode;
|
|
716
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FilesService, never>;
|
|
717
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FilesService>;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Service for managing OAuth provider configurations.
|
|
722
|
+
*
|
|
723
|
+
* Provides a central registry for both built-in and custom OAuth providers.
|
|
724
|
+
* Custom providers can be registered either through the environment configuration
|
|
725
|
+
* (customProviders field) or programmatically via registerProvider/registerProviders.
|
|
726
|
+
*
|
|
727
|
+
* Custom registrations take precedence over built-in defaults.
|
|
728
|
+
* Unknown providers receive an auto-generated fallback configuration.
|
|
729
|
+
*/
|
|
730
|
+
declare class ProviderRegistryService {
|
|
731
|
+
private environment;
|
|
732
|
+
private customProviders;
|
|
733
|
+
constructor(environment: MyEnvironmentModel);
|
|
734
|
+
/**
|
|
735
|
+
* Register a custom OAuth provider configuration.
|
|
736
|
+
* If a provider with the same id already exists, it will be overwritten.
|
|
737
|
+
* @param id - Provider identifier (e.g., 'okta', 'auth0')
|
|
738
|
+
* @param config - Provider display configuration
|
|
739
|
+
*/
|
|
740
|
+
registerProvider(id: string, config: OAuthProviderConfig): void;
|
|
741
|
+
/**
|
|
742
|
+
* Register multiple custom OAuth provider configurations at once.
|
|
743
|
+
* @param providers - Record of provider id to configuration
|
|
744
|
+
*/
|
|
745
|
+
registerProviders(providers: Record<string, OAuthProviderConfig>): void;
|
|
746
|
+
/**
|
|
747
|
+
* Get the full configuration for a provider.
|
|
748
|
+
* Resolution order: custom registration > built-in default > auto-generated fallback.
|
|
749
|
+
* @param provider - Provider identifier
|
|
750
|
+
*/
|
|
751
|
+
getProviderConfig(provider: string): OAuthProviderConfig;
|
|
752
|
+
/**
|
|
753
|
+
* Get the display label for a provider, formatted for sign-in context.
|
|
754
|
+
* @param provider - Provider identifier
|
|
755
|
+
* @returns Label like "Sign in with Google"
|
|
756
|
+
*/
|
|
757
|
+
getLabel(provider: string): string;
|
|
758
|
+
/**
|
|
759
|
+
* Get the display label for a provider, formatted for sign-up context.
|
|
760
|
+
* @param provider - Provider identifier
|
|
761
|
+
* @returns Label like "Sign up with Google"
|
|
762
|
+
*/
|
|
763
|
+
getSignupLabel(provider: string): string;
|
|
764
|
+
/**
|
|
765
|
+
* Get the icon for a provider, if configured.
|
|
766
|
+
* @param provider - Provider identifier
|
|
767
|
+
* @returns Icon string or undefined
|
|
768
|
+
*/
|
|
769
|
+
getIcon(provider: string): string | undefined;
|
|
770
|
+
/**
|
|
771
|
+
* Get the CSS class for a provider button.
|
|
772
|
+
* @param provider - Provider identifier
|
|
773
|
+
* @returns CSS class string (e.g., "btn-google")
|
|
774
|
+
*/
|
|
775
|
+
getCssClass(provider: string): string;
|
|
776
|
+
/**
|
|
777
|
+
* Get inline button styles for a provider, if configured.
|
|
778
|
+
* @param provider - Provider identifier
|
|
779
|
+
* @returns Style object for ngStyle binding, or null if no custom styles
|
|
780
|
+
*/
|
|
781
|
+
getButtonStyle(provider: string): Record<string, string> | null;
|
|
782
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ProviderRegistryService, never>;
|
|
783
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ProviderRegistryService>;
|
|
784
|
+
}
|
|
785
|
+
|
|
549
786
|
declare class NgxStoneScriptPhpClientModule {
|
|
550
787
|
static forRoot(environment: MyEnvironmentModel): ModuleWithProviders<NgxStoneScriptPhpClientModule>;
|
|
551
788
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxStoneScriptPhpClientModule, never>;
|
|
@@ -568,6 +805,7 @@ interface TenantSelectedEvent {
|
|
|
568
805
|
}
|
|
569
806
|
declare class TenantLoginComponent implements OnInit {
|
|
570
807
|
private auth;
|
|
808
|
+
private providerRegistry;
|
|
571
809
|
title: string;
|
|
572
810
|
providers: AuthProvider[];
|
|
573
811
|
showTenantSelector: boolean;
|
|
@@ -594,11 +832,13 @@ declare class TenantLoginComponent implements OnInit {
|
|
|
594
832
|
memberships: TenantMembership[];
|
|
595
833
|
selectedTenantId: string | null;
|
|
596
834
|
userName: string;
|
|
597
|
-
constructor(auth: AuthService);
|
|
835
|
+
constructor(auth: AuthService, providerRegistry: ProviderRegistryService);
|
|
598
836
|
ngOnInit(): void;
|
|
599
837
|
isProviderEnabled(provider: AuthProvider): boolean;
|
|
600
838
|
getProviderLabel(provider: AuthProvider): string;
|
|
601
839
|
getProviderIcon(provider: AuthProvider): string | undefined;
|
|
840
|
+
getProviderCssClass(provider: AuthProvider): string;
|
|
841
|
+
getProviderButtonStyle(provider: AuthProvider): Record<string, string> | null;
|
|
602
842
|
toggleAuthMethod(event: Event): void;
|
|
603
843
|
onEmailLogin(): Promise<void>;
|
|
604
844
|
onOAuthLogin(provider: AuthProvider): Promise<void>;
|
|
@@ -637,6 +877,7 @@ declare class AuthPageComponent implements OnInit {
|
|
|
637
877
|
|
|
638
878
|
declare class LoginDialogComponent implements OnInit {
|
|
639
879
|
private auth;
|
|
880
|
+
private providerRegistry;
|
|
640
881
|
/**
|
|
641
882
|
* REQUIRED: Which authentication providers to show in this dialog
|
|
642
883
|
* @example ['google', 'linkedin', 'emailPassword']
|
|
@@ -648,11 +889,13 @@ declare class LoginDialogComponent implements OnInit {
|
|
|
648
889
|
loading: boolean;
|
|
649
890
|
showPassword: boolean;
|
|
650
891
|
oauthProviders: AuthProvider[];
|
|
651
|
-
constructor(auth: AuthService);
|
|
892
|
+
constructor(auth: AuthService, providerRegistry: ProviderRegistryService);
|
|
652
893
|
ngOnInit(): void;
|
|
653
894
|
isProviderEnabled(provider: AuthProvider): boolean;
|
|
654
895
|
getProviderLabel(provider: AuthProvider): string;
|
|
655
896
|
getProviderIcon(provider: AuthProvider): string | undefined;
|
|
897
|
+
getProviderCssClass(provider: AuthProvider): string;
|
|
898
|
+
getProviderButtonStyle(provider: AuthProvider): Record<string, string> | null;
|
|
656
899
|
onEmailLogin(): Promise<void>;
|
|
657
900
|
onOAuthLogin(provider: AuthProvider): Promise<void>;
|
|
658
901
|
onRegisterClick(event: Event): void;
|
|
@@ -698,6 +941,7 @@ interface TenantCreatedEvent {
|
|
|
698
941
|
}
|
|
699
942
|
declare class TenantRegisterComponent implements OnInit {
|
|
700
943
|
private auth;
|
|
944
|
+
private providerRegistry;
|
|
701
945
|
title: string;
|
|
702
946
|
providers: AuthProvider[];
|
|
703
947
|
requireTenantName: boolean;
|
|
@@ -734,11 +978,13 @@ declare class TenantRegisterComponent implements OnInit {
|
|
|
734
978
|
oauthProviders: AuthProvider[];
|
|
735
979
|
showPassword: boolean;
|
|
736
980
|
showConfirmPassword: boolean;
|
|
737
|
-
constructor(auth: AuthService);
|
|
981
|
+
constructor(auth: AuthService, providerRegistry: ProviderRegistryService);
|
|
738
982
|
ngOnInit(): void;
|
|
739
983
|
isProviderEnabled(provider: AuthProvider): boolean;
|
|
740
984
|
getProviderLabel(provider: AuthProvider): string;
|
|
741
985
|
getProviderIcon(provider: AuthProvider): string | undefined;
|
|
986
|
+
getProviderCssClass(provider: AuthProvider): string;
|
|
987
|
+
getProviderButtonStyle(provider: AuthProvider): Record<string, string> | null;
|
|
742
988
|
onTenantNameChange(): void;
|
|
743
989
|
checkSlugAvailability(): Promise<void>;
|
|
744
990
|
toggleAuthMethod(event: Event): void;
|
|
@@ -826,5 +1072,5 @@ declare class TenantRegisterDialogComponent {
|
|
|
826
1072
|
static ɵcmp: i0.ɵɵComponentDeclaration<TenantRegisterDialogComponent, "lib-tenant-register-dialog", never, {}, {}, never, never, true, never>;
|
|
827
1073
|
}
|
|
828
1074
|
|
|
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 };
|
|
1075
|
+
export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, NgxStoneScriptPhpClientModule, ProviderRegistryService, RegisterComponent, SigninStatusService, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus };
|
|
1076
|
+
export type { AuthConfig, AuthMode, AuthProvider, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
|