@rip-lang/server 1.3.126 → 1.4.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/{docs/READ_VALIDATORS.md → API.md} +41 -119
- package/CONFIG.md +408 -0
- package/README.md +246 -1109
- package/acme/crypto.rip +0 -2
- package/browse.rip +62 -0
- package/control/cli.rip +89 -34
- package/control/lifecycle.rip +67 -1
- package/control/manager.rip +250 -0
- package/control/mdns.rip +3 -0
- package/middleware.rip +1 -1
- package/package.json +14 -11
- package/server.rip +189 -673
- package/serving/config.rip +766 -0
- package/{edge → serving}/forwarding.rip +2 -2
- package/serving/logging.rip +101 -0
- package/{edge → serving}/metrics.rip +29 -1
- package/serving/proxy.rip +99 -0
- package/{edge → serving}/queue.rip +1 -1
- package/{edge → serving}/ratelimit.rip +1 -1
- package/{edge → serving}/realtime.rip +71 -2
- package/{edge → serving}/registry.rip +1 -1
- package/{edge → serving}/router.rip +3 -3
- package/{edge → serving}/runtime.rip +18 -16
- package/{edge → serving}/security.rip +1 -1
- package/serving/static.rip +393 -0
- package/{edge → serving}/tls.rip +3 -7
- package/{edge → serving}/upstream.rip +4 -4
- package/{edge → serving}/verify.rip +16 -16
- package/streams/{tls_clienthello.rip → clienthello.rip} +1 -1
- package/streams/config.rip +8 -8
- package/streams/index.rip +5 -5
- package/streams/router.rip +2 -2
- package/tests/acme.rip +1 -1
- package/tests/config.rip +215 -0
- package/tests/control.rip +1 -1
- package/tests/{runtime_entrypoints.rip → entrypoints.rip} +11 -7
- package/tests/extracted.rip +118 -0
- package/tests/helpers.rip +4 -4
- package/tests/metrics.rip +3 -3
- package/tests/proxy.rip +9 -8
- package/tests/read.rip +1 -1
- package/tests/realtime.rip +3 -3
- package/tests/registry.rip +4 -4
- package/tests/router.rip +27 -27
- package/tests/runner.rip +70 -0
- package/tests/security.rip +4 -4
- package/tests/servers.rip +102 -136
- package/tests/static.rip +2 -2
- package/tests/streams_clienthello.rip +2 -2
- package/tests/streams_index.rip +4 -4
- package/tests/streams_pipe.rip +1 -1
- package/tests/streams_router.rip +10 -10
- package/tests/streams_runtime.rip +4 -4
- package/tests/streams_upstream.rip +1 -1
- package/tests/upstream.rip +2 -2
- package/tests/verify.rip +18 -18
- package/tests/watchers.rip +4 -4
- package/default.rip +0 -435
- package/docs/edge/CONFIG_LIFECYCLE.md +0 -111
- package/docs/edge/CONTRACTS.md +0 -137
- package/docs/edge/EDGEFILE_CONTRACT.md +0 -282
- package/docs/edge/M0B_REVIEW_NOTES.md +0 -102
- package/docs/edge/SCHEDULER.md +0 -46
- package/docs/logo.png +0 -0
- package/docs/logo.svg +0 -13
- package/docs/social.png +0 -0
- package/edge/config.rip +0 -607
- package/edge/static.rip +0 -69
- package/tests/edgefile.rip +0 -165
package/tests/edgefile.rip
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { test, eq, ok } from '../test.rip'
|
|
2
|
-
import { normalizeEdgeConfig, normalizeLegacyConfig, summarizeConfig, formatConfigErrors } from '../edge/config.rip'
|
|
3
|
-
|
|
4
|
-
getErrors = (fn) ->
|
|
5
|
-
try
|
|
6
|
-
fn()
|
|
7
|
-
[]
|
|
8
|
-
catch e
|
|
9
|
-
e.validationErrors or []
|
|
10
|
-
|
|
11
|
-
test "normalizeEdgeConfig accepts hosts with upstreams", ->
|
|
12
|
-
normalized = normalizeEdgeConfig(
|
|
13
|
-
hosts:
|
|
14
|
-
'*.example.com':
|
|
15
|
-
routes: [
|
|
16
|
-
{ path: '/*', upstream: 'app' }
|
|
17
|
-
]
|
|
18
|
-
upstreams:
|
|
19
|
-
app:
|
|
20
|
-
targets: ['http://127.0.0.1:3000']
|
|
21
|
-
, '/srv')
|
|
22
|
-
eq normalized.kind, 'edge'
|
|
23
|
-
eq Object.keys(normalized.upstreams).length, 1
|
|
24
|
-
|
|
25
|
-
test "normalizeEdgeConfig accepts hosts with apps", ->
|
|
26
|
-
normalized = normalizeEdgeConfig(
|
|
27
|
-
hosts:
|
|
28
|
-
'*.example.com':
|
|
29
|
-
app: 'admin'
|
|
30
|
-
apps:
|
|
31
|
-
admin:
|
|
32
|
-
entry: './admin/index.rip'
|
|
33
|
-
, '/srv')
|
|
34
|
-
eq Object.keys(normalized.apps).length, 1
|
|
35
|
-
eq normalized.sites['*.example.com'].routes[0].app, 'admin'
|
|
36
|
-
|
|
37
|
-
test "normalizeEdgeConfig version and edge are optional", ->
|
|
38
|
-
config = normalizeEdgeConfig(
|
|
39
|
-
hosts:
|
|
40
|
-
'*.example.com':
|
|
41
|
-
root: '/mnt/site'
|
|
42
|
-
, '/srv')
|
|
43
|
-
eq config.version, 1
|
|
44
|
-
ok config.edge
|
|
45
|
-
|
|
46
|
-
test "normalizeEdgeConfig rejects wildcard ACME domains", ->
|
|
47
|
-
errors = getErrors ->
|
|
48
|
-
normalizeEdgeConfig(
|
|
49
|
-
edge:
|
|
50
|
-
acme: true
|
|
51
|
-
acmeDomains: ['*.example.com']
|
|
52
|
-
hosts:
|
|
53
|
-
'*.example.com':
|
|
54
|
-
root: '/mnt/site'
|
|
55
|
-
, '/srv')
|
|
56
|
-
ok errors.some((err) -> err.code is 'E_ACME_WILDCARD')
|
|
57
|
-
|
|
58
|
-
test "normalizeEdgeConfig rejects routes with multiple actions", ->
|
|
59
|
-
errors = getErrors ->
|
|
60
|
-
normalizeEdgeConfig(
|
|
61
|
-
upstreams:
|
|
62
|
-
api:
|
|
63
|
-
targets: ['http://127.0.0.1:4000']
|
|
64
|
-
apps:
|
|
65
|
-
admin:
|
|
66
|
-
entry: './admin/index.rip'
|
|
67
|
-
hosts:
|
|
68
|
-
'*.example.com':
|
|
69
|
-
routes: [
|
|
70
|
-
{ path: '/x', upstream: 'api', app: 'admin' }
|
|
71
|
-
]
|
|
72
|
-
, '/srv')
|
|
73
|
-
ok errors.some((err) -> err.code is 'E_ROUTE_ACTION')
|
|
74
|
-
|
|
75
|
-
test "normalizeEdgeConfig rejects websocket route without upstream", ->
|
|
76
|
-
errors = getErrors ->
|
|
77
|
-
normalizeEdgeConfig(
|
|
78
|
-
apps:
|
|
79
|
-
admin:
|
|
80
|
-
entry: './admin/index.rip'
|
|
81
|
-
hosts:
|
|
82
|
-
'*.example.com':
|
|
83
|
-
routes: [
|
|
84
|
-
{ path: '/ws', app: 'admin', websocket: true }
|
|
85
|
-
]
|
|
86
|
-
, '/srv')
|
|
87
|
-
ok errors.some((err) -> err.code is 'E_ROUTE_WEBSOCKET')
|
|
88
|
-
|
|
89
|
-
test "normalizeEdgeConfig preserves verify policy", ->
|
|
90
|
-
normalized = normalizeEdgeConfig(
|
|
91
|
-
edge:
|
|
92
|
-
verify:
|
|
93
|
-
requireHealthyUpstreams: false
|
|
94
|
-
requireReadyApps: true
|
|
95
|
-
includeUnroutedManagedApps: false
|
|
96
|
-
minHealthyTargetsPerUpstream: 2
|
|
97
|
-
hosts:
|
|
98
|
-
'*.example.com':
|
|
99
|
-
root: '/mnt/site'
|
|
100
|
-
, '/srv')
|
|
101
|
-
eq normalized.edge.verify.requireHealthyUpstreams, false
|
|
102
|
-
eq normalized.edge.verify.includeUnroutedManagedApps, false
|
|
103
|
-
eq normalized.edge.verify.minHealthyTargetsPerUpstream, 2
|
|
104
|
-
|
|
105
|
-
test "normalizeEdgeConfig accepts streamUpstreams and streams", ->
|
|
106
|
-
normalized = normalizeEdgeConfig(
|
|
107
|
-
hosts:
|
|
108
|
-
'*.example.com':
|
|
109
|
-
root: '/mnt/site'
|
|
110
|
-
streamUpstreams:
|
|
111
|
-
incus:
|
|
112
|
-
targets: ['127.0.0.1:8443']
|
|
113
|
-
streams: [
|
|
114
|
-
{ listen: 8443, sni: ['incus.example.com'], upstream: 'incus' }
|
|
115
|
-
]
|
|
116
|
-
, '/srv')
|
|
117
|
-
ok normalized.streamUpstreams['incus']
|
|
118
|
-
eq normalized.streams.length, 1
|
|
119
|
-
|
|
120
|
-
test "normalizeEdgeConfig rejects unknown stream upstream refs", ->
|
|
121
|
-
errors = getErrors ->
|
|
122
|
-
normalizeEdgeConfig(
|
|
123
|
-
hosts:
|
|
124
|
-
'*.example.com':
|
|
125
|
-
root: '/mnt/site'
|
|
126
|
-
streams: [
|
|
127
|
-
{ listen: 8443, sni: ['incus.example.com'], upstream: 'missing' }
|
|
128
|
-
]
|
|
129
|
-
, '/srv')
|
|
130
|
-
ok errors.some((err) -> err.code is 'E_STREAM_UPSTREAM_REF')
|
|
131
|
-
|
|
132
|
-
test "formatConfigErrors includes code path and hint", ->
|
|
133
|
-
output = formatConfigErrors('Edgefile.rip', [
|
|
134
|
-
code: 'E_ROUTE_ACTION'
|
|
135
|
-
path: 'routes[0]'
|
|
136
|
-
message: 'route must define exactly one action'
|
|
137
|
-
hint: 'Choose one action field per route.'
|
|
138
|
-
])
|
|
139
|
-
ok output.includes('[E_ROUTE_ACTION]')
|
|
140
|
-
ok output.includes('routes[0]')
|
|
141
|
-
ok output.includes('Hint:')
|
|
142
|
-
|
|
143
|
-
test "summarizeConfig reports canonical counts", ->
|
|
144
|
-
summary = summarizeConfig('/srv/Edgefile.rip',
|
|
145
|
-
kind: 'edge'
|
|
146
|
-
version: 1
|
|
147
|
-
edge: {}
|
|
148
|
-
upstreams: { app: { targets: ['http://127.0.0.1:3000'] } }
|
|
149
|
-
apps: { admin: { entry: '/srv/admin/index.rip' } }
|
|
150
|
-
routes: []
|
|
151
|
-
sites: { '*.example.com': { routes: [{ path: '/*', upstream: 'app' }] } }
|
|
152
|
-
)
|
|
153
|
-
eq summary.counts.upstreams, 1
|
|
154
|
-
eq summary.counts.apps, 1
|
|
155
|
-
eq summary.counts.sites, 1
|
|
156
|
-
|
|
157
|
-
test "normalizeLegacyConfig validates legacy apps object", ->
|
|
158
|
-
normalized = normalizeLegacyConfig(
|
|
159
|
-
apps:
|
|
160
|
-
web:
|
|
161
|
-
entry: './index.rip'
|
|
162
|
-
hosts: ['example.com']
|
|
163
|
-
, '/srv')
|
|
164
|
-
eq normalized.kind, 'legacy'
|
|
165
|
-
eq Object.keys(normalized.apps).length, 1
|