firebase-tools 15.5.0 → 15.6.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 (61) hide show
  1. package/lib/apiv2.js +11 -5
  2. package/lib/apphosting/backend.js +1 -1
  3. package/lib/commands/deploy.js +3 -0
  4. package/lib/commands/init.js +5 -0
  5. package/lib/config.js +1 -0
  6. package/lib/dataconnect/client.js +2 -2
  7. package/lib/dataconnect/prompts.js +14 -0
  8. package/lib/deploy/auth/deploy.js +63 -0
  9. package/lib/deploy/auth/index.js +9 -0
  10. package/lib/deploy/auth/prepare.js +26 -0
  11. package/lib/deploy/auth/release.js +5 -0
  12. package/lib/deploy/dataconnect/release.js +11 -0
  13. package/lib/deploy/functions/backend.js +10 -0
  14. package/lib/deploy/functions/build.js +2 -2
  15. package/lib/deploy/functions/checkIam.js +3 -2
  16. package/lib/deploy/functions/deploy.js +4 -2
  17. package/lib/deploy/functions/prepare.js +5 -2
  18. package/lib/deploy/functions/prepareFunctionsUpload.js +7 -5
  19. package/lib/deploy/functions/release/fabricator.js +96 -15
  20. package/lib/deploy/functions/release/index.js +2 -1
  21. package/lib/deploy/functions/runtimes/dart.js +42 -0
  22. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +4 -1
  23. package/lib/deploy/functions/runtimes/index.js +9 -1
  24. package/lib/deploy/functions/runtimes/supported/types.js +6 -0
  25. package/lib/deploy/index.js +2 -0
  26. package/lib/emulator/auth/index.js +23 -17
  27. package/lib/emulator/auth/operations.js +9 -1
  28. package/lib/emulator/downloadableEmulatorInfo.json +31 -31
  29. package/lib/emulator/hubExport.js +15 -1
  30. package/lib/ensureApiEnabled.js +2 -2
  31. package/lib/gcp/cloudbilling.js +6 -3
  32. package/lib/gcp/iam.js +1 -1
  33. package/lib/gcp/runv2.js +75 -3
  34. package/lib/gcp/serviceusage.js +2 -2
  35. package/lib/gemini/fdcExperience.js +0 -11
  36. package/lib/init/features/auth.js +72 -0
  37. package/lib/init/features/dataconnect/resolver.js +17 -3
  38. package/lib/init/features/functions/index.js +22 -14
  39. package/lib/init/features/functions/javascript.js +18 -3
  40. package/lib/init/features/functions/typescript.js +20 -3
  41. package/lib/init/features/functions/utils.js +10 -0
  42. package/lib/init/features/genkit/index.js +3 -2
  43. package/lib/init/features/index.js +6 -2
  44. package/lib/init/index.js +11 -1
  45. package/lib/management/provisioning/provision.js +3 -0
  46. package/lib/management/provisioning/types.js +7 -0
  47. package/lib/mcp/resources/guides/init_auth.js +19 -2
  48. package/lib/mcp/tools/apptesting/tests.js +6 -4
  49. package/lib/mcp/tools/core/init.js +31 -0
  50. package/lib/tsconfig.publish.tsbuildinfo +1 -1
  51. package/package.json +1 -1
  52. package/schema/firebase-config.json +41 -0
  53. package/templates/init/apptesting/smoke_test.yaml +1 -1
  54. package/templates/init/dataconnect/secondary_schema.gql +8 -0
  55. package/templates/init/functions/javascript/index-ongraphrequest.js +36 -0
  56. package/templates/init/functions/javascript/package-ongraphrequest.lint.json +28 -0
  57. package/templates/init/functions/javascript/package-ongraphrequest.nolint.json +25 -0
  58. package/templates/init/functions/typescript/index-ongraphrequest.ts +44 -0
  59. package/templates/init/functions/typescript/package-ongraphrequest.lint.json +33 -0
  60. package/templates/init/functions/typescript/package-ongraphrequest.nolint.json +27 -0
  61. package/lib/mcp/util.test.js +0 -468
@@ -1,468 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const util_1 = require("./util");
5
- const testCases = [
6
- {
7
- desc: "should remove $schema property",
8
- input: {
9
- $schema: "http://json-schema.org/draft-07/schema#",
10
- type: "object",
11
- properties: { name: { type: "string" } },
12
- },
13
- expected: {
14
- type: "object",
15
- properties: { name: { type: "string" } },
16
- },
17
- },
18
- {
19
- desc: "should remove additionalProperties field",
20
- input: {
21
- type: "object",
22
- properties: { name: { type: "string" } },
23
- additionalProperties: false,
24
- },
25
- expected: {
26
- type: "object",
27
- properties: { name: { type: "string" } },
28
- },
29
- },
30
- {
31
- desc: "should remove additionalProperties from nested objects",
32
- input: {
33
- type: "object",
34
- properties: {
35
- user: {
36
- type: "object",
37
- properties: { id: { type: "number" } },
38
- additionalProperties: true,
39
- },
40
- meta: {
41
- type: "object",
42
- additionalProperties: { type: "string" },
43
- },
44
- },
45
- additionalProperties: false,
46
- },
47
- expected: {
48
- type: "object",
49
- properties: {
50
- user: {
51
- type: "object",
52
- properties: { id: { type: "number" } },
53
- },
54
- meta: {
55
- type: "object",
56
- },
57
- },
58
- },
59
- },
60
- {
61
- desc: "should remove top-level array type (string)",
62
- input: { type: "array", items: { type: "string" } },
63
- expected: {},
64
- },
65
- {
66
- desc: "should remove top-level array type (array of types including array)",
67
- input: { type: ["array", "string"], items: { type: "string" } },
68
- expected: { type: "string", items: { type: "string" } },
69
- },
70
- {
71
- desc: "should remove top-level array type (array of types including array and null)",
72
- input: { type: ["array", "null"], items: { type: "string" } },
73
- expected: {},
74
- },
75
- {
76
- desc: "should remove top-level null type",
77
- input: { type: "null" },
78
- expected: {},
79
- },
80
- {
81
- desc: "should KEEP array type in properties",
82
- input: {
83
- type: "object",
84
- properties: {
85
- tags: { type: "array", items: { type: "string" } },
86
- name: { type: "string" },
87
- },
88
- },
89
- expected: {
90
- type: "object",
91
- properties: {
92
- tags: { type: "array", items: { type: "string" } },
93
- name: { type: "string" },
94
- },
95
- },
96
- },
97
- {
98
- desc: "should remove null type from properties",
99
- input: {
100
- type: "object",
101
- properties: {
102
- optionalField: { type: "null" },
103
- name: { type: "string" },
104
- },
105
- },
106
- expected: {
107
- type: "object",
108
- properties: { name: { type: "string" } },
109
- },
110
- },
111
- {
112
- desc: "should convert type: ['string', 'null', 'array'] to anyOf: [{type: 'string'}, {type: 'array'}] in properties",
113
- input: {
114
- type: "object",
115
- properties: {
116
- mixed: { type: ["string", "null", "array"] },
117
- },
118
- },
119
- expected: {
120
- type: "object",
121
- properties: {
122
- mixed: { anyOf: [{ type: "string" }, { type: "array" }] },
123
- },
124
- },
125
- },
126
- {
127
- desc: "should convert type: ['string', 'number', 'null', 'array'] to anyOf in properties",
128
- input: {
129
- type: "object",
130
- properties: {
131
- mixed: { type: ["string", "number", "null", "array"] },
132
- },
133
- },
134
- expected: {
135
- type: "object",
136
- properties: {
137
- mixed: { anyOf: [{ type: "string" }, { type: "number" }, { type: "array" }] },
138
- },
139
- },
140
- },
141
- {
142
- desc: "should simplify type: ['string', 'null'] to type: 'string' in properties",
143
- input: {
144
- type: "object",
145
- properties: {
146
- simpleMixed: { type: ["string", "null"] },
147
- },
148
- },
149
- expected: {
150
- type: "object",
151
- properties: {
152
- simpleMixed: { type: "string" },
153
- },
154
- },
155
- },
156
- {
157
- desc: "should remove property if its type array becomes empty after filtering (e.g. only null)",
158
- input: {
159
- type: "object",
160
- properties: {
161
- onlyNull: { type: ["null"] },
162
- name: { type: "string" },
163
- },
164
- },
165
- expected: {
166
- type: "object",
167
- properties: { name: { type: "string" } },
168
- },
169
- },
170
- {
171
- desc: "should keep property if its type array contains only 'array' (not root) and simplify",
172
- input: {
173
- type: "object",
174
- properties: {
175
- onlyArray: { type: ["array", "null"] },
176
- name: { type: "string" },
177
- },
178
- },
179
- expected: {
180
- type: "object",
181
- properties: {
182
- onlyArray: { type: "array" },
183
- name: { type: "string" },
184
- },
185
- },
186
- },
187
- {
188
- desc: "should handle nested objects and clean them (arrays kept in nested, type arrays become anyOf or simplified)",
189
- input: {
190
- type: "object",
191
- properties: {
192
- user: {
193
- type: "object",
194
- properties: {
195
- id: { type: "number" },
196
- tags: { type: "array", items: { type: "string" } },
197
- status: { type: ["string", "integer", "null"] },
198
- maybeName: { type: ["string", "null"] },
199
- },
200
- },
201
- },
202
- },
203
- expected: {
204
- type: "object",
205
- properties: {
206
- user: {
207
- type: "object",
208
- properties: {
209
- id: { type: "number" },
210
- tags: { type: "array", items: { type: "string" } },
211
- status: { anyOf: [{ type: "string" }, { type: "integer" }] },
212
- maybeName: { type: "string" },
213
- },
214
- },
215
- },
216
- },
217
- },
218
- {
219
- desc: "should remove items if its schema becomes null",
220
- input: {
221
- type: "object",
222
- properties: {
223
- someObjectWithItems: {
224
- type: "object",
225
- items: { type: "null" },
226
- },
227
- },
228
- },
229
- expected: {
230
- type: "object",
231
- properties: {
232
- someObjectWithItems: {
233
- type: "object",
234
- },
235
- },
236
- },
237
- },
238
- {
239
- desc: "should clean definitions ($defs), convert type arrays to anyOf/simplified",
240
- input: {
241
- type: "object",
242
- properties: {
243
- myDef: { $ref: "#/$defs/invalidDef" },
244
- myValidDef: { $ref: "#/$defs/validDefWithArray" },
245
- myComplexDef: { $ref: "#/$defs/complexDef" },
246
- },
247
- $defs: {
248
- invalidDef: { type: "null" },
249
- validDef: { type: "string" },
250
- validDefWithArray: { type: "array", items: { type: "number" } },
251
- complexDef: { type: ["boolean", "string", "null"] },
252
- },
253
- },
254
- expected: {
255
- type: "object",
256
- properties: {
257
- myDef: { $ref: "#/$defs/invalidDef" },
258
- myValidDef: { $ref: "#/$defs/validDefWithArray" },
259
- myComplexDef: { $ref: "#/$defs/complexDef" },
260
- },
261
- $defs: {
262
- validDef: { type: "string" },
263
- validDefWithArray: { type: "array", items: { type: "number" } },
264
- complexDef: { anyOf: [{ type: "boolean" }, { type: "string" }] },
265
- },
266
- },
267
- },
268
- {
269
- desc: "should remove $defs if all definitions become invalid (e.g. all null)",
270
- input: {
271
- type: "object",
272
- $defs: {
273
- invalidDef1: { type: "null" },
274
- invalidDef2: { type: "null" },
275
- },
276
- },
277
- expected: {
278
- type: "object",
279
- },
280
- },
281
- {
282
- desc: "should clean schema arrays (anyOf, allOf, oneOf), keep nested arrays, convert internal type arrays",
283
- input: {
284
- anyOf: [
285
- { type: "string" },
286
- { type: "array", items: { type: "number" } },
287
- { type: "null" },
288
- { type: ["integer", "boolean", "null"] },
289
- ],
290
- allOf: [{ type: "number" }],
291
- oneOf: [{ type: "boolean" }, { type: ["null", "array"] }],
292
- },
293
- expected: {
294
- anyOf: [
295
- { type: "string" },
296
- { type: "array", items: { type: "number" } },
297
- { anyOf: [{ type: "integer" }, { type: "boolean" }] },
298
- ],
299
- allOf: [{ type: "number" }],
300
- oneOf: [{ type: "boolean" }, { type: "array" }],
301
- },
302
- },
303
- {
304
- desc: "should remove schema array keywords if their arrays become empty (e.g. all null)",
305
- input: {
306
- anyOf: [{ type: "null" }, { type: "null" }],
307
- description: "test",
308
- },
309
- expected: {
310
- description: "test",
311
- },
312
- },
313
- {
314
- desc: "should return an empty object if the entire schema is just { type: 'array' }",
315
- input: { type: "array" },
316
- expected: {},
317
- },
318
- {
319
- desc: "should return an empty object if the entire schema is just { type: 'null' }",
320
- input: { type: "null" },
321
- expected: {},
322
- },
323
- {
324
- desc: "should return an empty object if the entire schema is { type: ['null', 'array'] }",
325
- input: { type: ["null", "array"] },
326
- expected: {},
327
- },
328
- {
329
- desc: "should not modify a schema that is already clean (with nested array and anyOf)",
330
- input: {
331
- type: "object",
332
- properties: {
333
- name: { type: "string" },
334
- age: { type: "integer" },
335
- scores: { type: "array", items: { type: "number" } },
336
- choice: { anyOf: [{ type: "string" }, { type: "boolean" }] },
337
- },
338
- required: ["name"],
339
- },
340
- expected: {
341
- type: "object",
342
- properties: {
343
- name: { type: "string" },
344
- age: { type: "integer" },
345
- scores: { type: "array", items: { type: "number" } },
346
- choice: { anyOf: [{ type: "string" }, { type: "boolean" }] },
347
- },
348
- required: ["name"],
349
- },
350
- },
351
- {
352
- desc: "should handle deeply nested structures with various cleaning needs (arrays kept if not root, type arrays to anyOf)",
353
- input: {
354
- $schema: "http://json-schema.org/draft-07/schema#",
355
- title: "Complex Test",
356
- type: "object",
357
- additionalProperties: false,
358
- properties: {
359
- validProp: { type: "string" },
360
- propToBeKept: { type: "array", items: { type: "number" } },
361
- objectWithMixedTypes: {
362
- type: "object",
363
- additionalProperties: true,
364
- properties: {
365
- subPropString: { type: "string" },
366
- subPropNull: { type: "null" },
367
- subPropArrayType: { type: ["integer", "null", "array", "string"] },
368
- },
369
- },
370
- anotherArrayProp: { type: "array", items: { type: "boolean" } },
371
- },
372
- $defs: {
373
- reusableInvalid: { type: "null" },
374
- reusableValid: {
375
- type: "object",
376
- additionalProperties: { type: "string" },
377
- properties: {
378
- detail: { type: "string" },
379
- unwantedList: { type: "array", items: { type: "string" } },
380
- statusOptions: { type: ["number", "string", "null"] },
381
- },
382
- },
383
- toBeEmptyDef: { type: "null" },
384
- },
385
- anyOf: [
386
- { type: "string" },
387
- { type: "array", items: { type: "object" } },
388
- { $ref: "#/$defs/reusableInvalid" },
389
- { type: ["boolean", "null", "integer"] },
390
- ],
391
- },
392
- expected: {
393
- title: "Complex Test",
394
- type: "object",
395
- properties: {
396
- validProp: { type: "string" },
397
- propToBeKept: { type: "array", items: { type: "number" } },
398
- objectWithMixedTypes: {
399
- type: "object",
400
- properties: {
401
- subPropString: { type: "string" },
402
- subPropArrayType: {
403
- anyOf: [{ type: "integer" }, { type: "array" }, { type: "string" }],
404
- },
405
- },
406
- },
407
- anotherArrayProp: { type: "array", items: { type: "boolean" } },
408
- },
409
- $defs: {
410
- reusableValid: {
411
- type: "object",
412
- properties: {
413
- detail: { type: "string" },
414
- unwantedList: { type: "array", items: { type: "string" } },
415
- statusOptions: { anyOf: [{ type: "number" }, { type: "string" }] },
416
- },
417
- },
418
- },
419
- anyOf: [
420
- { type: "string" },
421
- { type: "array", items: { type: "object" } },
422
- { anyOf: [{ type: "boolean" }, { type: "integer" }] },
423
- ],
424
- },
425
- },
426
- {
427
- desc: "should remove properties if properties object becomes empty (all null)",
428
- input: {
429
- type: "object",
430
- properties: {
431
- field1: { type: "null" },
432
- field2: { type: "null" },
433
- },
434
- },
435
- expected: {
436
- type: "object",
437
- },
438
- },
439
- {
440
- desc: "top level schema with type: ['string', 'array'] should become type: 'string'",
441
- input: {
442
- type: ["string", "array"],
443
- description: "Test",
444
- },
445
- expected: {
446
- type: "string",
447
- description: "Test",
448
- },
449
- },
450
- {
451
- desc: "top level schema with type: ['string', 'number', 'array'] should become anyOf: [{type: string}, {type: number}]",
452
- input: {
453
- type: ["string", "number", "array"],
454
- description: "Test AnyOf Root",
455
- },
456
- expected: {
457
- anyOf: [{ type: "string" }, { type: "number" }],
458
- description: "Test AnyOf Root",
459
- },
460
- },
461
- ];
462
- describe("cleanSchema", () => {
463
- testCases.forEach((tc) => {
464
- it(tc.desc, () => {
465
- (0, chai_1.expect)((0, util_1.cleanSchema)(tc.input)).to.deep.equal(tc.expected);
466
- });
467
- });
468
- });