firebase-tools-with-isolate 13.9.0 → 13.11.2

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 (35) hide show
  1. package/lib/commands/dataconnect-sdk-generate.js +15 -9
  2. package/lib/commands/dataconnect-services-list.js +1 -7
  3. package/lib/commands/dataconnect-sql-migrate.js +0 -1
  4. package/lib/crashlytics/buildToolsJarHelper.js +2 -1
  5. package/lib/dataconnect/build.js +1 -9
  6. package/lib/dataconnect/client.js +14 -22
  7. package/lib/dataconnect/errors.js +17 -9
  8. package/lib/dataconnect/graphqlError.js +6 -3
  9. package/lib/dataconnect/names.js +21 -1
  10. package/lib/dataconnect/provisionCloudSql.js +37 -20
  11. package/lib/dataconnect/schemaMigration.js +98 -66
  12. package/lib/deploy/dataconnect/deploy.js +1 -0
  13. package/lib/deploy/dataconnect/release.js +0 -1
  14. package/lib/deploy/functions/prepare.js +1 -1
  15. package/lib/deploy/functions/runtimes/discovery/index.js +2 -1
  16. package/lib/deploy/functions/runtimes/supported/types.js +6 -0
  17. package/lib/emulator/controller.js +4 -3
  18. package/lib/emulator/dataconnectEmulator.js +69 -27
  19. package/lib/emulator/download.js +4 -0
  20. package/lib/emulator/downloadableEmulators.js +51 -24
  21. package/lib/emulator/portUtils.js +11 -2
  22. package/lib/emulator/storage/rules/runtime.js +1 -1
  23. package/lib/frameworks/angular/utils.js +8 -3
  24. package/lib/frameworks/next/utils.js +0 -1
  25. package/lib/gcp/cloudsql/cloudsqladmin.js +15 -2
  26. package/lib/gcp/cloudsql/connect.js +6 -6
  27. package/lib/init/features/dataconnect/index.js +171 -109
  28. package/lib/rc.js +1 -3
  29. package/lib/requireAuth.js +3 -0
  30. package/lib/track.js +29 -2
  31. package/package.json +3 -3
  32. package/schema/firebase-config.json +2 -0
  33. package/templates/init/dataconnect/dataconnect.yaml +1 -1
  34. package/templates/init/dataconnect/mutations.gql +1 -1
  35. package/templates/init/dataconnect/queries.gql +6 -6
@@ -10,6 +10,8 @@ const cloudsql = require("../../../gcp/cloudsql/cloudsqladmin");
10
10
  const ensureApis_1 = require("../../../dataconnect/ensureApis");
11
11
  const client_1 = require("../../../dataconnect/client");
12
12
  const emulators_1 = require("../emulators");
13
+ const names_1 = require("../../../dataconnect/names");
14
+ const logger_1 = require("../../../logger");
13
15
  const TEMPLATE_ROOT = (0, path_1.resolve)(__dirname, "../../../../templates/init/dataconnect/");
14
16
  const DATACONNECT_YAML_TEMPLATE = (0, fs_1.readFileSync)((0, path_1.join)(TEMPLATE_ROOT, "dataconnect.yaml"), "utf8");
15
17
  const CONNECTOR_YAML_TEMPLATE = (0, fs_1.readFileSync)((0, path_1.join)(TEMPLATE_ROOT, "connector.yaml"), "utf8");
@@ -17,97 +19,21 @@ const SCHEMA_TEMPLATE = (0, fs_1.readFileSync)((0, path_1.join)(TEMPLATE_ROOT, "
17
19
  const QUERIES_TEMPLATE = (0, fs_1.readFileSync)((0, path_1.join)(TEMPLATE_ROOT, "queries.gql"), "utf8");
18
20
  const MUTATIONS_TEMPLATE = (0, fs_1.readFileSync)((0, path_1.join)(TEMPLATE_ROOT, "mutations.gql"), "utf8");
19
21
  async function doSetup(setup, config) {
20
- if (setup.projectId) {
21
- await (0, ensureApis_1.ensureApis)(setup.projectId);
22
- }
23
- const serviceId = await (0, prompt_1.promptOnce)({
24
- message: "What ID would you like to use for this service?",
25
- type: "input",
26
- default: "dataconnect",
27
- });
28
- const connectorId = await (0, prompt_1.promptOnce)({
29
- message: "What ID would you like to use for your connector?",
30
- type: "input",
31
- default: "my-connector",
32
- });
33
- let cloudSqlInstanceId = "";
34
- let newInstance = false;
35
- let locationId = "";
36
- if (setup.projectId) {
37
- const instances = await cloudsql.listInstances(setup.projectId);
38
- const choices = instances.map((i) => {
39
- return { name: i.name, value: i.name, location: i.region };
40
- });
41
- const freeTrialInstanceId = await (0, freeTrial_1.checkForFreeTrialInstance)(setup.projectId);
42
- if (!freeTrialInstanceId) {
43
- choices.push({ name: "Create a new instance", value: "", location: "" });
44
- }
45
- if (instances.length) {
46
- cloudSqlInstanceId = await (0, prompt_1.promptOnce)({
47
- message: `Which CloudSSQL instance would you like to use?`,
48
- type: "list",
49
- choices,
50
- });
51
- }
52
- locationId = choices.find((c) => c.value === cloudSqlInstanceId).location;
53
- }
54
- if (cloudSqlInstanceId === "") {
55
- let locationOptions = [
56
- { name: "us-central1", value: "us-central1" },
57
- { name: "europe-north1", value: "europe-north1" },
58
- { name: "europe-central2", value: "europe-central2" },
59
- { name: "europe-west1", value: "europe-west1" },
60
- { name: "southamerica-west1", value: "southamerica-west1" },
61
- { name: "us-east4", value: "us-east4" },
62
- { name: "us-west1", value: "us-west1" },
63
- { name: "asia-southeast1", value: "asia-southeast1" },
64
- ];
65
- if (setup.projectId) {
66
- const locations = await (0, client_1.listLocations)(setup.projectId);
67
- locationOptions = locations.map((l) => {
68
- return { name: l, value: l };
69
- });
70
- }
71
- newInstance = true;
72
- cloudSqlInstanceId = await (0, prompt_1.promptOnce)({
73
- message: `What ID would you like to use for your new CloudSQL instance?`,
74
- type: "input",
75
- default: `dataconnect-test`,
76
- });
77
- locationId = await (0, prompt_1.promptOnce)({
78
- message: "What location would you use for this instance?",
79
- type: "list",
80
- choices: locationOptions,
81
- });
82
- }
83
- const dir = config.get("dataconnect.source") || "dataconnect";
84
- if (!config.has("dataconnect")) {
85
- config.set("dataconnect.source", dir);
86
- config.set("dataconnect.location", locationId);
87
- }
88
- let cloudSqlDatabase = "";
89
- let newDB = false;
90
- if (!newInstance && setup.projectId) {
91
- const dbs = await cloudsql.listDatabases(setup.projectId, cloudSqlInstanceId);
92
- const choices = dbs.map((d) => {
93
- return { name: d.name, value: d.name };
94
- });
95
- choices.push({ name: "Create a new database", value: "" });
96
- if (dbs.length) {
97
- cloudSqlDatabase = await (0, prompt_1.promptOnce)({
98
- message: `Which database in ${cloudSqlInstanceId} would you like to use?`,
99
- type: "list",
100
- choices,
101
- });
102
- }
22
+ let info = {
23
+ serviceId: "",
24
+ locationId: "",
25
+ cloudSqlInstanceId: "",
26
+ isNewInstance: false,
27
+ cloudSqlDatabase: "",
28
+ isNewDatabase: false,
29
+ connectorId: "default-connector",
30
+ };
31
+ info = await promptForService(setup, info);
32
+ if (info.cloudSqlInstanceId === "") {
33
+ info = await promptForCloudSQLInstance(setup, info);
103
34
  }
104
- if (cloudSqlDatabase === "") {
105
- newDB = true;
106
- cloudSqlDatabase = await (0, prompt_1.promptOnce)({
107
- message: `What ID would you like to use for your new database in ${cloudSqlInstanceId}?`,
108
- type: "input",
109
- default: `dataconnect`,
110
- });
35
+ if (info.cloudSqlDatabase === "") {
36
+ info = await promptForDatabase(setup, config, info);
111
37
  }
112
38
  const defaultConnectionString = setup.rcfile.dataconnectEmulatorConfig?.postgres?.localConnectionString ??
113
39
  emulators_1.DEFAULT_POSTGRES_CONNECTION;
@@ -118,35 +44,31 @@ async function doSetup(setup, config) {
118
44
  default: defaultConnectionString,
119
45
  });
120
46
  setup.rcfile.dataconnectEmulatorConfig = { postgres: { localConnectionString } };
121
- const subbedDataconnectYaml = subValues(DATACONNECT_YAML_TEMPLATE, {
122
- serviceId,
123
- cloudSqlInstanceId,
124
- cloudSqlDatabase,
125
- connectorId,
126
- });
127
- const subbedConnectorYaml = subValues(CONNECTOR_YAML_TEMPLATE, {
128
- serviceId,
129
- cloudSqlInstanceId,
130
- cloudSqlDatabase,
131
- connectorId,
132
- });
47
+ const dir = config.get("dataconnect.source") || "dataconnect";
48
+ const subbedDataconnectYaml = subValues(DATACONNECT_YAML_TEMPLATE, info);
49
+ const subbedConnectorYaml = subValues(CONNECTOR_YAML_TEMPLATE, info);
50
+ if (!config.has("dataconnect")) {
51
+ config.set("dataconnect.source", dir);
52
+ config.set("dataconnect.location", info.locationId);
53
+ }
133
54
  await config.askWriteProjectFile((0, path_1.join)(dir, "dataconnect.yaml"), subbedDataconnectYaml);
134
- await config.askWriteProjectFile((0, path_1.join)(dir, "connector", "connector.yaml"), subbedConnectorYaml);
135
55
  await config.askWriteProjectFile((0, path_1.join)(dir, "schema", "schema.gql"), SCHEMA_TEMPLATE);
136
- await config.askWriteProjectFile((0, path_1.join)(dir, "connector", "queries.gql"), QUERIES_TEMPLATE);
137
- await config.askWriteProjectFile((0, path_1.join)(dir, "connector", "mutations.gql"), MUTATIONS_TEMPLATE);
56
+ await config.askWriteProjectFile((0, path_1.join)(dir, info.connectorId, "connector.yaml"), subbedConnectorYaml);
57
+ await config.askWriteProjectFile((0, path_1.join)(dir, info.connectorId, "queries.gql"), QUERIES_TEMPLATE);
58
+ await config.askWriteProjectFile((0, path_1.join)(dir, info.connectorId, "mutations.gql"), MUTATIONS_TEMPLATE);
138
59
  if (setup.projectId &&
139
- (newInstance || newDB) &&
60
+ (info.isNewInstance || info.isNewDatabase) &&
140
61
  (await (0, prompt_1.confirm)({
141
62
  message: "Would you like to provision your CloudSQL instance and database now? This will take a few minutes.",
142
63
  default: true,
143
64
  }))) {
144
65
  await (0, provisionCloudSql_1.provisionCloudSql)({
145
66
  projectId: setup.projectId,
146
- locationId,
147
- instanceId: cloudSqlInstanceId,
148
- databaseId: cloudSqlDatabase,
67
+ locationId: info.locationId,
68
+ instanceId: info.cloudSqlInstanceId,
69
+ databaseId: info.cloudSqlDatabase,
149
70
  enableGoogleMlIntegration: false,
71
+ waitForCreation: false,
150
72
  });
151
73
  }
152
74
  }
@@ -164,3 +86,143 @@ function subValues(template, replacementValues) {
164
86
  }
165
87
  return replaced;
166
88
  }
89
+ async function promptForService(setup, info) {
90
+ if (setup.projectId) {
91
+ await (0, ensureApis_1.ensureApis)(setup.projectId);
92
+ const existingServices = await (0, client_1.listAllServices)(setup.projectId);
93
+ const existingServicesAndSchemas = await Promise.all(existingServices.map(async (s) => {
94
+ return {
95
+ service: s,
96
+ schema: await (0, client_1.getSchema)(s.name),
97
+ };
98
+ }));
99
+ const existingFreshServicesAndSchemas = existingServicesAndSchemas.filter((s) => {
100
+ return !s.schema?.source.files?.length;
101
+ });
102
+ if (existingFreshServicesAndSchemas.length) {
103
+ const choices = existingFreshServicesAndSchemas.map((s) => {
104
+ const serviceName = (0, names_1.parseServiceName)(s.service.name);
105
+ return {
106
+ name: `${serviceName.location}/${serviceName.serviceId}`,
107
+ value: s,
108
+ };
109
+ });
110
+ choices.push({ name: "Create a new service", value: undefined });
111
+ const choice = await (0, prompt_1.promptOnce)({
112
+ message: "Your project already has existing services. Which would you like to set up local files for?",
113
+ type: "list",
114
+ choices,
115
+ });
116
+ if (choice) {
117
+ const serviceName = (0, names_1.parseServiceName)(choice.service.name);
118
+ info.serviceId = serviceName.serviceId;
119
+ info.locationId = serviceName.location;
120
+ if (choice.schema) {
121
+ if (choice.schema.primaryDatasource.postgresql?.cloudSql.instance) {
122
+ const instanceName = (0, names_1.parseCloudSQLInstanceName)(choice.schema.primaryDatasource.postgresql?.cloudSql.instance);
123
+ info.cloudSqlInstanceId = instanceName.instanceId;
124
+ }
125
+ info.cloudSqlDatabase = choice.schema.primaryDatasource.postgresql?.database ?? "";
126
+ }
127
+ }
128
+ }
129
+ }
130
+ if (info.serviceId === "") {
131
+ info.serviceId = await (0, prompt_1.promptOnce)({
132
+ message: "What ID would you like to use for this service?",
133
+ type: "input",
134
+ default: "my-service",
135
+ });
136
+ }
137
+ return info;
138
+ }
139
+ async function promptForCloudSQLInstance(setup, info) {
140
+ if (setup.projectId) {
141
+ const instances = await cloudsql.listInstances(setup.projectId);
142
+ let choices = instances.map((i) => {
143
+ return { name: i.name, value: i.name, location: i.region };
144
+ });
145
+ choices = choices.filter((c) => info.locationId === "" || info.locationId === c.location);
146
+ if (choices.length) {
147
+ const freeTrialInstanceId = await (0, freeTrial_1.checkForFreeTrialInstance)(setup.projectId);
148
+ if (!freeTrialInstanceId) {
149
+ choices.push({ name: "Create a new instance", value: "", location: "" });
150
+ }
151
+ info.cloudSqlInstanceId = await (0, prompt_1.promptOnce)({
152
+ message: `Which CloudSQL instance would you like to use?`,
153
+ type: "list",
154
+ choices,
155
+ });
156
+ if (info.cloudSqlInstanceId !== "") {
157
+ info.locationId = choices.find((c) => c.value === info.cloudSqlInstanceId).location;
158
+ }
159
+ }
160
+ }
161
+ if (info.cloudSqlInstanceId === "") {
162
+ info.isNewInstance = true;
163
+ info.cloudSqlInstanceId = await (0, prompt_1.promptOnce)({
164
+ message: `What ID would you like to use for your new CloudSQL instance?`,
165
+ type: "input",
166
+ default: `fdc-sql`,
167
+ });
168
+ }
169
+ if (info.locationId === "") {
170
+ const choices = await locationChoices(setup);
171
+ info.locationId = await (0, prompt_1.promptOnce)({
172
+ message: "What location would like to use?",
173
+ type: "list",
174
+ choices,
175
+ });
176
+ }
177
+ return info;
178
+ }
179
+ async function locationChoices(setup) {
180
+ if (setup.projectId) {
181
+ const locations = await (0, client_1.listLocations)(setup.projectId);
182
+ return locations.map((l) => {
183
+ return { name: l, value: l };
184
+ });
185
+ }
186
+ else {
187
+ return [
188
+ { name: "us-central1", value: "us-central1" },
189
+ { name: "europe-north1", value: "europe-north1" },
190
+ { name: "europe-central2", value: "europe-central2" },
191
+ { name: "europe-west1", value: "europe-west1" },
192
+ { name: "southamerica-west1", value: "southamerica-west1" },
193
+ { name: "us-east4", value: "us-east4" },
194
+ { name: "us-west1", value: "us-west1" },
195
+ { name: "asia-southeast1", value: "asia-southeast1" },
196
+ ];
197
+ }
198
+ }
199
+ async function promptForDatabase(setup, config, info) {
200
+ if (!info.isNewInstance && setup.projectId) {
201
+ try {
202
+ const dbs = await cloudsql.listDatabases(setup.projectId, info.cloudSqlInstanceId);
203
+ const choices = dbs.map((d) => {
204
+ return { name: d.name, value: d.name };
205
+ });
206
+ choices.push({ name: "Create a new database", value: "" });
207
+ if (dbs.length) {
208
+ info.cloudSqlDatabase = await (0, prompt_1.promptOnce)({
209
+ message: `Which database in ${info.cloudSqlInstanceId} would you like to use?`,
210
+ type: "list",
211
+ choices,
212
+ });
213
+ }
214
+ }
215
+ catch (err) {
216
+ logger_1.logger.debug(`[dataconnect] Cannot list databases during init: ${err}`);
217
+ }
218
+ }
219
+ if (info.cloudSqlDatabase === "") {
220
+ info.isNewDatabase = true;
221
+ info.cloudSqlDatabase = await (0, prompt_1.promptOnce)({
222
+ message: `What ID would you like to use for your new database in ${info.cloudSqlInstanceId}?`,
223
+ type: "input",
224
+ default: `fdcdb`,
225
+ });
226
+ }
227
+ return info;
228
+ }
package/lib/rc.js CHANGED
@@ -154,9 +154,7 @@ class RC {
154
154
  return this.data.dataconnectEmulatorConfig ?? {};
155
155
  }
156
156
  setDataconnect(localConnectionString) {
157
- if (!this.data.dataconnectEmulatorConfig) {
158
- this.data.dataconnectEmulatorConfig = { postgres: { localConnectionString } };
159
- }
157
+ this.data.dataconnectEmulatorConfig = { postgres: { localConnectionString } };
160
158
  }
161
159
  save() {
162
160
  if (this.path) {
@@ -20,6 +20,9 @@ function getAuthClient(config) {
20
20
  return authClient;
21
21
  }
22
22
  async function autoAuth(options, authScopes) {
23
+ if (process.env.MONOSPACE_ENV) {
24
+ throw new error_1.FirebaseError("autoAuth not yet implemented for IDX. Please run 'firebase login'");
25
+ }
23
26
  const client = getAuthClient({ scopes: authScopes, projectId: options.project });
24
27
  const token = await client.getAccessToken();
25
28
  token !== null ? apiv2.setAccessToken(token) : false;
package/lib/track.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.track = exports.cliSession = exports.emulatorSession = exports.trackEmulator = exports.trackGA4 = exports.usageEnabled = exports.GA4_PROPERTIES = void 0;
3
+ exports.track = exports.cliSession = exports.vscodeSession = exports.emulatorSession = exports.trackVSCode = exports.trackEmulator = exports.trackGA4 = exports.usageEnabled = exports.GA4_PROPERTIES = void 0;
4
4
  const node_fetch_1 = require("node-fetch");
5
5
  const ua = require("universal-analytics");
6
6
  const uuid_1 = require("uuid");
@@ -19,6 +19,11 @@ exports.GA4_PROPERTIES = {
19
19
  apiSecret: process.env.FIREBASE_EMULATOR_GA4_API_SECRET || "2V_zBYc4TdeoppzDaIu0zw",
20
20
  clientIdKey: "emulator-analytics-clientId",
21
21
  },
22
+ vscode: {
23
+ measurementId: process.env.FIREBASE_VSCODE_GA4_MEASUREMENT_ID || "G-FYJ489XM2T",
24
+ apiSecret: process.env.FIREBASE_VSCODE_GA4_API_SECRET || "XAEWKHe7RM-ygCK44N52Ww",
25
+ clientIdKey: "vscode-analytics-clientId",
26
+ },
22
27
  };
23
28
  function usageEnabled() {
24
29
  return !!process.env.IS_FIREBASE_CLI && !!configstore_1.configstore.get("usage");
@@ -69,6 +74,24 @@ async function trackEmulator(eventName, params) {
69
74
  });
70
75
  }
71
76
  exports.trackEmulator = trackEmulator;
77
+ async function trackVSCode(eventName, params) {
78
+ const session = vscodeSession();
79
+ if (!session) {
80
+ return;
81
+ }
82
+ session.debugMode = process.env.VSCODE_DEBUG_MODE === "true";
83
+ const oldTotalEngagementSeconds = session.totalEngagementSeconds;
84
+ session.totalEngagementSeconds = process.uptime();
85
+ const duration = session.totalEngagementSeconds - oldTotalEngagementSeconds;
86
+ return _ga4Track({
87
+ session,
88
+ apiSecret: exports.GA4_PROPERTIES.vscode.apiSecret,
89
+ eventName,
90
+ params,
91
+ duration,
92
+ });
93
+ }
94
+ exports.trackVSCode = trackVSCode;
72
95
  async function _ga4Track(args) {
73
96
  const { session, apiSecret, eventName, params, duration } = args;
74
97
  session.commandName = params?.command_name || session.commandName;
@@ -128,13 +151,17 @@ function emulatorSession() {
128
151
  return session("emulator");
129
152
  }
130
153
  exports.emulatorSession = emulatorSession;
154
+ function vscodeSession() {
155
+ return session("vscode");
156
+ }
157
+ exports.vscodeSession = vscodeSession;
131
158
  function cliSession() {
132
159
  return session("cli");
133
160
  }
134
161
  exports.cliSession = cliSession;
135
162
  function session(propertyName) {
136
163
  const validateOnly = !!process.env.FIREBASE_CLI_MP_VALIDATE;
137
- if (!usageEnabled()) {
164
+ if (!usageEnabled() && propertyName !== "vscode") {
138
165
  if (validateOnly) {
139
166
  logger_1.logger.warn("Google Analytics is DISABLED. To enable, (re)login and opt in to collection.");
140
167
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "firebase-tools-with-isolate",
3
- "version": "13.9.0",
4
3
  "description": "Command-Line Interface for Firebase with monorepo support",
4
+ "version": "13.11.2",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
7
7
  "firebase": "lib/bin/firebase.js"
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "dependencies": {
97
97
  "@google-cloud/cloud-sql-connector": "^1.2.3",
98
- "@google-cloud/pubsub": "^3.0.1",
98
+ "@google-cloud/pubsub": "^4.4.0",
99
99
  "abort-controller": "^3.0.0",
100
100
  "ajv": "^6.12.6",
101
101
  "archiver": "^5.0.0",
@@ -124,7 +124,7 @@
124
124
  "google-auth-library": "^9.7.0",
125
125
  "inquirer": "^8.2.6",
126
126
  "inquirer-autocomplete-prompt": "^2.0.1",
127
- "isolate-package": "^1.16.0",
127
+ "isolate-package": "^1.18.0",
128
128
  "jsonwebtoken": "^9.0.0",
129
129
  "leven": "^3.1.0",
130
130
  "libsodium-wrappers": "^0.7.10",
@@ -726,6 +726,7 @@
726
726
  "nodejs16",
727
727
  "nodejs18",
728
728
  "nodejs20",
729
+ "nodejs22",
729
730
  "nodejs6",
730
731
  "nodejs8",
731
732
  "python310",
@@ -787,6 +788,7 @@
787
788
  "nodejs16",
788
789
  "nodejs18",
789
790
  "nodejs20",
791
+ "nodejs22",
790
792
  "nodejs6",
791
793
  "nodejs8",
792
794
  "python310",
@@ -7,4 +7,4 @@ schema:
7
7
  database: "__cloudSqlDatabase__"
8
8
  cloudSql:
9
9
  instanceId: "__cloudSqlInstanceId__"
10
- connectorDirs: ["./connector"]
10
+ connectorDirs: ["./__connectorId__"]
@@ -10,7 +10,7 @@
10
10
  # }
11
11
  # mutation CreateEmail($content: String, $subject: String, $fromUid: String) @auth(level: PUBLIC) {
12
12
  # email_insert(data: {
13
- # text: $content,
13
+ # text: $content, # The request variable name doesn't have to match the field name.
14
14
  # subject: $subject,
15
15
  # fromUid: $fromUid,
16
16
  ## Server values let your service populate data for you
@@ -13,12 +13,12 @@
13
13
  ## where allows you to filter lists
14
14
  ## Here, we use it to filter to only emails where this user is one of the recipients.
15
15
  # emails(where: {
16
- # users_via_Recipient: {
16
+ # users_via_Recipient: {
17
17
  # exist: { uid: { eq: $uid }
18
18
  # }}
19
19
  # }) {
20
- # id subject sent
21
- # content: text
20
+ # id subject sent
21
+ # content: text # Select the `text` field but alias it as `content` in the response.
22
22
  # sender: from { name email: address uid }
23
23
 
24
24
  ## <field>_on_<foreign_key_field> makes it easy to grab info from another table
@@ -38,11 +38,11 @@
38
38
  # query ListSent(
39
39
  # $uid: String
40
40
  # ) @auth(level: PUBLIC) {
41
- # emails(where: {
41
+ # emails(where: {
42
42
  # fromUid: { eq: $uid }
43
43
  # }) {
44
- # id subject sent
45
- # content: text
44
+ # id subject sent
45
+ # content: text
46
46
  # sender: from { name email: address uid }
47
47
  # to: recipients_on_email {
48
48
  # user { name email: address uid }