firebase-tools-with-isolate 13.9.0 → 13.15.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.
Files changed (125) hide show
  1. package/lib/api.js +4 -2
  2. package/lib/apphosting/githubConnections.js +125 -37
  3. package/lib/apphosting/index.js +3 -8
  4. package/lib/auth.js +14 -15
  5. package/lib/bin/firebase.js +7 -5
  6. package/lib/commands/dataconnect-sdk-generate.js +17 -15
  7. package/lib/commands/dataconnect-services-list.js +2 -8
  8. package/lib/commands/dataconnect-sql-migrate.js +0 -1
  9. package/lib/commands/deploy.js +7 -1
  10. package/lib/commands/ext-configure.js +1 -6
  11. package/lib/commands/ext-dev-init.js +27 -30
  12. package/lib/commands/ext-dev-upload.js +4 -6
  13. package/lib/commands/ext-info.js +3 -5
  14. package/lib/commands/ext-install.js +0 -5
  15. package/lib/commands/ext-uninstall.js +0 -5
  16. package/lib/commands/ext-update.js +0 -5
  17. package/lib/commands/firestore-backups-schedules-create.js +11 -14
  18. package/lib/commands/firestore-backups-schedules-list.js +1 -1
  19. package/lib/commands/firestore-backups-schedules-update.js +4 -3
  20. package/lib/commands/firestore-databases-create.js +24 -7
  21. package/lib/commands/firestore-databases-restore.js +4 -4
  22. package/lib/commands/firestore-databases-update.js +5 -6
  23. package/lib/commands/functions-secrets-set.js +9 -6
  24. package/lib/commands/help.js +2 -0
  25. package/lib/commands/hosting-channel-create.js +1 -1
  26. package/lib/commands/hosting-channel-delete.js +1 -1
  27. package/lib/commands/hosting-channel-deploy.js +1 -1
  28. package/lib/commands/hosting-clone.js +1 -2
  29. package/lib/commands/index.js +9 -11
  30. package/lib/commands/init.js +16 -12
  31. package/lib/commands/login.js +1 -2
  32. package/lib/commands/setup-emulators-dataconnect.js +22 -3
  33. package/lib/config.js +5 -0
  34. package/lib/crashlytics/buildToolsJarHelper.js +2 -1
  35. package/lib/dataconnect/build.js +1 -9
  36. package/lib/dataconnect/client.js +67 -28
  37. package/lib/dataconnect/errors.js +17 -9
  38. package/lib/dataconnect/fileUtils.js +30 -7
  39. package/lib/dataconnect/filters.js +12 -1
  40. package/lib/dataconnect/graphqlError.js +6 -3
  41. package/lib/dataconnect/load.js +9 -7
  42. package/lib/dataconnect/names.js +21 -1
  43. package/lib/dataconnect/provisionCloudSql.js +37 -20
  44. package/lib/dataconnect/schemaMigration.js +119 -66
  45. package/lib/dataconnect/types.js +8 -1
  46. package/lib/deploy/dataconnect/deploy.js +1 -0
  47. package/lib/deploy/dataconnect/prepare.js +16 -2
  48. package/lib/deploy/dataconnect/release.js +0 -1
  49. package/lib/deploy/functions/build.js +10 -1
  50. package/lib/deploy/functions/prepare.js +1 -1
  51. package/lib/deploy/functions/runtimes/discovery/index.js +2 -1
  52. package/lib/deploy/functions/runtimes/supported/types.js +6 -0
  53. package/lib/emulator/adminSdkConfig.test.js +16 -0
  54. package/lib/emulator/constants.js +1 -0
  55. package/lib/emulator/controller.js +4 -9
  56. package/lib/emulator/dataconnectEmulator.js +181 -35
  57. package/lib/emulator/download.js +4 -0
  58. package/lib/emulator/downloadableEmulators.js +54 -28
  59. package/lib/emulator/eventarcEmulator.js +68 -18
  60. package/lib/emulator/functionsEmulator.js +89 -0
  61. package/lib/emulator/functionsEmulatorShared.js +4 -0
  62. package/lib/emulator/hub.js +1 -1
  63. package/lib/emulator/portUtils.js +20 -2
  64. package/lib/emulator/pubsubEmulator.js +1 -1
  65. package/lib/emulator/registry.js +1 -1
  66. package/lib/emulator/storage/apis/shared.js +2 -1
  67. package/lib/emulator/storage/persistence.js +5 -13
  68. package/lib/emulator/storage/rfc.js +9 -0
  69. package/lib/emulator/storage/rules/config.js +4 -2
  70. package/lib/emulator/storage/rules/runtime.js +1 -1
  71. package/lib/experiments.js +8 -3
  72. package/lib/extensions/askUserForParam.js +1 -1
  73. package/lib/extensions/change-log.js +2 -4
  74. package/lib/extensions/displayExtensionInfo.js +0 -5
  75. package/lib/extensions/extensionsHelper.js +5 -7
  76. package/lib/extensions/provisioningHelper.js +1 -1
  77. package/lib/extensions/updateHelper.js +1 -2
  78. package/lib/extensions/warnings.js +2 -7
  79. package/lib/firestore/api-sort.test.js +74 -0
  80. package/lib/firestore/api.js +8 -7
  81. package/lib/firestore/backupUtils.test.js +18 -0
  82. package/lib/firestore/pretty-print.js +21 -1
  83. package/lib/firestore/pretty-print.test.js +61 -0
  84. package/lib/firestore/util.test.js +42 -0
  85. package/lib/frameworks/angular/utils.js +21 -8
  86. package/lib/frameworks/compose/discover/mockFileSystem.js +36 -0
  87. package/lib/frameworks/index.js +2 -6
  88. package/lib/frameworks/next/utils.js +2 -9
  89. package/lib/frameworks/nuxt/index.js +3 -3
  90. package/lib/functions/events/v2.js +2 -1
  91. package/lib/gcp/cloudsql/cloudsqladmin.js +20 -2
  92. package/lib/gcp/cloudsql/connect.js +6 -6
  93. package/lib/gcp/devConnect.js +36 -1
  94. package/lib/hosting/implicitInit.js +2 -2
  95. package/lib/init/features/dataconnect/index.js +252 -124
  96. package/lib/init/features/dataconnect/sdk.js +131 -0
  97. package/lib/init/features/firestore/indexes.js +2 -2
  98. package/lib/init/features/firestore/rules.js +2 -2
  99. package/lib/init/features/functions/javascript.js +6 -8
  100. package/lib/init/features/functions/python.js +4 -6
  101. package/lib/init/features/functions/typescript.js +8 -10
  102. package/lib/init/features/hosting/github.js +43 -21
  103. package/lib/init/features/hosting/index.js +3 -3
  104. package/lib/init/features/index.js +3 -1
  105. package/lib/init/features/storage.js +2 -2
  106. package/lib/init/index.js +1 -0
  107. package/lib/listFiles.js +1 -1
  108. package/lib/management/apps.js +2 -2
  109. package/lib/rc.js +2 -3
  110. package/lib/requireAuth.js +8 -0
  111. package/lib/rulesDeploy.js +14 -12
  112. package/lib/templates.js +23 -0
  113. package/lib/track.js +29 -2
  114. package/lib/utils.js +2 -2
  115. package/package.json +25 -24
  116. package/schema/connector-yaml.json +36 -4
  117. package/schema/dataconnect-yaml.json +4 -0
  118. package/schema/firebase-config.json +2 -8
  119. package/templates/_gitignore +3 -0
  120. package/templates/init/dataconnect/connector.yaml +11 -0
  121. package/templates/init/dataconnect/dataconnect.yaml +2 -1
  122. package/templates/init/dataconnect/mutations.gql +18 -13
  123. package/templates/init/dataconnect/queries.gql +34 -29
  124. package/templates/init/dataconnect/schema.gql +1 -1
  125. package/lib/extensions/billingMigrationHelper.js +0 -61
@@ -276,9 +276,6 @@
276
276
  {
277
277
  "additionalProperties": false,
278
278
  "properties": {
279
- "location": {
280
- "type": "string"
281
- },
282
279
  "postdeploy": {
283
280
  "anyOf": [
284
281
  {
@@ -310,7 +307,6 @@
310
307
  }
311
308
  },
312
309
  "required": [
313
- "location",
314
310
  "source"
315
311
  ],
316
312
  "type": "object"
@@ -319,9 +315,6 @@
319
315
  "items": {
320
316
  "additionalProperties": false,
321
317
  "properties": {
322
- "location": {
323
- "type": "string"
324
- },
325
318
  "postdeploy": {
326
319
  "anyOf": [
327
320
  {
@@ -353,7 +346,6 @@
353
346
  }
354
347
  },
355
348
  "required": [
356
- "location",
357
349
  "source"
358
350
  ],
359
351
  "type": "object"
@@ -726,6 +718,7 @@
726
718
  "nodejs16",
727
719
  "nodejs18",
728
720
  "nodejs20",
721
+ "nodejs22",
729
722
  "nodejs6",
730
723
  "nodejs8",
731
724
  "python310",
@@ -787,6 +780,7 @@
787
780
  "nodejs16",
788
781
  "nodejs18",
789
782
  "nodejs20",
783
+ "nodejs22",
790
784
  "nodejs6",
791
785
  "nodejs8",
792
786
  "python310",
@@ -64,3 +64,6 @@ node_modules/
64
64
 
65
65
  # dotenv environment variables file
66
66
  .env
67
+
68
+ # dataconnect generated files
69
+ .dataconnect
@@ -1,2 +1,13 @@
1
1
  connectorId: "__connectorId__"
2
2
  authMode: "PUBLIC"
3
+ ## ## Here's an example of how to add generated SDKs.
4
+ ## ## You'll need to replace the outputDirs with ones pointing to where you want the generated code in your app.
5
+ # generate:
6
+ # javascriptSdk:
7
+ # outputDir: <Path where you want the generated SDK to be written to, relative to this file>
8
+ # package: "@firebasegen/my-connector"
9
+ # packageJSONDir: < Optional. Path to your Javascript app's package.json>
10
+ # swiftSdk:
11
+ # outputDir: <Path where you want the generated SDK to be written to, relative to this file>
12
+ # kotlinSdk:
13
+ # outputDir: <Path where you want the generated SDK to be written to, relative to this file>
@@ -1,5 +1,6 @@
1
1
  specVersion: "v1alpha"
2
2
  serviceId: "__serviceId__"
3
+ location: "__location__"
3
4
  schema:
4
5
  source: "./schema"
5
6
  datasource:
@@ -7,4 +8,4 @@ schema:
7
8
  database: "__cloudSqlDatabase__"
8
9
  cloudSql:
9
10
  instanceId: "__cloudSqlInstanceId__"
10
- connectorDirs: ["./connector"]
11
+ connectorDirs: [__connectorIds__]
@@ -1,30 +1,35 @@
1
1
  # # Example mutations for a simple email app
2
2
 
3
- # mutation CreateUser($uid: String, $name: String, $address: String) @auth(level: NO_ACCESS) {
4
- ## <type>_insert lets you create a new row in your table.
3
+ # # Logged in user can create their own account.
4
+ # mutation CreateUser($name: String!, $address: String!) @auth(level: USER) {
5
+ # # <type>_insert lets you create a new row in your table.
5
6
  # user_insert(data: {
6
- # uid: $uid,
7
+ # # Server values let your service populate sensitive data.
8
+ # # Users can only setup their own account.
9
+ # uid_expr: "auth.uid",
7
10
  # name: $name,
8
11
  # address: $address
9
12
  # })
10
13
  # }
11
- # mutation CreateEmail($content: String, $subject: String, $fromUid: String) @auth(level: PUBLIC) {
14
+
15
+ # # Logged in user can send emails from their account.
16
+ # mutation CreateEmail($content: String, $subject: String) @auth(level: USER) {
12
17
  # email_insert(data: {
18
+ # # The request variable name doesn't have to match the field name.
13
19
  # text: $content,
14
20
  # subject: $subject,
15
- # fromUid: $fromUid,
16
- ## Server values let your service populate data for you
17
- ## Here, we use sent_date: { today: true } to set 'sent' to today's date.
21
+ # # Server values let your service populate sensitive data.
22
+ # # Users are only allowed to create emails sent from their account.
23
+ # fromUid_expr: "auth.uid",
24
+ # # Server values let your service populate data for you
25
+ # # Here, we use sent_date: { today: true } to set 'sent' to today's date.
18
26
  # sent_date: { today: true }
19
27
  # })
20
28
  # }
21
- # mutation CreateRecipient($emailId: UUID, $uid: String) @auth(level: PUBLIC) {
29
+
30
+ # mutation CreateRecipient($emailId: UUID) @auth(level: USER) {
22
31
  # recipient_insert(data: {
23
32
  # emailId: $emailId,
24
- # userUid: $uid
33
+ # userUid_expr: "auth.uid"
25
34
  # })
26
35
  # }
27
- # mutation DeleteEmail($emailId: UUID, $uid: String) @auth(level: PUBLIC) {
28
- ## <type>_ delete lets you delete rows from your table.
29
- # recipient_delete(key: {emailId: $emailId, userUid: $uid})
30
- # }
@@ -1,51 +1,56 @@
1
1
  # # Example queries for a simple email app.
2
2
 
3
- ## @auth() directives control who can call each operation.
4
- ## Only admins should be able to list all users, so we use NO_ACCESS
5
- # query ListUsers @auth(level: NO_ACCESS) {
6
- # users { uid, name, email: address }
3
+ # # @auth() directives control who can call each operation.
4
+ # # Only admins should be able to list all emails, so we use NO_ACCESS
5
+ # query ListEmails @auth(level: NO_ACCESS) {
6
+ # emails {
7
+ # id, subject, text, sent
8
+ # from {
9
+ # name
10
+ # }
11
+ # }
7
12
  # }
8
13
 
9
- ## Everyone should be able to see their inbox though, so we use PUBLIC
10
- # query ListInbox(
11
- # $uid: String
12
- # ) @auth(level: PUBLIC) {
13
- ## where allows you to filter lists
14
- ## Here, we use it to filter to only emails where this user is one of the recipients.
14
+ # # Only admins should be able to list all users, so we use NO_ACCESS
15
+ # query ListUsers @auth(level: NO_ACCESS) {
16
+ # users { uid, name, address }
17
+ # }
18
+
19
+ # # Logged in users should be able to see their inbox though, so we use USER
20
+ # query ListInbox @auth(level: USER) {
21
+ # # where allows you to filter lists
22
+ # # Here, we use it to filter to only emails that are sent to the logged in user.
15
23
  # emails(where: {
16
- # users_via_Recipient: {
17
- # exist: { uid: { eq: $uid }
24
+ # users_via_Recipient: {
25
+ # exist: { uid: { eq_expr: "auth.uid" }
18
26
  # }}
19
27
  # }) {
20
- # id subject sent
21
- # content: text
22
- # sender: from { name email: address uid }
23
-
24
- ## <field>_on_<foreign_key_field> makes it easy to grab info from another table
25
- ## Here, we use it to grab all the recipients of the email.
28
+ # id subject sent
29
+ # content: text # Select the `text` field but alias it as `content` in the response.
30
+ # sender: from { name address uid }
31
+ # # <field>_on_<foreign_key_field> makes it easy to grab info from another table
32
+ # # Here, we use it to grab all the recipients of the email.
26
33
  # to: recipients_on_email {
27
- # user { name email: address uid }
34
+ # user { name address uid }
28
35
  # }
29
36
  # }
30
37
  # }
31
38
 
32
39
  # query GetUidByEmail($emails: [String!]) @auth(level: PUBLIC) {
33
40
  # users(where: { address: { in: $emails } }) {
34
- # uid email: address
41
+ # uid address
35
42
  # }
36
43
  # }
37
44
 
38
- # query ListSent(
39
- # $uid: String
40
- # ) @auth(level: PUBLIC) {
41
- # emails(where: {
42
- # fromUid: { eq: $uid }
45
+ # query ListSent($uid: String) @auth(level: PUBLIC) {
46
+ # emails(where: {
47
+ # from: {uid: {eq: $uid }}
43
48
  # }) {
44
- # id subject sent
45
- # content: text
46
- # sender: from { name email: address uid }
49
+ # id subject sent
50
+ # content: text
51
+ # sender: from { name address uid }
47
52
  # to: recipients_on_email {
48
- # user { name email: address uid }
53
+ # user { name address uid }
49
54
  # }
50
55
  # }
51
56
  # }
@@ -1,4 +1,4 @@
1
- ## Example schema for simple email app
1
+ # # Example schema for simple email app
2
2
  # type User @table(key: "uid") {
3
3
  # uid: String!
4
4
  # name: String!
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.displayNode10CreateBillingNotice = exports.displayNode10UpdateBillingNotice = void 0;
4
- const marked_1 = require("marked");
5
- const TerminalRenderer = require("marked-terminal");
6
- const error_1 = require("../error");
7
- const extensionsHelper_1 = require("./extensionsHelper");
8
- const prompt_1 = require("../prompt");
9
- const utils = require("../utils");
10
- const utils_1 = require("./utils");
11
- marked_1.marked.setOptions({
12
- renderer: new TerminalRenderer(),
13
- });
14
- const urlPricingExamples = "https://cloud.google.com/functions/pricing#pricing_examples";
15
- const urlFAQ = "https://firebase.google.com/support/faq/#extensions-pricing";
16
- const billingMsgUpdate = "This update includes an upgrade to Node.js 10 from Node.js 8, which is no" +
17
- " longer maintained. Starting with this update, you will be charged a" +
18
- " small amount (typically around $0.01/month) for the Firebase resources" +
19
- " required by this extension (even if it is not used), in addition to any" +
20
- " charges associated with its usage.\n\n" +
21
- `See pricing examples: **[${urlPricingExamples}](${urlPricingExamples})**\n` +
22
- `See the FAQ: **[${urlFAQ}](${urlFAQ})**\n`;
23
- const billingMsgCreate = "You will be charged around $0.01/month for the Firebase resources" +
24
- " required by this extension (even if it is not used). Additionally," +
25
- " using this extension will contribute to your project's overall usage" +
26
- " level of Firebase services. However, you'll only be charged for usage" +
27
- " that exceeds Firebase's free tier for those services.\n\n" +
28
- `See pricing examples: **[${urlPricingExamples}](${urlPricingExamples})**\n` +
29
- `See the FAQ: **[${urlFAQ}](${urlFAQ})**\n`;
30
- const defaultSpecVersion = "v1beta";
31
- const defaultRuntimes = {
32
- v1beta: "nodejs8",
33
- };
34
- function hasRuntime(spec, runtime) {
35
- const specVersion = spec.specVersion || defaultSpecVersion;
36
- const defaultRuntime = defaultRuntimes[specVersion];
37
- const resources = spec.resources || [];
38
- return resources.some((r) => runtime === ((0, utils_1.getResourceRuntime)(r) || defaultRuntime));
39
- }
40
- function displayNode10UpdateBillingNotice(curSpec, newSpec) {
41
- if (hasRuntime(curSpec, "nodejs8") && hasRuntime(newSpec, "nodejs10")) {
42
- utils.logLabeledWarning(extensionsHelper_1.logPrefix, (0, marked_1.marked)(billingMsgUpdate));
43
- }
44
- }
45
- exports.displayNode10UpdateBillingNotice = displayNode10UpdateBillingNotice;
46
- async function displayNode10CreateBillingNotice(spec, prompt) {
47
- if (hasRuntime(spec, "nodejs10")) {
48
- utils.logLabeledWarning(extensionsHelper_1.logPrefix, (0, marked_1.marked)(billingMsgCreate));
49
- if (prompt) {
50
- const continueUpdate = await (0, prompt_1.promptOnce)({
51
- type: "confirm",
52
- message: "Do you wish to continue?",
53
- default: true,
54
- });
55
- if (!continueUpdate) {
56
- throw new error_1.FirebaseError(`Cancelled.`, { exit: 2 });
57
- }
58
- }
59
- }
60
- }
61
- exports.displayNode10CreateBillingNotice = displayNode10CreateBillingNotice;