@sneat/app-auth 0.26.4 → 0.26.5
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/esm2022/index.js +1 -0
- package/esm2022/index.js.map +1 -1
- package/esm2022/lib/provide-sneat-firebase.js +120 -0
- package/esm2022/lib/provide-sneat-firebase.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/lib/provide-sneat-firebase.d.ts +56 -0
- package/lib/provide-sneat-firebase.d.ts.map +1 -0
- package/package.json +1 -1
- package/tsconfig.lib.tsbuildinfo +1 -1
package/esm2022/index.js
CHANGED
package/esm2022/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/app-auth/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './lib/provide-sneat-authenticated-providers';\nexport * from './lib/init-firebase';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/app-auth/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC","sourcesContent":["export * from './lib/provide-sneat-authenticated-providers';\nexport * from './lib/init-firebase';\nexport * from './lib/provide-sneat-firebase';\n"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { InjectionToken, inject, makeEnvironmentProviders, } from '@angular/core';
|
|
2
|
+
import { Capacitor } from '@capacitor/core';
|
|
3
|
+
import { initializeApp } from 'firebase/app';
|
|
4
|
+
import { getAnalytics, } from 'firebase/analytics';
|
|
5
|
+
import { connectAuthEmulator, getAuth, indexedDBLocalPersistence, initializeAuth, } from 'firebase/auth';
|
|
6
|
+
import { Firestore, connectFirestoreEmulator, getFirestore, } from 'firebase/firestore';
|
|
7
|
+
/** Re-exported so `Firestore` (a real class in the modular SDK, usable
|
|
8
|
+
* as-is as an Angular DI token) has one import source alongside the tokens
|
|
9
|
+
* below — consumers never need to reach into `firebase/firestore` directly. */
|
|
10
|
+
export { Firestore } from 'firebase/firestore';
|
|
11
|
+
/**
|
|
12
|
+
* DI token for the app's initialized `firebase/app` `FirebaseApp` instance.
|
|
13
|
+
*
|
|
14
|
+
* `FirebaseApp` is a plain interface in the modular SDK (no runtime class),
|
|
15
|
+
* so — unlike `Firestore` — it cannot be used as an injection token by
|
|
16
|
+
* itself; inject this token instead, e.g. `inject(SNEAT_FIREBASE_APP)`.
|
|
17
|
+
*/
|
|
18
|
+
export const SNEAT_FIREBASE_APP = new InjectionToken('SNEAT_FIREBASE_APP');
|
|
19
|
+
/**
|
|
20
|
+
* DI token for the app's initialized `firebase/auth` `Auth` instance.
|
|
21
|
+
* Same rationale as `SNEAT_FIREBASE_APP`: `Auth` is interface-only upstream.
|
|
22
|
+
*/
|
|
23
|
+
export const SNEAT_FIREBASE_AUTH = new InjectionToken('SNEAT_FIREBASE_AUTH');
|
|
24
|
+
/**
|
|
25
|
+
* DI token for the app's `firebase/analytics` `Analytics` instance.
|
|
26
|
+
*
|
|
27
|
+
* Resolves to `null` — never throws — when analytics isn't configured (no
|
|
28
|
+
* real `measurementId`, using the fleet's `'G-PROVIDE_IF_NEEDED'` sentinel)
|
|
29
|
+
* or when `getAnalytics()` throws in an environment that doesn't support it
|
|
30
|
+
* (SSR, some webviews, privacy-hardened browsers). The factory only runs the
|
|
31
|
+
* first time something actually injects this token, so an app that never
|
|
32
|
+
* injects it never pays for Analytics initialization at all — consumers must
|
|
33
|
+
* treat the value as optional either way.
|
|
34
|
+
*/
|
|
35
|
+
export const SNEAT_FIREBASE_ANALYTICS = new InjectionToken('SNEAT_FIREBASE_ANALYTICS');
|
|
36
|
+
function emulatorAllowed(enabled) {
|
|
37
|
+
if (!enabled)
|
|
38
|
+
return false;
|
|
39
|
+
const hostname = typeof location === 'undefined' ? '' : location.hostname;
|
|
40
|
+
if (hostname === 'localhost' || hostname === '127.0.0.1')
|
|
41
|
+
return true;
|
|
42
|
+
console.error('[provideSneatFirebase] Emulator config present on a non-localhost host ' +
|
|
43
|
+
`("${hostname || '?'}") — ignoring it.`);
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* `@angular/fire`-free replacement for `getAngularFireProviders()` (see
|
|
48
|
+
* `./init-firebase`). Initializes the firebase modular SDK directly
|
|
49
|
+
* (`initializeApp`/`getFirestore`/`getAuth`/`getAnalytics`) and provides
|
|
50
|
+
* `FirebaseApp`, `Firestore`, `Auth`, and `Analytics` through Angular DI —
|
|
51
|
+
* `inject(Firestore)`, `inject(SNEAT_FIREBASE_AUTH)`, etc. — with no
|
|
52
|
+
* `@angular/fire` import anywhere in this file or its call graph.
|
|
53
|
+
*
|
|
54
|
+
* Emulator wiring (`connectFirestoreEmulator`/`connectAuthEmulator`) mirrors
|
|
55
|
+
* `getAngularFireProviders()` exactly, including the Capacitor native-vs-web
|
|
56
|
+
* Auth persistence split and the firestore-emulator-over-443 SSL flag flip.
|
|
57
|
+
*
|
|
58
|
+
* NOT YET wired into `provideSneatAuthenticatedProviders()` / the fleet's
|
|
59
|
+
* bootstrap chain. sneat-libs' own internals (`SneatAuthStateService`,
|
|
60
|
+
* `FirebaseSneatApiAuthAdapter`, the analytics fan-out, …) still depend on
|
|
61
|
+
* `@angular/fire`'s `Auth`/`Firestore`/`Analytics` tokens, and cutting them
|
|
62
|
+
* over is a separate, larger pass — see the Step 1 PR description. This
|
|
63
|
+
* function exists standalone so it can be adopted incrementally, and so its
|
|
64
|
+
* own DI wiring is exercised and tested ahead of that cutover.
|
|
65
|
+
*/
|
|
66
|
+
export function provideSneatFirebase(firebaseConfig) {
|
|
67
|
+
return makeEnvironmentProviders([
|
|
68
|
+
{
|
|
69
|
+
provide: SNEAT_FIREBASE_APP,
|
|
70
|
+
useFactory: () => initializeApp(firebaseConfig),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
provide: Firestore,
|
|
74
|
+
useFactory: () => {
|
|
75
|
+
const app = inject(SNEAT_FIREBASE_APP);
|
|
76
|
+
const firestore = getFirestore(app);
|
|
77
|
+
const emulator = firebaseConfig.emulator;
|
|
78
|
+
if (emulator && emulatorAllowed(true)) {
|
|
79
|
+
connectFirestoreEmulator(firestore, emulator.firestoreHost || '127.0.0.1', emulator.firestorePort);
|
|
80
|
+
if (emulator.firestorePort === 443) {
|
|
81
|
+
firestore._settings.ssl = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return firestore;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
provide: SNEAT_FIREBASE_AUTH,
|
|
89
|
+
useFactory: () => {
|
|
90
|
+
const app = inject(SNEAT_FIREBASE_APP);
|
|
91
|
+
const auth = Capacitor.isNativePlatform()
|
|
92
|
+
? initializeAuth(app, { persistence: indexedDBLocalPersistence })
|
|
93
|
+
: getAuth(app);
|
|
94
|
+
const emulator = firebaseConfig.emulator;
|
|
95
|
+
if (emulator?.authPort && emulatorAllowed(true)) {
|
|
96
|
+
connectAuthEmulator(auth, `${emulator.authPort === 443 ? 'https' : 'http'}://${emulator.authHost || '127.0.0.1'}:${emulator.authPort}`);
|
|
97
|
+
}
|
|
98
|
+
return auth;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
provide: SNEAT_FIREBASE_ANALYTICS,
|
|
103
|
+
useFactory: () => {
|
|
104
|
+
if (!firebaseConfig.measurementId ||
|
|
105
|
+
firebaseConfig.measurementId === 'G-PROVIDE_IF_NEEDED') {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const app = inject(SNEAT_FIREBASE_APP);
|
|
110
|
+
return getAnalytics(app);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error('[provideSneatFirebase] getAnalytics() failed — continuing without analytics.', error);
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=provide-sneat-firebase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provide-sneat-firebase.js","sourceRoot":"","sources":["../../../../../libs/app-auth/src/lib/provide-sneat-firebase.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n EnvironmentProviders,\n InjectionToken,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport { Capacitor } from '@capacitor/core';\nimport { IFirebaseConfig } from '@sneat/core';\nimport { FirebaseApp, initializeApp } from 'firebase/app';\nimport {\n Analytics,\n getAnalytics,\n} from 'firebase/analytics';\nimport {\n Auth,\n connectAuthEmulator,\n getAuth,\n indexedDBLocalPersistence,\n initializeAuth,\n} from 'firebase/auth';\nimport {\n Firestore,\n connectFirestoreEmulator,\n getFirestore,\n} from 'firebase/firestore';\n\n/** Re-exported so `Firestore` (a real class in the modular SDK, usable\n * as-is as an Angular DI token) has one import source alongside the tokens\n * below — consumers never need to reach into `firebase/firestore` directly. */\nexport { Firestore } from 'firebase/firestore';\n\n/**\n * DI token for the app's initialized `firebase/app` `FirebaseApp` instance.\n *\n * `FirebaseApp` is a plain interface in the modular SDK (no runtime class),\n * so — unlike `Firestore` — it cannot be used as an injection token by\n * itself; inject this token instead, e.g. `inject(SNEAT_FIREBASE_APP)`.\n */\nexport const SNEAT_FIREBASE_APP = new InjectionToken<FirebaseApp>(\n 'SNEAT_FIREBASE_APP',\n);\n\n/**\n * DI token for the app's initialized `firebase/auth` `Auth` instance.\n * Same rationale as `SNEAT_FIREBASE_APP`: `Auth` is interface-only upstream.\n */\nexport const SNEAT_FIREBASE_AUTH = new InjectionToken<Auth>(\n 'SNEAT_FIREBASE_AUTH',\n);\n\n/**\n * DI token for the app's `firebase/analytics` `Analytics` instance.\n *\n * Resolves to `null` — never throws — when analytics isn't configured (no\n * real `measurementId`, using the fleet's `'G-PROVIDE_IF_NEEDED'` sentinel)\n * or when `getAnalytics()` throws in an environment that doesn't support it\n * (SSR, some webviews, privacy-hardened browsers). The factory only runs the\n * first time something actually injects this token, so an app that never\n * injects it never pays for Analytics initialization at all — consumers must\n * treat the value as optional either way.\n */\nexport const SNEAT_FIREBASE_ANALYTICS = new InjectionToken<Analytics | null>(\n 'SNEAT_FIREBASE_ANALYTICS',\n);\n\nfunction emulatorAllowed(enabled: boolean): boolean {\n if (!enabled) return false;\n const hostname = typeof location === 'undefined' ? '' : location.hostname;\n if (hostname === 'localhost' || hostname === '127.0.0.1') return true;\n console.error(\n '[provideSneatFirebase] Emulator config present on a non-localhost host ' +\n `(\"${hostname || '?'}\") — ignoring it.`,\n );\n return false;\n}\n\n/**\n * `@angular/fire`-free replacement for `getAngularFireProviders()` (see\n * `./init-firebase`). Initializes the firebase modular SDK directly\n * (`initializeApp`/`getFirestore`/`getAuth`/`getAnalytics`) and provides\n * `FirebaseApp`, `Firestore`, `Auth`, and `Analytics` through Angular DI —\n * `inject(Firestore)`, `inject(SNEAT_FIREBASE_AUTH)`, etc. — with no\n * `@angular/fire` import anywhere in this file or its call graph.\n *\n * Emulator wiring (`connectFirestoreEmulator`/`connectAuthEmulator`) mirrors\n * `getAngularFireProviders()` exactly, including the Capacitor native-vs-web\n * Auth persistence split and the firestore-emulator-over-443 SSL flag flip.\n *\n * NOT YET wired into `provideSneatAuthenticatedProviders()` / the fleet's\n * bootstrap chain. sneat-libs' own internals (`SneatAuthStateService`,\n * `FirebaseSneatApiAuthAdapter`, the analytics fan-out, …) still depend on\n * `@angular/fire`'s `Auth`/`Firestore`/`Analytics` tokens, and cutting them\n * over is a separate, larger pass — see the Step 1 PR description. This\n * function exists standalone so it can be adopted incrementally, and so its\n * own DI wiring is exercised and tested ahead of that cutover.\n */\nexport function provideSneatFirebase(\n firebaseConfig: IFirebaseConfig,\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: SNEAT_FIREBASE_APP,\n useFactory: (): FirebaseApp => initializeApp(firebaseConfig),\n },\n {\n provide: Firestore,\n useFactory: (): Firestore => {\n const app = inject(SNEAT_FIREBASE_APP);\n const firestore = getFirestore(app);\n const emulator = firebaseConfig.emulator;\n if (emulator && emulatorAllowed(true)) {\n connectFirestoreEmulator(\n firestore,\n emulator.firestoreHost || '127.0.0.1',\n emulator.firestorePort,\n );\n if (emulator.firestorePort === 443) {\n (\n firestore as unknown as { _settings: { ssl: boolean } }\n )._settings.ssl = true;\n }\n }\n return firestore;\n },\n },\n {\n provide: SNEAT_FIREBASE_AUTH,\n useFactory: (): Auth => {\n const app = inject(SNEAT_FIREBASE_APP);\n const auth: Auth = Capacitor.isNativePlatform()\n ? initializeAuth(app, { persistence: indexedDBLocalPersistence })\n : getAuth(app);\n const emulator = firebaseConfig.emulator;\n if (emulator?.authPort && emulatorAllowed(true)) {\n connectAuthEmulator(\n auth,\n `${emulator.authPort === 443 ? 'https' : 'http'}://${emulator.authHost || '127.0.0.1'}:${emulator.authPort}`,\n );\n }\n return auth;\n },\n },\n {\n provide: SNEAT_FIREBASE_ANALYTICS,\n useFactory: (): Analytics | null => {\n if (\n !firebaseConfig.measurementId ||\n firebaseConfig.measurementId === 'G-PROVIDE_IF_NEEDED'\n ) {\n return null;\n }\n try {\n const app = inject(SNEAT_FIREBASE_APP);\n return getAnalytics(app);\n } catch (error) {\n console.error(\n '[provideSneatFirebase] getAnalytics() failed — continuing without analytics.',\n error,\n );\n return null;\n }\n },\n },\n ]);\n}\n"]}
|
package/index.d.ts
CHANGED
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/app-auth/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/app-auth/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EnvironmentProviders, InjectionToken } from '@angular/core';
|
|
2
|
+
import { IFirebaseConfig } from '@sneat/core';
|
|
3
|
+
import { FirebaseApp } from 'firebase/app';
|
|
4
|
+
import { Analytics } from 'firebase/analytics';
|
|
5
|
+
import { Auth } from 'firebase/auth';
|
|
6
|
+
/** Re-exported so `Firestore` (a real class in the modular SDK, usable
|
|
7
|
+
* as-is as an Angular DI token) has one import source alongside the tokens
|
|
8
|
+
* below — consumers never need to reach into `firebase/firestore` directly. */
|
|
9
|
+
export { Firestore } from 'firebase/firestore';
|
|
10
|
+
/**
|
|
11
|
+
* DI token for the app's initialized `firebase/app` `FirebaseApp` instance.
|
|
12
|
+
*
|
|
13
|
+
* `FirebaseApp` is a plain interface in the modular SDK (no runtime class),
|
|
14
|
+
* so — unlike `Firestore` — it cannot be used as an injection token by
|
|
15
|
+
* itself; inject this token instead, e.g. `inject(SNEAT_FIREBASE_APP)`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SNEAT_FIREBASE_APP: InjectionToken<FirebaseApp>;
|
|
18
|
+
/**
|
|
19
|
+
* DI token for the app's initialized `firebase/auth` `Auth` instance.
|
|
20
|
+
* Same rationale as `SNEAT_FIREBASE_APP`: `Auth` is interface-only upstream.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SNEAT_FIREBASE_AUTH: InjectionToken<Auth>;
|
|
23
|
+
/**
|
|
24
|
+
* DI token for the app's `firebase/analytics` `Analytics` instance.
|
|
25
|
+
*
|
|
26
|
+
* Resolves to `null` — never throws — when analytics isn't configured (no
|
|
27
|
+
* real `measurementId`, using the fleet's `'G-PROVIDE_IF_NEEDED'` sentinel)
|
|
28
|
+
* or when `getAnalytics()` throws in an environment that doesn't support it
|
|
29
|
+
* (SSR, some webviews, privacy-hardened browsers). The factory only runs the
|
|
30
|
+
* first time something actually injects this token, so an app that never
|
|
31
|
+
* injects it never pays for Analytics initialization at all — consumers must
|
|
32
|
+
* treat the value as optional either way.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SNEAT_FIREBASE_ANALYTICS: InjectionToken<Analytics | null>;
|
|
35
|
+
/**
|
|
36
|
+
* `@angular/fire`-free replacement for `getAngularFireProviders()` (see
|
|
37
|
+
* `./init-firebase`). Initializes the firebase modular SDK directly
|
|
38
|
+
* (`initializeApp`/`getFirestore`/`getAuth`/`getAnalytics`) and provides
|
|
39
|
+
* `FirebaseApp`, `Firestore`, `Auth`, and `Analytics` through Angular DI —
|
|
40
|
+
* `inject(Firestore)`, `inject(SNEAT_FIREBASE_AUTH)`, etc. — with no
|
|
41
|
+
* `@angular/fire` import anywhere in this file or its call graph.
|
|
42
|
+
*
|
|
43
|
+
* Emulator wiring (`connectFirestoreEmulator`/`connectAuthEmulator`) mirrors
|
|
44
|
+
* `getAngularFireProviders()` exactly, including the Capacitor native-vs-web
|
|
45
|
+
* Auth persistence split and the firestore-emulator-over-443 SSL flag flip.
|
|
46
|
+
*
|
|
47
|
+
* NOT YET wired into `provideSneatAuthenticatedProviders()` / the fleet's
|
|
48
|
+
* bootstrap chain. sneat-libs' own internals (`SneatAuthStateService`,
|
|
49
|
+
* `FirebaseSneatApiAuthAdapter`, the analytics fan-out, …) still depend on
|
|
50
|
+
* `@angular/fire`'s `Auth`/`Firestore`/`Analytics` tokens, and cutting them
|
|
51
|
+
* over is a separate, larger pass — see the Step 1 PR description. This
|
|
52
|
+
* function exists standalone so it can be adopted incrementally, and so its
|
|
53
|
+
* own DI wiring is exercised and tested ahead of that cutover.
|
|
54
|
+
*/
|
|
55
|
+
export declare function provideSneatFirebase(firebaseConfig: IFirebaseConfig): EnvironmentProviders;
|
|
56
|
+
//# sourceMappingURL=provide-sneat-firebase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provide-sneat-firebase.d.ts","sourceRoot":"","sources":["../../../../../libs/app-auth/src/lib/provide-sneat-firebase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,cAAc,EAGf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,SAAS,EAEV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,IAAI,EAKL,MAAM,eAAe,CAAC;AAOvB;;+EAE+E;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,6BAE9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sBAE/B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,kCAEpC,CAAC;AAaF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,eAAe,GAC9B,oBAAoB,CAkEtB"}
|