@progalaxyelabs/ngx-stonescriptphp-client 1.10.0 → 1.11.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
|
@@ -16,8 +16,8 @@ declare class TokenService {
|
|
|
16
16
|
getRefreshToken(): string;
|
|
17
17
|
clear(): void;
|
|
18
18
|
/**
|
|
19
|
-
* Check if there is a
|
|
20
|
-
*
|
|
19
|
+
* Check if there is a non-empty access token.
|
|
20
|
+
* Token is treated as opaque — validity is determined by the auth server.
|
|
21
21
|
*/
|
|
22
22
|
hasValidAccessToken(): boolean;
|
|
23
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<TokenService, never>;
|
|
@@ -129,6 +129,31 @@ interface OAuthProviderConfig {
|
|
|
129
129
|
color?: string;
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Maps auth service response fields to expected locations.
|
|
134
|
+
* Different auth backends return tokens/user info in different structures.
|
|
135
|
+
* Paths use dot-notation (e.g., 'data.access_token' for nested fields).
|
|
136
|
+
*
|
|
137
|
+
* StoneScriptPHP format: { status: 'ok', data: { access_token, user, ... } }
|
|
138
|
+
* Raw/external format: { access_token, identity, ... }
|
|
139
|
+
*/
|
|
140
|
+
interface AuthResponseMap {
|
|
141
|
+
/**
|
|
142
|
+
* Dot-path to check for success (e.g., 'status' for StoneScriptPHP).
|
|
143
|
+
* If omitted, success is determined by presence of accessToken.
|
|
144
|
+
*/
|
|
145
|
+
successPath?: string;
|
|
146
|
+
/** Value that indicates success at successPath (e.g., 'ok') */
|
|
147
|
+
successValue?: string;
|
|
148
|
+
/** Dot-path to the access token (default: 'data.access_token') */
|
|
149
|
+
accessTokenPath: string;
|
|
150
|
+
/** Dot-path to the refresh token (default: 'data.refresh_token') */
|
|
151
|
+
refreshTokenPath: string;
|
|
152
|
+
/** Dot-path to the user/identity object (default: 'data.user') */
|
|
153
|
+
userPath: string;
|
|
154
|
+
/** Dot-path to error message (default: 'message') */
|
|
155
|
+
errorMessagePath?: string;
|
|
156
|
+
}
|
|
132
157
|
declare class MyEnvironmentModel {
|
|
133
158
|
production: boolean;
|
|
134
159
|
/**
|
|
@@ -212,6 +237,22 @@ declare class MyEnvironmentModel {
|
|
|
212
237
|
* ```
|
|
213
238
|
*/
|
|
214
239
|
customProviders?: Record<string, OAuthProviderConfig>;
|
|
240
|
+
/**
|
|
241
|
+
* Auth response field mapping.
|
|
242
|
+
* Defaults to StoneScriptPHP format: { status: 'ok', data: { access_token, user, ... } }
|
|
243
|
+
*
|
|
244
|
+
* For external auth servers that return flat responses like
|
|
245
|
+
* { access_token, identity, ... }, override with:
|
|
246
|
+
* ```typescript
|
|
247
|
+
* authResponseMap: {
|
|
248
|
+
* accessTokenPath: 'access_token',
|
|
249
|
+
* refreshTokenPath: 'refresh_token',
|
|
250
|
+
* userPath: 'identity',
|
|
251
|
+
* errorMessagePath: 'message'
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
authResponseMap?: AuthResponseMap;
|
|
215
256
|
/**
|
|
216
257
|
* Branding configuration for auth components
|
|
217
258
|
* Allows platforms to customize login/register pages without creating wrappers
|
|
@@ -377,6 +418,22 @@ declare class AuthService {
|
|
|
377
418
|
* @throws Error if no API URL is configured
|
|
378
419
|
*/
|
|
379
420
|
private getPlatformApiUrl;
|
|
421
|
+
/** Default response map: StoneScriptPHP format */
|
|
422
|
+
private get responseMap();
|
|
423
|
+
/** Resolve a dot-notation path on an object (e.g., 'data.access_token') */
|
|
424
|
+
private resolvePath;
|
|
425
|
+
/** Check if an auth response indicates success */
|
|
426
|
+
private isAuthSuccess;
|
|
427
|
+
/** Extract access token from auth response */
|
|
428
|
+
private getAccessToken;
|
|
429
|
+
/** Extract refresh token from auth response */
|
|
430
|
+
private getRefreshToken;
|
|
431
|
+
/** Extract user/identity object from auth response */
|
|
432
|
+
private getUserFromResponse;
|
|
433
|
+
/** Extract error message from auth response */
|
|
434
|
+
private getErrorMessage;
|
|
435
|
+
/** Normalize a user/identity object into the standard User shape */
|
|
436
|
+
private normalizeUser;
|
|
380
437
|
/**
|
|
381
438
|
* Hash UUID to numeric ID for backward compatibility
|
|
382
439
|
* Converts UUID string to a consistent numeric ID for legacy code
|
|
@@ -1087,4 +1144,4 @@ declare class TenantRegisterDialogComponent {
|
|
|
1087
1144
|
}
|
|
1088
1145
|
|
|
1089
1146
|
export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, NgxStoneScriptPhpClientModule, ProviderRegistryService, RegisterComponent, SigninStatusService, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus };
|
|
1090
|
-
export type { AuthConfig, AuthMode, AuthProvider, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
|
|
1147
|
+
export type { AuthConfig, AuthMode, AuthProvider, AuthResponseMap, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
|