Class FeedsTrait

Feed Trait adds global GraphQL Feeds query field listing user's feed messages.

Usage:

traits:
- type: feed
sources:
- Manual

The 'sources' configuration option specifies which entity types may be be referenced by an feed message. These will be used to build the FeedSource union type. If omitted, the entity type to which the trait is attached will be used (normally this should be the User entity).

Hierarchy

Constructors

Properties

_config?: FeedTraitConfig

Trait instance configuration.

_global: boolean = false

Whether this is a global (not bound to any specific schema item) trait instance.

_relationship?: null | object
_type?: "feed"

Trait type.

dataSourceWrapper: DataSourceWrapper
graphqlSchemaManager: GraphQLSchemaManager
logger: Logger
schemaManager: SchemaManager
tableName: string

Methods

  • GraphQL resolver to list the user's feed messages.

    Parameters

    Returns Promise<FeedGraphQLResult>

  • This is where any GraphQL mutation entries that are rquired by the trait are added.

    Returns

    The GraphQL schema string, including our additions.

    Parameters

    • schemaString: string

      The original GraphQL schema string.

    Returns string

  • Use the preDelete hook to clean up the deleted user's feed from DynamoDB.

    Todo

    Implement this.

    Parameters

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

      Used by traits for non user accessible entities

    • uuid: string

      The UUID of vertex being deleted.

    • datasourceWrapper: DataSourceWrapper

      Datasource wrapper object.

    • context: KosmosUserContext<object>

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

    Returns Promise<void>

  • This method is triggered when a trait callback has been activated

    Type Parameters

    • RT = any

    • Payload = any

    Parameters

    • callbackName: string

      This is the name of the callback function to call.

    • datasourceWrapper: DataSourceWrapper

      References to the Graph Hanlder

    • data: TraitDataObject<RT, Payload, Promise<any>>

      Request data passed along as part of the request.

    Returns Promise<RT>

  • This method is used to retrieve additions to the GraphQL schema and to register the callbacks associated to the Vertex.

    Returns

    GraphQL schema with trait schema appended.

    Parameters

    • schemaString: string

      Existing GraphQL schema.

    • _source: string

      String name of the source vertex that the trait is connected to (not used here)

    • Optional relationship: null | object

      JSON Object of the relationship, can be null where trait is not attached to a relationship.

    Returns string

  • GraphQL mutation resolver to update the last read position of the user's feed.

    Parameters

    Returns Promise<boolean>

Generated using TypeDoc