Files
speckle-server/packages/server/test/graphql/automate.ts
T
Kristaps Fabians Geikins eff46485c4 feat(server): generalized automate auth code handshake mechanism (#2360)
* feat(server): generalized automate auth code handshake mechanism

* amend API requests to match with changes in https://github.com/specklesystems/speckle-automate/pull/758

* fix test

* integration fix

* deleting auth code on verification

---------

Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2024-06-17 17:12:17 +03:00

129 lines
2.3 KiB
TypeScript

import { gql } from 'apollo-server-express'
export const automateFunctionFragment = gql`
fragment TestAutomateFunction on AutomateFunction {
id
name
repo {
id
owner
name
}
isFeatured
description
logo
releases(limit: 5) {
totalCount
items {
id
versionTag
createdAt
inputSchema
commitId
}
}
automationCount
supportedSourceApps
tags
}
`
export const automationFragment = gql`
fragment TestAutomation on Automation {
id
name
enabled
createdAt
updatedAt
runs {
totalCount
items {
id
trigger {
... on VersionCreatedTrigger {
version {
id
}
model {
id
}
}
}
status
createdAt
updatedAt
functionRuns {
id
status
statusMessage
contextView
function {
id
}
elapsed
results
}
}
}
currentRevision {
id
triggerDefinitions {
... on VersionCreatedTriggerDefinition {
type
model {
id
}
}
}
functions {
parameters
release {
id
function {
id
}
versionTag
createdAt
inputSchema
commitId
}
}
}
}
`
export const getProjectAutomationQuery = gql`
query GetProjectAutomation($projectId: String!, $automationId: String!) {
project(id: $projectId) {
id
automation(id: $automationId) {
...TestAutomation
}
}
}
${automationFragment}
`
export const getAutomateFunctionsQuery = gql`
query GetAutomateFunctions(
$cursor: String
$limit: Int!
$filter: AutomateFunctionsFilter
) {
automateFunctions(cursor: $cursor, limit: $limit, filter: $filter) {
cursor
totalCount
items {
...TestAutomateFunction
}
}
}
${automateFunctionFragment}
`
export const automateValidateAuthCodeQuery = gql`
query AutomateValidateAuthCode($payload: AutomateAuthCodePayloadTest!) {
automateValidateAuthCode(payload: $payload)
}
`