Compare commits

..

No commits in common. "e86f40c62016aed152d2f342ae50d5c0f6147bb1" and "318a2a24fd62e5896284c9471b1680a9ab03cc34" have entirely different histories.

16 changed files with 672 additions and 2790 deletions

View File

@ -3,4 +3,4 @@ GQL_DIR=$(dirname $(dirname "$(realpath "$BASH_SOURCE")"))
cd $GQL_DIR
LD_LIBRARY_PATH="" nix develop --impure --command bash "$GQL_DIR/bin/assert-no-changes.sh"
nix develop --impure --command bash "$GQL_DIR/bin/assert-no-changes.sh"

View File

@ -3,7 +3,6 @@ git ls-files | xargs md5sum > before.txt
yarn install
yarn graphql-codegen
prettier ./src --write
git ls-files | xargs md5sum > after.txt

View File

@ -20,7 +20,9 @@
},
"gitignore": {
"inputs": {
"nixpkgs": ["nixpkgs"]
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,

View File

@ -17,14 +17,7 @@
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-codegen/typescript-react-apollo": "^4.2.0",
"graphql": "^16.8.1",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4"
},
"prettier": {
"plugins": [
"prettier-plugin-organize-imports"
]
"graphql": "^16.8.1"
},
"devDependencies": {
"typescript": "^4.x"

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) {
getAggregatedShotMetrics(aggregateInput: $aggregateInput) {
aggregationIdentifiers {
featureName
groupName
}
targetMetrics {
count
makePercentage
}
}
}

View File

@ -0,0 +1,17 @@
query GetAggregateShots($bucketSets: [BucketSetInputGQL!]!) {
getAggregateShots(bucketSets: $bucketSets) {
featureBuckets {
rangeKey
lowerBound
}
targetMetrics {
count
makePercentage
floatFeature {
featureName
average
median
}
}
}
}

View File

@ -1,8 +0,0 @@
query getDeployedConfig {
getDeployedConfig {
allowNewUsers
devMode
environment
firebase
}
}

View File

@ -1,33 +1,36 @@
query GetFeed(
$limit: Int! = 5
$after: String = null
$filters: VideoFilterInput = null
$first: Int! = 5,
$after: String = null,
) {
getUserVideos(limit: $limit, after: $after, filters: $filters) {
getVideoFeedForUser(first: $first, after: $after) {
videos {
id
owner {
username
}
name
screenshotUri
totalShotsMade
totalShots
makePercentage
medianRun
averageTimeBetweenShots
createdAt
updatedAt
shots {
id
videoId
startFrame
endFrame
createdAt
updatedAt
}
startTime
endTime
elapsedTime
screenshotUri
stream {
id
linksRequested
uploadsCompleted
isCompleted
}
tags {
tagClasses {
name
}
name
createdAt
updatedAt
}
}
pageInfo {

View File

@ -1,9 +0,0 @@
query GetVideoMakePercentageIntervals($videoId: ID!, $intervalDuration: Int!) {
getVideoMakePercentageIntervals(
videoId: $videoId
intervalDuration: $intervalDuration
) {
makePercentage
elapsedTime
}
}

View File

@ -1,9 +1,5 @@
query GetShots(
$filterInput: FilterInput!
$includeCreatedAt: Boolean! = false
$includeUpdatedAt: Boolean! = false
$includeCueObjectFeatures: Boolean! = false
$includePocketingIntentionFeatures: Boolean! = false
$filterInput: FilterInput
$includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false
@ -17,16 +13,15 @@ query GetShots(
videoId
startFrame
endFrame
createdAt @include(if: $includeCreatedAt)
updatedAt @include(if: $includeUpdatedAt)
cueObjectFeatures @include(if: $includeCueObjectFeatures) {
createdAt
updatedAt
cueObjectFeatures {
cueObjectDistance @include(if: $includeCueObjectDistance)
cueObjectAngle @include(if: $includeCueObjectAngle)
cueBallSpeed @include(if: $includeCueBallSpeed)
shotDirection @include(if: $includeShotDirection)
}
pocketingIntentionFeatures
@include(if: $includePocketingIntentionFeatures) {
pocketingIntentionFeatures {
targetPocketDistance @include(if: $includeTargetPocketDistance)
make @include(if: $includeMake)
intendedPocketType @include(if: $includeIntendedPocketType)

View File

@ -1,38 +0,0 @@
mutation getProfileImageUploadLink($fileExt: String = ".png") {
getProfileImageUploadLink(fileExt: $fileExt) {
uploadUrl
headers {
key
value
}
}
}
mutation editProfileImageUri($profileImageUri: String!) {
editProfileImageUri(profileImageUri: $profileImageUri) {
id
firebaseUid
username
profileImageUri
createdAt
updatedAt
}
}
query getLoggedInUser {
getLoggedInUser {
id
firebaseUid
username
profileImageUri
activeVideoId
createdAt
updatedAt
}
}
query GetUserPlayTime($userId: Int!) {
getPlayTime(userId: $userId) {
totalSeconds
}
}

View File

@ -1,150 +0,0 @@
query GetStreamMonitoringDetails($videoId: Int!) {
getVideo(videoId: $videoId) {
id
totalShots
makePercentage
elapsedTime
homographyHistory {
crop {
left
top
width
height
}
pockets {
left
top
width
height
}
sourcePoints {
topLeft {
x
y
}
topSide {
x
y
}
topRight {
x
y
}
bottomLeft {
x
y
}
bottomSide {
x
y
}
bottomRight {
x
y
}
}
}
stream {
linksRequested
uploadsCompleted
segmentProcessingCursor
isCompleted
uploadCompletionCursor
lastIntendedSegmentBound
}
currentProcessing {
errors {
message
startSegmentIndex
endSegmentIndex
}
}
}
}
query GetVideoUpdatePageDetails($videoId: Int!) {
getVideo(videoId: $videoId) {
id
name
totalShots
makePercentage
elapsedTime
tags {
tagClasses {
name
}
name
}
}
}
mutation DeleteVideo($videoId: Int!) {
deleteVideo(videoId: $videoId)
}
query GetVideoDetails($videoId: Int!) {
getVideo(videoId: $videoId) {
id
name
screenshotUri
averageTimeBetweenShots
elapsedTime
endTime
makePercentage
makePercentage
medianRun
startTime
totalShots
totalShots
totalShotsMade
createdAt
updatedAt
owner {
id
firebaseUid
username
profileImageUri
}
tags {
tagClasses {
name
}
name
}
}
}
query GetVideos($videoIds: [Int!]!) {
getVideos(videoIds: $videoIds) {
id
playlist {
segmentDurations
}
stream {
id
segments {
uploaded
valid
segmentIndex
endFrameIndex
framesPerSecond
}
}
}
}
query GetVideo($videoId: Int!) {
getVideo(videoId: $videoId) {
id
playlist {
segmentDurations
}
stream {
segments {
segmentIndex
endFrameIndex
framesPerSecond
}
}
}
}

View File

@ -1,5 +1,29 @@
mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) {
createUploadStream(videoMetadata: $videoMetadataInput) {
mutation CreateUploadStream(
$videoName: String!
$deviceType: DeviceTypeEnum
$osVersion: String
$appVersion: String
$browserName: String
$browserVersion: String
$locale: String
$timezone: String
$networkType: String
$ipAddress: String
) {
createUploadStream(
videoName: $videoName
uploadMetadata: {
deviceType: $deviceType
osVersion: $osVersion
appVersion: $appVersion
browserName: $browserName
browserVersion: $browserVersion
locale: $locale
timezone: $timezone
networkType: $networkType
ipAddress: $ipAddress
}
) {
videoId
}
}
@ -7,54 +31,19 @@ mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) {
mutation GetUploadLink($videoId: Int!, $segmentIndex: Int!) {
getUploadLink(videoId: $videoId, segmentIndex: $segmentIndex) {
uploadUrl
headers {
key
value
}
}
}
mutation EditUploadStream(
mutation TerminateUploadStream(
$videoId: Int!
$videoMetadataInput: VideoMetadataInput!
$videoName: String
$gameType: String
$tableSize: String
) {
editUploadStream(videoId: $videoId, videoMetadata: $videoMetadataInput)
}
query GetUploadStreams(
$limit: Int! = 5
$after: String = null
$filters: VideoFilterInput = null
) {
getUserVideos(limit: $limit, after: $after, filters: $filters) {
videos {
id
}
pageInfo {
hasNextPage
endCursor
}
}
}
query GetUploadStreamsWithDetails(
$limit: Int! = 5
$after: String = null
$filters: VideoFilterInput = null
) {
getUserVideos(limit: $limit, after: $after, filters: $filters) {
videos {
id
name
startTime
stream {
isCompleted
lastIntendedSegmentBound
uploadCompletionCursor
}
}
pageInfo {
hasNextPage
endCursor
}
}
terminateUploadStream(
videoId: $videoId
videoName: $videoName
gameType: $gameType
tableSize: $tableSize
)
}

View File

@ -1,51 +1,33 @@
type Query {
getAggregatedShotMetrics(
aggregateInput: AggregateInputGQL!
): [AggregateResultGQL!]!
getBucketSet(keyName: String!): BucketSetGQL
getDeployedConfig: DeployedConfigGQL!
getVideoMakePercentageIntervals(
videoId: ID!
intervalDuration: Int! = 300
): [MakePercentageIntervalGQL!]!
getShots(filterInput: FilterInput!): [ShotGQL!]!
getAggregateShots(bucketSets: [BucketSetInputGQL!]!): [AggregateResultGQL!]!
getUser(userId: Int!): UserGQL
getLoggedInUser: UserGQL
getPlayTime(userId: Int!): UserPlayTimeGQL!
getUserVideos(
userId: Int = null
limit: Int! = 5
after: String = null
filters: VideoFilterInput = null
): VideoHistoryGQL!
getVideo(videoId: Int!): VideoGQL!
getVideos(videoIds: [Int!]!): [VideoGQL!]!
getShots(filterInput: FilterInput = null): [ShotGQL!]!
getBucketSet(keyName: String!): BucketSetGQL
getVideoFeedForUser(first: Int! = 5, after: String = null): VideoFeedGQL!
}
type AggregateResultGQL {
aggregationIdentifiers: [AggregationIdentifierGQL!]!
targetMetrics: TargetMetricsGQL!
featureBuckets: [BucketGQL!]!
targetMetrics: [TargetMetricGQL!]!
}
type AggregationIdentifierGQL {
featureName: String!
groupName: String!
type BucketGQL {
rangeKey: String!
lowerBound: Float!
}
type TargetMetricsGQL {
count: Int!
type TargetMetricGQL {
count: Int
makePercentage: Float
averageDifficulty: Float
floatFeature: TargetFloatFeatureGQL
}
input AggregateInputGQL {
aggregations: [AggregationInput!]!
filterInput: FilterInput
}
input AggregationInput {
bucketSet: BucketSetInputGQL = null
enum: EnumAggregation = null
type TargetFloatFeatureGQL {
featureName: String!
average: Float
median: Float
}
input BucketSetInputGQL {
@ -58,37 +40,68 @@ input BucketInputGQL {
lowerBound: Float!
}
input EnumAggregation {
feature: String!
type UserGQL {
id: Int!
firebaseUid: String!
username: String!
createdAt: DateTime
updatedAt: DateTime
statistics: UserStatisticsGQL!
}
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
"""Date with time (isoformat)"""
scalar DateTime
type UserStatisticsGQL {
totalShots: Int!
totalShotsMade: Int!
makePercentage: Decimal!
averageTimeBetweenShots: Decimal!
timeSpentPlaying: Decimal!
medianRun: Decimal
}
input AndFilter {
filters: [FilterInput!]!
"""Decimal (fixed-point)"""
scalar Decimal
type VideoGQL {
id: Int!
name: String
totalShotsMade: Int!
totalShots: Int!
makePercentage: Float!
medianRun: Float
averageTimeBetweenShots: Float
createdAt: DateTime
updatedAt: DateTime
shots: [ShotGQL!]!
startTime: DateTime
endTime: DateTime
elapsedTime: Float
framesPerSecond: Int!
stream: UploadStreamGQL
}
input OrFilter {
filters: [FilterInput!]!
type ShotGQL {
id: Int
videoId: Int
startFrame: Int
endFrame: Int
createdAt: DateTime
updatedAt: DateTime
features: ShotFeaturesGQL
cueObjectFeatures: CueObjectFeaturesGQL
pocketingIntentionFeatures: PocketingIntentionFeaturesGQL
}
input RangeFilter {
lessThan: Float = null
greaterThanEqualTo: Float = null
type ShotFeaturesGQL {
cueObjectAngle: Float
cueObjectDistance: Float
targetPocketDistance: Float
intendedPocket: PocketEnum
cueBallSpeed: Float
shotDirection: ShotDirectionEnum
bank: BankFeaturesGQL
}
enum PocketEnum {
@ -102,56 +115,17 @@ enum ShotDirectionEnum {
STRAIGHT
}
input VideoTagInput {
tagClasses: [VideoTagClassInput!]! = []
name: String!
type BankFeaturesGQL {
wallsHit: [WallTypeEnum!]!
bankAngle: Float!
distance: Float!
}
input VideoTagClassInput {
name: String!
enum WallTypeEnum {
LONG
SHORT
}
type BucketSetGQL {
keyName: String!
feature: String!
buckets: [BucketGQL!]!
}
type BucketGQL {
rangeKey: String!
lowerBound: Float!
}
type DeployedConfigGQL {
allowNewUsers: Boolean!
firebase: Boolean!
devMode: Boolean!
environment: String!
}
type MakePercentageIntervalGQL {
makePercentage: Float!
elapsedTime: Float!
}
type ShotGQL {
id: Int!
videoId: Int!
startFrame: Int!
endFrame: Int!
createdAt: DateTime
updatedAt: DateTime
cueObjectFeatures: CueObjectFeaturesGQL
pocketingIntentionFeatures: PocketingIntentionFeaturesGQL
bankFeatures: BankFeaturesGQL
user: UserGQL
}
"""
Date with time (isoformat)
"""
scalar DateTime
type CueObjectFeaturesGQL {
cueObjectDistance: Float
cueObjectAngle: Float
@ -163,144 +137,97 @@ type PocketingIntentionFeaturesGQL {
targetPocketDistance: Float
make: Boolean
intendedPocketType: PocketEnum
difficulty: Float
}
type BankFeaturesGQL {
wallsHit: [WallTypeEnum!]!
bankAngle: Float!
distance: Float!
}
enum WallTypeEnum {
LONG
SHORT
}
type UserGQL {
id: Int!
firebaseUid: String!
username: String!
activeVideoId: Int
profileImageUri: String
createdAt: DateTime
updatedAt: DateTime
}
type UserPlayTimeGQL {
totalSeconds: Float!
}
type VideoHistoryGQL {
videos: [VideoGQL!]!
pageInfo: PageInfoGQL!
}
type VideoGQL {
id: Int!
owner: UserGQL
name: String
screenshotUri: String
totalShotsMade: Int!
totalShots: Int!
makePercentage: Float!
medianRun: Float
averageTimeBetweenShots: Float
createdAt: DateTime
updatedAt: DateTime
shots: [ShotGQL!]!
startTime: DateTime
endTime: DateTime
elapsedTime: Float
framesPerSecond: Float!
stream: UploadStreamGQL
playlist: HLSPlaylistGQL
tags: [VideoTag!]!
homographyHistory: [HomographyInfoGQL!]!
currentProcessing: VideoProcessingGQL
}
type UploadStreamGQL {
id: ID!
linksRequested: Int!
uploadsCompleted: Int!
segmentProcessingCursor: Int!
lastIntendedSegmentBound: Int
isCompleted: Boolean!
lowestUnuploadedSegmentIndex: Int!
uploadCompletionCursor: Int!
errors: [StreamErrorGQL!]!
uploadMetadata: UploadStreamMetadata!
createdAt: DateTime!
updatedAt: DateTime!
segments: [UploadSegmentGQL!]!
}
type StreamErrorGQL {
message: String!
type UploadStreamMetadata {
deviceType: DeviceTypeEnum
osVersion: String
appVersion: String
browserName: String
browserVersion: String
locale: String
timezone: String
networkType: String
ipAddress: String
}
type UploadSegmentGQL {
segmentIndex: Int!
uploaded: Boolean!
valid: Boolean!
endFrameIndex: Int
framesPerSecond: Float
durationsInSeconds: Float
linksRequested: Int!
enum DeviceTypeEnum {
IOS
ANDROID
BROWSER
}
type HLSPlaylistGQL {
videoId: Int!
m3u8Text: String!
segmentDurations: [Float!]!
input FilterInput {
andFilters: AndFilter = null
orFilters: OrFilter = null
cueObjectDistance: CueObjectDistanceInput = null
targetPocketDistance: TargetPocketDistanceInput = null
cueObjectAngle: CueObjectAngleInput = null
cueBallSpeed: CueBallSpeedInput = null
intendedPocketType: IntendedPocketTypeInput = null
shotDirection: ShotDirectionInput = null
}
type VideoTag {
tagClasses: [VideoTagClass!]!
name: String!
input AndFilter {
filters: [FilterInput!]!
}
type VideoTagClass {
name: String!
input OrFilter {
filters: [FilterInput!]!
}
type HomographyInfoGQL {
frameIndex: Int!
crop: BoundingBoxGQL!
pockets: [BoundingBoxGQL!]!
sourcePoints: PocketPointsGQL!
destPoints: PocketPointsGQL!
input CueObjectDistanceInput {
value: RangeFilter!
}
type BoundingBoxGQL {
left: Float!
top: Float!
width: Float!
height: Float!
input RangeFilter {
lessThan: Float = null
greaterThanEqualTo: Float = null
}
type PocketPointsGQL {
topLeft: IntPoint2D!
topSide: IntPoint2D!
topRight: IntPoint2D!
bottomLeft: IntPoint2D!
bottomSide: IntPoint2D!
bottomRight: IntPoint2D!
input TargetPocketDistanceInput {
value: RangeFilter!
}
type IntPoint2D {
x: Int!
y: Int!
input CueObjectAngleInput {
value: RangeFilter!
}
type VideoProcessingGQL {
errors: [VideoProcessingErrorGQL!]!
input CueBallSpeedInput {
value: RangeFilter!
}
type VideoProcessingErrorGQL {
message: String!
startSegmentIndex: Int
endSegmentIndex: Int
input IntendedPocketTypeInput {
value: EnumFilter!
}
input EnumFilter {
equals: String = null
}
input ShotDirectionInput {
value: EnumFilter!
}
type BucketSetGQL {
keyName: String!
feature: String!
buckets: [BucketGQL!]!
}
type VideoFeedGQL {
videos: [VideoGQL!]!
pageInfo: PageInfoGQL!
}
type PageInfoGQL {
@ -308,22 +235,11 @@ type PageInfoGQL {
endCursor: String
}
input VideoFilterInput {
isStreamCompleted: Boolean = null
requireCursorCompletion: Boolean! = true
}
type Mutation {
createBucketSet(params: CreateBucketSetInput!): BucketSetGQL!
setLoggerLevel(path: String!, level: String!): Boolean!
getProfileImageUploadLink(fileExt: String = ".png"): GetUploadLinkReturn!
editProfileImageUri(profileImageUri: String!): UserGQL!
createUploadStream(
videoMetadata: VideoMetadataInput!
): CreateUploadStreamReturn!
createUploadStream(uploadMetadata: UploadMetadataInput, videoName: String = null): CreateUploadStreamReturn!
getUploadLink(videoId: Int!, segmentIndex: Int!): GetUploadLinkReturn!
editUploadStream(videoId: Int!, videoMetadata: VideoMetadataInput!): Boolean!
deleteVideo(videoId: Int!): Boolean!
terminateUploadStream(videoId: Int!, videoName: String = null, gameType: String = null, tableSize: String = null): Boolean!
}
input CreateBucketSetInput {
@ -332,32 +248,11 @@ input CreateBucketSetInput {
buckets: [BucketInputGQL!]!
}
type GetUploadLinkReturn {
uploadUrl: String!
headers: [Header]!
}
type Header {
key: String!
value: String!
}
type CreateUploadStreamReturn {
videoId: Int!
}
input VideoMetadataInput {
videoName: String = null
startTime: DateTime = null
endTime: DateTime = null
gameType: String = null
tableSize: String = null
uploadStreamMetadataInput: UploadStreamMetadataInput = null
lastIntendedSegmentBound: Int = null
endStream: Boolean! = false
}
input UploadStreamMetadataInput {
input UploadMetadataInput {
deviceType: DeviceTypeEnum = null
osVersion: String = null
appVersion: String = null
@ -369,8 +264,6 @@ input UploadStreamMetadataInput {
ipAddress: String = null
}
enum DeviceTypeEnum {
IOS
ANDROID
BROWSER
type GetUploadLinkReturn {
uploadUrl: String!
}

View File

@ -2548,16 +2548,6 @@ picomatch@^2.3.1:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
prettier-plugin-organize-imports@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz#77967f69d335e9c8e6e5d224074609309c62845e"
integrity sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==
prettier@^3.2.5:
version "3.2.5"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"
integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==
promise@^7.1.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"