tjs-lang 0.6.45 → 0.7.4
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/CLAUDE.md +70 -444
- package/README.md +15 -82
- package/bin/benchmarks.ts +7 -7
- package/bin/dev.ts +2 -1
- package/demo/autocomplete.test.ts +1 -1
- package/demo/docs.json +743 -47
- package/demo/src/demo-nav.ts +5 -5
- package/demo/src/index.ts +28 -36
- package/demo/src/module-sw.ts +1 -1
- package/demo/src/playground-shared.ts +17 -17
- package/demo/src/playground.ts +13 -1
- package/demo/src/style.ts +4 -1
- package/demo/src/tjs-playground.ts +5 -5
- package/demo/src/user-store.ts +2 -1
- package/demo/static/favicon.svg +17 -24
- package/demo/static/tosi-platform.json +9304 -0
- package/dist/index.js +176 -175
- package/dist/index.js.map +5 -43
- package/dist/scripts/compat-effect.d.ts +16 -0
- package/dist/scripts/compat-kysely.d.ts +13 -0
- package/dist/scripts/compat-radash.d.ts +13 -0
- package/dist/scripts/compat-superstruct.d.ts +13 -0
- package/dist/scripts/compat-ts-pattern.d.ts +13 -0
- package/dist/scripts/compat-zod.d.ts +12 -0
- package/dist/src/lang/emitters/from-ts.d.ts +1 -1
- package/dist/src/lang/emitters/js-tests.d.ts +4 -0
- package/dist/src/lang/emitters/js.d.ts +2 -2
- package/dist/src/lang/index.d.ts +1 -0
- package/dist/src/lang/json-schema.d.ts +40 -0
- package/dist/src/lang/parser-transforms.d.ts +14 -0
- package/dist/src/lang/runtime.d.ts +39 -20
- package/dist/src/types/Type.d.ts +5 -0
- package/dist/tjs-batteries.js +3 -4
- package/dist/tjs-batteries.js.map +5 -13
- package/dist/tjs-eval.js +47 -0
- package/dist/tjs-eval.js.map +7 -0
- package/dist/tjs-from-ts.js +58 -0
- package/dist/tjs-from-ts.js.map +7 -0
- package/dist/tjs-lang.js +349 -0
- package/dist/tjs-lang.js.map +7 -0
- package/dist/tjs-vm.js +51 -51
- package/dist/tjs-vm.js.map +4 -19
- package/docs/README.md +21 -20
- package/docs/WASM-QUICKSTART.md +283 -0
- package/docs/diagrams/architecture-shift.svg +117 -0
- package/docs/diagrams/compile-runtime.svg +130 -0
- package/docs/diagrams/icon-riff-1.svg +55 -0
- package/docs/diagrams/icon-riff-2.svg +62 -0
- package/docs/diagrams/icon-riff-3.svg +61 -0
- package/docs/diagrams/platform-overview.svg +114 -0
- package/docs/diagrams/safe-eval.svg +147 -0
- package/docs/eval-v4/arch-comparison.svg +277 -0
- package/docs/eval-v4/bundler-tree.svg +250 -0
- package/docs/eval-v4/http-lifecycle.svg +148 -0
- package/docs/function-predicate-design.md +8 -8
- package/docs/native-engine-integration.md +2 -2
- package/editors/codemirror/autocomplete.test.ts +29 -29
- package/package.json +24 -12
- package/src/cli/commands/convert.test.ts +11 -8
- package/src/lang/codegen.test.ts +117 -112
- package/src/lang/docs.test.ts +22 -22
- package/src/lang/docs.ts +5 -8
- package/src/lang/emitters/dts.test.ts +13 -13
- package/src/lang/emitters/from-ts.ts +36 -9
- package/src/lang/emitters/js-tests.ts +143 -28
- package/src/lang/emitters/js.ts +44 -31
- package/src/lang/features.test.ts +259 -43
- package/src/lang/from-ts.test.ts +3 -3
- package/src/lang/function-predicate.test.ts +1 -1
- package/src/lang/index.ts +8 -47
- package/src/lang/json-schema.test.ts +261 -0
- package/src/lang/json-schema.ts +167 -0
- package/src/lang/parser-params.ts +28 -44
- package/src/lang/parser-transforms.ts +255 -0
- package/src/lang/parser.test.ts +32 -13
- package/src/lang/parser.ts +49 -11
- package/src/lang/perf.test.ts +11 -11
- package/src/lang/roundtrip.test.ts +3 -3
- package/src/lang/runtime.test.ts +167 -0
- package/src/lang/runtime.ts +213 -64
- package/src/lang/transpiler.test.ts +21 -21
- package/src/lang/typescript-syntax.test.ts +11 -9
- package/src/types/Type.ts +38 -1
- package/src/use-cases/bootstrap.test.ts +7 -7
- package/src/use-cases/client-server.test.ts +1 -1
- package/src/use-cases/malicious-actor.test.ts +1 -1
- package/src/use-cases/rag-processor.test.ts +1 -1
- package/src/use-cases/sophisticated-agents.test.ts +2 -2
- package/src/use-cases/transpiler-llm.test.ts +1 -1
- package/src/use-cases/unbundled-imports.test.ts +9 -9
- package/tjs-lang.svg +17 -25
- package/dist/tjs-full.js +0 -435
- package/dist/tjs-full.js.map +0 -45
- package/dist/tjs-transpiler.js +0 -3
- package/dist/tjs-transpiler.js.map +0 -11
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 900"
|
|
3
|
+
font-family="system-ui, -apple-system, sans-serif">
|
|
4
|
+
<style>
|
|
5
|
+
/* Palette and semantic classes */
|
|
6
|
+
.header-primary { fill: #181340; }
|
|
7
|
+
.header-monolithic { fill: #ff6b6b; }
|
|
8
|
+
.header-microservice { fill: #51cf66; }
|
|
9
|
+
|
|
10
|
+
.box-monolithic { fill: #fff5f5; stroke: #ff1c24; stroke-width: 2; }
|
|
11
|
+
.box-microservice { fill: #f0fff5; stroke: #006736; stroke-width: 2; }
|
|
12
|
+
.box-client { fill: #eef6ff; stroke: #3da8f4; stroke-width: 2; }
|
|
13
|
+
.box-neutral { fill: #f5f5f5; stroke: #9e9e9e; stroke-width: 1.5; }
|
|
14
|
+
|
|
15
|
+
.section-header { fill: white; font-weight: 600; font-size: 14px; }
|
|
16
|
+
.section-label { fill: white; font-weight: 600; font-size: 16px; }
|
|
17
|
+
.box-label { fill: #181340; font-size: 12px; font-weight: 500; }
|
|
18
|
+
.box-label-small { fill: #181340; font-size: 11px; }
|
|
19
|
+
.text-muted { fill: #9e9e9e; font-size: 10px; }
|
|
20
|
+
.text-annotation { fill: #555; font-size: 10px; }
|
|
21
|
+
|
|
22
|
+
.arrow { stroke: #9e9e9e; stroke-width: 2; fill: none; }
|
|
23
|
+
.arrow-monolithic { stroke: #ff1c24; stroke-width: 2; fill: none; }
|
|
24
|
+
.arrow-microservice { stroke: #006736; stroke-width: 2; fill: none; }
|
|
25
|
+
.arrow-dashed { stroke: #9e9e9e; stroke-width: 2; fill: none; stroke-dasharray: 5,5; }
|
|
26
|
+
|
|
27
|
+
.title { fill: #181340; font-size: 18px; font-weight: 700; }
|
|
28
|
+
.section-title { fill: white; font-size: 14px; font-weight: 600; }
|
|
29
|
+
|
|
30
|
+
.comparison-label { fill: #181340; font-size: 11px; font-weight: 600; }
|
|
31
|
+
</style>
|
|
32
|
+
|
|
33
|
+
<defs>
|
|
34
|
+
<marker id="arr-mono" viewBox="0 0 10 10" refX="9" refY="5"
|
|
35
|
+
markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
36
|
+
<path d="M0 0 L10 5 L0 10z" fill="#ff1c24"/>
|
|
37
|
+
</marker>
|
|
38
|
+
<marker id="arr-micro" viewBox="0 0 10 10" refX="9" refY="5"
|
|
39
|
+
markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
40
|
+
<path d="M0 0 L10 5 L0 10z" fill="#006736"/>
|
|
41
|
+
</marker>
|
|
42
|
+
<marker id="arr-neutral" viewBox="0 0 10 10" refX="9" refY="5"
|
|
43
|
+
markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
44
|
+
<path d="M0 0 L10 5 L0 10z" fill="#9e9e9e"/>
|
|
45
|
+
</marker>
|
|
46
|
+
</defs>
|
|
47
|
+
|
|
48
|
+
<!-- Title -->
|
|
49
|
+
<text x="360" y="35" text-anchor="middle" class="title">Monolithic vs Microservice Architecture</text>
|
|
50
|
+
<text x="360" y="55" text-anchor="middle" class="text-muted">How a user request flows through each approach</text>
|
|
51
|
+
|
|
52
|
+
<!-- ========== MONOLITHIC SECTION ========== -->
|
|
53
|
+
<g id="section-monolithic" class="section">
|
|
54
|
+
<!-- Section header background -->
|
|
55
|
+
<rect x="20" y="75" width="320" height="40" class="header-monolithic" rx="4"/>
|
|
56
|
+
<text x="180" y="102" text-anchor="middle" class="section-label">Monolithic Architecture</text>
|
|
57
|
+
|
|
58
|
+
<!-- Client node -->
|
|
59
|
+
<g id="node-mono-client" class="node">
|
|
60
|
+
<rect x="45" y="135" width="270" height="40" class="box-client" rx="4"/>
|
|
61
|
+
<!-- text_y = 135 + (40/2) + (12*0.35) = 135 + 20 + 4.2 = 159.2 -->
|
|
62
|
+
<text x="180" y="159" text-anchor="middle" class="box-label">User/Client Request</text>
|
|
63
|
+
</g>
|
|
64
|
+
|
|
65
|
+
<!-- Arrow down -->
|
|
66
|
+
<line x1="180" y1="175" x2="180" y2="205" class="arrow-monolithic" marker-end="url(#arr-mono)"/>
|
|
67
|
+
|
|
68
|
+
<!-- API Gateway node -->
|
|
69
|
+
<g id="node-mono-gateway" class="node">
|
|
70
|
+
<rect x="45" y="205" width="270" height="40" class="box-monolithic" rx="4"/>
|
|
71
|
+
<!-- text_y = 205 + (40/2) + (12*0.35) = 205 + 20 + 4.2 = 229.2 -->
|
|
72
|
+
<text x="180" y="229" text-anchor="middle" class="box-label">API Gateway</text>
|
|
73
|
+
</g>
|
|
74
|
+
|
|
75
|
+
<!-- Arrow down -->
|
|
76
|
+
<line x1="180" y1="245" x2="180" y2="275" class="arrow-monolithic" marker-end="url(#arr-mono)"/>
|
|
77
|
+
|
|
78
|
+
<!-- Single Monolithic Server node -->
|
|
79
|
+
<g id="node-mono-server" class="node">
|
|
80
|
+
<rect x="45" y="275" width="270" height="120" class="box-monolithic" rx="4"/>
|
|
81
|
+
<!-- Title: text_y = 275 + (120/2) + (12*0.35) - offset_up = 275 + 60 + 4.2 - 28 = 311.2 -->
|
|
82
|
+
<text x="180" y="305" text-anchor="middle" class="box-label" font-weight="600">Single Monolithic Server</text>
|
|
83
|
+
|
|
84
|
+
<!-- Internal routing (shown as lines) -->
|
|
85
|
+
<line x1="60" y1="325" x2="300" y2="325" class="arrow" stroke-dasharray="3,3"/>
|
|
86
|
+
|
|
87
|
+
<!-- All components inside the same process -->
|
|
88
|
+
<!-- Users Service: text_y = 275 + 35 + (10*0.35) = 314.5 -->
|
|
89
|
+
<text x="120" y="340" text-anchor="middle" class="box-label-small" font-size="10">Users Service</text>
|
|
90
|
+
|
|
91
|
+
<!-- Products Service: text_y = similar calculation -->
|
|
92
|
+
<text x="240" y="340" text-anchor="middle" class="box-label-small" font-size="10">Products Service</text>
|
|
93
|
+
|
|
94
|
+
<!-- Orders Service -->
|
|
95
|
+
<text x="180" y="365" text-anchor="middle" class="box-label-small" font-size="10">Orders Service</text>
|
|
96
|
+
|
|
97
|
+
<!-- Database -->
|
|
98
|
+
<text x="180" y="385" text-anchor="middle" class="box-label-small" font-size="10">Shared Database</text>
|
|
99
|
+
</g>
|
|
100
|
+
|
|
101
|
+
<!-- Arrow down -->
|
|
102
|
+
<line x1="180" y1="395" x2="180" y2="425" class="arrow-monolithic" marker-end="url(#arr-mono)"/>
|
|
103
|
+
|
|
104
|
+
<!-- Response node -->
|
|
105
|
+
<g id="node-mono-response" class="node">
|
|
106
|
+
<rect x="45" y="425" width="270" height="40" class="box-monolithic" rx="4"/>
|
|
107
|
+
<!-- text_y = 425 + (40/2) + (12*0.35) = 425 + 20 + 4.2 = 449.2 -->
|
|
108
|
+
<text x="180" y="449" text-anchor="middle" class="box-label">Response to Client</text>
|
|
109
|
+
</g>
|
|
110
|
+
|
|
111
|
+
<!-- Characteristics box -->
|
|
112
|
+
<rect x="45" y="485" width="270" height="100" class="box-neutral" rx="4" stroke-dasharray="3,3"/>
|
|
113
|
+
<!-- Title: text_y = 485 + 8 + 11 = 504 -->
|
|
114
|
+
<text x="180" y="504" text-anchor="middle" class="comparison-label">Characteristics:</text>
|
|
115
|
+
<!-- Point 1 -->
|
|
116
|
+
<text x="55" y="523" class="text-annotation">• Single deployment unit</text>
|
|
117
|
+
<!-- Point 2 -->
|
|
118
|
+
<text x="55" y="540" class="text-annotation">• All code in one process</text>
|
|
119
|
+
<!-- Point 3 -->
|
|
120
|
+
<text x="55" y="557" class="text-annotation">• Shared database</text>
|
|
121
|
+
<!-- Point 4 -->
|
|
122
|
+
<text x="55" y="574" class="text-annotation">• One failure = whole app down</text>
|
|
123
|
+
</g>
|
|
124
|
+
|
|
125
|
+
<!-- ========== MICROSERVICE SECTION ========== -->
|
|
126
|
+
<g id="section-microservice" class="section">
|
|
127
|
+
<!-- Section header background -->
|
|
128
|
+
<rect x="380" y="75" width="320" height="40" class="header-microservice" rx="4"/>
|
|
129
|
+
<text x="540" y="102" text-anchor="middle" class="section-label">Microservice Architecture</text>
|
|
130
|
+
|
|
131
|
+
<!-- Client node -->
|
|
132
|
+
<g id="node-micro-client" class="node">
|
|
133
|
+
<rect x="405" y="135" width="270" height="40" class="box-client" rx="4"/>
|
|
134
|
+
<!-- text_y = 135 + (40/2) + (12*0.35) = 135 + 20 + 4.2 = 159.2 -->
|
|
135
|
+
<text x="540" y="159" text-anchor="middle" class="box-label">User/Client Request</text>
|
|
136
|
+
</g>
|
|
137
|
+
|
|
138
|
+
<!-- Arrow down -->
|
|
139
|
+
<line x1="540" y1="175" x2="540" y2="205" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
140
|
+
|
|
141
|
+
<!-- API Gateway node -->
|
|
142
|
+
<g id="node-micro-gateway" class="node">
|
|
143
|
+
<rect x="405" y="205" width="270" height="40" class="box-microservice" rx="4"/>
|
|
144
|
+
<!-- text_y = 205 + (40/2) + (12*0.35) = 205 + 20 + 4.2 = 229.2 -->
|
|
145
|
+
<text x="540" y="229" text-anchor="middle" class="box-label">API Gateway / Service Router</text>
|
|
146
|
+
</g>
|
|
147
|
+
|
|
148
|
+
<!-- Arrow down -->
|
|
149
|
+
<line x1="540" y1="245" x2="540" y2="275" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
150
|
+
|
|
151
|
+
<!-- Three independent services -->
|
|
152
|
+
<g id="services-container">
|
|
153
|
+
<!-- Users Service -->
|
|
154
|
+
<g id="node-micro-users" class="node">
|
|
155
|
+
<rect x="405" y="275" width="75" height="80" class="box-microservice" rx="4"/>
|
|
156
|
+
<!-- text_y = 275 + (80/2) + (11*0.35) = 275 + 40 + 3.85 = 318.85 -->
|
|
157
|
+
<text x="442.5" y="319" text-anchor="middle" class="box-label" font-size="11">Users</text>
|
|
158
|
+
<!-- text_y = 275 + 50 + 11 = 336 -->
|
|
159
|
+
<text x="442.5" y="336" text-anchor="middle" class="box-label-small" font-size="9">Service</text>
|
|
160
|
+
<!-- DB label: text_y = 275 + 65 = 340 -->
|
|
161
|
+
<text x="442.5" y="352" text-anchor="middle" class="box-label-small" font-size="8">+ DB</text>
|
|
162
|
+
</g>
|
|
163
|
+
|
|
164
|
+
<!-- Products Service -->
|
|
165
|
+
<g id="node-micro-products" class="node">
|
|
166
|
+
<rect x="492" y="275" width="75" height="80" class="box-microservice" rx="4"/>
|
|
167
|
+
<!-- text_y = 275 + (80/2) + (11*0.35) = 318.85 -->
|
|
168
|
+
<text x="529.5" y="319" text-anchor="middle" class="box-label" font-size="11">Products</text>
|
|
169
|
+
<text x="529.5" y="336" text-anchor="middle" class="box-label-small" font-size="9">Service</text>
|
|
170
|
+
<text x="529.5" y="352" text-anchor="middle" class="box-label-small" font-size="8">+ DB</text>
|
|
171
|
+
</g>
|
|
172
|
+
|
|
173
|
+
<!-- Orders Service -->
|
|
174
|
+
<g id="node-micro-orders" class="node">
|
|
175
|
+
<rect x="579" y="275" width="75" height="80" class="box-microservice" rx="4"/>
|
|
176
|
+
<!-- text_y = 275 + (80/2) + (11*0.35) = 318.85 -->
|
|
177
|
+
<text x="616.5" y="319" text-anchor="middle" class="box-label" font-size="11">Orders</text>
|
|
178
|
+
<text x="616.5" y="336" text-anchor="middle" class="box-label-small" font-size="9">Service</text>
|
|
179
|
+
<text x="616.5" y="352" text-anchor="middle" class="box-label-small" font-size="8">+ DB</text>
|
|
180
|
+
</g>
|
|
181
|
+
</g>
|
|
182
|
+
|
|
183
|
+
<!-- Arrows from gateway to services -->
|
|
184
|
+
<line x1="495" y1="245" x2="442.5" y2="275" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
185
|
+
<line x1="540" y1="245" x2="529.5" y2="275" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
186
|
+
<line x1="585" y1="245" x2="616.5" y2="275" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
187
|
+
|
|
188
|
+
<!-- Service-to-service communication (dotted) -->
|
|
189
|
+
<line x1="480" y1="310" x2="492" y2="310" class="arrow-dashed"/>
|
|
190
|
+
<line x1="567" y1="310" x2="579" y2="310" class="arrow-dashed"/>
|
|
191
|
+
|
|
192
|
+
<!-- Arrows down from services -->
|
|
193
|
+
<line x1="442.5" y1="355" x2="442.5" y2="385" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
194
|
+
<line x1="529.5" y1="355" x2="529.5" y2="385" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
195
|
+
<line x1="616.5" y1="355" x2="616.5" y2="385" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
196
|
+
|
|
197
|
+
<!-- Response aggregation node -->
|
|
198
|
+
<g id="node-micro-aggregate" class="node">
|
|
199
|
+
<rect x="405" y="385" width="270" height="40" class="box-microservice" rx="4"/>
|
|
200
|
+
<!-- text_y = 385 + (40/2) + (12*0.35) = 385 + 20 + 4.2 = 409.2 -->
|
|
201
|
+
<text x="540" y="409" text-anchor="middle" class="box-label">Aggregate & Response</text>
|
|
202
|
+
</g>
|
|
203
|
+
|
|
204
|
+
<!-- Arrow down -->
|
|
205
|
+
<line x1="540" y1="425" x2="540" y2="455" class="arrow-microservice" marker-end="url(#arr-micro)"/>
|
|
206
|
+
|
|
207
|
+
<!-- Final response node -->
|
|
208
|
+
<g id="node-micro-response" class="node">
|
|
209
|
+
<rect x="405" y="455" width="270" height="40" class="box-microservice" rx="4"/>
|
|
210
|
+
<!-- text_y = 455 + (40/2) + (12*0.35) = 455 + 20 + 4.2 = 479.2 -->
|
|
211
|
+
<text x="540" y="479" text-anchor="middle" class="box-label">Response to Client</text>
|
|
212
|
+
</g>
|
|
213
|
+
|
|
214
|
+
<!-- Characteristics box -->
|
|
215
|
+
<rect x="405" y="515" width="270" height="100" class="box-neutral" rx="4" stroke-dasharray="3,3"/>
|
|
216
|
+
<!-- Title: text_y = 515 + 8 + 11 = 534 -->
|
|
217
|
+
<text x="540" y="534" text-anchor="middle" class="comparison-label">Characteristics:</text>
|
|
218
|
+
<!-- Point 1 -->
|
|
219
|
+
<text x="415" y="553" class="text-annotation">• Independent services</text>
|
|
220
|
+
<!-- Point 2 -->
|
|
221
|
+
<text x="415" y="570" class="text-annotation">• Decentralized data</text>
|
|
222
|
+
<!-- Point 3 -->
|
|
223
|
+
<text x="415" y="587" class="text-annotation">• Service-to-service calls</text>
|
|
224
|
+
<!-- Point 4 -->
|
|
225
|
+
<text x="415" y="604" class="text-annotation">• Isolated failures</text>
|
|
226
|
+
</g>
|
|
227
|
+
|
|
228
|
+
<!-- ========== FLOW COMPARISON CALLOUT ========== -->
|
|
229
|
+
<g id="comparison-detail">
|
|
230
|
+
<!-- Request flow detail -->
|
|
231
|
+
<rect x="20" y="630" width="680" height="250" class="box-neutral" rx="4" stroke-dasharray="3,3" stroke-width="1.5"/>
|
|
232
|
+
|
|
233
|
+
<!-- Title: text_y = 630 + 22 + 14 = 666 -->
|
|
234
|
+
<text x="360" y="666" text-anchor="middle" class="section-title" font-size="13" fill="#181340" font-weight="600">Request Flow Comparison</text>
|
|
235
|
+
|
|
236
|
+
<!-- Monolithic flow detail -->
|
|
237
|
+
<g id="mono-flow-detail">
|
|
238
|
+
<!-- Header -->
|
|
239
|
+
<text x="60" y="700" class="comparison-label" font-size="11" fill="#ff1c24" font-weight="600">Monolithic Approach:</text>
|
|
240
|
+
|
|
241
|
+
<!-- Flow steps -->
|
|
242
|
+
<!-- text_y = 710 + (20*0.35) = 717 -->
|
|
243
|
+
<text x="60" y="717" class="text-annotation" font-size="10">1. Request arrives at single API endpoint</text>
|
|
244
|
+
<!-- text_y = 728 + (20*0.35) = 735 -->
|
|
245
|
+
<text x="60" y="735" class="text-annotation" font-size="10">2. Single process routes internally</text>
|
|
246
|
+
<!-- text_y = 746 + (20*0.35) = 753 -->
|
|
247
|
+
<text x="60" y="753" class="text-annotation" font-size="10">3. All business logic runs in same memory space</text>
|
|
248
|
+
<!-- text_y = 764 + (20*0.35) = 771 -->
|
|
249
|
+
<text x="60" y="771" class="text-annotation" font-size="10">4. Single database transaction</text>
|
|
250
|
+
<!-- text_y = 782 + (20*0.35) = 789 -->
|
|
251
|
+
<text x="60" y="789" class="text-annotation" font-size="10">5. Response returned directly</text>
|
|
252
|
+
|
|
253
|
+
<!-- Highlight -->
|
|
254
|
+
<text x="60" y="810" class="comparison-label" font-size="10" fill="#ff1c24">⚠ Tight coupling, scaling challenges</text>
|
|
255
|
+
</g>
|
|
256
|
+
|
|
257
|
+
<!-- Microservice flow detail -->
|
|
258
|
+
<g id="micro-flow-detail">
|
|
259
|
+
<!-- Header -->
|
|
260
|
+
<text x="380" y="700" class="comparison-label" font-size="11" fill="#006736" font-weight="600">Microservice Approach:</text>
|
|
261
|
+
|
|
262
|
+
<!-- Flow steps -->
|
|
263
|
+
<!-- text_y calculations same as above -->
|
|
264
|
+
<text x="380" y="717" class="text-annotation" font-size="10">1. Request routed to API Gateway</text>
|
|
265
|
+
<text x="380" y="735" class="text-annotation" font-size="10">2. Gateway dispatches to relevant services</text>
|
|
266
|
+
<text x="380" y="753" class="text-annotation" font-size="10">3. Services handle independently (+ own DB)</text>
|
|
267
|
+
<text x="380" y="771" class="text-annotation" font-size="10">4. Services may call each other if needed</text>
|
|
268
|
+
<text x="380" y="789" class="text-annotation" font-size="10">5. Gateway aggregates & responds</text>
|
|
269
|
+
|
|
270
|
+
<!-- Highlight -->
|
|
271
|
+
<text x="380" y="810" class="comparison-label" font-size="10" fill="#006736">✓ Loose coupling, independent scaling</text>
|
|
272
|
+
</g>
|
|
273
|
+
</g>
|
|
274
|
+
|
|
275
|
+
<!-- ========== BOTTOM ANNOTATION ========== -->
|
|
276
|
+
<text x="360" y="900" text-anchor="middle" class="text-muted" font-size="9">Red: Single point of failure risk | Green: Resilient isolation</text>
|
|
277
|
+
</svg>
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 1000"
|
|
2
|
+
font-family="system-ui, -apple-system, sans-serif">
|
|
3
|
+
<style>
|
|
4
|
+
/* Palette */
|
|
5
|
+
.bg { fill: #fafafa; stroke: #e4e4e4; }
|
|
6
|
+
|
|
7
|
+
/* Box styles */
|
|
8
|
+
.box-primary { fill: #eef6ff; stroke: #3da8f4; stroke-width: 2; }
|
|
9
|
+
.box-decision { fill: #fffbe6; stroke: #fdbe52; stroke-width: 2; }
|
|
10
|
+
.box-positive { fill: #f0fff5; stroke: #006736; stroke-width: 2; }
|
|
11
|
+
.box-negative { fill: #fff3f3; stroke: #ff1c24; stroke-width: 2; }
|
|
12
|
+
|
|
13
|
+
/* Arrows */
|
|
14
|
+
.arrow { stroke: #9e9e9e; stroke-width: 1.5; fill: none; }
|
|
15
|
+
.arrow-positive { stroke: #006736; stroke-width: 1.5; fill: none; }
|
|
16
|
+
.arrow-negative { stroke: #ff1c24; stroke-width: 1.5; fill: none; }
|
|
17
|
+
|
|
18
|
+
/* Text */
|
|
19
|
+
.text-primary { fill: #181340; }
|
|
20
|
+
.text-muted { fill: #9e9e9e; }
|
|
21
|
+
.text-label { fill: #181340; font-size: 13px; }
|
|
22
|
+
.text-small { fill: #9e9e9e; font-size: 11px; }
|
|
23
|
+
</style>
|
|
24
|
+
|
|
25
|
+
<defs>
|
|
26
|
+
<!-- Arrow markers -->
|
|
27
|
+
<marker id="arr" viewBox="0 0 10 10" refX="9" refY="5"
|
|
28
|
+
markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
29
|
+
<path d="M0 0 L10 5 L0 10z" fill="#9e9e9e"/>
|
|
30
|
+
</marker>
|
|
31
|
+
<marker id="arr-pos" viewBox="0 0 10 10" refX="9" refY="5"
|
|
32
|
+
markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
33
|
+
<path d="M0 0 L10 5 L0 10z" fill="#006736"/>
|
|
34
|
+
</marker>
|
|
35
|
+
<marker id="arr-neg" viewBox="0 0 10 10" refX="9" refY="5"
|
|
36
|
+
markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
37
|
+
<path d="M0 0 L10 5 L0 10z" fill="#ff1c24"/>
|
|
38
|
+
</marker>
|
|
39
|
+
</defs>
|
|
40
|
+
|
|
41
|
+
<!-- Root: Entry Point -->
|
|
42
|
+
<g id="node-entry" class="node">
|
|
43
|
+
<rect x="300" y="20" width="200" height="40" class="box-primary" rx="4"/>
|
|
44
|
+
<!-- text_y = 20 + (40/2) + (13*0.35) = 20 + 20 + 4.55 = 44.55 ≈ 45 -->
|
|
45
|
+
<text x="400" y="45" text-anchor="middle" class="text-label">app.js (entry)</text>
|
|
46
|
+
</g>
|
|
47
|
+
|
|
48
|
+
<!-- Fan lines from entry to three imports -->
|
|
49
|
+
<line x1="400" y1="60" x2="150" y2="140" class="arrow" marker-end="url(#arr)"/>
|
|
50
|
+
<line x1="400" y1="60" x2="400" y2="140" class="arrow" marker-end="url(#arr)"/>
|
|
51
|
+
<line x1="400" y1="60" x2="650" y2="140" class="arrow" marker-end="url(#arr)"/>
|
|
52
|
+
|
|
53
|
+
<!-- Left branch: ./utils -->
|
|
54
|
+
<g id="node-import-utils" class="node">
|
|
55
|
+
<rect x="50" y="140" width="200" height="40" class="box-primary" rx="4"/>
|
|
56
|
+
<!-- text_y = 140 + (40/2) + (13*0.35) = 140 + 20 + 4.55 = 164.55 ≈ 165 -->
|
|
57
|
+
<text x="150" y="165" text-anchor="middle" class="text-label">./utils</text>
|
|
58
|
+
</g>
|
|
59
|
+
|
|
60
|
+
<!-- Center branch: lodash -->
|
|
61
|
+
<g id="node-import-lodash" class="node">
|
|
62
|
+
<rect x="300" y="140" width="200" height="40" class="box-primary" rx="4"/>
|
|
63
|
+
<!-- text_y = 140 + (40/2) + (13*0.35) = 140 + 20 + 4.55 = 164.55 ≈ 165 -->
|
|
64
|
+
<text x="400" y="165" text-anchor="middle" class="text-label">lodash</text>
|
|
65
|
+
</g>
|
|
66
|
+
|
|
67
|
+
<!-- Right branch: ./helpers -->
|
|
68
|
+
<g id="node-import-helpers" class="node">
|
|
69
|
+
<rect x="550" y="140" width="200" height="40" class="box-primary" rx="4"/>
|
|
70
|
+
<!-- text_y = 140 + (40/2) + (13*0.35) = 140 + 20 + 4.55 = 164.55 ≈ 165 -->
|
|
71
|
+
<text x="650" y="165" text-anchor="middle" class="text-label">./helpers</text>
|
|
72
|
+
</g>
|
|
73
|
+
|
|
74
|
+
<!-- LEFT BRANCH: utils decision -->
|
|
75
|
+
<line x1="150" y1="180" x2="150" y2="230" class="arrow" marker-end="url(#arr)"/>
|
|
76
|
+
|
|
77
|
+
<g id="gate-cached-utils" class="gate">
|
|
78
|
+
<polygon points="150,230 200,280 150,330 100,280" class="box-decision"/>
|
|
79
|
+
<!-- text_y = 280 (center of diamond) + (13*0.35) = 280 + 4.55 = 284.55 ≈ 285 -->
|
|
80
|
+
<text x="150" y="285" text-anchor="middle" class="text-label">cached?</text>
|
|
81
|
+
</g>
|
|
82
|
+
|
|
83
|
+
<!-- Left branch from cache decision: NO (fetch & parse) -->
|
|
84
|
+
<line x1="100" y1="280" x2="50" y2="280" class="arrow" marker-end="url(#arr)"/>
|
|
85
|
+
<text x="75" y="275" class="text-small">no</text>
|
|
86
|
+
|
|
87
|
+
<g id="node-fetch-utils" class="node">
|
|
88
|
+
<rect x="-50" y="260" width="140" height="40" class="box-negative" rx="4"/>
|
|
89
|
+
<!-- text_y = 260 + (40/2) + (13*0.35) = 260 + 20 + 4.55 = 284.55 ≈ 285 -->
|
|
90
|
+
<text x="15" y="285" text-anchor="middle" class="text-label">fetch &</text>
|
|
91
|
+
</g>
|
|
92
|
+
|
|
93
|
+
<g id="node-parse-utils" class="node">
|
|
94
|
+
<rect x="-50" y="320" width="140" height="40" class="box-negative" rx="4"/>
|
|
95
|
+
<!-- text_y = 320 + (40/2) + (13*0.35) = 320 + 20 + 4.55 = 344.55 ≈ 345 -->
|
|
96
|
+
<text x="15" y="345" text-anchor="middle" class="text-label">parse</text>
|
|
97
|
+
</g>
|
|
98
|
+
|
|
99
|
+
<line x1="15" y1="300" x2="15" y2="320" class="arrow" marker-end="url(#arr)"/>
|
|
100
|
+
|
|
101
|
+
<!-- Left branch from cache decision: YES (resolve from cache) -->
|
|
102
|
+
<line x1="150" y1="330" x2="150" y2="380" class="arrow-positive" marker-end="url(#arr-pos)"/>
|
|
103
|
+
<text x="160" y="360" class="text-small">yes</text>
|
|
104
|
+
|
|
105
|
+
<g id="node-cache-utils" class="node">
|
|
106
|
+
<rect x="75" y="380" width="150" height="40" class="box-positive" rx="4"/>
|
|
107
|
+
<!-- text_y = 380 + (40/2) + (13*0.35) = 380 + 20 + 4.55 = 404.55 ≈ 405 -->
|
|
108
|
+
<text x="150" y="405" text-anchor="middle" class="text-label">from cache</text>
|
|
109
|
+
</g>
|
|
110
|
+
|
|
111
|
+
<!-- Converge paths for utils -->
|
|
112
|
+
<line x1="15" y1="360" x2="15" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
113
|
+
<line x1="15" y1="430" x2="120" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
114
|
+
<line x1="150" y1="420" x2="150" y2="430" class="arrow-positive" marker-end="url(#arr-pos)"/>
|
|
115
|
+
<line x1="120" y1="430" x2="150" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
116
|
+
|
|
117
|
+
<g id="node-utils-ready" class="node">
|
|
118
|
+
<rect x="75" y="430" width="150" height="40" class="box-primary" rx="4"/>
|
|
119
|
+
<!-- text_y = 430 + (40/2) + (13*0.35) = 430 + 20 + 4.55 = 454.55 ≈ 455 -->
|
|
120
|
+
<text x="150" y="455" text-anchor="middle" class="text-label">utils ready</text>
|
|
121
|
+
</g>
|
|
122
|
+
|
|
123
|
+
<!-- CENTER BRANCH: lodash decision -->
|
|
124
|
+
<line x1="400" y1="180" x2="400" y2="230" class="arrow" marker-end="url(#arr)"/>
|
|
125
|
+
|
|
126
|
+
<g id="gate-cached-lodash" class="gate">
|
|
127
|
+
<polygon points="400,230 450,280 400,330 350,280" class="box-decision"/>
|
|
128
|
+
<!-- text_y = 280 (center) + (13*0.35) = 284.55 ≈ 285 -->
|
|
129
|
+
<text x="400" y="285" text-anchor="middle" class="text-label">cached?</text>
|
|
130
|
+
</g>
|
|
131
|
+
|
|
132
|
+
<!-- Center branch from cache decision: NO (fetch & parse) -->
|
|
133
|
+
<line x1="350" y1="280" x2="300" y2="280" class="arrow" marker-end="url(#arr)"/>
|
|
134
|
+
<text x="325" y="275" class="text-small">no</text>
|
|
135
|
+
|
|
136
|
+
<g id="node-fetch-lodash" class="node">
|
|
137
|
+
<rect x="200" y="260" width="140" height="40" class="box-negative" rx="4"/>
|
|
138
|
+
<!-- text_y = 260 + (40/2) + (13*0.35) = 284.55 ≈ 285 -->
|
|
139
|
+
<text x="270" y="285" text-anchor="middle" class="text-label">fetch &</text>
|
|
140
|
+
</g>
|
|
141
|
+
|
|
142
|
+
<g id="node-parse-lodash" class="node">
|
|
143
|
+
<rect x="200" y="320" width="140" height="40" class="box-negative" rx="4"/>
|
|
144
|
+
<!-- text_y = 320 + (40/2) + (13*0.35) = 344.55 ≈ 345 -->
|
|
145
|
+
<text x="270" y="345" text-anchor="middle" class="text-label">parse</text>
|
|
146
|
+
</g>
|
|
147
|
+
|
|
148
|
+
<line x1="270" y1="300" x2="270" y2="320" class="arrow" marker-end="url(#arr)"/>
|
|
149
|
+
|
|
150
|
+
<!-- Center branch from cache decision: YES (resolve from cache) -->
|
|
151
|
+
<line x1="400" y1="330" x2="400" y2="380" class="arrow-positive" marker-end="url(#arr-pos)"/>
|
|
152
|
+
<text x="410" y="360" class="text-small">yes</text>
|
|
153
|
+
|
|
154
|
+
<g id="node-cache-lodash" class="node">
|
|
155
|
+
<rect x="325" y="380" width="150" height="40" class="box-positive" rx="4"/>
|
|
156
|
+
<!-- text_y = 380 + (40/2) + (13*0.35) = 404.55 ≈ 405 -->
|
|
157
|
+
<text x="400" y="405" text-anchor="middle" class="text-label">from cache</text>
|
|
158
|
+
</g>
|
|
159
|
+
|
|
160
|
+
<!-- Converge paths for lodash -->
|
|
161
|
+
<line x1="270" y1="360" x2="270" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
162
|
+
<line x1="270" y1="430" x2="370" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
163
|
+
<line x1="400" y1="420" x2="400" y2="430" class="arrow-positive" marker-end="url(#arr-pos)"/>
|
|
164
|
+
<line x1="370" y1="430" x2="400" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
165
|
+
|
|
166
|
+
<g id="node-lodash-ready" class="node">
|
|
167
|
+
<rect x="325" y="430" width="150" height="40" class="box-primary" rx="4"/>
|
|
168
|
+
<!-- text_y = 430 + (40/2) + (13*0.35) = 454.55 ≈ 455 -->
|
|
169
|
+
<text x="400" y="455" text-anchor="middle" class="text-label">lodash ready</text>
|
|
170
|
+
</g>
|
|
171
|
+
|
|
172
|
+
<!-- RIGHT BRANCH: helpers decision -->
|
|
173
|
+
<line x1="650" y1="180" x2="650" y2="230" class="arrow" marker-end="url(#arr)"/>
|
|
174
|
+
|
|
175
|
+
<g id="gate-cached-helpers" class="gate">
|
|
176
|
+
<polygon points="650,230 700,280 650,330 600,280" class="box-decision"/>
|
|
177
|
+
<!-- text_y = 280 (center) + (13*0.35) = 284.55 ≈ 285 -->
|
|
178
|
+
<text x="650" y="285" text-anchor="middle" class="text-label">cached?</text>
|
|
179
|
+
</g>
|
|
180
|
+
|
|
181
|
+
<!-- Right branch from cache decision: NO (fetch & parse) -->
|
|
182
|
+
<line x1="700" y1="280" x2="750" y2="280" class="arrow" marker-end="url(#arr)"/>
|
|
183
|
+
<text x="725" y="275" class="text-small">no</text>
|
|
184
|
+
|
|
185
|
+
<g id="node-fetch-helpers" class="node">
|
|
186
|
+
<rect x="660" y="260" width="140" height="40" class="box-negative" rx="4"/>
|
|
187
|
+
<!-- text_y = 260 + (40/2) + (13*0.35) = 284.55 ≈ 285 -->
|
|
188
|
+
<text x="730" y="285" text-anchor="middle" class="text-label">fetch &</text>
|
|
189
|
+
</g>
|
|
190
|
+
|
|
191
|
+
<g id="node-parse-helpers" class="node">
|
|
192
|
+
<rect x="660" y="320" width="140" height="40" class="box-negative" rx="4"/>
|
|
193
|
+
<!-- text_y = 320 + (40/2) + (13*0.35) = 344.55 ≈ 345 -->
|
|
194
|
+
<text x="730" y="345" text-anchor="middle" class="text-label">parse</text>
|
|
195
|
+
</g>
|
|
196
|
+
|
|
197
|
+
<line x1="730" y1="300" x2="730" y2="320" class="arrow" marker-end="url(#arr)"/>
|
|
198
|
+
|
|
199
|
+
<!-- Right branch from cache decision: YES (resolve from cache) -->
|
|
200
|
+
<line x1="650" y1="330" x2="650" y2="380" class="arrow-positive" marker-end="url(#arr-pos)"/>
|
|
201
|
+
<text x="660" y="360" class="text-small">yes</text>
|
|
202
|
+
|
|
203
|
+
<g id="node-cache-helpers" class="node">
|
|
204
|
+
<rect x="575" y="380" width="150" height="40" class="box-positive" rx="4"/>
|
|
205
|
+
<!-- text_y = 380 + (40/2) + (13*0.35) = 404.55 ≈ 405 -->
|
|
206
|
+
<text x="650" y="405" text-anchor="middle" class="text-label">from cache</text>
|
|
207
|
+
</g>
|
|
208
|
+
|
|
209
|
+
<!-- Converge paths for helpers -->
|
|
210
|
+
<line x1="730" y1="360" x2="730" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
211
|
+
<line x1="730" y1="430" x2="620" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
212
|
+
<line x1="650" y1="420" x2="650" y2="430" class="arrow-positive" marker-end="url(#arr-pos)"/>
|
|
213
|
+
<line x1="620" y1="430" x2="650" y2="430" class="arrow" marker-end="url(#arr)"/>
|
|
214
|
+
|
|
215
|
+
<g id="node-helpers-ready" class="node">
|
|
216
|
+
<rect x="575" y="430" width="150" height="40" class="box-primary" rx="4"/>
|
|
217
|
+
<!-- text_y = 430 + (40/2) + (13*0.35) = 454.55 ≈ 455 -->
|
|
218
|
+
<text x="650" y="455" text-anchor="middle" class="text-label">helpers ready</text>
|
|
219
|
+
</g>
|
|
220
|
+
|
|
221
|
+
<!-- Final merge: all three branches converge -->
|
|
222
|
+
<line x1="150" y1="470" x2="150" y2="520" class="arrow" marker-end="url(#arr)"/>
|
|
223
|
+
<line x1="400" y1="470" x2="400" y2="520" class="arrow" marker-end="url(#arr)"/>
|
|
224
|
+
<line x1="650" y1="470" x2="650" y2="520" class="arrow" marker-end="url(#arr)"/>
|
|
225
|
+
|
|
226
|
+
<!-- Converge to single merge node -->
|
|
227
|
+
<line x1="150" y1="520" x2="250" y2="520" class="arrow" marker-end="url(#arr)"/>
|
|
228
|
+
<line x1="400" y1="520" x2="400" y2="520" class="arrow" marker-end="url(#arr)"/>
|
|
229
|
+
<line x1="650" y1="520" x2="550" y2="520" class="arrow" marker-end="url(#arr)"/>
|
|
230
|
+
|
|
231
|
+
<g id="node-all-ready" class="node">
|
|
232
|
+
<rect x="250" y="520" width="300" height="50" class="box-positive" rx="4"/>
|
|
233
|
+
<!-- text_y = 520 + (50/2) + (13*0.35) = 520 + 25 + 4.55 = 549.55 ≈ 550 -->
|
|
234
|
+
<text x="400" y="550" text-anchor="middle" class="text-label">All dependencies resolved</text>
|
|
235
|
+
</g>
|
|
236
|
+
|
|
237
|
+
<!-- Final action: bundle -->
|
|
238
|
+
<line x1="400" y1="570" x2="400" y2="620" class="arrow" marker-end="url(#arr)"/>
|
|
239
|
+
|
|
240
|
+
<g id="node-bundle" class="node">
|
|
241
|
+
<rect x="300" y="620" width="200" height="40" class="box-positive" rx="4"/>
|
|
242
|
+
<!-- text_y = 620 + (40/2) + (13*0.35) = 644.55 ≈ 645 -->
|
|
243
|
+
<text x="400" y="645" text-anchor="middle" class="text-label">Generate bundle</text>
|
|
244
|
+
</g>
|
|
245
|
+
|
|
246
|
+
<!-- Annotation: explain the tree structure -->
|
|
247
|
+
<text x="400" y="700" text-anchor="middle" class="text-small">Entry point (root) fans out to imports (branches).</text>
|
|
248
|
+
<text x="400" y="715" text-anchor="middle" class="text-small">Each import checks cache: hit ✓ or miss → fetch & parse.</text>
|
|
249
|
+
<text x="400" y="730" text-anchor="middle" class="text-small">All paths merge downward (arrows point in), then bundle.</text>
|
|
250
|
+
</svg>
|