@procedures/client 0.32.0 → 0.34.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 +59 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/http/server/addressing.d.ts.map +1 -1
- package/dist/adapters/http/server/addressing.js +6 -2
- package/dist/adapters/http/server/addressing.js.map +1 -1
- package/dist/adapters/local/client/transport.js +2 -1
- package/dist/adapters/local/client/transport.js.map +1 -1
- package/dist/browser.d.ts +3 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -3
- package/dist/browser.js.map +1 -1
- package/dist/events/publisher.d.ts +6 -8
- package/dist/events/publisher.d.ts.map +1 -1
- package/dist/events/publisher.js +7 -31
- package/dist/events/publisher.js.map +1 -1
- package/dist/procedures/collection/changes.d.ts +2 -2
- package/dist/procedures/collection/changes.js +2 -2
- package/dist/procedures/collection/index.js +1 -1
- package/dist/procedures/collection/index.js.map +1 -1
- package/dist/procedures/collection/partition.d.ts +8 -56
- package/dist/procedures/collection/partition.d.ts.map +1 -1
- package/dist/procedures/collection/partition.js +7 -73
- package/dist/procedures/collection/partition.js.map +1 -1
- package/dist/procedures/collection/topic.d.ts +27 -39
- package/dist/procedures/collection/topic.d.ts.map +1 -1
- package/dist/procedures/collection/topic.js +55 -38
- package/dist/procedures/collection/topic.js.map +1 -1
- package/dist/procedures/core/schemas.d.ts +26 -10
- package/dist/procedures/core/schemas.d.ts.map +1 -1
- package/dist/procedures/core/schemas.js +34 -16
- package/dist/procedures/core/schemas.js.map +1 -1
- package/dist/procedures/define-procedure.d.ts.map +1 -1
- package/dist/procedures/define-procedure.js +5 -5
- package/dist/procedures/define-procedure.js.map +1 -1
- package/dist/procedures/index.d.ts +4 -3
- package/dist/procedures/index.d.ts.map +1 -1
- package/dist/procedures/index.js +5 -3
- package/dist/procedures/index.js.map +1 -1
- package/dist/procedures/module.d.ts +22 -0
- package/dist/procedures/module.d.ts.map +1 -1
- package/dist/procedures/module.js +18 -0
- package/dist/procedures/module.js.map +1 -1
- package/dist/procedures/registry.d.ts +2 -1
- package/dist/procedures/registry.d.ts.map +1 -1
- package/dist/procedures/registry.js +4 -2
- package/dist/procedures/registry.js.map +1 -1
- package/dist/procedures/segments.d.ts +61 -0
- package/dist/procedures/segments.d.ts.map +1 -0
- package/dist/procedures/segments.js +71 -0
- package/dist/procedures/segments.js.map +1 -0
- package/dist/procedures/types.d.ts +5 -2
- package/dist/procedures/types.d.ts.map +1 -1
- package/dist/procedures/types.js +8 -4
- package/dist/procedures/types.js.map +1 -1
- package/dist/server/host-policy.d.ts +1 -1
- package/dist/server/host-policy.d.ts.map +1 -1
- package/dist/server/host-policy.js +5 -3
- package/dist/server/host-policy.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/method.d.ts +18 -3
- package/dist/server/method.d.ts.map +1 -1
- package/dist/server/method.js +23 -6
- package/dist/server/method.js.map +1 -1
- package/dist/server/procedure-server.d.ts +5 -23
- package/dist/server/procedure-server.d.ts.map +1 -1
- package/dist/server/procedure-server.js +4 -29
- package/dist/server/procedure-server.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/http/server/addressing.ts +6 -2
- package/src/adapters/local/client/transport.ts +2 -2
- package/src/browser.ts +6 -1
- package/src/events/publisher.ts +14 -40
- package/src/procedures/collection/changes.ts +2 -2
- package/src/procedures/collection/index.ts +1 -1
- package/src/procedures/collection/partition.ts +10 -87
- package/src/procedures/collection/topic.ts +48 -51
- package/src/procedures/core/schemas.ts +35 -16
- package/src/procedures/define-procedure.ts +5 -7
- package/src/procedures/index.ts +6 -2
- package/src/procedures/module.ts +34 -0
- package/src/procedures/registry.ts +4 -2
- package/src/procedures/segments.ts +74 -0
- package/src/procedures/types.ts +8 -4
- package/src/server/host-policy.ts +5 -4
- package/src/server/index.ts +2 -0
- package/src/server/method.ts +23 -6
- package/src/server/procedure-server.ts +6 -34
package/dist/procedures/types.js
CHANGED
|
@@ -4,17 +4,21 @@
|
|
|
4
4
|
* Core types for procedure definitions, handlers, and registration.
|
|
5
5
|
* Procedures are the foundation for typed RPC calls with schema validation.
|
|
6
6
|
*/
|
|
7
|
+
import { segmentsToTopic, topicToSegments } from "./segments.js";
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* This function gives the key of a path: the segments with dots between them. Each segment encodes
|
|
10
|
+
* `%` as `%25` and `.` as `%2E` (`encodeSegment()`, roadmap CLI-75). Thus the key of
|
|
11
|
+
* `["a.b", "c"]` is `a%2Eb.c`, and not the key of `["a", "b", "c"]`. A plain path keeps its key.
|
|
9
12
|
*/
|
|
10
13
|
export function pathToKey(path) {
|
|
11
|
-
return path
|
|
14
|
+
return segmentsToTopic(path);
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
17
|
+
* This function gives the path of a key: it splits the key on each dot and decodes each segment
|
|
18
|
+
* (`decodeSegment()`, roadmap CLI-75). For each path, `keyToPath(pathToKey(path))` gives the path.
|
|
15
19
|
*/
|
|
16
20
|
export function keyToPath(key) {
|
|
17
|
-
return key
|
|
21
|
+
return topicToSegments(key);
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* Default output mode when not specified.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/procedures/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/procedures/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAkBjE;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAmB;IAC3C,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAilBD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAe,QAAQ,CAAC"}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* - `limits`, `limitStores`: the limits of the calls (CLI-40). Each server of the policy makes one
|
|
22
22
|
* keyed limiter for each limit, and refuses a call above a limit with `RATE_LIMITED`.
|
|
23
23
|
*/
|
|
24
|
-
import type
|
|
24
|
+
import { type Capability, type ClearanceOrder, type ProcedurePath, type ResourcesOf } from "../procedures/types.js";
|
|
25
25
|
import type { AdmitItem, Interceptor, Invocation } from "../procedures/invoke.js";
|
|
26
26
|
import type { PrincipalOf, ServerRequest } from "./types.js";
|
|
27
27
|
import type { BrowserGuardOptions } from "./browser-guard.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-policy.d.ts","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"host-policy.d.ts","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAa,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC/H,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,MA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AC,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,UAAU,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAClG,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,KAAK,WAAW,CAAC,GAAG,SAAS,CAAC;IAC1E,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACnD,0GAA0G;IAC1G,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAAC;IACnD,wEAAwE;IACxE,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,GAAG,SAAS,CAAC;CAC3E;AA4BD,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAqBtE;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAqB/G"}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* - `limits`, `limitStores`: the limits of the calls (CLI-40). Each server of the policy makes one
|
|
22
22
|
* keyed limiter for each limit, and refuses a call above a limit with `RATE_LIMITED`.
|
|
23
23
|
*/
|
|
24
|
+
import { pathToKey } from "../procedures/types.js";
|
|
24
25
|
import { narrowCapability } from "../procedures/capability.js";
|
|
25
26
|
import { timeoutInterceptor } from "../procedures/interceptors.js";
|
|
26
27
|
import { toMs } from "../duration.js";
|
|
@@ -40,7 +41,8 @@ export function exposePatterns(patterns) {
|
|
|
40
41
|
return (path) => {
|
|
41
42
|
if (all)
|
|
42
43
|
return true;
|
|
43
|
-
|
|
44
|
+
// The key encodes a dot in a segment (roadmap CLI-75), as the method name does
|
|
45
|
+
const key = pathToKey(path);
|
|
44
46
|
return exact.has(key) || prefixes.some((prefix) => key.startsWith(prefix));
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -48,7 +50,7 @@ export function exposePatterns(patterns) {
|
|
|
48
50
|
export function surfaceRule(surface) {
|
|
49
51
|
const namespaces = new Set(surface.namespaces);
|
|
50
52
|
const excluded = new Set(surface.exclude ?? []);
|
|
51
|
-
return (path) => namespaces.has(path[0] ?? "") && !excluded.has(path
|
|
53
|
+
return (path) => namespaces.has(path[0] ?? "") && !excluded.has(pathToKey(path));
|
|
52
54
|
}
|
|
53
55
|
/** The capability function of a policy: the capability of the options, narrowed by `readOnly`. */
|
|
54
56
|
function capabilityOfOptions(options) {
|
|
@@ -73,7 +75,7 @@ function exposeOf(options) {
|
|
|
73
75
|
const excluded = new Set(options.exclude ?? []);
|
|
74
76
|
if (excluded.size === 0)
|
|
75
77
|
return rule;
|
|
76
|
-
return (path) => !excluded.has(path
|
|
78
|
+
return (path) => !excluded.has(pathToKey(path)) && (rule ? rule(path) : true);
|
|
77
79
|
}
|
|
78
80
|
/** This function builds the policy of a host from its options. */
|
|
79
81
|
export function hostPolicy(options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-policy.js","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"host-policy.js","sourceRoot":"","sources":["../../src/server/host-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAA8E,MAAM,wBAAwB,CAAC;AAE/H,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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c,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;QACnD,oFAAoF;QACpF,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnE,CAAC;AACJ,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export type { ServerOptions } from "./server.js";
|
|
|
42
42
|
export { ProcedureServer, createProcedureServer, STREAM_METADATA_KEY, isUnboundedStream } from "./procedure-server.js";
|
|
43
43
|
export type { ProcedureServerOptions, RegisterProcedureOptions, StorageConfig, StopOptions, StopParts, StorageHandle, UseStorageOptions } from "./procedure-server.js";
|
|
44
44
|
export { pathToMethod, methodToPath, methodName } from "./method.js";
|
|
45
|
+
export { encodeSegment, decodeSegment, segmentsToTopic, topicToSegments } from "../procedures/segments.js";
|
|
45
46
|
export { HandlerNotFoundError, ServerError, type ServerRequest, type ServerResponse, type RequestHandler, type Credentials, type RequestConnection, type Principal, type PrincipalOf, type RequestIdentity, type Admission, type AmbientCredentials, type ServerDebugReport, type ServerHandler, type ServerMiddleware, type ServerContext, type ServerRunner, type ServerTransport, } from "./types.js";
|
|
46
47
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "../adapters/http/server/strategies.js";
|
|
47
48
|
export type { RoutedRequest } from "../adapters/http/server/strategies.js";
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAErE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC3G,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,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
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
export { Server } from "./server.js";
|
|
41
41
|
export { ProcedureServer, createProcedureServer, STREAM_METADATA_KEY, isUnboundedStream } from "./procedure-server.js";
|
|
42
42
|
export { pathToMethod, methodToPath, methodName } from "./method.js";
|
|
43
|
+
// The escape of a segment with a dot, for a method name, a key and a topic (roadmap CLI-75)
|
|
44
|
+
export { encodeSegment, decodeSegment, segmentsToTopic, topicToSegments } from "../procedures/segments.js";
|
|
43
45
|
export { HandlerNotFoundError, ServerError, } from "./types.js";
|
|
44
46
|
export { defaultServerUrlStrategy, rpcServerUrlStrategy } from "../adapters/http/server/strategies.js";
|
|
45
47
|
//# 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,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,GAiBZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC"}
|
|
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,4FAA4F;AAC5F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC3G,OAAO,EACL,oBAAoB,EACpB,WAAW,GAiBZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC"}
|
package/dist/server/method.d.ts
CHANGED
|
@@ -8,23 +8,38 @@
|
|
|
8
8
|
* (deep dive architecture review 3.3).
|
|
9
9
|
*
|
|
10
10
|
* `methodToPath` splits both the service and the operation on ".", so it reads both forms.
|
|
11
|
+
*
|
|
12
|
+
* Each segment encodes `%` as `%25` and then `.` as `%2E` before the join (`encodeSegment()`,
|
|
13
|
+
* roadmap CLI-75). Thus the path `["collections", "e2e.tabs", "find"]` is the method
|
|
14
|
+
* `{ service: "collections.e2e%2Etabs", operation: "find" }`, and `methodToPath` gives the same
|
|
15
|
+
* three segments again. A segment without `.` and `%` stays the same, so a plain path keeps its method.
|
|
11
16
|
*/
|
|
12
17
|
import type { Method } from "../client/types.js";
|
|
13
18
|
import type { ProcedurePath } from "../procedures/types.js";
|
|
14
19
|
/**
|
|
15
20
|
* This function gives the transport method of a procedure path. The last segment is the
|
|
16
|
-
* operation, and the other segments, joined with dots, are the service.
|
|
17
|
-
* for example `["morning"]`, has
|
|
21
|
+
* operation, and the other segments, joined with dots, are the service. Each segment is encoded
|
|
22
|
+
* first (`encodeSegment()`, roadmap CLI-75). A path of one segment, for example `["morning"]`, has
|
|
23
|
+
* the empty service (CLI-28). An empty path throws.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* pathToMethod(["docker", "compose", "up"]); // { service: "docker.compose", operation: "up" }
|
|
28
|
+
* pathToMethod(["collections", "e2e.tabs", "find"]); // { service: "collections.e2e%2Etabs", operation: "find" }
|
|
29
|
+
* ```
|
|
18
30
|
*/
|
|
19
31
|
export declare function pathToMethod(path: readonly string[]): Method;
|
|
20
32
|
/**
|
|
21
33
|
* The name of a method with dots: `docker.compose.up`, or only the operation for the empty
|
|
22
|
-
* service of a path of one segment (`morning`).
|
|
34
|
+
* service of a path of one segment (`morning`). The segments of the method are already encoded,
|
|
35
|
+
* so the name of `["collections", "e2e.tabs", "find"]` is `collections.e2e%2Etabs.find`.
|
|
23
36
|
*/
|
|
24
37
|
export declare function methodName(method: Pick<Method, "service" | "operation">): string;
|
|
25
38
|
/**
|
|
26
39
|
* This function gives the procedure path of a transport method. It accepts both encodings:
|
|
27
40
|
* `{ service: "a.b", operation: "c" }` and `{ service: "a", operation: "b.c" }` give `["a", "b", "c"]`.
|
|
41
|
+
* It splits on each dot and then decodes each segment (`decodeSegment()`, roadmap CLI-75): `%2E`
|
|
42
|
+
* gives `.` and `%25` gives `%`.
|
|
28
43
|
*/
|
|
29
44
|
export declare function methodToPath(method: Pick<Method, "service" | "operation">): ProcedurePath;
|
|
30
45
|
//# sourceMappingURL=method.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../src/server/method.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../src/server/method.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG5D;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAM5D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC,GAAG,MAAM,CAEhF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC,GAAG,aAAa,CAKzF"}
|
package/dist/server/method.js
CHANGED
|
@@ -8,21 +8,36 @@
|
|
|
8
8
|
* (deep dive architecture review 3.3).
|
|
9
9
|
*
|
|
10
10
|
* `methodToPath` splits both the service and the operation on ".", so it reads both forms.
|
|
11
|
+
*
|
|
12
|
+
* Each segment encodes `%` as `%25` and then `.` as `%2E` before the join (`encodeSegment()`,
|
|
13
|
+
* roadmap CLI-75). Thus the path `["collections", "e2e.tabs", "find"]` is the method
|
|
14
|
+
* `{ service: "collections.e2e%2Etabs", operation: "find" }`, and `methodToPath` gives the same
|
|
15
|
+
* three segments again. A segment without `.` and `%` stays the same, so a plain path keeps its method.
|
|
11
16
|
*/
|
|
17
|
+
import { encodeSegment, topicToSegments } from "../procedures/segments.js";
|
|
12
18
|
/**
|
|
13
19
|
* This function gives the transport method of a procedure path. The last segment is the
|
|
14
|
-
* operation, and the other segments, joined with dots, are the service.
|
|
15
|
-
* for example `["morning"]`, has
|
|
20
|
+
* operation, and the other segments, joined with dots, are the service. Each segment is encoded
|
|
21
|
+
* first (`encodeSegment()`, roadmap CLI-75). A path of one segment, for example `["morning"]`, has
|
|
22
|
+
* the empty service (CLI-28). An empty path throws.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* pathToMethod(["docker", "compose", "up"]); // { service: "docker.compose", operation: "up" }
|
|
27
|
+
* pathToMethod(["collections", "e2e.tabs", "find"]); // { service: "collections.e2e%2Etabs", operation: "find" }
|
|
28
|
+
* ```
|
|
16
29
|
*/
|
|
17
30
|
export function pathToMethod(path) {
|
|
18
31
|
if (path.length === 0) {
|
|
19
32
|
throw new Error("Invalid procedure path: it needs one segment or more");
|
|
20
33
|
}
|
|
21
|
-
|
|
34
|
+
const segments = path.map(encodeSegment);
|
|
35
|
+
return { service: segments.slice(0, -1).join("."), operation: segments[segments.length - 1] };
|
|
22
36
|
}
|
|
23
37
|
/**
|
|
24
38
|
* The name of a method with dots: `docker.compose.up`, or only the operation for the empty
|
|
25
|
-
* service of a path of one segment (`morning`).
|
|
39
|
+
* service of a path of one segment (`morning`). The segments of the method are already encoded,
|
|
40
|
+
* so the name of `["collections", "e2e.tabs", "find"]` is `collections.e2e%2Etabs.find`.
|
|
26
41
|
*/
|
|
27
42
|
export function methodName(method) {
|
|
28
43
|
return method.service === "" ? method.operation : `${method.service}.${method.operation}`;
|
|
@@ -30,11 +45,13 @@ export function methodName(method) {
|
|
|
30
45
|
/**
|
|
31
46
|
* This function gives the procedure path of a transport method. It accepts both encodings:
|
|
32
47
|
* `{ service: "a.b", operation: "c" }` and `{ service: "a", operation: "b.c" }` give `["a", "b", "c"]`.
|
|
48
|
+
* It splits on each dot and then decodes each segment (`decodeSegment()`, roadmap CLI-75): `%2E`
|
|
49
|
+
* gives `.` and `%25` gives `%`.
|
|
33
50
|
*/
|
|
34
51
|
export function methodToPath(method) {
|
|
35
52
|
// The empty service of a path of one segment has no segment. Each other empty segment stays, so
|
|
36
53
|
// a method with ".." or a stray dot names no procedure: the registry has no empty segment (CLI-28)
|
|
37
|
-
const service = method.service === "" ? [] : method.service
|
|
38
|
-
return [...service, ...method.operation
|
|
54
|
+
const service = method.service === "" ? [] : topicToSegments(method.service);
|
|
55
|
+
return [...service, ...topicToSegments(method.operation)];
|
|
39
56
|
}
|
|
40
57
|
//# sourceMappingURL=method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../src/server/method.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../src/server/method.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE3E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,IAAuB;IAClD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAE,EAAE,CAAC;AACjG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAA6C;IACtE,OAAO,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;AAC5F,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,MAA6C;IACxE,gGAAgG;IAChG,mGAAmG;IACnG,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -10,7 +10,7 @@ import type { AnyProcedure, ProcedurePath, RepositoryProvider, ProcedureModule }
|
|
|
10
10
|
import { ProcedureRegistry } from "../procedures/registry.js";
|
|
11
11
|
import { type AdmitItem, type Interceptor, type Invocation } from "../procedures/invoke.js";
|
|
12
12
|
import type { Capability, ClearanceOrder, ProcedureContext, ResourcesOf } from "../procedures/types.js";
|
|
13
|
-
import {
|
|
13
|
+
import type { CollectionPartitions } from "../procedures/collection/partition.js";
|
|
14
14
|
import { type IdempotencyOptions } from "../procedures/idempotency.js";
|
|
15
15
|
import { type Duration } from "../duration.js";
|
|
16
16
|
import type { CollectionStorage } from "../procedures/collection/storage.js";
|
|
@@ -382,26 +382,15 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
382
382
|
* for: the collection procedures and the subscriptions of `EventPublisher` use it. `storageOf`
|
|
383
383
|
* gives the storage of a partition: give the same storage for the same partition each time.
|
|
384
384
|
*
|
|
385
|
-
* The name can have a dot (roadmap CLI-42).
|
|
386
|
-
* name and the partition of a topic stay apart
|
|
387
|
-
*
|
|
388
|
-
* The server refuses partitions of `a` while it has a storage of `a.b` (roadmap CLI-57, decision
|
|
389
|
-
* D23). The plain topic of `a.b` is the topic of the partition `b` of `a`. `useStorage` refuses
|
|
390
|
-
* the other order.
|
|
385
|
+
* The name is the raw name, and it can have a dot (roadmap CLI-42 and CLI-75). Each topic
|
|
386
|
+
* encodes the name, so the name and the partition of a topic stay apart
|
|
387
|
+
* (`collectionChangeTopic()`). The partitions of `a` and a storage of `a.b` do not share a topic.
|
|
391
388
|
*
|
|
392
389
|
* @param name - Collection name
|
|
393
390
|
* @param partitions - The storage of each partition, and the resolver
|
|
394
391
|
* @returns this (for chaining)
|
|
395
|
-
* @throws CollectionTopicCollisionError when the topic of a partition is the topic of a collection with a storage
|
|
396
392
|
*/
|
|
397
393
|
usePartitions<T>(name: string, partitions: CollectionPartitions<T>): this;
|
|
398
|
-
/**
|
|
399
|
-
* The check of the topics of new storages (roadmap CLI-57, decision D23). The plain topic of each
|
|
400
|
-
* one must not be the topic of a partition of a collection with partitions.
|
|
401
|
-
*
|
|
402
|
-
* @throws CollectionTopicCollisionError for the first pair with the same topic
|
|
403
|
-
*/
|
|
404
|
-
private assertPlainTopicsApart;
|
|
405
394
|
/**
|
|
406
395
|
* Configure storage for a collection.
|
|
407
396
|
*
|
|
@@ -418,15 +407,12 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
418
407
|
* that took the old storage, for the time of `grace` at most. Before, such a call could fail
|
|
419
408
|
* because the storage was closed.
|
|
420
409
|
*
|
|
421
|
-
* The
|
|
422
|
-
* The plain topic of `a.b` is the topic of the partition `b` of `a`. With options, the promise
|
|
423
|
-
* rejects, and the old storage stays as it is.
|
|
410
|
+
* The name is the raw name, and it can have a dot. Its topic encodes the name (roadmap CLI-75).
|
|
424
411
|
*
|
|
425
412
|
* @param name - Collection name
|
|
426
413
|
* @param storage - Storage backend
|
|
427
414
|
* @param options - Drain and close the old storage
|
|
428
415
|
* @returns this (for chaining), or a promise of it when options are given
|
|
429
|
-
* @throws CollectionTopicCollisionError when the topic of the collection is the topic of a partition
|
|
430
416
|
*/
|
|
431
417
|
useStorage<T>(name: string, storage: CollectionStorage<T>): this;
|
|
432
418
|
useStorage<T>(name: string, storage: CollectionStorage<T>, options: UseStorageOptions): Promise<this>;
|
|
@@ -445,12 +431,8 @@ export declare class ProcedureServer extends Server implements RepositoryProvide
|
|
|
445
431
|
/**
|
|
446
432
|
* Configure multiple storages at once.
|
|
447
433
|
*
|
|
448
|
-
* The server examines all the names before it sets a storage: a refused name sets none (roadmap
|
|
449
|
-
* CLI-57, decision D23).
|
|
450
|
-
*
|
|
451
434
|
* @param storages - Map of collection names to storage backends
|
|
452
435
|
* @returns this (for chaining)
|
|
453
|
-
* @throws CollectionTopicCollisionError when the topic of a collection is the topic of a partition
|
|
454
436
|
*/
|
|
455
437
|
useStorages(storages: Record<string, CollectionStorage<unknown>>): this;
|
|
456
438
|
/**
|
|
@@ -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,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAmB,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5K,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAsB,MAAM,2BAA2B,CAAC;AAElF,OAAO,EAAoD,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9I,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACxG,OAAO,
|
|
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,EAA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C,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAa5D;CACF;AAMD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,sBAA2B,GACnC,eAAe,CAEjB"}
|
|
@@ -11,7 +11,6 @@ import { pathToKey } from "../procedures/types.js";
|
|
|
11
11
|
import { ProcedureRegistry, PROCEDURE_REGISTRY } from "../procedures/registry.js";
|
|
12
12
|
import { createCollectionProcedures } from "../procedures/collection/procedures.js";
|
|
13
13
|
import { InvocationError, closableUnread, invokeProcedure } from "../procedures/invoke.js";
|
|
14
|
-
import { assertTopicsApart } from "../procedures/collection/partition.js";
|
|
15
14
|
import { VERSION_CONFLICTS_METADATA_KEY, versionConflictsOf } from "../procedures/collection/precondition.js";
|
|
16
15
|
import { TIMEOUT_METADATA_KEY, effectsOf, joinNarrowing, narrowCapability } from "../procedures/capability.js";
|
|
17
16
|
import { IdempotencyCache, idempotencyKeyOf, isRepeatable } from "../procedures/idempotency.js";
|
|
@@ -286,8 +285,7 @@ export class ProcedureServer extends Server {
|
|
|
286
285
|
this.publisher = events instanceof EventPublisher ? events : events ? new EventPublisher({ ...events, clock: events.clock ?? this.clock }) : undefined;
|
|
287
286
|
if (this.publisher)
|
|
288
287
|
this.registerProcedure(this.publisher.procedure, { alwaysOn: true });
|
|
289
|
-
// Configure collections
|
|
290
|
-
// storages for a shared topic (roadmap CLI-57)
|
|
288
|
+
// Configure collections
|
|
291
289
|
if (options.collections) {
|
|
292
290
|
for (const [name, storage] of Object.entries(options.collections)) {
|
|
293
291
|
this.storages.set(name, storage);
|
|
@@ -358,35 +356,20 @@ export class ProcedureServer extends Server {
|
|
|
358
356
|
* for: the collection procedures and the subscriptions of `EventPublisher` use it. `storageOf`
|
|
359
357
|
* gives the storage of a partition: give the same storage for the same partition each time.
|
|
360
358
|
*
|
|
361
|
-
* The name can have a dot (roadmap CLI-42).
|
|
362
|
-
* name and the partition of a topic stay apart
|
|
363
|
-
*
|
|
364
|
-
* The server refuses partitions of `a` while it has a storage of `a.b` (roadmap CLI-57, decision
|
|
365
|
-
* D23). The plain topic of `a.b` is the topic of the partition `b` of `a`. `useStorage` refuses
|
|
366
|
-
* the other order.
|
|
359
|
+
* The name is the raw name, and it can have a dot (roadmap CLI-42 and CLI-75). Each topic
|
|
360
|
+
* encodes the name, so the name and the partition of a topic stay apart
|
|
361
|
+
* (`collectionChangeTopic()`). The partitions of `a` and a storage of `a.b` do not share a topic.
|
|
367
362
|
*
|
|
368
363
|
* @param name - Collection name
|
|
369
364
|
* @param partitions - The storage of each partition, and the resolver
|
|
370
365
|
* @returns this (for chaining)
|
|
371
|
-
* @throws CollectionTopicCollisionError when the topic of a partition is the topic of a collection with a storage
|
|
372
366
|
*/
|
|
373
367
|
usePartitions(name, partitions) {
|
|
374
|
-
assertTopicsApart(this.storages.keys(), (collection) => collection === name);
|
|
375
368
|
this.partitions.set(name, partitions);
|
|
376
369
|
return this;
|
|
377
370
|
}
|
|
378
|
-
/**
|
|
379
|
-
* The check of the topics of new storages (roadmap CLI-57, decision D23). The plain topic of each
|
|
380
|
-
* one must not be the topic of a partition of a collection with partitions.
|
|
381
|
-
*
|
|
382
|
-
* @throws CollectionTopicCollisionError for the first pair with the same topic
|
|
383
|
-
*/
|
|
384
|
-
assertPlainTopicsApart(names) {
|
|
385
|
-
assertTopicsApart(names, (collection) => this.partitions.has(collection));
|
|
386
|
-
}
|
|
387
371
|
useStorage(name, storage, options) {
|
|
388
372
|
if (options === undefined) {
|
|
389
|
-
this.assertPlainTopicsApart([name]);
|
|
390
373
|
this.storages.set(name, storage);
|
|
391
374
|
return this;
|
|
392
375
|
}
|
|
@@ -397,9 +380,6 @@ export class ProcedureServer extends Server {
|
|
|
397
380
|
* the old storage, and close it.
|
|
398
381
|
*/
|
|
399
382
|
async replaceStorage(name, storage, options) {
|
|
400
|
-
// Before the flush: a refused storage changes nothing (roadmap CLI-57). With an old storage,
|
|
401
|
-
// usePartitions() sees the name during the flush. Without one, no await comes before the set.
|
|
402
|
-
this.assertPlainTopicsApart([name]);
|
|
403
383
|
const graceMs = optionalMs(options.grace, "grace") ?? TIMER_DEFAULTS.server.storageGraceMs;
|
|
404
384
|
const old = this.storages.get(name);
|
|
405
385
|
const other = old !== undefined && old !== storage ? old : undefined;
|
|
@@ -473,15 +453,10 @@ export class ProcedureServer extends Server {
|
|
|
473
453
|
/**
|
|
474
454
|
* Configure multiple storages at once.
|
|
475
455
|
*
|
|
476
|
-
* The server examines all the names before it sets a storage: a refused name sets none (roadmap
|
|
477
|
-
* CLI-57, decision D23).
|
|
478
|
-
*
|
|
479
456
|
* @param storages - Map of collection names to storage backends
|
|
480
457
|
* @returns this (for chaining)
|
|
481
|
-
* @throws CollectionTopicCollisionError when the topic of a collection is the topic of a partition
|
|
482
458
|
*/
|
|
483
459
|
useStorages(storages) {
|
|
484
|
-
this.assertPlainTopicsApart(Object.keys(storages));
|
|
485
460
|
for (const [name, storage] of Object.entries(storages)) {
|
|
486
461
|
this.storages.set(name, storage);
|
|
487
462
|
}
|