@rentnerproxy/app-contracts 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/contracts.schema.json +4007 -0
- package/dist/Types/contract.types.d.ts +15 -0
- package/dist/Types/contract.types.js +1 -0
- package/dist/catalog.d.ts +352 -0
- package/dist/catalog.js +54 -0
- package/dist/client.d.ts +31 -0
- package/dist/client.js +66 -0
- package/dist/http-operations.d.ts +333 -0
- package/dist/http-operations.generated.d.ts +299 -0
- package/dist/http-operations.generated.js +300 -0
- package/dist/http-operations.js +17 -0
- package/dist/http.d.ts +127 -0
- package/dist/http.js +142 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/manifest.d.ts +90 -0
- package/dist/manifest.js +106 -0
- package/dist/platform-api.d.ts +282 -0
- package/dist/platform-api.js +287 -0
- package/dist/primitives.d.ts +33 -0
- package/dist/primitives.js +87 -0
- package/dist/provider-api.d.ts +221 -0
- package/dist/provider-api.js +227 -0
- package/dist/public-schemas.d.ts +4 -0
- package/dist/public-schemas.js +6 -0
- package/dist/publication.d.ts +410 -0
- package/dist/publication.js +50 -0
- package/dist/runtime.d.ts +75 -0
- package/dist/runtime.js +88 -0
- package/dist/schemas.d.ts +926 -0
- package/dist/schemas.js +114 -0
- package/dist/ui-bridge.d.ts +81 -0
- package/dist/ui-bridge.js +92 -0
- package/dist/validation.d.ts +784 -0
- package/dist/validation.js +245 -0
- package/dist/wire.d.ts +31 -0
- package/dist/wire.js +54 -0
- package/fixtures.json +1094 -0
- package/http-fixtures.json +829 -0
- package/openapi.json +2557 -0
- package/package.json +60 -5
- package/protocol-fixtures.json +1804 -0
- package/upstream-probe-fixtures.json +852 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { catalog, catalogRelease, packageArtifact } from '../catalog.ts';
|
|
3
|
+
import type { appManifest } from '../manifest.ts';
|
|
4
|
+
import type { approval, candidate, publication } from '../publication.ts';
|
|
5
|
+
import type { protocolSchemas } from '../schemas.ts';
|
|
6
|
+
export type AppManifest = z.infer<typeof appManifest>;
|
|
7
|
+
export type CatalogRelease = z.infer<typeof catalogRelease>;
|
|
8
|
+
export type PackageArtifact = z.infer<typeof packageArtifact>;
|
|
9
|
+
export type Catalog = z.infer<typeof catalog>;
|
|
10
|
+
export type Candidate = z.infer<typeof candidate>;
|
|
11
|
+
export type Approval = z.infer<typeof approval>;
|
|
12
|
+
export type Publication = z.infer<typeof publication>;
|
|
13
|
+
export type ProtocolDocumentName = keyof typeof protocolSchemas;
|
|
14
|
+
export type ProtocolDocument<Name extends ProtocolDocumentName> = z.output<(typeof protocolSchemas)[Name]>;
|
|
15
|
+
export type ContractErrorCode = 'invalidShape' | 'invalidManifest' | 'incompatibleManifest' | 'invalidRelease' | 'invalidCandidate' | 'invalidCatalog' | 'approvalMismatch' | 'publicationMismatch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const releaseDistribution = "https://github.com/RentnerProxy/app-catalog/releases/download/";
|
|
3
|
+
export declare const catalogIcon: z.ZodObject<{
|
|
4
|
+
format: z.ZodEnum<{
|
|
5
|
+
png: "png";
|
|
6
|
+
webp: "webp";
|
|
7
|
+
}>;
|
|
8
|
+
sha256: z.ZodString;
|
|
9
|
+
sizeBytes: z.ZodNumber;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export declare const packageArtifact: z.ZodObject<{
|
|
12
|
+
manifest: z.ZodObject<{
|
|
13
|
+
formatVersion: z.ZodLiteral<1>;
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
version: z.ZodString;
|
|
16
|
+
target: z.ZodEnum<{
|
|
17
|
+
"linux-amd64": "linux-amd64";
|
|
18
|
+
"linux-arm64": "linux-arm64";
|
|
19
|
+
}>;
|
|
20
|
+
source: z.ZodObject<{
|
|
21
|
+
repositoryId: z.ZodString;
|
|
22
|
+
commit: z.ZodString;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
display: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
summary: z.ZodString;
|
|
27
|
+
license: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
requires: z.ZodObject<{
|
|
30
|
+
runtimeProfile: z.ZodLiteral<"rentnerproxy-linux-v1">;
|
|
31
|
+
platformApi: z.ZodString;
|
|
32
|
+
appProtocol: z.ZodString;
|
|
33
|
+
uiBridge: z.ZodOptional<z.ZodString>;
|
|
34
|
+
engineCapabilities: z.ZodArray<z.ZodEnum<{
|
|
35
|
+
"caddy.crowdsec.v1": "caddy.crowdsec.v1";
|
|
36
|
+
"caddy.load-balancing.v1": "caddy.load-balancing.v1";
|
|
37
|
+
}>>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
entrypoint: z.ZodLiteral<"bin/app">;
|
|
40
|
+
api: z.ZodLiteral<"api/openapi.json">;
|
|
41
|
+
configSchema: z.ZodOptional<z.ZodString>;
|
|
42
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
entrypoint: z.ZodString;
|
|
44
|
+
slots: z.ZodArray<z.ZodEnum<{
|
|
45
|
+
dashboardWidget: "dashboardWidget";
|
|
46
|
+
navigation: "navigation";
|
|
47
|
+
proxyHostTab: "proxyHostTab";
|
|
48
|
+
search: "search";
|
|
49
|
+
}>>;
|
|
50
|
+
}, z.core.$strict>>;
|
|
51
|
+
providers: z.ZodArray<z.ZodEnum<{
|
|
52
|
+
crowdsec: "crowdsec";
|
|
53
|
+
dns: "dns";
|
|
54
|
+
"docker-discovery": "docker-discovery";
|
|
55
|
+
"load-balancer": "load-balancer";
|
|
56
|
+
monitoring: "monitoring";
|
|
57
|
+
oidc: "oidc";
|
|
58
|
+
}>>;
|
|
59
|
+
capabilities: z.ZodArray<z.ZodUnion<z.ZodObject<{
|
|
60
|
+
id: z.ZodLiteral<"access.logs.read.v1" | "diagnostics.upstream.probe.v1" | "diagnostics.upstream.probe.v2" | "dns.challenge.manage.v1" | "docker.inventory.observe.v1" | "engine.contributions.submit.v1" | "identity.provider.register.v1" | "notifications.incidents.manage.v1" | "notifications.publish.v1" | "proxy.hosts.manage-owned.v1" | "proxy.hosts.read.v1" | "security.enforcement.contribute.v1">;
|
|
61
|
+
scope: z.ZodLiteral<"dnsZones" | "dockerConnections" | "identityProviders" | "installation" | "ownedEngineResources" | "ownedProxyHosts" | "proxyHosts">;
|
|
62
|
+
}, z.core.$strict>[]>>;
|
|
63
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
64
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
targetVersion: z.ZodNumber;
|
|
66
|
+
readVersions: z.ZodArray<z.ZodNumber>;
|
|
67
|
+
writeVersions: z.ZodArray<z.ZodNumber>;
|
|
68
|
+
migrations: z.ZodArray<z.ZodObject<{
|
|
69
|
+
fromVersion: z.ZodNumber;
|
|
70
|
+
toVersion: z.ZodNumber;
|
|
71
|
+
path: z.ZodString;
|
|
72
|
+
}, z.core.$strict>>;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
incidentCategories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
resource: z.ZodEnum<{
|
|
78
|
+
none: "none";
|
|
79
|
+
proxyHost: "proxyHost";
|
|
80
|
+
}>;
|
|
81
|
+
}, z.core.$strict>>>;
|
|
82
|
+
resources: z.ZodObject<{
|
|
83
|
+
startupTimeoutMs: z.ZodNumber;
|
|
84
|
+
drainTimeoutMs: z.ZodNumber;
|
|
85
|
+
memoryMiB: z.ZodNumber;
|
|
86
|
+
processLimit: z.ZodNumber;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
archive: z.ZodObject<{
|
|
90
|
+
sha256: z.ZodString;
|
|
91
|
+
sizeBytes: z.ZodNumber;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
manifestSha256: z.ZodString;
|
|
94
|
+
sbom: z.ZodObject<{
|
|
95
|
+
sha256: z.ZodString;
|
|
96
|
+
sizeBytes: z.ZodNumber;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
provenance: z.ZodObject<{
|
|
99
|
+
sha256: z.ZodString;
|
|
100
|
+
sizeBytes: z.ZodNumber;
|
|
101
|
+
}, z.core.$strict>;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
export declare const catalogRelease: z.ZodObject<{
|
|
104
|
+
appId: z.ZodString;
|
|
105
|
+
version: z.ZodString;
|
|
106
|
+
source: z.ZodObject<{
|
|
107
|
+
repositoryId: z.ZodString;
|
|
108
|
+
commit: z.ZodString;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
publisher: z.ZodObject<{
|
|
111
|
+
namespace: z.ZodString;
|
|
112
|
+
name: z.ZodString;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
packages: z.ZodArray<z.ZodObject<{
|
|
115
|
+
manifest: z.ZodObject<{
|
|
116
|
+
formatVersion: z.ZodLiteral<1>;
|
|
117
|
+
id: z.ZodString;
|
|
118
|
+
version: z.ZodString;
|
|
119
|
+
target: z.ZodEnum<{
|
|
120
|
+
"linux-amd64": "linux-amd64";
|
|
121
|
+
"linux-arm64": "linux-arm64";
|
|
122
|
+
}>;
|
|
123
|
+
source: z.ZodObject<{
|
|
124
|
+
repositoryId: z.ZodString;
|
|
125
|
+
commit: z.ZodString;
|
|
126
|
+
}, z.core.$strict>;
|
|
127
|
+
display: z.ZodObject<{
|
|
128
|
+
name: z.ZodString;
|
|
129
|
+
summary: z.ZodString;
|
|
130
|
+
license: z.ZodString;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
requires: z.ZodObject<{
|
|
133
|
+
runtimeProfile: z.ZodLiteral<"rentnerproxy-linux-v1">;
|
|
134
|
+
platformApi: z.ZodString;
|
|
135
|
+
appProtocol: z.ZodString;
|
|
136
|
+
uiBridge: z.ZodOptional<z.ZodString>;
|
|
137
|
+
engineCapabilities: z.ZodArray<z.ZodEnum<{
|
|
138
|
+
"caddy.crowdsec.v1": "caddy.crowdsec.v1";
|
|
139
|
+
"caddy.load-balancing.v1": "caddy.load-balancing.v1";
|
|
140
|
+
}>>;
|
|
141
|
+
}, z.core.$strict>;
|
|
142
|
+
entrypoint: z.ZodLiteral<"bin/app">;
|
|
143
|
+
api: z.ZodLiteral<"api/openapi.json">;
|
|
144
|
+
configSchema: z.ZodOptional<z.ZodString>;
|
|
145
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
entrypoint: z.ZodString;
|
|
147
|
+
slots: z.ZodArray<z.ZodEnum<{
|
|
148
|
+
dashboardWidget: "dashboardWidget";
|
|
149
|
+
navigation: "navigation";
|
|
150
|
+
proxyHostTab: "proxyHostTab";
|
|
151
|
+
search: "search";
|
|
152
|
+
}>>;
|
|
153
|
+
}, z.core.$strict>>;
|
|
154
|
+
providers: z.ZodArray<z.ZodEnum<{
|
|
155
|
+
crowdsec: "crowdsec";
|
|
156
|
+
dns: "dns";
|
|
157
|
+
"docker-discovery": "docker-discovery";
|
|
158
|
+
"load-balancer": "load-balancer";
|
|
159
|
+
monitoring: "monitoring";
|
|
160
|
+
oidc: "oidc";
|
|
161
|
+
}>>;
|
|
162
|
+
capabilities: z.ZodArray<z.ZodUnion<z.ZodObject<{
|
|
163
|
+
id: z.ZodLiteral<"access.logs.read.v1" | "diagnostics.upstream.probe.v1" | "diagnostics.upstream.probe.v2" | "dns.challenge.manage.v1" | "docker.inventory.observe.v1" | "engine.contributions.submit.v1" | "identity.provider.register.v1" | "notifications.incidents.manage.v1" | "notifications.publish.v1" | "proxy.hosts.manage-owned.v1" | "proxy.hosts.read.v1" | "security.enforcement.contribute.v1">;
|
|
164
|
+
scope: z.ZodLiteral<"dnsZones" | "dockerConnections" | "identityProviders" | "installation" | "ownedEngineResources" | "ownedProxyHosts" | "proxyHosts">;
|
|
165
|
+
}, z.core.$strict>[]>>;
|
|
166
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
167
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
targetVersion: z.ZodNumber;
|
|
169
|
+
readVersions: z.ZodArray<z.ZodNumber>;
|
|
170
|
+
writeVersions: z.ZodArray<z.ZodNumber>;
|
|
171
|
+
migrations: z.ZodArray<z.ZodObject<{
|
|
172
|
+
fromVersion: z.ZodNumber;
|
|
173
|
+
toVersion: z.ZodNumber;
|
|
174
|
+
path: z.ZodString;
|
|
175
|
+
}, z.core.$strict>>;
|
|
176
|
+
}, z.core.$strict>>;
|
|
177
|
+
incidentCategories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
resource: z.ZodEnum<{
|
|
181
|
+
none: "none";
|
|
182
|
+
proxyHost: "proxyHost";
|
|
183
|
+
}>;
|
|
184
|
+
}, z.core.$strict>>>;
|
|
185
|
+
resources: z.ZodObject<{
|
|
186
|
+
startupTimeoutMs: z.ZodNumber;
|
|
187
|
+
drainTimeoutMs: z.ZodNumber;
|
|
188
|
+
memoryMiB: z.ZodNumber;
|
|
189
|
+
processLimit: z.ZodNumber;
|
|
190
|
+
}, z.core.$strict>;
|
|
191
|
+
}, z.core.$strict>;
|
|
192
|
+
archive: z.ZodObject<{
|
|
193
|
+
sha256: z.ZodString;
|
|
194
|
+
sizeBytes: z.ZodNumber;
|
|
195
|
+
}, z.core.$strict>;
|
|
196
|
+
manifestSha256: z.ZodString;
|
|
197
|
+
sbom: z.ZodObject<{
|
|
198
|
+
sha256: z.ZodString;
|
|
199
|
+
sizeBytes: z.ZodNumber;
|
|
200
|
+
}, z.core.$strict>;
|
|
201
|
+
provenance: z.ZodObject<{
|
|
202
|
+
sha256: z.ZodString;
|
|
203
|
+
sizeBytes: z.ZodNumber;
|
|
204
|
+
}, z.core.$strict>;
|
|
205
|
+
}, z.core.$strict>>;
|
|
206
|
+
icon: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
format: z.ZodEnum<{
|
|
208
|
+
png: "png";
|
|
209
|
+
webp: "webp";
|
|
210
|
+
}>;
|
|
211
|
+
sha256: z.ZodString;
|
|
212
|
+
sizeBytes: z.ZodNumber;
|
|
213
|
+
}, z.core.$strict>>;
|
|
214
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strict>;
|
|
216
|
+
export declare const revocation: z.ZodObject<{
|
|
217
|
+
appId: z.ZodString;
|
|
218
|
+
version: z.ZodString;
|
|
219
|
+
revokedAt: z.ZodISODateTime;
|
|
220
|
+
reason: z.ZodEnum<{
|
|
221
|
+
invalidPublication: "invalidPublication";
|
|
222
|
+
security: "security";
|
|
223
|
+
withdrawn: "withdrawn";
|
|
224
|
+
}>;
|
|
225
|
+
}, z.core.$strict>;
|
|
226
|
+
export declare const catalog: z.ZodObject<{
|
|
227
|
+
formatVersion: z.ZodLiteral<1>;
|
|
228
|
+
revision: z.ZodNumber;
|
|
229
|
+
releases: z.ZodArray<z.ZodObject<{
|
|
230
|
+
appId: z.ZodString;
|
|
231
|
+
version: z.ZodString;
|
|
232
|
+
source: z.ZodObject<{
|
|
233
|
+
repositoryId: z.ZodString;
|
|
234
|
+
commit: z.ZodString;
|
|
235
|
+
}, z.core.$strict>;
|
|
236
|
+
publisher: z.ZodObject<{
|
|
237
|
+
namespace: z.ZodString;
|
|
238
|
+
name: z.ZodString;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
packages: z.ZodArray<z.ZodObject<{
|
|
241
|
+
manifest: z.ZodObject<{
|
|
242
|
+
formatVersion: z.ZodLiteral<1>;
|
|
243
|
+
id: z.ZodString;
|
|
244
|
+
version: z.ZodString;
|
|
245
|
+
target: z.ZodEnum<{
|
|
246
|
+
"linux-amd64": "linux-amd64";
|
|
247
|
+
"linux-arm64": "linux-arm64";
|
|
248
|
+
}>;
|
|
249
|
+
source: z.ZodObject<{
|
|
250
|
+
repositoryId: z.ZodString;
|
|
251
|
+
commit: z.ZodString;
|
|
252
|
+
}, z.core.$strict>;
|
|
253
|
+
display: z.ZodObject<{
|
|
254
|
+
name: z.ZodString;
|
|
255
|
+
summary: z.ZodString;
|
|
256
|
+
license: z.ZodString;
|
|
257
|
+
}, z.core.$strict>;
|
|
258
|
+
requires: z.ZodObject<{
|
|
259
|
+
runtimeProfile: z.ZodLiteral<"rentnerproxy-linux-v1">;
|
|
260
|
+
platformApi: z.ZodString;
|
|
261
|
+
appProtocol: z.ZodString;
|
|
262
|
+
uiBridge: z.ZodOptional<z.ZodString>;
|
|
263
|
+
engineCapabilities: z.ZodArray<z.ZodEnum<{
|
|
264
|
+
"caddy.crowdsec.v1": "caddy.crowdsec.v1";
|
|
265
|
+
"caddy.load-balancing.v1": "caddy.load-balancing.v1";
|
|
266
|
+
}>>;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
entrypoint: z.ZodLiteral<"bin/app">;
|
|
269
|
+
api: z.ZodLiteral<"api/openapi.json">;
|
|
270
|
+
configSchema: z.ZodOptional<z.ZodString>;
|
|
271
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
272
|
+
entrypoint: z.ZodString;
|
|
273
|
+
slots: z.ZodArray<z.ZodEnum<{
|
|
274
|
+
dashboardWidget: "dashboardWidget";
|
|
275
|
+
navigation: "navigation";
|
|
276
|
+
proxyHostTab: "proxyHostTab";
|
|
277
|
+
search: "search";
|
|
278
|
+
}>>;
|
|
279
|
+
}, z.core.$strict>>;
|
|
280
|
+
providers: z.ZodArray<z.ZodEnum<{
|
|
281
|
+
crowdsec: "crowdsec";
|
|
282
|
+
dns: "dns";
|
|
283
|
+
"docker-discovery": "docker-discovery";
|
|
284
|
+
"load-balancer": "load-balancer";
|
|
285
|
+
monitoring: "monitoring";
|
|
286
|
+
oidc: "oidc";
|
|
287
|
+
}>>;
|
|
288
|
+
capabilities: z.ZodArray<z.ZodUnion<z.ZodObject<{
|
|
289
|
+
id: z.ZodLiteral<"access.logs.read.v1" | "diagnostics.upstream.probe.v1" | "diagnostics.upstream.probe.v2" | "dns.challenge.manage.v1" | "docker.inventory.observe.v1" | "engine.contributions.submit.v1" | "identity.provider.register.v1" | "notifications.incidents.manage.v1" | "notifications.publish.v1" | "proxy.hosts.manage-owned.v1" | "proxy.hosts.read.v1" | "security.enforcement.contribute.v1">;
|
|
290
|
+
scope: z.ZodLiteral<"dnsZones" | "dockerConnections" | "identityProviders" | "installation" | "ownedEngineResources" | "ownedProxyHosts" | "proxyHosts">;
|
|
291
|
+
}, z.core.$strict>[]>>;
|
|
292
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
293
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
294
|
+
targetVersion: z.ZodNumber;
|
|
295
|
+
readVersions: z.ZodArray<z.ZodNumber>;
|
|
296
|
+
writeVersions: z.ZodArray<z.ZodNumber>;
|
|
297
|
+
migrations: z.ZodArray<z.ZodObject<{
|
|
298
|
+
fromVersion: z.ZodNumber;
|
|
299
|
+
toVersion: z.ZodNumber;
|
|
300
|
+
path: z.ZodString;
|
|
301
|
+
}, z.core.$strict>>;
|
|
302
|
+
}, z.core.$strict>>;
|
|
303
|
+
incidentCategories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
304
|
+
id: z.ZodString;
|
|
305
|
+
name: z.ZodString;
|
|
306
|
+
resource: z.ZodEnum<{
|
|
307
|
+
none: "none";
|
|
308
|
+
proxyHost: "proxyHost";
|
|
309
|
+
}>;
|
|
310
|
+
}, z.core.$strict>>>;
|
|
311
|
+
resources: z.ZodObject<{
|
|
312
|
+
startupTimeoutMs: z.ZodNumber;
|
|
313
|
+
drainTimeoutMs: z.ZodNumber;
|
|
314
|
+
memoryMiB: z.ZodNumber;
|
|
315
|
+
processLimit: z.ZodNumber;
|
|
316
|
+
}, z.core.$strict>;
|
|
317
|
+
}, z.core.$strict>;
|
|
318
|
+
archive: z.ZodObject<{
|
|
319
|
+
sha256: z.ZodString;
|
|
320
|
+
sizeBytes: z.ZodNumber;
|
|
321
|
+
}, z.core.$strict>;
|
|
322
|
+
manifestSha256: z.ZodString;
|
|
323
|
+
sbom: z.ZodObject<{
|
|
324
|
+
sha256: z.ZodString;
|
|
325
|
+
sizeBytes: z.ZodNumber;
|
|
326
|
+
}, z.core.$strict>;
|
|
327
|
+
provenance: z.ZodObject<{
|
|
328
|
+
sha256: z.ZodString;
|
|
329
|
+
sizeBytes: z.ZodNumber;
|
|
330
|
+
}, z.core.$strict>;
|
|
331
|
+
}, z.core.$strict>>;
|
|
332
|
+
icon: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
format: z.ZodEnum<{
|
|
334
|
+
png: "png";
|
|
335
|
+
webp: "webp";
|
|
336
|
+
}>;
|
|
337
|
+
sha256: z.ZodString;
|
|
338
|
+
sizeBytes: z.ZodNumber;
|
|
339
|
+
}, z.core.$strict>>;
|
|
340
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
341
|
+
}, z.core.$strict>>;
|
|
342
|
+
revocations: z.ZodArray<z.ZodObject<{
|
|
343
|
+
appId: z.ZodString;
|
|
344
|
+
version: z.ZodString;
|
|
345
|
+
revokedAt: z.ZodISODateTime;
|
|
346
|
+
reason: z.ZodEnum<{
|
|
347
|
+
invalidPublication: "invalidPublication";
|
|
348
|
+
security: "security";
|
|
349
|
+
withdrawn: "withdrawn";
|
|
350
|
+
}>;
|
|
351
|
+
}, z.core.$strict>>;
|
|
352
|
+
}, z.core.$strict>;
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { appManifest } from './manifest.js';
|
|
3
|
+
import { appId, appVersion, archive, displayName, formatVersion, namespace, positiveInteger, releaseNotes, sha256, sourceIdentity, timestamp, } from './primitives.js';
|
|
4
|
+
export const releaseDistribution = 'https://github.com/RentnerProxy/app-catalog/releases/download/';
|
|
5
|
+
export const catalogIcon = z
|
|
6
|
+
.strictObject({
|
|
7
|
+
format: z.enum(['png', 'webp']),
|
|
8
|
+
sha256,
|
|
9
|
+
sizeBytes: z.number().int().min(1).max(2_097_152),
|
|
10
|
+
})
|
|
11
|
+
.describe('Verified catalog target at assets/<sha256>.<format>, relative to the catalog repository.');
|
|
12
|
+
const releaseEvidence = z.strictObject({
|
|
13
|
+
sha256,
|
|
14
|
+
sizeBytes: z.number().int().min(1).max(16_777_216),
|
|
15
|
+
});
|
|
16
|
+
export const packageArtifact = z.strictObject({
|
|
17
|
+
manifest: appManifest,
|
|
18
|
+
archive,
|
|
19
|
+
manifestSha256: sha256.describe('SHA-256 of the exact app.json bytes inside the archive.'),
|
|
20
|
+
sbom: releaseEvidence.describe('Release asset <archive filename>.sbom.json.'),
|
|
21
|
+
provenance: releaseEvidence.describe('Release asset <archive filename>.provenance.json.'),
|
|
22
|
+
});
|
|
23
|
+
export const catalogRelease = z
|
|
24
|
+
.strictObject({
|
|
25
|
+
appId,
|
|
26
|
+
version: appVersion,
|
|
27
|
+
source: sourceIdentity,
|
|
28
|
+
publisher: z
|
|
29
|
+
.strictObject({
|
|
30
|
+
namespace,
|
|
31
|
+
name: displayName,
|
|
32
|
+
})
|
|
33
|
+
.describe('Signed public display identity. The namespace must match the app ID. Only the trusted RentnerProxy publisher owns rentnerproxy.'),
|
|
34
|
+
packages: z.array(packageArtifact).min(1).max(2),
|
|
35
|
+
icon: catalogIcon.optional(),
|
|
36
|
+
notes: releaseNotes.optional(),
|
|
37
|
+
})
|
|
38
|
+
.describe('Public install/display data for one version. Each target has its own manifest and archive identity. The release tag is <appId>-v<version> and the asset is <appId>-<version>-<target>.tar.zst in RentnerProxy/app-catalog.');
|
|
39
|
+
export const revocation = z
|
|
40
|
+
.strictObject({
|
|
41
|
+
appId,
|
|
42
|
+
version: appVersion,
|
|
43
|
+
revokedAt: timestamp,
|
|
44
|
+
reason: z.enum(['withdrawn', 'security', 'invalidPublication']),
|
|
45
|
+
})
|
|
46
|
+
.describe('Revocation applies to all targets of the specified app version.');
|
|
47
|
+
export const catalog = z
|
|
48
|
+
.strictObject({
|
|
49
|
+
formatVersion,
|
|
50
|
+
revision: positiveInteger,
|
|
51
|
+
releases: z.array(catalogRelease).max(4096),
|
|
52
|
+
revocations: z.array(revocation).max(4096),
|
|
53
|
+
})
|
|
54
|
+
.describe('Catalog target payload for TUF. Verify its bytes and metadata before use. Releases and revocations are unique by app ID and version and disjoint. Website account, rating, and statistics data are outside this contract.');
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { httpOperations, type HttpMethod, type HttpOperationName, type HttpSocket } from './http-operations.ts';
|
|
2
|
+
import type { ProtocolDocument, ProtocolDocumentName } from './Types/contract.types.ts';
|
|
3
|
+
type OperationDocument<Operation, Field extends string> = Operation extends Record<Field, infer Name extends ProtocolDocumentName> ? ProtocolDocument<Name> : undefined;
|
|
4
|
+
type HttpDocument<Name extends HttpOperationName, Field extends string> = OperationDocument<(typeof httpOperations)[Name], Field>;
|
|
5
|
+
export interface HttpRequestOptions {
|
|
6
|
+
pathParameter?: string;
|
|
7
|
+
idempotencyKey?: string;
|
|
8
|
+
resumeCursor?: string;
|
|
9
|
+
body?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface HttpRequest<Name extends HttpOperationName> {
|
|
12
|
+
method: HttpMethod;
|
|
13
|
+
socket: HttpSocket;
|
|
14
|
+
path: string;
|
|
15
|
+
headers: Record<string, string>;
|
|
16
|
+
body: HttpDocument<Name, 'request'>;
|
|
17
|
+
}
|
|
18
|
+
/** Prepare the validated path, controls and payload. The transport provides authorization and byte limits. */
|
|
19
|
+
export declare function prepareHttpRequest<Name extends HttpOperationName>(name: Name, options?: HttpRequestOptions): HttpRequest<Name>;
|
|
20
|
+
export type HttpResponse<Name extends HttpOperationName> = {
|
|
21
|
+
ok: true;
|
|
22
|
+
data: HttpDocument<Name, 'response'>;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
problem: ProtocolDocument<'Problem'>;
|
|
26
|
+
};
|
|
27
|
+
/** Validate decoded response JSON. For empty success or a stream opening omit the body. */
|
|
28
|
+
export declare function parseHttpResponse<Name extends HttpOperationName>(name: Name, status: number, body?: unknown): HttpResponse<Name>;
|
|
29
|
+
/** Validate one decoded event after the transport admits a bounded SSE frame. */
|
|
30
|
+
export declare function parseHttpEvent<Name extends HttpOperationName>(name: Name, body: unknown): HttpDocument<Name, 'event'>;
|
|
31
|
+
export {};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { httpOperation, httpOperations, pathParameterSchemas, } from './http-operations.js';
|
|
2
|
+
import { ContractError, parseProtocolDocument } from './validation.js';
|
|
3
|
+
function requireHttpOperation(name) {
|
|
4
|
+
if (!Object.hasOwn(httpOperations, name)) {
|
|
5
|
+
throw new ContractError('invalidShape', 'Unknown v1 HTTP operation.');
|
|
6
|
+
}
|
|
7
|
+
return httpOperation(name);
|
|
8
|
+
}
|
|
9
|
+
export function prepareHttpRequest(name, options = {}) {
|
|
10
|
+
const operation = requireHttpOperation(name);
|
|
11
|
+
if (Boolean(operation.pathParameter) !==
|
|
12
|
+
(options.pathParameter !== undefined) ||
|
|
13
|
+
Boolean(operation.idempotencyKey) !==
|
|
14
|
+
(options.idempotencyKey !== undefined) ||
|
|
15
|
+
(!operation.resumeCursor && options.resumeCursor !== undefined) ||
|
|
16
|
+
Boolean(operation.request) !== (options.body !== undefined)) {
|
|
17
|
+
throw new ContractError('invalidShape', 'Invalid controls or payload for the HTTP operation.');
|
|
18
|
+
}
|
|
19
|
+
const path = operation.pathParameter
|
|
20
|
+
? operation.path.replace('{' + operation.pathParameter + '}', parseProtocolDocument(pathParameterSchemas[operation.pathParameter], options.pathParameter))
|
|
21
|
+
: operation.path;
|
|
22
|
+
const headers = {};
|
|
23
|
+
if (options.idempotencyKey !== undefined) {
|
|
24
|
+
headers['Idempotency-Key'] = parseProtocolDocument('RecordId', options.idempotencyKey);
|
|
25
|
+
}
|
|
26
|
+
if (options.resumeCursor !== undefined) {
|
|
27
|
+
headers['Last-Event-ID'] = parseProtocolDocument('EventCursor', options.resumeCursor);
|
|
28
|
+
}
|
|
29
|
+
const body = operation.request
|
|
30
|
+
? parseProtocolDocument(operation.request, options.body)
|
|
31
|
+
: undefined;
|
|
32
|
+
return {
|
|
33
|
+
method: operation.method,
|
|
34
|
+
socket: operation.socket,
|
|
35
|
+
path,
|
|
36
|
+
headers,
|
|
37
|
+
body,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function parseHttpResponse(name, status, body) {
|
|
41
|
+
const operation = requireHttpOperation(name);
|
|
42
|
+
if (status === operation.status) {
|
|
43
|
+
if (!operation.response && body !== undefined) {
|
|
44
|
+
throw new ContractError('invalidShape', 'The HTTP success response has no JSON body.');
|
|
45
|
+
}
|
|
46
|
+
const data = operation.response
|
|
47
|
+
? parseProtocolDocument(operation.response, body)
|
|
48
|
+
: undefined;
|
|
49
|
+
return { ok: true, data };
|
|
50
|
+
}
|
|
51
|
+
if (!Number.isInteger(status) || status < 400 || status > 599) {
|
|
52
|
+
throw new ContractError('invalidShape', 'Unexpected HTTP status for the operation.');
|
|
53
|
+
}
|
|
54
|
+
const problem = parseProtocolDocument('Problem', body);
|
|
55
|
+
if (problem.status !== status) {
|
|
56
|
+
throw new ContractError('invalidShape', 'The HTTP status does not match the problem.');
|
|
57
|
+
}
|
|
58
|
+
return { ok: false, problem };
|
|
59
|
+
}
|
|
60
|
+
export function parseHttpEvent(name, body) {
|
|
61
|
+
const operation = requireHttpOperation(name);
|
|
62
|
+
if (!operation.event) {
|
|
63
|
+
throw new ContractError('invalidShape', 'The HTTP operation has no event stream.');
|
|
64
|
+
}
|
|
65
|
+
return parseProtocolDocument(operation.event, body);
|
|
66
|
+
}
|