firebase-tools-with-isolate 14.10.1 → 14.16.0-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/lib/api.js +5 -1
- package/lib/apphosting/backend.js +40 -15
- package/lib/apptesting/ensureProjectConfigured.js +56 -0
- package/lib/apptesting/invokeTests.js +40 -0
- package/lib/apptesting/parseTestFiles.js +75 -0
- package/lib/apptesting/types.js +18 -0
- package/lib/auth.js +37 -2
- package/lib/command.js +24 -5
- package/lib/commands/apphosting-backends-create.js +8 -5
- package/lib/commands/apptesting-execute.js +101 -0
- package/lib/commands/dataconnect-sdk-generate.js +28 -26
- package/lib/commands/dataconnect-services-list.js +1 -1
- package/lib/commands/dataconnect-sql-diff.js +2 -2
- package/lib/commands/dataconnect-sql-grant.js +7 -2
- package/lib/commands/dataconnect-sql-migrate.js +2 -2
- package/lib/commands/dataconnect-sql-setup.js +3 -5
- package/lib/commands/dataconnect-sql-shell.js +2 -2
- package/lib/commands/ext-export.js +1 -1
- package/lib/commands/firestore-bulkdelete.js +73 -0
- package/lib/commands/firestore-databases-create.js +11 -0
- package/lib/commands/firestore-operations-cancel.js +44 -0
- package/lib/commands/firestore-operations-describe.js +29 -0
- package/lib/commands/firestore-operations-list.js +29 -0
- package/lib/commands/firestore-utils.js +15 -0
- package/lib/commands/functions-config-clone.js +2 -0
- package/lib/commands/functions-config-export.js +5 -2
- package/lib/commands/functions-config-get.js +2 -0
- package/lib/commands/functions-config-set.js +2 -0
- package/lib/commands/functions-config-unset.js +2 -0
- package/lib/commands/index.js +9 -0
- package/lib/commands/init.js +24 -4
- package/lib/commands/internaltesting-functions-discover.js +20 -5
- package/lib/commands/login.js +13 -9
- package/lib/commands/use.js +5 -0
- package/lib/config.js +16 -4
- package/lib/crashlytics/addNote.js +27 -0
- package/lib/crashlytics/buildToolsJarHelper.js +1 -2
- package/lib/crashlytics/deleteNote.js +23 -0
- package/lib/crashlytics/getIssueDetails.js +26 -0
- package/lib/crashlytics/getSampleCrash.js +34 -0
- package/lib/crashlytics/listNotes.js +29 -0
- package/lib/crashlytics/listTopDevices.js +33 -0
- package/lib/crashlytics/listTopIssues.js +8 -23
- package/lib/crashlytics/listTopOperatingSystems.js +32 -0
- package/lib/crashlytics/listTopVersions.js +32 -0
- package/lib/crashlytics/updateIssue.js +35 -0
- package/lib/crashlytics/utils.js +38 -0
- package/lib/dataconnect/appFinder.js +102 -0
- package/lib/dataconnect/client.js +23 -15
- package/lib/dataconnect/ensureApis.js +6 -9
- package/lib/dataconnect/errors.js +7 -1
- package/lib/dataconnect/freeTrial.js +16 -38
- package/lib/dataconnect/load.js +105 -6
- package/lib/dataconnect/provisionCloudSql.js +67 -70
- package/lib/dataconnect/schemaMigration.js +219 -169
- package/lib/deploy/dataconnect/deploy.js +7 -9
- package/lib/deploy/dataconnect/prepare.js +7 -12
- package/lib/deploy/dataconnect/release.js +43 -31
- package/lib/deploy/firestore/deploy.js +10 -0
- package/lib/deploy/functions/backend.js +7 -1
- package/lib/deploy/functions/build.js +28 -14
- package/lib/deploy/functions/deploy.js +3 -2
- package/lib/deploy/functions/ensure.js +1 -1
- package/lib/deploy/functions/functionsDeployHelper.js +8 -1
- package/lib/deploy/functions/params.js +4 -0
- package/lib/deploy/functions/prepare.js +25 -13
- package/lib/deploy/functions/pricing.js +12 -5
- package/lib/deploy/functions/release/fabricator.js +25 -3
- package/lib/deploy/functions/release/reporter.js +1 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +52 -5
- package/lib/deploy/functions/runtimes/node/index.js +83 -51
- package/lib/emulator/auth/operations.js +10 -1
- package/lib/emulator/commandUtils.js +7 -1
- package/lib/emulator/controller.js +22 -34
- package/lib/emulator/dataconnectEmulator.js +27 -24
- package/lib/emulator/downloadableEmulatorInfo.json +18 -18
- package/lib/emulator/env.js +2 -1
- package/lib/emulator/functionsEmulator.js +12 -2
- package/lib/emulator/hub.js +11 -8
- package/lib/emulator/tasksEmulator.js +1 -1
- package/lib/emulator/ui.js +3 -1
- package/lib/env.js +18 -0
- package/lib/experiments.js +20 -0
- package/lib/extensions/extensionsHelper.js +4 -15
- package/lib/extensions/runtimes/common.js +3 -2
- package/lib/extensions/utils.js +1 -12
- package/lib/firestore/api-sort.js +96 -3
- package/lib/firestore/api-types.js +20 -1
- package/lib/firestore/api.js +144 -15
- package/lib/firestore/pretty-print.js +35 -1
- package/lib/firestore/validator.js +1 -1
- package/lib/functional.js +7 -1
- package/lib/functions/deprecationWarnings.js +21 -0
- package/lib/functions/env.js +31 -16
- package/lib/functions/projectConfig.js +87 -8
- package/lib/functions/secrets.js +3 -0
- package/lib/gcp/cloudfunctions.js +1 -6
- package/lib/gcp/cloudfunctionsv2.js +3 -39
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/cloudsql/cloudsqladmin.js +4 -16
- package/lib/gcp/cloudsql/connect.js +4 -3
- package/lib/gcp/cloudsql/permissionsSetup.js +23 -16
- package/lib/gcp/k8s.js +32 -0
- package/lib/gcp/runv2.js +181 -0
- package/lib/gemini/fdcExperience.js +5 -3
- package/lib/init/features/aitools/claude.js +43 -0
- package/lib/init/features/aitools/cursor.js +61 -0
- package/lib/init/features/aitools/gemini.js +58 -0
- package/lib/init/features/aitools/index.js +28 -0
- package/lib/init/features/aitools/promptUpdater.js +111 -0
- package/lib/init/features/aitools/studio.js +17 -0
- package/lib/init/features/aitools/types.js +2 -0
- package/lib/init/features/aitools.js +83 -0
- package/lib/init/features/apptesting/index.js +34 -0
- package/lib/init/features/dataconnect/create_app.js +53 -0
- package/lib/init/features/dataconnect/index.js +280 -186
- package/lib/init/features/dataconnect/sdk.js +232 -144
- package/lib/init/features/index.js +8 -3
- package/lib/init/features/project.js +4 -0
- package/lib/init/index.js +18 -2
- package/lib/management/apps.js +3 -3
- package/lib/management/studio.js +120 -0
- package/lib/mcp/errors.js +5 -7
- package/lib/mcp/index.js +179 -61
- package/lib/mcp/logging-transport.js +23 -0
- package/lib/mcp/prompt.js +10 -0
- package/lib/mcp/prompts/core/deploy.js +101 -0
- package/lib/mcp/prompts/core/index.js +5 -0
- package/lib/mcp/prompts/crashlytics/connect.js +114 -0
- package/lib/mcp/prompts/crashlytics/index.js +5 -0
- package/lib/mcp/prompts/dataconnect/index.js +9 -0
- package/lib/mcp/prompts/dataconnect/schema.js +67 -0
- package/lib/mcp/prompts/index.js +47 -0
- package/lib/mcp/tools/apphosting/fetch_logs.js +22 -22
- package/lib/mcp/tools/apphosting/list_backends.js +10 -10
- package/lib/mcp/tools/auth/disable_user.js +7 -7
- package/lib/mcp/tools/auth/get_user.js +13 -6
- package/lib/mcp/tools/auth/index.js +10 -10
- package/lib/mcp/tools/auth/list_users.js +6 -6
- package/lib/mcp/tools/auth/set_claims.js +7 -7
- package/lib/mcp/tools/auth/set_sms_region_policy.js +6 -6
- package/lib/mcp/tools/core/consult_assistant.js +13 -8
- package/lib/mcp/tools/core/create_android_sha.js +9 -9
- package/lib/mcp/tools/core/create_app.js +7 -7
- package/lib/mcp/tools/core/create_project.js +13 -13
- package/lib/mcp/tools/core/get_admin_sdk_config.js +7 -7
- package/lib/mcp/tools/core/get_environment.js +8 -8
- package/lib/mcp/tools/core/get_project.js +5 -5
- package/lib/mcp/tools/core/get_sdk_config.js +19 -9
- package/lib/mcp/tools/core/index.js +28 -24
- package/lib/mcp/tools/core/init.js +39 -16
- package/lib/mcp/tools/core/list_apps.js +6 -6
- package/lib/mcp/tools/core/list_projects.js +6 -6
- package/lib/mcp/tools/core/login.js +46 -0
- package/lib/mcp/tools/core/logout.js +62 -0
- package/lib/mcp/tools/core/update_environment.js +10 -10
- package/lib/mcp/tools/crashlytics/add_note.js +32 -0
- package/lib/mcp/tools/crashlytics/constants.js +11 -0
- package/lib/mcp/tools/crashlytics/delete_note.js +35 -0
- package/lib/mcp/tools/crashlytics/get_issue_details.js +31 -0
- package/lib/mcp/tools/crashlytics/get_sample_crash.js +43 -0
- package/lib/mcp/tools/crashlytics/index.js +22 -2
- package/lib/mcp/tools/crashlytics/list_notes.js +37 -0
- package/lib/mcp/tools/crashlytics/list_top_devices.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_issues.js +12 -13
- package/lib/mcp/tools/crashlytics/list_top_operating_systems.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_versions.js +33 -0
- package/lib/mcp/tools/crashlytics/update_issue.js +37 -0
- package/lib/mcp/tools/database/get_data.js +49 -0
- package/lib/mcp/tools/database/get_rules.js +39 -0
- package/lib/mcp/tools/database/index.js +8 -0
- package/lib/mcp/tools/database/set_data.js +57 -0
- package/lib/mcp/tools/database/validate_rules.js +41 -0
- package/lib/mcp/tools/dataconnect/compile.js +43 -0
- package/lib/mcp/tools/dataconnect/execute.js +71 -0
- package/lib/mcp/tools/dataconnect/generate_operation.js +8 -8
- package/lib/mcp/tools/dataconnect/generate_schema.js +6 -6
- package/lib/mcp/tools/dataconnect/index.js +10 -18
- package/lib/mcp/tools/dataconnect/list_services.js +107 -11
- package/lib/mcp/tools/firestore/delete_document.js +13 -13
- package/lib/mcp/tools/firestore/get_documents.js +13 -13
- package/lib/mcp/tools/firestore/list_collections.js +7 -10
- package/lib/mcp/tools/firestore/query_collection.js +13 -13
- package/lib/mcp/tools/index.js +24 -18
- package/lib/mcp/tools/messaging/index.js +2 -2
- package/lib/mcp/tools/messaging/send_message.js +7 -7
- package/lib/mcp/tools/remoteconfig/get_template.js +5 -5
- package/lib/mcp/tools/remoteconfig/index.js +4 -4
- package/lib/mcp/tools/remoteconfig/publish_template.js +7 -7
- package/lib/mcp/tools/remoteconfig/rollback_template.js +6 -6
- package/lib/mcp/tools/rules/get_rules.js +8 -8
- package/lib/mcp/tools/rules/validate_rules.js +10 -10
- package/lib/mcp/tools/storage/get_download_url.js +8 -8
- package/lib/mcp/tools/storage/get_rules.js +8 -8
- package/lib/mcp/types.js +2 -0
- package/lib/mcp/util/dataconnect/compile.js +20 -0
- package/lib/mcp/util/dataconnect/content.js +655 -0
- package/lib/mcp/util/dataconnect/emulator.js +16 -0
- package/lib/mcp/util.js +5 -18
- package/lib/requireAuth.js +14 -4
- package/lib/rtdb.js +10 -6
- package/lib/scopes.js +2 -1
- package/lib/serve/functions.js +4 -3
- package/lib/timeout.js +21 -0
- package/lib/track.js +18 -1
- package/lib/unzip.js +13 -0
- package/lib/utils.js +76 -2
- package/package.json +6 -4
- package/prompts/FIREBASE.md +121 -0
- package/prompts/FIREBASE_FUNCTIONS.md +221 -0
- package/schema/apptesting-yaml.json +64 -0
- package/schema/firebase-config.json +163 -53
- package/templates/init/aitools/cursor-rules-header.txt +8 -0
- package/templates/init/aitools/gemini-extension.json +11 -0
- package/templates/init/apptesting/smoke_test.yaml +6 -0
- package/templates/init/dataconnect/connector.yaml +0 -16
- package/templates/init/dataconnect/dataconnect.yaml +2 -1
- package/templates/init/dataconnect/mutations.gql +29 -29
- package/templates/init/dataconnect/queries.gql +73 -73
- package/templates/init/dataconnect/schema.gql +48 -48
- package/templates/init/firestore/firestore.indexes.json +26 -1
- package/lib/dataconnect/fileUtils.js +0 -168
- package/lib/emulator/adminSdkConfig.test.js +0 -16
- package/lib/extensions/resolveSource.js +0 -23
- package/lib/firestore/api-sort.test.js +0 -74
- package/lib/firestore/backupUtils.test.js +0 -18
- package/lib/firestore/pretty-print.test.js +0 -61
- package/lib/firestore/util.test.js +0 -42
- package/lib/mcp/tools/dataconnect/emulator.js +0 -16
- package/lib/mcp/tools/dataconnect/execute_graphql.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_graphql_read.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_mutation.js +0 -62
- package/lib/mcp/tools/dataconnect/execute_query.js +0 -62
- package/lib/mcp/tools/dataconnect/get_connector.js +0 -31
- package/lib/mcp/tools/dataconnect/get_schema.js +0 -31
- /package/lib/mcp/{tools → util}/dataconnect/converter.js +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Firebase Functions Context (SDK 6.0.0+)
|
|
2
|
+
|
|
3
|
+
Always use v2 functions for new development. Use v1 only for Analytics, basic Auth, and Test Lab triggers.
|
|
4
|
+
|
|
5
|
+
For SDK versions before 6.0.0, add `/v2` to import paths (e.g., `firebase-functions/v2/https`).
|
|
6
|
+
|
|
7
|
+
## Function Imports (SDK 6.0.0+)
|
|
8
|
+
|
|
9
|
+
<example>
|
|
10
|
+
```typescript
|
|
11
|
+
// HTTPS functions
|
|
12
|
+
import {onRequest, onCall} from 'firebase-functions/https';
|
|
13
|
+
|
|
14
|
+
// Firestore triggers
|
|
15
|
+
import {onDocumentCreated, onDocumentUpdated, onDocumentDeleted} from 'firebase-functions/firestore';
|
|
16
|
+
|
|
17
|
+
// RTDB triggers
|
|
18
|
+
import {onValueCreated, onValueWritten, onValueUpdated, onValueDeleted} from 'firebase-functions/database';
|
|
19
|
+
|
|
20
|
+
// Scheduled functions
|
|
21
|
+
import {onSchedule} from 'firebase-functions/scheduler';
|
|
22
|
+
|
|
23
|
+
// Storage triggers
|
|
24
|
+
import {onObjectFinalized, onObjectDeleted} from 'firebase-functions/storage';
|
|
25
|
+
|
|
26
|
+
// Pub/Sub triggers
|
|
27
|
+
import {onMessagePublished} from 'firebase-functions/pubsub';
|
|
28
|
+
|
|
29
|
+
// Blocking Auth triggers
|
|
30
|
+
import {beforeUserCreated, beforeUserSignedIn} from 'firebase-functions/identity';
|
|
31
|
+
|
|
32
|
+
// Test Lab triggers
|
|
33
|
+
import {onTestMatrixCompleted} from 'firebase-functions/testLab';
|
|
34
|
+
|
|
35
|
+
// Deferred initialization
|
|
36
|
+
import {onInit} from 'firebase-functions';
|
|
37
|
+
|
|
38
|
+
// Structured logging
|
|
39
|
+
import {logger} from 'firebase-functions';
|
|
40
|
+
|
|
41
|
+
// Configuration
|
|
42
|
+
import {defineString, defineInt, defineSecret} from 'firebase-functions/params';
|
|
43
|
+
import * as params from 'firebase-functions/params';
|
|
44
|
+
|
|
45
|
+
// Note: For SDK versions before 6.0.0, add /v2 to import paths:
|
|
46
|
+
// import {onRequest} from 'firebase-functions/v2/https';
|
|
47
|
+
|
|
48
|
+
````
|
|
49
|
+
</example>
|
|
50
|
+
|
|
51
|
+
## v1 Functions (Analytics & Basic Auth Only)
|
|
52
|
+
|
|
53
|
+
<example>
|
|
54
|
+
```typescript
|
|
55
|
+
// Use v1 ONLY for these triggers
|
|
56
|
+
import * as functionsV1 from 'firebase-functions/v1';
|
|
57
|
+
import {logger} from 'firebase-functions';
|
|
58
|
+
|
|
59
|
+
// Analytics triggers (v1 only)
|
|
60
|
+
export const onPurchase = functionsV1.analytics.event('purchase').onLog((event) => {
|
|
61
|
+
logger.info('Purchase event', {
|
|
62
|
+
value: event.params?.value,
|
|
63
|
+
currency: event.params?.currency
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Basic Auth triggers (v1 only)
|
|
68
|
+
export const onUserCreate = functionsV1.auth.user().onCreate((user) => {
|
|
69
|
+
logger.info('User created', { uid: user.uid, email: user.email });
|
|
70
|
+
// Initialize user profile...
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const onUserDelete = functionsV1.auth.user().onDelete((user) => {
|
|
74
|
+
logger.info('User deleted', { uid: user.uid });
|
|
75
|
+
// Cleanup user data...
|
|
76
|
+
});
|
|
77
|
+
````
|
|
78
|
+
|
|
79
|
+
</example>
|
|
80
|
+
|
|
81
|
+
## Environment Configuration
|
|
82
|
+
|
|
83
|
+
<example>
|
|
84
|
+
```typescript
|
|
85
|
+
import {defineString, defineInt, defineSecret} from 'firebase-functions/params';
|
|
86
|
+
import * as params from 'firebase-functions/params';
|
|
87
|
+
import {onRequest} from 'firebase-functions/https';
|
|
88
|
+
import {logger} from 'firebase-functions';
|
|
89
|
+
|
|
90
|
+
// Built-in params available automatically
|
|
91
|
+
const projectId = params.projectID;
|
|
92
|
+
const databaseUrl = params.databaseURL;
|
|
93
|
+
const bucket = params.storageBucket;
|
|
94
|
+
const gcpProject = params.gcloudProject;
|
|
95
|
+
|
|
96
|
+
// Custom params
|
|
97
|
+
const apiUrl = defineString('API_URL', {
|
|
98
|
+
default: 'https://api.example.com'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const environment = defineString('ENVIRONMENT', {
|
|
102
|
+
default: 'dev'
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const apiKey = defineSecret('STRIPE_KEY');
|
|
106
|
+
|
|
107
|
+
// Using params directly in runtime configuration
|
|
108
|
+
export const processPayment = onRequest({
|
|
109
|
+
secrets: [apiKey],
|
|
110
|
+
memory: defineString('PAYMENT_MEMORY', { default: '1GiB' }),
|
|
111
|
+
minInstances: environment.equals('production').thenElse(5, 0),
|
|
112
|
+
maxInstances: environment.equals('production').thenElse(1000, 10)
|
|
113
|
+
}, async (req, res) => {
|
|
114
|
+
logger.info('Processing payment', {
|
|
115
|
+
project: projectId.value(),
|
|
116
|
+
bucket: bucket.value(),
|
|
117
|
+
env: environment.value()
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const key = apiKey.value();
|
|
121
|
+
const url = apiUrl.value();
|
|
122
|
+
// Process payment...
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
````
|
|
126
|
+
</example>
|
|
127
|
+
|
|
128
|
+
## Deferred Initialization
|
|
129
|
+
|
|
130
|
+
<example>
|
|
131
|
+
```typescript
|
|
132
|
+
import {onInit} from 'firebase-functions';
|
|
133
|
+
import {onRequest} from 'firebase-functions/https';
|
|
134
|
+
|
|
135
|
+
let heavyClient: HeavySDK;
|
|
136
|
+
|
|
137
|
+
onInit(async () => {
|
|
138
|
+
const {HeavySDK} = await import('./lib/heavy-sdk');
|
|
139
|
+
heavyClient = new HeavySDK({
|
|
140
|
+
// Expensive initialization...
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export const useHeavyClient = onRequest(async (req, res) => {
|
|
145
|
+
const result = await heavyClient.process(req.body);
|
|
146
|
+
res.json(result);
|
|
147
|
+
});
|
|
148
|
+
````
|
|
149
|
+
|
|
150
|
+
</example>
|
|
151
|
+
|
|
152
|
+
## Structured Logging
|
|
153
|
+
|
|
154
|
+
<example>
|
|
155
|
+
```typescript
|
|
156
|
+
import {logger} from 'firebase-functions';
|
|
157
|
+
import {onRequest} from 'firebase-functions/https';
|
|
158
|
+
|
|
159
|
+
interface OrderRequest {
|
|
160
|
+
orderId: string;
|
|
161
|
+
userId: string;
|
|
162
|
+
amount: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const processOrder = onRequest(async (req, res) => {
|
|
166
|
+
const {orderId, userId, amount} = req.body as OrderRequest;
|
|
167
|
+
|
|
168
|
+
logger.info("Processing order", {
|
|
169
|
+
orderId,
|
|
170
|
+
userId,
|
|
171
|
+
amount
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
// Process...
|
|
176
|
+
logger.log("Order complete", { orderId });
|
|
177
|
+
res.json({ success: true });
|
|
178
|
+
} catch (error) {
|
|
179
|
+
logger.error("Order failed", {
|
|
180
|
+
orderId,
|
|
181
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
182
|
+
stack: error instanceof Error ? error.stack : undefined
|
|
183
|
+
});
|
|
184
|
+
res.status(500).json({ error: "Processing failed" });
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
````
|
|
189
|
+
</example>
|
|
190
|
+
|
|
191
|
+
## Development Commands
|
|
192
|
+
|
|
193
|
+
<example>
|
|
194
|
+
```bash
|
|
195
|
+
# TypeScript development
|
|
196
|
+
cd functions
|
|
197
|
+
npm install
|
|
198
|
+
npm run build # Compile TypeScript
|
|
199
|
+
|
|
200
|
+
# Local development
|
|
201
|
+
|
|
202
|
+
firebase emulators:start --only functions
|
|
203
|
+
|
|
204
|
+
# Testing functions
|
|
205
|
+
|
|
206
|
+
npm test # Run unit tests
|
|
207
|
+
npm run serve # TypeScript watch + emulators
|
|
208
|
+
|
|
209
|
+
# Deployment
|
|
210
|
+
|
|
211
|
+
firebase deploy --only functions
|
|
212
|
+
firebase deploy --only functions:api,functions:onUserCreate
|
|
213
|
+
|
|
214
|
+
# Debugging
|
|
215
|
+
|
|
216
|
+
firebase functions:log
|
|
217
|
+
firebase functions:log --only api --lines=50
|
|
218
|
+
|
|
219
|
+
````
|
|
220
|
+
|
|
221
|
+
</example>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"definitions": {
|
|
5
|
+
"testConfig": {
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"route": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "URL route appended to the test target base URL at which to start the test"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"testStep": {
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"properties": {
|
|
18
|
+
"goal": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "The goal of the test step"
|
|
21
|
+
},
|
|
22
|
+
"hint": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "A hint to provide extra context to accomplish the goal"
|
|
25
|
+
},
|
|
26
|
+
"successCriteria": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Crtieria that the agent can use determine if the goal is complete"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"test": {
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"properties": {
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "A descriptive name of the test"
|
|
38
|
+
},
|
|
39
|
+
"testConfig": {
|
|
40
|
+
"$ref": "#/definitions/testConfig",
|
|
41
|
+
"description": "Configs to apply to the specific test"
|
|
42
|
+
},
|
|
43
|
+
"steps": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"$ref": "#/definitions/testStep"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"properties": {
|
|
53
|
+
"defaultConfig": {
|
|
54
|
+
"$ref": "#/definitions/testConfig",
|
|
55
|
+
"description": "Default config to apply to each test within the file"
|
|
56
|
+
},
|
|
57
|
+
"tests": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": {
|
|
60
|
+
"$ref": "#/definitions/test"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"additionalProperties": false,
|
|
4
4
|
"definitions": {
|
|
5
|
+
"ActiveRuntime": {
|
|
6
|
+
"enum": [
|
|
7
|
+
"nodejs18",
|
|
8
|
+
"nodejs20",
|
|
9
|
+
"nodejs22",
|
|
10
|
+
"python310",
|
|
11
|
+
"python311",
|
|
12
|
+
"python312",
|
|
13
|
+
"python313"
|
|
14
|
+
],
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
5
17
|
"DataConnectSingle": {
|
|
6
18
|
"additionalProperties": false,
|
|
7
19
|
"properties": {
|
|
@@ -88,6 +100,9 @@
|
|
|
88
100
|
"database": {
|
|
89
101
|
"type": "string"
|
|
90
102
|
},
|
|
103
|
+
"edition": {
|
|
104
|
+
"type": "string"
|
|
105
|
+
},
|
|
91
106
|
"indexes": {
|
|
92
107
|
"type": "string"
|
|
93
108
|
},
|
|
@@ -239,60 +254,14 @@
|
|
|
239
254
|
"type": "object"
|
|
240
255
|
},
|
|
241
256
|
"FunctionConfig": {
|
|
242
|
-
"
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"type": "string"
|
|
246
|
-
},
|
|
247
|
-
"ignore": {
|
|
248
|
-
"items": {
|
|
249
|
-
"type": "string"
|
|
250
|
-
},
|
|
251
|
-
"type": "array"
|
|
252
|
-
},
|
|
253
|
-
"postdeploy": {
|
|
254
|
-
"anyOf": [
|
|
255
|
-
{
|
|
256
|
-
"items": {
|
|
257
|
-
"type": "string"
|
|
258
|
-
},
|
|
259
|
-
"type": "array"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"type": "string"
|
|
263
|
-
}
|
|
264
|
-
]
|
|
265
|
-
},
|
|
266
|
-
"predeploy": {
|
|
267
|
-
"anyOf": [
|
|
268
|
-
{
|
|
269
|
-
"items": {
|
|
270
|
-
"type": "string"
|
|
271
|
-
},
|
|
272
|
-
"type": "array"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
"type": "string"
|
|
276
|
-
}
|
|
277
|
-
]
|
|
278
|
-
},
|
|
279
|
-
"runtime": {
|
|
280
|
-
"enum": [
|
|
281
|
-
"nodejs18",
|
|
282
|
-
"nodejs20",
|
|
283
|
-
"nodejs22",
|
|
284
|
-
"python310",
|
|
285
|
-
"python311",
|
|
286
|
-
"python312",
|
|
287
|
-
"python313"
|
|
288
|
-
],
|
|
289
|
-
"type": "string"
|
|
257
|
+
"anyOf": [
|
|
258
|
+
{
|
|
259
|
+
"$ref": "#/definitions/LocalFunctionConfig"
|
|
290
260
|
},
|
|
291
|
-
|
|
292
|
-
"
|
|
261
|
+
{
|
|
262
|
+
"$ref": "#/definitions/RemoteFunctionConfig"
|
|
293
263
|
}
|
|
294
|
-
|
|
295
|
-
"type": "object"
|
|
264
|
+
]
|
|
296
265
|
},
|
|
297
266
|
"HostingHeaders": {
|
|
298
267
|
"anyOf": [
|
|
@@ -894,6 +863,71 @@
|
|
|
894
863
|
},
|
|
895
864
|
"type": "object"
|
|
896
865
|
},
|
|
866
|
+
"LocalFunctionConfig": {
|
|
867
|
+
"additionalProperties": false,
|
|
868
|
+
"properties": {
|
|
869
|
+
"codebase": {
|
|
870
|
+
"type": "string"
|
|
871
|
+
},
|
|
872
|
+
"configDir": {
|
|
873
|
+
"type": "string"
|
|
874
|
+
},
|
|
875
|
+
"ignore": {
|
|
876
|
+
"items": {
|
|
877
|
+
"type": "string"
|
|
878
|
+
},
|
|
879
|
+
"type": "array"
|
|
880
|
+
},
|
|
881
|
+
"postdeploy": {
|
|
882
|
+
"anyOf": [
|
|
883
|
+
{
|
|
884
|
+
"items": {
|
|
885
|
+
"type": "string"
|
|
886
|
+
},
|
|
887
|
+
"type": "array"
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
"type": "string"
|
|
891
|
+
}
|
|
892
|
+
]
|
|
893
|
+
},
|
|
894
|
+
"predeploy": {
|
|
895
|
+
"anyOf": [
|
|
896
|
+
{
|
|
897
|
+
"items": {
|
|
898
|
+
"type": "string"
|
|
899
|
+
},
|
|
900
|
+
"type": "array"
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
"type": "string"
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
},
|
|
907
|
+
"prefix": {
|
|
908
|
+
"type": "string"
|
|
909
|
+
},
|
|
910
|
+
"runtime": {
|
|
911
|
+
"enum": [
|
|
912
|
+
"nodejs18",
|
|
913
|
+
"nodejs20",
|
|
914
|
+
"nodejs22",
|
|
915
|
+
"python310",
|
|
916
|
+
"python311",
|
|
917
|
+
"python312",
|
|
918
|
+
"python313"
|
|
919
|
+
],
|
|
920
|
+
"type": "string"
|
|
921
|
+
},
|
|
922
|
+
"source": {
|
|
923
|
+
"type": "string"
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
"required": [
|
|
927
|
+
"source"
|
|
928
|
+
],
|
|
929
|
+
"type": "object"
|
|
930
|
+
},
|
|
897
931
|
"Record<string,string>": {
|
|
898
932
|
"additionalProperties": false,
|
|
899
933
|
"type": "object"
|
|
@@ -936,6 +970,79 @@
|
|
|
936
970
|
],
|
|
937
971
|
"type": "object"
|
|
938
972
|
},
|
|
973
|
+
"RemoteFunctionConfig": {
|
|
974
|
+
"additionalProperties": false,
|
|
975
|
+
"properties": {
|
|
976
|
+
"codebase": {
|
|
977
|
+
"type": "string"
|
|
978
|
+
},
|
|
979
|
+
"configDir": {
|
|
980
|
+
"type": "string"
|
|
981
|
+
},
|
|
982
|
+
"ignore": {
|
|
983
|
+
"items": {
|
|
984
|
+
"type": "string"
|
|
985
|
+
},
|
|
986
|
+
"type": "array"
|
|
987
|
+
},
|
|
988
|
+
"postdeploy": {
|
|
989
|
+
"anyOf": [
|
|
990
|
+
{
|
|
991
|
+
"items": {
|
|
992
|
+
"type": "string"
|
|
993
|
+
},
|
|
994
|
+
"type": "array"
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
"type": "string"
|
|
998
|
+
}
|
|
999
|
+
]
|
|
1000
|
+
},
|
|
1001
|
+
"predeploy": {
|
|
1002
|
+
"anyOf": [
|
|
1003
|
+
{
|
|
1004
|
+
"items": {
|
|
1005
|
+
"type": "string"
|
|
1006
|
+
},
|
|
1007
|
+
"type": "array"
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
"type": "string"
|
|
1011
|
+
}
|
|
1012
|
+
]
|
|
1013
|
+
},
|
|
1014
|
+
"prefix": {
|
|
1015
|
+
"type": "string"
|
|
1016
|
+
},
|
|
1017
|
+
"remoteSource": {
|
|
1018
|
+
"additionalProperties": false,
|
|
1019
|
+
"properties": {
|
|
1020
|
+
"dir": {
|
|
1021
|
+
"type": "string"
|
|
1022
|
+
},
|
|
1023
|
+
"ref": {
|
|
1024
|
+
"type": "string"
|
|
1025
|
+
},
|
|
1026
|
+
"repository": {
|
|
1027
|
+
"type": "string"
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
"required": [
|
|
1031
|
+
"ref",
|
|
1032
|
+
"repository"
|
|
1033
|
+
],
|
|
1034
|
+
"type": "object"
|
|
1035
|
+
},
|
|
1036
|
+
"runtime": {
|
|
1037
|
+
"$ref": "#/definitions/ActiveRuntime"
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
"required": [
|
|
1041
|
+
"remoteSource",
|
|
1042
|
+
"runtime"
|
|
1043
|
+
],
|
|
1044
|
+
"type": "object"
|
|
1045
|
+
},
|
|
939
1046
|
"StorageSingle": {
|
|
940
1047
|
"additionalProperties": false,
|
|
941
1048
|
"properties": {
|
|
@@ -1478,7 +1585,10 @@
|
|
|
1478
1585
|
"functions": {
|
|
1479
1586
|
"anyOf": [
|
|
1480
1587
|
{
|
|
1481
|
-
"$ref": "#/definitions/
|
|
1588
|
+
"$ref": "#/definitions/LocalFunctionConfig"
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
"$ref": "#/definitions/RemoteFunctionConfig"
|
|
1482
1592
|
},
|
|
1483
1593
|
{
|
|
1484
1594
|
"items": {
|
|
@@ -1,17 +1 @@
|
|
|
1
1
|
connectorId: __connectorId__
|
|
2
|
-
## ## Here's an example of how to add generated SDKs.
|
|
3
|
-
## ## You'll need to replace the outputDirs with ones pointing to where you want the generated code in your app.
|
|
4
|
-
# generate:
|
|
5
|
-
# javascriptSdk:
|
|
6
|
-
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
7
|
-
# package: "@firebasegen/my-connector"
|
|
8
|
-
# packageJsonDir: < Optional. Path to your Javascript app's package.json>
|
|
9
|
-
# swiftSdk:
|
|
10
|
-
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
11
|
-
# package: DefaultConnector
|
|
12
|
-
# kotlinSdk:
|
|
13
|
-
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
14
|
-
# package: connectors.default
|
|
15
|
-
# dartSdk:
|
|
16
|
-
# outputDir: <Path where you want the generated SDK to be written to, relative to this file>
|
|
17
|
-
# package: default_connector
|
|
@@ -8,5 +8,6 @@ schema:
|
|
|
8
8
|
database: __cloudSqlDatabase__
|
|
9
9
|
cloudSql:
|
|
10
10
|
instanceId: __cloudSqlInstanceId__
|
|
11
|
-
|
|
11
|
+
# schemaValidation: "STRICT" # STRICT mode makes Postgres schema match Data Connect exactly.
|
|
12
|
+
# schemaValidation: "COMPATIBLE" # COMPATIBLE mode makes Postgres schema compatible with Data Connect.
|
|
12
13
|
connectorDirs: __connectorDirs__
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Example mutations for a simple movie app
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
# Create a movie based on user input
|
|
4
|
+
mutation CreateMovie($title: String!, $genre: String!, $imageUrl: String!)
|
|
5
|
+
@auth(level: USER_EMAIL_VERIFIED, insecureReason: "Any email verified users can create a new movie.") {
|
|
6
|
+
movie_insert(data: { title: $title, genre: $genre, imageUrl: $imageUrl })
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
# Upsert (update or insert) a user's username based on their auth.uid
|
|
10
|
+
mutation UpsertUser($username: String!) @auth(level: USER) {
|
|
11
|
+
# The "auth.uid" server value ensures that users can only register their own user.
|
|
12
|
+
user_upsert(data: { id_expr: "auth.uid", username: $username })
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
# Add a review for a movie
|
|
16
|
+
mutation AddReview($movieId: UUID!, $rating: Int!, $reviewText: String!)
|
|
17
|
+
@auth(level: USER) {
|
|
18
|
+
review_upsert(
|
|
19
|
+
data: {
|
|
20
|
+
userId_expr: "auth.uid"
|
|
21
|
+
movieId: $movieId
|
|
22
|
+
rating: $rating
|
|
23
|
+
reviewText: $reviewText
|
|
24
|
+
# reviewDate defaults to today in the schema. No need to set it manually.
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
28
|
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
# Logged in user can delete their review for a movie
|
|
30
|
+
mutation DeleteReview($movieId: UUID!) @auth(level: USER) {
|
|
31
|
+
# The "auth.uid" server value ensures that users can only delete their own reviews.
|
|
32
|
+
review_delete(key: { userId_expr: "auth.uid", movieId: $movieId })
|
|
33
|
+
}
|