Class SchemaItem<ItemType>

Type Parameters

Hierarchy

  • SchemaItem

Constructors

Properties

_schemaManager: SchemaManager
edgeHooks: ItemType extends "edge" ? {
    postCreate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postDelete: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postUpdate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    preCreate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    preDelete: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, uuid: string, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    preUpdate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, uuid: string, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
} : null
id: string
label: string
options: SchemaItemAction[]
parents: SchemaItemParent[]
plural: undefined | string
properties: {
    [field: string]: SchemaItemProperty | SchemaItemArrayProperty;
}

Type declaration

propertiesMetadataHooks: {
    finalize: SyncWaterfallHook<[schemaItem: SchemaItem<SchemaItemType>], UnsetAdditionalOptions>;
}

Type declaration

  • finalize: SyncWaterfallHook<[schemaItem: SchemaItem<SchemaItemType>], UnsetAdditionalOptions>

    Called by schema manager before properties metadata is frozen.

    Param

    The schema item.

    Returns

required: string[]
schemaHooks: {
    generateAccessControl: SyncWaterfallHook<[statements: TheStatementSchema], UnsetAdditionalOptions>;
    mutationItemSchema: SyncWaterfallHook<[schemaString: string, source: string, mutationType: MutationForSchemaProperty], UnsetAdditionalOptions>;
    mutationSchema: SyncWaterfallHook<[schemaString: string, source: string, relationship?: null | VertexRelationship], UnsetAdditionalOptions>;
    querySchema: SyncWaterfallHook<[schemaString: string, source: string], UnsetAdditionalOptions>;
    querySchemaGlobal: SyncWaterfallHook<[schemaString: string, source: string, relationship?: null | object], UnsetAdditionalOptions>;
    vertexSchema: SyncWaterfallHook<[schemaString: string, source: string, relationship?: null | object], UnsetAdditionalOptions>;
}

Type declaration

  • generateAccessControl: SyncWaterfallHook<[statements: TheStatementSchema], UnsetAdditionalOptions>

    This hooks enables altering generated entity access rules statements.

    Param

    Automatically generated statements.

    Returns

    • Altered statements.
  • mutationItemSchema: SyncWaterfallHook<[schemaString: string, source: string, mutationType: MutationForSchemaProperty], UnsetAdditionalOptions>

    This is where any GraphQL item mutation schema entries are added by the trait.

    TODO TS: Define correct relationship type.

    Param

    Existing GraphQL schema.

    Param

    String name of the source vertex that the trait is connected to

    Param

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

    Returns

    • GraphQL schema with trait schema appended (or just original schema string).
  • mutationSchema: SyncWaterfallHook<[schemaString: string, source: string, relationship?: null | VertexRelationship], UnsetAdditionalOptions>

    This is where any GraphQL Mutation schema entries are added by the trait.

    TODO TS: Define correct relationship type.

    Param

    Existing GraphQL schema.

    Param

    String name of the source vertex that the trait is connected to

    Param

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

    Returns

    • GraphQL schema with trait schema appended (or just original schema string).
  • querySchema: SyncWaterfallHook<[schemaString: string, source: string], UnsetAdditionalOptions>

    This is where any GraphQL Query schema entries are added by the trait.

    TODO TS: Define correct relationship type.

    Param

    Existing GraphQL schema.

    Param

    String name of the source vertex that the trait is connected to

    Param

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

    Returns

    • GraphQL schema with trait schema appended (or just original schema string).
  • querySchemaGlobal: SyncWaterfallHook<[schemaString: string, source: string, relationship?: null | object], UnsetAdditionalOptions>

    This is where any Global GraphQL Query schema entries are added by the trait.

    TODO TS: Define correct relationship type.

    Param

    Existing GraphQL schema.

    Param

    String name of the source vertex that the trait is connected to

    Param

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

    Returns

    • GraphQL schema with trait schema appended (or just original schema string).
  • vertexSchema: SyncWaterfallHook<[schemaString: string, source: string, relationship?: null | object], UnsetAdditionalOptions>

    This is where any GraphQL vertex schema entries are added by the trait.

    TODO TS: Define correct relationship type.

    Param

    Existing GraphQL schema.

    Param

    String name of the source vertex that the trait is connected to

    Param

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

    Returns

    • GraphQL schema with trait schema appended (or just original schema string).
schema_type: SchemaItemType
traits: TraitConfigBase<string>[]
type: "object"
vertexHooks: ItemType extends "vertex" ? {
    postAddRelationship: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, targetId: string, edge: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postCreate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postDelete: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postRemoveRelationship: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, relationshipData: RelationshipData, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postUpdate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postUpdateRelationship: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, targetId: string, edge: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    postView: AsyncSeriesHook<[item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    preAddRelationship: AsyncSeriesHook<unknown, UnsetAdditionalOptions>;
    preCreate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    preDelete: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, uuid: string, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    preRemoveRelationship: AsyncSeriesHook<unknown, UnsetAdditionalOptions>;
    preUpdate: AsyncSeriesHook<[traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, data: object, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
    preUpdateRelationship: AsyncSeriesHook<unknown, UnsetAdditionalOptions>;
    preView: AsyncSeriesHook<[uuid: string, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>], UnsetAdditionalOptions>;
} : null

Methods

  • Finalizes properties metadata and freezes the object.

    The purpose of freezing is to ensure the metadata is never updated at runtime; if that happens, this would indicate a bug in code.

    Returns void

  • Type Parameters

    • TTrait

    Parameters

    • name: string

    Returns undefined | TTrait

  • Initializes Traits attached to this SchemaItem. Should be called right after the constructor.

    Returns void

Generated using TypeDoc