firebase-tools-with-isolate 14.10.1 → 14.16.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.
Files changed (236) hide show
  1. package/lib/api.js +5 -1
  2. package/lib/apphosting/backend.js +40 -15
  3. package/lib/apptesting/ensureProjectConfigured.js +56 -0
  4. package/lib/apptesting/invokeTests.js +40 -0
  5. package/lib/apptesting/parseTestFiles.js +75 -0
  6. package/lib/apptesting/types.js +18 -0
  7. package/lib/auth.js +37 -2
  8. package/lib/command.js +24 -5
  9. package/lib/commands/apphosting-backends-create.js +8 -5
  10. package/lib/commands/apptesting-execute.js +101 -0
  11. package/lib/commands/dataconnect-sdk-generate.js +28 -26
  12. package/lib/commands/dataconnect-services-list.js +1 -1
  13. package/lib/commands/dataconnect-sql-diff.js +2 -2
  14. package/lib/commands/dataconnect-sql-grant.js +7 -2
  15. package/lib/commands/dataconnect-sql-migrate.js +2 -2
  16. package/lib/commands/dataconnect-sql-setup.js +3 -5
  17. package/lib/commands/dataconnect-sql-shell.js +2 -2
  18. package/lib/commands/ext-export.js +1 -1
  19. package/lib/commands/firestore-bulkdelete.js +73 -0
  20. package/lib/commands/firestore-databases-create.js +11 -0
  21. package/lib/commands/firestore-operations-cancel.js +44 -0
  22. package/lib/commands/firestore-operations-describe.js +29 -0
  23. package/lib/commands/firestore-operations-list.js +29 -0
  24. package/lib/commands/firestore-utils.js +15 -0
  25. package/lib/commands/functions-config-clone.js +2 -0
  26. package/lib/commands/functions-config-export.js +5 -2
  27. package/lib/commands/functions-config-get.js +2 -0
  28. package/lib/commands/functions-config-set.js +2 -0
  29. package/lib/commands/functions-config-unset.js +2 -0
  30. package/lib/commands/index.js +9 -0
  31. package/lib/commands/init.js +24 -4
  32. package/lib/commands/internaltesting-functions-discover.js +20 -5
  33. package/lib/commands/login.js +13 -9
  34. package/lib/commands/use.js +5 -0
  35. package/lib/config.js +16 -4
  36. package/lib/crashlytics/addNote.js +27 -0
  37. package/lib/crashlytics/buildToolsJarHelper.js +1 -2
  38. package/lib/crashlytics/deleteNote.js +23 -0
  39. package/lib/crashlytics/getIssueDetails.js +26 -0
  40. package/lib/crashlytics/getSampleCrash.js +34 -0
  41. package/lib/crashlytics/listNotes.js +29 -0
  42. package/lib/crashlytics/listTopDevices.js +33 -0
  43. package/lib/crashlytics/listTopIssues.js +8 -23
  44. package/lib/crashlytics/listTopOperatingSystems.js +32 -0
  45. package/lib/crashlytics/listTopVersions.js +32 -0
  46. package/lib/crashlytics/updateIssue.js +35 -0
  47. package/lib/crashlytics/utils.js +38 -0
  48. package/lib/dataconnect/appFinder.js +102 -0
  49. package/lib/dataconnect/client.js +23 -15
  50. package/lib/dataconnect/ensureApis.js +6 -9
  51. package/lib/dataconnect/errors.js +7 -1
  52. package/lib/dataconnect/freeTrial.js +16 -38
  53. package/lib/dataconnect/load.js +105 -6
  54. package/lib/dataconnect/provisionCloudSql.js +67 -70
  55. package/lib/dataconnect/schemaMigration.js +219 -169
  56. package/lib/deploy/dataconnect/deploy.js +7 -9
  57. package/lib/deploy/dataconnect/prepare.js +7 -12
  58. package/lib/deploy/dataconnect/release.js +43 -31
  59. package/lib/deploy/firestore/deploy.js +10 -0
  60. package/lib/deploy/functions/backend.js +7 -1
  61. package/lib/deploy/functions/build.js +28 -14
  62. package/lib/deploy/functions/deploy.js +3 -2
  63. package/lib/deploy/functions/ensure.js +1 -1
  64. package/lib/deploy/functions/functionsDeployHelper.js +8 -1
  65. package/lib/deploy/functions/params.js +4 -0
  66. package/lib/deploy/functions/prepare.js +25 -13
  67. package/lib/deploy/functions/pricing.js +12 -5
  68. package/lib/deploy/functions/release/fabricator.js +25 -3
  69. package/lib/deploy/functions/release/reporter.js +1 -0
  70. package/lib/deploy/functions/runtimes/discovery/index.js +52 -5
  71. package/lib/deploy/functions/runtimes/node/index.js +83 -51
  72. package/lib/emulator/auth/operations.js +10 -1
  73. package/lib/emulator/commandUtils.js +7 -1
  74. package/lib/emulator/controller.js +22 -34
  75. package/lib/emulator/dataconnectEmulator.js +27 -24
  76. package/lib/emulator/downloadableEmulatorInfo.json +18 -18
  77. package/lib/emulator/env.js +2 -1
  78. package/lib/emulator/functionsEmulator.js +12 -2
  79. package/lib/emulator/hub.js +11 -8
  80. package/lib/emulator/tasksEmulator.js +1 -1
  81. package/lib/emulator/ui.js +3 -1
  82. package/lib/env.js +18 -0
  83. package/lib/experiments.js +20 -0
  84. package/lib/extensions/extensionsHelper.js +4 -15
  85. package/lib/extensions/runtimes/common.js +3 -2
  86. package/lib/extensions/utils.js +1 -12
  87. package/lib/firestore/api-sort.js +96 -3
  88. package/lib/firestore/api-types.js +20 -1
  89. package/lib/firestore/api.js +144 -15
  90. package/lib/firestore/pretty-print.js +35 -1
  91. package/lib/firestore/validator.js +1 -1
  92. package/lib/functional.js +7 -1
  93. package/lib/functions/deprecationWarnings.js +21 -0
  94. package/lib/functions/env.js +31 -16
  95. package/lib/functions/projectConfig.js +87 -8
  96. package/lib/functions/secrets.js +3 -0
  97. package/lib/gcp/cloudfunctions.js +1 -6
  98. package/lib/gcp/cloudfunctionsv2.js +3 -39
  99. package/lib/gcp/cloudscheduler.js +1 -1
  100. package/lib/gcp/cloudsql/cloudsqladmin.js +4 -16
  101. package/lib/gcp/cloudsql/connect.js +4 -3
  102. package/lib/gcp/cloudsql/permissionsSetup.js +23 -16
  103. package/lib/gcp/k8s.js +32 -0
  104. package/lib/gcp/runv2.js +181 -0
  105. package/lib/gemini/fdcExperience.js +5 -3
  106. package/lib/init/features/aitools/claude.js +43 -0
  107. package/lib/init/features/aitools/cursor.js +61 -0
  108. package/lib/init/features/aitools/gemini.js +58 -0
  109. package/lib/init/features/aitools/index.js +28 -0
  110. package/lib/init/features/aitools/promptUpdater.js +111 -0
  111. package/lib/init/features/aitools/studio.js +17 -0
  112. package/lib/init/features/aitools/types.js +2 -0
  113. package/lib/init/features/aitools.js +83 -0
  114. package/lib/init/features/apptesting/index.js +34 -0
  115. package/lib/init/features/dataconnect/create_app.js +53 -0
  116. package/lib/init/features/dataconnect/index.js +280 -186
  117. package/lib/init/features/dataconnect/sdk.js +232 -144
  118. package/lib/init/features/index.js +8 -3
  119. package/lib/init/features/project.js +4 -0
  120. package/lib/init/index.js +18 -2
  121. package/lib/management/apps.js +3 -3
  122. package/lib/management/studio.js +120 -0
  123. package/lib/mcp/errors.js +5 -7
  124. package/lib/mcp/index.js +179 -61
  125. package/lib/mcp/logging-transport.js +23 -0
  126. package/lib/mcp/prompt.js +10 -0
  127. package/lib/mcp/prompts/core/deploy.js +101 -0
  128. package/lib/mcp/prompts/core/index.js +5 -0
  129. package/lib/mcp/prompts/crashlytics/connect.js +114 -0
  130. package/lib/mcp/prompts/crashlytics/index.js +5 -0
  131. package/lib/mcp/prompts/dataconnect/index.js +9 -0
  132. package/lib/mcp/prompts/dataconnect/schema.js +67 -0
  133. package/lib/mcp/prompts/index.js +47 -0
  134. package/lib/mcp/tools/apphosting/fetch_logs.js +22 -22
  135. package/lib/mcp/tools/apphosting/list_backends.js +10 -10
  136. package/lib/mcp/tools/auth/disable_user.js +7 -7
  137. package/lib/mcp/tools/auth/get_user.js +13 -6
  138. package/lib/mcp/tools/auth/index.js +10 -10
  139. package/lib/mcp/tools/auth/list_users.js +6 -6
  140. package/lib/mcp/tools/auth/set_claims.js +7 -7
  141. package/lib/mcp/tools/auth/set_sms_region_policy.js +6 -6
  142. package/lib/mcp/tools/core/consult_assistant.js +13 -8
  143. package/lib/mcp/tools/core/create_android_sha.js +9 -9
  144. package/lib/mcp/tools/core/create_app.js +7 -7
  145. package/lib/mcp/tools/core/create_project.js +13 -13
  146. package/lib/mcp/tools/core/get_admin_sdk_config.js +7 -7
  147. package/lib/mcp/tools/core/get_environment.js +8 -8
  148. package/lib/mcp/tools/core/get_project.js +5 -5
  149. package/lib/mcp/tools/core/get_sdk_config.js +19 -9
  150. package/lib/mcp/tools/core/index.js +28 -24
  151. package/lib/mcp/tools/core/init.js +39 -16
  152. package/lib/mcp/tools/core/list_apps.js +6 -6
  153. package/lib/mcp/tools/core/list_projects.js +6 -6
  154. package/lib/mcp/tools/core/login.js +46 -0
  155. package/lib/mcp/tools/core/logout.js +62 -0
  156. package/lib/mcp/tools/core/update_environment.js +10 -10
  157. package/lib/mcp/tools/crashlytics/add_note.js +32 -0
  158. package/lib/mcp/tools/crashlytics/constants.js +11 -0
  159. package/lib/mcp/tools/crashlytics/delete_note.js +35 -0
  160. package/lib/mcp/tools/crashlytics/get_issue_details.js +31 -0
  161. package/lib/mcp/tools/crashlytics/get_sample_crash.js +43 -0
  162. package/lib/mcp/tools/crashlytics/index.js +22 -2
  163. package/lib/mcp/tools/crashlytics/list_notes.js +37 -0
  164. package/lib/mcp/tools/crashlytics/list_top_devices.js +33 -0
  165. package/lib/mcp/tools/crashlytics/list_top_issues.js +12 -13
  166. package/lib/mcp/tools/crashlytics/list_top_operating_systems.js +33 -0
  167. package/lib/mcp/tools/crashlytics/list_top_versions.js +33 -0
  168. package/lib/mcp/tools/crashlytics/update_issue.js +37 -0
  169. package/lib/mcp/tools/database/get_data.js +49 -0
  170. package/lib/mcp/tools/database/get_rules.js +39 -0
  171. package/lib/mcp/tools/database/index.js +8 -0
  172. package/lib/mcp/tools/database/set_data.js +57 -0
  173. package/lib/mcp/tools/database/validate_rules.js +41 -0
  174. package/lib/mcp/tools/dataconnect/compile.js +43 -0
  175. package/lib/mcp/tools/dataconnect/execute.js +71 -0
  176. package/lib/mcp/tools/dataconnect/generate_operation.js +8 -8
  177. package/lib/mcp/tools/dataconnect/generate_schema.js +6 -6
  178. package/lib/mcp/tools/dataconnect/index.js +10 -18
  179. package/lib/mcp/tools/dataconnect/list_services.js +107 -11
  180. package/lib/mcp/tools/firestore/delete_document.js +13 -13
  181. package/lib/mcp/tools/firestore/get_documents.js +13 -13
  182. package/lib/mcp/tools/firestore/list_collections.js +7 -10
  183. package/lib/mcp/tools/firestore/query_collection.js +13 -13
  184. package/lib/mcp/tools/index.js +24 -18
  185. package/lib/mcp/tools/messaging/index.js +2 -2
  186. package/lib/mcp/tools/messaging/send_message.js +7 -7
  187. package/lib/mcp/tools/remoteconfig/get_template.js +5 -5
  188. package/lib/mcp/tools/remoteconfig/index.js +4 -4
  189. package/lib/mcp/tools/remoteconfig/publish_template.js +7 -7
  190. package/lib/mcp/tools/remoteconfig/rollback_template.js +6 -6
  191. package/lib/mcp/tools/rules/get_rules.js +8 -8
  192. package/lib/mcp/tools/rules/validate_rules.js +10 -10
  193. package/lib/mcp/tools/storage/get_download_url.js +8 -8
  194. package/lib/mcp/tools/storage/get_rules.js +8 -8
  195. package/lib/mcp/types.js +2 -0
  196. package/lib/mcp/util/dataconnect/compile.js +20 -0
  197. package/lib/mcp/util/dataconnect/content.js +655 -0
  198. package/lib/mcp/util/dataconnect/emulator.js +16 -0
  199. package/lib/mcp/util.js +5 -18
  200. package/lib/requireAuth.js +14 -4
  201. package/lib/rtdb.js +10 -6
  202. package/lib/scopes.js +2 -1
  203. package/lib/serve/functions.js +4 -3
  204. package/lib/timeout.js +21 -0
  205. package/lib/track.js +18 -1
  206. package/lib/unzip.js +13 -0
  207. package/lib/utils.js +76 -2
  208. package/package.json +5 -3
  209. package/prompts/FIREBASE.md +121 -0
  210. package/prompts/FIREBASE_FUNCTIONS.md +221 -0
  211. package/schema/apptesting-yaml.json +64 -0
  212. package/schema/firebase-config.json +163 -53
  213. package/templates/init/aitools/cursor-rules-header.txt +8 -0
  214. package/templates/init/aitools/gemini-extension.json +11 -0
  215. package/templates/init/apptesting/smoke_test.yaml +6 -0
  216. package/templates/init/dataconnect/connector.yaml +0 -16
  217. package/templates/init/dataconnect/dataconnect.yaml +2 -1
  218. package/templates/init/dataconnect/mutations.gql +29 -29
  219. package/templates/init/dataconnect/queries.gql +73 -73
  220. package/templates/init/dataconnect/schema.gql +48 -48
  221. package/templates/init/firestore/firestore.indexes.json +26 -1
  222. package/lib/dataconnect/fileUtils.js +0 -168
  223. package/lib/emulator/adminSdkConfig.test.js +0 -16
  224. package/lib/extensions/resolveSource.js +0 -23
  225. package/lib/firestore/api-sort.test.js +0 -74
  226. package/lib/firestore/backupUtils.test.js +0 -18
  227. package/lib/firestore/pretty-print.test.js +0 -61
  228. package/lib/firestore/util.test.js +0 -42
  229. package/lib/mcp/tools/dataconnect/emulator.js +0 -16
  230. package/lib/mcp/tools/dataconnect/execute_graphql.js +0 -48
  231. package/lib/mcp/tools/dataconnect/execute_graphql_read.js +0 -48
  232. package/lib/mcp/tools/dataconnect/execute_mutation.js +0 -62
  233. package/lib/mcp/tools/dataconnect/execute_query.js +0 -62
  234. package/lib/mcp/tools/dataconnect/get_connector.js +0 -31
  235. package/lib/mcp/tools/dataconnect/get_schema.js +0 -31
  236. /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
- "additionalProperties": false,
243
- "properties": {
244
- "codebase": {
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
- "source": {
292
- "type": "string"
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/FunctionConfig"
1588
+ "$ref": "#/definitions/LocalFunctionConfig"
1589
+ },
1590
+ {
1591
+ "$ref": "#/definitions/RemoteFunctionConfig"
1482
1592
  },
1483
1593
  {
1484
1594
  "items": {
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: Firebase project development guidelines
3
+ globs:
4
+ - "firebase.json"
5
+ - "firestore.rules"
6
+ - "**/*.rules"
7
+ - "functions/**/*"
8
+ ---
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "firebase",
3
+ "version": "0.0.1",
4
+ "mcpServers": {
5
+ "firebase": {
6
+ "command": "npx",
7
+ "args": ["-y", "firebase-tools", "experimental:mcp", "--dir", "{{PROJECT_PATH}}"]
8
+ }
9
+ },
10
+ "contextFileName": "FIREBASE.md"
11
+ }
@@ -0,0 +1,6 @@
1
+ tests:
2
+ - testName: Smoke test
3
+ steps:
4
+ - goal: View the provided application
5
+ hint: No additional actions should be necessary
6
+ successCriteria: The application should load with no obvious errors
@@ -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
- # schemaValidation: "COMPATIBLE"
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
- # # Example mutations for a simple movie app
1
+ # Example mutations for a simple movie app
2
2
 
3
- # # Create a movie based on user input
4
- # mutation CreateMovie($title: String!, $genre: String!, $imageUrl: String!)
5
- # @auth(level: USER_EMAIL_VERIFIED) {
6
- # movie_insert(data: { title: $title, genre: $genre, imageUrl: $imageUrl })
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
- # # 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
- # }
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
- # # 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
- # }
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
- # # 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
- # }
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
+ }