UNPKG

@empirica/tajriba

Version:
1,264 lines (1,262 loc) 396 kB
import { z } from 'zod'; import { createClient as createClient$1, fetchExchange, subscriptionExchange } from '@urql/core'; import 'cross-fetch/polyfill'; import { createClient } from 'graphql-ws'; import WebSocket from 'isomorphic-ws'; import { Observable } from 'rxjs'; import { pipe, subscribe } from 'wonka'; // src/generated/graphql.ts var EventType = /* @__PURE__ */ ((EventType2) => { EventType2["AttributeUpdate"] = "ATTRIBUTE_UPDATE"; EventType2["GroupAdd"] = "GROUP_ADD"; EventType2["LinkAdd"] = "LINK_ADD"; EventType2["ParticipantAdd"] = "PARTICIPANT_ADD"; EventType2["ParticipantConnect"] = "PARTICIPANT_CONNECT"; EventType2["ParticipantConnected"] = "PARTICIPANT_CONNECTED"; EventType2["ParticipantDisconnect"] = "PARTICIPANT_DISCONNECT"; EventType2["ScopeAdd"] = "SCOPE_ADD"; EventType2["StepAdd"] = "STEP_ADD"; EventType2["TransitionAdd"] = "TRANSITION_ADD"; return EventType2; })(EventType || {}); var OrderDirection = /* @__PURE__ */ ((OrderDirection2) => { OrderDirection2["Asc"] = "ASC"; OrderDirection2["Desc"] = "DESC"; return OrderDirection2; })(OrderDirection || {}); var Role = /* @__PURE__ */ ((Role2) => { Role2["Admin"] = "ADMIN"; Role2["Participant"] = "PARTICIPANT"; return Role2; })(Role || {}); var State = /* @__PURE__ */ ((State2) => { State2["Created"] = "CREATED"; State2["Ended"] = "ENDED"; State2["Failed"] = "FAILED"; State2["Paused"] = "PAUSED"; State2["Running"] = "RUNNING"; State2["Terminated"] = "TERMINATED"; return State2; })(State || {}); var StepOrderField = /* @__PURE__ */ ((StepOrderField2) => { StepOrderField2["CreatedAt"] = "CREATED_AT"; StepOrderField2["Duration"] = "DURATION"; StepOrderField2["StartedAt"] = "STARTED_AT"; return StepOrderField2; })(StepOrderField || {}); var AttributesDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "Attributes" }, variableDefinitions: [ { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "scopeID" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } } }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "after" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Cursor" } } }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "first" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "before" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Cursor" } } }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "last" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "attributes" }, arguments: [ { kind: "Argument", name: { kind: "Name", value: "scopeID" }, value: { kind: "Variable", name: { kind: "Name", value: "scopeID" } } }, { kind: "Argument", name: { kind: "Name", value: "after" }, value: { kind: "Variable", name: { kind: "Name", value: "after" } } }, { kind: "Argument", name: { kind: "Name", value: "first" }, value: { kind: "Variable", name: { kind: "Name", value: "first" } } }, { kind: "Argument", name: { kind: "Name", value: "before" }, value: { kind: "Variable", name: { kind: "Name", value: "before" } } }, { kind: "Argument", name: { kind: "Name", value: "last" }, value: { kind: "Variable", name: { kind: "Name", value: "last" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "totalCount" } }, { kind: "Field", name: { kind: "Name", value: "pageInfo" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "hasNextPage" } }, { kind: "Field", name: { kind: "Name", value: "hasPreviousPage" } }, { kind: "Field", name: { kind: "Name", value: "startCursor" } }, { kind: "Field", name: { kind: "Name", value: "endCursor" } } ] } }, { kind: "Field", name: { kind: "Name", value: "edges" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "node" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "createdBy" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "User" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "username" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Service" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Participant" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "identifier" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } } ] } }, { kind: "Field", name: { kind: "Name", value: "private" } }, { kind: "Field", name: { kind: "Name", value: "protected" } }, { kind: "Field", name: { kind: "Name", value: "immutable" } }, { kind: "Field", name: { kind: "Name", value: "ephemeral" } }, { kind: "Field", name: { kind: "Name", value: "deletedAt" } }, { kind: "Field", name: { kind: "Name", value: "key" } }, { kind: "Field", name: { kind: "Name", value: "val" } }, { kind: "Field", name: { kind: "Name", value: "index" } }, { kind: "Field", name: { kind: "Name", value: "current" } }, { kind: "Field", name: { kind: "Name", value: "version" } }, { kind: "Field", name: { kind: "Name", value: "vector" } }, { kind: "Field", name: { kind: "Name", value: "node" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Scope" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "kind" } }, { kind: "Field", name: { kind: "Name", value: "name" } } ] } } ] } } ] } }, { kind: "Field", name: { kind: "Name", value: "cursor" } } ] } } ] } } ] } } ] }; var SetAttributesDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "SetAttributes" }, variableDefinitions: [ { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "input" } }, type: { kind: "NonNullType", type: { kind: "ListType", type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "SetAttributeInput" } } } } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "setAttributes" }, arguments: [ { kind: "Argument", name: { kind: "Name", value: "input" }, value: { kind: "Variable", name: { kind: "Name", value: "input" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "attribute" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "createdBy" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "User" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "username" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Service" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Participant" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "identifier" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } } ] } }, { kind: "Field", name: { kind: "Name", value: "private" } }, { kind: "Field", name: { kind: "Name", value: "protected" } }, { kind: "Field", name: { kind: "Name", value: "immutable" } }, { kind: "Field", name: { kind: "Name", value: "ephemeral" } }, { kind: "Field", name: { kind: "Name", value: "deletedAt" } }, { kind: "Field", name: { kind: "Name", value: "key" } }, { kind: "Field", name: { kind: "Name", value: "val" } }, { kind: "Field", name: { kind: "Name", value: "index" } }, { kind: "Field", name: { kind: "Name", value: "current" } }, { kind: "Field", name: { kind: "Name", value: "version" } }, { kind: "Field", name: { kind: "Name", value: "vector" } }, { kind: "Field", name: { kind: "Name", value: "node" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Scope" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "kind" } }, { kind: "Field", name: { kind: "Name", value: "name" } } ] } } ] } } ] } } ] } } ] } } ] }; var ChangesDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "subscription", name: { kind: "Name", value: "Changes" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "changes" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "done" } }, { kind: "Field", name: { kind: "Name", value: "removed" } }, { kind: "Field", name: { kind: "Name", value: "change" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ScopeChange" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "kind" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StepChange" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "state" } }, { kind: "Field", name: { kind: "Name", value: "since" } }, { kind: "Field", name: { kind: "Name", value: "remaining" } }, { kind: "Field", name: { kind: "Name", value: "elapsed" } }, { kind: "Field", name: { kind: "Name", value: "running" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "AttributeChange" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "nodeID" } }, { kind: "Field", name: { kind: "Name", value: "deleted" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "isNew" } }, { kind: "Field", name: { kind: "Name", value: "index" } }, { kind: "Field", name: { kind: "Name", value: "vector" } }, { kind: "Field", name: { kind: "Name", value: "version" } }, { kind: "Field", name: { kind: "Name", value: "key" } }, { kind: "Field", name: { kind: "Name", value: "val" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ParticipantChange" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } } ] } } ] } } ] } } ] } } ] }; var AddGroupsDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "AddGroups" }, variableDefinitions: [ { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "input" } }, type: { kind: "NonNullType", type: { kind: "ListType", type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "AddGroupInput" } } } } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "addGroups" }, arguments: [ { kind: "Argument", name: { kind: "Name", value: "input" }, value: { kind: "Variable", name: { kind: "Name", value: "input" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "group" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } } ] } } ] } } ] } } ] }; var GroupsDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "Groups" }, variableDefinitions: [ { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "after" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Cursor" } } }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "first" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "before" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Cursor" } } }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "last" } }, type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "groups" }, arguments: [ { kind: "Argument", name: { kind: "Name", value: "after" }, value: { kind: "Variable", name: { kind: "Name", value: "after" } } }, { kind: "Argument", name: { kind: "Name", value: "first" }, value: { kind: "Variable", name: { kind: "Name", value: "first" } } }, { kind: "Argument", name: { kind: "Name", value: "before" }, value: { kind: "Variable", name: { kind: "Name", value: "before" } } }, { kind: "Argument", name: { kind: "Name", value: "last" }, value: { kind: "Variable", name: { kind: "Name", value: "last" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "edges" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "node" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "createdBy" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "User" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "username" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Service" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Participant" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "identifier" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } } ] } } ] } } ] } }, { kind: "Field", name: { kind: "Name", value: "totalCount" } }, { kind: "Field", name: { kind: "Name", value: "pageInfo" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "hasNextPage" } }, { kind: "Field", name: { kind: "Name", value: "hasPreviousPage" } }, { kind: "Field", name: { kind: "Name", value: "startCursor" } }, { kind: "Field", name: { kind: "Name", value: "endCursor" } } ] } } ] } } ] } } ] }; var OnEventDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "subscription", name: { kind: "Name", value: "OnEvent" }, variableDefinitions: [ { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "input" } }, type: { kind: "NamedType", name: { kind: "Name", value: "OnEventInput" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "onEvent" }, arguments: [ { kind: "Argument", name: { kind: "Name", value: "input" }, value: { kind: "Variable", name: { kind: "Name", value: "input" } } } ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "eventID" } }, { kind: "Field", name: { kind: "Name", value: "eventType" } }, { kind: "Field", name: { kind: "Name", value: "done" } }, { kind: "Field", name: { kind: "Name", value: "node" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Participant" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "identifier" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Attribute" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "createdAt" } }, { kind: "Field", name: { kind: "Name", value: "createdBy" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "User" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "username" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Service" } }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "createdAt" } } ] }