# Typescript HTTP Driver

## [](#_connection_header)Connection

### [](#_Database)Database

`class`

Fields   

Name

Type

Description

`name`

`string`

### [](#_DriverParams_header)Driver Params

#### [](#_DriverParams)DriverParams

`class`

```typescript
DriverParams: DriverParamsBasic | DriverParamsTranslated
```

#### [](#_DriverParamsBasic)DriverParamsBasic

`class`

Fields   

Name

Type

Description

`addresses`

`string`

`password`

`string`

`username`

`string`

#### [](#_DriverParamsTranslated)DriverParamsTranslated

`class`

Fields   

Name

Type

Description

`password`

`string`

`translatedAddresses`

`TranslatedAddress`

`username`

`string`

### [](#_TransactionOptions)TransactionOptions

`class`

Fields   

Name

Type

Description

`schemaLockAcquireTimeoutMillis`

`number`

`transactionTimeoutMillis`

`number`

### [](#_TransactionType)TransactionType

`class`

```typescript
TransactionType: "read" | "write" | "schema"
```

### [](#_TranslatedAddress)TranslatedAddress

`class`

Fields   

Name

Type

Description

`external`

`string`

`internal`

`string`

### [](#_TypeDBHttpDriver)TypeDBHttpDriver

`class`

#### [](#_TypeDBHttpDriver_TypeDBHttpDriver_params_DriverParams)method `TypeDBHttpDriver`

```typescript
new TypeDBHttpDriver(params: DriverParams): TypeDBHttpDriver
```

Input parameters   

Name

Description

Type

`params`

`DriverParams`

Returns

`TypeDBHttpDriver`

#### [](#_TypeDBHttpDriver_analyze_transactionId_string_query_string_analyzeOptions_AnalyzeOptions)method `analyze`

```typescript
analyze( transactionId: string, query: string, analyzeOptions?: AnalyzeOptions, ): Promise<ApiResponse<AnalyzeResponse>>
```

Input parameters   

Name

Description

Type

`transactionId`

`string`

`query`

`string`

`analyzeOptions`

`AnalyzeOptions`

Returns

`Promise<ApiResponse<AnalyzeResponse>>`

#### [](#_TypeDBHttpDriver_closeTransaction_transactionId_string)method `closeTransaction`

```typescript
closeTransaction(transactionId: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`transactionId`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_commitTransaction_transactionId_string)method `commitTransaction`

```typescript
commitTransaction(transactionId: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`transactionId`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_createDatabase_name_string)method `createDatabase`

```typescript
createDatabase(name: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`name`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_createUser_username_string_password_string)method `createUser`

```typescript
createUser(username: string, password: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`username`

`string`

`password`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_deleteDatabase_name_string)method `deleteDatabase`

```typescript
deleteDatabase(name: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`name`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_deleteUser_username_string)method `deleteUser`

```typescript
deleteUser(username: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`username`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_getCurrentUser_)method `getCurrentUser`

```typescript
getCurrentUser(): Promise<ApiResponse<User>>
```

Returns

`Promise<ApiResponse<User>>`

#### [](#_TypeDBHttpDriver_getDatabase_name_string)method `getDatabase`

```typescript
getDatabase(name: string): Promise<ApiResponse<Database>>
```

Input parameters   

Name

Description

Type

`name`

`string`

Returns

`Promise<ApiResponse<Database>>`

#### [](#_TypeDBHttpDriver_getDatabaseSchema_name_string)method `getDatabaseSchema`

```typescript
getDatabaseSchema(name: string): Promise<ApiResponse<string>>
```

Input parameters   

Name

Description

Type

`name`

`string`

Returns

`Promise<ApiResponse<string>>`

#### [](#_TypeDBHttpDriver_getDatabaseTypeSchema_name_string)method `getDatabaseTypeSchema`

```typescript
getDatabaseTypeSchema(name: string): Promise<ApiResponse<string>>
```

Input parameters   

Name

Description

Type

`name`

`string`

Returns

`Promise<ApiResponse<string>>`

#### [](#_TypeDBHttpDriver_getDatabases_)method `getDatabases`

```typescript
getDatabases(): Promise<ApiResponse<DatabasesListResponse>>
```

Returns

`Promise<ApiResponse<DatabasesListResponse>>`

#### [](#_TypeDBHttpDriver_getServers_)method `getServers`

```typescript
getServers(): Promise<ApiResponse<ServersListResponse>>
```

Returns

`Promise<ApiResponse<ServersListResponse>>`

#### [](#_TypeDBHttpDriver_getUser_username_string)method `getUser`

```typescript
getUser(username: string): Promise<ApiResponse<User>>
```

Input parameters   

Name

Description

Type

`username`

`string`

Returns

`Promise<ApiResponse<User>>`

#### [](#_TypeDBHttpDriver_getUsers_)method `getUsers`

```typescript
getUsers(): Promise<ApiResponse<UsersListResponse>>
```

Returns

`Promise<ApiResponse<UsersListResponse>>`

#### [](#_TypeDBHttpDriver_health_)method `health`

```typescript
health(): Promise<ApiResponse>
```

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_oneShotQuery_query_string_commit_boolean_databaseName_string_transactionType_TransactionType_transactionOptions_TransactionOptions_queryOptions_QueryOptions_givenRows_GivenRows)method `oneShotQuery`

```typescript
oneShotQuery( query: string, commit: boolean, databaseName: string, transactionType: TransactionType, transactionOptions?: TransactionOptions, queryOptions?: QueryOptions, givenRows?: GivenRows, ): Promise<ApiResponse<QueryResponse>>
```

Input parameters   

Name

Description

Type

`query`

`string`

`commit`

`boolean`

`databaseName`

`string`

`transactionType`

`TransactionType`

`transactionOptions`

`TransactionOptions`

`queryOptions`

`QueryOptions`

`givenRows`

`GivenRows`

Returns

`Promise<ApiResponse<QueryResponse>>`

#### [](#_TypeDBHttpDriver_openTransaction_databaseName_string_transactionType_TransactionType_transactionOptions_TransactionOptions)method `openTransaction`

```typescript
openTransaction( databaseName: string, transactionType: TransactionType, transactionOptions?: TransactionOptions, ): Promise<ApiResponse<TransactionOpenResponse>>
```

Input parameters   

Name

Description

Type

`databaseName`

`string`

`transactionType`

`TransactionType`

`transactionOptions`

`TransactionOptions`

Returns

`Promise<ApiResponse<TransactionOpenResponse>>`

#### [](#_TypeDBHttpDriver_query_transactionId_string_query_string_queryOptions_QueryOptions_givenRows_GivenRows)method `query`

```typescript
query( transactionId: string, query: string, queryOptions?: QueryOptions, givenRows?: GivenRows, ): Promise<ApiResponse<QueryResponse>>
```

Input parameters   

Name

Description

Type

`transactionId`

`string`

`query`

`string`

`queryOptions`

`QueryOptions`

`givenRows`

`GivenRows`

Returns

`Promise<ApiResponse<QueryResponse>>`

#### [](#_TypeDBHttpDriver_rollbackTransaction_transactionId_string)method `rollbackTransaction`

```typescript
rollbackTransaction(transactionId: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`transactionId`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_updateUser_username_string_password_string)method `updateUser`

```typescript
updateUser(username: string, password: string): Promise<ApiResponse>
```

Input parameters   

Name

Description

Type

`username`

`string`

`password`

`string`

Returns

`Promise<ApiResponse>`

#### [](#_TypeDBHttpDriver_version_)method `version`

```typescript
version(): Promise<ApiResponse<VersionResponse>>
```

Returns

`Promise<ApiResponse<VersionResponse>>`

### [](#_User)User

`class`

Fields   

Name

Type

Description

`username`

`string`

### [](#_connectionStaticFunctions)Static Functions

`class`

#### [](#_allOrigins_allOrigins_params_DriverParams)method `allOrigins`

```typescript
allOrigins(params: DriverParams): string[]
```

Return all configured origins for connection error fallback.

Input parameters   

Name

Description

Type

`params`

`DriverParams`

Returns

`string[]`

#### [](#_hostPortFromOrigin_hostPortFromOrigin_origin_string)method `hostPortFromOrigin`

```typescript
hostPortFromOrigin(origin: string): string
```

Extract host:port from a URL string. "https://127.0.0.1:18000" → "127.0.0.1:18000"

Input parameters   

Name

Description

Type

`origin`

`string`

Returns

`string`

#### [](#_isBasicParams_isBasicParams_params_DriverParams)method `isBasicParams`

```typescript
isBasicParams(params: DriverParams): params is DriverParamsBasic
```

Input parameters   

Name

Description

Type

`params`

`DriverParams`

Returns

`params is DriverParamsBasic`

#### [](#_isTranslatedParams_isTranslatedParams_params_DriverParams)method `isTranslatedParams`

```typescript
isTranslatedParams(params: DriverParams): params is DriverParamsTranslated
```

Input parameters   

Name

Description

Type

`params`

`DriverParams`

Returns

`params is DriverParamsTranslated`

#### [](#_remoteOrigin_remoteOrigin_params_DriverParams)method `remoteOrigin`

```typescript
remoteOrigin(params: DriverParams): string
```

Input parameters   

Name

Description

Type

`params`

`DriverParams`

Returns

`string`

#### [](#_resolveOrigin_resolveOrigin_params_DriverParams_primaryAddress_string)method `resolveOrigin`

```typescript
resolveOrigin(params: DriverParams, primaryAddress: string): string
```

Resolve an advertised primaryAddress (a full origin) to the matching configured address, else itself.

Input parameters   

Name

Description

Type

`params`

`DriverParams`

`primaryAddress`

`string`

Returns

`string`

## [](#_response_header)Response

### [](#_Answer)Answer

`class`

```typescript
Answer: ConceptRowAnswer | ConceptDocument
```

### [](#_AnswerType)AnswerType

`class`

```typescript
AnswerType: "ok" | "conceptRows" | "conceptDocuments"
```

### [](#_ApiError)ApiError

`class`

Fields   

Name

Type

Description

`code`

`string`

`message`

`string`

### [](#_ApiErrorResponse)ApiErrorResponse

`class`

Fields   

Name

Type

Description

`err`

`ApiError`

`status`

`number`

### [](#_ApiOkResponse_OK_RES)ApiOkResponse<OK\_RES>

`class`

Fields   

Name

Type

Description

`ok`

`OK_RES`

### [](#_ApiResponse_OK_RES)ApiResponse<OK\_RES>

`class`

```typescript
ApiResponse: ApiOkResponse<OK_RES> | ApiErrorResponse
```

### [](#_ConceptDocumentsQueryResponse)ConceptDocumentsQueryResponse

`class`

Fields   

Name

Type

Description

`answerType`

`"conceptDocuments"`

`answers`

`Object`

`comment`

`string`

`query`

`AnalyzedPipeline`

`queryType`

`QueryType`

### [](#_ConceptRow)ConceptRow

`class`

Fields   

Name

Type

Description

`[varName: string]`

`Concept`

### [](#_ConceptRowAnswer)ConceptRowAnswer

`class`

Fields   

Name

Type

Description

`data`

`ConceptRow`

`involvedBlocks`

`number`

### [](#_ConceptRowsQueryResponse)ConceptRowsQueryResponse

`class`

Fields   

Name

Type

Description

`answerType`

`"conceptRows"`

`answers`

`ConceptRowAnswer`

`comment`

`string`

`query`

`AnalyzedPipeline`

`queryType`

`QueryType`

### [](#_DatabasesListResponse)DatabasesListResponse

`class`

Fields   

Name

Type

Description

`databases`

`Database`

### [](#_Distribution)Distribution

`class`

```typescript
Distribution: "TypeDB Cluster" | "TypeDB CE"
```

### [](#_OkQueryResponse)OkQueryResponse

`class`

Fields   

Name

Type

Description

`answerType`

`"ok"`

`comment`

`string`

`query`

`AnalyzedPipeline`

`queryType`

`QueryType`

### [](#_SignInResponse)SignInResponse

`class`

Fields   

Name

Type

Description

`token`

`string`

### [](#_TransactionOpenResponse)TransactionOpenResponse

`class`

Fields   

Name

Type

Description

`transactionId`

`string`

### [](#_UsersListResponse)UsersListResponse

`class`

Fields   

Name

Type

Description

`users`

`User`

### [](#_VersionResponse)VersionResponse

`class`

Fields   

Name

Type

Description

`distribution`

`Distribution`

`version`

`string`

### [](#_responseStaticFunctions)Static Functions

`class`

#### [](#_driverError_driverError_code_string_message_string)method `driverError`

```typescript
driverError(code: string, message: string): ApiErrorResponse
```

Input parameters   

Name

Description

Type

`code`

`string`

`message`

`string`

Returns

`ApiErrorResponse`

#### [](#_isApiError_isApiError_err_any)method `isApiError`

```typescript
isApiError(err: any): err is ApiError
```

Input parameters   

Name

Description

Type

`err`

`any`

Returns

`err is ApiError`

#### [](#_isApiErrorResponse_isApiErrorResponse_res_ApiResponse)method `isApiErrorResponse`

```typescript
isApiErrorResponse(res: ApiResponse): res is ApiErrorResponse
```

Input parameters   

Name

Description

Type

`res`

`ApiResponse`

Returns

`res is ApiErrorResponse`

#### [](#_isMisdirectedError_isMisdirectedError_err_any)method `isMisdirectedError`

```typescript
isMisdirectedError(err: any): err is MisdirectedError
```

Input parameters   

Name

Description

Type

`err`

`any`

Returns

`err is MisdirectedError`

#### [](#_isOkResponse_isOkResponse_res_ApiResponse)method `isOkResponse`

```typescript
isOkResponse<OK_RES>(res: ApiResponse<OK_RES>): res is ApiOkResponse<OK_RES>
```

Input parameters   

Name

Description

Type

`res`

`ApiResponse`

Returns

`res is ApiOkResponse<OK_RES>`

## [](#_concept_header)Concept

### [](#_Attribute)Attribute

`class`

Fields   

Name

Type

Description

`iid`

`string`

`kind`

`"attribute"`

`type`

`AttributeType`

`value`

`any`

`valueType`

`ValueType`

### [](#_AttributeType)AttributeType

`class`

Fields   

Name

Type

Description

`kind`

`"attributeType"`

`label`

`string`

`valueType`

`ValueType`

### [](#_Concept)Concept

`class`

```typescript
Concept: Type | Entity | Relation | Attribute | Value
```

### [](#_ConceptDocument)ConceptDocument

`class`

```typescript
ConceptDocument: Object
```

### [](#_EdgeKind)EdgeKind

`class`

```typescript
EdgeKind:
 | "isa"
 | "has"
 | "links"
 | "sub"
 | "owns"
 | "relates"
 | "plays"
 | "isaExact"
 | "subExact"
 | "assigned"
 | "argument"
```

### [](#_Entity)Entity

`class`

Fields   

Name

Type

Description

`iid`

`string`

`kind`

`"entity"`

`type`

`EntityType`

### [](#_EntityType)EntityType

`class`

Fields   

Name

Type

Description

`kind`

`"entityType"`

`label`

`string`

### [](#_InstantiableType)InstantiableType

`class`

```typescript
InstantiableType: EntityType | RelationType | AttributeType
```

### [](#_Relation)Relation

`class`

Fields   

Name

Type

Description

`iid`

`string`

`kind`

`"relation"`

`type`

`RelationType`

### [](#_RelationType)RelationType

`class`

Fields   

Name

Type

Description

`kind`

`"relationType"`

`label`

`string`

### [](#_RoleType)RoleType

`class`

Fields   

Name

Type

Description

`kind`

`"roleType"`

`label`

`string`

### [](#_ThingKind)ThingKind

`class`

```typescript
ThingKind: "entity" | "relation" | "attribute"
```

### [](#_Type)Type

`class`

```typescript
Type: InstantiableType | RoleType
```

### [](#_TypeKind)TypeKind

`class`

```typescript
TypeKind: "entityType" | "relationType" | "attributeType" | "roleType"
```

### [](#_Value)Value

`class`

Fields   

Name

Type

Description

`kind`

`"value"`

`value`

`any`

`valueType`

`ValueType`

### [](#_ValueKind)ValueKind

`class`

```typescript
ValueKind: "value"
```

### [](#_ValueType)ValueType

`class`

```typescript
ValueType:
 | "boolean"
 | "integer"
 | "double"
 | "decimal"
 | "date"
 | "datetime"
 | "datetime-tz"
 | "duration"
 | "string"
 | "struct"
```

## [](#_analyze_header)Analyze

### [](#_analyzeStaticFunctions)Static Functions

`class`

#### [](#_getVariableName_getVariableName_structure_AnalyzedPipeline_variable_ConstraintVertexVariable)method `getVariableName`

```typescript
getVariableName( structure: AnalyzedPipeline | QueryStructureLegacy, variable: ConstraintVertexVariable, ): string
```

Input parameters   

Name

Description

Type

`structure`

`AnalyzedPipeline`

`variable`

`ConstraintVertexVariable`

Returns

`string`

### [](#_AnalyzeOptions)AnalyzeOptions

`class`

Fields   

Name

Type

Description

`include_plan`

`boolean`

### [](#_AnalyzedConjunction)AnalyzedConjunction

`class`

Fields   

Name

Type

Description

`annotations`

`ConjunctionAnnotations`

`constraints`

`ConstraintAny`

### [](#_AnalyzedFetch)AnalyzedFetch

`class`

```typescript
AnalyzedFetch:
 | { elements: AnalyzedFetch; tag: "list" }
 | { possibleFields: FetchAnnotationFieldEntry[]; tag: "object" }
 | { tag: "value"; valueTypes: ValueType[] }
```

### [](#_AnalyzedFunction)AnalyzedFunction

`class`

Fields   

Name

Type

Description

`argumentAnnotations`

`VariableAnnotations`

`arguments`

`string`

`body`

`AnalyzedPipeline`

`returnAnnotations`

`VariableAnnotations`

`returns`

`FunctionReturnStructure`

### [](#_AnalyzedPipeline)AnalyzedPipeline

`class`

Fields   

Name

Type

Description

`conjunctions`

`AnalyzedConjunction`

`outputs`

`string`

`stages`

`PipelineStage`

`variables`

`string`

### [](#_ConjunctionAnnotations)ConjunctionAnnotations

`class`

Fields   

Name

Type

Description

`variableAnnotations`

`string`

#### [](#_ConstraintAny)ConstraintAny

`class`

```typescript
ConstraintAny:
 | ConstraintIsa
 | ConstraintIsaExact
 | ConstraintHas
 | ConstraintLinks
 | ConstraintSub
 | ConstraintSubExact
 | ConstraintOwns
 | ConstraintRelates
 | ConstraintPlays
 | ConstraintExpression
 | ConstraintFunction
 | ConstraintComparison
 | ConstraintIs
 | ConstraintIid
 | ConstraintKind
 | ConstraintValue
 | ConstraintLabel
 | ConstraintOr
 | ConstraintNot
 | ConstraintTry
```

#### [](#_ConstraintComparison)ConstraintComparison

`class`

Fields   

Name

Type

Description

`comparator`

`string`

`lhs`

`ConstraintVertexVariable`

`rhs`

`ConstraintVertexVariable`

`tag`

`"comparison"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintExpression)ConstraintExpression

`class`

Fields   

Name

Type

Description

`arguments`

`ConstraintVertexVariable`

`assigned`

`ConstraintVertexVariable`

`tag`

`"expression"`

`text`

`string`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintFunction)ConstraintFunction

`class`

Fields   

Name

Type

Description

`arguments`

`ConstraintVertexVariable`

`assigned`

`ConstraintVertexVariable`

`name`

`string`

`tag`

`"functionCall"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintHas)ConstraintHas

`class`

Fields   

Name

Type

Description

`attribute`

`ConstraintVertexVariable`

`owner`

`ConstraintVertexVariable`

`tag`

`"has"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintIid)ConstraintIid

`class`

Fields   

Name

Type

Description

`concept`

`ConstraintVertexVariable`

`iid`

`string`

`tag`

`"iid"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintIs)ConstraintIs

`class`

Fields   

Name

Type

Description

`lhs`

`ConstraintVertexVariable`

`rhs`

`ConstraintVertexVariable`

`tag`

`"is"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintIsa)ConstraintIsa

`class`

Fields   

Name

Type

Description

`instance`

`ConstraintVertexVariable`

`tag`

`"isa"`

`textSpan`

`ConstraintSpan`

`type`

`ConstraintVertexVariable`

#### [](#_ConstraintIsaExact)ConstraintIsaExact

`class`

Fields   

Name

Type

Description

`instance`

`ConstraintVertexVariable`

`tag`

`"isa!"`

`textSpan`

`ConstraintSpan`

`type`

`ConstraintVertexVariable`

#### [](#_ConstraintKind)ConstraintKind

`class`

Fields   

Name

Type

Description

`kind`

`string`

`tag`

`"kind"`

`textSpan`

`ConstraintSpan`

`type`

`ConstraintVertexVariable`

#### [](#_ConstraintLabel)ConstraintLabel

`class`

Fields   

Name

Type

Description

`label`

`string`

`tag`

`"label"`

`textSpan`

`ConstraintSpan`

`type`

`ConstraintVertexVariable`

#### [](#_ConstraintLinks)ConstraintLinks

`class`

Fields   

Name

Type

Description

`player`

`ConstraintVertexVariable`

`relation`

`ConstraintVertexVariable`

`role`

`ConstraintVertexVariable`

`tag`

`"links"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintNot)ConstraintNot

`class`

Fields   

Name

Type

Description

`conjunction`

`number`

`tag`

`"not"`

#### [](#_ConstraintOr)ConstraintOr

`class`

Fields   

Name

Type

Description

`branches`

`number`

`tag`

`"or"`

#### [](#_ConstraintOwns)ConstraintOwns

`class`

Fields   

Name

Type

Description

`attribute`

`ConstraintVertexVariable`

`owner`

`ConstraintVertexVariable`

`tag`

`"owns"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintPlays)ConstraintPlays

`class`

Fields   

Name

Type

Description

`player`

`ConstraintVertexVariable`

`role`

`ConstraintVertexVariable`

`tag`

`"plays"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintRelates)ConstraintRelates

`class`

Fields   

Name

Type

Description

`relation`

`ConstraintVertexVariable`

`role`

`ConstraintVertexVariable`

`tag`

`"relates"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintSub)ConstraintSub

`class`

Fields   

Name

Type

Description

`subtype`

`ConstraintVertexVariable`

`supertype`

`ConstraintVertexVariable`

`tag`

`"sub"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintSubExact)ConstraintSubExact

`class`

Fields   

Name

Type

Description

`subtype`

`ConstraintVertexVariable`

`supertype`

`ConstraintVertexVariable`

`tag`

`"sub!"`

`textSpan`

`ConstraintSpan`

#### [](#_ConstraintTry)ConstraintTry

`class`

Fields   

Name

Type

Description

`conjunction`

`number`

`tag`

`"try"`

#### [](#_ConstraintValue)ConstraintValue

`class`

Fields   

Name

Type

Description

`attributeType`

`ConstraintVertexVariable`

`tag`

`"value"`

`textSpan`

`ConstraintSpan`

`valueType`

`string`

#### [](#_ConstraintSpan)ConstraintSpan

`class`

Fields   

Name

Type

Description

`begin`

`number`

`end`

`number`

#### [](#_ConstraintVertexAny)ConstraintVertexAny

`class`

```typescript
ConstraintVertexAny:
 | ConstraintVertexVariable
 | ConstraintVertexLabel
 | ConstraintVertexValue
 | ConstraintVertexNamedRole
```

#### [](#_ConstraintVertexLabel)ConstraintVertexLabel

`class`

Fields   

Name

Type

Description

`tag`

`"label"`

`type`

`Type`

#### [](#_ConstraintVertexNamedRole)ConstraintVertexNamedRole

`class`

Fields   

Name

Type

Description

`name`

`string`

`tag`

`"namedRole"`

`variable`

`string`

#### [](#_ConstraintVertexValue)ConstraintVertexValue

`class`

Fields   

Name

Type

Description

`kind`

`"value"`

`tag`

`"value"`

`value`

`any`

`valueType`

`ValueType`

#### [](#_ConstraintVertexVariable)ConstraintVertexVariable

`class`

Fields   

Name

Type

Description

`id`

`string`

`tag`

`"variable"`

### [](#_FetchAnnotationFieldEntry)FetchAnnotationFieldEntry

`class`

```typescript
FetchAnnotationFieldEntry: AnalyzedFetch & { key: string }
```

### [](#_FunctionReturnStructure)FunctionReturnStructure

`class`

```typescript
FunctionReturnStructure:
 | {
 selector: FunctionSingleReturnSelector;
 tag: "single";
 variables: VariableId[];
 }
 | { tag: "stream"; variables: VariableId[] }
 | { tag: "check" }
 | { reducers: Reducer[]; tag: "reduce" }
```

### [](#_FunctionSingleReturnSelector)FunctionSingleReturnSelector

`class`

```typescript
FunctionSingleReturnSelector: "first" | "last"
```

### [](#_PipelineStage)PipelineStage

`class`

```typescript
PipelineStage:
 | { block: ConjunctionIndex; tag: "match" }
 | { block: ConjunctionIndex; tag: "insert" }
 | {
 block: ConjunctionIndex;
 deletedVariables: VariableId[];
 tag: "delete";
 }
 | { block: ConjunctionIndex; tag: "put" }
 | { block: ConjunctionIndex; tag: "update" }
 | { tag: "select"; variables: VariableId[] }
 | {
 tag: "sort";
 variables: { tag: "Ascending" | "Descending"; variable: VariableId }[];
 }
 | { tag: "require"; variables: VariableId }
 | { offset: number; tag: "offset" }
 | { limit: number; tag: "limit" }
 | { tag: "distinct" }
 | {
 groupby: VariableId[];
 reducers: { assigned: VariableId; reducer: Reducer }[];
 tag: "reduce";
 }
```

### [](#_Reducer)Reducer

`class`

Fields   

Name

Type

Description

`arguments`

`VariableId`

`reducer`

`string`

### [](#_VariableAnnotations)VariableAnnotations

`class`

```typescript
VariableAnnotations: { isOptional: boolean } & (
 | { annotations: Type[]; tag: "instance" }
 | { annotations: Type[]; tag: "type" }
 | { tag: "value"; valueTypes: ValueType[] }
 )
```

### [](#_VariableId)VariableId

`class`

```typescript
VariableId: string
```

### [](#_VariableInfo)VariableInfo

`class`

Fields   

Name

Type

Description

`name`

`string`

[TypeDB HTTP Drivers](../index.md) [TypeDB Cloud API](../../cloud-http-api/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/reference/modules/ROOT/pages/typedb-http-drivers/typescript.adoc) Edit this page on GitHub.