@sneat/core 0.26.6 → 0.27.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.
@@ -0,0 +1,54 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * Angular DI tokens for the app's initialized firebase modular SDK instances.
4
+ *
5
+ * ## Why they live in `@sneat/core`
6
+ *
7
+ * The instances themselves are created by `provideSneatFirebase()` in
8
+ * `@sneat/app-auth`, which sits at the *top* of the dependency graph — it
9
+ * depends on `@sneat/auth-core`, `@sneat/logging` and `@sneat/api-*`. Those
10
+ * lower libs are the ones that need to *inject* Auth/App/Analytics
11
+ * (`SneatAuthStateService`, `FirebaseSneatApiAuthAdapter`, the analytics
12
+ * fan-out), so declaring the tokens in `@sneat/app-auth` would make every one
13
+ * of them import their own dependent — a cycle nx's
14
+ * `enforce-module-boundaries` rejects.
15
+ *
16
+ * `@sneat/core` is the one lib every consumer already depends on, and it
17
+ * already owns the matching `IFirebaseConfig`/`FirebaseConfigToken`
18
+ * declarations, so the tokens belong here. `@sneat/app-auth` re-exports all
19
+ * three, so `import { SNEAT_FIREBASE_AUTH } from '@sneat/app-auth'` — the
20
+ * import path documented when these tokens shipped — keeps working unchanged.
21
+ *
22
+ * ## Why the firebase imports are type-only
23
+ *
24
+ * `FirebaseApp`, `Auth` and `Analytics` are interfaces in the modular SDK, so
25
+ * `import type` erases completely at compile time. `@sneat/core` therefore
26
+ * gains **no** runtime dependency on `firebase` from this file — the peer is
27
+ * declared optional for exactly that reason.
28
+ */
29
+ /**
30
+ * DI token for the app's initialized `firebase/app` `FirebaseApp` instance.
31
+ *
32
+ * `FirebaseApp` is a plain interface in the modular SDK (no runtime class),
33
+ * so — unlike `Firestore` — it cannot be used as an injection token by
34
+ * itself; inject this token instead, e.g. `inject(SNEAT_FIREBASE_APP)`.
35
+ */
36
+ export const SNEAT_FIREBASE_APP = new InjectionToken('SNEAT_FIREBASE_APP');
37
+ /**
38
+ * DI token for the app's initialized `firebase/auth` `Auth` instance.
39
+ * Same rationale as `SNEAT_FIREBASE_APP`: `Auth` is interface-only upstream.
40
+ */
41
+ export const SNEAT_FIREBASE_AUTH = new InjectionToken('SNEAT_FIREBASE_AUTH');
42
+ /**
43
+ * DI token for the app's `firebase/analytics` `Analytics` instance.
44
+ *
45
+ * Resolves to `null` — never throws — when analytics isn't configured (no
46
+ * real `measurementId`, using the fleet's `'G-PROVIDE_IF_NEEDED'` sentinel)
47
+ * or when `getAnalytics()` throws in an environment that doesn't support it
48
+ * (SSR, some webviews, privacy-hardened browsers). The factory only runs the
49
+ * first time something actually injects this token, so an app that never
50
+ * injects it never pays for Analytics initialization at all — consumers must
51
+ * treat the value as optional either way.
52
+ */
53
+ export const SNEAT_FIREBASE_ANALYTICS = new InjectionToken('SNEAT_FIREBASE_ANALYTICS');
54
+ //# sourceMappingURL=firebase.tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase.tokens.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/firebase.tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAClD,oBAAoB,CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,cAAc,CACnD,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,cAAc,CACxD,0BAA0B,CAC3B,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { FirebaseApp } from 'firebase/app';\nimport type { Analytics } from 'firebase/analytics';\nimport type { Auth } from 'firebase/auth';\n\n/**\n * Angular DI tokens for the app's initialized firebase modular SDK instances.\n *\n * ## Why they live in `@sneat/core`\n *\n * The instances themselves are created by `provideSneatFirebase()` in\n * `@sneat/app-auth`, which sits at the *top* of the dependency graph — it\n * depends on `@sneat/auth-core`, `@sneat/logging` and `@sneat/api-*`. Those\n * lower libs are the ones that need to *inject* Auth/App/Analytics\n * (`SneatAuthStateService`, `FirebaseSneatApiAuthAdapter`, the analytics\n * fan-out), so declaring the tokens in `@sneat/app-auth` would make every one\n * of them import their own dependent — a cycle nx's\n * `enforce-module-boundaries` rejects.\n *\n * `@sneat/core` is the one lib every consumer already depends on, and it\n * already owns the matching `IFirebaseConfig`/`FirebaseConfigToken`\n * declarations, so the tokens belong here. `@sneat/app-auth` re-exports all\n * three, so `import { SNEAT_FIREBASE_AUTH } from '@sneat/app-auth'` — the\n * import path documented when these tokens shipped — keeps working unchanged.\n *\n * ## Why the firebase imports are type-only\n *\n * `FirebaseApp`, `Auth` and `Analytics` are interfaces in the modular SDK, so\n * `import type` erases completely at compile time. `@sneat/core` therefore\n * gains **no** runtime dependency on `firebase` from this file — the peer is\n * declared optional for exactly that reason.\n */\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"]}
@@ -21,4 +21,5 @@ export * from './directives';
21
21
  export * from './environment-config';
22
22
  export * from './logging/interfaces';
23
23
  export * from './analytics.interface';
24
+ export * from './firebase.tokens';
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './animations';\nexport * from './app.service';\nexport * from './core-models';\nexport * from './nav';\nexport * from './store';\nexport * from './sneat-enum-keys';\nexport * from './services';\nexport * from './exclude-undefined';\nexport * from './logging';\nexport * from './utils';\nexport * from './eq';\nexport * from './types';\nexport * from './sneat-extensions';\nexport * from './form-field';\nexport * from './team-type';\nexport * from './location-href';\nexport * from './reserved-public-path';\nexport * from './interfaces';\nexport * from './current-space-storage';\nexport * from './directives';\nexport * from './environment-config';\nexport * from './logging/interfaces';\nexport * from './analytics.interface';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './animations';\nexport * from './app.service';\nexport * from './core-models';\nexport * from './nav';\nexport * from './store';\nexport * from './sneat-enum-keys';\nexport * from './services';\nexport * from './exclude-undefined';\nexport * from './logging';\nexport * from './utils';\nexport * from './eq';\nexport * from './types';\nexport * from './sneat-extensions';\nexport * from './form-field';\nexport * from './team-type';\nexport * from './location-href';\nexport * from './reserved-public-path';\nexport * from './interfaces';\nexport * from './current-space-storage';\nexport * from './directives';\nexport * from './environment-config';\nexport * from './logging/interfaces';\nexport * from './analytics.interface';\nexport * from './firebase.tokens';\n"]}
@@ -0,0 +1,56 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import type { FirebaseApp } from 'firebase/app';
3
+ import type { Analytics } from 'firebase/analytics';
4
+ import type { Auth } from 'firebase/auth';
5
+ /**
6
+ * Angular DI tokens for the app's initialized firebase modular SDK instances.
7
+ *
8
+ * ## Why they live in `@sneat/core`
9
+ *
10
+ * The instances themselves are created by `provideSneatFirebase()` in
11
+ * `@sneat/app-auth`, which sits at the *top* of the dependency graph — it
12
+ * depends on `@sneat/auth-core`, `@sneat/logging` and `@sneat/api-*`. Those
13
+ * lower libs are the ones that need to *inject* Auth/App/Analytics
14
+ * (`SneatAuthStateService`, `FirebaseSneatApiAuthAdapter`, the analytics
15
+ * fan-out), so declaring the tokens in `@sneat/app-auth` would make every one
16
+ * of them import their own dependent — a cycle nx's
17
+ * `enforce-module-boundaries` rejects.
18
+ *
19
+ * `@sneat/core` is the one lib every consumer already depends on, and it
20
+ * already owns the matching `IFirebaseConfig`/`FirebaseConfigToken`
21
+ * declarations, so the tokens belong here. `@sneat/app-auth` re-exports all
22
+ * three, so `import { SNEAT_FIREBASE_AUTH } from '@sneat/app-auth'` — the
23
+ * import path documented when these tokens shipped — keeps working unchanged.
24
+ *
25
+ * ## Why the firebase imports are type-only
26
+ *
27
+ * `FirebaseApp`, `Auth` and `Analytics` are interfaces in the modular SDK, so
28
+ * `import type` erases completely at compile time. `@sneat/core` therefore
29
+ * gains **no** runtime dependency on `firebase` from this file — the peer is
30
+ * declared optional for exactly that reason.
31
+ */
32
+ /**
33
+ * DI token for the app's initialized `firebase/app` `FirebaseApp` instance.
34
+ *
35
+ * `FirebaseApp` is a plain interface in the modular SDK (no runtime class),
36
+ * so — unlike `Firestore` — it cannot be used as an injection token by
37
+ * itself; inject this token instead, e.g. `inject(SNEAT_FIREBASE_APP)`.
38
+ */
39
+ export declare const SNEAT_FIREBASE_APP: InjectionToken<FirebaseApp>;
40
+ /**
41
+ * DI token for the app's initialized `firebase/auth` `Auth` instance.
42
+ * Same rationale as `SNEAT_FIREBASE_APP`: `Auth` is interface-only upstream.
43
+ */
44
+ export declare const SNEAT_FIREBASE_AUTH: InjectionToken<Auth>;
45
+ /**
46
+ * DI token for the app's `firebase/analytics` `Analytics` instance.
47
+ *
48
+ * Resolves to `null` — never throws — when analytics isn't configured (no
49
+ * real `measurementId`, using the fleet's `'G-PROVIDE_IF_NEEDED'` sentinel)
50
+ * or when `getAnalytics()` throws in an environment that doesn't support it
51
+ * (SSR, some webviews, privacy-hardened browsers). The factory only runs the
52
+ * first time something actually injects this token, so an app that never
53
+ * injects it never pays for Analytics initialization at all — consumers must
54
+ * treat the value as optional either way.
55
+ */
56
+ export declare const SNEAT_FIREBASE_ANALYTICS: InjectionToken<Analytics | null>;
package/lib/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './directives';
21
21
  export * from './environment-config';
22
22
  export * from './logging/interfaces';
23
23
  export * from './analytics.interface';
24
+ export * from './firebase.tokens';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/core",
3
- "version": "0.26.6",
3
+ "version": "0.27.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,12 +10,18 @@
10
10
  "@angular/core": ">=22.0.0 <23.0.0",
11
11
  "@angular/router": ">=22.0.0 <23.0.0",
12
12
  "@ionic/angular": ">=9.0.0 <10.0.0",
13
- "@sneat/core-public": "^0.26.0",
13
+ "@sneat/core-public": "^0.27.0",
14
+ "firebase": "*",
14
15
  "rxjs": ">=7.8.0"
15
16
  },
16
17
  "dependencies": {
17
18
  "tslib": "2.8.1"
18
19
  },
20
+ "peerDependenciesMeta": {
21
+ "firebase": {
22
+ "optional": true
23
+ }
24
+ },
19
25
  "module": "esm2022/sneat-core.js",
20
26
  "typings": "sneat-core.d.ts",
21
27
  "exports": {