@angular/fire 17.0.0 → 17.1.0-canary.1302e3a
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 +21 -24
- package/analytics/analytics.module.d.ts +2 -2
- package/app/app.module.d.ts +2 -2
- package/app/firebase.d.ts +2 -1
- package/app-check/app-check.module.d.ts +2 -2
- package/auth/auth.module.d.ts +2 -2
- package/database/database.module.d.ts +2 -2
- 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 +24 -17
- package/esm2022/app/app.module.mjs +22 -16
- package/esm2022/app/firebase.mjs +3 -2
- package/esm2022/app-check/app-check.module.mjs +20 -18
- package/esm2022/auth/auth.module.mjs +20 -18
- package/esm2022/database/database.module.mjs +22 -20
- package/esm2022/firestore/firestore.module.mjs +22 -20
- package/esm2022/firestore/lite/lite.module.mjs +22 -20
- package/esm2022/functions/functions.module.mjs +22 -20
- package/esm2022/messaging/messaging.module.mjs +24 -17
- package/esm2022/performance/performance.module.mjs +20 -18
- package/esm2022/remote-config/remote-config.module.mjs +24 -17
- package/esm2022/storage/storage.module.mjs +22 -20
- package/esm2022/vertexai-preview/angular-fire-vertexai-preview.mjs +5 -0
- package/esm2022/vertexai-preview/firebase.mjs +7 -0
- package/esm2022/vertexai-preview/public_api.mjs +4 -0
- package/esm2022/vertexai-preview/vertexai.mjs +16 -0
- package/esm2022/vertexai-preview/vertexai.module.mjs +73 -0
- package/fesm2022/angular-fire-analytics.mjs +23 -16
- package/fesm2022/angular-fire-analytics.mjs.map +1 -1
- package/fesm2022/angular-fire-app-check.mjs +19 -17
- package/fesm2022/angular-fire-app-check.mjs.map +1 -1
- package/fesm2022/angular-fire-app.mjs +24 -17
- package/fesm2022/angular-fire-app.mjs.map +1 -1
- package/fesm2022/angular-fire-auth.mjs +19 -17
- package/fesm2022/angular-fire-auth.mjs.map +1 -1
- package/fesm2022/angular-fire-database.mjs +21 -19
- package/fesm2022/angular-fire-database.mjs.map +1 -1
- package/fesm2022/angular-fire-firestore-lite.mjs +21 -19
- package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -1
- package/fesm2022/angular-fire-firestore.mjs +21 -19
- package/fesm2022/angular-fire-firestore.mjs.map +1 -1
- package/fesm2022/angular-fire-functions.mjs +21 -19
- package/fesm2022/angular-fire-functions.mjs.map +1 -1
- package/fesm2022/angular-fire-messaging.mjs +23 -16
- package/fesm2022/angular-fire-messaging.mjs.map +1 -1
- package/fesm2022/angular-fire-performance.mjs +19 -17
- package/fesm2022/angular-fire-performance.mjs.map +1 -1
- package/fesm2022/angular-fire-remote-config.mjs +23 -16
- package/fesm2022/angular-fire-remote-config.mjs.map +1 -1
- package/fesm2022/angular-fire-storage.mjs +21 -19
- package/fesm2022/angular-fire-storage.mjs.map +1 -1
- package/fesm2022/angular-fire-vertexai-preview.mjs +99 -0
- package/fesm2022/angular-fire-vertexai-preview.mjs.map +1 -0
- package/firestore/firestore.module.d.ts +2 -2
- package/firestore/lite/lite.module.d.ts +2 -2
- package/functions/functions.module.d.ts +2 -2
- package/messaging/messaging.module.d.ts +2 -2
- package/package.json +9 -3
- package/performance/performance.module.d.ts +2 -2
- package/remote-config/remote-config.module.d.ts +2 -2
- package/schematics/common.js +1 -26
- package/schematics/deploy/actions.js +7 -1
- package/schematics/interfaces.js +11 -11
- package/schematics/setup/index.js +7 -97
- package/schematics/setup/prompts.js +2 -91
- package/schematics/utils.js +27 -75
- package/storage/storage.module.d.ts +2 -2
- package/vertexai-preview/firebase.d.ts +4 -0
- package/vertexai-preview/index.d.ts +5 -0
- package/vertexai-preview/package.json +3 -0
- package/vertexai-preview/public_api.d.ts +3 -0
- package/vertexai-preview/vertexai.d.ts +13 -0
- package/vertexai-preview/vertexai.module.d.ts +15 -0
|
@@ -9,44 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.ngAddSetupProject = exports.setupProject = void 0;
|
|
13
13
|
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
17
|
const utility_1 = require("@schematics/angular/utility");
|
|
18
|
-
const common_1 = require("../common");
|
|
19
18
|
const firebaseTools_1 = require("../firebaseTools");
|
|
20
19
|
const utils_1 = require("../utils");
|
|
21
20
|
const prompts_1 = require("./prompts");
|
|
22
21
|
const setupProject = (tree, context, features, config) => {
|
|
23
22
|
const { projectName } = (0, utils_1.getProject)(config, tree);
|
|
24
23
|
(0, utils_1.addIgnoreFiles)(tree);
|
|
25
|
-
if (features.
|
|
26
|
-
const { path: workspacePath, workspace } = (0, utils_1.getWorkspace)(tree);
|
|
27
|
-
const { project, projectName } = (0, utils_1.getProject)(config, tree);
|
|
28
|
-
(0, exports.setupFirebase)({
|
|
29
|
-
workspace,
|
|
30
|
-
workspacePath,
|
|
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
|
-
},
|
|
41
|
-
tree,
|
|
42
|
-
context,
|
|
43
|
-
project
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const featuresToImport = features.filter(it => it !== 0);
|
|
47
|
-
if (featuresToImport.length > 0) {
|
|
24
|
+
if (features.length) {
|
|
48
25
|
return (0, schematics_1.chain)([
|
|
49
|
-
(0, utility_1.
|
|
26
|
+
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
50
27
|
external('initializeApp', '@angular/fire/app');
|
|
51
28
|
return code `${external('provideFirebaseApp', '@angular/fire/app')}(() => initializeApp(${JSON.stringify(config.sdkConfig)}))`;
|
|
52
29
|
}),
|
|
@@ -71,84 +48,17 @@ const ngAddSetupProject = (options) => (host, context) => __awaiter(void 0, void
|
|
|
71
48
|
if (user.email !== (defaultUser === null || defaultUser === void 0 ? void 0 : defaultUser.email)) {
|
|
72
49
|
yield firebaseTools.login.use(user.email, { projectRoot });
|
|
73
50
|
}
|
|
74
|
-
const {
|
|
51
|
+
const { projectName: ngProjectName } = (0, utils_1.getProject)(options, host);
|
|
75
52
|
const [defaultProjectName] = (0, utils_1.getFirebaseProjectNameFromHost)(host, ngProjectName);
|
|
76
53
|
const firebaseProject = yield (0, prompts_1.projectPrompt)(defaultProjectName, { projectRoot, account: user.email });
|
|
77
|
-
let hosting = {};
|
|
78
|
-
let firebaseHostingSite;
|
|
79
|
-
if (features.includes(0)) {
|
|
80
|
-
const results = yield (0, prompts_1.projectTypePrompt)(ngProject, ngProjectName);
|
|
81
|
-
hosting = Object.assign(Object.assign({}, hosting), results);
|
|
82
|
-
firebaseHostingSite = yield (0, prompts_1.sitePrompt)(firebaseProject, { projectRoot });
|
|
83
|
-
}
|
|
84
54
|
let firebaseApp;
|
|
85
55
|
let sdkConfig;
|
|
86
|
-
if (features.
|
|
87
|
-
|
|
88
|
-
firebaseApp = yield (0, prompts_1.appPrompt)(firebaseProject, defaultAppId, { projectRoot });
|
|
56
|
+
if (features.length) {
|
|
57
|
+
firebaseApp = yield (0, prompts_1.appPrompt)(firebaseProject, undefined, { projectRoot });
|
|
89
58
|
const result = yield firebaseTools.apps.sdkconfig('web', firebaseApp.appId, { nonInteractive: true, projectRoot });
|
|
90
59
|
sdkConfig = result.sdkConfig;
|
|
91
60
|
}
|
|
92
|
-
return (0, exports.setupProject)(host, context, features, Object.assign(Object.assign(
|
|
61
|
+
return (0, exports.setupProject)(host, context, features, Object.assign(Object.assign({}, options), { firebaseProject, firebaseApp, sdkConfig }));
|
|
93
62
|
}
|
|
94
63
|
});
|
|
95
64
|
exports.ngAddSetupProject = ngAddSetupProject;
|
|
96
|
-
function generateFirebaseJson(tree, path, project, region) {
|
|
97
|
-
const firebaseJson = tree.exists(path)
|
|
98
|
-
? (0, common_1.safeReadJSON)(path, tree)
|
|
99
|
-
: {};
|
|
100
|
-
const newConfig = {
|
|
101
|
-
target: project,
|
|
102
|
-
source: '.',
|
|
103
|
-
frameworksBackend: {
|
|
104
|
-
region
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
if (firebaseJson.hosting === undefined) {
|
|
108
|
-
firebaseJson.hosting = [newConfig];
|
|
109
|
-
}
|
|
110
|
-
else if (Array.isArray(firebaseJson.hosting)) {
|
|
111
|
-
const existingConfigIndex = firebaseJson.hosting.findIndex(config => config.target === newConfig.target);
|
|
112
|
-
if (existingConfigIndex > -1) {
|
|
113
|
-
firebaseJson.hosting.splice(existingConfigIndex, 1, newConfig);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
firebaseJson.hosting.push(newConfig);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
firebaseJson.hosting = [firebaseJson.hosting, newConfig];
|
|
121
|
-
}
|
|
122
|
-
(0, common_1.overwriteIfExists)(tree, path, (0, common_1.stringifyFormatted)(firebaseJson));
|
|
123
|
-
}
|
|
124
|
-
exports.generateFirebaseJson = generateFirebaseJson;
|
|
125
|
-
const setupFirebase = (config) => {
|
|
126
|
-
var _a, _b, _c, _d;
|
|
127
|
-
const { tree, workspacePath, workspace, options } = config;
|
|
128
|
-
const project = workspace.projects[options.project];
|
|
129
|
-
if (!project.architect) {
|
|
130
|
-
throw new schematics_1.SchematicsException(`Angular project "${options.project}" has a malformed angular.json`);
|
|
131
|
-
}
|
|
132
|
-
project.architect.deploy = {
|
|
133
|
-
builder: '@angular/fire:deploy',
|
|
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',
|
|
148
|
-
};
|
|
149
|
-
tree.overwrite(workspacePath, JSON.stringify(workspace, null, 2));
|
|
150
|
-
generateFirebaseJson(tree, 'firebase.json', options.project, options.ssrRegion);
|
|
151
|
-
(0, common_1.generateFirebaseRc)(tree, '.firebaserc', options.firebaseProject.projectId, options.firebaseHostingSite, options.project);
|
|
152
|
-
return tree;
|
|
153
|
-
};
|
|
154
|
-
exports.setupFirebase = setupFirebase;
|
|
@@ -32,26 +32,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
35
|
+
exports.appPrompt = exports.projectPrompt = exports.userPrompt = exports.featuresPrompt = exports.searchApps = exports.searchProjects = void 0;
|
|
36
36
|
const child_process_1 = require("child_process");
|
|
37
37
|
const fuzzy = __importStar(require("fuzzy"));
|
|
38
38
|
const inquirer = __importStar(require("inquirer"));
|
|
39
|
-
const common_1 = require("../common");
|
|
40
39
|
const firebaseTools_1 = require("../firebaseTools");
|
|
41
40
|
const interfaces_1 = require("../interfaces");
|
|
42
41
|
const utils_1 = require("../utils");
|
|
43
42
|
inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));
|
|
44
43
|
const NEW_OPTION = '~~angularfire-new~~';
|
|
45
|
-
const DEFAULT_SITE_TYPE = 'DEFAULT_SITE';
|
|
46
44
|
const isProject = (elem) => {
|
|
47
45
|
return elem.original === undefined;
|
|
48
46
|
};
|
|
49
47
|
const isApp = (elem) => {
|
|
50
48
|
return elem.original === undefined;
|
|
51
49
|
};
|
|
52
|
-
const isSite = (elem) => {
|
|
53
|
-
return elem.original === undefined;
|
|
54
|
-
};
|
|
55
50
|
const searchProjects = (projects) => (_, input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
51
|
projects.unshift({
|
|
57
52
|
projectId: NEW_OPTION,
|
|
@@ -102,31 +97,6 @@ const searchApps = (apps) => (_, input) => __awaiter(void 0, void 0, void 0, fun
|
|
|
102
97
|
});
|
|
103
98
|
});
|
|
104
99
|
exports.searchApps = searchApps;
|
|
105
|
-
const searchSites = (sites) => (_, input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
|
-
sites.unshift({
|
|
107
|
-
name: NEW_OPTION,
|
|
108
|
-
defaultUrl: '[CREATE NEW SITE]',
|
|
109
|
-
});
|
|
110
|
-
return fuzzy.filter(input, sites, {
|
|
111
|
-
extract(el) {
|
|
112
|
-
return el.defaultUrl;
|
|
113
|
-
}
|
|
114
|
-
}).map((result) => {
|
|
115
|
-
let original;
|
|
116
|
-
if (isSite(result)) {
|
|
117
|
-
original = result;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
original = result.original;
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
name: original.defaultUrl,
|
|
124
|
-
title: original.defaultUrl,
|
|
125
|
-
value: (0, common_1.shortSiteName)(original),
|
|
126
|
-
};
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
exports.searchSites = searchSites;
|
|
130
100
|
const autocomplete = (questions) => inquirer.prompt(questions);
|
|
131
101
|
const featuresPrompt = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
132
102
|
const { features } = yield inquirer.prompt({
|
|
@@ -134,7 +104,7 @@ const featuresPrompt = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
134
104
|
name: 'features',
|
|
135
105
|
choices: interfaces_1.featureOptions,
|
|
136
106
|
message: 'What features would you like to setup?',
|
|
137
|
-
default: [
|
|
107
|
+
default: [],
|
|
138
108
|
});
|
|
139
109
|
return features;
|
|
140
110
|
});
|
|
@@ -223,62 +193,3 @@ const appPrompt = ({ projectId: project }, defaultAppId, options) => __awaiter(v
|
|
|
223
193
|
return (apps).find(it => (0, utils_1.shortAppId)(it) === appId);
|
|
224
194
|
});
|
|
225
195
|
exports.appPrompt = appPrompt;
|
|
226
|
-
const sitePrompt = ({ projectId: project }, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
227
|
-
const firebaseTools = yield (0, firebaseTools_1.getFirebaseTools)();
|
|
228
|
-
const sites = yield firebaseTools.hosting.sites.list(Object.assign(Object.assign({}, options), { project })).then(it => {
|
|
229
|
-
if (it.sites.length === 0) {
|
|
230
|
-
return [{
|
|
231
|
-
name: project,
|
|
232
|
-
defaultUrl: `https://${project}.web.app`,
|
|
233
|
-
type: DEFAULT_SITE_TYPE,
|
|
234
|
-
appId: undefined,
|
|
235
|
-
}];
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
return it.sites;
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
const { siteName } = yield autocomplete({
|
|
242
|
-
type: 'autocomplete',
|
|
243
|
-
name: 'siteName',
|
|
244
|
-
source: (0, exports.searchSites)(sites),
|
|
245
|
-
message: 'Please select a hosting site:',
|
|
246
|
-
default: _ => (0, common_1.shortSiteName)(sites.find(site => site.type === DEFAULT_SITE_TYPE)),
|
|
247
|
-
});
|
|
248
|
-
if (siteName === NEW_OPTION) {
|
|
249
|
-
const { subdomain } = yield inquirer.prompt({
|
|
250
|
-
type: 'input',
|
|
251
|
-
name: 'subdomain',
|
|
252
|
-
message: 'Please provide an unique, URL-friendly id for the site (<id>.web.app):',
|
|
253
|
-
});
|
|
254
|
-
return yield firebaseTools.hosting.sites.create(subdomain, Object.assign(Object.assign({}, options), { nonInteractive: true, project }));
|
|
255
|
-
}
|
|
256
|
-
return (sites).find(it => (0, common_1.shortSiteName)(it) === siteName);
|
|
257
|
-
});
|
|
258
|
-
exports.sitePrompt = sitePrompt;
|
|
259
|
-
const DEFAULT_REGION = 'us-central1';
|
|
260
|
-
const ALLOWED_SSR_REGIONS = [
|
|
261
|
-
{ name: 'us-central1 (Iowa)', value: 'us-central1' },
|
|
262
|
-
{ name: 'us-west1 (Oregon)', value: 'us-west1' },
|
|
263
|
-
{ name: 'us-east1 (South Carolina)', value: 'us-east1' },
|
|
264
|
-
{ name: 'europe-west1 (Belgium)', value: 'europe-west1' },
|
|
265
|
-
{ name: 'asia-east1 (Taiwan)', value: 'asia-east1' },
|
|
266
|
-
];
|
|
267
|
-
const projectTypePrompt = (project, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
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)) {
|
|
273
|
-
const { ssrRegion } = yield inquirer.prompt({
|
|
274
|
-
type: 'list',
|
|
275
|
-
name: 'ssrRegion',
|
|
276
|
-
choices: ALLOWED_SSR_REGIONS,
|
|
277
|
-
message: 'In which region would you like to host server-side content?',
|
|
278
|
-
default: DEFAULT_REGION,
|
|
279
|
-
});
|
|
280
|
-
return { projectType: 3, ssrRegion, buildTarget, serveTarget };
|
|
281
|
-
}
|
|
282
|
-
return { projectType: 3, buildTarget, serveTarget };
|
|
283
|
-
});
|
|
284
|
-
exports.projectTypePrompt = projectTypePrompt;
|
package/schematics/utils.js
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.addIgnoreFiles = exports.featureToRules = exports.addFixesToServer = exports.
|
|
3
|
+
exports.addIgnoreFiles = exports.featureToRules = exports.addFixesToServer = exports.getFirebaseProjectNameFromFs = exports.getFirebaseProjectNameFromHost = exports.getProject = exports.getWorkspace = exports.shortAppId = void 0;
|
|
7
4
|
const fs_1 = require("fs");
|
|
8
5
|
const path_1 = require("path");
|
|
9
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
10
|
-
const typescript_1 = __importDefault(require("@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
11
7
|
const utility_1 = require("@schematics/angular/utility");
|
|
12
|
-
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
13
|
-
const change_1 = require("@schematics/angular/utility/change");
|
|
14
8
|
const common_1 = require("./common");
|
|
15
|
-
const isUniversalApp = (project) => { var _a; return (_a = project.architect) === null || _a === void 0 ? void 0 : _a.server; };
|
|
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;
|
|
19
|
-
const hasPrerenderOption = (project) => { var _a; return (_a = project.architect) === null || _a === void 0 ? void 0 : _a.prerender; };
|
|
20
|
-
exports.hasPrerenderOption = hasPrerenderOption;
|
|
21
9
|
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(); };
|
|
22
10
|
exports.shortAppId = shortAppId;
|
|
23
11
|
function getWorkspace(host) {
|
|
@@ -81,47 +69,6 @@ const projectFromRc = (rc, target) => {
|
|
|
81
69
|
const site = project && ((_e = (_d = (_c = (_b = rc.targets) === null || _b === void 0 ? void 0 : _b[project]) === null || _c === void 0 ? void 0 : _c.hosting) === null || _d === void 0 ? void 0 : _d[target]) === null || _e === void 0 ? void 0 : _e[0]);
|
|
82
70
|
return [project || defaultProject, site];
|
|
83
71
|
};
|
|
84
|
-
function addEnvironmentEntry(host, filePath, data) {
|
|
85
|
-
const fileExists = host.exists(filePath);
|
|
86
|
-
if (fileExists) {
|
|
87
|
-
const buffer = host.read(filePath);
|
|
88
|
-
if (!buffer) {
|
|
89
|
-
throw new schematics_1.SchematicsException(`Cannot read ${filePath}`);
|
|
90
|
-
}
|
|
91
|
-
const sourceFile = typescript_1.default.createSourceFile(filePath, buffer.toString('utf-8'), typescript_1.default.ScriptTarget.Latest, true);
|
|
92
|
-
const envIdentifier = (0, ast_utils_1.findNode)(sourceFile, typescript_1.default.SyntaxKind.Identifier, 'environment');
|
|
93
|
-
if (!(envIdentifier === null || envIdentifier === void 0 ? void 0 : envIdentifier.parent)) {
|
|
94
|
-
throw new schematics_1.SchematicsException(`Cannot find 'environment' identifier in ${filePath}`);
|
|
95
|
-
}
|
|
96
|
-
const envObjectLiteral = envIdentifier.parent.getChildren().find(({ kind }) => kind === typescript_1.default.SyntaxKind.ObjectLiteralExpression);
|
|
97
|
-
if (!envObjectLiteral) {
|
|
98
|
-
throw new schematics_1.SchematicsException(`${filePath} is not in the expected format`);
|
|
99
|
-
}
|
|
100
|
-
const firebaseIdentifier = (0, ast_utils_1.findNode)(envObjectLiteral, typescript_1.default.SyntaxKind.Identifier, 'firebase');
|
|
101
|
-
const recorder = host.beginUpdate(filePath);
|
|
102
|
-
if (firebaseIdentifier === null || firebaseIdentifier === void 0 ? void 0 : firebaseIdentifier.parent) {
|
|
103
|
-
const change = new change_1.ReplaceChange(filePath, firebaseIdentifier.parent.pos, firebaseIdentifier.parent.getFullText(), data);
|
|
104
|
-
(0, change_1.applyToUpdateRecorder)(recorder, [change]);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
const openBracketToken = envObjectLiteral.getChildren().find(({ kind }) => kind === typescript_1.default.SyntaxKind.OpenBraceToken);
|
|
108
|
-
if (openBracketToken) {
|
|
109
|
-
const change = new change_1.InsertChange(filePath, openBracketToken.end, `${data},`);
|
|
110
|
-
(0, change_1.applyToUpdateRecorder)(recorder, [change]);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
throw new schematics_1.SchematicsException(`${filePath} is not in the expected format`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
host.commitUpdate(recorder);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
host.create(filePath, `export const environment = {${data},
|
|
120
|
-
};`);
|
|
121
|
-
}
|
|
122
|
-
return host;
|
|
123
|
-
}
|
|
124
|
-
exports.addEnvironmentEntry = addEnvironmentEntry;
|
|
125
72
|
function addFixesToServer(host) {
|
|
126
73
|
const serverPath = `/server.ts`;
|
|
127
74
|
if (!host.exists(serverPath)) {
|
|
@@ -143,8 +90,8 @@ exports.addFixesToServer = addFixesToServer;
|
|
|
143
90
|
function featureToRules(features, projectName) {
|
|
144
91
|
return features.map(feature => {
|
|
145
92
|
switch (feature) {
|
|
146
|
-
case
|
|
147
|
-
return (0, utility_1.
|
|
93
|
+
case 2:
|
|
94
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
148
95
|
external('initializeAppCheck', '@angular/fire/app-check');
|
|
149
96
|
external('ReCaptchaEnterpriseProvider', '@angular/fire/app-check');
|
|
150
97
|
return code `${external('provideAppCheck', '@angular/fire/app-check')}(() => {
|
|
@@ -153,61 +100,66 @@ function featureToRules(features, projectName) {
|
|
|
153
100
|
return initializeAppCheck(undefined, { provider, isTokenAutoRefreshEnabled: true });
|
|
154
101
|
})`;
|
|
155
102
|
});
|
|
156
|
-
case
|
|
103
|
+
case 1:
|
|
157
104
|
return (0, schematics_1.chain)([
|
|
158
|
-
(0, utility_1.
|
|
105
|
+
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
159
106
|
external('getAnalytics', '@angular/fire/analytics');
|
|
160
107
|
return code `${external('provideAnalytics', '@angular/fire/analytics')}(() => getAnalytics())`;
|
|
161
108
|
}),
|
|
162
109
|
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
163
110
|
return code `${external('ScreenTrackingService', '@angular/fire/analytics')}`;
|
|
164
111
|
}),
|
|
165
|
-
...(features.includes(
|
|
112
|
+
...(features.includes(0) ? [
|
|
166
113
|
(0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
167
114
|
return code `${external('UserTrackingService', '@angular/fire/analytics')}`;
|
|
168
115
|
})
|
|
169
116
|
] : []),
|
|
170
117
|
]);
|
|
171
|
-
case
|
|
172
|
-
return (0, utility_1.
|
|
118
|
+
case 0:
|
|
119
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
173
120
|
external('getAuth', '@angular/fire/auth');
|
|
174
121
|
return code `${external('provideAuth', '@angular/fire/auth')}(() => getAuth())`;
|
|
175
122
|
});
|
|
176
|
-
case
|
|
177
|
-
return (0, utility_1.
|
|
123
|
+
case 3:
|
|
124
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
178
125
|
external('getDatabase', '@angular/fire/database');
|
|
179
126
|
return code `${external('provideDatabase', '@angular/fire/database')}(() => getDatabase())`;
|
|
180
127
|
});
|
|
181
|
-
case
|
|
182
|
-
return (0, utility_1.
|
|
128
|
+
case 7:
|
|
129
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
183
130
|
external('getFirestore', '@angular/fire/firestore');
|
|
184
131
|
return code `${external('provideFirestore', '@angular/fire/firestore')}(() => getFirestore())`;
|
|
185
132
|
});
|
|
186
|
-
case
|
|
187
|
-
return (0, utility_1.
|
|
133
|
+
case 4:
|
|
134
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
188
135
|
external('getFunctions', '@angular/fire/functions');
|
|
189
136
|
return code `${external('provideFunctions', '@angular/fire/functions')}(() => getFunctions())`;
|
|
190
137
|
});
|
|
191
|
-
case
|
|
192
|
-
return (0, utility_1.
|
|
138
|
+
case 5:
|
|
139
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
193
140
|
external('getMessaging', '@angular/fire/messaging');
|
|
194
141
|
return code `${external('provideMessaging', '@angular/fire/messaging')}(() => getMessaging())`;
|
|
195
142
|
});
|
|
196
|
-
case
|
|
197
|
-
return (0, utility_1.
|
|
143
|
+
case 6:
|
|
144
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
198
145
|
external('getPerformance', '@angular/fire/performance');
|
|
199
146
|
return code `${external('providePerformance', '@angular/fire/performance')}(() => getPerformance())`;
|
|
200
147
|
});
|
|
201
|
-
case
|
|
202
|
-
return (0, utility_1.
|
|
148
|
+
case 8:
|
|
149
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
203
150
|
external('getStorage', '@angular/fire/storage');
|
|
204
151
|
return code `${external('provideStorage', '@angular/fire/storage')}(() => getStorage())`;
|
|
205
152
|
});
|
|
206
|
-
case
|
|
207
|
-
return (0, utility_1.
|
|
153
|
+
case 9:
|
|
154
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
208
155
|
external('getRemoteConfig', '@angular/fire/remote-config');
|
|
209
156
|
return code `${external('provideRemoteConfig', '@angular/fire/remote-config')}(() => getRemoteConfig())`;
|
|
210
157
|
});
|
|
158
|
+
case 10:
|
|
159
|
+
return (0, utility_1.addRootProvider)(projectName, ({ code, external }) => {
|
|
160
|
+
external('getVertexAI', '@angular/fire/vertexai-preview');
|
|
161
|
+
return code `${external('provideVertexAI', '@angular/fire/vertexai-preview')}(() => getVertexAI())`;
|
|
162
|
+
});
|
|
211
163
|
default:
|
|
212
164
|
return undefined;
|
|
213
165
|
}
|
|
@@ -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;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from 'firebase/vertexai-preview';
|
|
2
|
+
import { getVertexAI as _getVertexAI, getGenerativeModel as _getGenerativeModel } from 'firebase/vertexai-preview';
|
|
3
|
+
export declare const getVertexAI: typeof _getVertexAI;
|
|
4
|
+
export declare const getGenerativeModel: typeof _getGenerativeModel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VertexAI as FirebaseVertexAI } from 'firebase/vertexai-preview';
|
|
2
|
+
export interface VertexAI extends FirebaseVertexAI {
|
|
3
|
+
}
|
|
4
|
+
export declare class VertexAI {
|
|
5
|
+
constructor(vertexai: FirebaseVertexAI);
|
|
6
|
+
}
|
|
7
|
+
export declare const VERTEX_AI_PROVIDER_NAME = "vertexai";
|
|
8
|
+
export interface VertexAIInstances extends Array<FirebaseVertexAI> {
|
|
9
|
+
}
|
|
10
|
+
export declare class VertexAIInstances {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
export declare const vertexAIInstance$: import("rxjs").Observable<FirebaseVertexAI>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EnvironmentProviders, InjectionToken, Injector, NgZone } from '@angular/core';
|
|
2
|
+
import { FirebaseApp } from '@angular/fire/app';
|
|
3
|
+
import { VertexAI as FirebaseVertexAI } from 'firebase/vertexai-preview';
|
|
4
|
+
import { VertexAI } from './vertexai';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare const PROVIDED_VERTEX_AI_INSTANCES: InjectionToken<VertexAI[]>;
|
|
7
|
+
export declare function defaultVertexAIInstanceFactory(provided: FirebaseVertexAI[] | undefined, defaultApp: FirebaseApp): VertexAI;
|
|
8
|
+
export declare function vertexAIInstanceFactory(fn: (injector: Injector) => FirebaseVertexAI): (zone: NgZone, injector: Injector) => VertexAI;
|
|
9
|
+
export declare class VertexAIModule {
|
|
10
|
+
constructor();
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VertexAIModule, never>;
|
|
12
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<VertexAIModule, never, never, never>;
|
|
13
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<VertexAIModule>;
|
|
14
|
+
}
|
|
15
|
+
export declare function provideVertexAI(fn: (injector: Injector) => FirebaseVertexAI, ...deps: any[]): EnvironmentProviders;
|