firebase-tools 15.14.0 → 15.15.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 +2 -6
- package/lib/command.js +23 -29
- package/lib/commands/dataconnect-compile.js +6 -6
- package/lib/commands/dataconnect-execute.js +1 -1
- package/lib/commands/dataconnect-sdk-generate.js +3 -3
- package/lib/commands/dataconnect-services-list.js +1 -1
- package/lib/commands/dataconnect-sql-diff.js +3 -3
- package/lib/commands/dataconnect-sql-grant.js +2 -2
- package/lib/commands/dataconnect-sql-migrate.js +4 -4
- package/lib/commands/dataconnect-sql-setup.js +2 -2
- package/lib/commands/dataconnect-sql-shell.js +4 -4
- package/lib/commands/ext-dev-usage.js +0 -2
- package/lib/commands/init.js +3 -3
- package/lib/commands/open.js +1 -1
- package/lib/commands/setup-emulators-dataconnect.js +1 -1
- package/lib/dataconnect/freeTrial.js +2 -2
- package/lib/dataconnect/load.js +2 -2
- package/lib/dataconnect/provisionCloudSql.js +3 -3
- package/lib/dataconnect/schemaMigration.js +11 -11
- package/lib/dataconnect/webhook.js +1 -1
- package/lib/deploy/functions/backend.js +1 -1
- package/lib/deploy/functions/build.js +3 -3
- package/lib/deploy/functions/deploy.js +5 -2
- package/lib/deploy/functions/prepare.js +53 -0
- package/lib/deploy/functions/release/fabricator.js +59 -46
- package/lib/deploy/functions/release/planner.js +1 -1
- package/lib/deploy/functions/runtimes/dart/index.js +3 -1
- package/lib/deploy/functions/runtimes/dart/triggerSupport.js +123 -0
- package/lib/deploy/functions/runtimes/index.js +1 -4
- package/lib/deploy/functions/services/ailogic.js +12 -1
- package/lib/deploy/functions/services/dataconnect.js +1 -1
- package/lib/emulator/constants.js +1 -1
- package/lib/emulator/controller.js +2 -2
- package/lib/emulator/dataconnectEmulator.js +14 -14
- package/lib/emulator/dataconnectToolkitController.js +2 -2
- package/lib/emulator/downloadableEmulatorInfo.json +31 -31
- package/lib/emulator/extensionsEmulator.js +1 -2
- package/lib/emulator/functionsEmulator.js +15 -0
- package/lib/emulator/hub.js +3 -3
- package/lib/emulator/hubExport.js +2 -2
- package/lib/emulator/initEmulators.js +1 -1
- package/lib/experiments.js +10 -5
- package/lib/gcp/ailogic.js +6 -3
- package/lib/gcp/runv2.js +9 -2
- package/lib/init/features/dataconnect/index.js +7 -7
- package/lib/init/features/dataconnect/resolver.js +2 -2
- package/lib/init/features/dataconnect/sdk.js +8 -8
- package/lib/init/features/functions/index.js +1 -1
- package/lib/mcp/index.js +0 -1
- package/lib/mcp/prompts/dataconnect/schema.js +6 -6
- package/lib/mcp/resources/guides/init_data_connect.js +2 -2
- package/lib/mcp/resources/guides/init_firestore.js +1 -1
- package/lib/mcp/tools/core/init.js +9 -9
- package/lib/mcp/tools/dataconnect/compile.js +5 -5
- package/lib/mcp/tools/dataconnect/execute.js +6 -6
- package/lib/mcp/tools/dataconnect/list_services.js +7 -7
- package/lib/mcp/util/dataconnect/content.js +19 -19
- package/lib/tsconfig.compile.tsbuildinfo +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +16 -4
- package/templates/init/functions/dart/pubspec.yaml +6 -7
- package/templates/init/functions/dart/server.dart +3 -1
- package/lib/shortenUrl.js +0 -28
|
@@ -4,7 +4,7 @@ exports.BUILTIN_SDL = exports.MAIN_INSTRUCTIONS = void 0;
|
|
|
4
4
|
exports.MAIN_INSTRUCTIONS = `
|
|
5
5
|
Closely follow the following instructions:
|
|
6
6
|
|
|
7
|
-
You are Firebase
|
|
7
|
+
You are Firebase SQL Connect expert that is responsible for creating data connect schemas code in GraphQL for users.You will be given a description of the desired schema using Firebase SQL Connect and your task is to write the schema code in GraphQL that fulfills the requirements and correct any mistakes in your generation.
|
|
8
8
|
|
|
9
9
|
For example, if I were to ask for a schema for a GraphQL database that contains a table called "users" with a field called "name" and another table called "posts" with a field called "body", I would get the following schema:
|
|
10
10
|
\`\`\`
|
|
@@ -18,7 +18,7 @@ type Post @table {
|
|
|
18
18
|
}
|
|
19
19
|
\`\`\`
|
|
20
20
|
|
|
21
|
-
Simple Firebase
|
|
21
|
+
Simple Firebase SQL Connect schema often takes the following form:
|
|
22
22
|
\`\`\`graphql
|
|
23
23
|
type TableName @table {
|
|
24
24
|
uuidField: UUID
|
|
@@ -43,7 +43,7 @@ type TableName @table {
|
|
|
43
43
|
|
|
44
44
|
Leave out objects named after \`Query\` and \`Mutation\`
|
|
45
45
|
|
|
46
|
-
Firebase
|
|
46
|
+
Firebase SQL Connect implicitly adds \`id: UUID!\` to every table and implicitly makes it primary key. Therefore, leave out the \`id\` field.
|
|
47
47
|
|
|
48
48
|
Use \`UUID\` type instead of \`ID\` type or \`String\` type for id-like fields.
|
|
49
49
|
|
|
@@ -87,19 +87,19 @@ Leave out \`directive\`, \`enum\` and \`scalar\`.
|
|
|
87
87
|
|
|
88
88
|
Leave out \`@view\`.
|
|
89
89
|
|
|
90
|
-
Be sure that your response contains a valid Firebase
|
|
90
|
+
Be sure that your response contains a valid Firebase SQL Connect schema in a single GraphQL code block inside of triple backticks and closely follows my instructions and description.
|
|
91
91
|
`.trim();
|
|
92
92
|
exports.BUILTIN_SDL = `
|
|
93
93
|
# Directives
|
|
94
94
|
|
|
95
95
|
Directives define specific behaviors that can be applied to fields or types within a GraphQL schema.
|
|
96
96
|
|
|
97
|
-
##
|
|
97
|
+
## SQL Connect Defined
|
|
98
98
|
|
|
99
99
|
### @col on \`FIELD_DEFINITION\` {:#col}
|
|
100
100
|
Customizes a field that represents a SQL database table column.
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
SQL Connect maps scalar Fields on [\`@table\`](directive.md#table) type to a SQL column of
|
|
103
103
|
corresponding data type.
|
|
104
104
|
|
|
105
105
|
- scalar [\`UUID\`](scalar.md#UUID) maps to [\`uuid\`](https://www.postgresql.org/docs/current/datatype-uuid.html).
|
|
@@ -125,7 +125,7 @@ type Post @table {
|
|
|
125
125
|
}
|
|
126
126
|
\`\`\`
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
SQL Connect converts it to the following SQL table schema.
|
|
129
129
|
|
|
130
130
|
\`\`\`sql
|
|
131
131
|
CREATE TABLE "public"."post" (
|
|
@@ -199,7 +199,7 @@ filter and order requirement.
|
|
|
199
199
|
|
|
200
200
|
| Argument | Type | Description |
|
|
201
201
|
|---|---|---|
|
|
202
|
-
| \`name\` | [\`String\`](scalar.md#String) | Configure the SQL database index id. If not overridden,
|
|
202
|
+
| \`name\` | [\`String\`](scalar.md#String) | Configure the SQL database index id. If not overridden, SQL Connect generates the index name: - \`{table_name}_{first_field}_{second_field}_aa_idx\` - \`{table_name}_{field_name}_idx\` |
|
|
203
203
|
| \`fields\` | [\`[String!]\`](scalar.md#String) | Only allowed and required when used on a [\`@table\`](directive.md#table) type. Specifies the fields to create the index on. |
|
|
204
204
|
| \`order\` | [\`[IndexFieldOrder!]\`](enum.md#IndexFieldOrder) | Only allowed for \`BTREE\` [\`@index\`](directive.md#index) on [\`@table\`](directive.md#table) type. Specifies the order for each indexed column. Defaults to all \`ASC\`. |
|
|
205
205
|
| \`type\` | [\`IndexType\`](enum.md#IndexType) | Customize the index type. For most index, it defaults to \`BTREE\`. For array fields, only allowed [\`IndexType\`](enum.md#IndexType) is \`GIN\`. For [\`Vector\`](scalar.md#Vector) fields, defaults to \`HNSW\`, may configure to \`IVFFLAT\`. |
|
|
@@ -218,7 +218,7 @@ type OneTable @table {
|
|
|
218
218
|
someField: String!
|
|
219
219
|
}
|
|
220
220
|
\`\`\`
|
|
221
|
-
|
|
221
|
+
SQL Connect adds implicit foreign key column and relation query field. So the
|
|
222
222
|
above schema is equivalent to the following schema.
|
|
223
223
|
|
|
224
224
|
\`\`\`graphql
|
|
@@ -234,7 +234,7 @@ type OneTable @table {
|
|
|
234
234
|
# manyTables_on_refField: [ManyTable!]!
|
|
235
235
|
}
|
|
236
236
|
\`\`\`
|
|
237
|
-
|
|
237
|
+
SQL Connect generates the necessary foreign key constraint.
|
|
238
238
|
|
|
239
239
|
\`\`\`sql
|
|
240
240
|
CREATE TABLE "public"."many_table" (
|
|
@@ -314,7 +314,7 @@ type Group @table { name: String! }
|
|
|
314
314
|
type User @table { name: String! }
|
|
315
315
|
\`\`\`
|
|
316
316
|
|
|
317
|
-
When
|
|
317
|
+
When SQL Connect sees a table with two reference field as its primary key, it
|
|
318
318
|
knows this is a join table, so expands the many-to-many query field.
|
|
319
319
|
|
|
320
320
|
\`\`\`graphql
|
|
@@ -418,7 +418,7 @@ type TableName @table {
|
|
|
418
418
|
myField: String
|
|
419
419
|
}
|
|
420
420
|
\`\`\`
|
|
421
|
-
|
|
421
|
+
SQL Connect adds an implicit \`id\` primary key column. So the above schema is equivalent to:
|
|
422
422
|
|
|
423
423
|
\`\`\`graphql
|
|
424
424
|
type TableName @table(key: "id") {
|
|
@@ -427,7 +427,7 @@ type TableName @table(key: "id") {
|
|
|
427
427
|
}
|
|
428
428
|
\`\`\`
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
SQL Connect generates the following SQL table and CRUD operations to use it.
|
|
431
431
|
|
|
432
432
|
\`\`\`sql
|
|
433
433
|
CREATE TABLE "public"."table_name" (
|
|
@@ -475,7 +475,7 @@ type User @table(key: "uid") {
|
|
|
475
475
|
| \`name\` | [\`String\`](scalar.md#String) | Configures the SQL database table name. Defaults to snake_case like \`table_name\`. |
|
|
476
476
|
| \`singular\` | [\`String\`](scalar.md#String) | Configures the singular name. Defaults to the camelCase like \`tableName\`. |
|
|
477
477
|
| \`plural\` | [\`String\`](scalar.md#String) | Configures the plural name. Defaults to infer based on English plural pattern like \`tableNames\`. |
|
|
478
|
-
| \`key\` | [\`[String!]\`](scalar.md#String) | Defines the primary key of the table. Defaults to a single field named \`id\`. If not present already,
|
|
478
|
+
| \`key\` | [\`[String!]\`](scalar.md#String) | Defines the primary key of the table. Defaults to a single field named \`id\`. If not present already, SQL Connect adds an implicit field \`id: UUID! @default(expr: "uuidV4()")\`. |
|
|
479
479
|
|
|
480
480
|
### @unique on \`FIELD_DEFINITION\` | \`OBJECT\` {:#unique}
|
|
481
481
|
Defines unique constraints on [\`@table\`](directive.md#table).
|
|
@@ -502,16 +502,16 @@ type may define \`@ref(references)\` to refer to fields that has a unique constr
|
|
|
502
502
|
|
|
503
503
|
| Argument | Type | Description |
|
|
504
504
|
|---|---|---|
|
|
505
|
-
| \`indexName\` | [\`String\`](scalar.md#String) | Configures the SQL database unique constraint name. If not overridden,
|
|
505
|
+
| \`indexName\` | [\`String\`](scalar.md#String) | Configures the SQL database unique constraint name. If not overridden, SQL Connect generates the unique constraint name: - \`table_name_first_field_second_field_uidx\` - \`table_name_only_field_name_uidx\` |
|
|
506
506
|
| \`fields\` | [\`[String!]\`](scalar.md#String) | Only allowed and required when used on OBJECT, this specifies the fields to create a unique constraint on. |
|
|
507
507
|
|
|
508
508
|
### @view on \`OBJECT\` {:#view}
|
|
509
509
|
Defines a relational database Raw SQLview.
|
|
510
510
|
|
|
511
|
-
|
|
511
|
+
SQL Connect generates GraphQL queries with WHERE and ORDER BY clauses.
|
|
512
512
|
However, not all SQL features has native GraphQL equivalent.
|
|
513
513
|
|
|
514
|
-
You can write **an arbitrary SQL SELECT statement**.
|
|
514
|
+
You can write **an arbitrary SQL SELECT statement**. SQL Connect
|
|
515
515
|
would map Graphql fields on [\`@view\`](directive.md#view) type to columns in your SELECT statement.
|
|
516
516
|
|
|
517
517
|
* Scalar GQL fields (camelCase) should match a SQL column (snake_case)
|
|
@@ -633,10 +633,10 @@ Raw SQL view doesn't have a primary key, so it doesn't support lookup. Other
|
|
|
633
633
|
View cannot be mutated. You can perform CRUD operations on the underlying
|
|
634
634
|
table to alter its content.
|
|
635
635
|
|
|
636
|
-
**Important:
|
|
636
|
+
**Important: SQL Connect doesn't parse and validate SQL**
|
|
637
637
|
|
|
638
638
|
- If the SQL view is invalid or undefined, related requests may fail.
|
|
639
|
-
- If the SQL view return incompatible types. Firebase
|
|
639
|
+
- If the SQL view return incompatible types. Firebase SQL Connect may surface
|
|
640
640
|
errors.
|
|
641
641
|
- If a field doesn't have a corresponding column in the SQL SELECT statement,
|
|
642
642
|
it will always be \`null\`.
|