@tech4good/angular-schematics 21.6.0 → 21.7.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.
- package/CHANGELOG.md +28 -0
- package/README.md +266 -1
- package/package.json +34 -7
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +4 -5
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +1 -1
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +14 -6
- package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +12 -6
- package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +18 -10
- package/src/entity/index.js +4 -49
- package/src/entity/index.js.map +1 -1
- package/src/guard/files/__name@dasherize__.guard.spec.ts.template +0 -1
- package/src/ng-add/files/.github/workflows/angular-github-ci.yml.template +3 -0
- package/src/ng-add/files/.gitignore.template +3 -0
- package/src/ng-add/files/analytics/datasets.js.template +206 -0
- package/src/ng-add/files/analytics/entity_sources.js.template +58 -0
- package/src/ng-add/files/analytics/entity_sources.test.js.template +57 -0
- package/src/ng-add/files/analytics/lib/api_query.js.template +87 -0
- package/src/ng-add/files/analytics/lib/api_query.test.js.template +84 -0
- package/src/ng-add/files/analytics/lib/bigquery_query_compatibility.test.js.template +53 -0
- package/src/ng-add/files/analytics/lib/dataset_schema.js.template +53 -0
- package/src/ng-add/files/analytics/lib/dataset_schema.test.js.template +34 -0
- package/src/ng-add/files/analytics/lib/entity_sync.js.template +397 -0
- package/src/ng-add/files/analytics/lib/entity_sync.test.js.template +212 -0
- package/src/ng-add/files/analytics/lib/identifier_salt.js.template +57 -0
- package/src/ng-add/files/analytics/lib/identifier_salt.test.js.template +36 -0
- package/src/ng-add/files/analytics/lib/snapshot_files.js.template +46 -0
- package/src/ng-add/files/analytics/lib/snapshot_files.test.js.template +67 -0
- package/src/ng-add/files/analytics/lib/sqlite.js.template +92 -0
- package/src/ng-add/files/analytics/lib/upload_entities.js.template +81 -0
- package/src/ng-add/files/analytics/lib/upload_entities.test.js.template +86 -0
- package/src/ng-add/files/analytics/proxy.conf.json.template +7 -0
- package/src/ng-add/files/analytics/scripts/refresh_snapshot.js.template +518 -0
- package/src/ng-add/files/analytics/scripts/start.js.template +88 -0
- package/src/ng-add/files/analytics/server/server.js.template +212 -0
- package/src/ng-add/files/angular.json.template +80 -1
- package/src/ng-add/files/bigquery/queries/active_time_by_route.sql.template +27 -8
- package/src/ng-add/files/bigquery/queries/active_user_windows.sql.template +67 -0
- package/src/ng-add/files/bigquery/queries/dashboard_route_visits.sql.template +47 -0
- package/src/ng-add/files/bigquery/queries/data_quality.sql.template +323 -0
- package/src/ng-add/files/bigquery/queries/onboarding_funnel.sql.template +512 -0
- package/src/ng-add/files/bigquery/queries/onboarding_stage_observations.sql.template +134 -0
- package/src/ng-add/files/bigquery/queries/weekly_retention_cohorts.sql.template +90 -0
- package/src/ng-add/files/bigquery/scripts/export_entities.js.template +120 -0
- package/src/ng-add/files/bigquery/scripts/init_views.js.template +57 -0
- package/src/ng-add/files/bigquery/scripts/run_query.js.template +141 -0
- package/src/ng-add/files/bigquery/views/events_flat.sql.template +27 -12
- package/src/ng-add/files/bigquery/views/logs_latest.sql.template +16 -3
- package/src/ng-add/files/docs-infra/analytics-guide.md.template +270 -25
- package/src/ng-add/files/docs-infra/analytics-workbench-guide.md.template +307 -0
- package/src/ng-add/files/docs-infra/authentication-architecture.md.template +54 -24
- package/src/ng-add/files/docs-infra/email-infrastructure.md.template +43 -0
- package/src/ng-add/files/docs-infra/firestore-index-checker.md.template +87 -0
- package/src/ng-add/files/docs-infra/infrastructure-guide.md.template +108 -29
- package/src/ng-add/files/docs-infra/load-system-architecture.md.template +15 -1
- package/src/ng-add/files/docs-infra/querying-strategy.md.template +14 -0
- package/src/ng-add/files/docs-infra/stream-system-architecture.md.template +21 -7
- package/src/ng-add/files/eslint.config.js.template +22 -3
- package/src/ng-add/files/functions/package.json.template +1 -0
- package/src/ng-add/files/functions/src/email.ts.template +23 -0
- package/src/ng-add/files/jest.config.ts.template +3 -2
- package/src/ng-add/files/package.json.template +39 -16
- package/src/ng-add/files/projects/analytics/src/app/analytics-api.service.ts.template +130 -0
- package/src/ng-add/files/projects/analytics/src/app/app.component.html.template +77 -0
- package/src/ng-add/files/projects/analytics/src/app/app.component.scss.template +240 -0
- package/src/ng-add/files/projects/analytics/src/app/app.component.ts.template +96 -0
- package/src/ng-add/files/projects/analytics/src/app/app.routes.ts.template +11 -0
- package/src/ng-add/files/projects/analytics/src/app/dashboard-pages.spec.ts.template +151 -0
- package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.html.template +39 -0
- package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/data-quality/data-quality-page/data-quality-page.component.ts.template +95 -0
- package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.html.template +47 -0
- package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/engagement/engagement-page/engagement-page.component.ts.template +120 -0
- package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.html.template +40 -0
- package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/onboarding/onboarding-page/onboarding-page.component.ts.template +98 -0
- package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.html.template +35 -0
- package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/overview/overview-page/overview-page.component.ts.template +84 -0
- package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.html.template +42 -0
- package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.scss.template +1 -0
- package/src/ng-add/files/projects/analytics/src/app/routes/routes-page/routes-page.component.ts.template +110 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/analytics-utils.ts.template +43 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/chart-theme.ts.template +42 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-layout.scss.template +239 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.html.template +76 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.scss.template +128 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.spec.ts.template +31 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/dashboard-table/dashboard-table.component.ts.template +153 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.html.template +16 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.scss.template +63 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/funnel-chart/funnel-chart.component.ts.template +52 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.html.template +5 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.scss.template +56 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.spec.ts.template +30 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/metric-card/metric-card.component.ts.template +15 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.html.template +9 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.scss.template +43 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/quality-chart/quality-chart.component.ts.template +62 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.html.template +9 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.scss.template +33 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-distribution-chart/route-distribution-chart.component.ts.template +82 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.html.template +15 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.scss.template +45 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/route-traffic-chart/route-traffic-chart.component.ts.template +55 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.html.template +18 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.scss.template +45 -0
- package/src/ng-add/files/projects/analytics/src/app/shared/status-message/status-message.component.ts.template +15 -0
- package/src/ng-add/files/projects/analytics/src/app/vega-chart/vega-chart.component.ts.template +121 -0
- package/src/ng-add/files/projects/analytics/src/index.html.template +19 -0
- package/src/ng-add/files/projects/analytics/src/main.ts.template +16 -0
- package/src/ng-add/files/projects/analytics/src/styles.scss.template +28 -0
- package/src/ng-add/files/projects/analytics/tsconfig.app.json.template +13 -0
- package/src/ng-add/files/projects/analytics/tsconfig.spec.json.template +15 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.spec.ts.template +11 -12
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.ts.template +7 -7
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.spec.ts.template +8 -10
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.ts.template +3 -2
- package/src/ng-add/files/src/app/app.component.html.template +1 -1
- package/src/ng-add/files/src/app/app.component.scss.template +1 -1
- package/src/ng-add/files/src/app/app.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/app.component.ts.template +1 -2
- package/src/ng-add/files/src/app/app.config.ts.template +21 -15
- package/src/ng-add/files/src/app/auth-routing.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.spec.ts.template +46 -29
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.ts.template +27 -18
- package/src/ng-add/files/src/app/core/auth/auth.providers.spec.ts.template +112 -0
- package/src/ng-add/files/src/app/core/auth/auth.providers.ts.template +48 -0
- package/src/ng-add/files/src/app/core/auth/auth.service.ts.template +9 -23
- package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.spec.ts.template +3 -14
- package/src/ng-add/files/src/app/core/firebase/data.providers.prod.ts.template +21 -0
- package/src/ng-add/files/src/app/core/firebase/data.providers.ts.template +13 -0
- package/src/ng-add/files/src/app/core/local-storage/session.service.spec.ts.template +43 -0
- package/src/ng-add/files/src/app/core/local-storage/session.service.ts.template +7 -0
- package/src/ng-add/files/src/app/core/store/app-data.spec.ts.template +76 -0
- package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +19 -67
- package/src/ng-add/files/src/app/core/store/auth/auth.store.spec.ts.template +102 -12
- package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +32 -237
- package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +17 -12
- package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +6 -7
- package/src/ng-add/files/src/app/core/store/user/user.store.ts.template +14 -10
- package/src/ng-add/files/src/app/core/store/user-context/user-context.mock.ts.template +20 -8
- package/src/ng-add/files/src/app/core/store/user-context/user-context.model.ts.template +5 -6
- package/src/ng-add/files/src/app/core/store/user-context/user-context.store.ts.template +14 -10
- package/src/ng-add/files/src/app/core/store/user-private/user-private.mock.ts.template +20 -7
- package/src/ng-add/files/src/app/core/store/user-private/user-private.model.ts.template +5 -6
- package/src/ng-add/files/src/app/core/store/user-private/user-private.store.ts.template +14 -10
- package/src/ng-add/files/src/app/core/testing/app-mocks.ts.template +42 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.html.template +2 -1
- package/src/ng-add/files/src/app/first-time/consent/consent.component.scss.template +7 -3
- package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +31 -11
- package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +16 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +15 -15
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +11 -3
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.html.template +2 -1
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.scss.template +7 -3
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.spec.ts.template +20 -6
- package/src/ng-add/files/src/app/first-time/early-access/survey-form/survey-form.component.ts.template +2 -0
- package/src/ng-add/files/src/app/first-time/early-access/waitlist-view/waitlist-view.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/first-time/email-link/email-link.component.spec.ts.template +17 -1
- package/src/ng-add/files/src/app/first-time/email-link/email-link.component.ts.template +15 -0
- package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +15 -0
- package/src/ng-add/files/src/app/first-time/landing/landing.component.spec.ts.template +2 -0
- package/src/ng-add/files/src/app/first-time/login/login.component.spec.ts.template +21 -3
- package/src/ng-add/files/src/app/first-time/login/login.component.ts.template +26 -0
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.spec.ts.template +4 -2
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.ts.template +1 -1
- package/src/ng-add/files/src/app/main/account-profile/account-profile.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/main/account-profile/delete-guest-card/delete-guest-card.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/main/account-profile/profile-details-card/profile-details-card.component.spec.ts.template +4 -4
- package/src/ng-add/files/src/app/main/account-profile/sign-in-methods-card/sign-in-methods-card.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/main/home/home.component.spec.ts.template +4 -5
- package/src/ng-add/files/src/app/main/home/home.component.ts.template +1 -1
- package/src/ng-add/files/src/app/shared/guest-warning-bar/guest-warning-bar.component.spec.ts.template +4 -4
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.spec.ts.template +2 -2
- package/src/ng-add/files/tsconfig.spec.json.template +3 -1
- package/src/ng-add/index.js +7 -0
- package/src/ng-add/index.js.map +1 -1
- package/src/shared/entity-registry.d.ts +8 -0
- package/src/shared/entity-registry.js +28 -0
- package/src/shared/entity-registry.js.map +1 -0
- package/.agents/skills/publish-npm/SKILL.md +0 -37
- package/.agents/skills/publish-npm/eval.yaml +0 -32
- package/.agents/skills/publish-npm/fixtures/package-v21.json.template +0 -8
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.t4g/agent-memory.db +0 -0
- package/src/component/index_spec.d.ts +0 -1
- package/src/component/index_spec.js +0 -68
- package/src/component/index_spec.js.map +0 -1
- package/src/entity/index_spec.d.ts +0 -1
- package/src/entity/index_spec.js +0 -153
- package/src/entity/index_spec.js.map +0 -1
- package/src/guard/index_spec.d.ts +0 -1
- package/src/guard/index_spec.js +0 -64
- package/src/guard/index_spec.js.map +0 -1
- package/src/ng-add/files/bigquery/scripts/export_entities.py.template +0 -143
- package/src/ng-add/files/bigquery/scripts/run_query.py.template +0 -167
- package/src/ng-add/files/src/app/core/firebase/cached-listeners.service.ts.template +0 -500
- package/src/ng-add/files/src/app/core/firebase/database.service.ts.template +0 -73
- package/src/ng-add/files/src/app/core/firebase/email-link-context.service.spec.ts.template +0 -59
- package/src/ng-add/files/src/app/core/firebase/email-link-context.service.ts.template +0 -147
- package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +0 -453
- package/src/ng-add/files/src/app/core/firebase/firebase.service.spec.ts.template +0 -116
- package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +0 -639
- package/src/ng-add/files/src/app/core/firebase/simulate-load.spec.ts.template +0 -104
- package/src/ng-add/files/src/app/core/firebase/simulate-stream.spec.ts.template +0 -127
- package/src/ng-add/files/src/app/core/firebase/simulation.mock.ts.template +0 -38
- package/src/ng-add/files/src/app/core/firebase/stream-multiplexer.ts.template +0 -445
- package/src/ng-add/files/src/app/core/logging/logging.service.spec.ts.template +0 -118
- package/src/ng-add/files/src/app/core/logging/logging.service.ts.template +0 -168
- package/src/ng-add/files/src/app/core/store/app.model.ts.template +0 -21
- package/src/ng-add/files/src/app/core/store/app.store.spec.ts.template +0 -920
- package/src/ng-add/files/src/app/core/store/app.store.ts.template +0 -1320
- package/src/ng-add/files/src/app/core/store/batch-write.firebase.service.ts.template +0 -58
- package/src/ng-add/files/src/app/core/store/batch-write.mock.service.ts.template +0 -105
- package/src/ng-add/files/src/app/core/store/batch-write.service.ts.template +0 -126
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +0 -9
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.scss.template +0 -46
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.spec.ts.template +0 -69
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +0 -39
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.spec.ts.template +0 -122
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +0 -88
- package/src/ng-add/index_spec.d.ts +0 -1
- package/src/ng-add/index_spec.js +0 -108
- package/src/ng-add/index_spec.js.map +0 -1
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { DATA_ACCESS } from '@tech4good/platform-data';
|
|
1
2
|
# Infrastructure Guide
|
|
2
3
|
|
|
4
|
+
> Import shared infrastructure directly from `@tech4good/platform-data`,
|
|
5
|
+
> `@tech4good/platform-data/firestore`, or `@tech4good/platform-data/testing`.
|
|
6
|
+
> Local forwarding files are not generated. Improve the engine in the package;
|
|
7
|
+
> keep app entities, domain methods, seeds, auth policies and query choices here.
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
This document describes the custom infrastructure patterns in repositories generated using `@techgood/angular-schematics` that differ from standard Angular conventions. Understanding these is essential for contributing code correctly.
|
|
4
11
|
|
|
5
12
|
---
|
|
@@ -15,22 +22,28 @@ All entities share reserved system fields:
|
|
|
15
22
|
| Field | Type | Purpose |
|
|
16
23
|
|-------|------|---------|
|
|
17
24
|
| `__id` | `string` | Primary key (matches Firestore document ID) |
|
|
18
|
-
| `_createdAt` | `
|
|
19
|
-
| `_updatedAt` | `
|
|
25
|
+
| `_createdAt` | `DataTimestamp` | Set automatically on creation |
|
|
26
|
+
| `_updatedAt` | `DataTimestamp` | Set automatically on every write |
|
|
20
27
|
| `_deleted` | `boolean` | Soft-delete flag — **entities are never hard-deleted** |
|
|
21
28
|
|
|
29
|
+
All four fields are required on stored entities. `_deleted` is used by active
|
|
30
|
+
and soft-delete queries; `_updatedAt` drives incremental loads and nested-stream
|
|
31
|
+
change detection. `_createdAt` records creation time. Use `NewDataEntity<YourEntity>`
|
|
32
|
+
for creation inputs: `store.add()` supplies identity and metadata. Mock seeds and
|
|
33
|
+
records passed to `store.init()` must contain complete stored metadata.
|
|
34
|
+
|
|
22
35
|
Foreign keys use the `__` prefix (e.g. `__ownerId`, `__communityId`). This is a project convention, not an Angular or Firebase one.
|
|
23
36
|
|
|
24
37
|
**Example** (community.model.ts):
|
|
25
38
|
```typescript
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_updatedAt?: Timestamp;
|
|
30
|
-
_deleted?: boolean;
|
|
39
|
+
import { DataEntity, defineEntity } from '@tech4good/platform-data';
|
|
40
|
+
|
|
41
|
+
export interface Community extends DataEntity {
|
|
31
42
|
name: string;
|
|
32
43
|
__ownerId: string;
|
|
33
44
|
}
|
|
45
|
+
|
|
46
|
+
export const communityEntity = defineEntity<Community>({ collection: 'communitys' });
|
|
34
47
|
```
|
|
35
48
|
|
|
36
49
|
### 1.2 Entity File Set
|
|
@@ -39,38 +52,67 @@ Each entity lives in `src/app/core/store/<entity-name>/` and consists of exactly
|
|
|
39
52
|
|
|
40
53
|
| File | Purpose |
|
|
41
54
|
|------|---------|
|
|
42
|
-
| `<entity>.model.ts` | TypeScript interface |
|
|
55
|
+
| `<entity>.model.ts` | TypeScript interface and exported `defineEntity<T>({ collection })` |
|
|
43
56
|
| `<entity>.store.ts` | ngrx signal store with `withEntitiesAndDBMethods` |
|
|
44
|
-
| `<entity>.mock.ts` | Mock signal store
|
|
57
|
+
| `<entity>.mock.ts` | Mock signal store, seeds, and exported `defineEntityMock` wiring |
|
|
45
58
|
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
Use `ng generate @tech4good/angular-schematics:entity <name>` to generate all
|
|
60
|
+
three files and refresh the registries. Manual entity files following the same
|
|
61
|
+
convention are discovered too; no central service edits are required.
|
|
48
62
|
|
|
49
63
|
### 1.3 Collection Naming
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
Declare the exact collection name once with `defineEntity` in the model file.
|
|
66
|
+
Stores and mock stores use `communityEntity.collection`. The schematic preserves
|
|
67
|
+
existing naming (append `s`, e.g. `communitys`); it does not rename database data.
|
|
68
|
+
Use a string literal so tooling can resolve it without executing application code.
|
|
52
69
|
|
|
53
|
-
### 1.4
|
|
70
|
+
### 1.4 Generated Entity Registration
|
|
54
71
|
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
export type AnyEntity = Session | Community | User | UserContext;
|
|
58
|
-
```
|
|
72
|
+
`t4g-entities` discovers exported definitions under `src/app` and writes:
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
- `src/app/core/store/entities.generated.ts`: `APP_ENTITIES` and `AppEntityMap`.
|
|
75
|
+
- `src/app/core/store/entity-mocks.generated.ts`: `APP_ENTITY_MOCKS`.
|
|
76
|
+
|
|
77
|
+
Keep these generated files in version control for editor support and review;
|
|
78
|
+
regenerate rather than edit them. There is no handwritten `AnyEntity` union.
|
|
79
|
+
Generic code imports `DataEntity`; concrete stores retain their entity's type.
|
|
80
|
+
|
|
81
|
+
Custom mock wiring belongs beside its fixtures:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
export const communityMock = defineEntityMock(communityEntity, {
|
|
85
|
+
store: CommunityMockDB,
|
|
86
|
+
seeds: COMMUNITY_DB,
|
|
87
|
+
});
|
|
67
88
|
```
|
|
68
89
|
|
|
90
|
+
Import `defineEntityMock` from `@tech4good/platform-data/testing` and the entity
|
|
91
|
+
definition directly from its relative model file. An entity without a custom
|
|
92
|
+
mock declaration gets an empty in-memory mock collection. Duplicate collection
|
|
93
|
+
or mock declarations fail generation, with the relevant filename.
|
|
94
|
+
|
|
95
|
+
`npm start`, `npm run watch`, and `npm run test:watch` keep discovery running as
|
|
96
|
+
files are added, changed, renamed, or deleted. Build/test/lint commands regenerate
|
|
97
|
+
before running. Use `npm run generate:entities` after manual edits, and
|
|
98
|
+
`npm run check:entities` in CI before regeneration to detect stale committed files.
|
|
99
|
+
Direct `ng`/`jest` commands bypass this setup; run generation first when using them.
|
|
100
|
+
|
|
101
|
+
The app's `provideAppMocks()` supplies `createMockRegistry(APP_ENTITY_MOCKS)` to the shared `MockDataService`. Tests can seed
|
|
102
|
+
any discovered collection with `provideAppMocks({ collections: { users: [] } })`;
|
|
103
|
+
these overrides are typed and an empty array clears that mock collection.
|
|
104
|
+
Production replaces `data.providers.ts` with `data.providers.prod.ts`, which
|
|
105
|
+
never imports the mock registry or fixture modules.
|
|
106
|
+
|
|
107
|
+
Security rules remain app-owned. The schematic retains its existing development
|
|
108
|
+
rule stub and index generation; replacing the stub with the entity's intended
|
|
109
|
+
access policy is still required.
|
|
110
|
+
|
|
69
111
|
---
|
|
70
112
|
|
|
71
113
|
## 2. Soft Deletes
|
|
72
114
|
|
|
73
|
-
Entities are **never hard-deleted** from Firestore. Instead, `removeEntity` sets `_deleted: true` and `_updatedAt
|
|
115
|
+
Entities are **never hard-deleted** from Firestore. Instead, `removeEntity` sets `_deleted: true` and `_updatedAt` to a backend-generated timestamp.
|
|
74
116
|
|
|
75
117
|
This has several implications:
|
|
76
118
|
|
|
@@ -85,7 +127,7 @@ This has several implications:
|
|
|
85
127
|
- The document was soft-deleted (→ remove from local store)
|
|
86
128
|
- The document no longer matches the query but still exists (→ keep in store)
|
|
87
129
|
|
|
88
|
-
The `
|
|
130
|
+
The package `CachedListenersService` handles this by using `entityInQueryResults()` to distinguish the two cases.
|
|
89
131
|
|
|
90
132
|
---
|
|
91
133
|
|
|
@@ -199,7 +241,9 @@ export const environment = {
|
|
|
199
241
|
```
|
|
200
242
|
|
|
201
243
|
When `mockDB` is true, `app.config.ts` swaps out:
|
|
202
|
-
- `
|
|
244
|
+
- `FirestoreDataService` → `MockDataService` (via `DATA_ACCESS` token)
|
|
245
|
+
- `FirebaseAuthService` → `MockAuthService` (via `AUTH_ACCESS` token)
|
|
246
|
+
- Firestore profile persistence → mock profile persistence, with the same app profile defaults
|
|
203
247
|
- `BatchWriteDBService` → `BatchWriteMockService` (via `BATCH_WRITE_SERVICE` token)
|
|
204
248
|
- Firebase providers are not loaded at all
|
|
205
249
|
|
|
@@ -227,7 +271,8 @@ resolves the matching Firestore application profile.
|
|
|
227
271
|
|
|
228
272
|
`AppComponent.ngOnInit()` starts one app-lifetime Firebase auth observer. Fresh sign-in
|
|
229
273
|
methods provision the profile directly after Firebase credentials are ready. Logout and
|
|
230
|
-
guest deletion tear down Firestore streams and reset
|
|
274
|
+
guest deletion tear down Firestore streams and reset auth-related state (including
|
|
275
|
+
load history for those reset stores) before invalidating
|
|
231
276
|
the local session.
|
|
232
277
|
|
|
233
278
|
See [`docs-infra/authentication-architecture.md`](authentication-architecture.md) for the
|
|
@@ -365,7 +410,7 @@ The project uses `@tech4good/angular-schematics` for code generation. Key schema
|
|
|
365
410
|
|
|
366
411
|
| Command | What it generates |
|
|
367
412
|
|---------|-------------------|
|
|
368
|
-
| `ng generate entity <name>` | Model + Store + MockDB + seed data array,
|
|
413
|
+
| `ng generate entity <name>` | Model + Store + MockDB + seed data array, defines collection identity in the model and regenerates entity/mock registries |
|
|
369
414
|
| `ng generate component <name>` | Standard Angular component with the project's section layout and comment headers |
|
|
370
415
|
|
|
371
416
|
> [!CAUTION]
|
|
@@ -394,3 +439,37 @@ await this.batch.batchWrite(async (batchConfig) => {
|
|
|
394
439
|
```
|
|
395
440
|
|
|
396
441
|
If an `__id` is not provided to `store.add()`, one is generated automatically. But when you need to reference the ID in a related entity within the same batch, you must pre-generate it.
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
Shared entity timestamps use `DataTimestamp` and helpers imported directly from
|
|
445
|
+
`@tech4good/platform-data`. Use `dataTimestampNow()` in seeds and
|
|
446
|
+
`dataTimestampToDate(value)` for UI display. The `/firestore` adapter converts
|
|
447
|
+
native SDK timestamps, including domain fields in nested maps/arrays, at the
|
|
448
|
+
read/write/query boundary. Persisted Firestore documents still use native
|
|
449
|
+
Firestore timestamps. The current timestamp-based delta algorithm is unchanged.
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
## Shared Runtime Logging
|
|
453
|
+
|
|
454
|
+
Import `injectLogger` from `@tech4good/platform-logging` in an Angular field
|
|
455
|
+
initializer or provider factory:
|
|
456
|
+
|
|
457
|
+
```ts
|
|
458
|
+
private readonly logger = injectLogger('auth');
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
Keep the returned logger for later callbacks. Configure logging once using
|
|
462
|
+
`providePlatformLogging` in `app.config.ts`; the data package uses its `data`
|
|
463
|
+
namespace. New generated apps start with logging disabled and opt in to saved
|
|
464
|
+
settings and the DevTools handle only during development:
|
|
465
|
+
|
|
466
|
+
```js
|
|
467
|
+
debugLogger.enable('data,auth');
|
|
468
|
+
debugLogger.disable();
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Namespaces match exactly. Existing saved `query` filters must change to `data`.
|
|
472
|
+
All levels follow the filter. A custom `sink` receives `{ namespace, level,
|
|
473
|
+
values }` for tests or application-specific output. Logging state belongs to its
|
|
474
|
+
Angular injector; no copied local service or data-specific logger provider is
|
|
475
|
+
needed. The application's analytics event logging remains a separate concern.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Load System Architecture
|
|
2
2
|
|
|
3
|
+
> Import shared infrastructure directly from `@tech4good/platform-data`,
|
|
4
|
+
> `@tech4good/platform-data/firestore`, or `@tech4good/platform-data/testing`.
|
|
5
|
+
> Local forwarding files are not generated. Improve the engine in the package;
|
|
6
|
+
> keep app entities, domain methods, seeds, auth policies and query choices here.
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
This document details the code-level architecture of the `load()` method in the query system. For a high-level overview of our querying strategy, refer to [querying-strategy.md](./querying-strategy.md).
|
|
4
10
|
|
|
5
11
|
## 1. Data Structures & State Management
|
|
@@ -138,7 +144,7 @@ However, we face a temporal problem: we want to only fetch data that has changed
|
|
|
138
144
|
Instead, we group the IDs into **5-minute Time Buckets**:
|
|
139
145
|
|
|
140
146
|
```typescript
|
|
141
|
-
// From
|
|
147
|
+
// From platform-data/src/entity-store.ts
|
|
142
148
|
const BUCKET_MS = 5 * 60 * 1000;
|
|
143
149
|
const groupsByBucket = new Map<number, { minTime: number, values: string[] }>();
|
|
144
150
|
|
|
@@ -164,3 +170,11 @@ The system iterates over these buckets, chunks them into batches of up to 30 (Fi
|
|
|
164
170
|
By rounding to the nearest 5-minute bucket, we sacrifice a tiny amount of over-fetching (fetching up to 5 minutes of redundant data) in exchange for keeping the DB reads massively batched.
|
|
165
171
|
|
|
166
172
|
After the fetch completes, **all IDs in the batch are assigned the exact same `newLoadTime`**. This convergence ensures that these entities group together perfectly in future requests, eliminating fragmentation over time.
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
Shared entity timestamps use `DataTimestamp` and helpers imported directly from
|
|
176
|
+
`@tech4good/platform-data`. Use `dataTimestampNow()` in seeds and
|
|
177
|
+
`dataTimestampToDate(value)` for UI display. The `/firestore` adapter converts
|
|
178
|
+
native SDK timestamps, including domain fields in nested maps/arrays, at the
|
|
179
|
+
read/write/query boundary. Persisted Firestore documents still use native
|
|
180
|
+
Firestore timestamps. The current timestamp-based delta algorithm is unchanged.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @tech4good/angular-schematics Querying Strategy
|
|
2
2
|
|
|
3
|
+
> Import shared infrastructure directly from `@tech4good/platform-data`,
|
|
4
|
+
> `@tech4good/platform-data/firestore`, or `@tech4good/platform-data/testing`.
|
|
5
|
+
> Local forwarding files are not generated. Improve the engine in the package;
|
|
6
|
+
> keep app entities, domain methods, seeds, auth policies and query choices here.
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
This document provides a high-level overview of the @tech4good/angular-schematics framework's querying strategy. It is designed to help developers and AI agents think through the best approach for fetching, streaming, and managing database state for highly collaborative systems.
|
|
4
10
|
|
|
5
11
|
## 1. Designing Collaborative Systems (The Big Picture)
|
|
@@ -155,3 +161,11 @@ To solve these problems, the framework uses a complex **Global Multiplexer with
|
|
|
155
161
|
If you have a complex scenario that doesn't fit these rules, you must either denormalize the data into the parent document, or use `load()` instead.
|
|
156
162
|
|
|
157
163
|
> **Deep Dive**: See [Stream System Architecture](./stream-system-architecture.md) for code-level details on the Global Multiplexer and listener teardown logic.
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
Shared entity timestamps use `DataTimestamp` and helpers imported directly from
|
|
167
|
+
`@tech4good/platform-data`. Use `dataTimestampNow()` in seeds and
|
|
168
|
+
`dataTimestampToDate(value)` for UI display. The `/firestore` adapter converts
|
|
169
|
+
native SDK timestamps, including domain fields in nested maps/arrays, at the
|
|
170
|
+
read/write/query boundary. Persisted Firestore documents still use native
|
|
171
|
+
Firestore timestamps. The current timestamp-based delta algorithm is unchanged.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Stream System Architecture
|
|
2
2
|
|
|
3
|
+
> Import shared infrastructure directly from `@tech4good/platform-data`,
|
|
4
|
+
> `@tech4good/platform-data/firestore`, or `@tech4good/platform-data/testing`.
|
|
5
|
+
> Local forwarding files are not generated. Improve the engine in the package;
|
|
6
|
+
> keep app entities, domain methods, seeds, auth policies and query choices here.
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
This document details the code-level architecture of the `stream()` method. While `load()` is a one-shot fetch, `stream()` maintains an active websocket to Firestore. For a high-level overview of our querying strategy, refer to [querying-strategy.md](./querying-strategy.md).
|
|
4
10
|
|
|
5
11
|
## 1. Data Structures & Connection Caching
|
|
@@ -9,7 +15,7 @@ Because websockets are expensive and Firestore limits active listeners (100 conc
|
|
|
9
15
|
The `CachedListenersService` maintains the cache for complex legacy queries:
|
|
10
16
|
|
|
11
17
|
```typescript
|
|
12
|
-
// From cached-listeners.
|
|
18
|
+
// From platform-data/src/cached-listeners.ts
|
|
13
19
|
// Key: "collection.queryParams.queryOptions"
|
|
14
20
|
private connectionByQueryKey: Record<string, CachedConnection> = {};
|
|
15
21
|
|
|
@@ -22,7 +28,7 @@ export interface CachedConnection {
|
|
|
22
28
|
Separately, the `CachedListenersService` maintains a map of generic `StreamMultiplexer` instances, which are delegated to handle simple queries:
|
|
23
29
|
|
|
24
30
|
```typescript
|
|
25
|
-
// From cached-listeners.
|
|
31
|
+
// From platform-data/src/cached-listeners.ts
|
|
26
32
|
// Key: "collection.field"
|
|
27
33
|
private streamMultiplexers = new Map<string, StreamMultiplexer>();
|
|
28
34
|
```
|
|
@@ -30,7 +36,7 @@ private streamMultiplexers = new Map<string, StreamMultiplexer>();
|
|
|
30
36
|
Inside the `StreamMultiplexer` class itself, the state is split to track component lifecycles and batch pools:
|
|
31
37
|
|
|
32
38
|
```typescript
|
|
33
|
-
// From stream-multiplexer.ts
|
|
39
|
+
// From platform-data/src/stream-multiplexer.ts
|
|
34
40
|
export class StreamMultiplexer {
|
|
35
41
|
// Bi-directional tracking between a unique ID and the components (DestroyRefs) that requested it
|
|
36
42
|
private destroyRefsById = new Map<string, Set<DestroyRef>>();
|
|
@@ -180,7 +186,7 @@ Before attempting a complex repack, the system identifies any batch or single li
|
|
|
180
186
|
For the remaining streams that contain a mix of active and orphaned IDs, the multiplexer executes a greedy algorithm to mathematically consolidate them:
|
|
181
187
|
|
|
182
188
|
```typescript
|
|
183
|
-
// From stream-multiplexer.ts: executeSmartRepack()
|
|
189
|
+
// From platform-data/src/stream-multiplexer.ts: executeSmartRepack()
|
|
184
190
|
|
|
185
191
|
// 1. Gather all "sparse" single listeners and candidate batches (<= 25 active IDs)
|
|
186
192
|
const candidateBatches = this.batchedListeners
|
|
@@ -207,7 +213,7 @@ for (let i = 0; i < candidateBatches.length; i++) {
|
|
|
207
213
|
To ensure absolutely zero UI flickering during this repack, the multiplexer implements an **overlapping teardown** mechanism.
|
|
208
214
|
|
|
209
215
|
```typescript
|
|
210
|
-
// From stream-multiplexer.ts: startNewBatches()
|
|
216
|
+
// From platform-data/src/stream-multiplexer.ts: startNewBatches()
|
|
211
217
|
|
|
212
218
|
// We pass the old sockets as an argument, but we do NOT unsubscribe them yet.
|
|
213
219
|
const unsubscribeBatch = this.db.streamEntitiesChanges(this.collection, queryParams, {}).subscribe(changes => {
|
|
@@ -230,7 +236,7 @@ When a component is finally destroyed, it triggers the teardown sequence. Becaus
|
|
|
230
236
|
For standard cached connections, the `CachedListenersService` waits 5 seconds (the "Grace Period") before unsubscribing from Firestore. If the user clicks a link and navigates away but immediately comes back, we don't want to tear down and rebuild the websocket, which causes UI flicker and burns DB reads.
|
|
231
237
|
|
|
232
238
|
```typescript
|
|
233
|
-
// From cached-listeners.
|
|
239
|
+
// From platform-data/src/cached-listeners.ts
|
|
234
240
|
destroyRef.onDestroy(() => {
|
|
235
241
|
setTimeout(() => {
|
|
236
242
|
connection.registeredSet.delete(destroyRef);
|
|
@@ -247,7 +253,7 @@ destroyRef.onDestroy(() => {
|
|
|
247
253
|
For simple multiplexed queries, `StreamMultiplexer` also employs a 5-second grace period. However, because a component might have requested a dozen specific IDs, the multiplexer must selectively remove that component's "claim" on each individual ID.
|
|
248
254
|
|
|
249
255
|
```typescript
|
|
250
|
-
// From stream-multiplexer.ts
|
|
256
|
+
// From platform-data/src/stream-multiplexer.ts
|
|
251
257
|
destroyRef.onDestroy(() => {
|
|
252
258
|
setTimeout(() => {
|
|
253
259
|
let triggeredRemove = false;
|
|
@@ -281,3 +287,11 @@ destroyRef.onDestroy(() => {
|
|
|
281
287
|
```
|
|
282
288
|
|
|
283
289
|
As seen in the code, tearing down Path B rarely results in an immediate websocket disconnection unless a socket is 100% abandoned. Most often, the IDs simply become "orphaned" and are cleaned up asynchronously during the next Smart Repack.
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
Shared entity timestamps use `DataTimestamp` and helpers imported directly from
|
|
293
|
+
`@tech4good/platform-data`. Use `dataTimestampNow()` in seeds and
|
|
294
|
+
`dataTimestampToDate(value)` for UI display. The `/firestore` adapter converts
|
|
295
|
+
native SDK timestamps, including domain fields in nested maps/arrays, at the
|
|
296
|
+
read/write/query boundary. Persisted Firestore documents still use native
|
|
297
|
+
Firestore timestamps. The current timestamp-based delta algorithm is unchanged.
|
|
@@ -14,7 +14,7 @@ const compat = new FlatCompat({
|
|
|
14
14
|
|
|
15
15
|
export default defineConfig([
|
|
16
16
|
// Global ignore
|
|
17
|
-
globalIgnores(["
|
|
17
|
+
globalIgnores(["dist/**/*", ".cache/**/*", ".local/**/*"]),
|
|
18
18
|
|
|
19
19
|
// TypeScript files
|
|
20
20
|
{
|
|
@@ -33,7 +33,13 @@ export default defineConfig([
|
|
|
33
33
|
// We include app and spec tsconfigs because the root tsconfig.json
|
|
34
34
|
// explicitly excludes files ("files": []) and only serves to reference the others.
|
|
35
35
|
// Without these explicit references, ESLint cannot discover the application files.
|
|
36
|
-
project: [
|
|
36
|
+
project: [
|
|
37
|
+
"tsconfig.json",
|
|
38
|
+
"tsconfig.app.json",
|
|
39
|
+
"tsconfig.spec.json",
|
|
40
|
+
"projects/analytics/tsconfig.app.json",
|
|
41
|
+
"projects/analytics/tsconfig.spec.json",
|
|
42
|
+
],
|
|
37
43
|
createDefaultProgram: true,
|
|
38
44
|
},
|
|
39
45
|
},
|
|
@@ -97,4 +103,17 @@ export default defineConfig([
|
|
|
97
103
|
"@typescript-eslint/no-explicit-any": "off"
|
|
98
104
|
}
|
|
99
105
|
},
|
|
100
|
-
|
|
106
|
+
{
|
|
107
|
+
files: ["projects/analytics/**/*.ts"],
|
|
108
|
+
rules: {
|
|
109
|
+
"@angular-eslint/component-selector": [
|
|
110
|
+
"error",
|
|
111
|
+
{ prefix: "analytics", style: "kebab-case", type: "element" },
|
|
112
|
+
],
|
|
113
|
+
"@angular-eslint/directive-selector": [
|
|
114
|
+
"error",
|
|
115
|
+
{ prefix: "analytics", style: "camelCase", type: "attribute" },
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineSecret } from 'firebase-functions/params';
|
|
2
|
+
import { createResendEmailSender, type EmailSender } from '@tech4good/platform-email';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Firebase Secret Manager binding for the Resend API key.
|
|
6
|
+
* Attach `secrets: [resendApiKey]` to any Cloud Function that sends email.
|
|
7
|
+
*/
|
|
8
|
+
export const resendApiKey = defineSecret('RESEND_API_KEY');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Creates a server-side Resend email sender configured for <%= classify(project) %>.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to safe dry-run logging when `RESEND_API_KEY` is unset (such as in local emulators).
|
|
14
|
+
* Override `EMAIL_FROM` and `EMAIL_REPLY_TO` in `functions/.env.<project-id>`.
|
|
15
|
+
*/
|
|
16
|
+
export function createAppEmailSender(): EmailSender {
|
|
17
|
+
return createResendEmailSender({
|
|
18
|
+
apiKey: resendApiKey.value(),
|
|
19
|
+
defaultFrom: process.env['EMAIL_FROM'] || '<%= classify(project) %> <notifications@mail.tech4good.dev>',
|
|
20
|
+
defaultReplyTo: process.env['EMAIL_REPLY_TO'],
|
|
21
|
+
allowDryRunWhenUnconfigured: true,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -45,7 +45,7 @@ const config: Config = {
|
|
|
45
45
|
],
|
|
46
46
|
},
|
|
47
47
|
transformIgnorePatterns: [
|
|
48
|
-
'node_modules/(?!.*\\.mjs$|@angular|@ngrx|rxjs|crypto-es)',
|
|
48
|
+
'node_modules/(?!.*\\.mjs$|@angular|@ngrx|rxjs|crypto-es|vega-embed|vega|vega-lite|json-stringify-pretty-compact|d3-.*)',
|
|
49
49
|
],
|
|
50
50
|
moduleNameMapper: {
|
|
51
51
|
'^src/(.*)$': '<rootDir>/src/$1',
|
|
@@ -59,6 +59,7 @@ const config: Config = {
|
|
|
59
59
|
testPathIgnorePatterns: [
|
|
60
60
|
'/node_modules/',
|
|
61
61
|
'/dist/',
|
|
62
|
+
'<rootDir>/analytics/',
|
|
62
63
|
'<rootDir>/src/environments/environment.test.ts',
|
|
63
64
|
...(process.env['JEST_RULES'] ? [] : ['<rootDir>/firestore.rules.spec.ts', '<rootDir>/firestore.logs.rules.spec.ts'])
|
|
64
65
|
],
|
|
@@ -78,4 +79,4 @@ const config: Config = {
|
|
|
78
79
|
},
|
|
79
80
|
};
|
|
80
81
|
|
|
81
|
-
export default config;
|
|
82
|
+
export default config;
|
|
@@ -4,25 +4,40 @@
|
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"ng": "ng",
|
|
7
|
-
"start": "ng serve",
|
|
8
|
-
"build": "ng build",
|
|
9
|
-
"watch": "ng build --watch --configuration development",
|
|
10
|
-
"test": "jest",
|
|
11
|
-
"test:watch": "jest --watch",
|
|
12
|
-
"test:coverage": "jest --coverage",
|
|
7
|
+
"start": "t4g-entities --watch -- ng serve",
|
|
8
|
+
"build": "t4g-entities && ng build",
|
|
9
|
+
"watch": "t4g-entities --watch -- ng build --watch --configuration development",
|
|
10
|
+
"test": "t4g-entities && jest",
|
|
11
|
+
"test:watch": "t4g-entities --watch -- jest --watch",
|
|
12
|
+
"test:coverage": "t4g-entities && jest --coverage",
|
|
13
13
|
"test:rules": "firebase emulators:exec --only firestore 'JEST_RULES=1 jest firestore.rules.spec.ts firestore.logs.rules.spec.ts'",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
14
|
+
"check:indexes": "t4g-check-firestore-indexes",
|
|
15
|
+
"fix:indexes": "t4g-check-firestore-indexes --fix",
|
|
16
|
+
"lint": "t4g-entities && ng lint <%= dasherize(project) %> && ng lint analytics",
|
|
17
|
+
"lintfix": "ng lint <%= dasherize(project) %> --fix && ng lint analytics --fix",
|
|
18
|
+
"code-check": "t4g-entities && ngc --noEmit && sass src:dist/css-check --no-source-map && rm -rf dist/css-check && npm run lintfix",
|
|
19
|
+
"analyze": "t4g-entities && ng build --stats-json && esbuild-visualizer --metadata dist/<%= dasherize(project) %>/stats.json --filename dist/<%= dasherize(project) %>/bundle-analysis.html && open dist/<%= dasherize(project) %>/bundle-analysis.html",
|
|
20
|
+
"deploy:dev": "t4g-entities && npm --prefix functions run build && ng build --configuration development && firebase deploy --project dev",
|
|
21
|
+
"deploy:prod": "t4g-entities && npm --prefix functions run build && ng build --configuration production && firebase deploy --project prod",
|
|
20
22
|
"deploy:functions:dev": "npm --prefix functions run build && firebase deploy --only functions --project dev",
|
|
21
23
|
"deploy:functions:prod": "npm --prefix functions run build && firebase deploy --only functions --project prod",
|
|
22
|
-
"deploy:logs": "firebase deploy --only firestore:rules --project log --config firebase.logs.json"
|
|
24
|
+
"deploy:logs": "firebase deploy --only firestore:rules --project log --config firebase.logs.json",
|
|
25
|
+
"bigquery:init": "node bigquery/scripts/init_views.js",
|
|
26
|
+
"analytics": "node analytics/scripts/start.js",
|
|
27
|
+
"analytics:serve": "ng serve analytics --host 127.0.0.1 --port 4320 --proxy-config analytics/proxy.conf.json",
|
|
28
|
+
"analytics:server": "node analytics/server/server.js",
|
|
29
|
+
"analytics:refresh": "node analytics/scripts/refresh_snapshot.js",
|
|
30
|
+
"analytics:build": "ng build analytics",
|
|
31
|
+
"analytics:test": "node --test analytics/*.test.js analytics/**/*.test.js",
|
|
32
|
+
"generate:entities": "t4g-entities",
|
|
33
|
+
"check:entities": "t4g-entities --check"
|
|
23
34
|
},
|
|
24
35
|
"private": true,
|
|
25
36
|
"dependencies": {
|
|
37
|
+
"@tech4good/platform-auth": "0.1.0-alpha.0",
|
|
38
|
+
"@tech4good/platform-data": "0.1.0-alpha.0",
|
|
39
|
+
"@tech4good/platform-logging": "0.1.0-alpha.0",
|
|
40
|
+
"@tech4good/platform-ui": "0.1.0-alpha.0",
|
|
26
41
|
"@angular/animations": "^21.2.15",
|
|
27
42
|
"@angular/cdk": "^21.2.13",
|
|
28
43
|
"@angular/common": "^21.2.15",
|
|
@@ -44,7 +59,10 @@
|
|
|
44
59
|
"globalthis": "^1.0.4",
|
|
45
60
|
"proxy-polyfill": "^0.3.2",
|
|
46
61
|
"rxjs": "~7.8.0",
|
|
47
|
-
"tslib": "^2.3.0"
|
|
62
|
+
"tslib": "^2.3.0",
|
|
63
|
+
"vega": "^6.1.2",
|
|
64
|
+
"vega-embed": "^7.1.0",
|
|
65
|
+
"vega-lite": "^6.4.2"
|
|
48
66
|
},
|
|
49
67
|
"devDependencies": {
|
|
50
68
|
"@angular-eslint/builder": "^21.4.0",
|
|
@@ -56,9 +74,13 @@
|
|
|
56
74
|
"@angular/cli": "^21.2.13",
|
|
57
75
|
"@angular/compiler-cli": "^21.2.15",
|
|
58
76
|
"@firebase/rules-unit-testing": "^5.0.1",
|
|
77
|
+
"@google-cloud/bigquery": "^8.3.1",
|
|
78
|
+
"@google-cloud/firestore": "^8.6.0",
|
|
79
|
+
"firebase-admin": "^14.2.0",
|
|
59
80
|
"firebase-tools": "^14.27.0",
|
|
60
81
|
"@ngx-env/builder": "^21.0.1",
|
|
61
|
-
"@tech4good/angular-schematics": "
|
|
82
|
+
"@tech4good/angular-schematics": "^<%= schematicsVersion %>",
|
|
83
|
+
"@tech4good/platform-tooling": "0.1.0-alpha.2",
|
|
62
84
|
"@types/estree": "^1.0.0",
|
|
63
85
|
"@types/jest": "^30.0.0",
|
|
64
86
|
"@types/node": "^18.19.47",
|
|
@@ -78,7 +100,8 @@
|
|
|
78
100
|
"whatwg-fetch": "^3.6.20",
|
|
79
101
|
"ts-jest": "^29.3.4",
|
|
80
102
|
"ts-jest-mock-import-meta": "^1.3.0",
|
|
81
|
-
"ts-node": "^10.9.2"
|
|
103
|
+
"ts-node": "^10.9.2",
|
|
104
|
+
"sqlite3": "^6.0.1"
|
|
82
105
|
},
|
|
83
106
|
"overrides": {
|
|
84
107
|
"firebase": "$firebase",
|