From 04a30e67d3bc1d138dba6371865f801fcf907d69 Mon Sep 17 00:00:00 2001 From: Mike Kalange Date: Wed, 22 May 2024 15:13:18 -0600 Subject: [PATCH 1/2] Add gql mods for implementing one-of --- src/index.tsx | 18 ++---------------- src/schema.gql | 43 +++++++++++++++---------------------------- 2 files changed, 17 insertions(+), 44 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index b10591c..159080c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -54,10 +54,6 @@ export type AggregationInput = { enum?: InputMaybe; }; -export type AndFilter = { - filters: Array; -}; - export type BankFeaturesGql = { __typename?: "BankFeaturesGQL"; bankAngle: Scalars["Float"]["output"]; @@ -134,14 +130,14 @@ export type EnumAggregation = { }; export type FilterInput = { - andFilters?: InputMaybe; + andFilters?: InputMaybe>; cueBallSpeed?: InputMaybe; cueObjectAngle?: InputMaybe; cueObjectDistance?: InputMaybe; difficulty?: InputMaybe; intendedPocketType?: InputMaybe>; make?: InputMaybe>; - orFilters?: InputMaybe; + orFilters?: InputMaybe>; shotDirection?: InputMaybe>; tags?: InputMaybe>; targetPocketDistance?: InputMaybe; @@ -236,10 +232,6 @@ export type MutationSetLoggerLevelArgs = { path: Scalars["String"]["input"]; }; -export type OrFilter = { - filters: Array; -}; - export type PageInfoGql = { __typename?: "PageInfoGQL"; endCursor?: Maybe; @@ -329,11 +321,6 @@ export type RangeFilter = { lessThan?: InputMaybe; }; -export type SerializedShotPathsGql = { - __typename?: "SerializedShotPathsGQL"; - b64EncodedBuffer?: Maybe; -}; - export enum ShotDirectionEnum { Left = "LEFT", Right = "RIGHT", @@ -348,7 +335,6 @@ export type ShotGql = { endFrame: Scalars["Int"]["output"]; id: Scalars["Int"]["output"]; pocketingIntentionFeatures?: Maybe; - serializedShotPaths?: Maybe; startFrame: Scalars["Int"]["output"]; updatedAt?: Maybe; user?: Maybe; diff --git a/src/schema.gql b/src/schema.gql index b0735b1..106a0d7 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -44,8 +44,8 @@ input AggregateInputGQL { } input AggregationInput { - bucketSet: BucketSetInputGQL = null - enum: EnumAggregation = null + bucketSet: BucketSetInputGQL + enum: EnumAggregation } input BucketSetInputGQL { @@ -63,27 +63,19 @@ input EnumAggregation { } input FilterInput { - andFilters: AndFilter = null - orFilters: OrFilter = null - cueObjectDistance: RangeFilter = null - targetPocketDistance: RangeFilter = null - cueObjectAngle: RangeFilter = null - cueBallSpeed: RangeFilter = null - difficulty: RangeFilter = null - intendedPocketType: [PocketEnum!] = null - shotDirection: [ShotDirectionEnum!] = null - videoId: [Int!] = null - userId: [Int!] = null - make: [Boolean!] = null - tags: [VideoTagInput!] = null -} - -input AndFilter { - filters: [FilterInput!]! -} - -input OrFilter { - filters: [FilterInput!]! + andFilters: [FilterInput!] + orFilters: [FilterInput!] + cueObjectDistance: RangeFilter + targetPocketDistance: RangeFilter + cueObjectAngle: RangeFilter + cueBallSpeed: RangeFilter + difficulty: RangeFilter + intendedPocketType: [PocketEnum!] + shotDirection: [ShotDirectionEnum!] + videoId: [Int!] + userId: [Int!] + make: [Boolean!] + tags: [VideoTagInput!] } input RangeFilter { @@ -144,7 +136,6 @@ type ShotGQL { cueObjectFeatures: CueObjectFeaturesGQL pocketingIntentionFeatures: PocketingIntentionFeaturesGQL bankFeatures: BankFeaturesGQL - serializedShotPaths: SerializedShotPathsGQL user: UserGQL } @@ -178,10 +169,6 @@ enum WallTypeEnum { SHORT } -type SerializedShotPathsGQL { - b64EncodedBuffer: String -} - type UserGQL { id: Int! firebaseUid: String! -- 2.46.1 From 33f5404820702191989b31f62b63e104dad0eb58 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 22 May 2024 16:41:24 -0600 Subject: [PATCH 2/2] Actually incorperate one of stuff --- src/index.tsx | 224 ++++++++++++++++++++++++++++++++++++++++++++----- src/schema.gql | 9 +- 2 files changed, 212 insertions(+), 21 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 159080c..8edd05e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -49,10 +49,9 @@ export type AggregationIdentifierGql = { groupName: Scalars["String"]["output"]; }; -export type AggregationInput = { - bucketSet?: InputMaybe; - enum?: InputMaybe; -}; +export type AggregationInput = + | { bucketSet: BucketSetInputGql; enum?: never } + | { bucketSet?: never; enum: EnumAggregation }; export type BankFeaturesGql = { __typename?: "BankFeaturesGQL"; @@ -129,21 +128,202 @@ export type EnumAggregation = { feature: Scalars["String"]["input"]; }; -export type FilterInput = { - andFilters?: InputMaybe>; - cueBallSpeed?: InputMaybe; - cueObjectAngle?: InputMaybe; - cueObjectDistance?: InputMaybe; - difficulty?: InputMaybe; - intendedPocketType?: InputMaybe>; - make?: InputMaybe>; - orFilters?: InputMaybe>; - shotDirection?: InputMaybe>; - tags?: InputMaybe>; - targetPocketDistance?: InputMaybe; - userId?: InputMaybe>; - videoId?: InputMaybe>; -}; +export type FilterInput = + | { + andFilters: Array; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed: RangeFilter; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle: RangeFilter; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance: RangeFilter; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty: RangeFilter; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType: Array; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make: Array; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters: Array; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection: Array; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags: Array; + targetPocketDistance?: never; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance: RangeFilter; + userId?: never; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId: Array; + videoId?: never; + } + | { + andFilters?: never; + cueBallSpeed?: never; + cueObjectAngle?: never; + cueObjectDistance?: never; + difficulty?: never; + intendedPocketType?: never; + make?: never; + orFilters?: never; + shotDirection?: never; + tags?: never; + targetPocketDistance?: never; + userId?: never; + videoId: Array; + }; export type GetUploadLinkReturn = { __typename?: "GetUploadLinkReturn"; @@ -321,6 +501,11 @@ export type RangeFilter = { lessThan?: InputMaybe; }; +export type SerializedShotPathsGql = { + __typename?: "SerializedShotPathsGQL"; + b64EncodedBuffer?: Maybe; +}; + export enum ShotDirectionEnum { Left = "LEFT", Right = "RIGHT", @@ -335,6 +520,7 @@ export type ShotGql = { endFrame: Scalars["Int"]["output"]; id: Scalars["Int"]["output"]; pocketingIntentionFeatures?: Maybe; + serializedShotPaths?: Maybe; startFrame: Scalars["Int"]["output"]; updatedAt?: Maybe; user?: Maybe; diff --git a/src/schema.gql b/src/schema.gql index 106a0d7..c229a1b 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -43,7 +43,7 @@ input AggregateInputGQL { filterInput: FilterInput } -input AggregationInput { +input AggregationInput @oneOf { bucketSet: BucketSetInputGQL enum: EnumAggregation } @@ -62,7 +62,7 @@ input EnumAggregation { feature: String! } -input FilterInput { +input FilterInput @oneOf { andFilters: [FilterInput!] orFilters: [FilterInput!] cueObjectDistance: RangeFilter @@ -136,6 +136,7 @@ type ShotGQL { cueObjectFeatures: CueObjectFeaturesGQL pocketingIntentionFeatures: PocketingIntentionFeaturesGQL bankFeatures: BankFeaturesGQL + serializedShotPaths: SerializedShotPathsGQL user: UserGQL } @@ -169,6 +170,10 @@ enum WallTypeEnum { SHORT } +type SerializedShotPathsGQL { + b64EncodedBuffer: String +} + type UserGQL { id: Int! firebaseUid: String! -- 2.46.1