@procedures/client 0.7.0 → 0.8.1
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/CHANGELOG.md +107 -0
- package/README.md +115 -11
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/http/client/transport.d.ts +4 -0
- package/dist/adapters/http/client/transport.d.ts.map +1 -1
- package/dist/adapters/http/client/transport.js +11 -1
- package/dist/adapters/http/client/transport.js.map +1 -1
- package/dist/adapters/http/client/types.d.ts +19 -0
- package/dist/adapters/http/client/types.d.ts.map +1 -1
- package/dist/adapters/http/server/cors.d.ts +64 -0
- package/dist/adapters/http/server/cors.d.ts.map +1 -0
- package/dist/adapters/http/server/cors.js +113 -0
- package/dist/adapters/http/server/cors.js.map +1 -0
- package/dist/adapters/http/server/handler.d.ts +136 -0
- package/dist/adapters/http/server/handler.d.ts.map +1 -0
- package/dist/adapters/http/server/handler.js +495 -0
- package/dist/adapters/http/server/handler.js.map +1 -0
- package/dist/adapters/http/server/strategies.d.ts +14 -5
- package/dist/adapters/http/server/strategies.d.ts.map +1 -1
- package/dist/adapters/http/server/strategies.js.map +1 -1
- package/dist/adapters/http/server/transport.d.ts +36 -46
- package/dist/adapters/http/server/transport.d.ts.map +1 -1
- package/dist/adapters/http/server/transport.js +58 -433
- package/dist/adapters/http/server/transport.js.map +1 -1
- package/dist/adapters/http/server/types.d.ts +13 -0
- package/dist/adapters/http/server/types.d.ts.map +1 -1
- package/dist/adapters/websocket/client/transport.d.ts +7 -3
- package/dist/adapters/websocket/client/transport.d.ts.map +1 -1
- package/dist/adapters/websocket/client/transport.js +9 -3
- package/dist/adapters/websocket/client/transport.js.map +1 -1
- package/dist/adapters/websocket/server/transport.d.ts +56 -1
- package/dist/adapters/websocket/server/transport.d.ts.map +1 -1
- package/dist/adapters/websocket/server/transport.js +174 -17
- package/dist/adapters/websocket/server/transport.js.map +1 -1
- package/dist/adapters/websocket/server/types.d.ts +10 -3
- package/dist/adapters/websocket/server/types.d.ts.map +1 -1
- package/dist/adapters/websocket/server/upgrade-router.d.ts +28 -0
- package/dist/adapters/websocket/server/upgrade-router.d.ts.map +1 -0
- package/dist/adapters/websocket/server/upgrade-router.js +62 -0
- package/dist/adapters/websocket/server/upgrade-router.js.map +1 -0
- package/dist/adapters/websocket/server/upgrade.d.ts +68 -0
- package/dist/adapters/websocket/server/upgrade.d.ts.map +1 -0
- package/dist/adapters/websocket/server/upgrade.js +49 -0
- package/dist/adapters/websocket/server/upgrade.js.map +1 -0
- package/dist/adapters/websocket/shared/rpc.d.ts +2 -0
- package/dist/adapters/websocket/shared/rpc.d.ts.map +1 -1
- package/dist/adapters/websocket/shared/rpc.js +8 -2
- package/dist/adapters/websocket/shared/rpc.js.map +1 -1
- package/dist/browser.d.ts +14 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +12 -3
- package/dist/browser.js.map +1 -1
- package/dist/client/client.d.ts +43 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +69 -1
- package/dist/client/client.js.map +1 -1
- package/dist/client/errors/registry.d.ts.map +1 -1
- package/dist/client/errors/registry.js +1 -0
- package/dist/client/errors/registry.js.map +1 -1
- package/dist/client/middleware/retry.d.ts +4 -0
- package/dist/client/middleware/retry.d.ts.map +1 -1
- package/dist/client/middleware/retry.js +86 -78
- package/dist/client/middleware/retry.js.map +1 -1
- package/dist/events/bus.d.ts +32 -14
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/events/bus.js +119 -65
- package/dist/events/bus.js.map +1 -1
- package/dist/events/index.d.ts +3 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js.map +1 -1
- package/dist/events/publisher.d.ts +14 -0
- package/dist/events/publisher.d.ts.map +1 -1
- package/dist/events/publisher.js +62 -10
- package/dist/events/publisher.js.map +1 -1
- package/dist/events/remote.d.ts +80 -18
- package/dist/events/remote.d.ts.map +1 -1
- package/dist/events/remote.js +448 -58
- package/dist/events/remote.js.map +1 -1
- package/dist/events/rows.d.ts +31 -0
- package/dist/events/rows.d.ts.map +1 -0
- package/dist/events/rows.js +39 -0
- package/dist/events/rows.js.map +1 -0
- package/dist/events/types.d.ts +13 -2
- package/dist/events/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +14 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +9 -0
- package/dist/node.js.map +1 -1
- package/dist/procedures/caller.d.ts +33 -0
- package/dist/procedures/caller.d.ts.map +1 -0
- package/dist/procedures/caller.js +27 -0
- package/dist/procedures/caller.js.map +1 -0
- package/dist/procedures/capability.d.ts +6 -0
- package/dist/procedures/capability.d.ts.map +1 -1
- package/dist/procedures/capability.js +25 -0
- package/dist/procedures/capability.js.map +1 -1
- package/dist/procedures/collection/changes.d.ts +94 -0
- package/dist/procedures/collection/changes.d.ts.map +1 -0
- package/dist/procedures/collection/changes.js +182 -0
- package/dist/procedures/collection/changes.js.map +1 -0
- package/dist/procedures/collection/index.d.ts +8 -3
- package/dist/procedures/collection/index.d.ts.map +1 -1
- package/dist/procedures/collection/index.js +6 -1
- package/dist/procedures/collection/index.js.map +1 -1
- package/dist/procedures/collection/procedures.d.ts +39 -2
- package/dist/procedures/collection/procedures.d.ts.map +1 -1
- package/dist/procedures/collection/procedures.js +131 -8
- package/dist/procedures/collection/procedures.js.map +1 -1
- package/dist/procedures/collection/query.d.ts +246 -0
- package/dist/procedures/collection/query.d.ts.map +1 -0
- package/dist/procedures/collection/query.js +854 -0
- package/dist/procedures/collection/query.js.map +1 -0
- package/dist/procedures/collection/schemas.d.ts +59 -0
- package/dist/procedures/collection/schemas.d.ts.map +1 -1
- package/dist/procedures/collection/schemas.js +172 -6
- package/dist/procedures/collection/schemas.js.map +1 -1
- package/dist/procedures/collection/storage.d.ts +64 -6
- package/dist/procedures/collection/storage.d.ts.map +1 -1
- package/dist/procedures/collection/storage.js +23 -0
- package/dist/procedures/collection/storage.js.map +1 -1
- package/dist/procedures/elicit.d.ts +190 -0
- package/dist/procedures/elicit.d.ts.map +1 -0
- package/dist/procedures/elicit.js +127 -0
- package/dist/procedures/elicit.js.map +1 -0
- package/dist/procedures/hints.d.ts +43 -0
- package/dist/procedures/hints.d.ts.map +1 -0
- package/dist/procedures/hints.js +74 -0
- package/dist/procedures/hints.js.map +1 -0
- package/dist/procedures/index.d.ts +12 -3
- package/dist/procedures/index.d.ts.map +1 -1
- package/dist/procedures/index.js +7 -1
- package/dist/procedures/index.js.map +1 -1
- package/dist/procedures/invoke.d.ts +20 -0
- package/dist/procedures/invoke.d.ts.map +1 -1
- package/dist/procedures/invoke.js +16 -0
- package/dist/procedures/invoke.js.map +1 -1
- package/dist/procedures/progress.d.ts +24 -0
- package/dist/procedures/progress.d.ts.map +1 -0
- package/dist/procedures/progress.js +11 -0
- package/dist/procedures/progress.js.map +1 -0
- package/dist/procedures/registry.d.ts.map +1 -1
- package/dist/procedures/registry.js +5 -0
- package/dist/procedures/registry.js.map +1 -1
- package/dist/procedures/types.d.ts +92 -0
- package/dist/procedures/types.d.ts.map +1 -1
- package/dist/procedures/types.js.map +1 -1
- package/dist/procedures/untrusted.d.ts +28 -0
- package/dist/procedures/untrusted.d.ts.map +1 -0
- package/dist/procedures/untrusted.js +32 -0
- package/dist/procedures/untrusted.js.map +1 -0
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +1 -0
- package/dist/protocol.js.map +1 -1
- package/dist/server/browser-guard.d.ts +12 -2
- package/dist/server/browser-guard.d.ts.map +1 -1
- package/dist/server/browser-guard.js +43 -6
- package/dist/server/browser-guard.js.map +1 -1
- package/dist/server/host-policy.d.ts +10 -1
- package/dist/server/host-policy.d.ts.map +1 -1
- package/dist/server/host-policy.js +5 -0
- package/dist/server/host-policy.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/procedure-server.d.ts +75 -9
- package/dist/server/procedure-server.d.ts.map +1 -1
- package/dist/server/procedure-server.js +151 -17
- package/dist/server/procedure-server.js.map +1 -1
- package/dist/server/request-auth.d.ts +51 -4
- package/dist/server/request-auth.d.ts.map +1 -1
- package/dist/server/request-auth.js +116 -5
- package/dist/server/request-auth.js.map +1 -1
- package/dist/server/types.d.ts +73 -5
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js.map +1 -1
- package/dist/timers.d.ts +5 -0
- package/dist/timers.d.ts.map +1 -1
- package/dist/timers.js +3 -1
- package/dist/timers.js.map +1 -1
- package/package.json +5 -1
- package/src/adapters/http/client/transport.ts +11 -1
- package/src/adapters/http/client/types.ts +22 -0
- package/src/adapters/http/server/cors.ts +144 -0
- package/src/adapters/http/server/handler.ts +624 -0
- package/src/adapters/http/server/strategies.ts +16 -6
- package/src/adapters/http/server/transport.ts +66 -479
- package/src/adapters/http/server/types.ts +15 -0
- package/src/adapters/websocket/client/transport.ts +9 -3
- package/src/adapters/websocket/server/transport.ts +189 -18
- package/src/adapters/websocket/server/types.ts +11 -3
- package/src/adapters/websocket/server/upgrade-router.ts +77 -0
- package/src/adapters/websocket/server/upgrade.ts +88 -0
- package/src/adapters/websocket/shared/rpc.ts +9 -2
- package/src/browser.ts +85 -2
- package/src/client/client.ts +83 -1
- package/src/client/errors/registry.ts +1 -0
- package/src/client/middleware/retry.ts +89 -78
- package/src/events/bus.ts +141 -73
- package/src/events/index.ts +3 -0
- package/src/events/publisher.ts +71 -10
- package/src/events/remote.ts +575 -73
- package/src/events/rows.ts +48 -0
- package/src/events/types.ts +15 -2
- package/src/index.ts +1 -1
- package/src/node.ts +21 -0
- package/src/procedures/caller.ts +45 -0
- package/src/procedures/capability.ts +21 -0
- package/src/procedures/collection/changes.ts +245 -0
- package/src/procedures/collection/index.ts +56 -1
- package/src/procedures/collection/procedures.ts +185 -7
- package/src/procedures/collection/query.ts +1009 -0
- package/src/procedures/collection/schemas.ts +233 -7
- package/src/procedures/collection/storage.ts +84 -6
- package/src/procedures/elicit.ts +320 -0
- package/src/procedures/hints.ts +91 -0
- package/src/procedures/index.ts +82 -2
- package/src/procedures/invoke.ts +31 -0
- package/src/procedures/progress.ts +25 -0
- package/src/procedures/registry.ts +4 -0
- package/src/procedures/types.ts +102 -0
- package/src/procedures/untrusted.ts +50 -0
- package/src/protocol.ts +3 -1
- package/src/server/browser-guard.ts +48 -6
- package/src/server/host-policy.ts +13 -1
- package/src/server/index.ts +3 -0
- package/src/server/procedure-server.ts +185 -20
- package/src/server/request-auth.ts +128 -6
- package/src/server/types.ts +82 -5
- package/src/timers.ts +8 -1
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* no allowed origin is refused (an image tag or a form sends no `Origin` for a GET).
|
|
16
16
|
* - HTTP only: a procedure call by GET or HEAD is refused unless `allowGet` is true, and a
|
|
17
17
|
* request body must be JSON.
|
|
18
|
+
* - A request with ambient credentials (the cookies that a browser sends by itself) is trusted
|
|
19
|
+
* only from a named origin. `"*"` does not open the origin check for it (CSRF). A list or a
|
|
20
|
+
* function of origins still does.
|
|
18
21
|
*/
|
|
19
22
|
const LOOPBACK_NAMES = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
|
20
23
|
/** True for a host name or a bind address that only this computer can reach. */
|
|
@@ -36,9 +39,10 @@ export function hostNameOf(header) {
|
|
|
36
39
|
return header.slice(0, header.indexOf("]") + 1).toLowerCase();
|
|
37
40
|
return (header.split(":")[0] ?? "").toLowerCase();
|
|
38
41
|
}
|
|
39
|
-
function originAllowedBy(origin, allowed) {
|
|
42
|
+
function originAllowedBy(origin, allowed, ambient) {
|
|
43
|
+
// "*" names no origin: ambient credentials are not trusted from it
|
|
40
44
|
if (allowed === "*")
|
|
41
|
-
return
|
|
45
|
+
return !ambient;
|
|
42
46
|
if (typeof allowed === "function")
|
|
43
47
|
return allowed(origin);
|
|
44
48
|
return (allowed ?? []).includes(origin);
|
|
@@ -64,11 +68,44 @@ function hasBody(headers) {
|
|
|
64
68
|
const length = Number(headers["content-length"] ?? 0);
|
|
65
69
|
return length > 0 || headers["transfer-encoding"] !== undefined;
|
|
66
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* True when a request carries ambient credentials: a `Cookie` header, which a browser sends by
|
|
73
|
+
* itself, also for a request that another site starts.
|
|
74
|
+
*/
|
|
75
|
+
export function hasAmbientCredentials(headers) {
|
|
76
|
+
const cookie = headers.cookie;
|
|
77
|
+
return typeof cookie === "string" && cookie.trim() !== "";
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* True when a face trusts a request only from a named origin. This is so when the server reads
|
|
81
|
+
* cookies for each request (`"always"`), or when the request carries a cookie that an auth path can
|
|
82
|
+
* read. `cookiesNamed` is true for a face that trusts no cookie from
|
|
83
|
+
* an origin that is not named, with or without an auth path.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export function needsNamedOrigin(mode, headers, cookiesNamed) {
|
|
88
|
+
return mode === "always" || (hasAmbientCredentials(headers) && (cookiesNamed || mode !== undefined));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This function refuses a face whose server reads cookies for each request (`principalOf`) while
|
|
92
|
+
* its browser checks permit each origin (`"*"`). Each site could then send a request with the cookies
|
|
93
|
+
* of the user (CSRF).
|
|
94
|
+
*
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
export function assertNamedOrigins(face, mode, allowedOrigins, originOption) {
|
|
98
|
+
if (mode !== "always" || allowedOrigins !== "*")
|
|
99
|
+
return;
|
|
100
|
+
throw new Error(`${face}: the request hook principalOf reads the cookies of each request, and the origin "*" lets each site send them (CSRF). Give ${originOption} or allowedOrigins a list or a function of the origins that can call.`);
|
|
101
|
+
}
|
|
67
102
|
/**
|
|
68
103
|
* The checks of the host, the origin and the fetch site, for HTTP and WebSocket requests.
|
|
69
|
-
* `http` adds the checks of the method and the body.
|
|
104
|
+
* `http` adds the checks of the method and the body. `ambient` is true when the server can trust
|
|
105
|
+
* ambient credentials (cookies) for the request. Then `"*"` does not permit another origin. Only a
|
|
106
|
+
* named origin (a list or a function) does.
|
|
70
107
|
*/
|
|
71
|
-
export function checkBrowserRequest(req, options = {}, http = false) {
|
|
108
|
+
export function checkBrowserRequest(req, options = {}, http = false, ambient = false) {
|
|
72
109
|
const { headers } = req;
|
|
73
110
|
// DNS rebinding: a request on a loopback address must name a loopback host
|
|
74
111
|
if (options.allowedHosts !== "*" && isLoopbackAddress(req.socket?.localAddress)) {
|
|
@@ -79,13 +116,13 @@ export function checkBrowserRequest(req, options = {}, http = false) {
|
|
|
79
116
|
}
|
|
80
117
|
const origin = typeof headers.origin === "string" ? headers.origin : undefined;
|
|
81
118
|
if (origin !== undefined) {
|
|
82
|
-
if (!sameOrigin(origin, headers.host) && !originAllowedBy(origin, options.allowedOrigins)) {
|
|
119
|
+
if (!sameOrigin(origin, headers.host) && !originAllowedBy(origin, options.allowedOrigins, ambient)) {
|
|
83
120
|
return { ok: false, status: 403, code: "FORBIDDEN_ORIGIN", message: `Forbidden: the origin "${origin}" is not allowed` };
|
|
84
121
|
}
|
|
85
122
|
}
|
|
86
123
|
else {
|
|
87
124
|
const site = headers["sec-fetch-site"];
|
|
88
|
-
if ((site === "cross-site" || site === "same-site") && options.allowedOrigins !== "*") {
|
|
125
|
+
if ((site === "cross-site" || site === "same-site") && (options.allowedOrigins !== "*" || ambient)) {
|
|
89
126
|
return { ok: false, status: 403, code: "FORBIDDEN_ORIGIN", message: "Forbidden: a request from another site" };
|
|
90
127
|
}
|
|
91
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-guard.js","sourceRoot":"","sources":["../../src/server/browser-guard.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-guard.js","sourceRoot":"","sources":["../../src/server/browser-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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;IACH,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* procedures (a host for an outside caller sets it).
|
|
13
13
|
* - `timeout`: the time limit of each call from a caller (not of its nested calls).
|
|
14
14
|
* - `token`, `browser`: the checks of the network transports (`client-server` applies them).
|
|
15
|
+
* - `principalOf`: the request hook. It reads the credentials of a network request (a cookie, a
|
|
16
|
+
* header, the query) and gives a bearer token, a principal and a narrowing.
|
|
15
17
|
* - `capability`, `readOnly`, `clearanceOrder`, `resources`, `admitItem`: the capability of each
|
|
16
18
|
* call and what the host gives for it (CAPABILITIES-2026-10).
|
|
17
19
|
* - `events`: the remote events of the host (`documentation/EVENTS.md`). The server pins
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
*/
|
|
20
22
|
import type { Capability, ClearanceOrder, ProcedurePath, ResourcesOf } from "../procedures/types.js";
|
|
21
23
|
import type { AdmitItem, Interceptor, Invocation } from "../procedures/invoke.js";
|
|
22
|
-
import type { ServerRequest } from "./types.js";
|
|
24
|
+
import type { PrincipalOf, ServerRequest } from "./types.js";
|
|
23
25
|
import type { BrowserGuardOptions } from "./browser-guard.js";
|
|
24
26
|
import type { ProcedureRegistry } from "../procedures/registry.js";
|
|
25
27
|
import type { ProcedureServerOptions } from "./procedure-server.js";
|
|
@@ -48,6 +50,11 @@ export interface HostPolicyOptions {
|
|
|
48
50
|
interceptors?: readonly Interceptor[] | undefined;
|
|
49
51
|
/** The token that each network request must send (HTTP and WebSocket transports). */
|
|
50
52
|
token?: string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* The request hook: it reads the credentials of each network request (a cookie, a header, the
|
|
55
|
+
* query) and gives a bearer token, a principal and a narrowing (`ProcedureServerOptions`).
|
|
56
|
+
*/
|
|
57
|
+
principalOf?: PrincipalOf | undefined;
|
|
51
58
|
/** The browser checks of the network transports (`allowedOrigins`, `allowedHosts`, `allowGet`). */
|
|
52
59
|
browser?: BrowserGuardOptions | undefined;
|
|
53
60
|
/**
|
|
@@ -77,6 +84,8 @@ export interface HostPolicy {
|
|
|
77
84
|
readonly strictCalls: boolean;
|
|
78
85
|
readonly interceptors: readonly Interceptor[];
|
|
79
86
|
readonly token: string | undefined;
|
|
87
|
+
/** The request hook of the network requests, or undefined for none. */
|
|
88
|
+
readonly principalOf?: PrincipalOf | undefined;
|
|
80
89
|
readonly browser: BrowserGuardOptions;
|
|
81
90
|
/** The capability of a call from a caller, or undefined for no limits. */
|
|
82
91
|
readonly capabilityOf: ((request?: ServerRequest<unknown>) => Capability | undefined) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-policy.d.ts","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"host-policy.d.ts","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAErD,iGAAiG;AACjG,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,SAAS,MAAM,EAAE,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,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAkB/G"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* procedures (a host for an outside caller sets it).
|
|
13
13
|
* - `timeout`: the time limit of each call from a caller (not of its nested calls).
|
|
14
14
|
* - `token`, `browser`: the checks of the network transports (`client-server` applies them).
|
|
15
|
+
* - `principalOf`: the request hook. It reads the credentials of a network request (a cookie, a
|
|
16
|
+
* header, the query) and gives a bearer token, a principal and a narrowing.
|
|
15
17
|
* - `capability`, `readOnly`, `clearanceOrder`, `resources`, `admitItem`: the capability of each
|
|
16
18
|
* call and what the host gives for it (CAPABILITIES-2026-10).
|
|
17
19
|
* - `events`: the remote events of the host (`documentation/EVENTS.md`). The server pins
|
|
@@ -83,6 +85,7 @@ export function hostPolicy(options = {}) {
|
|
|
83
85
|
strictCalls: options.strictCalls ?? false,
|
|
84
86
|
interceptors,
|
|
85
87
|
token: options.token,
|
|
88
|
+
...(options.principalOf ? { principalOf: options.principalOf } : {}),
|
|
86
89
|
browser: options.browser ?? {},
|
|
87
90
|
capabilityOf: capabilityOfOptions(options),
|
|
88
91
|
clearanceOrder: options.clearanceOrder,
|
|
@@ -100,6 +103,8 @@ export function procedureServerOptions(policy, registry) {
|
|
|
100
103
|
strictCalls: policy.strictCalls,
|
|
101
104
|
// The token of the policy: ProcedureServer examines it for each network request (R18)
|
|
102
105
|
...(policy.token !== undefined ? { token: policy.token } : {}),
|
|
106
|
+
// The request hook of the policy: the credentials of a cookie, a header or the query (CLI-2a)
|
|
107
|
+
...(policy.principalOf ? { principalOf: policy.principalOf } : {}),
|
|
103
108
|
...(policy.interceptors.length > 0 ? { interceptors: policy.interceptors } : {}),
|
|
104
109
|
...(policy.capabilityOf ? { capability: policy.capabilityOf } : {}),
|
|
105
110
|
...(policy.clearanceOrder ? { clearanceOrder: policy.clearanceOrder } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-policy.js","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"host-policy.js","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAAE,IAAI,EAAiB,MAAM,gBAAgB,CAAC;AAQrD,8FAA8F;AAC9F,MAAM,UAAU,cAAc,CAAC,QAA2B;IACxD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,GAAG,GAAG,KAAK,CAAC;IAChB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,KAAK,GAAG;YAAE,GAAG,GAAG,IAAI,CAAC;aAC3B,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;;YAChE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,GAAG;YAAE,OAAO,IAAI,CAAC;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,OAAoB;IAC9C,MAAM,UAAU,GAAG,IAAI,G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AC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3E,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,0FAA0F;QAC1F,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export type { ServerOptions } from "./server.js";
|
|
|
38
38
|
export { ProcedureServer, createProcedureServer, STREAM_METADATA_KEY, isUnboundedStream } from "./procedure-server.js";
|
|
39
39
|
export type { ProcedureServerOptions, StorageConfig, StopOptions, UseStorageOptions } from "./procedure-server.js";
|
|
40
40
|
export { pathToMethod, methodToPath } from "./method.js";
|
|
41
|
-
export { HandlerNotFoundError, ServerError, type ServerRequest, type ServerResponse, type RequestHandler, type Credentials, type Principal, type ServerHandler, type ServerMiddleware, type ServerContext, type ServerRunner, type ServerTransport, } from "./types.js";
|
|
41
|
+
export { HandlerNotFoundError, ServerError, type ServerRequest, type ServerResponse, type RequestHandler, type Credentials, type Principal, type PrincipalOf, type RequestIdentity, type AmbientCredentials, type ServerHandler, type ServerMiddleware, type ServerContext, type ServerRunner, type ServerTransport, } from "./types.js";
|
|
42
42
|
export { HttpServerTransport, defaultServerUrlStrategy, rpcServerUrlStrategy, } from "../adapters/http/server/index.js";
|
|
43
43
|
export type { HttpServerTransportOptions, HttpUrlStrategy, } from "../adapters/http/server/index.js";
|
|
44
44
|
export { WebSocketServerTransport } from "../adapters/websocket/server/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACvH,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,0BAA0B,EAC1B,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EACV,+BAA+B,EAC/B,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACvH,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,0BAA0B,EAC1B,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EACV,+BAA+B,EAC/B,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,uCAAuC,CAAC"}
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEvH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEvH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,WAAW,GAcZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Integrates with ProcedureRegistry and CollectionStorage backends.
|
|
6
6
|
*/
|
|
7
7
|
import { Server, type ServerOptions } from "./server.js";
|
|
8
|
-
import type { Method, Principal, ServerHandler, ServerRequest, ServerResponse } from "./types.js";
|
|
8
|
+
import type { AmbientCredentials, Method, Principal, PrincipalOf, ServerHandler, ServerRequest, ServerResponse } from "./types.js";
|
|
9
9
|
import type { AnyProcedure, ProcedurePath, RepositoryProvider, ProcedureModule } from "../procedures/types.js";
|
|
10
10
|
import { ProcedureRegistry } from "../procedures/registry.js";
|
|
11
11
|
import { type AdmitItem, type Interceptor, type Invocation } from "../procedures/invoke.js";
|
|
@@ -13,7 +13,9 @@ import type { Capability, ClearanceOrder, ResourcesOf } from "../procedures/type
|
|
|
13
13
|
import { type IdempotencyOptions } from "../procedures/idempotency.js";
|
|
14
14
|
import { type Duration } from "../duration.js";
|
|
15
15
|
import type { CollectionStorage } from "../procedures/collection/storage.js";
|
|
16
|
+
import { type Clock } from "../clock.js";
|
|
16
17
|
import { EventPublisher, type EventPublisherOptions } from "../events/publisher.js";
|
|
18
|
+
import type { CollectionProceduresOptions } from "../procedures/collection/procedures.js";
|
|
17
19
|
/**
|
|
18
20
|
* Storage configuration for a collection.
|
|
19
21
|
*/
|
|
@@ -30,8 +32,18 @@ export interface UseStorageOptions {
|
|
|
30
32
|
* flush fails, the old storage stays and `useStorage` throws.
|
|
31
33
|
*/
|
|
32
34
|
drain?: boolean | undefined;
|
|
33
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* True: the server closes the old storage after the change. The close waits for the calls that
|
|
37
|
+
* took the old storage, for the time of `grace` at most.
|
|
38
|
+
*/
|
|
34
39
|
close?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The longest time that the close waits for the calls on the old storage, for example
|
|
42
|
+
* `seconds(5)`. When the time ends, the server closes the old storage. A call that still uses it
|
|
43
|
+
* then fails with the error of a closed storage. 0: the server closes it at once.
|
|
44
|
+
* @default 30 seconds (`TIMER_DEFAULTS.server.storageGraceMs`)
|
|
45
|
+
*/
|
|
46
|
+
grace?: Duration | undefined;
|
|
35
47
|
}
|
|
36
48
|
/**
|
|
37
49
|
* Options for ProcedureServer.
|
|
@@ -43,6 +55,11 @@ export interface ProcedureServerOptions extends ServerOptions {
|
|
|
43
55
|
autoRegister?: boolean;
|
|
44
56
|
/** Collections to configure with storage backends */
|
|
45
57
|
collections?: Record<string, CollectionStorage<unknown>>;
|
|
58
|
+
/**
|
|
59
|
+
* The clock of the wait of `useStorage` for the calls on an old storage (roadmap R35). The
|
|
60
|
+
* default is the clock of the platform. A test gives a fake clock.
|
|
61
|
+
*/
|
|
62
|
+
clock?: Clock | undefined;
|
|
46
63
|
/**
|
|
47
64
|
* The procedures that the callers of this server can reach. `registerFromRegistry()` registers
|
|
48
65
|
* only these procedures. A data-driven procedure (control flow, `eval`, a procedure that
|
|
@@ -92,6 +109,22 @@ export interface ProcedureServerOptions extends ServerOptions {
|
|
|
92
109
|
* `request.principal`.
|
|
93
110
|
*/
|
|
94
111
|
authenticate?: ((request: ServerRequest<unknown>) => Principal | undefined | Promise<Principal | undefined>) | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The request hook of the server: it reads the credentials of each network request (a cookie, a
|
|
114
|
+
* header, the query) and gives a bearer token, a principal and a narrowing. It runs before the
|
|
115
|
+
* token check: its bearer token replaces the bearer token of the credentials. Its principal
|
|
116
|
+
* replaces the principal of the token check. `authenticate` runs after it and can read
|
|
117
|
+
* `request.principal`. Undefined or an error refuses the request with `UNAUTHORIZED`. A request
|
|
118
|
+
* without credentials (from this process) does not go through the hook.
|
|
119
|
+
*/
|
|
120
|
+
principalOf?: PrincipalOf | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* How the server can authenticate a request with ambient credentials (cookies), for the CSRF
|
|
123
|
+
* checks of the network faces. The default is `"always"` with `principalOf`, `"cookies"` with
|
|
124
|
+
* `authenticate`, and none without them. `false`: the server reads no cookies, for example an
|
|
125
|
+
* `authenticate` function that reads only the bearer token.
|
|
126
|
+
*/
|
|
127
|
+
ambientCredentials?: AmbientCredentials | false | undefined;
|
|
95
128
|
/**
|
|
96
129
|
* The remote events of the server (`documentation/EVENTS.md`): a bus and its topic rule, or an
|
|
97
130
|
* `EventPublisher`. The server pins the procedure `events.subscribe`, outside its registry, so a
|
|
@@ -161,6 +194,10 @@ export declare function errorResponse(id: string, error: unknown): ServerRespons
|
|
|
161
194
|
export declare class ProcedureServer extends Server implements RepositoryProvider {
|
|
162
195
|
private readonly procedureRegistry;
|
|
163
196
|
private readonly storages;
|
|
197
|
+
/** For each storage: the calls in flight that took it, and the closes that wait for them */
|
|
198
|
+
private readonly storageUses;
|
|
199
|
+
/** The clock of the wait of `useStorage` */
|
|
200
|
+
private readonly clock;
|
|
164
201
|
/** The procedures that `registerProcedure` pinned, by key */
|
|
165
202
|
private readonly pinnedProcedures;
|
|
166
203
|
/**
|
|
@@ -186,13 +223,19 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
186
223
|
private draining;
|
|
187
224
|
/** The calls in flight, a stream until its end */
|
|
188
225
|
private inFlight;
|
|
189
|
-
/** The token of the server, and its authenticate function (R18) */
|
|
226
|
+
/** The token of the server, its request hook and its authenticate function (R18) */
|
|
190
227
|
private readonly token;
|
|
228
|
+
private readonly principalOf;
|
|
191
229
|
private readonly authenticate;
|
|
192
230
|
/** The functions that `stop()` waits on: each one runs when no call is in flight */
|
|
193
231
|
private idleWaiters;
|
|
194
232
|
/** The publisher of the remote events, from the option `events`, or undefined. */
|
|
195
233
|
readonly publisher: EventPublisher | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* How the server can authenticate a request with ambient credentials (cookies). The network faces
|
|
236
|
+
* read it: they trust such a request only from a named origin (CSRF).
|
|
237
|
+
*/
|
|
238
|
+
readonly ambientCredentials: AmbientCredentials | undefined;
|
|
196
239
|
constructor(options?: ProcedureServerOptions);
|
|
197
240
|
/**
|
|
198
241
|
* Get storage for a collection.
|
|
@@ -218,7 +261,11 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
218
261
|
* failed flush keeps the old storage and throws. A call that arrives during the flush goes
|
|
219
262
|
* to the old storage.
|
|
220
263
|
* - `close`: the server closes the old storage after the change. The close of a
|
|
221
|
-
* `HybridStorage` sends the writes that arrived during the flush.
|
|
264
|
+
* `HybridStorage` sends the writes that arrived during the flush. An old storage that another
|
|
265
|
+
* collection still uses stays open: the server closes it when the last collection leaves it.
|
|
266
|
+
* - The new calls use the new storage at once. Before the close, the server waits for the calls
|
|
267
|
+
* that took the old storage, for the time of `grace` at most. Before, such a call could fail
|
|
268
|
+
* because the storage was closed.
|
|
222
269
|
*
|
|
223
270
|
* @param name - Collection name
|
|
224
271
|
* @param storage - Storage backend
|
|
@@ -227,8 +274,18 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
227
274
|
*/
|
|
228
275
|
useStorage<T>(name: string, storage: CollectionStorage<T>): this;
|
|
229
276
|
useStorage<T>(name: string, storage: CollectionStorage<T>, options: UseStorageOptions): Promise<this>;
|
|
230
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* The change of `useStorage` with options: flush the old storage, change, wait for the calls on
|
|
279
|
+
* the old storage, and close it.
|
|
280
|
+
*/
|
|
231
281
|
private replaceStorage;
|
|
282
|
+
/** A promise that resolves when no call uses the storage, or when `graceMs` ends. */
|
|
283
|
+
private callsOnStorageEnded;
|
|
284
|
+
/**
|
|
285
|
+
* The repository of one call. The call is a user of each storage that it takes, until
|
|
286
|
+
* `release()`. Then a close of `useStorage` can go on.
|
|
287
|
+
*/
|
|
288
|
+
private callRepository;
|
|
232
289
|
/**
|
|
233
290
|
* Configure multiple storages at once.
|
|
234
291
|
*
|
|
@@ -282,9 +339,11 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
282
339
|
*/
|
|
283
340
|
private invoke;
|
|
284
341
|
/**
|
|
285
|
-
* The token check and the principal of a request (roadmap R18).
|
|
286
|
-
* credentials
|
|
287
|
-
*
|
|
342
|
+
* The token check and the principal of a request (roadmap R18). The request hook reads the
|
|
343
|
+
* credentials of a network request first: a bearer token, a principal and a narrowing. A
|
|
344
|
+
* network request (with credentials) must present the token. The authenticate function gives
|
|
345
|
+
* the principal. The function gives an UNAUTHORIZED response, or undefined when the request
|
|
346
|
+
* passes.
|
|
288
347
|
*/
|
|
289
348
|
private admit;
|
|
290
349
|
/** One call in flight ended: `stop()` can go on when it was the last one. */
|
|
@@ -299,6 +358,12 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
299
358
|
* still stops with its caller, because nobody can read it again.
|
|
300
359
|
*/
|
|
301
360
|
private runKeyed;
|
|
361
|
+
/**
|
|
362
|
+
* The capability of a request. It comes from the server, never from the request. The remaining
|
|
363
|
+
* time of the caller and the narrowing of the request can only make it narrower
|
|
364
|
+
* (CAPABILITIES-2026-10, decision 9). Two different clearances without an order throw.
|
|
365
|
+
*/
|
|
366
|
+
private capabilityOf;
|
|
302
367
|
/** Run a procedure for a request with a signal. */
|
|
303
368
|
private run;
|
|
304
369
|
/**
|
|
@@ -306,8 +371,9 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
306
371
|
* Creates standard CRUD procedures using the configured storage.
|
|
307
372
|
*
|
|
308
373
|
* @param collectionName - Collection name
|
|
374
|
+
* @param options - The query policy of `find`. `$regex` is off unless the policy permits it.
|
|
309
375
|
*/
|
|
310
|
-
registerCollectionProcedures(collectionName: string): void;
|
|
376
|
+
registerCollectionProcedures(collectionName: string, options?: CollectionProceduresOptions): void;
|
|
311
377
|
/** The paths that the server serves now. */
|
|
312
378
|
private servedKeys;
|
|
313
379
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedure-server.d.ts","sourceRoot":"","sources":["../../src/server/procedure-server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"procedure-server.d.ts","sourceRoot":"","sources":["../../src/server/procedure-server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAmB,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEpJ,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAsB,MAAM,2BAA2B,CAAC;AAElF,OAAO,EAAoC,KAAK,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