Skip to content

Commit

Permalink
feat: added document and rwa modules and interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 committed Feb 7, 2024
1 parent 3aa065e commit bfaede2
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 31 deletions.
75 changes: 66 additions & 9 deletions api/src/graphql/generated/drive/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export interface NexusGenObjects {
nodes: Array<NexusGenRootTypes['Node'] | null>; // [Node]!
slug?: string | null; // String
}
DocumentModelDocument: { // root type
content: string; // String!
id: string; // String!
name: string; // String!
type: string; // String!
}
DriveSystem: {};
Listener: { // root type
block: boolean; // Boolean!
Expand Down Expand Up @@ -149,7 +155,12 @@ export interface NexusGenObjects {
type: string; // String!
}
Query: {};
ServerSystem: {};
RwaDocument: { // root type
field1: string; // String!
id: string; // String!
name: string; // String!
type: string; // String!
}
Session: { // root type
allowedOrigins?: string | null; // String
createdAt: NexusGenScalars['Date']; // Date!
Expand All @@ -172,6 +183,7 @@ export interface NexusGenObjects {
operations: NexusGenRootTypes['OperationUpdate'][]; // [OperationUpdate!]!
scope: string; // String!
}
SwitchboardHost: {};
Sync: {};
User: { // root type
address: string; // String!
Expand All @@ -180,7 +192,8 @@ export interface NexusGenObjects {
}

export interface NexusGenInterfaces {
System: NexusGenRootTypes['DriveSystem'] | NexusGenRootTypes['ServerSystem'];
Document: NexusGenRootTypes['DocumentModelDocument'] | NexusGenRootTypes['RwaDocument'];
System: NexusGenRootTypes['DriveSystem'] | NexusGenRootTypes['SwitchboardHost'];
}

export interface NexusGenUnions {
Expand All @@ -207,6 +220,12 @@ export interface NexusGenFieldTypes {
nodes: Array<NexusGenRootTypes['Node'] | null>; // [Node]!
slug: string | null; // String
}
DocumentModelDocument: { // field return type
content: string; // String!
id: string; // String!
name: string; // String!
type: string; // String!
}
DriveSystem: { // field return type
auth: NexusGenRootTypes['Auth'] | null; // Auth
sync: NexusGenRootTypes['Sync'] | null; // Sync
Expand Down Expand Up @@ -264,11 +283,15 @@ export interface NexusGenFieldTypes {
type: string; // String!
}
Query: { // field return type
document: NexusGenRootTypes['Document'] | null; // Document
drive: NexusGenRootTypes['DocumentDriveState'] | null; // DocumentDriveState
system: NexusGenRootTypes['DriveSystem'] | null; // DriveSystem
}
ServerSystem: { // field return type
auth: NexusGenRootTypes['Auth'] | null; // Auth
RwaDocument: { // field return type
field1: string; // String!
id: string; // String!
name: string; // String!
type: string; // String!
}
Session: { // field return type
allowedOrigins: string | null; // String
Expand All @@ -292,13 +315,21 @@ export interface NexusGenFieldTypes {
operations: NexusGenRootTypes['OperationUpdate'][]; // [OperationUpdate!]!
scope: string; // String!
}
SwitchboardHost: { // field return type
auth: NexusGenRootTypes['Auth'] | null; // Auth
}
Sync: { // field return type
strands: Array<NexusGenRootTypes['StrandUpdate'] | null> | null; // [StrandUpdate]
}
User: { // field return type
address: string; // String!
createdAt: NexusGenScalars['Date']; // Date!
}
Document: { // field return type
id: string; // String!
name: string; // String!
type: string; // String!
}
System: { // field return type
auth: NexusGenRootTypes['Auth'] | null; // Auth
}
Expand All @@ -321,6 +352,12 @@ export interface NexusGenFieldTypeNames {
nodes: 'Node'
slug: 'String'
}
DocumentModelDocument: { // field return type name
content: 'String'
id: 'String'
name: 'String'
type: 'String'
}
DriveSystem: { // field return type name
auth: 'Auth'
sync: 'Sync'
Expand Down Expand Up @@ -378,11 +415,15 @@ export interface NexusGenFieldTypeNames {
type: 'String'
}
Query: { // field return type name
document: 'Document'
drive: 'DocumentDriveState'
system: 'DriveSystem'
}
ServerSystem: { // field return type name
auth: 'Auth'
RwaDocument: { // field return type name
field1: 'String'
id: 'String'
name: 'String'
type: 'String'
}
Session: { // field return type name
allowedOrigins: 'String'
Expand All @@ -406,13 +447,21 @@ export interface NexusGenFieldTypeNames {
operations: 'OperationUpdate'
scope: 'String'
}
SwitchboardHost: { // field return type name
auth: 'Auth'
}
Sync: { // field return type name
strands: 'StrandUpdate'
}
User: { // field return type name
address: 'String'
createdAt: 'Date'
}
Document: { // field return type name
id: 'String'
name: 'String'
type: 'String'
}
System: { // field return type name
auth: 'Auth'
}
Expand Down Expand Up @@ -447,6 +496,11 @@ export interface NexusGenArgTypes {
signature: string; // String!
}
}
Query: {
document: { // args
id: string; // String!
}
}
Sync: {
strands: { // args
listenerId?: string | null; // ID
Expand All @@ -456,12 +510,15 @@ export interface NexusGenArgTypes {
}

export interface NexusGenAbstractTypeMembers {
System: "DriveSystem" | "ServerSystem"
Document: "DocumentModelDocument" | "RwaDocument"
System: "DriveSystem" | "SwitchboardHost"
}

export interface NexusGenTypeInterfaces {
DocumentModelDocument: "Document"
DriveSystem: "System"
ServerSystem: "System"
RwaDocument: "Document"
SwitchboardHost: "System"
}

export type NexusGenObjectNames = keyof NexusGenObjects;
Expand All @@ -478,7 +535,7 @@ export type NexusGenUnionNames = never;

export type NexusGenObjectsUsingAbstractStrategyIsTypeOf = never;

export type NexusGenAbstractsUsingStrategyResolveType = "System";
export type NexusGenAbstractsUsingStrategyResolveType = "Document" | "System";

export type NexusGenFeaturesConfig = {
abstractTypeStrategies: {
Expand Down
25 changes: 23 additions & 2 deletions api/src/graphql/generated/drive/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ type Challenge {
"""Date custom scalar type"""
scalar Date

interface Document {
id: String!
name: String!
type: String!
}

type DocumentDriveState {
icon: String
id: ID!
Expand All @@ -24,6 +30,13 @@ type DocumentDriveState {
slug: String
}

type DocumentModelDocument implements Document {
content: String!
id: String!
name: String!
type: String!
}

type DriveSystem implements System {
auth: Auth
sync: Sync
Expand Down Expand Up @@ -122,12 +135,16 @@ type OperationUpdate {
}

type Query {
document(id: String!): Document
drive: DocumentDriveState
system: DriveSystem
}

type ServerSystem implements System {
auth: Auth
type RwaDocument implements Document {
field1: String!
id: String!
name: String!
type: String!
}

type Session {
Expand Down Expand Up @@ -161,6 +178,10 @@ type StrandUpdate {
scope: String!
}

type SwitchboardHost implements System {
auth: Auth
}

type Sync {
strands(listenerId: ID, since: Date): [StrandUpdate]
}
Expand Down
24 changes: 12 additions & 12 deletions api/src/graphql/generated/index/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export interface NexusGenObjects {
parentFolder?: string | null; // String
}
Query: {};
ServerSystem: {};
Session: { // root type
allowedOrigins?: string | null; // String
createdAt: NexusGenScalars['Date']; // Date!
Expand All @@ -116,14 +115,15 @@ export interface NexusGenObjects {
session: NexusGenRootTypes['Session']; // Session!
token: string; // String!
}
SwitchboardHost: {};
User: { // root type
address: string; // String!
createdAt: NexusGenScalars['Date']; // Date!
}
}

export interface NexusGenInterfaces {
System: NexusGenRootTypes['ServerSystem'];
System: NexusGenRootTypes['SwitchboardHost'];
}

export interface NexusGenUnions {
Expand Down Expand Up @@ -175,10 +175,7 @@ export interface NexusGenFieldTypes {
}
Query: { // field return type
drives: Array<string | null> | null; // [String]
system: NexusGenRootTypes['ServerSystem'] | null; // ServerSystem
}
ServerSystem: { // field return type
auth: NexusGenRootTypes['Auth'] | null; // Auth
system: NexusGenRootTypes['SwitchboardHost'] | null; // SwitchboardHost
}
Session: { // field return type
allowedOrigins: string | null; // String
Expand All @@ -195,6 +192,9 @@ export interface NexusGenFieldTypes {
session: NexusGenRootTypes['Session']; // Session!
token: string; // String!
}
SwitchboardHost: { // field return type
auth: NexusGenRootTypes['Auth'] | null; // Auth
}
User: { // field return type
address: string; // String!
createdAt: NexusGenScalars['Date']; // Date!
Expand Down Expand Up @@ -246,10 +246,7 @@ export interface NexusGenFieldTypeNames {
}
Query: { // field return type name
drives: 'String'
system: 'ServerSystem'
}
ServerSystem: { // field return type name
auth: 'Auth'
system: 'SwitchboardHost'
}
Session: { // field return type name
allowedOrigins: 'String'
Expand All @@ -266,6 +263,9 @@ export interface NexusGenFieldTypeNames {
session: 'Session'
token: 'String'
}
SwitchboardHost: { // field return type name
auth: 'Auth'
}
User: { // field return type name
address: 'String'
createdAt: 'Date'
Expand Down Expand Up @@ -301,11 +301,11 @@ export interface NexusGenArgTypes {
}

export interface NexusGenAbstractTypeMembers {
System: "ServerSystem"
System: "SwitchboardHost"
}

export interface NexusGenTypeInterfaces {
ServerSystem: "System"
SwitchboardHost: "System"
}

export type NexusGenObjectNames = keyof NexusGenObjects;
Expand Down
10 changes: 5 additions & 5 deletions api/src/graphql/generated/index/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ type Node {

type Query {
drives: [String]
system: ServerSystem
}

type ServerSystem implements System {
auth: Auth
system: SwitchboardHost
}

type Session {
Expand All @@ -95,6 +91,10 @@ type SessionOutput {
token: String!
}

type SwitchboardHost implements System {
auth: Auth
}

interface System {
auth: Auth
}
Expand Down
11 changes: 9 additions & 2 deletions api/src/graphql/server/drive/schema.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import * as path from 'path';
import { connectionPlugin, fieldAuthorizePlugin, makeSchema } from 'nexus/dist';
import { connectionPlugin, fieldAuthorizePlugin, makeSchema, nonNull, queryField, unionType } from 'nexus/dist';
import { validationPlugin } from 'nexus-validation-plugin';
import { applyMiddleware } from 'graphql-middleware';
import { GQLDateBase } from './dateSchema';
import * as driveResolver from '../../../modules/drive';
import * as systemResolver from '../../../modules/system';
import * as documentResolver from '../../../modules/document';
import * as rwaDocumentResolver from '../../../modules/rwa';
import { getExtraResolvers } from '../../../importedModules';

/* istanbul ignore next @preserve */
export const schema = makeSchema({
types: {
GQLDateBase, ...systemResolver, ...driveResolver, ...getExtraResolvers(),
GQLDateBase,
...systemResolver,
...driveResolver,
...documentResolver,
...rwaDocumentResolver,
...getExtraResolvers(),
},
plugins: [
fieldAuthorizePlugin({
Expand Down
1 change: 1 addition & 0 deletions api/src/modules/document/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './resolvers';
Loading

0 comments on commit bfaede2

Please sign in to comment.