@arcote.tech/arc-host 0.3.1 → 0.3.3
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.
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -3737
- package/dist/index.js.map +6 -8
- package/dist/src/arc-host.d.ts +6 -0
- package/dist/src/arc-host.d.ts.map +1 -1
- package/dist/src/context-handler.d.ts.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/index.ts +0 -3
- package/package.json +1 -1
- package/src/arc-host.ts +178 -6
- package/src/context-handler.ts +11 -1
- package/src/index.ts +0 -3
- package/dist/sqliteAdapter.d.ts +0 -3
- package/dist/sqliteAdapter.d.ts.map +0 -1
- package/sqliteAdapter.ts +0 -7
package/dist/src/arc-host.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare class ArcHost {
|
|
|
51
51
|
private handleHttpCommand;
|
|
52
52
|
/**
|
|
53
53
|
* Handle HTTP query request
|
|
54
|
+
* Uses view.queryContext() to apply protections consistently with liveQuery
|
|
54
55
|
*/
|
|
55
56
|
private handleHttpQuery;
|
|
56
57
|
/**
|
|
@@ -61,6 +62,11 @@ export declare class ArcHost {
|
|
|
61
62
|
* Handle HTTP event sync request
|
|
62
63
|
*/
|
|
63
64
|
private handleHttpEventSync;
|
|
65
|
+
/**
|
|
66
|
+
* Handle HTTP route request
|
|
67
|
+
* Matches path against registered routes and executes handler
|
|
68
|
+
*/
|
|
69
|
+
private handleHttpRoute;
|
|
64
70
|
/**
|
|
65
71
|
* Stop the server
|
|
66
72
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc-host.d.ts","sourceRoot":"","sources":["../../src/arc-host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arc-host.d.ts","sourceRoot":"","sources":["../../src/arc-host.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,aA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bf;;OAEG;IACG,aAAa,CACjB,MAAM,EAAE,KAAK,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,GAAG,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,EACF,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,YAAY,GAAG,IAAI,GACzB,OAAO,CAAC,aAAa,EAAE,CAAC;IA2C3B;;OAEG;IACG,cAAc,CAClB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,KAAK,EAAE,YAAY,GAAG,IAAI,GACzB,OAAO,CAAC,aAAa,EAAE,CAAC;IA8C3B;;OAEG;IACH,QAAQ,IAAI,KAAK,CAAC,aAAa,CAAC;IAIhC;;OAEG;IACH,cAAc,IAAI,iBAAiB;IAInC;;OAEG;IACH,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC;IAI/C;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;CAG5C"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ export { ConnectionManager } from "./connection-manager";
|
|
|
3
3
|
export { ContextHandler } from "./context-handler";
|
|
4
4
|
export type { ArcHostConfig, ClientToHostMessage, ConnectedClient, HostToClientMessage, SyncableEvent, TokenPayload, } from "./types";
|
|
5
5
|
export { canTokenEmitEvent, canTokenReceiveEvent, filterEventsForToken, } from "./event-auth";
|
|
6
|
-
export { sqliteAdapterFactory } from "../sqliteAdapter";
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,cAAc,CAAC"}
|
package/index.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// Re-export everything from src
|
|
2
2
|
export * from "./src";
|
|
3
3
|
|
|
4
|
-
// Legacy export for backwards compatibility
|
|
5
|
-
export { sqliteAdapterFactory } from "./sqliteAdapter";
|
|
6
|
-
|
|
7
4
|
// Helper function to start host
|
|
8
5
|
import type { ArcContextAny, DBAdapterFactory } from "@arcote.tech/arc";
|
|
9
6
|
import { ArcHost } from "./src/arc-host";
|
package/package.json
CHANGED
package/src/arc-host.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ArcRouteAny } from "@arcote.tech/arc";
|
|
1
2
|
import { liveQuery } from "@arcote.tech/arc";
|
|
2
3
|
import type { Server, ServerWebSocket } from "bun";
|
|
3
4
|
import jwt from "jsonwebtoken";
|
|
@@ -264,6 +265,7 @@ export class ArcHost {
|
|
|
264
265
|
|
|
265
266
|
this.server = Bun.serve<WebSocketData>({
|
|
266
267
|
port: this.port,
|
|
268
|
+
idleTimeout: 255,
|
|
267
269
|
|
|
268
270
|
fetch(req, server) {
|
|
269
271
|
const url = new URL(req.url);
|
|
@@ -335,7 +337,13 @@ export class ArcHost {
|
|
|
335
337
|
|
|
336
338
|
// HTTP query endpoint: POST /query/:viewName
|
|
337
339
|
if (url.pathname.startsWith("/query/") && req.method === "POST") {
|
|
338
|
-
return self.handleHttpQuery(
|
|
340
|
+
return self.handleHttpQuery(
|
|
341
|
+
req,
|
|
342
|
+
url,
|
|
343
|
+
tokenPayload,
|
|
344
|
+
corsHeaders,
|
|
345
|
+
token,
|
|
346
|
+
);
|
|
339
347
|
}
|
|
340
348
|
|
|
341
349
|
// SSE stream endpoint: GET /stream/:viewName
|
|
@@ -354,6 +362,17 @@ export class ArcHost {
|
|
|
354
362
|
return self.handleHttpEventSync(req, tokenPayload, corsHeaders);
|
|
355
363
|
}
|
|
356
364
|
|
|
365
|
+
// Route endpoints: /route/*
|
|
366
|
+
if (url.pathname.startsWith("/route/")) {
|
|
367
|
+
return self.handleHttpRoute(
|
|
368
|
+
req,
|
|
369
|
+
url,
|
|
370
|
+
tokenPayload,
|
|
371
|
+
corsHeaders,
|
|
372
|
+
token,
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
357
376
|
return new Response("Not Found", { status: 404, headers: corsHeaders });
|
|
358
377
|
},
|
|
359
378
|
|
|
@@ -427,6 +446,10 @@ export class ArcHost {
|
|
|
427
446
|
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
428
447
|
});
|
|
429
448
|
} catch (error) {
|
|
449
|
+
console.error(`[ARC HTTP] Command '${commandName}' error:`, error);
|
|
450
|
+
if (error instanceof Error && error.stack) {
|
|
451
|
+
console.error(`[ARC HTTP] Stack trace:`, error.stack);
|
|
452
|
+
}
|
|
430
453
|
return new Response(JSON.stringify({ error: (error as Error).message }), {
|
|
431
454
|
status: 500,
|
|
432
455
|
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
@@ -436,12 +459,14 @@ export class ArcHost {
|
|
|
436
459
|
|
|
437
460
|
/**
|
|
438
461
|
* Handle HTTP query request
|
|
462
|
+
* Uses view.queryContext() to apply protections consistently with liveQuery
|
|
439
463
|
*/
|
|
440
464
|
private async handleHttpQuery(
|
|
441
465
|
req: Request,
|
|
442
466
|
url: URL,
|
|
443
|
-
|
|
467
|
+
_token: TokenPayload | null,
|
|
444
468
|
corsHeaders: Record<string, string>,
|
|
469
|
+
rawToken: string | null,
|
|
445
470
|
): Promise<Response> {
|
|
446
471
|
const viewName = url.pathname.split("/query/")[1];
|
|
447
472
|
if (!viewName) {
|
|
@@ -453,11 +478,29 @@ export class ArcHost {
|
|
|
453
478
|
|
|
454
479
|
try {
|
|
455
480
|
const params = await req.json();
|
|
456
|
-
const dataStorage = this.contextHandler.getDataStorage();
|
|
457
|
-
const tx = await dataStorage.getReadTransaction();
|
|
458
|
-
const result = await tx.find(viewName, params);
|
|
459
481
|
|
|
460
|
-
//
|
|
482
|
+
// Get view element
|
|
483
|
+
const viewElement = this.contextHandler
|
|
484
|
+
.getModel()
|
|
485
|
+
.context.get(viewName) as any;
|
|
486
|
+
|
|
487
|
+
if (!viewElement || !viewElement.queryContext) {
|
|
488
|
+
return new Response(JSON.stringify({ error: "View not found" }), {
|
|
489
|
+
status: 404,
|
|
490
|
+
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Set auth token so view.queryContext() can apply protections
|
|
495
|
+
this.contextHandler.setAuthToken(rawToken);
|
|
496
|
+
|
|
497
|
+
// Use view's queryContext which applies protections automatically
|
|
498
|
+
const model = this.contextHandler.getModel();
|
|
499
|
+
const adapters = model.getAdapters();
|
|
500
|
+
const queryCtx = viewElement.queryContext(adapters);
|
|
501
|
+
|
|
502
|
+
// Execute query through view's queryContext (protections applied)
|
|
503
|
+
const result = await queryCtx.find(params);
|
|
461
504
|
|
|
462
505
|
return new Response(JSON.stringify(result), {
|
|
463
506
|
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
@@ -631,6 +674,135 @@ export class ArcHost {
|
|
|
631
674
|
}
|
|
632
675
|
}
|
|
633
676
|
|
|
677
|
+
/**
|
|
678
|
+
* Handle HTTP route request
|
|
679
|
+
* Matches path against registered routes and executes handler
|
|
680
|
+
*/
|
|
681
|
+
private async handleHttpRoute(
|
|
682
|
+
req: Request,
|
|
683
|
+
url: URL,
|
|
684
|
+
tokenPayload: TokenPayload | null,
|
|
685
|
+
corsHeaders: Record<string, string>,
|
|
686
|
+
rawToken: string | null,
|
|
687
|
+
): Promise<Response> {
|
|
688
|
+
const method = req.method as "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
689
|
+
|
|
690
|
+
// Find matching route in context
|
|
691
|
+
const context = this.contextHandler.getModel().context;
|
|
692
|
+
let matchedRoute: ArcRouteAny | null = null;
|
|
693
|
+
let routeParams: Record<string, string> = {};
|
|
694
|
+
|
|
695
|
+
for (const element of context.elements) {
|
|
696
|
+
// Check if element is a route (has matchesPath method)
|
|
697
|
+
if (element && typeof (element as any).matchesPath === "function") {
|
|
698
|
+
const route = element as ArcRouteAny;
|
|
699
|
+
const match = route.matchesPath(url.pathname);
|
|
700
|
+
if (match.matches) {
|
|
701
|
+
matchedRoute = route;
|
|
702
|
+
routeParams = match.params;
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (!matchedRoute) {
|
|
709
|
+
return new Response(JSON.stringify({ error: "Route not found" }), {
|
|
710
|
+
status: 404,
|
|
711
|
+
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// Get handler for this method
|
|
716
|
+
const handler = matchedRoute.getHandler(method);
|
|
717
|
+
if (!handler) {
|
|
718
|
+
return new Response(
|
|
719
|
+
JSON.stringify({ error: `Method ${method} not allowed` }),
|
|
720
|
+
{
|
|
721
|
+
status: 405,
|
|
722
|
+
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
723
|
+
},
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// Check protection
|
|
728
|
+
if (!matchedRoute.isPublic && matchedRoute.hasProtections) {
|
|
729
|
+
if (!tokenPayload) {
|
|
730
|
+
return new Response(JSON.stringify({ error: "Unauthorized" }), {
|
|
731
|
+
status: 401,
|
|
732
|
+
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// Set auth token for protection check
|
|
737
|
+
this.contextHandler.setAuthToken(rawToken);
|
|
738
|
+
|
|
739
|
+
// Check if token type matches any protection
|
|
740
|
+
let isAuthorized = false;
|
|
741
|
+
for (const protection of matchedRoute.protections) {
|
|
742
|
+
if (protection.token.name === tokenPayload.tokenType) {
|
|
743
|
+
// Create a mock token instance for the check
|
|
744
|
+
const mockTokenInstance = {
|
|
745
|
+
params: tokenPayload.params,
|
|
746
|
+
getTokenDefinition: () => protection.token,
|
|
747
|
+
};
|
|
748
|
+
const allowed = await protection.check(mockTokenInstance as any);
|
|
749
|
+
if (allowed) {
|
|
750
|
+
isAuthorized = true;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
if (!isAuthorized) {
|
|
757
|
+
return new Response(JSON.stringify({ error: "Forbidden" }), {
|
|
758
|
+
status: 403,
|
|
759
|
+
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
} else if (!matchedRoute.isPublic && !matchedRoute.hasProtections) {
|
|
763
|
+
// Route is not public and has no protections - require any valid token
|
|
764
|
+
if (!tokenPayload) {
|
|
765
|
+
return new Response(JSON.stringify({ error: "Unauthorized" }), {
|
|
766
|
+
status: 401,
|
|
767
|
+
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
// Build route context
|
|
773
|
+
this.contextHandler.setAuthToken(rawToken);
|
|
774
|
+
const model = this.contextHandler.getModel();
|
|
775
|
+
const adapters = model.getAdapters();
|
|
776
|
+
|
|
777
|
+
const authParams = tokenPayload
|
|
778
|
+
? { params: tokenPayload.params, tokenName: tokenPayload.tokenType }
|
|
779
|
+
: undefined;
|
|
780
|
+
|
|
781
|
+
const routeContext = matchedRoute.buildContext(adapters, authParams);
|
|
782
|
+
|
|
783
|
+
try {
|
|
784
|
+
// Execute handler
|
|
785
|
+
const response = await handler(routeContext, req, routeParams, url);
|
|
786
|
+
|
|
787
|
+
// Add CORS headers to response
|
|
788
|
+
const newHeaders = new Headers(response.headers);
|
|
789
|
+
for (const [key, value] of Object.entries(corsHeaders)) {
|
|
790
|
+
newHeaders.set(key, value);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return new Response(response.body, {
|
|
794
|
+
status: response.status,
|
|
795
|
+
statusText: response.statusText,
|
|
796
|
+
headers: newHeaders,
|
|
797
|
+
});
|
|
798
|
+
} catch (error) {
|
|
799
|
+
return new Response(JSON.stringify({ error: (error as Error).message }), {
|
|
800
|
+
status: 500,
|
|
801
|
+
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
634
806
|
/**
|
|
635
807
|
* Stop the server
|
|
636
808
|
*/
|
package/src/context-handler.ts
CHANGED
|
@@ -78,7 +78,17 @@ export class ContextHandler {
|
|
|
78
78
|
|
|
79
79
|
// TODO: Check command protection with token
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
try {
|
|
82
|
+
return await command(params);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error(`[ARC] Command '${commandName}' failed:`);
|
|
85
|
+
console.error(`[ARC] Params:`, JSON.stringify(params, null, 2));
|
|
86
|
+
console.error(`[ARC] Error:`, error);
|
|
87
|
+
if (error instanceof Error) {
|
|
88
|
+
console.error(`[ARC] Stack:`, error.stack);
|
|
89
|
+
}
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
/**
|
package/src/index.ts
CHANGED
package/dist/sqliteAdapter.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqliteAdapter.d.ts","sourceRoot":"","sources":["../sqliteAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,KAAG,gBAErD,CAAC"}
|
package/sqliteAdapter.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { DBAdapterFactory } from "@arcote.tech/arc";
|
|
2
|
-
// @ts-ignore - external package without types
|
|
3
|
-
import { createBunSQLiteAdapterFactory } from "@arcote.tech/arc-adapter-db-sqlite";
|
|
4
|
-
|
|
5
|
-
export const sqliteAdapterFactory = (dbName: string): DBAdapterFactory => {
|
|
6
|
-
return createBunSQLiteAdapterFactory(dbName);
|
|
7
|
-
};
|