@progalaxyelabs/ngx-stonescriptphp-client 1.9.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
|
/**
|
|
@@ -165,6 +190,12 @@ declare class MyEnvironmentModel {
|
|
|
165
190
|
messagingSenderId: string;
|
|
166
191
|
measurementId: string;
|
|
167
192
|
};
|
|
193
|
+
/**
|
|
194
|
+
* Platform's own API base URL (e.g., '//api.medstoreapp.in')
|
|
195
|
+
* Used to route registration through the platform API proxy instead of auth directly
|
|
196
|
+
* @example '//api.medstoreapp.in'
|
|
197
|
+
*/
|
|
198
|
+
apiUrl?: string;
|
|
168
199
|
apiServer: {
|
|
169
200
|
host: string;
|
|
170
201
|
};
|
|
@@ -206,6 +237,22 @@ declare class MyEnvironmentModel {
|
|
|
206
237
|
* ```
|
|
207
238
|
*/
|
|
208
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;
|
|
209
256
|
/**
|
|
210
257
|
* Branding configuration for auth components
|
|
211
258
|
* Allows platforms to customize login/register pages without creating wrappers
|
|
@@ -365,6 +412,28 @@ declare class AuthService {
|
|
|
365
412
|
* Check if multi-server mode is enabled
|
|
366
413
|
*/
|
|
367
414
|
isMultiServerMode(): boolean;
|
|
415
|
+
/**
|
|
416
|
+
* Get the platform's own API base URL
|
|
417
|
+
* Used for routes that go through the platform API proxy (e.g. register-tenant)
|
|
418
|
+
* @throws Error if no API URL is configured
|
|
419
|
+
*/
|
|
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;
|
|
368
437
|
/**
|
|
369
438
|
* Hash UUID to numeric ID for backward compatibility
|
|
370
439
|
* Converts UUID string to a consistent numeric ID for legacy code
|
|
@@ -1075,4 +1144,4 @@ declare class TenantRegisterDialogComponent {
|
|
|
1075
1144
|
}
|
|
1076
1145
|
|
|
1077
1146
|
export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, NgxStoneScriptPhpClientModule, ProviderRegistryService, RegisterComponent, SigninStatusService, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus };
|
|
1078
|
-
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 };
|