-
Notifications
You must be signed in to change notification settings - Fork 87
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
New graphql schema #662
New graphql schema #662
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!! Just left some minor questions ✌️
PS: The docs are amazing <3
2cbf3b6
to
ce670f0
Compare
300dbca
to
b671a76
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Left some suggestions
docs/README.md
Outdated
|
||
```graphql | ||
query { | ||
ProductReadModels(filter: { sku: { begingsWith: "jelwery" } }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProductReadModels(filter: { sku: { begingsWith: "jelwery" } }) { | |
ProductReadModels(filter: { sku: { begingsWith: "jewelry" } }) { |
docs/README.md
Outdated
@@ -1582,6 +1582,142 @@ For more information about queries and how to use them, please check the [GraphQ | |||
|
|||
Booster GraphQL API also provides support for real-time updates using subscriptions and websocket, to get more information about it go to the [GraphQL API](#subscribing-to-read-models) section. | |||
|
|||
#### Filtering a read model | |||
|
|||
Booster GraphQL API provides support for filtering ReadModels on queries, subscriptions and at code level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Booster GraphQL API provides support for filtering ReadModels on queries, subscriptions and at code level. | |
The Booster GraphQL API provides support for filtering Read Models on queries, subscriptions and at code level. |
docs/README.md
Outdated
|
||
Booster GraphQL API provides support for filtering ReadModels on queries, subscriptions and at code level. | ||
|
||
Using the GraphQL API endpoint you can retrieve the schema of your application so you can see what are the filters for every ReadModel and its properties. You can filter like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the GraphQL API endpoint you can retrieve the schema of your application so you can see what are the filters for every ReadModel and its properties. You can filter like this: | |
Using the GraphQL API endpoint you can retrieve the schema of your application so you can see what are the filters for every Read Model and its properties. You can filter like this: |
docs/README.md
Outdated
|
||
Using the GraphQL API endpoint you can retrieve the schema of your application so you can see what are the filters for every ReadModel and its properties. You can filter like this: | ||
|
||
Searching for a specific ReadModel by id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Searching for a specific ReadModel by id | |
Searching for a specific Read Model by `id` |
docs/README.md
Outdated
|
||
#### Supported filters | ||
|
||
The currently supported filters are in the following ones. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The currently supported filters are in the following ones. | | |
The currently supported filters are the following ones: |
docs/README.md
Outdated
| and | [Filters] | AND - all filters on the list have a match | | ||
| or | [Filters] | OR - At least one filter of the list has a match | | ||
| not | Filter/and/or | The element does not match the filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be formatted probably
@@ -37,7 +39,7 @@ export const template = `{ | |||
"scripts": { | |||
"lint:check": "eslint --ext '.js,.ts' **/*.ts", | |||
"lint:fix": "eslint --quiet --fix --ext '.js,.ts' **/*.ts", | |||
"compile": "npx tsc -b tsconfig.json", | |||
"compile": "npx ttypescript -b tsconfig.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[rant]
Whyyyyyy 😭😭😭😭 Would've been better to use ts-patch
...
Anyways, go on... 🥲
[/rant]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just extended form the existing branch, we'll have plenty of time to change it in the future 🙌🏻
const propertyTypes = Reflect.getMetadata('design:paramtypes', classType) | ||
if (propertyNames.length != propertyTypes.length) { | ||
const meta: ClassMetadata = Reflect.getMetadata('booster:typeinfo', classType) | ||
if (!meta) { | ||
// eslint-disable-next-line prettier/prettier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this line is not needed anymore
// eslint-disable-next-line prettier/prettier |
...{ | ||
type: GraphQLJSONObject, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doing this and not instead:
...{ | |
type: GraphQLJSONObject, | |
}, | |
type: GraphQLJSONObject, |
private generateOperationEnumValuesFor(operationsEnum: AnyClass): GraphQLEnumValueConfigMap { | ||
const enumValuesConfig: GraphQLEnumValueConfigMap = {} | ||
for (const opSymbol in operationsEnum) { | ||
const opName = (operationsEnum as any)[opSymbol] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any
police 👮🏻♂️
What's the contents of operationsEnum
? Maybe we can type it in a better way? Can you explain more please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't create that function, it was added after a rebase, so there isn't much I can tell you here 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, keep circulating 👮
0636d6b
to
ef39cf3
Compare
ef39cf3
to
6a904cd
Compare
Description
Note: This branch has been extended from #616 as the metadata reflection introduced by the TypeScript transformers is necessary. Unfortunately, this has its limitations as stated in #661.
This branch introduces the GraphQL new schema in the core, allowing filtering by more than one property at the same time and by complex properties as well in queries and subscriptions.
Changes
The GraphQL schema now is way more secure and complete, allows complex and multiple filters instead of just one basic one. Also, the filter API is way more user-friendly.
Checks
Additional information
This PR solves: #600 #602 and also #603
Due to a
DynamoDB
limitation, the schema has to make use of genericGraphQLJSONType
types, which doesn't give much info to the user and doesn't give us full security when updating types. This also doesn't give us the ability yet to query by properties of a complex property that is inside aList
. You can see more information about this limitation here #652Next steps
Refactor the rest of the providers to use the new GraphQL schema, see #601