Skip to content

Commit

Permalink
chore: update graphql schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeodor committed May 7, 2024
1 parent aeea5f1 commit 75a3d3a
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 22 deletions.
6 changes: 6 additions & 0 deletions python/src/numerous/generated/graphql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
TextFieldValue,
)
from .input_types import (
AppCreateInfo,
AppSecret,
BuildPushInput,
ElementInput,
ElementSelectInput,
ListElementInput,
Expand Down Expand Up @@ -83,9 +86,12 @@
"AllElementsSessionAllSliderElementGraphContext",
"AllElementsSessionAllTextField",
"AllElementsSessionAllTextFieldGraphContext",
"AppCreateInfo",
"AppSecret",
"AsyncBaseClient",
"AuthRole",
"BaseModel",
"BuildPushInput",
"ButtonValue",
"Client",
"ElementInput",
Expand Down
17 changes: 16 additions & 1 deletion python/src/numerous/generated/graphql/input_types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by ariadne-codegen
# Source: ../shared/schema.gql

from typing import Optional
from typing import List, Optional

from pydantic import Field

Expand All @@ -23,6 +23,12 @@ class NewTool(BaseModel):
manifest: str


class AppCreateInfo(BaseModel):
name: str
display_name: str = Field(alias="displayName")
description: str


class ElementInput(BaseModel):
element_id: str = Field(alias="elementID")
text_value: Optional[str] = Field(alias="textValue", default=None)
Expand All @@ -38,3 +44,12 @@ class ElementSelectInput(BaseModel):

class ListElementInput(BaseModel):
list_element_id: str = Field(alias="listElementID")


class AppSecret(BaseModel):
name: str
base_64_value: str = Field(alias="base64Value")


class BuildPushInput(BaseModel):
secrets: Optional[List["AppSecret"]] = None
96 changes: 75 additions & 21 deletions shared/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ scalar Upload
directive @client on QUERY | FIELD
directive @trackOperation(eventName: String!) on FIELD_DEFINITION
directive @canAccessInvitation on FIELD_DEFINITION
directive @canManageApp on FIELD_DEFINITION

###############################################################################
### Auth
Expand Down Expand Up @@ -33,11 +34,14 @@ enum Role {
type OrganizationMembership {
organization: Organization!
role: Role!
user: User!
}

type User {
id: ID!
fullName: String!
memberships: [OrganizationMembership!]!
email: String!
}

type Query {
Expand All @@ -58,6 +62,7 @@ type Organization {
slug: String!
apps: [App!]!
members: [OrganizationMembership!]!
pendingInvitations: [OrganizationInvitation!]! @hasRole(role: ADMIN)
}

type OrganizationInvitation {
Expand Down Expand Up @@ -118,6 +123,11 @@ union OrganizationInvitationCreateResult =

union OrganizationInvitationAcceptResult = Organization | OrganizationNotFound

union OrganizationInvitationDeleteResult =
| OrganizationInvitation
| OrganizationNotFound
| OrganizationInvitationNotFound

extend type Query {
organization(organizationSlug: ID): OrganizationQueryResult!
@hasRole(role: USER)
Expand All @@ -138,6 +148,9 @@ type Mutation {
organizationInvitationAccept(
invitationId: ID!
): OrganizationInvitationAcceptResult @canAccessInvitation
organizationInvitationDelete(
invitationId: ID!
): OrganizationInvitationDeleteResult @hasRole(role: ADMIN)
}

###############################################################################
Expand All @@ -158,16 +171,6 @@ type Tool {
createdAt: Time!
}

type App {
id: ID!
name: String!
description: String
user: User!
publicUrl: String
sharedUrl: String
createdAt: Time!
}

type PublicTool {
developer: User!
name: String!
Expand Down Expand Up @@ -197,28 +200,70 @@ type ToolDeleteFailure {

union ToolDeleteResult = ToolDeleteSuccess | ToolDeleteFailure

type AppDeploy {
app: App!
buildId: ID!
}

extend type Mutation {
toolCreate(input: NewTool!): Tool! @trackOperation(eventName: "App Create")
toolPublish(id: ID!): Tool! @trackOperation(eventName: "App Publish")
toolUnpublish(id: ID!): Tool! @trackOperation(eventName: "App Unpublish")
toolDelete(id: ID!): ToolDeleteResult!
@trackOperation(eventName: "App Delete")
organizationAppDeploy(
appId: ID!
organizationSlug: ID!
appArchive: Upload!
): AppDeploy! @hasRole(role: USER)
}

###############################################################################
### End of tool management
###############################################################################
###############################################################################
### App management
###############################################################################

type AppDeployment {
id: ID!
name: String!
url: String!
}

type AppVersion {
id: ID!
}

type App {
id: ID!
name: String!
displayName: String!
description: String!
createdBy: User!
createdAt: Time!
defaultDeployment: AppDeployment
}

type AppVersionUploadURL {
url: String!
}

input AppCreateInfo {
name: String!
displayName: String!
description: String!
}

extend type Query {
app(organizationSlug: String!, appName: String!): App @hasRole(role: USER)
}


extend type Mutation {
appCreate(organizationSlug: String!, appData: AppCreateInfo!): App! @hasRole(role: USER)
appVersionCreate(appID: ID!): AppVersion! @canManageApp
appVersionUploadURL(appVersionID: ID!): AppVersionUploadURL! @canManageApp
appDeploy(appVersionID: ID!): AppDeployment! @canManageApp
}

extend type Subscription {
appDeployLogs(appDeploymentID: ID!): LogMessage!
}

###############################################################################
### End of App management
###############################################################################
###############################################################################
### Job management
###############################################################################
Expand Down Expand Up @@ -443,8 +488,17 @@ type BuildEventInfo {

union BuildEvent = BuildEventSuccess | BuildEventFailure | BuildEventInfo

input AppSecret {
name: String!
base64Value: String!
}

input BuildPushInput {
secrets: [AppSecret!]
}

extend type Mutation {
buildPush(file: Upload!, id: ID!): buildConfiguration!
buildPush(file: Upload!, id: ID!, input: BuildPushInput): buildConfiguration!
@trackOperation(eventName: "App Push")
}

Expand Down

0 comments on commit 75a3d3a

Please sign in to comment.