@principal-ai/subsystems-react 0.56.39 → 0.56.41
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 +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/subsystem/C4ContainersPanel.d.ts +32 -2
- package/dist/subsystem/C4ContainersPanel.d.ts.map +1 -1
- package/dist/subsystem/C4ContainersPanel.js +89 -21
- package/dist/subsystem/C4ContainersPanel.js.map +1 -1
- package/dist/subsystem/C4Graph.d.ts +13 -0
- package/dist/subsystem/C4Graph.d.ts.map +1 -1
- package/dist/subsystem/C4Graph.js +19 -2
- package/dist/subsystem/C4Graph.js.map +1 -1
- package/dist/subsystem/C4NodeCard.d.ts +15 -2
- package/dist/subsystem/C4NodeCard.d.ts.map +1 -1
- package/dist/subsystem/C4NodeCard.js +124 -7
- package/dist/subsystem/C4NodeCard.js.map +1 -1
- package/dist/subsystem/C4ProjectionView.d.ts +8 -1
- package/dist/subsystem/C4ProjectionView.d.ts.map +1 -1
- package/dist/subsystem/C4ProjectionView.js +3 -3
- package/dist/subsystem/C4ProjectionView.js.map +1 -1
- package/dist/subsystem/C4SketchView.d.ts +9 -1
- package/dist/subsystem/C4SketchView.d.ts.map +1 -1
- package/dist/subsystem/C4SketchView.js +2 -2
- package/dist/subsystem/C4SketchView.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +5 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +2 -2
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/TrailIcon.d.ts +18 -4
- package/dist/subsystem/TrailIcon.d.ts.map +1 -1
- package/dist/subsystem/TrailIcon.js +35 -24
- package/dist/subsystem/TrailIcon.js.map +1 -1
- package/dist/subsystem/TrailsPanel.d.ts +3 -1
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +28 -17
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/dist/subsystem/__fixtures__/c4Deployments.d.ts +18 -0
- package/dist/subsystem/__fixtures__/c4Deployments.d.ts.map +1 -0
- package/dist/subsystem/__fixtures__/c4Deployments.js +185 -0
- package/dist/subsystem/__fixtures__/c4Deployments.js.map +1 -0
- package/dist/subsystem/c4.d.ts +63 -0
- package/dist/subsystem/c4.d.ts.map +1 -1
- package/dist/subsystem/c4.js.map +1 -1
- package/dist/subsystem/c4Deployment.d.ts +78 -0
- package/dist/subsystem/c4Deployment.d.ts.map +1 -0
- package/dist/subsystem/c4Deployment.js +68 -0
- package/dist/subsystem/c4Deployment.js.map +1 -0
- package/dist/subsystem/techIcons/cloudflare.d.ts +15 -0
- package/dist/subsystem/techIcons/cloudflare.d.ts.map +1 -0
- package/dist/subsystem/techIcons/cloudflare.js +15 -0
- package/dist/subsystem/techIcons/cloudflare.js.map +1 -0
- package/dist/subsystem/techIcons/index.d.ts +14 -1
- package/dist/subsystem/techIcons/index.d.ts.map +1 -1
- package/dist/subsystem/techIcons/index.js +17 -0
- package/dist/subsystem/techIcons/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +25 -1
- package/src/stories/Canvases/C4/C4Sketch.stories.tsx +51 -0
- package/src/subsystem/C4ContainersPanel.test.tsx +90 -2
- package/src/subsystem/C4ContainersPanel.tsx +142 -35
- package/src/subsystem/C4Graph.tsx +49 -3
- package/src/subsystem/C4NodeCard.tsx +217 -7
- package/src/subsystem/C4ProjectionView.tsx +12 -0
- package/src/subsystem/C4SketchView.tsx +13 -0
- package/src/subsystem/SubsystemComponentGraph.tsx +7 -1
- package/src/subsystem/TrailIcon.tsx +60 -34
- package/src/subsystem/TrailsPanel.test.tsx +51 -0
- package/src/subsystem/TrailsPanel.tsx +40 -11
- package/src/subsystem/__fixtures__/c4Deployments.ts +196 -0
- package/src/subsystem/c4.ts +62 -0
- package/src/subsystem/c4Deployment.test.tsx +211 -0
- package/src/subsystem/c4Deployment.tsx +137 -0
- package/src/subsystem/techIcons/cloudflare.ts +14 -0
- package/src/subsystem/techIcons/index.tsx +30 -1
- package/src/subsystem/techIcons/techIcons.test.ts +12 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c4Deployments.js","sourceRoot":"","sources":["../../../src/subsystem/__fixtures__/c4Deployments.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACzC,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,wCAAwC;IAC/C,QAAQ,EAAE,CAAC,0BAA0B,EAAE,6BAA6B,CAAC;IACrE,MAAM,EAAE,WAAW;IACnB,WAAW,EACT,4IAA4I;IAC9I,SAAS,EAAE,0BAA0B;IACrC,SAAS,EAAE,0BAA0B;IACrC,KAAK,EAAE;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE;QAC9C,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,WAAW;gBACjB,EAAE,EAAE,oBAAoB;gBACxB,KAAK,EAAE,UAAU;gBACjB,aAAa,EAAE,aAAa;gBAC5B,UAAU,EAAE,mBAAmB;gBAC/B,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,kEAAkE;gBAC/E,UAAU,EAAE;oBACV,WAAW,EAAE,4BAA4B;oBACzC,QAAQ,EAAE,YAAY;oBACtB,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,UAAU;oBAChB,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;iBACrB;aACF;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,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AC,MAAM,uBAAuB,GAAiD,IAAI,GAAG,CAC1F,CACE;IACE;QACE,WAAW,EAAE,4BAA4B;QACzC,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,CAAC,sCAAsC,CAAC;QAClD,UAAU,EAAE,2CAA2C;QACvD,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,gBAAgB;KACzB;IACD;QACE,WAAW,EAAE,0CAA0C;QACvD,MAAM,EAAE,UAAU;QAClB,UAAU,EAAE,8CAA8C;QAC1D,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,gBAAgB;KACzB;IACD;QACE,WAAW,EAAE,kCAAkC;QAC/C,MAAM,EAAE,WAAW;QACnB,UAAU,EAAE,6BAA6B;QACzC,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,gBAAgB;KACzB;IACD;QACE,WAAW,EAAE,oCAAoC;QACjD,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,gBAAgB;KACzB;CACkC,CACtC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAC/D,CAAC"}
|
package/dist/subsystem/c4.d.ts
CHANGED
|
@@ -89,6 +89,64 @@ interface C4MemberList {
|
|
|
89
89
|
* a queue is a `data-store` whose technology/label say "queue".
|
|
90
90
|
*/
|
|
91
91
|
export type C4ContainerKind = 'application' | 'data-store';
|
|
92
|
+
/**
|
|
93
|
+
* Which declared piece of infrastructure a container is — the *configured*
|
|
94
|
+
* anchor, read from a wrangler config or terraform JSON at a commit.
|
|
95
|
+
*
|
|
96
|
+
* It says where the container is meant to run, which is enough to draw the
|
|
97
|
+
* provider's mark. It holds no live fact: whether the thing is actually
|
|
98
|
+
* running, and at what URL, is a {@link C4DeploymentObservation} supplied
|
|
99
|
+
* separately and joined on `resourceKey`. Architecture identity and runtime
|
|
100
|
+
* state are kept apart on purpose — accepting a container never implies it is
|
|
101
|
+
* deployed.
|
|
102
|
+
*
|
|
103
|
+
* Structurally identical to `InfraC4Deployment` in `subsystems-core`, which
|
|
104
|
+
* produces these.
|
|
105
|
+
*/
|
|
106
|
+
export interface C4Deployment {
|
|
107
|
+
/** `<provider>:<resourceType>:<identifier>`, e.g. `cloudflare:worker:topic-share`. */
|
|
108
|
+
resourceKey: string;
|
|
109
|
+
/** Hosting provider, lowercase: `cloudflare`. */
|
|
110
|
+
provider: string;
|
|
111
|
+
/** `worker`, `r2_bucket`, `d1_database`, `kv_namespace`, … */
|
|
112
|
+
resourceType: string;
|
|
113
|
+
/** The provider's own name or id for the resource. */
|
|
114
|
+
name: string;
|
|
115
|
+
/** Where it was declared. Absent on a hand-authored anchor. */
|
|
116
|
+
source?: {
|
|
117
|
+
tool: string;
|
|
118
|
+
file: string;
|
|
119
|
+
pointer: string;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Whether a declared resource was found live. `unknown` means the check could
|
|
124
|
+
* not be made — never treat it as `not-found`.
|
|
125
|
+
*/
|
|
126
|
+
export type C4DeploymentStatus = 'deployed' | 'not-found' | 'unknown';
|
|
127
|
+
/**
|
|
128
|
+
* One observation of one declared resource in a live account. Supplied by the
|
|
129
|
+
* host, never stored on the element. Carries no credential or secret.
|
|
130
|
+
*
|
|
131
|
+
* Structurally identical to `InfraDeploymentObservation` in `subsystems-core`.
|
|
132
|
+
*/
|
|
133
|
+
export interface C4DeploymentObservation {
|
|
134
|
+
/** Joins to {@link C4Deployment.resourceKey}. */
|
|
135
|
+
resourceKey: string;
|
|
136
|
+
status: C4DeploymentStatus;
|
|
137
|
+
resourceId?: string;
|
|
138
|
+
/** Where the running thing answers. The first is the one a reader is sent to. */
|
|
139
|
+
liveUrls?: string[];
|
|
140
|
+
/** The provider dashboard page for this resource. */
|
|
141
|
+
consoleUrl?: string;
|
|
142
|
+
version?: string;
|
|
143
|
+
/** When that version went live (ISO). */
|
|
144
|
+
deployedAt?: string;
|
|
145
|
+
/** When we looked (ISO). */
|
|
146
|
+
observedAt: string;
|
|
147
|
+
/** Who said so: `cloudflare-api`, `terraform-state`, `authored`. */
|
|
148
|
+
source: string;
|
|
149
|
+
}
|
|
92
150
|
/** A deployable unit or a store — the C4 level 2 box. */
|
|
93
151
|
export interface C4Container extends C4ElementBase {
|
|
94
152
|
kind: 'container';
|
|
@@ -102,6 +160,11 @@ export interface C4Container extends C4ElementBase {
|
|
|
102
160
|
* the components inside resolve from the model document.
|
|
103
161
|
*/
|
|
104
162
|
process?: string;
|
|
163
|
+
/**
|
|
164
|
+
* The declared infrastructure this container is, when a config file names
|
|
165
|
+
* it. Drives the provider mark on the card.
|
|
166
|
+
*/
|
|
167
|
+
deployment?: C4Deployment;
|
|
105
168
|
}
|
|
106
169
|
/**
|
|
107
170
|
* A functional grouping inside a container — the C4 level 3 box.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c4.d.ts","sourceRoot":"","sources":["../../src/subsystem/c4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAElE,uDAAuD;AACvD,UAAU,aAAa;IACrB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,cAAc,CAAC;IACtB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;;GAQ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AM,GAAG,MAAM,CAIlD"}
|
package/dist/subsystem/c4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c4.js","sourceRoot":"","sources":["../../src/subsystem/c4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;
|
|
1
|
+
{"version":3,"file":"c4.js","sourceRoot":"","sources":["../../src/subsystem/c4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAsMH;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA6D;IAE7D,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IACvF,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAEvF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,4EAA4E;IAC5E,iDAAiD;IACjD,MAAM,OAAO,GAAG,CAAC,WAAmB,EAAW,EAAE,CAC/C,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAExD,MAAM,gBAAgB,GAAa,EAAE,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE;QAC1B,MAAM,OAAO,GAAG,UAAU;aACvB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;aAC5D,GAAG,CAAC,CAAC,IA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xC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment state for C4 cards — the join between a container's configured
|
|
3
|
+
* anchor and what the host observed live, and the context that carries the
|
|
4
|
+
* observations to the cards.
|
|
5
|
+
*
|
|
6
|
+
* A context rather than node data: observations arrive and refresh on their
|
|
7
|
+
* own clock, and threading them through the graph's node build would re-run
|
|
8
|
+
* layout every time one changed. The card box does not depend on them.
|
|
9
|
+
*/
|
|
10
|
+
/// <reference types="react" />
|
|
11
|
+
import type { C4Deployment, C4DeploymentObservation, C4Element } from './c4';
|
|
12
|
+
/** What a reader can be sent to. */
|
|
13
|
+
export type C4DeploymentLinkKind = 'live' | 'console';
|
|
14
|
+
/**
|
|
15
|
+
* How a container's deployment reads on its card.
|
|
16
|
+
*
|
|
17
|
+
* - `deployed` — observed live.
|
|
18
|
+
* - `not-found` — declared, looked for, and absent.
|
|
19
|
+
* - `configured` — declared, and either never checked or the check could not
|
|
20
|
+
* be made. Deliberately one state: both mean "we cannot say it is running".
|
|
21
|
+
*/
|
|
22
|
+
export type C4DeploymentPhase = 'deployed' | 'not-found' | 'configured';
|
|
23
|
+
export interface C4DeploymentView {
|
|
24
|
+
deployment: C4Deployment;
|
|
25
|
+
phase: C4DeploymentPhase;
|
|
26
|
+
observation?: C4DeploymentObservation;
|
|
27
|
+
/** The running thing, when it has a usable URL. Only ever set when deployed. */
|
|
28
|
+
liveUrl?: string;
|
|
29
|
+
/** The provider's page for the resource, when it has a usable URL. */
|
|
30
|
+
consoleUrl?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Only http(s) is ever handed to the host to open — an observation is data, not trusted markup. */
|
|
33
|
+
export declare function safeExternalUrl(url: string | undefined): string | undefined;
|
|
34
|
+
/** The deployment anchor an element carries, if it is a container with one. */
|
|
35
|
+
export declare function elementDeployment(element: C4Element): C4Deployment | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve what a card should show for a deployment anchor.
|
|
38
|
+
*
|
|
39
|
+
* A live URL is offered only when the resource was observed deployed: a URL
|
|
40
|
+
* for something we could not find is a link to nowhere. The console link
|
|
41
|
+
* survives `not-found` and `unknown`, since the dashboard is where a reader
|
|
42
|
+
* goes to find out why.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveDeploymentView(deployment: C4Deployment, observation: C4DeploymentObservation | undefined): C4DeploymentView;
|
|
45
|
+
/**
|
|
46
|
+
* Where an element stands, for display: its review state, lifted by evidence.
|
|
47
|
+
*
|
|
48
|
+
* `proposed` means "a hypothesis nobody has confirmed". An observation that the
|
|
49
|
+
* thing is running confirms it exists, so a proposed element observed deployed
|
|
50
|
+
* reads as `deployed` instead — it is no longer theoretical. The stored review
|
|
51
|
+
* state is not changed: this is derived on every render, so it falls back to
|
|
52
|
+
* `proposed` by itself when the observation goes away or stops saying
|
|
53
|
+
* `deployed`. A human decision is never overridden — `accepted` and `rejected`
|
|
54
|
+
* stand as they are.
|
|
55
|
+
*/
|
|
56
|
+
export type C4Standing = 'accepted' | 'proposed' | 'rejected' | 'deployed';
|
|
57
|
+
export declare function elementStanding(element: C4Element, observation: C4DeploymentObservation | undefined): C4Standing;
|
|
58
|
+
/** What the host is told when a reader follows a deployment link. */
|
|
59
|
+
export interface C4OpenExternalRequest {
|
|
60
|
+
url: string;
|
|
61
|
+
kind: C4DeploymentLinkKind;
|
|
62
|
+
/** The element the link was on. */
|
|
63
|
+
elementId: string;
|
|
64
|
+
resourceKey: string;
|
|
65
|
+
}
|
|
66
|
+
export interface C4DeploymentContextValue {
|
|
67
|
+
/** Observations keyed by `resourceKey`. */
|
|
68
|
+
observations?: ReadonlyMap<string, C4DeploymentObservation>;
|
|
69
|
+
/**
|
|
70
|
+
* Open a URL outside the app. The views never navigate themselves — a
|
|
71
|
+
* desktop host opens the system browser, a web host a new tab. Without it
|
|
72
|
+
* the links are not drawn.
|
|
73
|
+
*/
|
|
74
|
+
onOpenExternal?: (request: C4OpenExternalRequest) => void;
|
|
75
|
+
}
|
|
76
|
+
export declare const C4DeploymentContext: import("react").Context<C4DeploymentContextValue>;
|
|
77
|
+
export declare function useC4Deployments(): C4DeploymentContextValue;
|
|
78
|
+
//# sourceMappingURL=c4Deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c4Deployment.d.ts","sourceRoot":"","sources":["../../src/subsystem/c4Deployment.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAE7E,oCAAoC;AACpC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,YAAY,CAAC;IACzB,KAAK,EAAE,iBAAiB,CAAC;IACzB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAQ3E;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,CAE9E;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,YAAY,EACxB,WAAW,EAAE,uBAAuB,GAAG,SAAS,GAC/C,gBAAgB,CAmBlB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3E,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,uBAAuB,GAAG,SAAS,GAC/C,UAAU,CAQZ;AAED,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,oBAAoB,CAAC;IAC3B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IAC5D;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAC3D;AAID,eAAO,MAAM,mBAAmB,mDAAiD,CAAC;AAElF,wBAAgB,gBAAgB,IAAI,wBAAwB,CAE3D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment state for C4 cards — the join between a container's configured
|
|
3
|
+
* anchor and what the host observed live, and the context that carries the
|
|
4
|
+
* observations to the cards.
|
|
5
|
+
*
|
|
6
|
+
* A context rather than node data: observations arrive and refresh on their
|
|
7
|
+
* own clock, and threading them through the graph's node build would re-run
|
|
8
|
+
* layout every time one changed. The card box does not depend on them.
|
|
9
|
+
*/
|
|
10
|
+
import { createContext, useContext } from 'react';
|
|
11
|
+
/** Only http(s) is ever handed to the host to open — an observation is data, not trusted markup. */
|
|
12
|
+
export function safeExternalUrl(url) {
|
|
13
|
+
if (!url)
|
|
14
|
+
return undefined;
|
|
15
|
+
try {
|
|
16
|
+
const parsed = new URL(url);
|
|
17
|
+
return parsed.protocol === 'https:' || parsed.protocol === 'http:' ? parsed.href : undefined;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** The deployment anchor an element carries, if it is a container with one. */
|
|
24
|
+
export function elementDeployment(element) {
|
|
25
|
+
return element.kind === 'container' ? element.deployment : undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve what a card should show for a deployment anchor.
|
|
29
|
+
*
|
|
30
|
+
* A live URL is offered only when the resource was observed deployed: a URL
|
|
31
|
+
* for something we could not find is a link to nowhere. The console link
|
|
32
|
+
* survives `not-found` and `unknown`, since the dashboard is where a reader
|
|
33
|
+
* goes to find out why.
|
|
34
|
+
*/
|
|
35
|
+
export function resolveDeploymentView(deployment, observation) {
|
|
36
|
+
const phase = observation?.status === 'deployed'
|
|
37
|
+
? 'deployed'
|
|
38
|
+
: observation?.status === 'not-found'
|
|
39
|
+
? 'not-found'
|
|
40
|
+
: 'configured';
|
|
41
|
+
const liveUrl = phase === 'deployed'
|
|
42
|
+
? observation?.liveUrls?.map(safeExternalUrl).find((url) => !!url)
|
|
43
|
+
: undefined;
|
|
44
|
+
const consoleUrl = safeExternalUrl(observation?.consoleUrl);
|
|
45
|
+
return {
|
|
46
|
+
deployment,
|
|
47
|
+
phase,
|
|
48
|
+
...(observation ? { observation } : {}),
|
|
49
|
+
...(liveUrl ? { liveUrl } : {}),
|
|
50
|
+
...(consoleUrl ? { consoleUrl } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function elementStanding(element, observation) {
|
|
54
|
+
if (element.state !== 'proposed')
|
|
55
|
+
return element.state;
|
|
56
|
+
const deployment = elementDeployment(element);
|
|
57
|
+
return deployment &&
|
|
58
|
+
observation?.resourceKey === deployment.resourceKey &&
|
|
59
|
+
observation.status === 'deployed'
|
|
60
|
+
? 'deployed'
|
|
61
|
+
: 'proposed';
|
|
62
|
+
}
|
|
63
|
+
const EMPTY = {};
|
|
64
|
+
export const C4DeploymentContext = createContext(EMPTY);
|
|
65
|
+
export function useC4Deployments() {
|
|
66
|
+
return useContext(C4DeploymentContext);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=c4Deployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c4Deployment.js","sourceRoot":"","sources":["../../src/subsystem/c4Deployment.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AA0BlD,oGAAoG;AACpG,MAAM,UAAU,eAAe,CAAC,GAAuB;IACrD,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;KAC9F;IAAC,MAAM;QACN,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,OAAkB;IAClD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAwB,EACxB,WAAgD;IAEhD,MAAM,KAAK,GACT,WAAW,EAAE,MAAM,KAAK,UAAU;QAChC,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,WAAW,E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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare mark — the cloud from the official logo, without the wordmark.
|
|
3
|
+
*
|
|
4
|
+
* Source: https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg.
|
|
5
|
+
* The two cloud paths and their fills are taken unmodified; the wordmark, the backing rectangle and the
|
|
6
|
+
* Illustrator wrapper are dropped, and the viewBox is cropped to the cloud so
|
|
7
|
+
* the mark fills a square slot.
|
|
8
|
+
*
|
|
9
|
+
* Cloudflare and the Cloudflare logo are trademarks of Cloudflare, Inc. Used
|
|
10
|
+
* here for identification only, with no endorsement implied.
|
|
11
|
+
*
|
|
12
|
+
* Root sized to 100% so the card's wrapper controls the box.
|
|
13
|
+
*/
|
|
14
|
+
export declare const cloudflareSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"126.8 24.5 91.2 42.3\"><path fill=\"#F48220\" d=\"M189.1,63.6c0.5-1.9,0.3-3.6-0.6-4.9c-0.8-1.2-2.2-1.9-3.9-1.9l-32.2-0.4c-0.2,0-0.4-0.1-0.5-0.3 c-0.1-0.2-0.1-0.4-0.1-0.6c0.1-0.3,0.4-0.6,0.7-0.6l32.5-0.4c3.9-0.2,8-3.3,9.5-7.1l1.9-4.8c0.1-0.2,0.1-0.4,0.1-0.6 c-2.1-9.5-10.5-16.5-20.6-16.5c-9.3,0-17.2,6-20,14.3c-1.8-1.4-4.2-2.1-6.7-1.8c-4.5,0.4-8,4-8.5,8.5c-0.1,1.2,0,2.3,0.2,3.3 c-7.3,0.2-13.1,6.2-13.1,13.5c0,0.7,0.1,1.3,0.1,2c0,0.3,0.3,0.5,0.6,0.5l59.4,0c0.3,0,0.7-0.2,0.8-0.6L189.1,63.6z\"/><path fill=\"#FBAD40\" d=\"M199.3,42.9c-0.3,0-0.6,0-0.9,0c-0.2,0-0.4,0.2-0.5,0.4l-1.3,4.4c-0.5,1.9-0.3,3.6,0.6,4.9 c0.8,1.2,2.2,1.9,3.9,1.9l6.9,0.4c0.2,0,0.4,0.1,0.5,0.3c0.1,0.2,0.1,0.4,0.1,0.6c-0.1,0.3-0.4,0.6-0.7,0.6l-7.1,0.4 c-3.9,0.2-8,3.3-9.5,7.1l-0.5,1.3c-0.1,0.2,0.1,0.5,0.4,0.5h24.5c0.3,0,0.6-0.2,0.6-0.5c0.4-1.5,0.7-3.1,0.7-4.8 C216.9,50.8,209,42.9,199.3,42.9\"/></svg>";
|
|
15
|
+
//# sourceMappingURL=cloudflare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../../../src/subsystem/techIcons/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,+7BAA+6B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare mark — the cloud from the official logo, without the wordmark.
|
|
3
|
+
*
|
|
4
|
+
* Source: https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg.
|
|
5
|
+
* The two cloud paths and their fills are taken unmodified; the wordmark, the backing rectangle and the
|
|
6
|
+
* Illustrator wrapper are dropped, and the viewBox is cropped to the cloud so
|
|
7
|
+
* the mark fills a square slot.
|
|
8
|
+
*
|
|
9
|
+
* Cloudflare and the Cloudflare logo are trademarks of Cloudflare, Inc. Used
|
|
10
|
+
* here for identification only, with no endorsement implied.
|
|
11
|
+
*
|
|
12
|
+
* Root sized to 100% so the card's wrapper controls the box.
|
|
13
|
+
*/
|
|
14
|
+
export const cloudflareSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="126.8 24.5 91.2 42.3"><path fill="#F48220" d="M189.1,63.6c0.5-1.9,0.3-3.6-0.6-4.9c-0.8-1.2-2.2-1.9-3.9-1.9l-32.2-0.4c-0.2,0-0.4-0.1-0.5-0.3 c-0.1-0.2-0.1-0.4-0.1-0.6c0.1-0.3,0.4-0.6,0.7-0.6l32.5-0.4c3.9-0.2,8-3.3,9.5-7.1l1.9-4.8c0.1-0.2,0.1-0.4,0.1-0.6 c-2.1-9.5-10.5-16.5-20.6-16.5c-9.3,0-17.2,6-20,14.3c-1.8-1.4-4.2-2.1-6.7-1.8c-4.5,0.4-8,4-8.5,8.5c-0.1,1.2,0,2.3,0.2,3.3 c-7.3,0.2-13.1,6.2-13.1,13.5c0,0.7,0.1,1.3,0.1,2c0,0.3,0.3,0.5,0.6,0.5l59.4,0c0.3,0,0.7-0.2,0.8-0.6L189.1,63.6z"/><path fill="#FBAD40" d="M199.3,42.9c-0.3,0-0.6,0-0.9,0c-0.2,0-0.4,0.2-0.5,0.4l-1.3,4.4c-0.5,1.9-0.3,3.6,0.6,4.9 c0.8,1.2,2.2,1.9,3.9,1.9l6.9,0.4c0.2,0,0.4,0.1,0.5,0.3c0.1,0.2,0.1,0.4,0.1,0.6c-0.1,0.3-0.4,0.6-0.7,0.6l-7.1,0.4 c-3.9,0.2-8,3.3-9.5,7.1l-0.5,1.3c-0.1,0.2,0.1,0.5,0.4,0.5h24.5c0.3,0,0.6-0.2,0.6-0.5c0.4-1.5,0.7-3.1,0.7-4.8 C216.9,50.8,209,42.9,199.3,42.9"/></svg>`;
|
|
15
|
+
//# sourceMappingURL=cloudflare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.js","sourceRoot":"","sources":["../../../src/subsystem/techIcons/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,46BAA46B,CAAC"}
|
|
@@ -33,9 +33,22 @@ export interface TechBrand {
|
|
|
33
33
|
export declare const TECH_BRANDS: readonly TechBrand[];
|
|
34
34
|
/** The official mark for a technology string, or undefined when we hold none. */
|
|
35
35
|
export declare function technologyBrand(technology: string | undefined): TechBrand | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* A hosting provider's mark — where a container is deployed, as opposed to
|
|
38
|
+
* what it is built with. Kept out of `TECH_BRANDS` on purpose: "built with
|
|
39
|
+
* Bun" and "runs on Cloudflare" are different facts drawn in different slots,
|
|
40
|
+
* and a provider is matched by its exact id, not by scanning free text.
|
|
41
|
+
*/
|
|
42
|
+
export interface ProviderBrand extends Omit<TechBrand, 'match'> {
|
|
43
|
+
/** The provider id a deployment carries, lowercase: `cloudflare`. */
|
|
44
|
+
provider: string;
|
|
45
|
+
}
|
|
46
|
+
export declare const PROVIDER_BRANDS: readonly ProviderBrand[];
|
|
47
|
+
/** The official mark for a provider id, or undefined when we hold none. */
|
|
48
|
+
export declare function providerBrand(provider: string | undefined): ProviderBrand | undefined;
|
|
36
49
|
/** A brand mark sized to the top row. Full-colour, not tinted by state. */
|
|
37
50
|
export declare function TechMark({ brand, size, showTitle, }: {
|
|
38
|
-
brand: TechBrand
|
|
51
|
+
brand: Pick<TechBrand, 'name' | 'source' | 'svg'>;
|
|
39
52
|
size?: number;
|
|
40
53
|
/** Render the attribution tooltip. Off inside rows that already explain themselves. */
|
|
41
54
|
showTitle?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subsystem/techIcons/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/subsystem/techIcons/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;AAOH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAwB3C,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAGrF;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC7D,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAQnD,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAIrF;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,IAAS,EACT,SAAgB,GACjB,EAAE;IACD,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,+BAUA"}
|
|
@@ -12,6 +12,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
12
|
* identification only, under each owner's trademark policy.
|
|
13
13
|
*/
|
|
14
14
|
import { bunSvg } from './bun';
|
|
15
|
+
import { cloudflareSvg } from './cloudflare';
|
|
15
16
|
import { nodeSvg } from './node';
|
|
16
17
|
import { reactSvg } from './react';
|
|
17
18
|
/**
|
|
@@ -49,6 +50,22 @@ export function technologyBrand(technology) {
|
|
|
49
50
|
return undefined;
|
|
50
51
|
return TECH_BRANDS.find((brand) => brand.match.test(technology));
|
|
51
52
|
}
|
|
53
|
+
export const PROVIDER_BRANDS = [
|
|
54
|
+
{
|
|
55
|
+
provider: 'cloudflare',
|
|
56
|
+
name: 'Cloudflare',
|
|
57
|
+
source: 'https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg',
|
|
58
|
+
svg: cloudflareSvg,
|
|
59
|
+
color: '#f48220',
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
/** The official mark for a provider id, or undefined when we hold none. */
|
|
63
|
+
export function providerBrand(provider) {
|
|
64
|
+
if (!provider)
|
|
65
|
+
return undefined;
|
|
66
|
+
const id = provider.toLowerCase();
|
|
67
|
+
return PROVIDER_BRANDS.find((brand) => brand.provider === id);
|
|
68
|
+
}
|
|
52
69
|
/** A brand mark sized to the top row. Full-colour, not tinted by state. */
|
|
53
70
|
export function TechMark({ brand, size = 14, showTitle = true, }) {
|
|
54
71
|
return (_jsx("span", { ...(showTitle ? { title: `${brand.name} — ${brand.source}` } : {}), "aria-label": brand.name, style: { display: 'inline-flex', width: size, height: size, flexShrink: 0 },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/subsystem/techIcons/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAkBnC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C;QACE,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,mBAAmB;QAC3B,GAAG,EAAE,QAAQ;QACb,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,SAAS;KACjB;IACD;QACE,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,yBAAyB;QACjC,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,SAAS;KACjB;IACD;QACE,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,+CAA+C;QACvD,GAAG,EAAE,OAAO;QACZ,yEAAyE;QACzE,gCAAgC;QAChC,KAAK,EAAE,kBAAkB;QACzB,KA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E,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,gBACvD,KAAK,CAAC,IAAI,EACtB,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE;QAC3E,2DAA2D;QAC3D,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAC9C,CACH,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -315,10 +315,11 @@ export type { C4ProjectionViewProps } from './subsystem/C4ProjectionView';
|
|
|
315
315
|
export { C4SketchView } from './subsystem/C4SketchView';
|
|
316
316
|
export type { C4SketchViewProps } from './subsystem/C4SketchView';
|
|
317
317
|
export { ShareButton } from './subsystem/ShareButton';
|
|
318
|
-
export { C4ContainersPanel } from './subsystem/C4ContainersPanel';
|
|
318
|
+
export { C4ContainersPanel, groupContainersByDeployment } from './subsystem/C4ContainersPanel';
|
|
319
319
|
export type {
|
|
320
320
|
C4ContainerListItem,
|
|
321
321
|
C4ContainersPanelProps,
|
|
322
|
+
C4ContainerGroup,
|
|
322
323
|
} from './subsystem/C4ContainersPanel';
|
|
323
324
|
export { DescriptionPreview } from './subsystem/DescriptionPreview';
|
|
324
325
|
export type { DescriptionPreviewProps } from './subsystem/DescriptionPreview';
|
|
@@ -345,6 +346,26 @@ export type { TechBrand } from './subsystem/techIcons';
|
|
|
345
346
|
export type { C4NodeCardProps, NodeStyle, NodeShape, C4ShapeKind } from './subsystem/C4NodeCard';
|
|
346
347
|
export { ContainerCardHeader, OPEN_HEADER_PAD, OPEN_SIDE_PAD, OPEN_FOOTER_PAD } from './subsystem/containerCard';
|
|
347
348
|
export type { ContainerCardHeaderProps } from './subsystem/containerCard';
|
|
349
|
+
// --- C4 deployment: configured anchor + live observation ---------------
|
|
350
|
+
export {
|
|
351
|
+
C4DeploymentContext,
|
|
352
|
+
elementDeployment,
|
|
353
|
+
elementStanding,
|
|
354
|
+
resolveDeploymentView,
|
|
355
|
+
safeExternalUrl,
|
|
356
|
+
useC4Deployments,
|
|
357
|
+
} from './subsystem/c4Deployment';
|
|
358
|
+
export type {
|
|
359
|
+
C4DeploymentContextValue,
|
|
360
|
+
C4DeploymentLinkKind,
|
|
361
|
+
C4DeploymentPhase,
|
|
362
|
+
C4DeploymentView,
|
|
363
|
+
C4OpenExternalRequest,
|
|
364
|
+
C4Standing,
|
|
365
|
+
} from './subsystem/c4Deployment';
|
|
366
|
+
export { PROVIDER_BRANDS, providerBrand } from './subsystem/techIcons';
|
|
367
|
+
export type { ProviderBrand } from './subsystem/techIcons';
|
|
368
|
+
|
|
348
369
|
// --- C4 elements: authored, not derived -------------------------------
|
|
349
370
|
export {
|
|
350
371
|
labelFromPurl,
|
|
@@ -361,6 +382,9 @@ export type {
|
|
|
361
382
|
C4Model,
|
|
362
383
|
C4ContainerKind,
|
|
363
384
|
C4Container,
|
|
385
|
+
C4Deployment,
|
|
386
|
+
C4DeploymentObservation,
|
|
387
|
+
C4DeploymentStatus,
|
|
364
388
|
C4Component,
|
|
365
389
|
C4ExternalSystem,
|
|
366
390
|
C4Person,
|
|
@@ -5,6 +5,11 @@ import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme
|
|
|
5
5
|
import { C4SketchView } from '../../../subsystem/C4SketchView';
|
|
6
6
|
import type { C4Sketch } from '../../../subsystem/c4Sketch';
|
|
7
7
|
import { SKETCH_FIXTURE } from '../../../subsystem/__fixtures__/c4Sketch';
|
|
8
|
+
import {
|
|
9
|
+
DEPLOYMENT_OBSERVATIONS,
|
|
10
|
+
DEPLOYMENT_SKETCH,
|
|
11
|
+
} from '../../../subsystem/__fixtures__/c4Deployments';
|
|
12
|
+
import type { C4OpenExternalRequest } from '../../../subsystem/c4Deployment';
|
|
8
13
|
import {
|
|
9
14
|
CONTAINER_MATRIX_SKETCH,
|
|
10
15
|
DESCRIPTION_BOUNDARY_SKETCH,
|
|
@@ -92,3 +97,49 @@ export const DescriptionBoundary: Story = {
|
|
|
92
97
|
export const NotesOnly: Story = {
|
|
93
98
|
render: () => <Demo sketch={NOTES_ONLY_SKETCH} />,
|
|
94
99
|
};
|
|
100
|
+
|
|
101
|
+
function DeploymentsDemo({ observed }: { observed: boolean }) {
|
|
102
|
+
const [last, setLast] = React.useState<C4OpenExternalRequest | null>(null);
|
|
103
|
+
return (
|
|
104
|
+
<div style={{ width: '100%', height: '100vh', position: 'relative' }}>
|
|
105
|
+
<C4SketchView
|
|
106
|
+
sketch={DEPLOYMENT_SKETCH}
|
|
107
|
+
deployments={observed ? DEPLOYMENT_OBSERVATIONS : undefined}
|
|
108
|
+
onOpenExternal={setLast}
|
|
109
|
+
/>
|
|
110
|
+
{last && (
|
|
111
|
+
<pre
|
|
112
|
+
style={{
|
|
113
|
+
position: 'absolute',
|
|
114
|
+
right: 12,
|
|
115
|
+
bottom: 12,
|
|
116
|
+
margin: 0,
|
|
117
|
+
padding: '8px 10px',
|
|
118
|
+
borderRadius: 6,
|
|
119
|
+
background: 'rgba(0,0,0,0.75)',
|
|
120
|
+
color: '#fff',
|
|
121
|
+
fontSize: 11,
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
{`onOpenExternal(${JSON.stringify(last, null, 2)})`}
|
|
125
|
+
</pre>
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Containers proposed from wrangler configs, with live observations joined in.
|
|
133
|
+
* Every badge state is on screen: deployed with live + console links, deployed
|
|
134
|
+
* store with a console link only, declared-but-missing, could-not-check, never
|
|
135
|
+
* checked, and a provider we hold no mark for. The story stands in for the
|
|
136
|
+
* host: a click reports the request instead of opening a browser.
|
|
137
|
+
*/
|
|
138
|
+
export const Deployments: Story = {
|
|
139
|
+
render: () => <DeploymentsDemo observed />,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** The same sketch before any credentialed check has run: every mark is configured-only. */
|
|
143
|
+
export const DeploymentsConfiguredOnly: Story = {
|
|
144
|
+
render: () => <DeploymentsDemo observed={false} />,
|
|
145
|
+
};
|
|
@@ -3,7 +3,12 @@ import { createElement } from 'react';
|
|
|
3
3
|
import { Window } from 'happy-dom';
|
|
4
4
|
import { cleanup, fireEvent, render } from '@testing-library/react/pure';
|
|
5
5
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
C4ContainersPanel,
|
|
8
|
+
groupContainersByDeployment,
|
|
9
|
+
type C4ContainerListItem,
|
|
10
|
+
} from './C4ContainersPanel';
|
|
11
|
+
import type { C4DeploymentObservation } from './c4';
|
|
7
12
|
|
|
8
13
|
// Bun's happy-dom test environment isn't registered (no @happy-dom/global-
|
|
9
14
|
// registrator), so wire the DOM primitives React DOM needs before rendering.
|
|
@@ -86,7 +91,13 @@ describe('C4ContainersPanel', () => {
|
|
|
86
91
|
expect(view.getByText('2 containers')).toBeTruthy();
|
|
87
92
|
expect(view.getByText('Host')).toBeTruthy();
|
|
88
93
|
expect(view.getByText('Session store')).toBeTruthy();
|
|
89
|
-
|
|
94
|
+
// The proposed container sits under a Proposed heading; the accepted one
|
|
95
|
+
// needs no heading and is listed first.
|
|
96
|
+
expect(view.getByText('Proposed')).toBeTruthy();
|
|
97
|
+
const labels = [...view.container.querySelectorAll('li')].map((li) => li.textContent);
|
|
98
|
+
expect(labels[0]).toContain('Host');
|
|
99
|
+
expect(labels[1]).toContain('Proposed');
|
|
100
|
+
expect(labels[2]).toContain('Session store');
|
|
90
101
|
expect(view.queryByText('Host API')).toBeNull();
|
|
91
102
|
const row = view.getByText('Host').closest('li');
|
|
92
103
|
expect(row?.className).toContain('c4-containers-row');
|
|
@@ -149,3 +160,80 @@ describe('C4ContainersPanel', () => {
|
|
|
149
160
|
expect(view.getByText('No containers.')).toBeTruthy();
|
|
150
161
|
});
|
|
151
162
|
});
|
|
163
|
+
|
|
164
|
+
describe('groupContainersByDeployment', () => {
|
|
165
|
+
const worker = (name: string, state: 'proposed' | 'accepted' = 'proposed'): C4ContainerListItem => ({
|
|
166
|
+
container: {
|
|
167
|
+
kind: 'container',
|
|
168
|
+
id: `container:${name}`,
|
|
169
|
+
label: name,
|
|
170
|
+
containerKind: 'application',
|
|
171
|
+
technology: 'Cloudflare Worker',
|
|
172
|
+
state,
|
|
173
|
+
deployment: {
|
|
174
|
+
resourceKey: `cloudflare:worker:${name}`,
|
|
175
|
+
provider: 'cloudflare',
|
|
176
|
+
resourceType: 'worker',
|
|
177
|
+
name,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
open: false,
|
|
181
|
+
members: [],
|
|
182
|
+
});
|
|
183
|
+
const observed = (name: string, status: C4DeploymentObservation['status']) =>
|
|
184
|
+
[
|
|
185
|
+
`cloudflare:worker:${name}`,
|
|
186
|
+
{
|
|
187
|
+
resourceKey: `cloudflare:worker:${name}`,
|
|
188
|
+
status,
|
|
189
|
+
observedAt: '2026-11-29T00:00:00.000Z',
|
|
190
|
+
source: 'cloudflare-api',
|
|
191
|
+
},
|
|
192
|
+
] as const;
|
|
193
|
+
|
|
194
|
+
test('observed-running containers group under their provider; the rest are proposed', () => {
|
|
195
|
+
const groups = groupContainersByDeployment(
|
|
196
|
+
[worker('live'), worker('declared'), worker('missing'), worker('unchecked')],
|
|
197
|
+
new Map([observed('live', 'deployed'), observed('missing', 'not-found'), observed('unchecked', 'unknown')]),
|
|
198
|
+
);
|
|
199
|
+
expect(groups.map((g) => [g.kind, g.provider, g.items.map((i) => i.container.label)])).toEqual([
|
|
200
|
+
['provider', 'cloudflare', ['live']],
|
|
201
|
+
['proposed', undefined, ['declared', 'missing', 'unchecked']],
|
|
202
|
+
]);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test('an accepted container that is running still groups by where it runs', () => {
|
|
206
|
+
const groups = groupContainersByDeployment(
|
|
207
|
+
[worker('live', 'accepted'), worker('idle', 'accepted')],
|
|
208
|
+
new Map([observed('live', 'deployed')]),
|
|
209
|
+
);
|
|
210
|
+
expect(groups.map((g) => [g.kind, g.items.map((i) => i.container.label)])).toEqual([
|
|
211
|
+
['settled', ['idle']],
|
|
212
|
+
['provider', ['live']],
|
|
213
|
+
]);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test('with no observations nothing is under a provider', () => {
|
|
217
|
+
expect(groupContainersByDeployment([worker('a')]).map((g) => g.kind)).toEqual(['proposed']);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
test('the panel draws the provider heading with its mark, and no per-row tags', () => {
|
|
221
|
+
const view = renderPanel([worker('live'), worker('declared')], {
|
|
222
|
+
deployments: new Map([observed('live', 'deployed')]),
|
|
223
|
+
});
|
|
224
|
+
const heading = view.container.querySelector('[data-container-group="provider:cloudflare"]')!;
|
|
225
|
+
expect(heading.textContent).toContain('Cloudflare');
|
|
226
|
+
expect(heading.querySelector('[aria-label="Cloudflare"]')).not.toBeNull();
|
|
227
|
+
expect(view.queryByText('deployed')).toBeNull();
|
|
228
|
+
expect(view.queryByText('proposed')).toBeNull();
|
|
229
|
+
expect(view.getByText('Proposed')).toBeTruthy();
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
describe('C4ContainersPanel technology', () => {
|
|
234
|
+
test('each row names its technology under the label', () => {
|
|
235
|
+
const view = renderPanel(ITEMS);
|
|
236
|
+
const row = view.getByText('Host').closest('li')!;
|
|
237
|
+
expect(row.querySelector('[data-container-technology]')?.textContent).toBe('Bun');
|
|
238
|
+
});
|
|
239
|
+
});
|