Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(subscriptions): introducing live query support (#399)
- Loading branch information
Showing
70 changed files
with
12,847 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
node7minus | ||
node8plus | ||
examples | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @flow | ||
import { LiveProvider } from "graphile-build"; | ||
import type { PgClass } from "./plugins/PgIntrospectionPlugin"; | ||
|
||
export default class PgLiveProvider extends LiveProvider { | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
constructor(...args: any[]) { | ||
super(...args); | ||
this.namespace = "pg"; | ||
} | ||
|
||
collectionIdentifierIsValid(collectionIdentifier: PgClass) { | ||
return collectionIdentifier && collectionIdentifier.kind === "class"; | ||
} | ||
|
||
recordIdentifierIsValid( | ||
collectionIdentifier: PgClass, | ||
// eslint-disable-next-line flowtype/no-weak-types | ||
recordIdentifier: Array<any> | ||
) { | ||
if (!Array.isArray(recordIdentifier)) return false; | ||
if (!collectionIdentifier.primaryKeyConstraint) return false; | ||
if ( | ||
recordIdentifier.length !== | ||
collectionIdentifier.primaryKeyConstraint.keyAttributes.length | ||
) { | ||
return false; | ||
} | ||
// TODO: more validation would not go amiss | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.