@tech4good/angular-schematics 21.3.0 → 21.5.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/.t4g/agent-memory.db +0 -0
- package/CHANGELOG.md +41 -0
- package/package.json +1 -1
- package/src/entity/index.js +42 -9
- package/src/entity/index.js.map +1 -1
- package/src/entity/index_spec.js +42 -8
- package/src/entity/index_spec.js.map +1 -1
- package/src/entity/schema.json +0 -5
- package/src/ng-add/files/.firebaserc.template +2 -1
- package/src/ng-add/files/.gitignore.template +1 -0
- package/src/ng-add/files/angular.json.template +3 -0
- package/src/ng-add/files/bigquery/queries/active_time_by_route.sql.template +34 -0
- package/src/ng-add/files/bigquery/scripts/export_entities.py.template +143 -0
- package/src/ng-add/files/bigquery/scripts/run_query.py.template +167 -0
- package/src/ng-add/files/bigquery/views/events_flat.sql.template +60 -0
- package/src/ng-add/files/bigquery/views/logs_latest.sql.template +34 -0
- package/src/ng-add/files/docs-infra/analytics-guide.md.template +170 -0
- package/src/ng-add/files/firebase.logs.json.template +5 -0
- package/src/ng-add/files/firestore.indexes.json.template +89 -0
- package/src/ng-add/files/firestore.logs.rules.spec.ts.template +100 -0
- package/src/ng-add/files/firestore.logs.rules.template +8 -0
- package/src/ng-add/files/firestore.rules.spec.ts.template +88 -1
- package/src/ng-add/files/firestore.rules.template +9 -0
- package/src/ng-add/files/jest.config.ts.template +1 -1
- package/src/ng-add/files/package.json.template +6 -3
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.spec.ts.template +3 -3
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.spec.ts.template +0 -1
- package/src/ng-add/files/src/app/app.component.html.template +1 -1
- package/src/ng-add/files/src/app/app.component.scss.template +9 -1
- package/src/ng-add/files/src/app/app.component.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/auth-routing.spec.ts.template +1 -1
- package/src/ng-add/files/src/app/core/analytics/log.service.ts.template +27 -5
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.spec.ts.template +147 -4
- package/src/ng-add/files/src/app/core/analytics/time-analytics.service.ts.template +355 -149
- package/src/ng-add/files/src/app/core/auth/guards/require-auth-and-consent.guard.ts.template +3 -1
- package/src/ng-add/files/src/app/core/firebase/cached-listeners.service.ts.template +53 -51
- package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +6 -0
- package/src/ng-add/files/src/app/core/firebase/simulate-load.spec.ts.template +2 -2
- package/src/ng-add/files/src/app/core/firebase/simulate-stream.spec.ts.template +14 -14
- package/src/ng-add/files/src/app/core/firebase/stream-multiplexer.ts.template +50 -48
- package/src/ng-add/files/src/app/core/logging/logging.service.spec.ts.template +118 -0
- package/src/ng-add/files/src/app/core/logging/logging.service.ts.template +168 -0
- package/src/ng-add/files/src/app/core/store/app.model.ts.template +3 -1
- package/src/ng-add/files/src/app/core/store/app.store.ts.template +11 -9
- package/src/ng-add/files/src/app/core/store/auth/auth.mock.ts.template +5 -4
- package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +13 -4
- package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +0 -4
- package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +0 -1
- package/src/ng-add/files/src/app/core/store/user-private/user-private.mock.ts.template +15 -0
- package/src/ng-add/files/src/app/core/store/user-private/user-private.model.ts.template +9 -0
- package/src/ng-add/files/src/app/core/store/user-private/user-private.store.ts.template +41 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.html.template +172 -48
- package/src/ng-add/files/src/app/first-time/consent/consent.component.scss.template +31 -0
- package/src/ng-add/files/src/app/first-time/consent/consent.component.spec.ts.template +31 -3
- package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +12 -11
- package/src/ng-add/files/src/app/first-time/consent/consent.guard.ts.template +0 -6
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.spec.ts.template +0 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +1 -1
- package/src/ng-add/files/src/app/first-time/early-access/early-access.guard.ts.template +7 -1
- package/src/ng-add/files/src/app/first-time/first-time-routing.spec.ts.template +7 -6
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +3 -3
- package/src/ng-add/files/src/app/first-time/landing/landing.component.scss.template +1 -1
- package/src/ng-add/files/src/app/first-time/onboarding/onboarding.component.ts.template +3 -3
- package/src/ng-add/files/src/app/main/home/home.component.spec.ts.template +1 -1
- package/src/ng-add/files/src/app/main/home/home.component.ts.template +4 -4
- package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.scss.template +1 -0
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.spec.ts.template +41 -5
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +25 -2
- package/src/ng-add/files/src/environments/environment.test.ts.template +1 -1
- package/src/shared/statements-adder.d.ts +1 -0
- package/src/shared/statements-adder.js +8 -0
- package/src/shared/statements-adder.js.map +1 -1
- package/src/ng-add/files/src/app/core/firebase/query-logger.ts.template +0 -11
- package/tech4good-angular-schematics-21.0.0.tgz +0 -0
|
@@ -12,12 +12,31 @@ export class DetectRedeploymentService {
|
|
|
12
12
|
|
|
13
13
|
constructor() {}
|
|
14
14
|
|
|
15
|
+
/** Retrieves the filename of the currently loaded main javascript bundle. */
|
|
16
|
+
private getLoadedMainScript(): string | null {
|
|
17
|
+
if (typeof document === 'undefined') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const scripts = Array.from(document.querySelectorAll('script'));
|
|
21
|
+
for (const script of scripts) {
|
|
22
|
+
const src = script.getAttribute('src');
|
|
23
|
+
if (src) {
|
|
24
|
+
const m = src.match(/main[-a-zA-Z0-9]*\.js/);
|
|
25
|
+
if (m) {
|
|
26
|
+
return m[0];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
15
33
|
/** Sets redeployed$ and returns it. */
|
|
16
34
|
public init() {
|
|
17
35
|
// Matches the filename of the main javascript file, which contains the hash in the name
|
|
18
36
|
const regexp = /main[-a-zA-Z0-9]*\.js/;
|
|
37
|
+
const currentScript = this.getLoadedMainScript();
|
|
19
38
|
|
|
20
|
-
const observable
|
|
39
|
+
const observable = (interval(2 * 60 * 1000) // every 2 minutes
|
|
21
40
|
.pipe(
|
|
22
41
|
startWith(0),
|
|
23
42
|
// Fetch index.html with a timestamp query parameter so it definitely doesn't get cached anywhere.
|
|
@@ -34,6 +53,10 @@ export class DetectRedeploymentService {
|
|
|
34
53
|
}
|
|
35
54
|
}),
|
|
36
55
|
filter((val) => !!val),
|
|
56
|
+
// Prepend the currently loaded script tag if available so that if index.html
|
|
57
|
+
// is updated before loading, we detect it immediately on the first check.
|
|
58
|
+
startWith(currentScript),
|
|
59
|
+
filter((val) => !!val),
|
|
37
60
|
// Only emit when there are unique versions
|
|
38
61
|
distinctUntilChanged(),
|
|
39
62
|
// Skip the first starting version so we only get changes
|
|
@@ -42,7 +65,7 @@ export class DetectRedeploymentService {
|
|
|
42
65
|
map(() => undefined as void),
|
|
43
66
|
// Modeled after example 1 in: https://www.learnrxjs.io/operators/multicasting/multicast.html
|
|
44
67
|
share(),
|
|
45
|
-
);
|
|
68
|
+
) as Observable<void>);
|
|
46
69
|
|
|
47
70
|
observable.subscribe();
|
|
48
71
|
|
|
@@ -5,4 +5,5 @@ export interface IHash {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function getSourceText(host: Tree, filePath: string): string;
|
|
7
7
|
export declare function simpleInsert(sourceText: string, fileToEdit: string, labels: string[], statements: string[]): Change[];
|
|
8
|
+
export declare function insertBefore(sourceText: string, fileToEdit: string, label: string, statement: string): Change;
|
|
8
9
|
export declare function AddStatements(filePath: string, labels: string[], statements: string[], tree: Tree): void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSourceText = getSourceText;
|
|
4
4
|
exports.simpleInsert = simpleInsert;
|
|
5
|
+
exports.insertBefore = insertBefore;
|
|
5
6
|
exports.AddStatements = AddStatements;
|
|
6
7
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
8
|
const change_1 = require("@schematics/angular/utility/change");
|
|
@@ -23,6 +24,13 @@ function simpleInsert(sourceText, fileToEdit, labels, statements) {
|
|
|
23
24
|
return new change_1.InsertChange(fileToEdit, index, `\n${statements[i]}`);
|
|
24
25
|
});
|
|
25
26
|
}
|
|
27
|
+
function insertBefore(sourceText, fileToEdit, label, statement) {
|
|
28
|
+
const index = sourceText.indexOf(label);
|
|
29
|
+
if (index === -1) {
|
|
30
|
+
throw new schematics_1.SchematicsException(`Label "${label}" not found in ${fileToEdit}`);
|
|
31
|
+
}
|
|
32
|
+
return new change_1.InsertChange(fileToEdit, index, statement);
|
|
33
|
+
}
|
|
26
34
|
function AddStatements(filePath, labels, statements, tree) {
|
|
27
35
|
// getSourceText
|
|
28
36
|
let text = tree.read(filePath); // reads the file from the tree
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statements-adder.js","sourceRoot":"","sources":["statements-adder.ts"],"names":[],"mappings":";;AAOA,sCAMC;AAED,oCAWC;AAED,sCAyBG;
|
|
1
|
+
{"version":3,"file":"statements-adder.js","sourceRoot":"","sources":["statements-adder.ts"],"names":[],"mappings":";;AAOA,sCAMC;AAED,oCAWC;AAED,oCAMC;AAED,sCAyBG;AA7DH,2DAAuE;AACvE,+DAA0E;AAM1E,SAAgB,aAAa,CAAC,IAAU,EAAE,QAAgB;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,gCAAmB,CAAC,QAAQ,QAAQ,kBAAkB,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO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C,CAAC,MAAM,CAAC;AAC/D,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isDevMode } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
// Flip this to `true` when you want to trace query execution!
|
|
4
|
-
// This will output rich logs for stream multiplexing and load bucketing.
|
|
5
|
-
export const DEBUG_QUERY_SYSTEM = false;
|
|
6
|
-
|
|
7
|
-
export function queryLog(...args: unknown[]) {
|
|
8
|
-
if (isDevMode() && DEBUG_QUERY_SYSTEM) {
|
|
9
|
-
console.log(...args);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
Binary file
|