@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,300 @@
|
|
|
1
|
+
// Generated by bun run contracts:generate.
|
|
2
|
+
export const generatedRpcLimits = {
|
|
3
|
+
"maxJsonBytes": 1048576,
|
|
4
|
+
"maxJsonDepth": 64,
|
|
5
|
+
"maxListEntries": 100,
|
|
6
|
+
"defaultDeadlineMs": 10000,
|
|
7
|
+
"maxDeadlineMs": 30000
|
|
8
|
+
};
|
|
9
|
+
export const generatedHttpOperations = {
|
|
10
|
+
getAppHealth: {
|
|
11
|
+
"failures": {
|
|
12
|
+
"503": "The app is unhealthy."
|
|
13
|
+
},
|
|
14
|
+
"method": "GET",
|
|
15
|
+
"path": "/app/v1/health",
|
|
16
|
+
"response": "AppHealth",
|
|
17
|
+
"socket": "app.sock",
|
|
18
|
+
"status": 200,
|
|
19
|
+
"summary": "Check app process health"
|
|
20
|
+
},
|
|
21
|
+
getAppReadiness: {
|
|
22
|
+
"failures": {
|
|
23
|
+
"503": "The app or its required context is unavailable."
|
|
24
|
+
},
|
|
25
|
+
"method": "GET",
|
|
26
|
+
"path": "/app/v1/ready",
|
|
27
|
+
"response": "AppReadiness",
|
|
28
|
+
"socket": "app.sock",
|
|
29
|
+
"status": 200,
|
|
30
|
+
"summary": "Check readiness for the negotiated generation"
|
|
31
|
+
},
|
|
32
|
+
activateApp: {
|
|
33
|
+
"idempotencyKey": true,
|
|
34
|
+
"method": "POST",
|
|
35
|
+
"path": "/app/v1/lifecycle/activate",
|
|
36
|
+
"socket": "app.sock",
|
|
37
|
+
"status": 204,
|
|
38
|
+
"summary": "Activate the prepared app generation"
|
|
39
|
+
},
|
|
40
|
+
drainApp: {
|
|
41
|
+
"idempotencyKey": true,
|
|
42
|
+
"method": "POST",
|
|
43
|
+
"path": "/app/v1/lifecycle/drain",
|
|
44
|
+
"socket": "app.sock",
|
|
45
|
+
"status": 204,
|
|
46
|
+
"summary": "Drain the active app generation"
|
|
47
|
+
},
|
|
48
|
+
deactivateApp: {
|
|
49
|
+
"idempotencyKey": true,
|
|
50
|
+
"method": "POST",
|
|
51
|
+
"path": "/app/v1/lifecycle/deactivate",
|
|
52
|
+
"socket": "app.sock",
|
|
53
|
+
"status": 204,
|
|
54
|
+
"summary": "Deactivate the drained app generation"
|
|
55
|
+
},
|
|
56
|
+
callAppApi: {
|
|
57
|
+
"description": "The authenticated gateway verifies current user and resource access, then validates the request and result against the installed package API for this operation ID.",
|
|
58
|
+
"idempotencyKey": true,
|
|
59
|
+
"method": "POST",
|
|
60
|
+
"path": "/app/v1/api/{operationId}",
|
|
61
|
+
"pathParameter": "operationId",
|
|
62
|
+
"request": "AppApiPayload",
|
|
63
|
+
"response": "AppApiPayload",
|
|
64
|
+
"socket": "app.sock",
|
|
65
|
+
"status": 200,
|
|
66
|
+
"summary": "Invoke an app-owned operation declared by the package"
|
|
67
|
+
},
|
|
68
|
+
invokeAppProvider: {
|
|
69
|
+
"description": "The broker derives the provider from the active registration. Its profile, operation discriminants and resource identities must match the invocation and result. Accepted long-running provider work may carry a durable Operation.",
|
|
70
|
+
"idempotencyKey": true,
|
|
71
|
+
"method": "POST",
|
|
72
|
+
"path": "/app/v1/providers/{providerId}",
|
|
73
|
+
"pathParameter": "providerId",
|
|
74
|
+
"request": "ProviderRequest",
|
|
75
|
+
"response": "ProviderResult",
|
|
76
|
+
"socket": "app.sock",
|
|
77
|
+
"status": 200,
|
|
78
|
+
"summary": "Invoke a negotiated provider operation"
|
|
79
|
+
},
|
|
80
|
+
getPlatformContext: {
|
|
81
|
+
"description": "An authenticated candidate generation may read its own context while preparing for readiness. Other operations require an active generation and current authorization.",
|
|
82
|
+
"method": "GET",
|
|
83
|
+
"path": "/platform/v1/context",
|
|
84
|
+
"response": "PlatformContext",
|
|
85
|
+
"socket": "core.sock",
|
|
86
|
+
"status": 200,
|
|
87
|
+
"summary": "Read the verified installation context"
|
|
88
|
+
},
|
|
89
|
+
checkAuthorization: {
|
|
90
|
+
"method": "POST",
|
|
91
|
+
"path": "/platform/v1/authorization",
|
|
92
|
+
"request": "AuthorizationRequest",
|
|
93
|
+
"response": "AuthorizationResult",
|
|
94
|
+
"socket": "core.sock",
|
|
95
|
+
"status": 200,
|
|
96
|
+
"summary": "Check current resource authorization"
|
|
97
|
+
},
|
|
98
|
+
listProxyHosts: {
|
|
99
|
+
"method": "POST",
|
|
100
|
+
"path": "/platform/v1/proxy-hosts/query",
|
|
101
|
+
"request": "ProxyHostQuery",
|
|
102
|
+
"response": "ProxyHostPage",
|
|
103
|
+
"socket": "core.sock",
|
|
104
|
+
"status": 200,
|
|
105
|
+
"summary": "List proxy hosts within current grants"
|
|
106
|
+
},
|
|
107
|
+
updateOwnedProxyHost: {
|
|
108
|
+
"description": "The platform controls ownership and configuration. Recheck current ownership, grants and revision before applying; conflicts preserve the currently applied proxy configuration.",
|
|
109
|
+
"idempotencyKey": true,
|
|
110
|
+
"method": "POST",
|
|
111
|
+
"path": "/platform/v1/proxy-hosts/owned",
|
|
112
|
+
"request": "OwnedProxyHostChange",
|
|
113
|
+
"response": "Operation",
|
|
114
|
+
"socket": "core.sock",
|
|
115
|
+
"status": 202,
|
|
116
|
+
"summary": "Apply a revision-checked change to an app-owned host"
|
|
117
|
+
},
|
|
118
|
+
probeUpstream: {
|
|
119
|
+
"method": "POST",
|
|
120
|
+
"path": "/platform/v1/diagnostics/upstream",
|
|
121
|
+
"request": "UpstreamProbe",
|
|
122
|
+
"response": "UpstreamProbeResult",
|
|
123
|
+
"socket": "core.sock",
|
|
124
|
+
"status": 200,
|
|
125
|
+
"summary": "Run a bounded probe of an authorized proxy host upstream"
|
|
126
|
+
},
|
|
127
|
+
probeUpstreams: {
|
|
128
|
+
"description": "Requires diagnostics.upstream.probe.v2. Each probe returns the stage result that built-in host monitoring classifies, so an app can classify it the same way. A probe the platform cannot run returns an explicit outcome instead of failing the batch.",
|
|
129
|
+
"method": "POST",
|
|
130
|
+
"path": "/platform/v1/diagnostics/upstream/batch",
|
|
131
|
+
"request": "UpstreamProbeBatch",
|
|
132
|
+
"response": "UpstreamProbeBatchResult",
|
|
133
|
+
"socket": "core.sock",
|
|
134
|
+
"status": 200,
|
|
135
|
+
"summary": "Probe authorized proxy host upstreams with monitoring-class admission"
|
|
136
|
+
},
|
|
137
|
+
publishNotification: {
|
|
138
|
+
"idempotencyKey": true,
|
|
139
|
+
"method": "POST",
|
|
140
|
+
"path": "/platform/v1/notifications",
|
|
141
|
+
"request": "AppNotification",
|
|
142
|
+
"socket": "core.sock",
|
|
143
|
+
"status": 204,
|
|
144
|
+
"summary": "Publish an app-owned notification"
|
|
145
|
+
},
|
|
146
|
+
setIncident: {
|
|
147
|
+
"description": "Requires notifications.incidents.manage.v1. The incident key is app-chosen and stays the same while the incident lasts. The platform deduplicates incidents per installation and key, and resolves the open incidents of an installation that stops, loses the grant or is removed.",
|
|
148
|
+
"failures": {
|
|
149
|
+
"404": "The resource is unavailable to this installation.",
|
|
150
|
+
"409": "The category is not declared, or the idempotency key was used for a different change."
|
|
151
|
+
},
|
|
152
|
+
"idempotencyKey": true,
|
|
153
|
+
"method": "POST",
|
|
154
|
+
"path": "/platform/v1/incidents/{incidentKey}",
|
|
155
|
+
"pathParameter": "incidentKey",
|
|
156
|
+
"request": "AppIncidentChange",
|
|
157
|
+
"socket": "core.sock",
|
|
158
|
+
"status": 204,
|
|
159
|
+
"summary": "Open, update or resolve an app incident in platform notifications"
|
|
160
|
+
},
|
|
161
|
+
recordAuditEvent: {
|
|
162
|
+
"description": "The platform supplies app, installation, actor and timestamp provenance from authenticated context.",
|
|
163
|
+
"idempotencyKey": true,
|
|
164
|
+
"method": "POST",
|
|
165
|
+
"path": "/platform/v1/audit-events",
|
|
166
|
+
"request": "AppAuditEvent",
|
|
167
|
+
"socket": "core.sock",
|
|
168
|
+
"status": 204,
|
|
169
|
+
"summary": "Record an app-owned audit event"
|
|
170
|
+
},
|
|
171
|
+
readSecret: {
|
|
172
|
+
"failures": {
|
|
173
|
+
"404": "The secret is unavailable to this installation."
|
|
174
|
+
},
|
|
175
|
+
"method": "GET",
|
|
176
|
+
"path": "/platform/v1/secrets/{secretId}",
|
|
177
|
+
"pathParameter": "secretId",
|
|
178
|
+
"response": "AppSecret",
|
|
179
|
+
"socket": "core.sock",
|
|
180
|
+
"status": 200,
|
|
181
|
+
"summary": "Read a secret assigned to this app installation"
|
|
182
|
+
},
|
|
183
|
+
getProvider: {
|
|
184
|
+
"failures": {
|
|
185
|
+
"404": "The provider is unavailable to this installation."
|
|
186
|
+
},
|
|
187
|
+
"method": "GET",
|
|
188
|
+
"path": "/platform/v1/providers/{providerId}",
|
|
189
|
+
"pathParameter": "providerId",
|
|
190
|
+
"response": "ProviderRegistration",
|
|
191
|
+
"socket": "core.sock",
|
|
192
|
+
"status": 200,
|
|
193
|
+
"summary": "Read an authorized provider registration"
|
|
194
|
+
},
|
|
195
|
+
getOperation: {
|
|
196
|
+
"failures": {
|
|
197
|
+
"404": "The operation is unavailable to this installation."
|
|
198
|
+
},
|
|
199
|
+
"method": "GET",
|
|
200
|
+
"path": "/platform/v1/operations/{operationId}",
|
|
201
|
+
"pathParameter": "operationId",
|
|
202
|
+
"response": "Operation",
|
|
203
|
+
"socket": "core.sock",
|
|
204
|
+
"status": 200,
|
|
205
|
+
"summary": "Read an authorized durable operation"
|
|
206
|
+
},
|
|
207
|
+
cancelOperation: {
|
|
208
|
+
"failures": {
|
|
209
|
+
"404": "The operation is unavailable to this installation."
|
|
210
|
+
},
|
|
211
|
+
"idempotencyKey": true,
|
|
212
|
+
"method": "POST",
|
|
213
|
+
"path": "/platform/v1/operations/{operationId}/cancel",
|
|
214
|
+
"pathParameter": "operationId",
|
|
215
|
+
"response": "Operation",
|
|
216
|
+
"socket": "core.sock",
|
|
217
|
+
"status": 202,
|
|
218
|
+
"summary": "Request cancellation of an authorized operation"
|
|
219
|
+
},
|
|
220
|
+
subscribeToEvents: {
|
|
221
|
+
"description": "The SSE id is the resume cursor. Events are at least once. Deduplicate by the data event ID. Recheck active generation, grants, resource visibility, and delegation at delivery. Close the stream when subscription authority expires or is revoked.",
|
|
222
|
+
"event": "PlatformEvent",
|
|
223
|
+
"failures": {
|
|
224
|
+
"410": "The cursor expired. Perform a full authorized resynchronization."
|
|
225
|
+
},
|
|
226
|
+
"method": "GET",
|
|
227
|
+
"path": "/platform/v1/events",
|
|
228
|
+
"resumeCursor": true,
|
|
229
|
+
"socket": "core.sock",
|
|
230
|
+
"status": 200,
|
|
231
|
+
"summary": "Resume the permission-filtered durable stream"
|
|
232
|
+
},
|
|
233
|
+
getLegacyHandoff: {
|
|
234
|
+
"description": "A legacy feature domain equals a provider profile. Every handoff operation acts only for the active generation of the calling installation. The state platform means the platform still owns the domain. The state exported means this installation is importing a fixed export. The state committed means this installation owns the domain.",
|
|
235
|
+
"failures": {
|
|
236
|
+
"401": "The credential is invalid, or the generation or its lease is no longer current.",
|
|
237
|
+
"403": "The manifest does not declare the domain as a provider profile, or the installation lacks the provider grant for it.",
|
|
238
|
+
"409": "Another installation holds the domain."
|
|
239
|
+
},
|
|
240
|
+
"method": "GET",
|
|
241
|
+
"path": "/platform/v1/legacy-handoffs/{domain}",
|
|
242
|
+
"pathParameter": "domain",
|
|
243
|
+
"response": "LegacyHandoffStatus",
|
|
244
|
+
"socket": "core.sock",
|
|
245
|
+
"status": 200,
|
|
246
|
+
"summary": "Read the handoff state of a built-in feature domain"
|
|
247
|
+
},
|
|
248
|
+
beginLegacyHandoff: {
|
|
249
|
+
"description": "Begin fences the platform writers of the domain and fixes one export of its configuration, credentials and history as ordered parts. While the export is open, repeating begin returns exported with the same digest and part count, so an interrupted import resumes. After commit, begin returns committed with the same digest and no part count.",
|
|
250
|
+
"failures": {
|
|
251
|
+
"401": "The credential is invalid, or the generation or its lease is no longer current.",
|
|
252
|
+
"403": "The manifest does not declare the domain as a provider profile, or the installation lacks the provider grant for it.",
|
|
253
|
+
"409": "Another installation holds the domain, or the idempotency key conflicts."
|
|
254
|
+
},
|
|
255
|
+
"idempotencyKey": true,
|
|
256
|
+
"method": "POST",
|
|
257
|
+
"path": "/platform/v1/legacy-handoffs/{domain}/begin",
|
|
258
|
+
"pathParameter": "domain",
|
|
259
|
+
"response": "LegacyHandoffBeginResult",
|
|
260
|
+
"socket": "core.sock",
|
|
261
|
+
"status": 200,
|
|
262
|
+
"summary": "Fence platform writers and fix a built-in feature export"
|
|
263
|
+
},
|
|
264
|
+
readLegacyHandoffPart: {
|
|
265
|
+
"description": "Read every sequence with 0 <= sequence < partCount and import each part durably before commit. An export with no parts needs no reads. The digest binds each read to the export that begin fixed, so a read never returns a part of a replaced export. A serialized part is at most 262144 bytes.",
|
|
266
|
+
"failures": {
|
|
267
|
+
"401": "The credential is invalid, or the generation or its lease is no longer current.",
|
|
268
|
+
"403": "The manifest does not declare the domain as a provider profile, or the installation lacks the provider grant for it.",
|
|
269
|
+
"404": "No export exists for this installation, or the sequence is not below the part count.",
|
|
270
|
+
"409": "Another installation holds the domain, or the digest differs from the current export.",
|
|
271
|
+
"503": "The stored part is unreadable. The platform must abort the handoff and export again."
|
|
272
|
+
},
|
|
273
|
+
"method": "POST",
|
|
274
|
+
"path": "/platform/v1/legacy-handoffs/{domain}/parts",
|
|
275
|
+
"pathParameter": "domain",
|
|
276
|
+
"request": "LegacyHandoffPartRequest",
|
|
277
|
+
"response": "LegacyHandoffPart",
|
|
278
|
+
"socket": "core.sock",
|
|
279
|
+
"status": 200,
|
|
280
|
+
"summary": "Read one part of the fixed built-in feature export"
|
|
281
|
+
},
|
|
282
|
+
commitLegacyHandoff: {
|
|
283
|
+
"description": "Commit exactly the digest that begin returned, after every part is imported durably. Commit retires the platform state once and transfers ownership to this installation. The result state is committed. Repeating commit with the same digest returns committed.",
|
|
284
|
+
"failures": {
|
|
285
|
+
"401": "The credential is invalid, or the generation or its lease is no longer current.",
|
|
286
|
+
"403": "The manifest does not declare the domain as a provider profile, or the installation lacks the provider grant for it.",
|
|
287
|
+
"404": "No export exists for this installation.",
|
|
288
|
+
"409": "Another installation holds the domain, the digest differs from the export, or the idempotency key conflicts."
|
|
289
|
+
},
|
|
290
|
+
"idempotencyKey": true,
|
|
291
|
+
"method": "POST",
|
|
292
|
+
"path": "/platform/v1/legacy-handoffs/{domain}/commit",
|
|
293
|
+
"pathParameter": "domain",
|
|
294
|
+
"request": "LegacyHandoffCommit",
|
|
295
|
+
"response": "LegacyHandoffCommitResult",
|
|
296
|
+
"socket": "core.sock",
|
|
297
|
+
"status": 200,
|
|
298
|
+
"summary": "Commit an imported built-in feature export"
|
|
299
|
+
},
|
|
300
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { generatedHttpOperations, generatedRpcLimits, } from './http-operations.generated.js';
|
|
2
|
+
export const rpcLimits = Object.freeze(generatedRpcLimits);
|
|
3
|
+
/** The protocol document that admits each path parameter value. */
|
|
4
|
+
export const pathParameterSchemas = Object.freeze({
|
|
5
|
+
operationId: 'RecordId',
|
|
6
|
+
providerId: 'RecordId',
|
|
7
|
+
secretId: 'RecordId',
|
|
8
|
+
incidentKey: 'RecordId',
|
|
9
|
+
domain: 'LegacyHandoffDomain',
|
|
10
|
+
});
|
|
11
|
+
const operations = generatedHttpOperations;
|
|
12
|
+
for (const operation of Object.values(operations))
|
|
13
|
+
Object.freeze(operation);
|
|
14
|
+
export const httpOperations = Object.freeze(operations);
|
|
15
|
+
export function httpOperation(name) {
|
|
16
|
+
return httpOperations[name];
|
|
17
|
+
}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type HttpOperationDefinition } from './http-operations.ts';
|
|
2
|
+
declare function describeOperation(name: string, operation: HttpOperationDefinition): {
|
|
3
|
+
operationId: string;
|
|
4
|
+
summary: string;
|
|
5
|
+
description: string | undefined;
|
|
6
|
+
'x-rentnerproxy-socket': import("./http-operations.ts").HttpSocket;
|
|
7
|
+
security: {
|
|
8
|
+
CoreCredential: never[];
|
|
9
|
+
}[] | {
|
|
10
|
+
AppCredential: never[];
|
|
11
|
+
}[];
|
|
12
|
+
parameters: {
|
|
13
|
+
$ref: string;
|
|
14
|
+
}[];
|
|
15
|
+
requestBody?: {
|
|
16
|
+
required: boolean;
|
|
17
|
+
content: {
|
|
18
|
+
'application/json': {
|
|
19
|
+
schema: {
|
|
20
|
+
$ref: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
} | undefined;
|
|
25
|
+
responses: Record<string, object>;
|
|
26
|
+
};
|
|
27
|
+
export declare const httpPaths: Record<string, Partial<Record<'get' | 'post', ReturnType<typeof describeOperation>>>>;
|
|
28
|
+
export declare const httpComponents: {
|
|
29
|
+
securitySchemes: {
|
|
30
|
+
AppCredential: {
|
|
31
|
+
type: string;
|
|
32
|
+
scheme: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
CoreCredential: {
|
|
36
|
+
type: string;
|
|
37
|
+
scheme: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
parameters: {
|
|
42
|
+
Installation: {
|
|
43
|
+
name: string;
|
|
44
|
+
in: string;
|
|
45
|
+
required: boolean;
|
|
46
|
+
schema: {
|
|
47
|
+
$ref: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
Generation: {
|
|
51
|
+
name: string;
|
|
52
|
+
in: string;
|
|
53
|
+
required: boolean;
|
|
54
|
+
description: string;
|
|
55
|
+
schema: {
|
|
56
|
+
$ref: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
Delegation: {
|
|
60
|
+
name: string;
|
|
61
|
+
in: string;
|
|
62
|
+
description: string;
|
|
63
|
+
schema: {
|
|
64
|
+
type: string;
|
|
65
|
+
pattern: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
IdempotencyKey: {
|
|
69
|
+
name: string;
|
|
70
|
+
in: string;
|
|
71
|
+
required: boolean;
|
|
72
|
+
description: string;
|
|
73
|
+
schema: {
|
|
74
|
+
$ref: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
operationId: {
|
|
78
|
+
name: "domain" | "incidentKey" | "operationId" | "providerId" | "secretId";
|
|
79
|
+
in: string;
|
|
80
|
+
required: boolean;
|
|
81
|
+
schema: {
|
|
82
|
+
$ref: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
providerId: {
|
|
86
|
+
name: "domain" | "incidentKey" | "operationId" | "providerId" | "secretId";
|
|
87
|
+
in: string;
|
|
88
|
+
required: boolean;
|
|
89
|
+
schema: {
|
|
90
|
+
$ref: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
secretId: {
|
|
94
|
+
name: "domain" | "incidentKey" | "operationId" | "providerId" | "secretId";
|
|
95
|
+
in: string;
|
|
96
|
+
required: boolean;
|
|
97
|
+
schema: {
|
|
98
|
+
$ref: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
incidentKey: {
|
|
102
|
+
name: "domain" | "incidentKey" | "operationId" | "providerId" | "secretId";
|
|
103
|
+
in: string;
|
|
104
|
+
required: boolean;
|
|
105
|
+
schema: {
|
|
106
|
+
$ref: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
domain: {
|
|
110
|
+
name: "domain" | "incidentKey" | "operationId" | "providerId" | "secretId";
|
|
111
|
+
in: string;
|
|
112
|
+
required: boolean;
|
|
113
|
+
schema: {
|
|
114
|
+
$ref: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
ResumeCursor: {
|
|
118
|
+
name: string;
|
|
119
|
+
in: string;
|
|
120
|
+
description: string;
|
|
121
|
+
schema: {
|
|
122
|
+
$ref: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export {};
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { httpOperations, pathParameterSchemas, } from './http-operations.js';
|
|
2
|
+
function schema(name) {
|
|
3
|
+
return { $ref: '#/components/schemas/' + name };
|
|
4
|
+
}
|
|
5
|
+
function parameter(name) {
|
|
6
|
+
return { $ref: '#/components/parameters/' + name };
|
|
7
|
+
}
|
|
8
|
+
function json(description, name, contentType = 'application/json') {
|
|
9
|
+
return { description, content: { [contentType]: { schema: schema(name) } } };
|
|
10
|
+
}
|
|
11
|
+
function problem(description) {
|
|
12
|
+
return json(description, 'Problem', 'application/problem+json');
|
|
13
|
+
}
|
|
14
|
+
function describeOperation(name, operation) {
|
|
15
|
+
const core = operation.socket === 'core.sock';
|
|
16
|
+
const parameters = [parameter('Installation'), parameter('Generation')];
|
|
17
|
+
if (core)
|
|
18
|
+
parameters.push(parameter('Delegation'));
|
|
19
|
+
if (operation.pathParameter)
|
|
20
|
+
parameters.push(parameter(operation.pathParameter));
|
|
21
|
+
if (operation.idempotencyKey)
|
|
22
|
+
parameters.push(parameter('IdempotencyKey'));
|
|
23
|
+
if (operation.resumeCursor)
|
|
24
|
+
parameters.push(parameter('ResumeCursor'));
|
|
25
|
+
const responses = {
|
|
26
|
+
401: problem('The request credential is absent or invalid.'),
|
|
27
|
+
403: problem('The installation, generation, actor, or resource is unauthorized.'),
|
|
28
|
+
'4XX': problem('The request was rejected with a stable problem code.'),
|
|
29
|
+
'5XX': problem('The operation failed with a stable problem code.'),
|
|
30
|
+
};
|
|
31
|
+
if (operation.idempotencyKey) {
|
|
32
|
+
responses[409] = problem('The resource, generation, or idempotency key conflicts.');
|
|
33
|
+
}
|
|
34
|
+
for (const [status, description] of Object.entries(operation.failures ?? {})) {
|
|
35
|
+
responses[status] = problem(description);
|
|
36
|
+
}
|
|
37
|
+
if (operation.event) {
|
|
38
|
+
responses[operation.status] = {
|
|
39
|
+
description: 'Server-Sent Events.',
|
|
40
|
+
content: {
|
|
41
|
+
'text/event-stream': {
|
|
42
|
+
schema: { type: 'string' },
|
|
43
|
+
'x-rentnerproxy-event-data-schema': schema(operation.event),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else if (operation.response) {
|
|
49
|
+
responses[operation.status] = json(operation.status === 202
|
|
50
|
+
? 'The operation was accepted.'
|
|
51
|
+
: 'The operation result.', operation.response);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
responses[operation.status] = {
|
|
55
|
+
description: 'The operation completed.',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
operationId: name,
|
|
60
|
+
summary: operation.summary,
|
|
61
|
+
description: operation.description,
|
|
62
|
+
'x-rentnerproxy-socket': operation.socket,
|
|
63
|
+
security: core ? [{ CoreCredential: [] }] : [{ AppCredential: [] }],
|
|
64
|
+
parameters,
|
|
65
|
+
...(operation.request && {
|
|
66
|
+
requestBody: {
|
|
67
|
+
required: true,
|
|
68
|
+
content: {
|
|
69
|
+
'application/json': { schema: schema(operation.request) },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
responses,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export const httpPaths = {};
|
|
77
|
+
for (const [name, operation] of Object.entries(httpOperations)) {
|
|
78
|
+
const { path, method } = operation;
|
|
79
|
+
const item = (httpPaths[path] ??= {});
|
|
80
|
+
item[method === 'GET' ? 'get' : 'post'] = describeOperation(name, operation);
|
|
81
|
+
}
|
|
82
|
+
function pathParameter(name) {
|
|
83
|
+
return {
|
|
84
|
+
name,
|
|
85
|
+
in: 'path',
|
|
86
|
+
required: true,
|
|
87
|
+
schema: schema(pathParameterSchemas[name]),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export const httpComponents = {
|
|
91
|
+
securitySchemes: {
|
|
92
|
+
AppCredential: {
|
|
93
|
+
type: 'http',
|
|
94
|
+
scheme: 'bearer',
|
|
95
|
+
description: 'The manager-issued app direction credential. The platform verifies the app peer UID before calling it. The app validates the credential and generation.',
|
|
96
|
+
},
|
|
97
|
+
CoreCredential: {
|
|
98
|
+
type: 'http',
|
|
99
|
+
scheme: 'bearer',
|
|
100
|
+
description: 'The manager-issued core direction credential. The platform validates the Linux peer UID and credential on each request and authorizes the installation generation for the requested operation.',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
parameters: {
|
|
104
|
+
Installation: {
|
|
105
|
+
name: 'X-App-Installation',
|
|
106
|
+
in: 'header',
|
|
107
|
+
required: true,
|
|
108
|
+
schema: schema('RecordId'),
|
|
109
|
+
},
|
|
110
|
+
Generation: {
|
|
111
|
+
name: 'X-App-Generation',
|
|
112
|
+
in: 'header',
|
|
113
|
+
required: true,
|
|
114
|
+
description: 'Positive installation generation in canonical decimal form.',
|
|
115
|
+
schema: schema('Generation'),
|
|
116
|
+
},
|
|
117
|
+
Delegation: {
|
|
118
|
+
name: 'X-App-Delegation',
|
|
119
|
+
in: 'header',
|
|
120
|
+
description: 'The platform-issued opaque delegation is required for user-originated work. An explicit service grant governs autonomous operations.',
|
|
121
|
+
schema: { type: 'string', pattern: '^[A-Za-z0-9_-]{16,256}$' },
|
|
122
|
+
},
|
|
123
|
+
IdempotencyKey: {
|
|
124
|
+
name: 'Idempotency-Key',
|
|
125
|
+
in: 'header',
|
|
126
|
+
required: true,
|
|
127
|
+
description: 'Retry the same input with the original key. Reusing the key with different input conflicts.',
|
|
128
|
+
schema: schema('RecordId'),
|
|
129
|
+
},
|
|
130
|
+
operationId: pathParameter('operationId'),
|
|
131
|
+
providerId: pathParameter('providerId'),
|
|
132
|
+
secretId: pathParameter('secretId'),
|
|
133
|
+
incidentKey: pathParameter('incidentKey'),
|
|
134
|
+
domain: pathParameter('domain'),
|
|
135
|
+
ResumeCursor: {
|
|
136
|
+
name: 'Last-Event-ID',
|
|
137
|
+
in: 'header',
|
|
138
|
+
description: 'Resume within the subscription authorized by the current generation, grants, and delegation.',
|
|
139
|
+
schema: schema('EventCursor'),
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { contractVersion, v1ProtocolVersion } from './primitives.ts';
|
|
2
|
+
export { ContractError, catalogIconPath, catalogIconTarget, checkApprovalBinding, checkManifestCompatibility, checkPublicationBinding, packageDownloadUrl, packageReleaseAssets, parseAppManifest, parseApproval, parseCandidate, parseCatalog, parseProtocolDocument, parsePublication, type ManifestEnvironment, } from './validation.ts';
|
|
3
|
+
export { parseHttpEvent, parseHttpResponse, prepareHttpRequest, type HttpRequest, type HttpRequestOptions, type HttpResponse, } from './client.ts';
|
|
4
|
+
export { httpOperations, rpcLimits, type HttpMethod, type HttpOperationName, type HttpSocket, } from './http-operations.ts';
|
|
5
|
+
export type { AppManifest, Approval, Candidate, Catalog, CatalogRelease, ContractErrorCode, PackageArtifact, ProtocolDocument, ProtocolDocumentName, Publication, } from './Types/contract.types.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { contractVersion, v1ProtocolVersion } from './primitives.js';
|
|
2
|
+
export { ContractError, catalogIconPath, catalogIconTarget, checkApprovalBinding, checkManifestCompatibility, checkPublicationBinding, packageDownloadUrl, packageReleaseAssets, parseAppManifest, parseApproval, parseCandidate, parseCatalog, parseProtocolDocument, parsePublication, } from './validation.js';
|
|
3
|
+
export { parseHttpEvent, parseHttpResponse, prepareHttpRequest, } from './client.js';
|
|
4
|
+
export { httpOperations, rpcLimits, } from './http-operations.js';
|