@concavejs/runtime-node 0.0.1-alpha.4
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.
Potentially problematic release.
This version of @concavejs/runtime-node might be problematic. Click here for more details.
- package/README.md +85 -0
- package/dist/factory.d.ts +54 -0
- package/dist/factory.js +47381 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +49169 -0
- package/dist/module-loader/fs-module-loader.d.ts +15 -0
- package/dist/server/dev.d.ts +7 -0
- package/dist/server/http-handler.d.ts +12 -0
- package/dist/server/index.d.ts +88 -0
- package/dist/server/index.js +47366 -0
- package/dist/server/sync-handler.d.ts +17 -0
- package/package.json +46 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem Module Loader for Node.js
|
|
3
|
+
*
|
|
4
|
+
* Loads Convex UDF modules from the filesystem with TypeScript support
|
|
5
|
+
*
|
|
6
|
+
* Note: TypeScript support requires the tsx loader to be registered via --import flag.
|
|
7
|
+
* The CLI automatically adds this flag when starting the Node.js runtime.
|
|
8
|
+
*/
|
|
9
|
+
import { FsModuleLoaderBase, type ModuleLoaderConfig } from "@concavejs/runtime-base/module-loader";
|
|
10
|
+
export { type ModuleLoaderConfig };
|
|
11
|
+
export declare class FsModuleLoader extends FsModuleLoaderBase {
|
|
12
|
+
constructor(config: ModuleLoaderConfig);
|
|
13
|
+
protected fileExists(path: string): Promise<boolean>;
|
|
14
|
+
protected importModule(path: string): Promise<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Request Handler for Node.js
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around the shared HttpHandler from @concavejs/core
|
|
5
|
+
*/
|
|
6
|
+
import type { UdfExec } from "@concavejs/core/udf";
|
|
7
|
+
import type { UdfExecutionAdapter } from "@concavejs/core/udf/execution-adapter";
|
|
8
|
+
import { HttpHandler, type HttpHandlerOptions } from "@concavejs/core/http";
|
|
9
|
+
export type NodeHttpHandlerOptions = HttpHandlerOptions;
|
|
10
|
+
export declare class NodeHttpHandler extends HttpHandler {
|
|
11
|
+
constructor(udfExecutor: UdfExec, adapter?: UdfExecutionAdapter, options?: HttpHandlerOptions);
|
|
12
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Server for Concave
|
|
3
|
+
*
|
|
4
|
+
* Single-process server using Node.js HTTP and WebSocket APIs
|
|
5
|
+
*/
|
|
6
|
+
import type { DocStore } from "@concavejs/core/docstore";
|
|
7
|
+
import type { BlobStore } from "@concavejs/core/abstractions";
|
|
8
|
+
import type { ModuleLoader } from "@concavejs/core/udf";
|
|
9
|
+
type ModuleRegistryEntry = (() => Promise<any>) | Promise<any> | any;
|
|
10
|
+
export interface NodeAdapterFactoryContext {
|
|
11
|
+
runtime: "node";
|
|
12
|
+
options: Readonly<NodeServerOptions>;
|
|
13
|
+
}
|
|
14
|
+
export type NodeDocStoreFactory = (context: NodeAdapterFactoryContext) => DocStore;
|
|
15
|
+
export type NodeBlobStoreFactory = (context: NodeAdapterFactoryContext) => BlobStore;
|
|
16
|
+
export type NodeModuleMap = Record<string, ModuleRegistryEntry>;
|
|
17
|
+
export type NodeModuleSource = ModuleLoader | NodeModuleMap;
|
|
18
|
+
export type NodeModuleSources = NodeModuleSource | NodeModuleSource[];
|
|
19
|
+
export type SchemaBootstrapMode = "auto" | "skip";
|
|
20
|
+
export interface NodeListenOptions {
|
|
21
|
+
port?: number;
|
|
22
|
+
hostname?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface NodeServerOptions {
|
|
25
|
+
/** Path to the root convex/ directory (used for component scanning). */
|
|
26
|
+
convexDir?: string;
|
|
27
|
+
/** Path to the directory containing root UDF modules (defaults to convexDir). */
|
|
28
|
+
functionsDir?: string;
|
|
29
|
+
/** Document storage provider */
|
|
30
|
+
docstore?: DocStore | NodeDocStoreFactory;
|
|
31
|
+
/** Blob storage provider */
|
|
32
|
+
blobstore?: BlobStore | NodeBlobStoreFactory;
|
|
33
|
+
/**
|
|
34
|
+
* Schema bootstrap behavior.
|
|
35
|
+
* - "auto": load schema.ts (if present) and register search/vector indexes.
|
|
36
|
+
* - "skip": do not load schema.ts and initialize with no schema indexes.
|
|
37
|
+
*/
|
|
38
|
+
schema?: SchemaBootstrapMode;
|
|
39
|
+
/** Pre-loaded dashboard HTML (avoids bundling dashboard-local) */
|
|
40
|
+
dashboardHtml?: string;
|
|
41
|
+
/** Module sources to resolve Convex modules. */
|
|
42
|
+
modules?: NodeModuleSources;
|
|
43
|
+
/** Whether this server is running in dev mode. Controls logLines on wire. Defaults to true. */
|
|
44
|
+
isDev?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare class NodeServer {
|
|
47
|
+
private options;
|
|
48
|
+
private docstore;
|
|
49
|
+
private blobstore?;
|
|
50
|
+
private syncHandler;
|
|
51
|
+
private httpHandler;
|
|
52
|
+
private taskExecutor;
|
|
53
|
+
private runtime;
|
|
54
|
+
private server?;
|
|
55
|
+
private wss?;
|
|
56
|
+
private convexDir?;
|
|
57
|
+
private functionsDir?;
|
|
58
|
+
private dashboardHtml?;
|
|
59
|
+
private schemaMode;
|
|
60
|
+
private componentLoadersConfigured;
|
|
61
|
+
private boundPort?;
|
|
62
|
+
private boundHostname?;
|
|
63
|
+
private initialized;
|
|
64
|
+
constructor(options?: NodeServerOptions);
|
|
65
|
+
/**
|
|
66
|
+
* Resolve adapters and build runtime internals.
|
|
67
|
+
* Called once at the start of listen(). Default docstore/blobstore are
|
|
68
|
+
* loaded via dynamic import() so that node:sqlite is never eagerly required
|
|
69
|
+
* when the caller provides their own adapter (e.g. better-sqlite3 in Electron).
|
|
70
|
+
*/
|
|
71
|
+
private init;
|
|
72
|
+
listen(options?: NodeListenOptions): Promise<void>;
|
|
73
|
+
close(): Promise<void>;
|
|
74
|
+
private configureComponentLoaders;
|
|
75
|
+
private resolveSchemaIndexes;
|
|
76
|
+
/**
|
|
77
|
+
* Convert Node.js IncomingMessage to fetch-compatible Request
|
|
78
|
+
*/
|
|
79
|
+
private nodeRequestToFetch;
|
|
80
|
+
/**
|
|
81
|
+
* Serve dashboard static files
|
|
82
|
+
*/
|
|
83
|
+
private serveDashboard;
|
|
84
|
+
private getDashboardHtml;
|
|
85
|
+
get url(): string;
|
|
86
|
+
get port(): number;
|
|
87
|
+
}
|
|
88
|
+
export {};
|