Type required

// insert link with unuvailable type impossible
await deep.insert({ type_id: 999 });
// throwed error: check constraint of an insert/update permission has failed
hasura_permissions postgresql_trigger
type exists +

Particular links

// Particular (from without to, or to without from) is not allowed.
await deep.insert({ type_id: 1, from_id: 1 });
// throwed error: Particular links is not allowed id: 169, from: 1, to: 0.
hasura_permissions postgresql_trigger
particular links +

Node type

// create new type
const { data: [{ id }] } = await deep.insert({ type_id: 1 });
// type not describe from_id and to_id
// we can insert link of this type without from_id and to_id
await deep.insert({ type_id: id });
// but we cant insert with from_id or to_id
await deep.insert({ type_id: id, from_id: 1, to_id: 1 });
hasura_permissions postgresql_trigger
from is allowed type +
to is allowed type +

Link type

// create new type
const { data: [{ id: A }] } = await deep.insert({ type_id: 1 });
const { data: [{ id: B }] } = await deep.insert({ type_id: 1, from_id: A, to_id: A });
const { data: [{ id: a }] } = await deep.insert({ type_id: A });
// success
const { data: [{ id: b }] } = await deep.insert({ type_id: B, from_id: a, to_id: a });
// success
const { data: [{ id: c }] } = await deep.insert({ type_id: B, from_id: a, to_id: b });
// error
hasura_permissions postgresql_trigger
type conflict +

Any type

['@deep-foundation/core','Any'] can be used for allow any from/to without strict type validation.

const { data: [{ id }] } = await deep.insert({ type_id: 1, from_id: await deep.id('@deep-foundation/core', 'Any'), to_id: await deep.id('@deep-foundation/core', 'Any') });

Union types

Alpha version does not support union types. We add it soon...

Union types allow use multiple OR variants of type for from/ to.

Max id size

JavaScript number max save size 9007199254740991