@edsis/angular 22.0.91 → 22.1.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.
@@ -46,6 +46,9 @@ interface EdsisAuthMessages {
46
46
  readonly signInAria: string;
47
47
  /** Status di halaman login selama full-page redirect ke Google berlangsung. */
48
48
  readonly googleRedirecting: string;
49
+ readonly gatewayStartFailed: string;
50
+ readonly gatewayHandoffInProgress: string;
51
+ readonly gatewaySessionMissing: string;
49
52
  readonly nativeSignInInProgress: string;
50
53
  readonly nativeSignInUnavailable: string;
51
54
  readonly nativeSignInFailed: string;
@@ -94,6 +97,8 @@ type EdsisAuthMessagesOverride = {
94
97
  declare const EDSIS_AUTH_MESSAGES: InjectionToken<EdsisAuthMessages>;
95
98
  declare function mergeEdsisAuthMessages(override?: EdsisAuthMessagesOverride): EdsisAuthMessages;
96
99
 
100
+ declare const GOOGLE_AUTH_GATEWAY_DEFAULT_START_ENDPOINT: "/v1/auth/google/start";
101
+ declare const GOOGLE_AUTH_GATEWAY_DEFAULT_HANDOFF_ENDPOINT: "/v1/auth/google/handoff";
97
102
  /**
98
103
  * Path route callback Google di dalam `authRoutes`; juga menjadi sumber
99
104
  * derivasi `redirectUri` (`${appUrl}/auth/google/callback`), sehingga URL yang
@@ -114,10 +119,12 @@ interface EdsisAuthHealthCheckConfig {
114
119
  }
115
120
  /**
116
121
  * Google Sign-In dengan authorization-code flow. Exchange code dilakukan
117
- * backend (`POST {apiUrl}/auth/google`) sehingga client secret tidak pernah
122
+ * backend (`POST {apiUrl}/v1/auth/google`) sehingga client secret tidak pernah
118
123
  * menyentuh frontend.
119
124
  */
120
- interface EdsisAuthGoogleOauthConfig {
125
+ interface EdsisAuthGoogleDirectOauthConfig {
126
+ /** Optional for backward compatibility; omitting it selects direct mode. */
127
+ mode?: 'direct';
121
128
  /**
122
129
  * OAuth 2.0 client ID dari Google Cloud Console. String kosong dianggap
123
130
  * tidak dikonfigurasi (tombol Google tetap placeholder), sehingga aman
@@ -125,6 +132,30 @@ interface EdsisAuthGoogleOauthConfig {
125
132
  */
126
133
  clientId: string;
127
134
  }
135
+ interface EdsisAuthGoogleGatewayEndpointsConfig {
136
+ /**
137
+ * Base URL Auth Gateway. Default `apiUrl`; jika diisi, origin-nya wajib
138
+ * sama dengan `apiUrl` agar seluruh cookie/session auth tetap satu origin.
139
+ */
140
+ baseUrl?: string;
141
+ /** Default `/v1/auth/google/start`; harus path relatif terhadap `baseUrl`. */
142
+ startEndpoint?: string;
143
+ /** Default `/v1/auth/google/handoff`; harus path relatif terhadap `baseUrl`. */
144
+ handoffEndpoint?: string;
145
+ }
146
+ /**
147
+ * Google Sign-In terpusat untuk MFE. Gateway memiliki konfigurasi Google dan
148
+ * refresh cookie; MFE hanya memiliki ID allowlist dan PKCE verifier sekali pakai.
149
+ */
150
+ interface EdsisAuthGoogleGatewayOauthConfig {
151
+ mode: 'gateway';
152
+ /** ID lower-kebab-case yang terdaftar bersama return URL pada Auth Gateway. */
153
+ mfeId: string;
154
+ /** Optional jika Gateway memakai base URL dan endpoint auth standar dari `apiUrl`. */
155
+ gateway?: EdsisAuthGoogleGatewayEndpointsConfig;
156
+ }
157
+ /** `{ clientId }` lama tetap memilih direct mode tanpa perubahan konsumer. */
158
+ type EdsisAuthGoogleOauthConfig = EdsisAuthGoogleDirectOauthConfig | EdsisAuthGoogleGatewayOauthConfig;
128
159
  interface EdsisAuthNativeGoogleConfig {
129
160
  /** Default `true` saat blok konfigurasi ini diberikan. */
130
161
  enabled?: boolean;
@@ -152,9 +183,9 @@ interface EdsisAuthConfig {
152
183
  httpInterceptors?: readonly HttpInterceptorFn[];
153
184
  healthCheck?: EdsisAuthHealthCheckConfig;
154
185
  /**
155
- * Provider OAuth di halaman login (saat ini hanya Google). `redirectUri`
156
- * tidak dikonfigurasi konsumer; library menurunkannya dari `appUrl`:
157
- * `${appUrl}/auth/google/callback`.
186
+ * Provider OAuth di halaman login (saat ini hanya Google). Callback direct
187
+ * maupun Gateway tidak dikonfigurasi konsumer; library menurunkannya dari
188
+ * `appUrl` sebagai `${appUrl}/auth/google/callback`.
158
189
  */
159
190
  oauth?: EdsisAuthOauthConfig;
160
191
  }
@@ -163,11 +194,24 @@ interface ResolvedEdsisAuthHealthCheck {
163
194
  url: string;
164
195
  timeoutMs: number;
165
196
  }
166
- interface ResolvedEdsisAuthGoogleOauth {
197
+ interface ResolvedEdsisAuthGoogleDirectOauth {
198
+ mode: 'direct';
167
199
  clientId: string;
168
200
  /** Diturunkan dari `appUrl`: `${appUrl}/auth/google/callback`. */
169
201
  redirectUri: string;
170
202
  }
203
+ interface ResolvedEdsisAuthGoogleGatewayOauth {
204
+ mode: 'gateway';
205
+ mfeId: string;
206
+ /** Callback MFE exact yang didaftarkan pada allowlist Gateway. */
207
+ returnUrl: string;
208
+ gateway: {
209
+ baseUrl: string;
210
+ startUrl: string;
211
+ handoffUrl: string;
212
+ };
213
+ }
214
+ type ResolvedEdsisAuthGoogleOauth = ResolvedEdsisAuthGoogleDirectOauth | ResolvedEdsisAuthGoogleGatewayOauth;
171
215
  interface ResolvedEdsisAuthOauth {
172
216
  /** `null` saat Google Sign-In tidak dikonfigurasi (perilaku placeholder lama). */
173
217
  google: ResolvedEdsisAuthGoogleOauth | null;
@@ -278,6 +322,47 @@ declare class NativeGoogleAuthService {
278
322
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<NativeGoogleAuthService>;
279
323
  }
280
324
 
325
+ declare const GOOGLE_GATEWAY_SESSION_STORAGE_KEY = "auth-google-gateway-session";
326
+ declare const GOOGLE_GATEWAY_SESSION_VERSION: 1;
327
+ interface GoogleGatewaySession {
328
+ readonly version: typeof GOOGLE_GATEWAY_SESSION_VERSION;
329
+ readonly mfeId: string;
330
+ readonly returnUrl: string;
331
+ readonly codeVerifier: string;
332
+ readonly expiresAt: number;
333
+ }
334
+ interface GoogleGatewaySessionExpectation {
335
+ readonly mfeId: string;
336
+ readonly returnUrl: string;
337
+ readonly now?: number;
338
+ }
339
+ /** RFC 7636 verifier with 256 bits of entropy and no persisted token material. */
340
+ declare function createGooglePkceVerifier(windowRef: Window): string;
341
+ /** RFC 7636 S256 challenge for the verifier retained in the one-time session. */
342
+ declare function createGooglePkceChallenge(windowRef: Window, codeVerifier: string): Promise<string>;
343
+ /** Stores only the verifier and short-lived correlation metadata. */
344
+ declare function storeGoogleGatewaySession(documentRef: Document, session: GoogleGatewaySession): void;
345
+ declare function clearGoogleGatewaySession(documentRef: Document): void;
346
+ /**
347
+ * Consumes the PKCE session exactly once. Malformed, expired, or cross-MFE
348
+ * records fail closed after removal so they cannot be replayed.
349
+ */
350
+ declare function consumeGoogleGatewaySession(documentRef: Document, expected: GoogleGatewaySessionExpectation): GoogleGatewaySession | null;
351
+
352
+ /** HTTP client for the central Google Auth Gateway mode. */
353
+ declare class GoogleGatewayAuthService {
354
+ private readonly config;
355
+ private readonly documentRef;
356
+ private readonly http;
357
+ start(): Promise<string>;
358
+ consumeSession(): GoogleGatewaySession | null;
359
+ exchangeHandoff(handoffCode: string, session: GoogleGatewaySession): Promise<unknown>;
360
+ private requireGatewayConfig;
361
+ private requireWindow;
362
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<GoogleGatewayAuthService, never>;
363
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<GoogleGatewayAuthService>;
364
+ }
365
+
281
366
  declare const GOOGLE_OAUTH_STATE_STORAGE_KEY = "auth-google-state";
282
367
  declare const GOOGLE_OAUTH_AUTHORIZE_URL = "https://accounts.google.com/o/oauth2/v2/auth";
283
368
  interface GoogleAuthorizeUrlOptions {
@@ -319,6 +404,7 @@ declare class AuthGoogleCallbackPage {
319
404
  private readonly authSessionService;
320
405
  private readonly authService;
321
406
  private readonly authConfig;
407
+ private readonly googleGateway;
322
408
  protected readonly messages: _edsis_angular_module_auth.EdsisAuthMessages;
323
409
  protected readonly loginPath: `/${string}`;
324
410
  protected readonly authenticatedHomePath: `/${string}`;
@@ -328,7 +414,10 @@ declare class AuthGoogleCallbackPage {
328
414
  constructor();
329
415
  private handleCallback;
330
416
  private clearCallbackParamsFromAddressBar;
331
- private exchange;
417
+ private exchangeDirectCode;
418
+ private exchangeGatewayHandoff;
419
+ private complete;
420
+ private callbackErrorMessage;
332
421
  private fail;
333
422
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthGoogleCallbackPage, never>;
334
423
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AuthGoogleCallbackPage, "AuthGoogleCallbackPage", never, {}, {}, never, never, true, never>;
@@ -361,6 +450,7 @@ declare class AuthLoginPage {
361
450
  private readonly injector;
362
451
  private readonly authMagicLinkService;
363
452
  private readonly authConfig;
453
+ private readonly googleGateway;
364
454
  private readonly nativeGoogle;
365
455
  private readonly router;
366
456
  protected readonly messages: _edsis_angular_module_auth.EdsisAuthMessages;
@@ -393,6 +483,7 @@ declare class AuthLoginPage {
393
483
  protected readonly emailFieldClasses: _angular_core.Signal<"flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base!" | "flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base! border-destructive focus-within:border-destructive focus-within:ring-destructive/20" | "flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base! border-emerald-500 focus-within:border-emerald-500 focus-within:ring-emerald-500/20">;
394
484
  protected retryHealth(): void;
395
485
  protected signInWithGoogle(): void;
486
+ private signInWithGatewayGoogle;
396
487
  private signInWithNativeGoogle;
397
488
  protected redirectTo(url: string): void;
398
489
  protected submit(): Promise<void>;
@@ -441,5 +532,5 @@ declare class AuthVerifyPage {
441
532
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<AuthVerifyPage, "edsis-auth-verify-page", never, { "token": { "alias": "token"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
442
533
  }
443
534
 
444
- export { AuthGoogleCallbackPage, AuthLoginPage, AuthLogoutPage, AuthService, AuthShellPage, AuthVerifyPage, DEFAULT_EDSIS_AUTH_MESSAGES, EDSIS_AUTH_CONFIG, EDSIS_AUTH_MESSAGES, EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER, EDSIS_SKIP_AUTH, GOOGLE_OAUTH_AUTHORIZE_URL, GOOGLE_OAUTH_CALLBACK_ROUTE_PATH, GOOGLE_OAUTH_STATE_STORAGE_KEY, NativeGoogleAuthService, TauriNativeGoogleAuthAdapter, authRoutes, authenticatedGuard, buildGoogleAuthorizeUrl, consumeGoogleOauthState, createGoogleOauthState, edsisAuthInterceptor, guestOnlyGuard, homeRedirectGuard, isNativeGoogleSignInResult, mergeEdsisAuthMessages, provideEdsisAuth, resolveEdsisAuthConfig, setAuthNotificationBadge, storeGoogleOauthState };
445
- export type { AuthUser, EdsisAuthConfig, EdsisAuthGoogleOauthConfig, EdsisAuthHealthCheckConfig, EdsisAuthMessages, EdsisAuthMessagesOverride, EdsisAuthNativeGoogleConfig, EdsisAuthOauthConfig, EdsisNativeGoogleAuthAdapter, GoogleAuthorizeUrlOptions, NativeGooglePlatform, NativeGoogleSignInResult, ResolvedEdsisAuthConfig, ResolvedEdsisAuthGoogleOauth, ResolvedEdsisAuthHealthCheck, ResolvedEdsisAuthOauth };
535
+ export { AuthGoogleCallbackPage, AuthLoginPage, AuthLogoutPage, AuthService, AuthShellPage, AuthVerifyPage, DEFAULT_EDSIS_AUTH_MESSAGES, EDSIS_AUTH_CONFIG, EDSIS_AUTH_MESSAGES, EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER, EDSIS_SKIP_AUTH, GOOGLE_AUTH_GATEWAY_DEFAULT_HANDOFF_ENDPOINT, GOOGLE_AUTH_GATEWAY_DEFAULT_START_ENDPOINT, GOOGLE_GATEWAY_SESSION_STORAGE_KEY, GOOGLE_GATEWAY_SESSION_VERSION, GOOGLE_OAUTH_AUTHORIZE_URL, GOOGLE_OAUTH_CALLBACK_ROUTE_PATH, GOOGLE_OAUTH_STATE_STORAGE_KEY, GoogleGatewayAuthService, NativeGoogleAuthService, TauriNativeGoogleAuthAdapter, authRoutes, authenticatedGuard, buildGoogleAuthorizeUrl, clearGoogleGatewaySession, consumeGoogleGatewaySession, consumeGoogleOauthState, createGoogleOauthState, createGooglePkceChallenge, createGooglePkceVerifier, edsisAuthInterceptor, guestOnlyGuard, homeRedirectGuard, isNativeGoogleSignInResult, mergeEdsisAuthMessages, provideEdsisAuth, resolveEdsisAuthConfig, setAuthNotificationBadge, storeGoogleGatewaySession, storeGoogleOauthState };
536
+ export type { AuthUser, EdsisAuthConfig, EdsisAuthGoogleDirectOauthConfig, EdsisAuthGoogleGatewayEndpointsConfig, EdsisAuthGoogleGatewayOauthConfig, EdsisAuthGoogleOauthConfig, EdsisAuthHealthCheckConfig, EdsisAuthMessages, EdsisAuthMessagesOverride, EdsisAuthNativeGoogleConfig, EdsisAuthOauthConfig, EdsisNativeGoogleAuthAdapter, GoogleAuthorizeUrlOptions, GoogleGatewaySession, GoogleGatewaySessionExpectation, NativeGooglePlatform, NativeGoogleSignInResult, ResolvedEdsisAuthConfig, ResolvedEdsisAuthGoogleDirectOauth, ResolvedEdsisAuthGoogleGatewayOauth, ResolvedEdsisAuthGoogleOauth, ResolvedEdsisAuthHealthCheck, ResolvedEdsisAuthOauth };
@@ -0,0 +1,126 @@
1
+ import { InjectionToken, EnvironmentProviders } from '@angular/core';
2
+ import { AppPreferencesDefaults } from '@edsis/angular/block/themes';
3
+ import { EdsisAuthConfig } from '@edsis/angular/module/auth';
4
+ import { EdsisRuntimeConfig } from '@edsis/angular/services/runtime';
5
+ import { Routes } from '@angular/router';
6
+ import { NavigationItem } from '@edsis/navigation';
7
+
8
+ declare const APPLICATION_PROFILE_NAMES: readonly ["mfe-standalone"];
9
+ declare const DEFAULT_APPLICATION_PROFILE_NAME: "mfe-standalone";
10
+ type ApplicationProfileName = (typeof APPLICATION_PROFILE_NAMES)[number];
11
+
12
+ /** Centrally managed visual and structural defaults for a standalone MFE. */
13
+ interface ApplicationProfile {
14
+ readonly name: ApplicationProfileName;
15
+ readonly defaults: AppPreferencesDefaults;
16
+ }
17
+ declare const MFE_STANDALONE_APPLICATION_PROFILE: ApplicationProfile;
18
+ declare const APPLICATION_PROFILES: Readonly<{
19
+ 'mfe-standalone': ApplicationProfile;
20
+ }>;
21
+ declare const MFE_APPLICATION_PROFILE: InjectionToken<ApplicationProfile>;
22
+ interface StandaloneMfeConfig {
23
+ readonly auth: EdsisAuthConfig;
24
+ readonly runtime?: EdsisRuntimeConfig;
25
+ /** Exact registry field; MFEs cannot invent per-app global profiles. */
26
+ readonly standaloneProfile: ApplicationProfileName;
27
+ }
28
+ declare function applicationProfile(name?: ApplicationProfileName): ApplicationProfile;
29
+ /**
30
+ * Composes the global providers used only by a standalone MFE application.
31
+ * Federated feature routes must inherit these singletons from their host and
32
+ * therefore must never call this provider.
33
+ */
34
+ declare function provideStandaloneMfe(config: StandaloneMfeConfig): EnvironmentProviders;
35
+
36
+ declare const MFE_CONTRACT_VERSION: 1;
37
+ declare const MFE_ENTRY_EXPOSURE: "./Mfe";
38
+ declare const MFE_EXPOSURE_KINDS: readonly ["contract", "routes", "page", "component"];
39
+ declare const MFE_CAPABILITY_MODES: readonly ["required", "optional", "provided"];
40
+ declare const MFE_PLATFORM_CAPABILITIES: {
41
+ readonly auth: "edsis.auth";
42
+ readonly loading: "edsis.loading";
43
+ readonly navigation: "edsis.navigation";
44
+ readonly runtime: "edsis.runtime";
45
+ readonly theme: "edsis.theme";
46
+ };
47
+ type MfeContractVersion = typeof MFE_CONTRACT_VERSION;
48
+ type MfeExposureKind = (typeof MFE_EXPOSURE_KINDS)[number];
49
+ type MfeCapabilityMode = (typeof MFE_CAPABILITY_MODES)[number];
50
+ type MfeId = string;
51
+ type MfeExposureKey = `./${string}`;
52
+ type MfeCapabilityId = string;
53
+ /** A host capability consumed or supplied by the MFE contract. */
54
+ interface MfeCapabilityDescriptor {
55
+ readonly id: MfeCapabilityId;
56
+ /** Capability compatibility is versioned by a positive major number. */
57
+ readonly version: number;
58
+ readonly mode: MfeCapabilityMode;
59
+ readonly description?: string;
60
+ }
61
+ /** Metadata for every module exposed in the remote federation configuration. */
62
+ interface MfeExposureDescriptor {
63
+ readonly key: MfeExposureKey;
64
+ readonly kind: MfeExposureKind;
65
+ /** Contract major in which this exposure became public. */
66
+ readonly since: MfeContractVersion;
67
+ /** Export to read from the loaded module. Omit for its default export. */
68
+ readonly exportName?: string;
69
+ /** Capability IDs associated with this exposure when it is rendered directly. */
70
+ readonly capabilities?: readonly MfeCapabilityId[];
71
+ readonly description?: string;
72
+ }
73
+ /**
74
+ * Public, shell-free contract exposed from `./Mfe` by every EDSIS remote.
75
+ *
76
+ * The host owns global shell, theme, authentication, navigation state, runtime,
77
+ * and loading services. The remote contributes only feature routes,
78
+ * navigation metadata, capabilities, and optional direct exposures.
79
+ */
80
+ interface MfeContractV1 {
81
+ readonly contractVersion: MfeContractVersion;
82
+ readonly id: MfeId;
83
+ readonly displayName: string;
84
+ readonly featureRoutes: Routes;
85
+ readonly navigation: readonly NavigationItem[];
86
+ readonly capabilities: readonly MfeCapabilityDescriptor[];
87
+ readonly exposures: readonly MfeExposureDescriptor[];
88
+ }
89
+ type MfeContract = MfeContractV1;
90
+ type MfeContractIssueCode = 'duplicate_capability' | 'duplicate_exposure' | 'invalid_capability' | 'invalid_contract' | 'invalid_exposure' | 'invalid_id' | 'invalid_navigation' | 'invalid_routes' | 'missing_entry_exposure' | 'unknown_capability' | 'unsupported_version';
91
+ interface MfeContractIssue {
92
+ readonly code: MfeContractIssueCode;
93
+ readonly path: string;
94
+ readonly message: string;
95
+ }
96
+ /** Host-side registry expectations applied after the remote shape is trusted. */
97
+ interface MfeContractExpectation {
98
+ readonly id: string;
99
+ readonly supportedContractVersions: readonly number[];
100
+ }
101
+ type MfeContractValidationResult = {
102
+ readonly valid: true;
103
+ readonly contract: MfeContract;
104
+ readonly issues: readonly [];
105
+ } | {
106
+ readonly valid: false;
107
+ readonly issues: readonly MfeContractIssue[];
108
+ };
109
+ declare class MfeContractValidationError extends Error {
110
+ readonly issues: readonly MfeContractIssue[];
111
+ constructor(issuesOrMessage: readonly MfeContractIssue[] | string);
112
+ }
113
+ /** Keeps literal inference while rejecting an invalid contract during remote evaluation. */
114
+ declare function defineMfe<const Contract extends MfeContractV1>(contract: Contract): Contract;
115
+ declare function isMfeContract(value: unknown): value is MfeContract;
116
+ declare function assertMfeContract(value: unknown): asserts value is MfeContract;
117
+ /**
118
+ * Reads the exact named `mfe` export from an untrusted federation namespace.
119
+ * Shape validation runs before registry identity and supported-major checks.
120
+ */
121
+ declare function readMfeContract(remoteModule: unknown, expectation: MfeContractExpectation): MfeContractV1;
122
+ /** Validates an untrusted remote value before the host reads routes or exposures from it. */
123
+ declare function validateMfeContract(value: unknown): MfeContractValidationResult;
124
+
125
+ export { APPLICATION_PROFILES, APPLICATION_PROFILE_NAMES, DEFAULT_APPLICATION_PROFILE_NAME, MFE_APPLICATION_PROFILE, MFE_CAPABILITY_MODES, MFE_CONTRACT_VERSION, MFE_ENTRY_EXPOSURE, MFE_EXPOSURE_KINDS, MFE_PLATFORM_CAPABILITIES, MFE_STANDALONE_APPLICATION_PROFILE, MfeContractValidationError, applicationProfile, assertMfeContract, defineMfe, isMfeContract, provideStandaloneMfe, readMfeContract, validateMfeContract };
126
+ export type { ApplicationProfile, ApplicationProfileName, MfeCapabilityDescriptor, MfeCapabilityId, MfeCapabilityMode, MfeContract, MfeContractExpectation, MfeContractIssue, MfeContractIssueCode, MfeContractV1, MfeContractValidationResult, MfeContractVersion, MfeExposureDescriptor, MfeExposureKey, MfeExposureKind, MfeId, StandaloneMfeConfig };