@angular/fire 16.0.0-rc.0 → 17.0.0-canary.05e9da2
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/README.md +14 -41
- package/analytics/analytics.module.d.ts +2 -2
- package/analytics/package.json +3 -0
- package/app/app.module.d.ts +2 -2
- package/app/package.json +3 -0
- package/app-check/app-check.module.d.ts +2 -2
- package/app-check/package.json +3 -0
- package/auth/auth.module.d.ts +2 -2
- package/auth/firebase.d.ts +2 -1
- package/auth/package.json +3 -0
- package/auth-guard/package.json +3 -0
- package/compat/analytics/package.json +3 -0
- package/compat/auth/package.json +3 -0
- package/compat/auth-guard/package.json +3 -0
- package/compat/database/package.json +3 -0
- package/compat/firestore/package.json +3 -0
- package/compat/functions/package.json +3 -0
- package/compat/messaging/package.json +3 -0
- package/compat/package.json +3 -0
- package/compat/performance/package.json +3 -0
- package/compat/remote-config/package.json +3 -0
- package/compat/storage/package.json +3 -0
- package/database/database.module.d.ts +2 -2
- package/database/package.json +3 -0
- package/docs/compat/auth/getting-started.md +4 -4
- package/docs/compat/emulators/emulators.md +28 -2
- package/docs/compat/firestore/collections.md +1 -1
- package/docs/compat/firestore/querying-collections.md +2 -2
- package/docs/compat.md +1 -1
- package/docs/install-and-setup.md +1 -1
- package/docs/messaging.md +187 -9
- package/esm2022/analytics/analytics.module.mjs +30 -23
- package/esm2022/analytics/screen-tracking.service.mjs +6 -6
- package/esm2022/analytics/user-tracking.service.mjs +5 -5
- package/esm2022/app/app.module.mjs +28 -22
- package/esm2022/app-check/app-check.module.mjs +25 -23
- package/esm2022/auth/auth.module.mjs +25 -23
- package/esm2022/auth/firebase.mjs +3 -2
- package/esm2022/auth-guard/auth-guard.mjs +5 -5
- package/esm2022/auth-guard/auth-guard.module.mjs +6 -6
- package/esm2022/compat/analytics/analytics.mjs +6 -6
- package/esm2022/compat/analytics/analytics.module.mjs +7 -7
- package/esm2022/compat/analytics/screen-tracking.service.mjs +6 -6
- package/esm2022/compat/analytics/user-tracking.service.mjs +6 -6
- package/esm2022/compat/auth/auth.mjs +6 -6
- package/esm2022/compat/auth/auth.module.mjs +6 -6
- package/esm2022/compat/auth-guard/auth-guard.mjs +5 -5
- package/esm2022/compat/auth-guard/auth-guard.module.mjs +6 -6
- package/esm2022/compat/database/database.mjs +6 -6
- package/esm2022/compat/database/database.module.mjs +6 -6
- package/esm2022/compat/firebase.app.module.mjs +7 -7
- package/esm2022/compat/firestore/firestore.mjs +6 -6
- package/esm2022/compat/firestore/firestore.module.mjs +6 -6
- package/esm2022/compat/functions/functions.mjs +6 -6
- package/esm2022/compat/functions/functions.module.mjs +6 -6
- package/esm2022/compat/messaging/messaging.mjs +6 -6
- package/esm2022/compat/messaging/messaging.module.mjs +6 -6
- package/esm2022/compat/performance/performance.mjs +6 -6
- package/esm2022/compat/performance/performance.module.mjs +7 -7
- package/esm2022/compat/performance/performance.service.mjs +5 -5
- package/esm2022/compat/remote-config/remote-config.mjs +6 -6
- package/esm2022/compat/remote-config/remote-config.module.mjs +6 -6
- package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +10 -10
- package/esm2022/compat/storage/storage.mjs +6 -6
- package/esm2022/compat/storage/storage.module.mjs +6 -6
- package/esm2022/database/database.module.mjs +27 -25
- package/esm2022/firestore/firestore.module.mjs +27 -25
- package/esm2022/firestore/lite/lite.module.mjs +27 -25
- package/esm2022/functions/functions.module.mjs +27 -25
- package/esm2022/messaging/messaging.module.mjs +29 -22
- package/esm2022/performance/performance.module.mjs +25 -23
- package/esm2022/remote-config/remote-config.module.mjs +29 -22
- package/esm2022/storage/storage.module.mjs +27 -25
- package/esm2022/zones.mjs +5 -5
- package/fesm2022/angular-fire-analytics.mjs +40 -33
- package/fesm2022/angular-fire-analytics.mjs.map +1 -1
- package/fesm2022/angular-fire-app-check.mjs +26 -24
- package/fesm2022/angular-fire-app-check.mjs.map +1 -1
- package/fesm2022/angular-fire-app.mjs +28 -22
- package/fesm2022/angular-fire-app.mjs.map +1 -1
- package/fesm2022/angular-fire-auth-guard.mjs +9 -9
- package/fesm2022/angular-fire-auth-guard.mjs.map +1 -1
- package/fesm2022/angular-fire-auth.mjs +28 -25
- package/fesm2022/angular-fire-auth.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-analytics.mjs +22 -22
- package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-auth-guard.mjs +9 -9
- package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-auth.mjs +10 -10
- package/fesm2022/angular-fire-compat-auth.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-database.mjs +10 -10
- package/fesm2022/angular-fire-compat-database.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-firestore.mjs +10 -10
- package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-functions.mjs +10 -10
- package/fesm2022/angular-fire-compat-functions.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-messaging.mjs +11 -11
- package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-performance.mjs +16 -16
- package/fesm2022/angular-fire-compat-performance.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-remote-config.mjs +11 -11
- package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-storage.mjs +19 -19
- package/fesm2022/angular-fire-compat-storage.mjs.map +1 -1
- package/fesm2022/angular-fire-compat.mjs +6 -6
- package/fesm2022/angular-fire-compat.mjs.map +1 -1
- package/fesm2022/angular-fire-database.mjs +27 -25
- package/fesm2022/angular-fire-database.mjs.map +1 -1
- package/fesm2022/angular-fire-firestore-lite.mjs +27 -25
- package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -1
- package/fesm2022/angular-fire-firestore.mjs +27 -25
- package/fesm2022/angular-fire-firestore.mjs.map +1 -1
- package/fesm2022/angular-fire-functions.mjs +27 -25
- package/fesm2022/angular-fire-functions.mjs.map +1 -1
- package/fesm2022/angular-fire-messaging.mjs +29 -22
- package/fesm2022/angular-fire-messaging.mjs.map +1 -1
- package/fesm2022/angular-fire-performance.mjs +25 -23
- package/fesm2022/angular-fire-performance.mjs.map +1 -1
- package/fesm2022/angular-fire-remote-config.mjs +29 -22
- package/fesm2022/angular-fire-remote-config.mjs.map +1 -1
- package/fesm2022/angular-fire-storage.mjs +27 -25
- package/fesm2022/angular-fire-storage.mjs.map +1 -1
- package/fesm2022/angular-fire.mjs +4 -4
- package/fesm2022/angular-fire.mjs.map +1 -1
- package/firestore/firestore.module.d.ts +2 -2
- package/firestore/lite/lite.module.d.ts +2 -2
- package/firestore/lite/package.json +3 -0
- package/firestore/package.json +3 -0
- package/functions/functions.module.d.ts +2 -2
- package/functions/package.json +3 -0
- package/messaging/messaging.module.d.ts +2 -2
- package/messaging/package.json +3 -0
- package/package.json +12 -12
- package/performance/package.json +3 -0
- package/performance/performance.module.d.ts +2 -2
- package/remote-config/package.json +3 -0
- package/remote-config/remote-config.module.d.ts +2 -2
- package/schematics/firebaseTools.js +2 -2
- package/schematics/interfaces.js +9 -8
- package/schematics/setup/index.js +46 -47
- package/schematics/setup/prompts.js +24 -19
- package/schematics/utils.js +77 -59
- package/storage/package.json +3 -0
- package/storage/storage.module.d.ts +2 -2
|
@@ -14,64 +14,46 @@ const fs_1 = require("fs");
|
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const core_1 = require("@angular-devkit/core");
|
|
16
16
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
17
|
+
const utility_1 = require("@schematics/angular/utility");
|
|
17
18
|
const common_1 = require("../common");
|
|
18
19
|
const firebaseTools_1 = require("../firebaseTools");
|
|
19
20
|
const utils_1 = require("../utils");
|
|
20
21
|
const prompts_1 = require("./prompts");
|
|
21
|
-
const setupProject = (tree, context, features, config) =>
|
|
22
|
-
|
|
23
|
-
const { path: workspacePath, workspace } = (0, utils_1.getWorkspace)(tree);
|
|
24
|
-
const { project, projectName } = (0, utils_1.getProject)(config, tree);
|
|
25
|
-
const sourcePath = (_a = project.sourceRoot) !== null && _a !== void 0 ? _a : project.root;
|
|
22
|
+
const setupProject = (tree, context, features, config) => {
|
|
23
|
+
const { projectName } = (0, utils_1.getProject)(config, tree);
|
|
26
24
|
(0, utils_1.addIgnoreFiles)(tree);
|
|
27
|
-
const featuresToImport = features.filter(it => it !== 0);
|
|
28
|
-
if (featuresToImport.length > 0) {
|
|
29
|
-
(0, utils_1.addToNgModule)(tree, { features: featuresToImport, sourcePath });
|
|
30
|
-
(0, utils_1.addFixesToServer)(tree);
|
|
31
|
-
}
|
|
32
|
-
if (config.sdkConfig) {
|
|
33
|
-
const source = `
|
|
34
|
-
firebase: {
|
|
35
|
-
${Object.entries(config.sdkConfig).reduce((c, [k, v]) => c.concat(` ${k}: '${v}'`), []).join(',\n')},
|
|
36
|
-
}`;
|
|
37
|
-
const environmentPath = `${sourcePath}/environments/environment.ts`;
|
|
38
|
-
(0, utils_1.addEnvironmentEntry)(tree, `/${environmentPath}`, source);
|
|
39
|
-
Object.values(project.architect || {}).forEach(builder => {
|
|
40
|
-
Object.values(builder.configurations || {}).forEach(configuration => {
|
|
41
|
-
(configuration.fileReplacements || []).forEach((replacement) => {
|
|
42
|
-
if (replacement.replace === environmentPath) {
|
|
43
|
-
(0, utils_1.addEnvironmentEntry)(tree, `/${replacement.with}`, source);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
const options = {
|
|
50
|
-
project: projectName,
|
|
51
|
-
firebaseProject: config.firebaseProject,
|
|
52
|
-
firebaseApp: config.firebaseApp,
|
|
53
|
-
firebaseHostingSite: config.firebaseHostingSite,
|
|
54
|
-
sdkConfig: config.sdkConfig,
|
|
55
|
-
prerender: undefined,
|
|
56
|
-
browserTarget: config.browserTarget,
|
|
57
|
-
serverTarget: config.serverTarget,
|
|
58
|
-
prerenderTarget: config.prerenderTarget,
|
|
59
|
-
ssrRegion: config.ssrRegion,
|
|
60
|
-
};
|
|
61
25
|
if (features.includes(0)) {
|
|
62
|
-
|
|
26
|
+
const { path: workspacePath, workspace } = (0, utils_1.getWorkspace)(tree);
|
|
27
|
+
const { project, projectName } = (0, utils_1.getProject)(config, tree);
|
|
28
|
+
(0, exports.setupFirebase)({
|
|
63
29
|
workspace,
|
|
64
30
|
workspacePath,
|
|
65
|
-
options
|
|
31
|
+
options: {
|
|
32
|
+
project: projectName,
|
|
33
|
+
firebaseProject: config.firebaseProject,
|
|
34
|
+
firebaseApp: config.firebaseApp,
|
|
35
|
+
firebaseHostingSite: config.firebaseHostingSite,
|
|
36
|
+
sdkConfig: config.sdkConfig,
|
|
37
|
+
buildTarget: config.buildTarget,
|
|
38
|
+
serveTarget: config.serveTarget,
|
|
39
|
+
ssrRegion: config.ssrRegion,
|
|
40
|
+
},
|
|
66
41
|
tree,
|
|
67
42
|
context,
|
|
68
43
|
project
|
|
69
44
|
});
|
|
70
45
|
}
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
const featuresToImport = features.filter(it => it !== 0);
|
|
47
|
+
if (featuresToImport.length > 0) {
|
|
48
|
+
return (0, schematics_1.chain)([
|
|
49
|
+
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
50
|
+
external('initializeApp', '@angular/fire/app');
|
|
51
|
+
return code `${external('provideFirebaseApp', '@angular/fire/app')}(() => initializeApp(${JSON.stringify(config.sdkConfig)}))`;
|
|
52
|
+
}),
|
|
53
|
+
...(0, utils_1.featureToRules)(features, projectName),
|
|
54
|
+
]);
|
|
73
55
|
}
|
|
74
|
-
}
|
|
56
|
+
};
|
|
75
57
|
exports.setupProject = setupProject;
|
|
76
58
|
const ngAddSetupProject = (options) => (host, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
59
|
let projectRoot = host._backend._root;
|
|
@@ -85,7 +67,10 @@ const ngAddSetupProject = (options) => (host, context) => __awaiter(void 0, void
|
|
|
85
67
|
(0, fs_1.writeFileSync)((0, path_1.join)(projectRoot, 'firebase.json'), '{}');
|
|
86
68
|
}
|
|
87
69
|
const user = yield (0, prompts_1.userPrompt)({ projectRoot });
|
|
88
|
-
yield firebaseTools.login
|
|
70
|
+
const defaultUser = yield firebaseTools.login(options);
|
|
71
|
+
if (user.email !== (defaultUser === null || defaultUser === void 0 ? void 0 : defaultUser.email)) {
|
|
72
|
+
yield firebaseTools.login.use(user.email, { projectRoot });
|
|
73
|
+
}
|
|
89
74
|
const { project: ngProject, projectName: ngProjectName } = (0, utils_1.getProject)(options, host);
|
|
90
75
|
const [defaultProjectName] = (0, utils_1.getFirebaseProjectNameFromHost)(host, ngProjectName);
|
|
91
76
|
const firebaseProject = yield (0, prompts_1.projectPrompt)(defaultProjectName, { projectRoot, account: user.email });
|
|
@@ -104,7 +89,7 @@ const ngAddSetupProject = (options) => (host, context) => __awaiter(void 0, void
|
|
|
104
89
|
const result = yield firebaseTools.apps.sdkconfig('web', firebaseApp.appId, { nonInteractive: true, projectRoot });
|
|
105
90
|
sdkConfig = result.sdkConfig;
|
|
106
91
|
}
|
|
107
|
-
|
|
92
|
+
return (0, exports.setupProject)(host, context, features, Object.assign(Object.assign(Object.assign({}, options), hosting), { firebaseProject, firebaseApp, firebaseHostingSite, sdkConfig }));
|
|
108
93
|
}
|
|
109
94
|
});
|
|
110
95
|
exports.ngAddSetupProject = ngAddSetupProject;
|
|
@@ -138,6 +123,7 @@ function generateFirebaseJson(tree, path, project, region) {
|
|
|
138
123
|
}
|
|
139
124
|
exports.generateFirebaseJson = generateFirebaseJson;
|
|
140
125
|
const setupFirebase = (config) => {
|
|
126
|
+
var _a, _b, _c, _d;
|
|
141
127
|
const { tree, workspacePath, workspace, options } = config;
|
|
142
128
|
const project = workspace.projects[options.project];
|
|
143
129
|
if (!project.architect) {
|
|
@@ -145,7 +131,20 @@ const setupFirebase = (config) => {
|
|
|
145
131
|
}
|
|
146
132
|
project.architect.deploy = {
|
|
147
133
|
builder: '@angular/fire:deploy',
|
|
148
|
-
options:
|
|
134
|
+
options: {
|
|
135
|
+
version: 2,
|
|
136
|
+
},
|
|
137
|
+
configurations: {
|
|
138
|
+
production: {
|
|
139
|
+
buildTarget: (_a = options.buildTarget) === null || _a === void 0 ? void 0 : _a[0],
|
|
140
|
+
serveTarget: (_b = options.serveTarget) === null || _b === void 0 ? void 0 : _b[0],
|
|
141
|
+
},
|
|
142
|
+
development: {
|
|
143
|
+
buildTarget: (_c = options.buildTarget) === null || _c === void 0 ? void 0 : _c[1],
|
|
144
|
+
serveTarget: (_d = options.serveTarget) === null || _d === void 0 ? void 0 : _d[1],
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
defaultConfiguration: 'production',
|
|
149
148
|
};
|
|
150
149
|
tree.overwrite(workspacePath, JSON.stringify(workspace, null, 2));
|
|
151
150
|
generateFirebaseJson(tree, 'firebase.json', options.project, options.ssrRegion);
|
|
@@ -33,6 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.projectTypePrompt = exports.sitePrompt = exports.appPrompt = exports.projectPrompt = exports.userPrompt = exports.featuresPrompt = exports.searchSites = exports.searchApps = exports.searchProjects = void 0;
|
|
36
|
+
const child_process_1 = require("child_process");
|
|
36
37
|
const fuzzy = __importStar(require("fuzzy"));
|
|
37
38
|
const inquirer = __importStar(require("inquirer"));
|
|
38
39
|
const common_1 = require("../common");
|
|
@@ -141,15 +142,14 @@ exports.featuresPrompt = featuresPrompt;
|
|
|
141
142
|
const userPrompt = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
142
143
|
var _a;
|
|
143
144
|
const firebaseTools = yield (0, firebaseTools_1.getFirebaseTools)();
|
|
144
|
-
|
|
145
|
-
if (!
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return user;
|
|
145
|
+
let loginList = yield firebaseTools.login.list();
|
|
146
|
+
if (!Array.isArray(loginList) || loginList.length === 0) {
|
|
147
|
+
(0, child_process_1.spawnSync)('firebase login', { shell: true, cwd: options.projectRoot, stdio: 'inherit' });
|
|
148
|
+
return yield firebaseTools.login(options);
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
const defaultUser = yield firebaseTools.login(options);
|
|
152
|
-
const choices =
|
|
152
|
+
const choices = loginList.map(({ user }) => ({ name: user.email, value: user }));
|
|
153
153
|
const newChoice = { name: '[Login in with another account]', value: NEW_OPTION };
|
|
154
154
|
const { user } = yield inquirer.prompt({
|
|
155
155
|
type: 'list',
|
|
@@ -159,8 +159,17 @@ const userPrompt = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
159
159
|
default: (_a = choices.find(it => it.value.email === defaultUser.email)) === null || _a === void 0 ? void 0 : _a.value,
|
|
160
160
|
});
|
|
161
161
|
if (user === NEW_OPTION) {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
(0, child_process_1.spawnSync)('firebase login:add', { shell: true, cwd: options.projectRoot, stdio: 'inherit' });
|
|
163
|
+
loginList = yield firebaseTools.login.list();
|
|
164
|
+
if (!Array.isArray(loginList)) {
|
|
165
|
+
throw new Error("firebase login:list did not respond as expected");
|
|
166
|
+
}
|
|
167
|
+
const priorEmails = choices.map(it => it.name);
|
|
168
|
+
const newLogin = loginList.find(it => !priorEmails.includes(it.user.email));
|
|
169
|
+
if (!newLogin) {
|
|
170
|
+
throw new Error("Did not find a new user.");
|
|
171
|
+
}
|
|
172
|
+
return newLogin.user;
|
|
164
173
|
}
|
|
165
174
|
return user;
|
|
166
175
|
}
|
|
@@ -256,15 +265,11 @@ const ALLOWED_SSR_REGIONS = [
|
|
|
256
265
|
{ name: 'asia-east1 (Taiwan)', value: 'asia-east1' },
|
|
257
266
|
];
|
|
258
267
|
const projectTypePrompt = (project, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if ((0, utils_1.isUniversalApp)(project)) {
|
|
264
|
-
serverTarget = `${name}:server:${((_e = (_d = project.architect) === null || _d === void 0 ? void 0 : _d.server) === null || _e === void 0 ? void 0 : _e.defaultConfiguration) || 'production'}`;
|
|
265
|
-
browserTarget = `${name}:build:${((_g = (_f = project.architect) === null || _f === void 0 ? void 0 : _f.build) === null || _g === void 0 ? void 0 : _g.defaultConfiguration) || 'production'}`;
|
|
266
|
-
const prerender = (0, utils_1.hasPrerenderOption)(project);
|
|
267
|
-
prerenderTarget = prerender && `${name}:prerender:${prerender.defaultConfiguration || 'production'}`;
|
|
268
|
+
const buildTarget = [`${name}:build:production`, `${name}:build:development`];
|
|
269
|
+
const serveTarget = (0, utils_1.isUniversalApp)(project) ?
|
|
270
|
+
[`${name}:serve-ssr:production`, `${name}:serve-ssr:development`] :
|
|
271
|
+
[`${name}:serve:production`, `${name}:serve:development`];
|
|
272
|
+
if ((0, utils_1.isUniversalApp)(project) || (0, utils_1.isSSRApp)(project)) {
|
|
268
273
|
const { ssrRegion } = yield inquirer.prompt({
|
|
269
274
|
type: 'list',
|
|
270
275
|
name: 'ssrRegion',
|
|
@@ -272,8 +277,8 @@ const projectTypePrompt = (project, name) => __awaiter(void 0, void 0, void 0, f
|
|
|
272
277
|
message: 'In which region would you like to host server-side content?',
|
|
273
278
|
default: DEFAULT_REGION,
|
|
274
279
|
});
|
|
275
|
-
return {
|
|
280
|
+
return { projectType: 3, ssrRegion, buildTarget, serveTarget };
|
|
276
281
|
}
|
|
277
|
-
return { projectType: 3,
|
|
282
|
+
return { projectType: 3, buildTarget, serveTarget };
|
|
278
283
|
});
|
|
279
284
|
exports.projectTypePrompt = projectTypePrompt;
|
package/schematics/utils.js
CHANGED
|
@@ -3,17 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.addIgnoreFiles = exports.
|
|
6
|
+
exports.addIgnoreFiles = exports.featureToRules = exports.addFixesToServer = exports.addEnvironmentEntry = exports.getFirebaseProjectNameFromFs = exports.getFirebaseProjectNameFromHost = exports.getProject = exports.getWorkspace = exports.shortAppId = exports.hasPrerenderOption = exports.isSSRApp = exports.isUniversalApp = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
10
10
|
const typescript_1 = __importDefault(require("@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
11
|
+
const utility_1 = require("@schematics/angular/utility");
|
|
11
12
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
12
13
|
const change_1 = require("@schematics/angular/utility/change");
|
|
13
|
-
const find_module_1 = require("@schematics/angular/utility/find-module");
|
|
14
14
|
const common_1 = require("./common");
|
|
15
15
|
const isUniversalApp = (project) => { var _a; return (_a = project.architect) === null || _a === void 0 ? void 0 : _a.server; };
|
|
16
16
|
exports.isUniversalApp = isUniversalApp;
|
|
17
|
+
const isSSRApp = (project) => { var _a, _b; return !!((_b = (_a = project.architect) === null || _a === void 0 ? void 0 : _a.build.options) === null || _b === void 0 ? void 0 : _b.ssr); };
|
|
18
|
+
exports.isSSRApp = isSSRApp;
|
|
17
19
|
const hasPrerenderOption = (project) => { var _a; return (_a = project.architect) === null || _a === void 0 ? void 0 : _a.prerender; };
|
|
18
20
|
exports.hasPrerenderOption = hasPrerenderOption;
|
|
19
21
|
const shortAppId = (app) => { var _a; return (_a = app === null || app === void 0 ? void 0 : app.appId) === null || _a === void 0 ? void 0 : _a.split('/').pop(); };
|
|
@@ -138,64 +140,80 @@ ${addZonePatch ? 'import \'zone.js/dist/zone-patch-rxjs\';' : ''}`));
|
|
|
138
140
|
return host;
|
|
139
141
|
}
|
|
140
142
|
exports.addFixesToServer = addFixesToServer;
|
|
141
|
-
function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
143
|
+
function featureToRules(features, projectName) {
|
|
144
|
+
return features.map(feature => {
|
|
145
|
+
switch (feature) {
|
|
146
|
+
case 3:
|
|
147
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
148
|
+
external('initializeAppCheck', '@angular/fire/app-check');
|
|
149
|
+
external('ReCaptchaEnterpriseProvider', '@angular/fire/app-check');
|
|
150
|
+
return code `${external('provideAppCheck', '@angular/fire/app-check')}(() => {
|
|
151
|
+
// TODO get a reCAPTCHA Enterprise here https://console.cloud.google.com/security/recaptcha?project=_
|
|
152
|
+
const provider = new ReCaptchaEnterpriseProvider(/* reCAPTCHA Enterprise site key */);
|
|
153
|
+
return initializeAppCheck(undefined, { provider, isTokenAutoRefreshEnabled: true });
|
|
154
|
+
})`;
|
|
155
|
+
});
|
|
156
|
+
case 2:
|
|
157
|
+
return (0, schematics_1.chain)([
|
|
158
|
+
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
159
|
+
external('getAnalytics', '@angular/fire/analytics');
|
|
160
|
+
return code `${external('provideAnalytics', '@angular/fire/analytics')}(() => getAnalytics())`;
|
|
161
|
+
}),
|
|
162
|
+
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
163
|
+
return code `${external('ScreenTrackingService', '@angular/fire/analytics')}`;
|
|
164
|
+
}),
|
|
165
|
+
...(features.includes(1) ? [
|
|
166
|
+
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
167
|
+
return code `${external('UserTrackingService', '@angular/fire/analytics')}`;
|
|
168
|
+
})
|
|
169
|
+
] : []),
|
|
170
|
+
]);
|
|
171
|
+
case 1:
|
|
172
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
173
|
+
external('getAuth', '@angular/fire/auth');
|
|
174
|
+
return code `${external('provideAuth', '@angular/fire/auth')}(() => getAuth())`;
|
|
175
|
+
});
|
|
176
|
+
case 4:
|
|
177
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
178
|
+
external('getDatabase', '@angular/fire/database');
|
|
179
|
+
return code `${external('provideDatabase', '@angular/fire/database')}(() => getDatabase())`;
|
|
180
|
+
});
|
|
181
|
+
case 8:
|
|
182
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
183
|
+
external('getFirestore', '@angular/fire/firestore');
|
|
184
|
+
return code `${external('provideFirestore', '@angular/fire/firestore')}(() => getFirestore())`;
|
|
185
|
+
});
|
|
186
|
+
case 5:
|
|
187
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
188
|
+
external('getFunctions', '@angular/fire/functions');
|
|
189
|
+
return code `${external('provideFunctions', '@angular/fire/functions')}(() => getFunctions())`;
|
|
190
|
+
});
|
|
191
|
+
case 6:
|
|
192
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
193
|
+
external('getMessaging', '@angular/fire/messaging');
|
|
194
|
+
return code `${external('provideMessaging', '@angular/fire/messaging')}(() => getMessaging())`;
|
|
195
|
+
});
|
|
196
|
+
case 7:
|
|
197
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
198
|
+
external('getPerformance', '@angular/fire/performance');
|
|
199
|
+
return code `${external('providePerformance', '@angular/fire/performance')}(() => getPerformance())`;
|
|
200
|
+
});
|
|
201
|
+
case 9:
|
|
202
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
203
|
+
external('getStorage', '@angular/fire/storage');
|
|
204
|
+
return code `${external('provideStorage', '@angular/fire/storage')}(() => getStorage())`;
|
|
205
|
+
});
|
|
206
|
+
case 10:
|
|
207
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
208
|
+
external('getRemoteConfig', '@angular/fire/remote-config');
|
|
209
|
+
return code `${external('provideRemoteConfig', '@angular/fire/remote-config')}(() => getRemoteConfig())`;
|
|
210
|
+
});
|
|
211
|
+
default:
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
}).filter((it) => !!it);
|
|
197
215
|
}
|
|
198
|
-
exports.
|
|
216
|
+
exports.featureToRules = featureToRules;
|
|
199
217
|
const addIgnoreFiles = (host) => {
|
|
200
218
|
const path = '/.gitignore';
|
|
201
219
|
if (!host.exists(path)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken, Injector,
|
|
1
|
+
import { EnvironmentProviders, InjectionToken, Injector, NgZone } from '@angular/core';
|
|
2
2
|
import { FirebaseApp } from '@angular/fire/app';
|
|
3
3
|
import { FirebaseStorage } from 'firebase/storage';
|
|
4
4
|
import { Storage } from './storage';
|
|
@@ -12,4 +12,4 @@ export declare class StorageModule {
|
|
|
12
12
|
static ɵmod: i0.ɵɵNgModuleDeclaration<StorageModule, never, never, never>;
|
|
13
13
|
static ɵinj: i0.ɵɵInjectorDeclaration<StorageModule>;
|
|
14
14
|
}
|
|
15
|
-
export declare function provideStorage(fn: (injector: Injector) => FirebaseStorage, ...deps: any[]):
|
|
15
|
+
export declare function provideStorage(fn: (injector: Injector) => FirebaseStorage, ...deps: any[]): EnvironmentProviders;
|