@fonderie/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ interface ITenant {
2
+ id: string;
3
+ slug: string;
4
+ plan: string;
5
+ }
6
+ interface IAuthUser {
7
+ id: string;
8
+ email: string | null;
9
+ phone: string | null;
10
+ suspended: boolean;
11
+ mfaEnabled: boolean;
12
+ deletedAt: Date | null;
13
+ emailVerifiedAt: Date | null;
14
+ loginMethod: 'email' | 'phone' | 'google';
15
+ phoneVerified: boolean;
16
+ mfaPending?: boolean;
17
+ }
18
+ interface IWorkspace {
19
+ id: string;
20
+ name: string;
21
+ isPersonal?: boolean;
22
+ }
23
+ interface ICourierMessage {
24
+ type: string;
25
+ locale?: string;
26
+ recipient: {
27
+ email: string | null;
28
+ phone: string | null;
29
+ deviceToken: string | null;
30
+ };
31
+ data: Record<string, unknown>;
32
+ }
33
+ interface IRouteMatch {
34
+ handler: Middleware;
35
+ params: Record<string, string>;
36
+ }
37
+ interface IRouter {
38
+ match(method: string, path: string): IRouteMatch | null;
39
+ add(method: string, path: string, handler: Middleware): void;
40
+ }
41
+ interface IFonderieContextMeta {
42
+ params?: Record<string, string>;
43
+ body?: unknown;
44
+ workspaceId?: string;
45
+ userId?: string;
46
+ userWorkspaceRoles?: string[];
47
+ message?: ICourierMessage;
48
+ [key: string]: unknown;
49
+ }
50
+ interface IFonderieContext {
51
+ request: Request;
52
+ meta: IFonderieContextMeta;
53
+ readonly tenant: ITenant | null;
54
+ readonly user: IAuthUser | null;
55
+ readonly workspace: IWorkspace | null;
56
+ _router: IRouter;
57
+ }
58
+ type Middleware = (ctx: IFonderieContext, next: () => Promise<Response>) => Promise<Response>;
59
+ interface IFonderieApp {
60
+ use(middleware: Middleware): IFonderieApp;
61
+ register(module: IFonderieModule): IFonderieApp;
62
+ addRoute(method: string, path: string, ...handlers: Middleware[]): void;
63
+ listen(port: number, options?: {
64
+ name?: string;
65
+ version?: string;
66
+ env?: string;
67
+ }): void;
68
+ }
69
+ interface IFonderieModule {
70
+ name: string;
71
+ deps?: string[];
72
+ install(app: IFonderieApp): void | Promise<void>;
73
+ }
74
+
75
+ export type { IAuthUser, ICourierMessage, IFonderieApp, IFonderieContext, IFonderieContextMeta, IFonderieModule, IRouteMatch, IRouter, ITenant, IWorkspace, Middleware };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@fonderie/core",
3
+ "version": "0.1.0",
4
+ "description": "Framework core — request router, middleware pipeline, module system, and shared context types. Every other @fonderie-js package depends on this.",
5
+ "keywords": [
6
+ "fonderie-js",
7
+ "framework",
8
+ "middleware",
9
+ "router",
10
+ "saas",
11
+ "typescript"
12
+ ],
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "engines": {
16
+ "node": ">=20"
17
+ },
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "require": "./dist/index.cjs"
23
+ },
24
+ "./config": {
25
+ "types": "./dist/config.d.ts",
26
+ "import": "./dist/config.js",
27
+ "require": "./dist/config.cjs"
28
+ },
29
+ "./types": {
30
+ "types": "./dist/types.d.ts",
31
+ "import": "./dist/types.js",
32
+ "require": "./dist/types.cjs"
33
+ },
34
+ "./middlewares": {
35
+ "types": "./dist/middlewares/index.d.ts",
36
+ "import": "./dist/middlewares/index.js",
37
+ "require": "./dist/middlewares/index.cjs"
38
+ },
39
+ "./parser": {
40
+ "types": "./dist/parser.d.ts",
41
+ "import": "./dist/parser.js",
42
+ "require": "./dist/parser.cjs"
43
+ },
44
+ "./response": {
45
+ "types": "./dist/response.d.ts",
46
+ "import": "./dist/response.js",
47
+ "require": "./dist/response.cjs"
48
+ }
49
+ },
50
+ "main": "./dist/index.cjs",
51
+ "module": "./dist/index.js",
52
+ "types": "./dist/index.d.ts",
53
+ "scripts": {
54
+ "build": "tsup",
55
+ "dev": "tsup --watch",
56
+ "typecheck": "tsc --noEmit",
57
+ "test": "tsx --test src/__tests__/*.test.ts",
58
+ "lint": "biome lint src",
59
+ "format": "biome format --write src",
60
+ "check": "biome check --write src"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^25.6.0",
64
+ "tsup": "^8.5.1",
65
+ "tsx": "^4.21.0",
66
+ "typescript": "^6.0.3"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ },
71
+ "files": [
72
+ "dist",
73
+ "LICENSE",
74
+ "README.md"
75
+ ],
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "git+https://github.com/fonderie-js/sdk.git",
79
+ "directory": "packages/core"
80
+ },
81
+ "homepage": "https://github.com/fonderie-js/sdk/tree/main/packages/core#readme",
82
+ "bugs": {
83
+ "url": "https://github.com/fonderie-js/sdk/issues"
84
+ }
85
+ }