@procedures/client 0.19.0 → 0.20.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.
- package/CHANGELOG.md +31 -0
- package/README.md +5 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/http/server/strategies.d.ts +17 -0
- 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/types.d.ts +6 -3
- package/dist/adapters/http/server/types.d.ts.map +1 -1
- package/dist/browser.d.ts +5 -5
- package/dist/browser.js +5 -5
- package/dist/index.d.ts +10 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -13
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +4 -5
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +4 -5
- package/dist/node.js.map +1 -1
- package/dist/server/browser-guard.d.ts +16 -4
- package/dist/server/browser-guard.d.ts.map +1 -1
- package/dist/server/browser-guard.js.map +1 -1
- package/dist/server/index.d.ts +3 -66
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -22
- package/dist/server/index.js.map +1 -1
- package/package.json +2 -1
- package/src/adapters/http/server/strategies.ts +16 -0
- package/src/adapters/http/server/types.ts +6 -3
- package/src/browser.ts +5 -5
- package/src/index.ts +11 -25
- package/src/node.ts +5 -6
- package/src/server/browser-guard.ts +19 -7
- package/src/server/index.ts +3 -90
|
@@ -14,6 +14,23 @@ export interface RoutedRequest {
|
|
|
14
14
|
/** The path of the URL, without the query. */
|
|
15
15
|
readonly path: string;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The request that a URL strategy of `HttpServerTransport` gets (CLI-61). The type is structural:
|
|
19
|
+
* a `Request` of Express agrees with it, and so does the `UrlRequest` of `procedureHandler`. Thus
|
|
20
|
+
* the type names no `express` and no Node module.
|
|
21
|
+
*/
|
|
22
|
+
export interface UrlStrategyRequest extends RoutedRequest {
|
|
23
|
+
/** The URL of the request line: the path and the query. */
|
|
24
|
+
readonly url: string;
|
|
25
|
+
/** The headers of the request, by lower-case name. */
|
|
26
|
+
readonly headers: {
|
|
27
|
+
readonly [name: string]: string | string[] | undefined;
|
|
28
|
+
};
|
|
29
|
+
/** The query parameters. Express gives its parsed query. */
|
|
30
|
+
readonly query?: unknown;
|
|
31
|
+
/** The body that a body parser of the app gives. Without a body parser, the body is absent. */
|
|
32
|
+
readonly body?: unknown;
|
|
33
|
+
}
|
|
17
34
|
/**
|
|
18
35
|
* Default URL strategy: RESTful routes.
|
|
19
36
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/server/strategies.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGvD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAmC1E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAuBtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,SAAS,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,MAAM,GAAG,IAAI,CASvG;AAED,0FAA0F;AAC1F,eAAO,MAAM,wBAAwB,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,MAAM,GAAG,IAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/server/strategies.ts"],"names":[],"mappings":"AAAA;;;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AAE,GAAG,CAAC,MAAM,CAAC,WAAW,EAAW,CAAC,CAAC;IAC1E,CAAC,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,MAAM,CAAC,MAAM,wBAAwB,GAA0C,8BAA8B,EAAE,CAAC"}
|
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for HTTP server adapter.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { Express } from "express";
|
|
7
7
|
import type { Server as HttpServer } from "http";
|
|
8
8
|
import type { Method } from "../../../client/types.js";
|
|
9
9
|
import type { BrowserGuardOptions } from "../../../server/browser-guard.js";
|
|
10
10
|
import type { Clock } from "../../../clock.js";
|
|
11
11
|
import type { Duration } from "../../../duration.js";
|
|
12
12
|
import type { Addressing } from "./addressing.js";
|
|
13
|
+
import type { UrlStrategyRequest } from "./strategies.js";
|
|
13
14
|
/**
|
|
14
|
-
* URL strategy
|
|
15
|
+
* The URL strategy of `HttpServerTransport`: it gives the method of a request, or null when the URL
|
|
16
|
+
* names no method. The transport gives it the `Request` of Express. The parameter type is
|
|
17
|
+
* structural (CLI-61), so a strategy also serves the `UrlRequest` of `procedureHandler`.
|
|
15
18
|
*/
|
|
16
|
-
export type HttpUrlStrategy = (req:
|
|
19
|
+
export type HttpUrlStrategy = (req: UrlStrategyRequest) => Method | null;
|
|
17
20
|
/**
|
|
18
21
|
* HTTP server transport options.
|
|
19
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/server/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/adapters/http/server/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,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AM,EAAE,CAAC;IAEhC;;;;;OAKG;IACH,WAAW,CAAC,EAAE;QACZ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH"}
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Universal Client Library: the browser-safe entry point.
|
|
3
3
|
*
|
|
4
|
-
* This module exports
|
|
5
|
-
* (`HttpServerTransport` and `WebSocketServerTransport`, which use `http` and `ws`)
|
|
6
|
-
*
|
|
7
|
-
* re-exports this module. It also adds the
|
|
8
|
-
*
|
|
4
|
+
* This module exports the client, the procedures, the events and the server engine. The Node
|
|
5
|
+
* server transports (`HttpServerTransport` and `WebSocketServerTransport`, which use `http` and `ws`)
|
|
6
|
+
* have the entry "@procedures/client/node" (CLI-6). A browser bundle imports
|
|
7
|
+
* "@procedures/client/browser". The root entry point re-exports this module. It also adds the URL
|
|
8
|
+
* strategies and the browser checks of the server, which are browser-safe too.
|
|
9
9
|
*
|
|
10
10
|
* Collections (maps, caches, collection storage) are in @procedures/collections.
|
|
11
11
|
* The program store, the storage backends that need a Client (ApiStorage, HybridStorage) and the
|
package/dist/browser.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Universal Client Library: the browser-safe entry point.
|
|
3
3
|
*
|
|
4
|
-
* This module exports
|
|
5
|
-
* (`HttpServerTransport` and `WebSocketServerTransport`, which use `http` and `ws`)
|
|
6
|
-
*
|
|
7
|
-
* re-exports this module. It also adds the
|
|
8
|
-
*
|
|
4
|
+
* This module exports the client, the procedures, the events and the server engine. The Node
|
|
5
|
+
* server transports (`HttpServerTransport` and `WebSocketServerTransport`, which use `http` and `ws`)
|
|
6
|
+
* have the entry "@procedures/client/node" (CLI-6). A browser bundle imports
|
|
7
|
+
* "@procedures/client/browser". The root entry point re-exports this module. It also adds the URL
|
|
8
|
+
* strategies and the browser checks of the server, which are browser-safe too.
|
|
9
9
|
*
|
|
10
10
|
* Collections (maps, caches, collection storage) are in @procedures/collections.
|
|
11
11
|
* The program store, the storage backends that need a Client (ApiStorage, HybridStorage) and the
|
package/dist/index.d.ts
CHANGED
|
@@ -4,21 +4,19 @@
|
|
|
4
4
|
* Protocol-agnostic RPC client with middleware composition
|
|
5
5
|
* and transport adapters.
|
|
6
6
|
*
|
|
7
|
-
* This entry point
|
|
8
|
-
*
|
|
9
|
-
* `ws`,
|
|
10
|
-
*
|
|
7
|
+
* This entry point exports the browser-safe entry point ("@procedures/client/browser"), the URL
|
|
8
|
+
* strategies of the server and the browser checks of the server. It imports no Node built-in, no
|
|
9
|
+
* `ws` and no `express`, and its declarations name none of them (CLI-6, CLI-61). Thus a browser
|
|
10
|
+
* bundle can import it too. The server transports and the procedure faces of Node have the entry
|
|
11
|
+
* "@procedures/client/node".
|
|
11
12
|
*
|
|
12
|
-
* The `WebSocketTransport` of this entry uses the global `WebSocket
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The `WebSocketTransport` of this entry uses the global `WebSocket`. The Node entry
|
|
14
|
+
* "@procedures/client/node" has a `WebSocketTransport` whose sockets are of the `ws` package: a
|
|
15
|
+
* drop ends them at once.
|
|
15
16
|
*/
|
|
16
17
|
export * from "./browser.js";
|
|
17
18
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "./adapters/http/server/strategies.js";
|
|
18
|
-
export {
|
|
19
|
-
export type { HttpServerTransportOptions, HttpUrlStrategy, } from "./server/index.js";
|
|
20
|
-
export { WebSocketServerTransport } from "./server/index.js";
|
|
19
|
+
export type { RoutedRequest } from "./adapters/http/server/strategies.js";
|
|
21
20
|
export { checkBrowserRequest, hasAmbientCredentials, isLoopbackHost, isLoopbackAddress, hostNameOf } from "./server/browser-guard.js";
|
|
22
|
-
export type { BrowserGuardOptions, GuardedRequest, GuardResult } from "./server/browser-guard.js";
|
|
23
|
-
export type { WebSocketServerTransportOptions, WebSocketAuthHandler, WebSocketConnectionHandler, WebSocketMessage, } from "./server/index.js";
|
|
21
|
+
export type { BrowserGuardOptions, GuardedHeaders, GuardedRequest, GuardResult } from "./server/browser-guard.js";
|
|
24
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,cAAc,CAAC;AAK7B,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACtG,YAAY,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,cAAc,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACtI,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,24 +4,20 @@
|
|
|
4
4
|
* Protocol-agnostic RPC client with middleware composition
|
|
5
5
|
* and transport adapters.
|
|
6
6
|
*
|
|
7
|
-
* This entry point
|
|
8
|
-
*
|
|
9
|
-
* `ws`,
|
|
10
|
-
*
|
|
7
|
+
* This entry point exports the browser-safe entry point ("@procedures/client/browser"), the URL
|
|
8
|
+
* strategies of the server and the browser checks of the server. It imports no Node built-in, no
|
|
9
|
+
* `ws` and no `express`, and its declarations name none of them (CLI-6, CLI-61). Thus a browser
|
|
10
|
+
* bundle can import it too. The server transports and the procedure faces of Node have the entry
|
|
11
|
+
* "@procedures/client/node".
|
|
11
12
|
*
|
|
12
|
-
* The `WebSocketTransport` of this entry uses the global `WebSocket
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The `WebSocketTransport` of this entry uses the global `WebSocket`. The Node entry
|
|
14
|
+
* "@procedures/client/node" has a `WebSocketTransport` whose sockets are of the `ws` package: a
|
|
15
|
+
* drop ends them at once.
|
|
15
16
|
*/
|
|
16
17
|
export * from "./browser.js";
|
|
17
18
|
// ============================================================================
|
|
18
|
-
//
|
|
19
|
+
// The URL strategies and the browser checks of the server (browser-safe)
|
|
19
20
|
// ============================================================================
|
|
20
21
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "./adapters/http/server/strategies.js";
|
|
21
|
-
// Deprecated (CLI-6 step 1): import these from "@procedures/client/node". The next MINOR removes
|
|
22
|
-
// them from the root. ./server/index.ts holds the deprecated aliases, so an editor marks each old
|
|
23
|
-
// import, and each alias is the same class or type as the export of ./node.
|
|
24
|
-
export { HttpServerTransport } from "./server/index.js";
|
|
25
|
-
export { WebSocketServerTransport } from "./server/index.js";
|
|
26
22
|
export { checkBrowserRequest, hasAmbientCredentials, isLoopbackHost, isLoopbackAddress, hostNameOf } from "./server/browser-guard.js";
|
|
27
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,cAAc,CAAC;AAE7B,+EAA+E;AAC/E,yEAAyE;AACzE,+EAA+E;AAC/E,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEtG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,cAAc,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/node.d.ts
CHANGED
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
* (CLI-31). `urlAddressing()` is the default, and `bodyPathAddressing()` reads the path from the
|
|
20
20
|
* body of a single endpoint.
|
|
21
21
|
*
|
|
22
|
-
* The server transports are in this entry
|
|
23
|
-
* over `procedureHandler`, and `WebSocketServerTransport`.
|
|
24
|
-
*
|
|
25
|
-
* `http` and no `ws`.
|
|
22
|
+
* The server transports are in this entry only (CLI-6): `HttpServerTransport`, the Express shim
|
|
23
|
+
* over `procedureHandler`, and `WebSocketServerTransport`. Thus the root and `./server` import no
|
|
24
|
+
* `http`, no `ws` and no `express`.
|
|
26
25
|
*/
|
|
27
26
|
export { WebSocketTransport } from "./adapters/websocket/client/node.js";
|
|
28
27
|
export type { WebSocketTransportOptions, WebSocketClass } from "./adapters/websocket/client/types.js";
|
|
@@ -33,7 +32,7 @@ export { readJsonBody, BodyError } from "./adapters/http/server/body.js";
|
|
|
33
32
|
export type { ProcedureHandlerOptions, NodeProcedureHandler, NodeUrlStrategy, UrlRequest } from "./adapters/http/server/handler.js";
|
|
34
33
|
export type { CorsOptions, CredentialedCorsOptions } from "./adapters/http/server/cors.js";
|
|
35
34
|
export { credentialedCors } from "./adapters/http/server/cors.js";
|
|
36
|
-
export type { RoutedRequest } from "./adapters/http/server/strategies.js";
|
|
35
|
+
export type { RoutedRequest, UrlStrategyRequest } from "./adapters/http/server/strategies.js";
|
|
37
36
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "./adapters/http/server/strategies.js";
|
|
38
37
|
export { urlAddressing, bodyPathAddressing } from "./adapters/http/server/addressing.js";
|
|
39
38
|
export type { Addressing, CallAddress, UrlAddressingOptions, BodyPathAddressingOptions } from "./adapters/http/server/addressing.js";
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA
|
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E,MAAM,0CAA0C,CAAC;AACpF,YAAY,EACV,+BAA+B,EAC/B,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,sCAAsC,CAAC"}
|
package/dist/node.js
CHANGED
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
* (CLI-31). `urlAddressing()` is the default, and `bodyPathAddressing()` reads the path from the
|
|
20
20
|
* body of a single endpoint.
|
|
21
21
|
*
|
|
22
|
-
* The server transports are in this entry
|
|
23
|
-
* over `procedureHandler`, and `WebSocketServerTransport`.
|
|
24
|
-
*
|
|
25
|
-
* `http` and no `ws`.
|
|
22
|
+
* The server transports are in this entry only (CLI-6): `HttpServerTransport`, the Express shim
|
|
23
|
+
* over `procedureHandler`, and `WebSocketServerTransport`. Thus the root and `./server` import no
|
|
24
|
+
* `http`, no `ws` and no `express`.
|
|
26
25
|
*/
|
|
27
26
|
export { WebSocketTransport } from "./adapters/websocket/client/node.js";
|
|
28
27
|
export { writeNdjsonStream } from "./adapters/http/server/ndjson.js";
|
|
@@ -34,7 +33,7 @@ export { credentialedCors } from "./adapters/http/server/cors.js";
|
|
|
34
33
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "./adapters/http/server/strategies.js";
|
|
35
34
|
// The addressing of a request: the URL (the default), or the path in the body of a single endpoint (CLI-31)
|
|
36
35
|
export { urlAddressing, bodyPathAddressing } from "./adapters/http/server/addressing.js";
|
|
37
|
-
// The server transports (CLI-6):
|
|
36
|
+
// The server transports (CLI-6): only this entry exports them
|
|
38
37
|
export { HttpServerTransport } from "./adapters/http/server/transport.js";
|
|
39
38
|
export { upgradeHandler } from "./adapters/websocket/server/upgrade.js";
|
|
40
39
|
export { WebSocketServerTransport } from "./adapters/websocket/server/transport.js";
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,0GAA0G;AAC1G,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAGzE,0FAA0F;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACtG,4GAA4G;AAC5G,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAEzF,8DAA8D;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC"}
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
*
|
|
22
22
|
* Each refusal is the error `FORBIDDEN` of wire v1, with the status 403 and a reason (CLI-4).
|
|
23
23
|
*/
|
|
24
|
-
import type { IncomingHttpHeaders } from "node:http";
|
|
25
24
|
/** The options of the browser checks of a server transport. */
|
|
26
25
|
export interface BrowserGuardOptions {
|
|
27
26
|
/**
|
|
@@ -43,10 +42,23 @@ export interface BrowserGuardOptions {
|
|
|
43
42
|
*/
|
|
44
43
|
allowGet?: boolean | undefined;
|
|
45
44
|
}
|
|
46
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* The headers of a request, by lower-case name. The type is structural, so the root names no Node
|
|
47
|
+
* module (CLI-61). `IncomingHttpHeaders` of `node:http` agrees with it.
|
|
48
|
+
*/
|
|
49
|
+
export interface GuardedHeaders {
|
|
50
|
+
readonly [name: string]: string | string[] | undefined;
|
|
51
|
+
readonly host?: string | undefined;
|
|
52
|
+
readonly origin?: string | undefined;
|
|
53
|
+
readonly cookie?: string | undefined;
|
|
54
|
+
readonly "content-type"?: string | undefined;
|
|
55
|
+
readonly "content-length"?: string | undefined;
|
|
56
|
+
readonly "transfer-encoding"?: string | undefined;
|
|
57
|
+
}
|
|
58
|
+
/** The parts of an incoming request that the checks read. An `IncomingMessage` of `node:http` agrees with it. */
|
|
47
59
|
export interface GuardedRequest {
|
|
48
60
|
method?: string | undefined;
|
|
49
|
-
headers:
|
|
61
|
+
headers: GuardedHeaders;
|
|
50
62
|
socket?: {
|
|
51
63
|
localAddress?: string | undefined;
|
|
52
64
|
} | undefined;
|
|
@@ -78,7 +90,7 @@ export declare function hostNameOf(header: string | undefined): string;
|
|
|
78
90
|
* True when a request carries ambient credentials: a `Cookie` header, which a browser sends by
|
|
79
91
|
* itself, also for a request that another site starts.
|
|
80
92
|
*/
|
|
81
|
-
export declare function hasAmbientCredentials(headers:
|
|
93
|
+
export declare function hasAmbientCredentials(headers: GuardedHeaders): boolean;
|
|
82
94
|
/**
|
|
83
95
|
* The checks of the host, the origin and the fetch site, for HTTP and WebSocket requests.
|
|
84
96
|
* `http` adds the checks of the method and the body. `ambient` is true when the server can trust
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-guard.d.ts","sourceRoot":"","sources":["../../src/server/browser-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"browser-guard.d.ts","sourceRoot":"","sources":["../../src/server/browser-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,+DAA+D;AAC/D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC,CA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BAAoB,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;IACpH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAON,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAItE;AAED,gHAAgH;AAChH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAI7D;AA+BD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAGtE;AA4BD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,OAAO,GAAE,mBAAwB,EACjC,IAAI,UAAQ,EACZ,OAAO,UAAQ,GACd,WAAW,CAkCb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-guard.js","sourceRoot":"","sources":["../../src/server/browser-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"browser-guard.js","sourceRoot":"","sources":["../../src/server/browser-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AA+D3E,wFAAwF;AACxF,SAAS,OAAO,CAAC,MAAqD,EAAE,OAAe;IACrF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACxE,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,cAAc,CAAC,GAAG,CA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C;QACvC,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,GAAG,IAAI,OAAO,CAAC,EAAE,CAAC;YACnG,OAAO,OAAO,CAAC,oBAAoB,EAAE,wCAAwC,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACnD,IAAI,CAAC,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACjE,OAAO,OAAO,CAAC,oBAAoB,EAAE,uCAAuC,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;YAC7D,OAAO,OAAO,CAAC,wBAAwB,EAAE,2EAA2E,CAAC,CAAC;QACxH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* - Handler registry with pattern matching
|
|
12
12
|
* - Graceful shutdown
|
|
13
13
|
*
|
|
14
|
-
* The server transports have the entry `@procedures/client/node` (CLI-6). This entry
|
|
15
|
-
*
|
|
14
|
+
* The server transports have the entry `@procedures/client/node` (CLI-6). This entry imports no
|
|
15
|
+
* Node built-in, no `ws` and no `express`, and its declarations name none of them (CLI-61).
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```typescript
|
|
@@ -37,10 +37,6 @@
|
|
|
37
37
|
* await httpTransport.start();
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
import { HttpServerTransport as NodeHttpServerTransport } from "../adapters/http/server/transport.js";
|
|
41
|
-
import type { HttpServerTransportOptions as NodeHttpServerTransportOptions, HttpUrlStrategy as NodeHttpUrlStrategy } from "../adapters/http/server/types.js";
|
|
42
|
-
import { WebSocketServerTransport as NodeWebSocketServerTransport } from "../adapters/websocket/server/transport.js";
|
|
43
|
-
import type { WebSocketServerTransportOptions as NodeWebSocketServerTransportOptions, WebSocketAuthHandler as NodeWebSocketAuthHandler, WebSocketConnectionHandler as NodeWebSocketConnectionHandler, WebSocketMessage as NodeWebSocketMessage } from "../adapters/websocket/server/types.js";
|
|
44
40
|
export { Server } from "./server.js";
|
|
45
41
|
export type { ServerOptions } from "./server.js";
|
|
46
42
|
export { ProcedureServer, createProcedureServer, STREAM_METADATA_KEY, isUnboundedStream } from "./procedure-server.js";
|
|
@@ -48,64 +44,5 @@ export type { ProcedureServerOptions, RegisterProcedureOptions, StorageConfig, S
|
|
|
48
44
|
export { pathToMethod, methodToPath, methodName } from "./method.js";
|
|
49
45
|
export { HandlerNotFoundError, ServerError, type ServerRequest, type ServerResponse, type RequestHandler, type Credentials, type Principal, type PrincipalOf, type RequestIdentity, type AmbientCredentials, type ServerDebugReport, type ServerHandler, type ServerMiddleware, type ServerContext, type ServerRunner, type ServerTransport, } from "./types.js";
|
|
50
46
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "../adapters/http/server/strategies.js";
|
|
51
|
-
|
|
52
|
-
* The HTTP server transport of Express, a shim over `procedureHandler`.
|
|
53
|
-
*
|
|
54
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
55
|
-
*/
|
|
56
|
-
export declare const HttpServerTransport: typeof NodeHttpServerTransport;
|
|
57
|
-
/**
|
|
58
|
-
* The HTTP server transport of Express, a shim over `procedureHandler`.
|
|
59
|
-
*
|
|
60
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
61
|
-
*/
|
|
62
|
-
export type HttpServerTransport = NodeHttpServerTransport;
|
|
63
|
-
/**
|
|
64
|
-
* The options of `HttpServerTransport`.
|
|
65
|
-
*
|
|
66
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
67
|
-
*/
|
|
68
|
-
export type HttpServerTransportOptions = NodeHttpServerTransportOptions;
|
|
69
|
-
/**
|
|
70
|
-
* The URL strategy of `HttpServerTransport`: it gives the method of an Express request.
|
|
71
|
-
*
|
|
72
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
73
|
-
*/
|
|
74
|
-
export type HttpUrlStrategy = NodeHttpUrlStrategy;
|
|
75
|
-
/**
|
|
76
|
-
* The WebSocket server transport, on the `ws` package.
|
|
77
|
-
*
|
|
78
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
79
|
-
*/
|
|
80
|
-
export declare const WebSocketServerTransport: typeof NodeWebSocketServerTransport;
|
|
81
|
-
/**
|
|
82
|
-
* The WebSocket server transport, on the `ws` package.
|
|
83
|
-
*
|
|
84
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
85
|
-
*/
|
|
86
|
-
export type WebSocketServerTransport = NodeWebSocketServerTransport;
|
|
87
|
-
/**
|
|
88
|
-
* The options of `WebSocketServerTransport`.
|
|
89
|
-
*
|
|
90
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
91
|
-
*/
|
|
92
|
-
export type WebSocketServerTransportOptions = NodeWebSocketServerTransportOptions;
|
|
93
|
-
/**
|
|
94
|
-
* The authentication handler of `WebSocketServerTransport`, for each upgrade request.
|
|
95
|
-
*
|
|
96
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
97
|
-
*/
|
|
98
|
-
export type WebSocketAuthHandler = NodeWebSocketAuthHandler;
|
|
99
|
-
/**
|
|
100
|
-
* The connection handler of `WebSocketServerTransport`, for each new connection.
|
|
101
|
-
*
|
|
102
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
103
|
-
*/
|
|
104
|
-
export type WebSocketConnectionHandler = NodeWebSocketConnectionHandler;
|
|
105
|
-
/**
|
|
106
|
-
* The RPC message of `WebSocketServerTransport`.
|
|
107
|
-
*
|
|
108
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
109
|
-
*/
|
|
110
|
-
export type WebSocketMessage<TReq = unknown> = NodeWebSocketMessage<TReq>;
|
|
47
|
+
export type { RoutedRequest } from "../adapters/http/server/strategies.js";
|
|
111
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;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,wBAAwB,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACvK,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrE,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,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AACvG,YAAY,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* - Handler registry with pattern matching
|
|
12
12
|
* - Graceful shutdown
|
|
13
13
|
*
|
|
14
|
-
* The server transports have the entry `@procedures/client/node` (CLI-6). This entry
|
|
15
|
-
*
|
|
14
|
+
* The server transports have the entry `@procedures/client/node` (CLI-6). This entry imports no
|
|
15
|
+
* Node built-in, no `ws` and no `express`, and its declarations name none of them (CLI-61).
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```typescript
|
|
@@ -37,29 +37,9 @@
|
|
|
37
37
|
* await httpTransport.start();
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
import { HttpServerTransport as NodeHttpServerTransport } from "../adapters/http/server/transport.js";
|
|
41
|
-
import { WebSocketServerTransport as NodeWebSocketServerTransport } from "../adapters/websocket/server/transport.js";
|
|
42
40
|
export { Server } from "./server.js";
|
|
43
41
|
export { ProcedureServer, createProcedureServer, STREAM_METADATA_KEY, isUnboundedStream } from "./procedure-server.js";
|
|
44
42
|
export { pathToMethod, methodToPath, methodName } from "./method.js";
|
|
45
43
|
export { HandlerNotFoundError, ServerError, } from "./types.js";
|
|
46
44
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "../adapters/http/server/strategies.js";
|
|
47
|
-
// ============================================================================
|
|
48
|
-
// The server transports: deprecated here (CLI-6 step 1)
|
|
49
|
-
// ============================================================================
|
|
50
|
-
// Their entry is `@procedures/client/node`. This entry and the root (which re-exports these
|
|
51
|
-
// names from this module) give them through deprecated aliases until the next MINOR, so an
|
|
52
|
-
// editor marks each old import. Each alias is the same class or type as the export of ./node.
|
|
53
|
-
/**
|
|
54
|
-
* The HTTP server transport of Express, a shim over `procedureHandler`.
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
57
|
-
*/
|
|
58
|
-
export const HttpServerTransport = NodeHttpServerTransport;
|
|
59
|
-
/**
|
|
60
|
-
* The WebSocket server transport, on the `ws` package.
|
|
61
|
-
*
|
|
62
|
-
* @deprecated Import it from `@procedures/client/node`. The root and `@procedures/client/server` stop exporting it in the next MINOR (CLI-6).
|
|
63
|
-
*/
|
|
64
|
-
export const WebSocketServerTransport = NodeWebSocketServerTransport;
|
|
65
45
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;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,UAAU,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,WAAW,GAeZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@procedures/client",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.20.0",
|
|
5
5
|
"description": "Procedures as data for TypeScript: define typed procedures once and call them in process, over HTTP, WebSocket, the CLI or MCP. Streaming, middleware, retries, caching and a JSON program format.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rpc",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
],
|
|
90
90
|
"client": {
|
|
91
91
|
"browser": [
|
|
92
|
+
".",
|
|
92
93
|
"./browser",
|
|
93
94
|
"./client",
|
|
94
95
|
"./events",
|
|
@@ -18,6 +18,22 @@ export interface RoutedRequest {
|
|
|
18
18
|
readonly path: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* The request that a URL strategy of `HttpServerTransport` gets (CLI-61). The type is structural:
|
|
23
|
+
* a `Request` of Express agrees with it, and so does the `UrlRequest` of `procedureHandler`. Thus
|
|
24
|
+
* the type names no `express` and no Node module.
|
|
25
|
+
*/
|
|
26
|
+
export interface UrlStrategyRequest extends RoutedRequest {
|
|
27
|
+
/** The URL of the request line: the path and the query. */
|
|
28
|
+
readonly url: string;
|
|
29
|
+
/** The headers of the request, by lower-case name. */
|
|
30
|
+
readonly headers: { readonly [name: string]: string | string[] | undefined };
|
|
31
|
+
/** The query parameters. Express gives its parsed query. */
|
|
32
|
+
readonly query?: unknown;
|
|
33
|
+
/** The body that a body parser of the app gives. Without a body parser, the body is absent. */
|
|
34
|
+
readonly body?: unknown;
|
|
35
|
+
}
|
|
36
|
+
|
|
21
37
|
/**
|
|
22
38
|
* Default URL strategy: RESTful routes.
|
|
23
39
|
*
|
|
@@ -4,18 +4,21 @@
|
|
|
4
4
|
* Type definitions for HTTP server adapter.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type { Express } from "express";
|
|
8
8
|
import type { Server as HttpServer } from "http";
|
|
9
9
|
import type { Method } from "../../../client/types.js";
|
|
10
10
|
import type { BrowserGuardOptions } from "../../../server/browser-guard.js";
|
|
11
11
|
import type { Clock } from "../../../clock.js";
|
|
12
12
|
import type { Duration } from "../../../duration.js";
|
|
13
13
|
import type { Addressing } from "./addressing.js";
|
|
14
|
+
import type { UrlStrategyRequest } from "./strategies.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* URL strategy
|
|
17
|
+
* The URL strategy of `HttpServerTransport`: it gives the method of a request, or null when the URL
|
|
18
|
+
* names no method. The transport gives it the `Request` of Express. The parameter type is
|
|
19
|
+
* structural (CLI-61), so a strategy also serves the `UrlRequest` of `procedureHandler`.
|
|
17
20
|
*/
|
|
18
|
-
export type HttpUrlStrategy = (req:
|
|
21
|
+
export type HttpUrlStrategy = (req: UrlStrategyRequest) => Method | null;
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* HTTP server transport options.
|
package/src/browser.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Universal Client Library: the browser-safe entry point.
|
|
3
3
|
*
|
|
4
|
-
* This module exports
|
|
5
|
-
* (`HttpServerTransport` and `WebSocketServerTransport`, which use `http` and `ws`)
|
|
6
|
-
*
|
|
7
|
-
* re-exports this module. It also adds the
|
|
8
|
-
*
|
|
4
|
+
* This module exports the client, the procedures, the events and the server engine. The Node
|
|
5
|
+
* server transports (`HttpServerTransport` and `WebSocketServerTransport`, which use `http` and `ws`)
|
|
6
|
+
* have the entry "@procedures/client/node" (CLI-6). A browser bundle imports
|
|
7
|
+
* "@procedures/client/browser". The root entry point re-exports this module. It also adds the URL
|
|
8
|
+
* strategies and the browser checks of the server, which are browser-safe too.
|
|
9
9
|
*
|
|
10
10
|
* Collections (maps, caches, collection storage) are in @procedures/collections.
|
|
11
11
|
* The program store, the storage backends that need a Client (ApiStorage, HybridStorage) and the
|