wip fix
This commit is contained in:
parent
5ad665f260
commit
bd7c021e84
|
|
@ -174,4 +174,5 @@ dist
|
|||
# Finder (MacOS) folder config
|
||||
.DS_Store
|
||||
|
||||
app
|
||||
app/db
|
||||
app/srv
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
node_modules
|
||||
# Keep environment variables out of version control
|
||||
.env
|
||||
|
|
@ -1 +0,0 @@
|
|||
export * from "@prisma/client";
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "db",
|
||||
"dependencies": {
|
||||
"@prisma/client": "5.3.1",
|
||||
"prisma": "^5.3.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
import { PrismaClient } from "@prisma/client";
|
||||
|
|
@ -1,291 +0,0 @@
|
|||
declare module "pkgs/api/_prasi" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(): Promise<void>;
|
||||
};
|
||||
export const getApiEntry: () => any;
|
||||
}
|
||||
declare module "pkgs/api/_web" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(id: string, _: string): Promise<any>;
|
||||
};
|
||||
}
|
||||
declare module "pkgs/utils/dir" {
|
||||
export const dir: (path: string) => string;
|
||||
}
|
||||
declare module "app/db/db" {
|
||||
|
||||
}
|
||||
declare module "pkgs/utils/global" {
|
||||
import { Logger } from "pino";
|
||||
import { RadixRouter } from "radix3";
|
||||
import { Database } from "bun:sqlite";
|
||||
type SingleRoute = {
|
||||
url: string;
|
||||
args: string[];
|
||||
fn: (...arg: any[]) => Promise<any>;
|
||||
path: string;
|
||||
};
|
||||
export const g: {
|
||||
|
||||
dburl: string;
|
||||
datadir: string;
|
||||
mode: "dev" | "prod";
|
||||
|
||||
log: Logger;
|
||||
firebaseInit: boolean;
|
||||
firebase: admin.app.App;
|
||||
notif: {
|
||||
db: Database;
|
||||
};
|
||||
api: Record<string, SingleRoute>;
|
||||
domains: null | Record<string, string>;
|
||||
web: Record<string, {
|
||||
site_id: string;
|
||||
current: number;
|
||||
deploying: null | {
|
||||
status: string;
|
||||
received: number;
|
||||
total: number;
|
||||
};
|
||||
deploys: number[];
|
||||
domains: string[];
|
||||
router: null | RadixRouter<{
|
||||
id: string;
|
||||
}>;
|
||||
cacheKey: number;
|
||||
cache: null | {
|
||||
site: {
|
||||
id: string;
|
||||
name: string;
|
||||
favicon: string;
|
||||
domain: string;
|
||||
id_user: string;
|
||||
created_at: Date | null;
|
||||
id_org: string | null;
|
||||
updated_at: Date | null;
|
||||
responsive: string;
|
||||
} | null;
|
||||
pages: {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
content_tree: any;
|
||||
id_site: string;
|
||||
created_at: Date | null;
|
||||
js_compiled: string | null;
|
||||
js: string | null;
|
||||
updated_at: Date | null;
|
||||
id_folder: string | null;
|
||||
is_deleted: boolean;
|
||||
}[];
|
||||
npm: {
|
||||
site: Record<string, string>;
|
||||
pages: Record<string, Record<string, string>>;
|
||||
};
|
||||
comps: {
|
||||
id: string;
|
||||
name: string;
|
||||
content_tree: any;
|
||||
created_at: Date | null;
|
||||
updated_at: Date | null;
|
||||
type: string;
|
||||
id_component_group: string | null;
|
||||
props: any;
|
||||
}[];
|
||||
};
|
||||
}>;
|
||||
router: RadixRouter<SingleRoute>;
|
||||
port: number;
|
||||
frm: {
|
||||
js: string;
|
||||
etag: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
declare module "pkgs/server/load-web" {
|
||||
export const loadWeb: () => Promise<void>;
|
||||
export const loadWebCache: (site_id: string, ts: number | string) => Promise<void>;
|
||||
}
|
||||
declare module "pkgs/api/_deploy" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(action: ({
|
||||
type: "check";
|
||||
} | {
|
||||
type: "db-update";
|
||||
url: string;
|
||||
} | {
|
||||
type: "db-pull";
|
||||
} | {
|
||||
type: "restart";
|
||||
} | {
|
||||
type: "domain-add";
|
||||
domain: string;
|
||||
} | {
|
||||
type: "domain-del";
|
||||
domain: string;
|
||||
} | {
|
||||
type: "deploy-del";
|
||||
ts: string;
|
||||
} | {
|
||||
type: "deploy";
|
||||
dlurl: string;
|
||||
} | {
|
||||
type: "deploy-status";
|
||||
} | {
|
||||
type: "redeploy";
|
||||
ts: string;
|
||||
}) & {
|
||||
id_site: string;
|
||||
}): Promise<"ok" | {
|
||||
now: number;
|
||||
current: any;
|
||||
deploys: any;
|
||||
domains: any;
|
||||
db: {
|
||||
url: any;
|
||||
};
|
||||
} | {
|
||||
now: number;
|
||||
current: any;
|
||||
deploys: any;
|
||||
domains?: undefined;
|
||||
db?: undefined;
|
||||
}>;
|
||||
};
|
||||
export const downloadFile: (url: string, filePath: string, progress?: (rec: number, total: number) => void) => Promise<boolean>;
|
||||
}
|
||||
declare module "pkgs/api/_upload" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(body: any): Promise<string>;
|
||||
};
|
||||
}
|
||||
declare module "pkgs/server/serve-web" {
|
||||
export const serveWeb: (url: URL, req: Request) => Promise<false | string[] | Response>;
|
||||
export const generateIndexHtml: (base_url: string, site_id: string) => string;
|
||||
}
|
||||
declare module "pkgs/api/_file" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(): Promise<Response>;
|
||||
};
|
||||
}
|
||||
declare module "pkgs/api/_notif" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(action: string, data: {
|
||||
type: "register";
|
||||
token: string;
|
||||
id: string;
|
||||
} | {
|
||||
type: "send";
|
||||
id: string;
|
||||
body: string;
|
||||
title: string;
|
||||
data?: any;
|
||||
}): Promise<{
|
||||
result: string;
|
||||
error?: undefined;
|
||||
totalDevice?: undefined;
|
||||
} | {
|
||||
error: string;
|
||||
result?: undefined;
|
||||
totalDevice?: undefined;
|
||||
} | {
|
||||
result: string;
|
||||
totalDevice: any;
|
||||
error?: undefined;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
declare module "pkgs/api/_api_frm" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(): Promise<void>;
|
||||
};
|
||||
}
|
||||
declare module "pkgs/api/_proxy" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(arg: {
|
||||
url: string;
|
||||
method: "POST" | "GET";
|
||||
headers: any;
|
||||
body: any;
|
||||
}): Promise<Response>;
|
||||
};
|
||||
}
|
||||
declare module "pkgs/api/_dbs" {
|
||||
export const _: {
|
||||
url: string;
|
||||
api(dbName: any, action?: string): Promise<void>;
|
||||
};
|
||||
}
|
||||
declare module "app/srv/exports" {
|
||||
export const _web: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: string[];
|
||||
handler: Promise<typeof import("pkgs/api/_web")>;
|
||||
};
|
||||
export const _deploy: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: string[];
|
||||
handler: Promise<typeof import("pkgs/api/_deploy")>;
|
||||
};
|
||||
export const _upload: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: string[];
|
||||
handler: Promise<typeof import("pkgs/api/_upload")>;
|
||||
};
|
||||
export const _prasi: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: any[];
|
||||
handler: Promise<typeof import("pkgs/api/_prasi")>;
|
||||
};
|
||||
export const _file: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: any[];
|
||||
handler: Promise<typeof import("pkgs/api/_file")>;
|
||||
};
|
||||
export const _notif: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: string[];
|
||||
handler: Promise<typeof import("pkgs/api/_notif")>;
|
||||
};
|
||||
export const _api_frm: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: any[];
|
||||
handler: Promise<typeof import("pkgs/api/_api_frm")>;
|
||||
};
|
||||
export const _proxy: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: string[];
|
||||
handler: Promise<typeof import("pkgs/api/_proxy")>;
|
||||
};
|
||||
export const _dbs: {
|
||||
name: string;
|
||||
url: string;
|
||||
path: string;
|
||||
args: string[];
|
||||
handler: Promise<typeof import("pkgs/api/_dbs")>;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
export const _web = {
|
||||
name: "_web",
|
||||
url: "/_web/:id/**",
|
||||
path: "app/srv/api/_web.ts",
|
||||
args: ["id","_"],
|
||||
handler: import("../../pkgs/api/_web")
|
||||
}
|
||||
export const _deploy = {
|
||||
name: "_deploy",
|
||||
url: "/_deploy",
|
||||
path: "app/srv/api/_deploy.ts",
|
||||
args: ["action"],
|
||||
handler: import("../../pkgs/api/_deploy")
|
||||
}
|
||||
export const _upload = {
|
||||
name: "_upload",
|
||||
url: "/_upload",
|
||||
path: "app/srv/api/_upload.ts",
|
||||
args: ["body"],
|
||||
handler: import("../../pkgs/api/_upload")
|
||||
}
|
||||
export const _prasi = {
|
||||
name: "_prasi",
|
||||
url: "/_prasi/**",
|
||||
path: "app/srv/api/_prasi.ts",
|
||||
args: [],
|
||||
handler: import("../../pkgs/api/_prasi")
|
||||
}
|
||||
export const _file = {
|
||||
name: "_file",
|
||||
url: "/_file/**",
|
||||
path: "app/srv/api/_file.ts",
|
||||
args: [],
|
||||
handler: import("../../pkgs/api/_file")
|
||||
}
|
||||
export const _notif = {
|
||||
name: "_notif",
|
||||
url: "/_notif/:action/:token",
|
||||
path: "app/srv/api/_notif.ts",
|
||||
args: ["action","data"],
|
||||
handler: import("../../pkgs/api/_notif")
|
||||
}
|
||||
export const _api_frm = {
|
||||
name: "_api_frm",
|
||||
url: "/_api_frm",
|
||||
path: "app/srv/api/_api_frm.ts",
|
||||
args: [],
|
||||
handler: import("../../pkgs/api/_api_frm")
|
||||
}
|
||||
export const _proxy = {
|
||||
name: "_proxy",
|
||||
url: "/_proxy/*",
|
||||
path: "app/srv/api/_proxy.ts",
|
||||
args: ["arg"],
|
||||
handler: import("../../pkgs/api/_proxy")
|
||||
}
|
||||
export const _dbs = {
|
||||
name: "_dbs",
|
||||
url: "/_dbs/:dbName/:action",
|
||||
path: "app/srv/api/_dbs.ts",
|
||||
args: ["dbName","action"],
|
||||
handler: import("../../pkgs/api/_dbs")
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import { createLogger } from "./utils/logger";
|
|||
import { dirAsync, existsAsync } from "fs-jetpack";
|
||||
import { dir } from "utils/dir";
|
||||
import { $ } from "execa";
|
||||
|
||||
g.mode = process.argv.includes("dev") ? "dev" : "prod";
|
||||
g.datadir = g.mode === "prod" ? "../data" : ".data";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue