Type Parameters

Hierarchy (view full)

Implements

Constructors

Properties

apolloClient: IApolloClient<any>
canSelectReturning?: string
client: IApolloClient<any>
DeepClient: typeof DeepClient = DeepClient
DeepContext: Context<DeepClient<Link<Id>>> = DeepContext
DeepProvider: ((__namedParameters: {
    apolloClient?: IApolloClient<any>;
    children?: any;
    minilinks?: MinilinkCollection<MinilinksGeneratorOptions, Link<Id>>;
    namespace?: string;
    path?: string;
    secret?: string;
    ssl?: boolean;
    token?: string;
    ws?: boolean;
}) => Element) = DeepProvider
defaultDeleteName?: string
defaultInsertName?: string
defaultSelectName?: string
defaultUpdateName?: string
deleteReturning?: string
emitter: EventEmitter<DefaultEventMap>
filesSelectReturning?: string
gql: typeof gql = gql
handleAuth?: ((linkId?: Id, token?: string) => any)
handleOperation?: ((operation: string, query?: any, value?: any, options?: any) => any)
handlersSelectReturning?: string
insertReturning?: string
linkId?: Id
linksSelectReturning?: string
local?: boolean
minilinks: MinilinksResult<L>
namespace?: string
Query: NamedExoticComponent<any>
remote?: boolean
returning?: string
secret?: string
selectorsSelectReturning?: string
selectReturning?: string
silent: boolean
ssl?: boolean
Subscription: NamedExoticComponent<any>
table?: string
token?: string
treeSelectReturning?: string
unsafe?: any
unvertualizeId: ((id: Id) => Id)
updateReturning?: string
useCan: ((objectId: Id | Id[], subjectId: Id | Id[], actionId: Id | Id[]) => {
    data: boolean | void;
    loading: boolean;
    refetch: (() => Promise<boolean>);
})
useDeep: (() => DeepClient<Link<Id>>) = useDeep
useDeepId: ((start: QueryLink | DeepClientStartItem, ...path: DeepClientPathItem[]) => {
    data: Id;
    error?: any;
    loading: boolean;
})
useDeepQuery: (<Table, LL>(query: Exp<Table>, options?: Options<Table>) => {
    data?: LL[];
    error?: any;
    loading: boolean;
    refetch?: (() => Promise<any>);
})
useDeepSubscription: (<Table, LL>(query: Exp<Table>, options?: Options<Table>) => UseDeepSubscriptionResult<LL>)
useId: ((start: QueryLink | DeepClientStartItem, ...path: DeepClientPathItem[]) => {
    data: Id;
    error?: any;
    loading: boolean;
})
useLink: ((link: Id | Link<Id>) => MinilinksLink<Id>)
useLinks: ((...links: (Id | Link<Id>)[]) => MinilinksLink<Id>[])
useLocalApply: ((data: any, name: string) => {
    anomalies?: MinilinkError[];
    data: L[];
    errors?: MinilinkError[];
})
useLocalId: ((start: QueryLink | DeepClientStartItem, ...path: DeepClientPathItem[]) => void | Id)
useLocalQuery: ((query: Exp<"links">, options?: MinilinksQueryOptions<MinilinksQueryOptionAggregate>) => L[])
useLocalSubscription: ((query: Exp<"links">, options?: MinilinksQueryOptions<MinilinksQueryOptionAggregate>) => L[])
useMinilinksApply: ((data: any, name: string) => {
    anomalies?: MinilinkError[];
    data: L[];
    errors?: MinilinkError[];
})
useMinilinksId: ((start: QueryLink | DeepClientStartItem, ...path: DeepClientPathItem[]) => void | Id)
useMinilinksQuery: ((query: Exp<"links">, options?: MinilinksQueryOptions<MinilinksQueryOptionAggregate>) => L[])
useMinilinksSubscription: ((query: Exp<"links">, options?: MinilinksQueryOptions<MinilinksQueryOptionAggregate>) => L[])
useQuery: (<Table, LL>(query: Exp<Table>, options?: Options<Table>) => {
    data?: LL[];
    error?: any;
    loading: boolean;
    refetch?: (() => Promise<any>);
})
useSearch: ((value: string, options?: DeepSearchOptions) => any)
useSubscription: (<Table, LL>(query: Exp<Table>, options?: Options<Table>) => UseDeepSubscriptionResult<LL>)
valuesSelectReturning?: string
ws?: boolean
resolveDependency?: ((path: string) => Promise<any>)

Methods

  • Parameters

    • __namedParameters: {
          context?: Id[];
          execution_provider_id?: number;
          handlerId?: Id;
          isolation_provider_id?: number;
      }
      • Optionalcontext?: Id[]
      • Optionalexecution_provider_id?: number
      • OptionalhandlerId?: Id
      • Optionalisolation_provider_id?: number

    Returns Promise<void | Handler>

  • Type Parameters

    • TTable extends
          | "links"
          | "numbers"
          | "strings"
          | "objects"
          | "can"
          | "selectors"
          | "tree"
          | "handlers"

    Parameters

    Returns any[] | Promise<any[]>

  • Returns {
        return: {
            _contain: {
                relation: string;
                type_id: Id;
            };
            _symbol: {
                relation: string;
                type_id: Id;
            };
            _type: {
                relation: string;
                return: {
                    _contain: {
                        relation: string;
                        type_id: Id;
                    };
                    _symbol: {
                        relation: string;
                        type_id: Id;
                    };
                };
            };
        };
    }

    • return: {
          _contain: {
              relation: string;
              type_id: Id;
          };
          _symbol: {
              relation: string;
              type_id: Id;
          };
          _type: {
              relation: string;
              return: {
                  _contain: {
                      relation: string;
                      type_id: Id;
                  };
                  _symbol: {
                      relation: string;
                      type_id: Id;
                  };
              };
          };
      }
      • _contain: {
            relation: string;
            type_id: Id;
        }
        • relation: string
        • type_id: Id
      • _symbol: {
            relation: string;
            type_id: Id;
        }
        • relation: string
        • type_id: Id
      • _type: {
            relation: string;
            return: {
                _contain: {
                    relation: string;
                    type_id: Id;
                };
                _symbol: {
                    relation: string;
                    type_id: Id;
                };
            };
        }
        • relation: string
        • return: {
              _contain: {
                  relation: string;
                  type_id: Id;
              };
              _symbol: {
                  relation: string;
                  type_id: Id;
              };
          }
          • _contain: {
                relation: string;
                type_id: Id;
            }
            • relation: string
            • type_id: Id
          • _symbol: {
                relation: string;
                type_id: Id;
            }
            • relation: string
            • type_id: Id
  • Await for a promise

    Parameters

    • id: Id

      Id of a link which is processed by a handler

    • options: {
          results: boolean;
      } = ...

      An object with options for the await operation

      • results: boolean

    Returns Promise<any>

    A promise that resolves to the result of the awaited promise

    Let us imagine you have published a package and want to programatically wait until it is published or failed to publish

    await deep.await(
    await deep.id('my-package-name')
    )

    In this case you will await all the promises for 'my-package-name' link

  • Checks whether subjectUds can perform actionIds on objectIds

    Parameters

    • objectIds: Id | Id[]

      A link id or an array of link ids to check whether the subjectUds can perform the actionIds on

    • subjectIds: Id | Id[]

      A link id or an array of link ids to check whether they can perform the actionIds on the objectIds

    • actionIds: Id | Id[]

      A link id or an array of link ids to check whether the subjectUds can perform on the objectIds

    • userIds: Id | Id[] = ...

      A link id or an array of link ids from which perspective the check is performed

    Returns Promise<boolean>

    A promise that resolves to a boolean value indicating whether the subjectUds can perform the actionIds on the objectIds

  • Deletes a value in the database. By default deletes a link in the links table

    Type Parameters

    • TTable extends
          | "links"
          | "numbers"
          | "strings"
          | "objects"

    Parameters

    • exp:
          | string
          | number
          | Id[]
          | (TTable extends "numbers"
              ? BoolExpValue<number>
              : TTable extends "strings"
                  ? BoolExpValue<string>
                  : TTable extends "objects"
                      ? BoolExpValue<object>
                      : TTable extends "can"
                          ? BoolExpCan
                          : TTable extends "selectors"
                              ? BoolExpSelector
                              : TTable extends "tree"
                                  ? BoolExpTree
                                  : TTable extends "handlers"
                                      ? BoolExpHandler
                                      : QueryLink)
    • Optionaloptions: WriteOptions<TTable>

      An object with options for the delete operation

    Returns Promise<DeepClientResult<{
        id: any;
    }[]>>

    A promise that resolves to the deleted object or an array of deleted objects with the fields configured by options.returning which is by default 'id'

    await deep.delete({
    id: 888
    })

    In this case the link with id 888 will be deleted

    await deep.delete({
    type_id: 888
    })

    In this case all the links with type_id 888 will be deleted

    await deep.delete({
    from_id: 888
    })

    In this case all the links with from_id 888 will be deleted

    await deep.delete({
    to_id: 888
    })

    In this case all the links with to_id 888 will be deleted

    await deep.delete({
    string: {
    value: {
    _eq: 'MyString'
    }
    }
    })

    In this case all the links with string value 'MyString' will be deleted

    await deep.delete({
    number: {
    value: {
    _eq: 888
    }
    }
    })

    In this case all the links with number value 888 will be deleted

    await deep.delete({
    object: {
    value: {
    _eq: {
    myFieldKey: "myFieldValue"
    }
    }
    }
    })

    In this case all the links with object value { myFieldName: "myFieldValue" } will be deleted

    await deep.delete({
    link_id: 888
    }, {
    table: 'strings'
    })

    In this case string value of a link with id 888 will be deleted

    await deep.delete({
    link_id: 888
    }, {
    table: 'numbers'
    })

    In this case number value of a link with id 888 will be deleted

    await deep.delete({
    link_id: 888
    }, {
    table: 'objects'
    })

    In this case object value of a link with id 888 will be deleted

  • Parameters

    • __namedParameters: {
          context?: Id[];
          handlerId?: Id;
          input?: any;
          linkId?: Id;
          value?: string;
      }
      • Optionalcontext?: Id[]
      • OptionalhandlerId?: Id
      • Optionalinput?: any
      • OptionallinkId?: Id
      • Optionalvalue?: string

    Returns Promise<{
        data?: any;
        error?: any;
    }>

  • Find id of a link by link name or id and contain values (names) as path items

    Parameters

    Returns Promise<number>

    A promise that resolves to the id of the link

    const corePackageLinkId = await deep.id("@deep-foundation/core")
    
    const userTypeLinkId = await deep.id("@deep-foundation/core", "User")
    
    const myLinkId = await deep.id(deep.linkId, 'My Link Name', 'My Nested Link Name')
    
    const adminLinkId = await deep.id("deep", "admin")
    
  • Find id of a link from minilinks by link name or id and contain values (names) as path items

    Parameters

    Returns Id

    A promise that resolves to the id of the link

    const corePackageLinkId = deep.idLocal("@deep-foundation/core")
    
    const userTypeLinkId = deep.idLocal("@deep-foundation/core", "User")
    
    const myLinkId = deep.idLocal(deep.linkId, 'My Link Name', 'My Nested Link Name')
    
    const adminLinkId = deep.idLocal("deep", "admin")
    
  • This function fetches the corresponding IDs from the Deep for each specified path.

    Parameters

    • Rest...paths: [DeepClientStartItem, ...DeepClientPathItem[]][]

      An array of [start, ...path] tuples. Each tuple specifies a path to a link, where 'start' is the package name or id and ...path further specifies the path to the id using Contain link values (names).

    Returns Promise<any>

    • Returns a Promise that resolves to an object. The object has keys corresponding to the package name or id of each path. The value for each package key is an object where keys are the items in the corresponding path, and the values are the IDs retrieved from the Deep.

    ids

    Will throw an error if the id retrieval fails in this.id() function.

      const ids = await deep.ids([
    ['@deep-foundation/core', 'Package'],
    ['@deep-foundation/core', 'PackageVersion']
    ]);

    // Outputs
    // {
    // "@deep-foundation/core": {
    // "Package": 2,
    // "PackageVersion": 46
    // }
    // }
  • Imports from a library

    Parameters

    • path: string

      A path to import from

    Returns Promise<any>

    A promise that resolves to the imported value

    Is able to import CommoJS and ESModule libraries. This is the recommended way to import from libraries in deep handlers

    async ({deep}) => {
    const importResult = await deep.import("my-lib-name");
    }
  • Inserts a value into the database. By default inserts a link to the links table

    Type Parameters

    • TTable extends
          | "links"
          | "numbers"
          | "strings"
          | "objects"
    • LL = L

    Parameters

    Returns Promise<DeepClientResult<{
        id: any;
    }[]>>

    A promise that resolves to the inserted object or an array of inserted objects with the fields configured by options.returning which is by default 'id'

    If a link already has value you should update its value, not insert

    await deep.insert({
    type_id: await deep.id("@deep-foundation/core", "Type")
    })

    In this case instances of your type will not have from and to

    await deep.insert({
    type_id: await deep.id("@deep-foundation/core", "Type"),
    from_id: await deep.id("@deep-foundation/core", "Package"),
    to_id: await deep.id("@deep-foundation/core", "User")
    })

    In this case instances of your type will must go from instances of Package to instances of User

    await deep.insert({
    type_id: await deep.id("@deep-foundation/core", "Type"),
    from_id: await deep.id("@deep-foundation/core", "Any"),
    to_id: await deep.id("@deep-foundation/core", "Any")
    })

    In this case instances of your type may go from instances of any link to instances of any link without restrictions

    await deep.insert({
    type_id: await deep.id("@deep-foundation/core", "Type"),
    from_id: await deep.id("@deep-foundation/core", "Package"),
    to_id: await deep.id("@deep-foundation/core", "Any")
    })

    In this case instances of your type may go from instances of Package to instances of any link without restrictions

    await deep.insert({
    type_id: await deep.id("@deep-foundation/core", "Type"),
    from_id: await deep.id("@deep-foundation/core", "Any"),
    to_id: await deep.id("@deep-foundation/core", "Package")
    })

    In this case instances of your type may go from instances of any link without restrictions to instances of Package

    await deep.insert({
    link_id: 888,
    value: 'MyString'
    }, {
    table: 'strings'
    })

    Note: If a link already has value you should update its value, not insert

    await deep.insert({
    link_id: 888,
    value: 888
    }, {
    table: 'numbers'
    })

    Note: If a link already has value you should update its value, not insert

    await deep.insert({
    link_id: 888,
    value: {
    myFieldName: 'myFieldValue'
    }
    }, {
    table: 'objects'
    })

    Note: If a link already has value you should update its value, not insert

  • Performs a login operation

    Parameters

    Returns Promise<DeepClientAuthResult>

    A promsie that resolves to the result of the login operation

    const apolloClient = generateApolloClient({
    path: NEXT_PUBLIC_GQL_PATH,
    ssl: true,
    });
    const unloginedDeep = new DeepClient({ apolloClient });
    const guestLoginResult = await unloginedDeep.guest();
    const guestDeep = new DeepClient({ deep: unloginedDeep, ...guestLoginResult });
    const adminLoginResult = await guestDeep.login({
    linkId: await guestDeep.id('deep', 'admin'),
    });
    const deep = new DeepClient({ deep: guestDeep, ...adminLoginResult });
  • Returns a name of a link input that is located in a value of a contain link pointing to the link input

    Parameters

    Returns Promise<string>

    const userTypeLinkId = await deep.id("@deep-foundation/core", "User");
    const userTypeLinkName = await deep.name(userTypeLinkId);
  • Returns a name of a link input that is located in a value of a contain link pointing to the link input according to links stored in minilinks

    Parameters

    Returns string

    const userTypeLinkId = await deep.id("@deep-foundation/core", "User");
    const userTypeLinkName = deep.nameLocal(userTypeLinkId);

    Note: "@deep-foundation/core" package, "User" link, Contain link pointing from "@deep-foundation/core" to "User" must be in minilinks

  • Gets a value from the database. By default gets a link from the links table

    Type Parameters

    • TTable extends
          | "links"
          | "numbers"
          | "strings"
          | "objects"
          | "can"
          | "selectors"
          | "tree"
          | "handlers"
    • LL = L

    Parameters

    • exp: Exp<TTable>

      A filter expression to filter the objects to get

    • Optionaloptions: ReadOptions<TTable>

      An object with options for the select operation

    Returns Promise<DeepClientResult<LL[]>>

    A promise that resolves to the selected object or an array of selected objects with the fields configured by options.returning which is by default 'id'

    await deep.select({
    id: deep.linkId
    })
    await deep.select({
    type_id: {
    _id: ["@deep-foundation/core", "User"]
    }
    })
    await deep.select({
    from_id: deep.linkId
    })
    await deep.select({
    to_id: deep.linkId
    })
    await deep.select({
    string: {
    value: {
    _eq: "MyString"
    }
    }
    })
    await deep.select({
    number: {
    value: {
    _eq: 888
    }
    }
    })
    await deep.select({
    object: {
    value: {
    _eq: {
    myFieldKey: "myFieldValue"
    }
    }
    }
    })
  • Returns a symbol icon of a link input that is located in a value of a Symbol link to type of the link input

    Parameters

    Returns Promise<string>

    const userTypeLinkId = await deep.id("@deep-foundation/core", "User");
    const userTypeLinkSymbol = await deep.symbol(userTypeLinkId);
  • Returns a symbol icon of a link input that is located in a value of a Symbol link to type of the link input according to links stored in minilinks

    Parameters

    Returns string

    const userTypeLinkId = await deep.id("@deep-foundation/core", "User");
    const userTypeLinkSymbol = deep.symbolLocal(userTypeLinkId);
  • Updates a value in the database. By default updates a link in the links table

    Type Parameters

    • TTable extends
          | "links"
          | "numbers"
          | "strings"
          | "objects"

    Parameters

    • exp:
          | string
          | number
          | Id[]
          | (TTable extends "numbers"
              ? BoolExpValue<number>
              : TTable extends "strings"
                  ? BoolExpValue<string>
                  : TTable extends "objects"
                      ? BoolExpValue<object>
                      : TTable extends "can"
                          ? BoolExpCan
                          : TTable extends "selectors"
                              ? BoolExpSelector
                              : TTable extends "tree"
                                  ? BoolExpTree
                                  : TTable extends "handlers"
                                      ? BoolExpHandler
                                      : QueryLink)
    • value: UpdateValue<TTable>

      A value to update the objects with

    • Optionaloptions: WriteOptions<TTable>

      An object with options for the update operation

    Returns Promise<DeepClientResult<{
        id: any;
    }[]>>

    A promise that resolves to the updated object or an array of updated objects with the fields configured by options.returning which is by default 'id'

    await deep.update({
    id: 888
    }, {
    from_id: 1
    })

    In this case from_id will be updated to 1 for link with id 888

    await deep.update({
    id: 888
    }, {
    to_id: 1
    })

    In this case to_id will be updated to 1 for link with id 888

    await deep.update(
    {
    link_id: 888
    },
    {
    value: "MyStringValue"
    },
    {
    table: 'strings'
    }
    )

    In this case string value will be updated to "MyStringValue" for link with id 888

    await deep.update(
    {
    link_id: 888
    },
    {
    value: 888
    },
    {
    table: 'numbers'
    }
    )

    In this case number value will be updated to 888 for link with id 888

    await deep.update(
    {
    link_id: 888
    },
    {
    value: {
    myFieldName: "myFieldValue"
    }
    },
    {
    table: 'numbers'
    }
    )

    In this case number value will be updated to { myFieldName: "myFieldValue" } for link with id 888

MMNEPVFCICPMFPCPTTAAATR