better setup
This commit is contained in:
parent
77db64b46d
commit
4e247f3f09
8
app.js
8
app.js
@ -1,6 +1,8 @@
|
|||||||
/** @import * as TYPES from "./graph/graph.d.ts" */
|
/** @import * as TYPES from "./graph.d.ts" */
|
||||||
import * as FSHandle from "./store-directory-handle.js";
|
import * as FSHandle from "./store-directory-handle.js";
|
||||||
|
|
||||||
|
import "./graph.js";
|
||||||
|
|
||||||
import Styles from "./styles.js";
|
import Styles from "./styles.js";
|
||||||
const {DOM, Div, Tag} = Styles;
|
const {DOM, Div, Tag} = Styles;
|
||||||
|
|
||||||
@ -17,10 +19,10 @@ async function LoadHandleFiles()
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const module = await import("./graph/setup.js"+"?bust="+Math.random());
|
await import("./user-data/setup.js"+"?bust="+Math.random());
|
||||||
/** @type {Record<string, TYPES.GraphParts>} */
|
/** @type {Record<string, TYPES.GraphParts>} */
|
||||||
const read = BuildResults;
|
const read = BuildResults;
|
||||||
|
|
||||||
for(const roomKey in read)
|
for(const roomKey in read)
|
||||||
{
|
{
|
||||||
const room = read[roomKey]
|
const room = read[roomKey]
|
||||||
|
|||||||
56
deep/mock-user-folder/setup.d.ts
vendored
Normal file
56
deep/mock-user-folder/setup.d.ts
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
export type User = {name:string, id:string, desk:Set<Desk>};
|
||||||
|
export type Role = {name:string, id:string, user:User[]};
|
||||||
|
export type Desk = {name:string, id:string, need:Part[], time:number[], make:Part[], pass:Map<Pass, Scan>, role:Role[]};
|
||||||
|
export type Pass = {name:string, id:string, path:string, live:boolean, load:()=>Promise<void>, dump:()=>void};
|
||||||
|
export type Part = {name:string, id:string, pass:Map<Pass, {time:number, work:Work[], make:(user:User, data:string)=>Promise<void>}>, need:Desk[], make:Desk[], loop?:boolean};
|
||||||
|
export type Work = [time:number, data:string, user:User];
|
||||||
|
export type Scan = {need_dirty:number[], make_dirty:number[], need_empty:number[], make_empty:number[], due_date?:Date}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export type GraphBuilder=
|
||||||
|
<
|
||||||
|
Users extends Record<string, string>,
|
||||||
|
Roles extends Record<string, [ name:string, ...users:Array<keyof Users>]>,
|
||||||
|
Parts extends Record<string, [ name:string, loop?:"loop"] >,
|
||||||
|
PartKeys = keyof Parts,
|
||||||
|
Desks extends Record<string, [ name:string, roles:Array<keyof Roles>, need:{[K in PartKeys]?: number}, ...make:Array<PartKeys>]>,
|
||||||
|
>
|
||||||
|
(
|
||||||
|
params:{
|
||||||
|
meta?:{name:string},
|
||||||
|
user:Users,
|
||||||
|
role:Roles,
|
||||||
|
part:Parts,
|
||||||
|
desk:Desks,
|
||||||
|
pass:Record<string, [name:string]>,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
=>GraphParts
|
||||||
|
|
||||||
|
|
||||||
|
export type GraphParts = {
|
||||||
|
Desk:Record<string, Desk>,
|
||||||
|
Part:Record<string, Part>,
|
||||||
|
User:Record<string, User>,
|
||||||
|
Role:Record<string, Role>,
|
||||||
|
Pass:Record<string, Pass>
|
||||||
|
Path:string
|
||||||
|
}
|
||||||
|
|
||||||
|
// export type MassBuilder=<Params extends Record<string, GraphParts>>(rooms:Params)=>()=>{
|
||||||
|
// [K in keyof Params]: GraphParts
|
||||||
|
// }
|
||||||
|
|
||||||
|
export type MassBuilder=<Params extends Record<string, GraphParts>>(rooms:Params)=>void
|
||||||
|
|
||||||
|
export type UserPassFile = Record<string, Array<[time:number, data:string, user?:User]>>
|
||||||
|
|
||||||
|
export type Scanner =(desk:Desk, pass:Pass)=>void;
|
||||||
|
|
||||||
|
declare global
|
||||||
|
{
|
||||||
|
const Setup: MassBuilder;
|
||||||
|
const Room: GraphBuilder;
|
||||||
|
const BuildResults: Record<string, GraphParts>
|
||||||
|
}
|
||||||
0
graph/graph.d.ts → graph.d.ts
vendored
0
graph/graph.d.ts → graph.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
/** @import * as TYPES from "./graph.d.ts" */
|
/** @import * as TYPES from "./graph.js" */
|
||||||
import * as FSAccess from "../store-directory-handle.js";
|
import * as FSAccess from "./store-directory-handle.js";
|
||||||
|
|
||||||
export const noop = "no-op";
|
export const noop = "no-op";
|
||||||
|
|
||||||
@ -21,12 +21,12 @@ async function Interceptor(event)
|
|||||||
const pathname = url.pathname.substring(1);
|
const pathname = url.pathname.substring(1);
|
||||||
let parts = pathname.split("/");
|
let parts = pathname.split("/");
|
||||||
|
|
||||||
if(parts[0] == "graph")
|
if(parts[0] == "user-data")
|
||||||
{
|
{
|
||||||
console.log("intercept:", pathname);
|
console.log("intercept:", pathname);
|
||||||
|
|
||||||
const handle = await FSAccess.getDirectoryHandle();
|
const handle = await FSAccess.getDirectoryHandle();
|
||||||
const text = await FSAccess.Read(handle, parts);
|
const text = await FSAccess.Read(handle, parts.slice(1));
|
||||||
if(text)
|
if(text)
|
||||||
{
|
{
|
||||||
console.log("successful intercept:", pathname);
|
console.log("successful intercept:", pathname);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user