@fougere/calls 0.9.0-alpha.1 → 0.9.3-alpha.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -16
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/index.ts +9 -16
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,KAAK,SAAS,EAA0B,MAAM,eAAe,CAAC;AAInI,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE1D,sDAAsD;AACtD,eAAO,MAAM,QAAQ,UAAU,CAAC;AAEhC,MAAM,WAAW,YAAY;IAC3B,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;CACzC;AA+ED,2FAA2F;AAC3F,wBAAgB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,CA+E3D"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CARRIES_LINE, frond, LogLine } from '@fougere/core';
|
|
1
|
+
import { CARRIES_LINE, declaredTopologyOf, frond, LogLine } from '@fougere/core';
|
|
2
2
|
import KeepHandler from './KeepHandler.js';
|
|
3
3
|
import { CallRing } from './CallRing.js';
|
|
4
4
|
import { ErrorRing, LogRing, QueryRing } from './rings.js';
|
|
@@ -7,14 +7,16 @@ import { servePanel } from './panel.js';
|
|
|
7
7
|
export const CALLS_OP = 'calls';
|
|
8
8
|
/** What this process serves, read from the app itself. */
|
|
9
9
|
function servedModel(app) {
|
|
10
|
+
// What the config SAYS. What the runtime saw is in the ring, under `route` — and the two
|
|
11
|
+
// disagree exactly when something is misconfigured, which is the whole point of showing
|
|
12
|
+
// them side by side. `rpc.topology` calls a frond remote because it ANSWERED.
|
|
13
|
+
const declared = declaredTopologyOf(app);
|
|
14
|
+
const stated = new Map(declared.fronds.map((one) => [one.frond, one]));
|
|
10
15
|
return {
|
|
11
16
|
fronds: app.fronds.filter((frond) => !frond.brought).map((frond) => ({
|
|
12
17
|
name: frond.name,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// showing them side by side. `rpc.topology` calls a frond remote because it ANSWERED.
|
|
16
|
-
declared: app.remotes[frond.name] ? 'remote' : 'local',
|
|
17
|
-
at: app.remotes[frond.name] ? hostOf(app.remotes[frond.name]) : null,
|
|
18
|
+
declared: stated.get(frond.name)?.placement ?? 'local',
|
|
19
|
+
at: stated.get(frond.name)?.at ?? null,
|
|
18
20
|
entities: frond.entities.map((entity) => entity.name),
|
|
19
21
|
operations: frond.handlers.flatMap((handler) => {
|
|
20
22
|
const ops = app.operationsFor(handler.address);
|
|
@@ -43,16 +45,6 @@ function servedModel(app) {
|
|
|
43
45
|
})),
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
|
-
/** Host and port only — a declared address may carry credentials, and this answer leaves. */
|
|
47
|
-
function hostOf(address) {
|
|
48
|
-
try {
|
|
49
|
-
const url = new URL(address);
|
|
50
|
-
return `${url.protocol}//${url.host}`;
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return address;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
48
|
function nameOf(schema) {
|
|
57
49
|
const named = schema;
|
|
58
50
|
if (!named)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY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G,EAAE,KAAK,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,GAAQ;YACjB,MAAM,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YAC5B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/calls",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3-alpha.0",
|
|
4
4
|
"description": "Optional call log for Fougere: a bounded ring of every dispatch, served as an rpc operation. Read it with `fougere devtools`.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fougere",
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"src"
|
|
31
31
|
],
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@fougere/
|
|
34
|
-
"@fougere/
|
|
33
|
+
"@fougere/adapter-sql": "^0.9.3-alpha.0",
|
|
34
|
+
"@fougere/core": "^0.9.3-alpha.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"vitest": "^4.1.0",
|
|
38
|
-
"@fougere/adapter-sql": "0.9.
|
|
39
|
-
"@fougere/
|
|
40
|
-
"@fougere/
|
|
41
|
-
"@fougere/
|
|
42
|
-
"@fougere/
|
|
43
|
-
"@fougere/
|
|
38
|
+
"@fougere/adapter-sql": "0.9.3-alpha.0",
|
|
39
|
+
"@fougere/core": "0.9.3-alpha.0",
|
|
40
|
+
"@fougere/container": "0.9.3-alpha.0",
|
|
41
|
+
"@fougere/schema": "0.9.3-alpha.0",
|
|
42
|
+
"@fougere/transport-http": "0.9.3-alpha.0",
|
|
43
|
+
"@fougere/compiler": "0.9.3-alpha.0"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CARRIES_LINE, frond, LogLine, type App, type Extension, type InvocationContext } from '@fougere/core';
|
|
1
|
+
import { CARRIES_LINE, declaredTopologyOf, frond, LogLine, type App, type Extension, type InvocationContext } from '@fougere/core';
|
|
2
2
|
import KeepHandler from './KeepHandler.js';
|
|
3
3
|
import { CallRing } from './CallRing.js';
|
|
4
4
|
import { ErrorRing, LogRing, QueryRing } from './rings.js';
|
|
@@ -18,14 +18,17 @@ export interface CallsOptions {
|
|
|
18
18
|
|
|
19
19
|
/** What this process serves, read from the app itself. */
|
|
20
20
|
function servedModel(app: App): unknown {
|
|
21
|
+
// What the config SAYS. What the runtime saw is in the ring, under `route` — and the two
|
|
22
|
+
// disagree exactly when something is misconfigured, which is the whole point of showing
|
|
23
|
+
// them side by side. `rpc.topology` calls a frond remote because it ANSWERED.
|
|
24
|
+
const declared = declaredTopologyOf(app);
|
|
25
|
+
const stated = new Map(declared.fronds.map((one) => [one.frond, one]));
|
|
26
|
+
|
|
21
27
|
return {
|
|
22
28
|
fronds: app.fronds.filter((frond) => !frond.brought).map((frond) => ({
|
|
23
29
|
name: frond.name,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// showing them side by side. `rpc.topology` calls a frond remote because it ANSWERED.
|
|
27
|
-
declared: app.remotes[frond.name] ? 'remote' as const : 'local' as const,
|
|
28
|
-
at: app.remotes[frond.name] ? hostOf(app.remotes[frond.name]!) : null,
|
|
30
|
+
declared: stated.get(frond.name)?.placement ?? 'local',
|
|
31
|
+
at: stated.get(frond.name)?.at ?? null,
|
|
29
32
|
entities: frond.entities.map((entity) => entity.name),
|
|
30
33
|
operations: frond.handlers.flatMap((handler) => {
|
|
31
34
|
const ops = app.operationsFor(handler.address);
|
|
@@ -55,16 +58,6 @@ function servedModel(app: App): unknown {
|
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
/** Host and port only — a declared address may carry credentials, and this answer leaves. */
|
|
59
|
-
function hostOf(address: string): string {
|
|
60
|
-
try {
|
|
61
|
-
const url = new URL(address);
|
|
62
|
-
return `${url.protocol}//${url.host}`;
|
|
63
|
-
} catch {
|
|
64
|
-
return address;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
61
|
function nameOf(schema: unknown): string | null {
|
|
69
62
|
const named = schema as { getName?: () => string; name?: string } | undefined;
|
|
70
63
|
if (!named) return null;
|