@mintplayer/ng-spark 22.30.0 → 22.31.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.
Files changed (82) hide show
  1. package/README.md +2 -2
  2. package/auth/README.md +216 -0
  3. package/fesm2022/mintplayer-ng-spark-auth-account.mjs +2023 -0
  4. package/fesm2022/mintplayer-ng-spark-auth-account.mjs.map +1 -0
  5. package/fesm2022/mintplayer-ng-spark-auth-auth-bar.mjs +96 -0
  6. package/fesm2022/mintplayer-ng-spark-auth-auth-bar.mjs.map +1 -0
  7. package/fesm2022/mintplayer-ng-spark-auth-confirm-email.mjs +200 -0
  8. package/fesm2022/mintplayer-ng-spark-auth-confirm-email.mjs.map +1 -0
  9. package/fesm2022/mintplayer-ng-spark-auth-core.mjs +452 -0
  10. package/fesm2022/mintplayer-ng-spark-auth-core.mjs.map +1 -0
  11. package/fesm2022/mintplayer-ng-spark-auth-external-login.mjs +201 -0
  12. package/fesm2022/mintplayer-ng-spark-auth-external-login.mjs.map +1 -0
  13. package/fesm2022/mintplayer-ng-spark-auth-forgot-password.mjs +196 -0
  14. package/fesm2022/mintplayer-ng-spark-auth-forgot-password.mjs.map +1 -0
  15. package/fesm2022/mintplayer-ng-spark-auth-guards.mjs +16 -0
  16. package/fesm2022/mintplayer-ng-spark-auth-guards.mjs.map +1 -0
  17. package/fesm2022/mintplayer-ng-spark-auth-interceptors.mjs +18 -0
  18. package/fesm2022/mintplayer-ng-spark-auth-interceptors.mjs.map +1 -0
  19. package/fesm2022/mintplayer-ng-spark-auth-login.mjs +282 -0
  20. package/fesm2022/mintplayer-ng-spark-auth-login.mjs.map +1 -0
  21. package/fesm2022/mintplayer-ng-spark-auth-models.mjs +114 -0
  22. package/fesm2022/mintplayer-ng-spark-auth-models.mjs.map +1 -0
  23. package/fesm2022/mintplayer-ng-spark-auth-pipes.mjs +43 -0
  24. package/fesm2022/mintplayer-ng-spark-auth-pipes.mjs.map +1 -0
  25. package/fesm2022/mintplayer-ng-spark-auth-register.mjs +216 -0
  26. package/fesm2022/mintplayer-ng-spark-auth-register.mjs.map +1 -0
  27. package/fesm2022/mintplayer-ng-spark-auth-reset-password.mjs +223 -0
  28. package/fesm2022/mintplayer-ng-spark-auth-reset-password.mjs.map +1 -0
  29. package/fesm2022/mintplayer-ng-spark-auth-routes.mjs +194 -0
  30. package/fesm2022/mintplayer-ng-spark-auth-routes.mjs.map +1 -0
  31. package/fesm2022/mintplayer-ng-spark-auth-sign-in.mjs +210 -0
  32. package/fesm2022/mintplayer-ng-spark-auth-sign-in.mjs.map +1 -0
  33. package/fesm2022/mintplayer-ng-spark-auth-two-factor.mjs +218 -0
  34. package/fesm2022/mintplayer-ng-spark-auth-two-factor.mjs.map +1 -0
  35. package/fesm2022/mintplayer-ng-spark-auth.mjs +48 -0
  36. package/fesm2022/mintplayer-ng-spark-auth.mjs.map +1 -0
  37. package/fesm2022/mintplayer-ng-spark-client-operations.mjs +294 -2
  38. package/fesm2022/mintplayer-ng-spark-client-operations.mjs.map +1 -1
  39. package/fesm2022/mintplayer-ng-spark-identity-provider-connected-applications.mjs +389 -0
  40. package/fesm2022/mintplayer-ng-spark-identity-provider-connected-applications.mjs.map +1 -0
  41. package/fesm2022/mintplayer-ng-spark-identity-provider-core.mjs +204 -0
  42. package/fesm2022/mintplayer-ng-spark-identity-provider-core.mjs.map +1 -0
  43. package/fesm2022/mintplayer-ng-spark-identity-provider-developers.mjs +486 -0
  44. package/fesm2022/mintplayer-ng-spark-identity-provider-developers.mjs.map +1 -0
  45. package/fesm2022/mintplayer-ng-spark-identity-provider-management.mjs +350 -0
  46. package/fesm2022/mintplayer-ng-spark-identity-provider-management.mjs.map +1 -0
  47. package/fesm2022/mintplayer-ng-spark-identity-provider.mjs +66 -0
  48. package/fesm2022/mintplayer-ng-spark-identity-provider.mjs.map +1 -0
  49. package/fesm2022/mintplayer-ng-spark-pwa.mjs +162 -0
  50. package/fesm2022/mintplayer-ng-spark-pwa.mjs.map +1 -0
  51. package/fesm2022/mintplayer-ng-spark-services.mjs +11 -1
  52. package/fesm2022/mintplayer-ng-spark-services.mjs.map +1 -1
  53. package/fesm2022/mintplayer-ng-spark-shell.mjs.map +1 -1
  54. package/fesm2022/mintplayer-ng-spark.mjs.map +1 -1
  55. package/package.json +99 -1
  56. package/types/mintplayer-ng-spark-auth-account.d.ts +255 -0
  57. package/types/mintplayer-ng-spark-auth-auth-bar.d.ts +22 -0
  58. package/types/mintplayer-ng-spark-auth-confirm-email.d.ts +21 -0
  59. package/types/mintplayer-ng-spark-auth-core.d.ts +197 -0
  60. package/types/mintplayer-ng-spark-auth-external-login.d.ts +132 -0
  61. package/types/mintplayer-ng-spark-auth-forgot-password.d.ts +18 -0
  62. package/types/mintplayer-ng-spark-auth-guards.d.ts +15 -0
  63. package/types/mintplayer-ng-spark-auth-interceptors.d.ts +2 -0
  64. package/types/mintplayer-ng-spark-auth-login.d.ts +46 -0
  65. package/types/mintplayer-ng-spark-auth-models.d.ts +489 -0
  66. package/types/mintplayer-ng-spark-auth-pipes.d.ts +8 -0
  67. package/types/mintplayer-ng-spark-auth-register.d.ts +21 -0
  68. package/types/mintplayer-ng-spark-auth-reset-password.d.ts +25 -0
  69. package/types/mintplayer-ng-spark-auth-routes.d.ts +154 -0
  70. package/types/mintplayer-ng-spark-auth-sign-in.d.ts +84 -0
  71. package/types/mintplayer-ng-spark-auth-two-factor.d.ts +23 -0
  72. package/types/mintplayer-ng-spark-auth.d.ts +24 -0
  73. package/types/mintplayer-ng-spark-client-operations.d.ts +78 -3
  74. package/types/mintplayer-ng-spark-identity-provider-connected-applications.d.ts +35 -0
  75. package/types/mintplayer-ng-spark-identity-provider-core.d.ts +144 -0
  76. package/types/mintplayer-ng-spark-identity-provider-developers.d.ts +55 -0
  77. package/types/mintplayer-ng-spark-identity-provider-management.d.ts +33 -0
  78. package/types/mintplayer-ng-spark-identity-provider.d.ts +64 -0
  79. package/types/mintplayer-ng-spark-pwa.d.ts +89 -0
  80. package/types/mintplayer-ng-spark-services.d.ts +10 -0
  81. package/types/mintplayer-ng-spark-shell.d.ts +2 -2
  82. package/types/mintplayer-ng-spark.d.ts +4 -4
@@ -0,0 +1,33 @@
1
+ import { Color } from "@mintplayer/ng-bootstrap";
2
+ import { SparkSigningKey, identityProviderQueryLink } from "@mintplayer/ng-spark/identity-provider/core";
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * The identity provider's management page (`identity-provider/admin`, PRD D9), for its
6
+ * administrators (`ManageAll/IdentityProvider`): the signing keys with a rotate-now action, and links
7
+ * to the library's queues (developer requests, scope approvals, go-live reviews) and records (grants,
8
+ * the audit trail) in the generic query page. The server answers 403 to anyone else, and the page
9
+ * then says so instead of rendering an empty administration screen.
10
+ */
11
+ export declare class SparkIdentityProviderManagementComponent {
12
+ private readonly text;
13
+ private readonly portal;
14
+ protected readonly colors: typeof Color;
15
+ protected readonly queues: {
16
+ label: string;
17
+ alias: string;
18
+ }[];
19
+ protected readonly queryLink: typeof identityProviderQueryLink;
20
+ readonly loading: import("@angular/core").WritableSignal<boolean>;
21
+ readonly busy: import("@angular/core").WritableSignal<boolean>;
22
+ readonly forbidden: import("@angular/core").WritableSignal<boolean>;
23
+ readonly keys: import("@angular/core").WritableSignal<SparkSigningKey[]>;
24
+ readonly changes: import("@angular/core").WritableSignal<string[]>;
25
+ readonly error: import("@angular/core").WritableSignal<string>;
26
+ readonly notice: import("@angular/core").WritableSignal<string>;
27
+ constructor();
28
+ load(): Promise<void>;
29
+ rotate(): Promise<void>;
30
+ protected stateColor(state: string): Color;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<SparkIdentityProviderManagementComponent, never>;
32
+ static ɵcmp: i0.ɵɵComponentDeclaration<SparkIdentityProviderManagementComponent, "spark-identity-provider-management", never, {}, {}, never, never, true, never>;
33
+ }
@@ -0,0 +1,64 @@
1
+ import { CanActivateFn } from "@angular/router";
2
+ import { SparkAccountOverviewLink, SparkAuthRouteEntry, SparkAuthRoutePaths } from "@mintplayer/ng-spark/auth/models";
3
+ import { SparkAuthRoutesFeature } from "@mintplayer/ng-spark/auth/routes";
4
+ export * from "@mintplayer/ng-spark/identity-provider/core";
5
+ type Child = SparkAuthRoutesFeature['children'][number];
6
+ /**
7
+ * One group of identity-provider pages, passed to {@link withIdentityProvider}. Produced only by
8
+ * `withConnectedApplications()`, `withDeveloperRoutes()` and `withManagementRoutes()`.
9
+ */
10
+ export interface SparkIdentityProviderRoutesFeature {
11
+ readonly children: Child[];
12
+ readonly paths: SparkAuthRoutePaths;
13
+ readonly accountLinks?: SparkAccountOverviewLink[];
14
+ }
15
+ /** Every feature's guard option: defaults to `[sparkAuthGuard]`; `[]` under an already guarded parent. */
16
+ export interface SparkIdentityProviderGuardOptions {
17
+ canActivate?: CanActivateFn[];
18
+ }
19
+ /**
20
+ * The identity provider's SPA pages (`docs/identity_provider_platform_PRD.md` D7), as one
21
+ * `sparkAuthRoutes()` feature:
22
+ *
23
+ * ```ts
24
+ * sparkAuthRoutes(
25
+ * withLocalLogin(), withAccount(),
26
+ * withIdentityProvider(withConnectedApplications(), withDeveloperRoutes(), withManagementRoutes()),
27
+ * )
28
+ * ```
29
+ *
30
+ * The sub-features merge into one feature, and each page keeps its own `import()` (its own secondary
31
+ * entry point), so a page nobody opts into is never bundled. The pages popups show (`/connect/*`:
32
+ * sign-in, consent, device, logout, error) are server-rendered and not part of this.
33
+ *
34
+ * Every path has a literal first segment, so the group neither shadows `sparkRoutes()` nor is shadowed
35
+ * by it. Apps and resources are edited in the generic `po/:type` screens (PRD Q1 = A).
36
+ */
37
+ export declare function withIdentityProvider(...features: SparkIdentityProviderRoutesFeature[]): SparkAuthRoutesFeature;
38
+ /**
39
+ * Mounts the connected-applications page (default `account/applications`, PRD D6): the applications
40
+ * the user granted access to, with whole-grant and per-scope withdrawal. Sets
41
+ * `SPARK_AUTH_ROUTE_PATHS.connectedApplications` and adds a link to the account overview.
42
+ */
43
+ export declare function withConnectedApplications(options?: SparkIdentityProviderGuardOptions & {
44
+ connectedApplications?: SparkAuthRouteEntry;
45
+ }): SparkIdentityProviderRoutesFeature;
46
+ /**
47
+ * Mounts the developer portal (PRD D2/D3): `developers` (status, terms, request, registration token)
48
+ * and `developers/invitations/:token?app=<applicationId>` (accept a team invitation; the mailed link's
49
+ * target, which the server builds from this default path). Both need a signed-in user; the guard sends
50
+ * anyone else to sign in and back.
51
+ */
52
+ export declare function withDeveloperRoutes(options?: SparkIdentityProviderGuardOptions & {
53
+ developers?: SparkAuthRouteEntry;
54
+ invitation?: SparkAuthRouteEntry;
55
+ }): SparkIdentityProviderRoutesFeature;
56
+ /**
57
+ * Mounts the management page (default `identity-provider/admin`, PRD D9): signing keys with
58
+ * rotate-now, and links to the queues (developer requests, scope approvals, go-live reviews) and
59
+ * records (applications, resources, grants, audit trail). Mount it for everyone signed in: the server
60
+ * decides who is an administrator, and the page tells anyone else they may not see it.
61
+ */
62
+ export declare function withManagementRoutes(options?: SparkIdentityProviderGuardOptions & {
63
+ identityProviderManagement?: SparkAuthRouteEntry;
64
+ }): SparkIdentityProviderRoutesFeature;
@@ -0,0 +1,89 @@
1
+ import * as i0 from "@angular/core";
2
+ import { EnvironmentProviders, InjectionToken } from "@angular/core";
3
+ import { SwRegistrationOptions } from "@angular/service-worker";
4
+ export interface SparkServiceWorkerOptions {
5
+ /** Whether the worker registers. Default: `!isDevMode()`, so only production builds register it. */
6
+ enabled?: boolean;
7
+ /** The worker script, relative to the base href. Default: `ngsw-worker.js`. */
8
+ script?: string;
9
+ /** When the worker registers. Default: `registerWhenStable:30000`. */
10
+ registrationStrategy?: SwRegistrationOptions['registrationStrategy'];
11
+ }
12
+ /**
13
+ * Registers Angular's service worker with Spark's update policy (#464, Q1b); see
14
+ * {@link SparkServiceWorkerUpdates} for what happens when a new version is deployed.
15
+ *
16
+ * The application also needs an `ngsw-config.json` with Spark's navigation exclusions and
17
+ * `serviceWorker` in its production build configuration; see `docs/guide-pwa.md`.
18
+ */
19
+ export declare function provideSparkServiceWorker(options?: SparkServiceWorkerOptions): EnvironmentProviders;
20
+ /** A service-worker version as `ngsw.json` describes it. `appData` is the config's `appData`. */
21
+ export interface SparkAppVersion {
22
+ hash: string;
23
+ appData?: Record<string, unknown>;
24
+ }
25
+ /** The two page loads the update policy performs. Replaceable for tests. */
26
+ export interface SparkPageLoader {
27
+ assign(url: string): void;
28
+ reload(): void;
29
+ }
30
+ /** How the update policy loads a page: `window.location` by default. */
31
+ export declare const SPARK_SW_PAGE_LOADER: InjectionToken<SparkPageLoader>;
32
+ /** Update-check timing. Defaults: every 6 h, and on becoming visible at most once a minute. */
33
+ export interface SparkServiceWorkerSchedule {
34
+ checkIntervalMs: number;
35
+ visibleCheckThrottleMs: number;
36
+ }
37
+ export declare const SPARK_SW_SCHEDULE: InjectionToken<SparkServiceWorkerSchedule>;
38
+ /**
39
+ * The update policy of `provideSparkServiceWorker()` (#464, Q1b).
40
+ *
41
+ * - `VERSION_READY`: the **next** router navigation becomes a full page load of its target, so the
42
+ * user lands on the page they asked for, in the new version, without losing anything on the page
43
+ * they are leaving (the navigation was leaving it anyway).
44
+ * - `unrecoverable`: the running version can no longer be served, so the page reloads at once.
45
+ * - Checks: once the application is stable, every 6 h, and when the tab becomes visible again
46
+ * (at most once a minute).
47
+ * - **A hidden tab never reloads.** Spark has no unsaved-changes tracking to consult, so a reload
48
+ * nobody is looking at could throw away an open edit. An `unrecoverable` in a hidden tab waits
49
+ * until the tab is visible; a navigation in a hidden tab stays a normal in-app navigation.
50
+ *
51
+ * Nothing happens when the service worker is disabled (development builds, unsupported browsers)
52
+ * or on the server.
53
+ */
54
+ export declare class SparkServiceWorkerUpdates {
55
+ private readonly swUpdate;
56
+ private readonly router;
57
+ private readonly location;
58
+ private readonly appRef;
59
+ private readonly document;
60
+ private readonly platformId;
61
+ private readonly destroyRef;
62
+ private readonly pageLoader;
63
+ private readonly schedule;
64
+ private readonly _updateReady;
65
+ private readonly _currentVersion;
66
+ private readonly _latestVersion;
67
+ /** True once a new version is downloaded and the next navigation will load it. */
68
+ readonly updateReady: import("@angular/core").Signal<boolean>;
69
+ /** The running version, known once an update was reported. */
70
+ readonly currentVersion: import("@angular/core").Signal<SparkAppVersion | null>;
71
+ /** The version the next navigation loads (`appData.build` is the ng-spark version). */
72
+ readonly latestVersion: import("@angular/core").Signal<SparkAppVersion | null>;
73
+ private started;
74
+ private leaving;
75
+ private reloadWhenVisible;
76
+ private lastCheck;
77
+ /** Starts the policy. Idempotent; called by the app initializer `provideSparkServiceWorker()` adds. */
78
+ start(): void;
79
+ private onVersionReady;
80
+ private onUnrecoverable;
81
+ private onNavigationStart;
82
+ private check;
83
+ private reload;
84
+ private isHidden;
85
+ private readReloadedFor;
86
+ private writeReloadedFor;
87
+ static ɵfac: i0.ɵɵFactoryDeclaration<SparkServiceWorkerUpdates, never>;
88
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
89
+ }
@@ -15,6 +15,8 @@ export declare class RetryActionService {
15
15
  export declare class SparkLanguageService {
16
16
  private readonly http;
17
17
  private readonly config;
18
+ /** Null outside a browser (server-side rendering), where there is no cookie to write. */
19
+ private readonly document;
18
20
  private readonly baseUrl;
19
21
  private readonly currentLang;
20
22
  private readonly translationsMap;
@@ -22,6 +24,14 @@ export declare class SparkLanguageService {
22
24
  readonly languages: import("@angular/core").WritableSignal<Record<string, TranslatedString>>;
23
25
  constructor();
24
26
  private loadCulture;
27
+ /**
28
+ * Mirrors the language into the `spark-lang` cookie, which the server-rendered pages read
29
+ * (`/connect/*` of the identity provider, `ConnectText.CultureCookie`): they cannot see
30
+ * localStorage, and without the cookie a sign-in popup would open in the browser's language
31
+ * rather than the one the user picked in the app. Not `HttpOnly` by nature (script writes it);
32
+ * it carries only a language code, which the server matches against its supported cultures.
33
+ */
34
+ private writeCookie;
25
35
  private loadTranslations;
26
36
  setLanguage(lang: string): void;
27
37
  resolve(ts: TranslatedString | undefined): string;
@@ -43,7 +43,7 @@ export declare class SparkShellTopbarStartDirective {
43
43
  /**
44
44
  * Topbar, trailing edge. Default: the language selector (which hides itself when the app has
45
45
  * one language). This is where an auth bar goes — the shell cannot ship one itself, since
46
- * `@mintplayer/ng-spark` does not (and must not) depend on `@mintplayer/ng-spark-auth`.
46
+ * the non-auth entry points of `@mintplayer/ng-spark` do not (and must not) import `@mintplayer/ng-spark/auth/*`.
47
47
  */
48
48
  export declare class SparkShellTopbarEndDirective {
49
49
  readonly templateRef: TemplateRef<unknown>;
@@ -320,7 +320,7 @@ export declare class SparkShellComponent {
320
320
  * instead.
321
321
  *
322
322
  * Because the response is caller-scoped it must be re-fetched when the caller changes: the
323
- * component tracks the optional `SPARK_AUTH_STATE` signal (supplied by ng-spark-auth's
323
+ * component tracks the optional `SPARK_AUTH_STATE` signal (supplied by ng-spark/auth's
324
324
  * `provideSparkAuth()`, or by the app's own auth stack) and reloads on every change. Without a
325
325
  * provider it fetches once. `reloadToken` is the manual escape hatch (any changed value triggers
326
326
  * a reload), and `reload()` the imperative one.
@@ -18,16 +18,16 @@ export declare const SPARK_CONFIG: InjectionToken<SparkConfig>;
18
18
  export declare const defaultSparkConfig: SparkConfig;
19
19
  /**
20
20
  * A signal that changes whenever the authenticated user changes — the bridge that lets ng-spark
21
- * components react to sign-in/out without a dependency on `@mintplayer/ng-spark-auth` (no
22
- * dependency exists between the two packages, in either direction, on purpose).
21
+ * components react to sign-in/out without importing `@mintplayer/ng-spark/auth/*` (the non-auth
22
+ * entry points must not import the auth ones, on purpose, so an app without auth pulls no auth code).
23
23
  *
24
- * `@mintplayer/ng-spark-auth`'s `provideSparkAuth()` supplies it from `SparkAuthService.user`;
24
+ * `@mintplayer/ng-spark/auth`'s `provideSparkAuth()` supplies it from `SparkAuthService.user`;
25
25
  * an app with its own auth stack provides any signal that changes on sign-in/out. Consumers
26
26
  * inject it `{ optional: true }` — absent, auth-sensitive data (the program-units menu) is
27
27
  * fetched once and never re-fetched.
28
28
  *
29
29
  * The signal's VALUE is deliberately opaque (`unknown`): consumers only track it for change,
30
- * never read it — what "the user" looks like belongs to the auth package.
30
+ * never read it — what "the user" looks like belongs to the auth entry points.
31
31
  */
32
32
  export declare const SPARK_AUTH_STATE: InjectionToken<Signal<unknown>>;
33
33
  export declare function provideSpark(config?: Partial<SparkConfig>): Provider[];