console/integration-tests/testkit/collections.ts
Dimitri POSTOLOV 1cc2a0adca
Operation Collections in Lab (#1610)
Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
Co-authored-by: Dotan Simha <dotansimha@gmail.com>
2023-06-12 16:56:27 +02:00

204 lines
3.9 KiB
TypeScript

import { graphql } from './gql';
export const FindCollectionQuery = graphql(`
query Collection($selector: TargetSelectorInput!, $id: ID!) {
target(selector: $selector) {
id
documentCollection(id: $id) {
id
name
description
}
}
}
`);
export const CreateCollectionMutation = graphql(`
mutation CreateCollection(
$selector: TargetSelectorInput!
$input: CreateDocumentCollectionInput!
) {
createDocumentCollection(selector: $selector, input: $input) {
error {
message
}
ok {
updatedTarget {
id
documentCollections {
edges {
cursor
node {
id
name
}
}
}
}
collection {
id
name
operations(first: 100) {
edges {
cursor
node {
id
name
}
cursor
}
}
}
}
}
}
`);
export const UpdateCollectionMutation = graphql(`
mutation UpdateCollection(
$selector: TargetSelectorInput!
$input: UpdateDocumentCollectionInput!
) {
updateDocumentCollection(selector: $selector, input: $input) {
error {
message
}
ok {
updatedTarget {
id
documentCollections {
edges {
node {
id
name
}
cursor
}
}
}
collection {
id
name
description
operations(first: 100) {
edges {
cursor
node {
id
name
}
}
}
}
}
}
}
`);
export const DeleteCollectionMutation = graphql(`
mutation DeleteCollection($selector: TargetSelectorInput!, $id: ID!) {
deleteDocumentCollection(selector: $selector, id: $id) {
error {
message
}
ok {
deletedId
updatedTarget {
id
documentCollections {
edges {
cursor
node {
id
}
}
}
}
}
}
}
`);
export const CreateOperationMutation = graphql(`
mutation CreateOperation(
$selector: TargetSelectorInput!
$input: CreateDocumentCollectionOperationInput!
) {
createOperationInDocumentCollection(selector: $selector, input: $input) {
error {
message
}
ok {
operation {
id
name
}
collection {
id
operations {
edges {
cursor
node {
id
}
}
}
}
}
}
}
`);
export const UpdateOperationMutation = graphql(`
mutation UpdateOperation(
$selector: TargetSelectorInput!
$input: UpdateDocumentCollectionOperationInput!
) {
updateOperationInDocumentCollection(selector: $selector, input: $input) {
error {
message
}
ok {
operation {
id
name
query
variables
headers
}
}
}
}
`);
export const DeleteOperationMutation = graphql(`
mutation DeleteOperation($selector: TargetSelectorInput!, $id: ID!) {
deleteOperationInDocumentCollection(selector: $selector, id: $id) {
error {
message
}
ok {
deletedId
updatedTarget {
id
documentCollections {
edges {
cursor
node {
id
operations {
edges {
node {
id
}
cursor
}
}
}
}
}
}
}
}
}
`);