Class DataSourceWrapper

Hierarchy

  • DataSourceWrapper

Constructors

Methods

  • Creates an edge.

    Type Parameters

    • TCreatedItem = Record<string, any>

    Parameters

    • context: KosmosUserContext<object>

      The context of the user on whose behalf the call is being made.

    • traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>

      Used by traits for non user accessible entities

    • edgeName: string

      The label of the edge that is to be created

    • srcUuid: string
    • srcLabel: undefined | string
    • destUuid: string
    • destLabel: undefined | string
    • properties: Record<string, any>

      The initial data that to be added to the edge

    • unique: boolean

      TRUE to make edge unique

    • Optional validate: boolean

      Used by traits for non user accessible entities. Default is true.

    • Optional executeHooks: boolean

    Returns Promise<TCreatedItem>

  • Runs ACL for the specific action.

    Returns

    Parameters

    • context: KosmosUserContext<object>

      the context of the user who the call is being made on behalf of.

    • label: string

      entiti label

    • uuid: string

      entity ID

    • action: string

      policy action

    • Optional throwError: boolean

      throw an error on forbidden

    Returns Promise<boolean>

  • This function is used to create a vertex

    TODO: Remove data argument, use traitData.args instead since it's the same.

    Type Parameters

    • TCreatedItem = Record<string, any>

    Parameters

    • context: KosmosUserContext<object>

      The context of the user on whose behalf the call is being made.

    • type: string

      The type of vertex that is to be created

    • data: Record<string, any>

      The initial data that to be added to the vertex

    • connectToVertices: ConnectionToAdd[]

      The connections that should be added to the vertex once it has been created.

    • Optional validate: boolean

      Used by traits for non user accessible entities. Default is true.

    • Optional traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>

      Used by traits for non user accessible entities TODO document traitData object.

    • Optional executeHooksArg: boolean

    Returns Promise<TCreatedItem>

  • Deletes an edge.

    Type Parameters

    Parameters

    • context: KosmosUserContext<object>

      The context of the user on whose behalf the call is being made.

    • traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>

      Used by traits for non user accessible entities

    • edgeId: string

      The ID of the edge that is to be deleted

    • Optional validate: boolean

      Used by traits for non user accessible entities. Default is true.

    • Optional executeHooks: boolean

    Returns Promise<{
        done: boolean;
        value: TDeletedItem;
    }>

  • This function is used to delete an entity specified by a uuid.

    Parameters

    • context: KosmosUserContext<object>

      The context of the user on whose behalf the call is being made.

    • type: string

      The type of entity to be deleted.

    • uuid: string

      The uuid of the entity.

    • traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>
    • Optional validate: boolean

      Used by traits for non user accessible entities. Default is true.

    Returns Promise<{
        id?: string;
    }>

  • Returns

    Type Parameters

    Parameters

    • context: KosmosUserContext<object>
    • label: string
    • sourceId: string
    • direction: "in" | "out"
    • edgeProperties: object
    • destinationType: string
    • vertexProperties: object

    Returns Promise<IteratorResult<T, any>>

  • TODO: Document me.

    Returns

    Type Parameters

    Parameters

    • context: KosmosUserContext<object>
    • entityUuid: string
    • edgeName: undefined | string
    • Optional out: boolean
    • Optional properties: object
    • Optional mapElements: boolean

    Returns Promise<IteratorResult<T, any>>

  • Finds a real entity type of the entity.

    Returns the same string as passed in for vertex types, tries to determine a real entity type of vertex if type is a union.

    Returns

    Real entity type

    Parameters

    • context: KosmosUserContext<object>

      the context of the user who the call is being made on behalf of.

    • schemaItemName: undefined | string

      vertex schema type name; could be either real entity type name or union

    • entityId: string

      entity ID

    Returns Promise<undefined | string>

  • This function is used to retrieve a Vertex by its uuid.

    Type Parameters

    Parameters

    • context: KosmosUserContext<object>

      The context of the user on whose behalf the call is being made.

    • uuid: string

      The uuid of the entity

    • Optional includeLabel: boolean

      include the label as part of the response. Default is false.

    • Optional type: string

      The type of the entity being requested (optional)

    • Optional validate: boolean

      Used by traits for non user accessible entities. Default is true.

    • Optional clearCacheFirst: boolean

      Clear cache before running the function (optional). Default is false.

    Returns Promise<null | TRetrievedItem>

  • Returns

    Type Parameters

    Parameters

    • context: KosmosUserContext<object>
    • label: string
    • sourceId: string
    • direction: "in" | "out"
    • edgeProperties: object
    • destinationType: string
    • vertexProperties: object

    Returns Promise<IteratorResult<T, any>>

  • Wrapper for GraphHandler.listEdgesByTypeFromVertex().

    Deprecated

    Use ZeroToManyRelationVertexLoader service

    Returns

    The list of edges.

    Parameters

    • context: KosmosUserContext<object>

      The user context

    • sourceUUID: string

      The source UUID of the entity

    • sourceType: string

      The source type of the entity

    • edgeType: string

      The type of the connecting edge

    • Optional offset: string

      The offset defaults to Constants.DATE_EPOCH.

    • Optional limit: null | number

      The limit defaults to 10

    • Optional destinationType: string

      The type of the destination vertex

    • Optional bypassAccess: boolean

      Used by trait to bypass access default false.

    • Optional filter: LuceneQueryFieldExpression | LuceneQueryNodeExpression<true>

      The evaluated lucene query

    • Optional orderByProperty: string

      Used to define what to filter by ie created /updated date, default is created date.

    • Optional orderBy: FilterOrderDirection

      Used to define what order ie desc or asc

    Returns Promise<GremlinItem[]>

  • Wrapper for GraphHandler.listInverseEdgesByTypeFromVertex().

    Deprecated

    Use ZeroToManyRelationVertexLoader service

    Returns

    The list of edges.

    Parameters

    • context: KosmosUserContext<object>

      The user context

    • sourceUUID: string

      The source UUID of the entity

    • sourceType: string

      The source type of the entity

    • edgeType: string

      The type of the connecting edge

    • Optional offset: string

      The offset defaults to Constants.DATE_EPOCH.

    • Optional limit: null | number

      The limit defaults to 10

    • Optional destinationType: string

      The type of the destination vertex

    • Optional filter: LuceneQueryFieldExpression | LuceneQueryNodeExpression<true>

      The evaluated lucene query

    • Optional orderByProperty: string

      Used to define what to filter by ie created /updated date, default is created date.

    • Optional orderBy: FilterOrderDirection

      Used to define what order ie desc or asc

    Returns Promise<GremlinItem[]>

  • This function is used to get a list of Vertices of a specified type.

    Type Parameters

    Parameters

    • context: KosmosUserContext<object>

      The context of the user on whose behalf the call is being made.

    • type: string

      The entity type of the requested items

    • Optional after: string

      The offset to return from

    • Optional limit: number

      The maximum number of items to return.

    • Optional filter: string

      The lucene search string

    • Optional filterOrder: string

      The property and order to sort by

    • Optional validate: boolean

      Used by traits for non user accessible entities. Default is true.

    • Optional query: CSQL

    Returns Promise<ListResponse<TRetrievedItem>>

  • This function is used to update an existing entity.

    Type Parameters

    • TUpdatedItem = Record<string, any>

    Parameters

    • context: KosmosUserContext<object>

      The context of the user on whose behalf the call is being made.

    • type: string

      The type of entity to be updated.

    • data: Record<string, any>

      The data to update.

    • connectToVertices: ConnectionToAdd[]

      The connections that should be added to the vertex once it's been updated.

    • disconnectFromVertices: ConnectionToRemove[]

      The connections that should be removed from the vertex once it's been updated.

    • traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>
    • Optional validate: boolean

      Used by traits for non user accessible entities. Default is true.

    Returns Promise<null | TUpdatedItem>

Generated using TypeDoc