@fairfox/polly 0.73.0 → 0.73.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/dist/src/polly-ui/Dropdown.d.ts +6 -0
- package/dist/src/polly-ui/index.css +2 -9
- package/dist/src/polly-ui/index.js +60 -7
- package/dist/src/polly-ui/index.js.map +3 -3
- package/dist/src/polly-ui/styles.css +2 -9
- package/dist/tools/verify/src/cli.js +25 -2
- package/dist/tools/verify/src/cli.js.map +3 -3
- package/dist/tools/visualize/src/cli.js +109 -3
- package/dist/tools/visualize/src/cli.js.map +5 -5
- package/package.json +1 -1
|
@@ -1864,14 +1864,37 @@ class HandlerExtractor {
|
|
|
1864
1864
|
return null;
|
|
1865
1865
|
const key = keyArg.getLiteralValue();
|
|
1866
1866
|
const variableName = this.getVariableNameFromParent(node) || key;
|
|
1867
|
+
const access = this.extractMeshAccess(args[2]);
|
|
1867
1868
|
return {
|
|
1868
1869
|
kind,
|
|
1869
1870
|
key,
|
|
1870
1871
|
variableName,
|
|
1871
1872
|
filePath,
|
|
1872
|
-
line: node.getStartLineNumber()
|
|
1873
|
+
line: node.getStartLineNumber(),
|
|
1874
|
+
...access ? { access } : {}
|
|
1873
1875
|
};
|
|
1874
1876
|
}
|
|
1877
|
+
extractMeshAccess(optionsArg) {
|
|
1878
|
+
if (!optionsArg || !Node4.isObjectLiteralExpression(optionsArg))
|
|
1879
|
+
return;
|
|
1880
|
+
const accessProp = optionsArg.getProperty("access");
|
|
1881
|
+
if (!accessProp || !Node4.isPropertyAssignment(accessProp))
|
|
1882
|
+
return;
|
|
1883
|
+
const accessObj = accessProp.getInitializer();
|
|
1884
|
+
if (!accessObj || !Node4.isObjectLiteralExpression(accessObj))
|
|
1885
|
+
return;
|
|
1886
|
+
const predicateText = (name) => {
|
|
1887
|
+
const prop = accessObj.getProperty(name);
|
|
1888
|
+
if (!prop || !Node4.isPropertyAssignment(prop))
|
|
1889
|
+
return;
|
|
1890
|
+
return prop.getInitializer()?.getText().replace(/\s+/g, " ").trim();
|
|
1891
|
+
};
|
|
1892
|
+
const read = predicateText("read");
|
|
1893
|
+
const write = predicateText("write");
|
|
1894
|
+
if (read === undefined && write === undefined)
|
|
1895
|
+
return;
|
|
1896
|
+
return { read: read ?? "unset", write: write ?? "unset" };
|
|
1897
|
+
}
|
|
1875
1898
|
analyzeFileAndImports(sourceFile, handlers, messageTypes, invalidMessageTypes, stateConstraints, globalStateConstraints, verifiedStates, resources) {
|
|
1876
1899
|
const filePath = sourceFile.getFilePath();
|
|
1877
1900
|
if (this.analyzedFiles.has(filePath)) {
|
|
@@ -4639,6 +4662,11 @@ var DEFAULT_ELEMENT_STYLES = {
|
|
|
4639
4662
|
shape: "Cylinder",
|
|
4640
4663
|
background: DEFAULT_COLORS.queryHandler,
|
|
4641
4664
|
color: DEFAULT_COLORS.textDark
|
|
4665
|
+
},
|
|
4666
|
+
"Mesh Transport": {
|
|
4667
|
+
shape: "Pipe",
|
|
4668
|
+
background: DEFAULT_COLORS.service,
|
|
4669
|
+
color: DEFAULT_COLORS.textLight
|
|
4642
4670
|
}
|
|
4643
4671
|
};
|
|
4644
4672
|
var DEFAULT_RELATIONSHIP_STYLES = {
|
|
@@ -4665,6 +4693,29 @@ var DEFAULT_RELATIONSHIP_STYLES = {
|
|
|
4665
4693
|
var DEFAULT_THEME = "https://static.structurizr.com/themes/default/theme.json";
|
|
4666
4694
|
|
|
4667
4695
|
// tools/visualize/src/codegen/structurizr.ts
|
|
4696
|
+
var MESH_TRANSPORT_NODES = [
|
|
4697
|
+
{
|
|
4698
|
+
id: "mesh_net_adapter",
|
|
4699
|
+
name: "MeshNetworkAdapter",
|
|
4700
|
+
description: "Signs and encrypts every mesh operation"
|
|
4701
|
+
},
|
|
4702
|
+
{
|
|
4703
|
+
id: "mesh_webrtc_adapter",
|
|
4704
|
+
name: "MeshWebRTCAdapter",
|
|
4705
|
+
description: "Peer-to-peer WebRTC data channels"
|
|
4706
|
+
},
|
|
4707
|
+
{
|
|
4708
|
+
id: "mesh_signaling_client",
|
|
4709
|
+
name: "MeshSignalingClient",
|
|
4710
|
+
description: "WebRTC offer/answer signalling"
|
|
4711
|
+
},
|
|
4712
|
+
{
|
|
4713
|
+
id: "mesh_signaling_endpoint",
|
|
4714
|
+
name: "Signalling endpoint",
|
|
4715
|
+
description: "The rendezvous server peers exchange WebRTC offers through"
|
|
4716
|
+
}
|
|
4717
|
+
];
|
|
4718
|
+
|
|
4668
4719
|
class StructurizrDSLGenerator {
|
|
4669
4720
|
analysis;
|
|
4670
4721
|
options;
|
|
@@ -4763,6 +4814,9 @@ class StructurizrDSLGenerator {
|
|
|
4763
4814
|
const meshDocs = this.generateMeshDocuments();
|
|
4764
4815
|
if (meshDocs)
|
|
4765
4816
|
parts.push(meshDocs);
|
|
4817
|
+
const meshTransport = this.generateMeshTransport();
|
|
4818
|
+
if (meshTransport)
|
|
4819
|
+
parts.push(meshTransport);
|
|
4766
4820
|
parts.push(this.generateContainerRelationships());
|
|
4767
4821
|
parts.push(" }");
|
|
4768
4822
|
return parts.join(`
|
|
@@ -4794,7 +4848,8 @@ class StructurizrDSLGenerator {
|
|
|
4794
4848
|
continue;
|
|
4795
4849
|
seen.add(sig.key);
|
|
4796
4850
|
const kindLabel = sig.kind === "mesh" ? "Mesh Document" : "Peer Document";
|
|
4797
|
-
const
|
|
4851
|
+
const access = sig.access ? ` · access read=${this.clip(sig.access.read)} write=${this.clip(sig.access.write)}` : "";
|
|
4852
|
+
const description = `${kindLabel} — deriveDocumentId('${sig.key}')${access}`;
|
|
4798
4853
|
parts.push(` ${this.meshDocId(sig.key)} = container "${this.escape(sig.key)}" "${this.escape(description)}" "$${sig.kind}State" {`);
|
|
4799
4854
|
parts.push(` tags "${kindLabel}"`);
|
|
4800
4855
|
parts.push(" }");
|
|
@@ -4805,6 +4860,9 @@ class StructurizrDSLGenerator {
|
|
|
4805
4860
|
meshDocId(key) {
|
|
4806
4861
|
return `mesh_doc_${this.toId(key)}`;
|
|
4807
4862
|
}
|
|
4863
|
+
clip(text, max = 32) {
|
|
4864
|
+
return text.length > max ? `${text.slice(0, max - 1)}…` : text;
|
|
4865
|
+
}
|
|
4808
4866
|
contextForFilePath(filePath) {
|
|
4809
4867
|
const contextKeys = Object.keys(this.analysis.contexts);
|
|
4810
4868
|
if (contextKeys.length === 1)
|
|
@@ -5143,6 +5201,7 @@ class StructurizrDSLGenerator {
|
|
|
5143
5201
|
parts.push(...this.generateMessageFlowRelationships());
|
|
5144
5202
|
parts.push(...this.generateExternalAPIRelationships());
|
|
5145
5203
|
parts.push(...this.generateMeshRelationships());
|
|
5204
|
+
parts.push(...this.generateMeshTransportRelationships());
|
|
5146
5205
|
return parts.join(`
|
|
5147
5206
|
`);
|
|
5148
5207
|
}
|
|
@@ -5162,6 +5221,53 @@ class StructurizrDSLGenerator {
|
|
|
5162
5221
|
}
|
|
5163
5222
|
return parts;
|
|
5164
5223
|
}
|
|
5224
|
+
meshSignalKinds() {
|
|
5225
|
+
const signals = this.analysis.meshOrPeerSignals ?? [];
|
|
5226
|
+
return {
|
|
5227
|
+
mesh: signals.some((s) => s.kind === "mesh"),
|
|
5228
|
+
peer: signals.some((s) => s.kind === "peer")
|
|
5229
|
+
};
|
|
5230
|
+
}
|
|
5231
|
+
generateMeshTransport() {
|
|
5232
|
+
const { mesh, peer } = this.meshSignalKinds();
|
|
5233
|
+
if (!mesh && !peer)
|
|
5234
|
+
return "";
|
|
5235
|
+
const parts = [];
|
|
5236
|
+
if (mesh) {
|
|
5237
|
+
for (const node of MESH_TRANSPORT_NODES) {
|
|
5238
|
+
parts.push(` ${node.id} = container "${node.name}" "${this.escape(node.description)}" "Mesh Transport" {`);
|
|
5239
|
+
parts.push(' tags "Mesh Transport"');
|
|
5240
|
+
parts.push(" }");
|
|
5241
|
+
}
|
|
5242
|
+
}
|
|
5243
|
+
if (peer) {
|
|
5244
|
+
parts.push(` peer_relay = container "Peer relay" "${this.escape("The always-on relay $peerState syncs through")}" "Peer Transport" {`);
|
|
5245
|
+
parts.push(' tags "Mesh Transport"');
|
|
5246
|
+
parts.push(" }");
|
|
5247
|
+
}
|
|
5248
|
+
return parts.join(`
|
|
5249
|
+
`);
|
|
5250
|
+
}
|
|
5251
|
+
generateMeshTransportRelationships() {
|
|
5252
|
+
const { mesh, peer } = this.meshSignalKinds();
|
|
5253
|
+
const parts = [];
|
|
5254
|
+
if (mesh) {
|
|
5255
|
+
parts.push(' extension.mesh_net_adapter -> extension.mesh_webrtc_adapter "wraps"');
|
|
5256
|
+
parts.push(' extension.mesh_webrtc_adapter -> extension.mesh_signaling_client "negotiates via"');
|
|
5257
|
+
parts.push(' extension.mesh_signaling_client -> extension.mesh_signaling_endpoint "connects to"');
|
|
5258
|
+
}
|
|
5259
|
+
if (!mesh && !peer)
|
|
5260
|
+
return parts;
|
|
5261
|
+
const seen = new Set;
|
|
5262
|
+
for (const sig of this.analysis.meshOrPeerSignals ?? []) {
|
|
5263
|
+
if (seen.has(sig.key))
|
|
5264
|
+
continue;
|
|
5265
|
+
seen.add(sig.key);
|
|
5266
|
+
const target = sig.kind === "mesh" ? "mesh_net_adapter" : "peer_relay";
|
|
5267
|
+
parts.push(` extension.${this.meshDocId(sig.key)} -> extension.${target} "syncs through"`);
|
|
5268
|
+
}
|
|
5269
|
+
return parts;
|
|
5270
|
+
}
|
|
5165
5271
|
generateUserRelationships() {
|
|
5166
5272
|
const parts = [];
|
|
5167
5273
|
const uiContexts = ["popup", "options", "devtools"];
|
|
@@ -6360,4 +6466,4 @@ main().catch((_error) => {
|
|
|
6360
6466
|
process.exit(1);
|
|
6361
6467
|
});
|
|
6362
6468
|
|
|
6363
|
-
//# debugId=
|
|
6469
|
+
//# debugId=2FC255DE0B3BC47C64756E2164756E21
|