Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fdc): Rename Response to Data #13369

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
84d7598
First pass at dataconnect
maneesht May 23, 2024
a960d33
Got mutations to work
maneesht May 28, 2024
257c90c
Finished WIP
maneesht Jun 25, 2024
2b0c7ab
Used generated SDK
maneesht Jul 11, 2024
b5c3611
Merge branch 'master' into mtewani/fdc
maneesht Jul 11, 2024
8e8e737
Removed unrelated chagnes
maneesht Jul 11, 2024
806989b
Cleanup
maneesht Jul 11, 2024
8978090
Updated deps
maneesht Jul 11, 2024
fa7829e
Addressed comments
maneesht Jul 16, 2024
d7bb86c
Removed prints
maneesht Jul 16, 2024
8983df1
Removed unnecessary protos
maneesht Jul 23, 2024
1297684
Removed user class
maneesht Jul 23, 2024
2774a0d
Removed unnecessary class
maneesht Jul 23, 2024
3058024
Removed unnecessary deps
maneesht Jul 29, 2024
f5b35ea
Added back config files
maneesht Jul 29, 2024
8df3922
Fixed formatting
maneesht Jul 29, 2024
c7868f6
added index.html
maneesht Jul 29, 2024
9149814
Added license files
maneesht Jul 29, 2024
34d53aa
Fixed formatting
maneesht Jul 29, 2024
8bc79ad
Fixed linting issues
maneesht Jul 30, 2024
fb97874
Fixed formatting
maneesht Jul 30, 2024
7b421c9
Added protobuf as dependency
maneesht Jul 30, 2024
37ab782
Added license
maneesht Jul 31, 2024
d5521e8
Ignored example dir for secret checking
maneesht Jul 31, 2024
bb54564
Added changelog and readme
maneesht Jul 31, 2024
16855c8
Updated package version
maneesht Jul 31, 2024
bf9f8b9
Implemented app check
maneesht Aug 7, 2024
6a643f1
Removed key
maneesht Aug 7, 2024
723b069
Revert "Removed key"
maneesht Aug 7, 2024
6a69cab
Removed key again
maneesht Aug 7, 2024
afe32c2
Added error catching implementation (#13163)
maneesht Aug 7, 2024
fde352f
feat(dataconnect): Added error handling (#13175)
maneesht Aug 12, 2024
6d756f4
Miscellaneous cleanup
maneesht Aug 12, 2024
2e3d56e
Removed macros experiment
maneesht Aug 12, 2024
b053313
Removed .then statements
maneesht Aug 12, 2024
ec3a45d
Removed debug prints
maneesht Aug 12, 2024
2fec20e
Addressed first pass of comments
maneesht Aug 13, 2024
e3d19f0
Added movie_insert gql file
maneesht Aug 13, 2024
d5dc189
Added comments
maneesht Aug 13, 2024
b33ab6c
Renamed package
maneesht Aug 13, 2024
b0ceb73
Another package rename
maneesht Aug 13, 2024
422bd80
Removed common package
maneesht Aug 14, 2024
7d0826a
Added missing files
maneesht Aug 14, 2024
466fa23
Updated readme
maneesht Aug 14, 2024
359088a
Revert "Removed common package"
maneesht Aug 14, 2024
281c399
Various improvements
maneesht Aug 22, 2024
05ab14e
Merge branch 'mtewani/implement-app-check' into mtewani/fdc
maneesht Aug 22, 2024
31694c0
Made changes per api proposal
maneesht Aug 23, 2024
61562f3
Fixed initialization issues with generated SDK
maneesht Aug 23, 2024
945a9cf
Made changes according to api council review
maneesht Aug 28, 2024
6847801
Addressed Comments.
maneesht Sep 3, 2024
d7e933f
Merge remote-tracking branch 'origin/main' into mtewani/fdc
maneesht Sep 3, 2024
a6a5585
Added missing license header to files
maneesht Sep 3, 2024
f9ac9a4
/s/query/operation
maneesht Sep 3, 2024
46b7f73
API Council Changes
maneesht Sep 3, 2024
47f98bc
Included list movies changes
maneesht Sep 3, 2024
b3817a9
API council updates
maneesht Sep 5, 2024
bdd9535
Addressed comments
maneesht Sep 5, 2024
636f740
Removed print
maneesht Sep 5, 2024
89232c6
Added license header
maneesht Sep 5, 2024
74e40a9
Removed files that should be gitignored
maneesht Sep 5, 2024
abb4354
Removed requirement on firebase_options
maneesht Sep 6, 2024
d22ea34
Added missing line
maneesht Sep 6, 2024
6dde572
Removed windows and linux folders, updated changelog and gitignore
maneesht Sep 6, 2024
ce3caeb
Updated version of firebase_data_connect
maneesht Sep 7, 2024
800ee6a
Implemented gmpid
maneesht Sep 18, 2024
2614210
Merge remote-tracking branch 'origin/main' into mtewani/implement-gmpid
maneesht Sep 18, 2024
bca91b2
Made changes
maneesht Sep 18, 2024
a0de73d
Made more changes
maneesht Sep 18, 2024
51a7327
Replaced null with emptySerializer
maneesht Sep 18, 2024
0ec73f4
Trigger Build
maneesht Sep 18, 2024
34eb062
Fixed errors
maneesht Sep 18, 2024
c2a2d63
Renamed response types to use data instead
maneesht Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
<data android:mimeType="text/plain" />
</intent>
</queries>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ directive @auth(
"""
expr: Boolean_Expr @fdc_oneOf(required: true)
) on QUERY | MUTATION

"""
Marks an element of a GraphQL operation as no longer supported on the client.
The Firebase Data Connect backend will still support this element, but it will
no longer appear in generated SDKs.
"""
directive @retired(
"Explains why this element was retired."
reason: String
) on QUERY | MUTATION | FIELD | VARIABLE_DEFINITION

"Query filter criteria for `String` scalar fields."
input String_Filter {
"When true, match if field `IS NULL`. When false, match if field is `NOT NULL`."
Expand Down Expand Up @@ -304,6 +315,7 @@ input Any_ListFilter {
"Match if list field does not contain any of the provided values as members."
excludesAll: [Any!]
}

"""
(Internal) A string that uniquely identifies a type, field, and so on.

Expand Down Expand Up @@ -358,53 +370,7 @@ directive @fdc_generated(
| ENUM_VALUE
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
"""
Defines a database index to optimize query performance.

Given `type TableName @table @index(fields: [“fieldName”, “secondFieldName”])`,
`table_name_field_name_second_field_name_aa_idx` is the SQL index id.
`table_name_field_name_second_field_name_ad_idx` if `order: [ASC DESC]`.
`table_name_field_name_second_field_name_dd_idx` if `order: [DESC DESC]`.

Given `type TableName @table { fieldName: Int @index } `
`table_name_field_name_idx` is the SQL index id.
`order` matters less for single field indexes because they can be scanned in both ways.

Override with `@index(name)` in case of index name conflicts.
"""
directive @index(
"The SQL database index id. Defaults to <table_name>_<field_name>_idx."
name: String
"""
Only allowed and required when used on OBJECT.
The fields to create an index on.
"""
fields: [String!]
"""
Only allowed when used on OBJECT and BTREE index.
Index order of each column. Default to all ASC.
"""
order: [IndexFieldOrder!]
"""
For array field, default to `GIN`.
For Vector field, default to `HNSW`.
"""
type: IndexType
"""
Only allowed when used on vector field.
The vector similarity method. Default to `INNER_PRODUCT`.
"""
vector_method: VectorSimilarityMethod
) repeatable on FIELD_DEFINITION | OBJECT

enum IndexFieldOrder { ASC DESC }

enum IndexType {
BTREE
GIN
HNSW
IVFFLAT
}
type Query {
_service: _Service!
}
Expand All @@ -415,7 +381,10 @@ type Mutation {
}

type _Service {
"Full Service Definition Language of the Frebase Data Connect Schema, including normalized schema, predefined and generated types."
sdl: String!
"Orignal Schema Sources in the service."
schema: String!
}

"(Internal) Added to things that may be removed from FDC and will soon be no longer usable in schema or operations."
Expand Down Expand Up @@ -465,6 +434,7 @@ directive @fdc_oneOf(
"If true, exactly one field / argument in the group must be specified."
required: Boolean! = false
) repeatable on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION

"""
UUID is a string with hex digits representing an RFC4122 value.

Expand All @@ -490,16 +460,7 @@ scalar True
@fdc_forbiddenAsFieldType
@fdc_forbiddenAsVariableType
@fdc_example(value: true, description: "The only allowed value.")
"Define the intervals used in timestamps and dates (subset)"
enum TimestampInterval @fdc_deprecated {
second
minute
hour
day
week
month
year
}

"""
A Common Expression Language (CEL) expression that returns a boolean at runtime.

Expand Down Expand Up @@ -566,6 +527,7 @@ scalar Any_SQL
@fdc_sqlExpression
@fdc_forbiddenAsVariableType
@fdc_forbiddenAsFieldType

"""
Defines a relational database table.

Expand Down Expand Up @@ -718,24 +680,6 @@ enum OrderDirection {
DESC
}

enum ColDefault @fdc_deprecated {
"""
Generates a random UUID (v4) as the default column value.
Compatible with String or UUID typed fields.
"""
UUID
"""
Generates an auto-incrementing sequence as the default column value.
Compatible with Int and Int64 typed fields.
"""
SEQUENCE
"""
Populates the default column value with the current date or timestamp.
Compatible with Date and Timestamp typed fields.
"""
NOW
}

"""
Specify the default column value.

Expand All @@ -744,8 +688,6 @@ The supported arguments vary based on the field type.
directive @default(
"A constant value. Validated against the field GraphQL type at compile-time."
value: Any @fdc_oneOf(required: true)
"(Deprecated) Built-in common ways to generate initial value."
generate: ColDefault @fdc_oneOf(required: true) @deprecated
"A CEL expression, whose return value must match the field data type."
expr: Any_Expr @fdc_oneOf(required: true)
"""
Expand All @@ -757,6 +699,75 @@ directive @default(
"""
sql: Any_SQL @fdc_oneOf(required: true)
) on FIELD_DEFINITION

"""
Defines a database index to optimize query performance.

Given `type TableName @table @index(fields: [“fieldName”, “secondFieldName”])`,
`table_name_field_name_second_field_name_aa_idx` is the SQL index id.
`table_name_field_name_second_field_name_ad_idx` if `order: [ASC DESC]`.
`table_name_field_name_second_field_name_dd_idx` if `order: [DESC DESC]`.

Given `type TableName @table { fieldName: Int @index } `
`table_name_field_name_idx` is the SQL index id.
`order` matters less for single field indexes because they can be scanned in both ways.

Override with `@index(name)` in case of index name conflicts.
"""
directive @index(
"The SQL database index id. Defaults to <table_name>_<field_name>_idx."
name: String
"""
Only allowed and required when used on OBJECT.
The fields to create an index on.
"""
fields: [String!]
"""
Only allowed when used on OBJECT and BTREE index.
Index order of each column. Default to all ASC.
"""
order: [IndexFieldOrder!]
"""
For array field, default to `GIN`.
For Vector field, default to `HNSW`.
"""
type: IndexType
"""
Only allowed when used on vector field.
The vector similarity method. Default to `INNER_PRODUCT`.
"""
vector_method: VectorSimilarityMethod
) repeatable on FIELD_DEFINITION | OBJECT

enum IndexFieldOrder { ASC DESC }

enum IndexType {
BTREE
GIN
HNSW
IVFFLAT
}

"""
Defines a unique constraint.

Given `type TableName @table @unique(fields: [“fieldName”, “secondFieldName”])`,
`table_name_field_name_second_field_name_uidx` is the SQL unique index id.
Given `type TableName @table { fieldName: Int @unique } `
`table_name_field_name_uidx` is the SQL unique index id.

Override with `@unique(indexName)` in case of index name conflicts.
"""
directive @unique(
"The SQL database unique index name. Defaults to <table_name>_<field_name>_uidx."
indexName: String
"""
Only allowed and required when used on OBJECT.
The fields to create a unique constraint on.
"""
fields: [String!]
) repeatable on FIELD_DEFINITION | OBJECT

"""
Date is a string in the YYYY-MM-DD format representing a local-only date.

Expand Down Expand Up @@ -980,25 +991,7 @@ enum Date_Interval @fdc_forbiddenAsFieldType {
MONTH
YEAR
}
"""
Defines a unique constraint.

Given `type TableName @table @unique(fields: [“fieldName”, “secondFieldName”])`,
`table_name_field_name_second_field_name_uidx` is the SQL unique index id.
Given `type TableName @table { fieldName: Int @unique } `
`table_name_field_name_uidx` is the SQL unique index id.

Override with `@unique(indexName)` in case of index name conflicts.
"""
directive @unique(
"The SQL database unique index name. Defaults to <table_name>_<field_name>_uidx."
indexName: String
"""
Only allowed and required when used on OBJECT.
The fields to create a unique constraint on.
"""
fields: [String!]
) repeatable on FIELD_DEFINITION | OBJECT
"Update input of a String value"
input String_Update {
set: String @fdc_oneOf(group: "set")
Expand Down Expand Up @@ -1090,6 +1083,7 @@ input Any_ListUpdate {
append: [Any!]
prepend: [Any!]
}

"""
Vector is an array of single-precision floating-point numbers, serialized
as a JSON array. All elements must be finite (no NaN, Infinity or -Infinity).
Expand Down Expand Up @@ -1168,3 +1162,4 @@ scalar Vector_Embed_Model
@fdc_forbiddenAsVariableType
@fdc_forbiddenAsFieldType
@fdc_example(value: "textembedding-gecko@003", description: "A stable version of the textembedding-gecko model")

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ mutation addDirectorToMovie($personId: Person_Key, $movieId: UUID)
@auth(level: PUBLIC) {
directedBy_insert(data: { directedby: $personId, movieId: $movieId })
}
mutation seedData @auth(level: PUBLIC) {
movies1: movie_insert(
data: {
title: "The Matrix"
releaseYear: 1999
genre: "Action"
rating: 5.0
description: "When a beautiful stranger leads computer hacker Neo to a forbidding underworld, he discovers the shocking truth--the life he knows is the elaborate deception of an evil cyber-intelligence."
}
)
}
mutation createMovie(
$title: String!
$releaseYear: Int!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"port": 9099
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ class AddDirectorToMovie {
String name = "addDirectorToMovie";
AddDirectorToMovie({required this.dataConnect});

Deserializer<AddDirectorToMovieResponse> dataDeserializer = (String json) =>
AddDirectorToMovieResponse.fromJson(
jsonDecode(json) as Map<String, dynamic>);
Deserializer<AddDirectorToMovieData> dataDeserializer = (String json) =>
AddDirectorToMovieData.fromJson(jsonDecode(json) as Map<String, dynamic>);
Serializer<AddDirectorToMovieVariables> varsSerializer =
(AddDirectorToMovieVariables vars) => jsonEncode(vars.toJson());
MutationRef<AddDirectorToMovieResponse, AddDirectorToMovieVariables> ref(
{AddDirectorToMovieVariablesPersonId? personId,
String? movieId,
AddDirectorToMovieVariables? addDirectorToMovieVariables}) {
AddDirectorToMovieVariables vars1 = AddDirectorToMovieVariables(
MutationRef<AddDirectorToMovieData, AddDirectorToMovieVariables> ref({
AddDirectorToMovieVariablesPersonId? personId,
String? movieId,
}) {
AddDirectorToMovieVariables vars = AddDirectorToMovieVariables(
personId: personId,
movieId: movieId,
);
AddDirectorToMovieVariables vars = addDirectorToMovieVariables ?? vars1;

return dataConnect.mutation(
this.name, dataDeserializer, varsSerializer, vars);
}
Expand Down Expand Up @@ -53,10 +52,10 @@ class AddDirectorToMovieDirectedByInsert {
}
}

class AddDirectorToMovieResponse {
class AddDirectorToMovieData {
late AddDirectorToMovieDirectedByInsert directedBy_insert;

AddDirectorToMovieResponse.fromJson(Map<String, dynamic> json)
AddDirectorToMovieData.fromJson(Map<String, dynamic> json)
: directedBy_insert = AddDirectorToMovieDirectedByInsert.fromJson(
json['directedBy_insert']) {}

Expand All @@ -69,7 +68,7 @@ class AddDirectorToMovieResponse {
return json;
}

AddDirectorToMovieResponse({
AddDirectorToMovieData({
required this.directedBy_insert,
}) {
// TODO(mtewani): Only show this if there are optional fields.
Expand Down Expand Up @@ -124,8 +123,8 @@ class AddDirectorToMovieVariables {
}

AddDirectorToMovieVariables({
AddDirectorToMovieVariablesPersonId? this.personId,
String? this.movieId,
this.personId,
this.movieId,
}) {
// TODO(mtewani): Only show this if there are optional fields.
}
Expand Down
Loading
Loading