graph builder
This commit is contained in:
parent
3494362744
commit
d6ee853c22
30
index.js
30
index.js
@ -1,7 +1,7 @@
|
|||||||
/** @import * as TYPES from "./types.ts" */
|
/** @import * as TYPES from "./types.ts" */
|
||||||
|
|
||||||
/** @type {TYPES.DeskBuilder} */
|
/** @type {TYPES.GraphBuilder} */
|
||||||
function Desk(parts, ...desks)
|
function Desk(users, roles, parts, ...desks)
|
||||||
{
|
{
|
||||||
for(let id in parts)
|
for(let id in parts)
|
||||||
{
|
{
|
||||||
@ -44,27 +44,19 @@ function Desk(parts, ...desks)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const users = {
|
||||||
|
u1:"seth2"
|
||||||
|
}
|
||||||
|
|
||||||
Desk
|
Desk
|
||||||
(
|
(
|
||||||
|
users,
|
||||||
|
{
|
||||||
|
dev:["Development", "u1"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
p1:"hey",
|
p1:"hey",
|
||||||
p2:"sup"
|
p2:"sup"
|
||||||
},
|
},
|
||||||
["d1", "all", {p2:3}, "p1"]
|
["d1", ["dev"], "all", {p2:3}, "p1"]
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
/** @type {TYPES.UserBuilder} */
|
|
||||||
function User(users, roles)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
User(
|
|
||||||
{
|
|
||||||
u1:"seth"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
r1:["Dev", "u155"]
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"checkJs": true
|
|
||||||
},
|
|
||||||
}
|
|
||||||
22
types.ts
22
types.ts
@ -1,25 +1,17 @@
|
|||||||
type PartBlueprint = string
|
type PartBlueprint = string
|
||||||
|
type UserBlueprint = string
|
||||||
|
|
||||||
export type DeskBuilder=
|
export type GraphBuilder=
|
||||||
<
|
<
|
||||||
|
Users extends Record<string, UserBlueprint>,
|
||||||
|
Roles extends Record<string, [ name:string, ...users:Array<keyof Users>]>,
|
||||||
Parts extends Record<string, PartBlueprint>,
|
Parts extends Record<string, PartBlueprint>,
|
||||||
Desk extends [ name:string, mode:"all"|"one", need:Partial<Record<keyof Parts, number>>, ...make:Array<keyof Parts>]
|
Desk extends [ name:string, roles:Array<keyof Roles>, mode:"all"|"one", need:Partial<Record<keyof Parts, number>>, ...make:Array<keyof Parts>]
|
||||||
>
|
>
|
||||||
(
|
(
|
||||||
|
users:Users,
|
||||||
|
roles:Roles,
|
||||||
parts:Parts,
|
parts:Parts,
|
||||||
...desks:Desk[]
|
...desks:Desk[]
|
||||||
)
|
)
|
||||||
=>void
|
=>void
|
||||||
|
|
||||||
|
|
||||||
type UserBlueprint = string
|
|
||||||
export type UserBuilder=
|
|
||||||
<
|
|
||||||
Users extends Record<string, UserBlueprint>,
|
|
||||||
Roles extends Record<string, [ name:string, ...users:Array<keyof Users>]>
|
|
||||||
>
|
|
||||||
(
|
|
||||||
users:Users,
|
|
||||||
roles:Roles
|
|
||||||
)
|
|
||||||
=>void
|
|
||||||
Loading…
Reference in New Issue
Block a user