https://youtu.be/saGuuxJMlaI?t=2806
const userId = 362;
// Create a node-link type with name Example1.
await deep.insert({
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Example1' } },
}
},
});
// Create a node-link type with name Example2.
// It has attached value of String type.
await deep.insert({
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Example2' } },
}
},
out: {
data: {
type_id: await deep.id('@deep-foundation/core', 'Value'),
to_id: await deep.id('@deep-foundation/core', 'String'),
}
}
});
// Create a node-link type with name Human.
// It has attached properties such as age (Number type), gender (String type), and name (String type).
await deep.insert({
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: [
{
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Human' } },
},
{
from_id: await deep.id('@deep-foundation/core', 'Any'),
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Age' } },
}
},
out: {
data: {
type_id: await deep.id('@deep-foundation/core', 'Value'),
to_id: await deep.id('@deep-foundation/core', 'Number'),
}
}
},
{
from_id: await deep.id('@deep-foundation/core', 'Any'),
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Name' } },
}
},
out: {
data: {
type_id: await deep.id('@deep-foundation/core', 'Value'),
to_id: await deep.id('@deep-foundation/core', 'String'),
}
}
},
{
from_id: await deep.id('@deep-foundation/core', 'Any'),
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Gender' } },
}
},
out: {
data: {
type_id: await deep.id('@deep-foundation/core', 'Value'),
to_id: await deep.id('@deep-foundation/core', 'String'),
}
}
},
]
}
});
Write the code using this example for the following command description:
Create Vehicle type.
// Create a node-link type with name Vehicle.
await deep.insert({
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Vehicle' } },
}
},
});
Create a Vehicle type.
It has a NumberOfWheels property.
// Create a node-link type with name Vehicle.
// It has attached properties such as NumberOfWheels (Number type).
await deep.insert({
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: [
{
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Vehicle' } },
},
{
from_id: await deep.id('@deep-foundation/core', 'Any'),
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: userId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'NumberOfWheels' } },
}
},
out: {
data: {
type_id: await deep.id('@deep-foundation/core', 'Value'),
to_id: await deep.id('@deep-foundation/core', 'Number'),
}
}
},
]
}
});
THE END OF CONVERSATION WITH GPT-4
P.S.
It is actually a good practice to contain Value links too (especially in deep packages), be careful to use this code in production environment, for example:
// Create a node-link type with name Example.
// It has attached value of String type.
await deep.insert({
type_id: await deep.id('@deep-foundation/core', 'Type'),
in: {
data: {
from_id: packageId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'Example' } },
}
},
out: {
data: {
type_id: await deep.id('@deep-foundation/core', 'Value'),
to_id: await deep.id('@deep-foundation/core', 'String'),
in: {
data: {
from_id: packageId,
type_id: await deep.id('@deep-foundation/core', 'Contain'),
string: { data: { value: 'exampleValue' } },
}
}
}
}
});
Join the Deep on Discord: https://discord.gg/xcTVRAgH9t (All your questions will be answered)