@pipeline-builder/api-core 5.3.3 → 6.0.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/CHANGELOG.md +15 -0
- package/lib/constants/http-status.d.ts +1 -0
- package/lib/constants/http-status.js +2 -1
- package/lib/contracts/billing.d.ts +40 -0
- package/lib/contracts/billing.js +58 -0
- package/lib/contracts/call.d.ts +95 -0
- package/lib/contracts/call.js +73 -0
- package/lib/contracts/cascade.d.ts +30 -0
- package/lib/contracts/cascade.js +30 -0
- package/lib/contracts/compliance.d.ts +96 -0
- package/lib/contracts/compliance.js +180 -0
- package/lib/contracts/define.d.ts +123 -0
- package/lib/contracts/define.js +93 -0
- package/lib/contracts/image-registry.d.ts +269 -0
- package/lib/contracts/image-registry.js +401 -0
- package/lib/contracts/index.d.ts +18 -0
- package/lib/contracts/index.js +55 -0
- package/lib/contracts/message.d.ts +93 -0
- package/lib/contracts/message.js +145 -0
- package/lib/contracts/ops-center.d.ts +9 -0
- package/lib/contracts/ops-center.js +25 -0
- package/lib/contracts/pipeline.d.ts +9 -0
- package/lib/contracts/pipeline.js +25 -0
- package/lib/contracts/platform.d.ts +338 -0
- package/lib/contracts/platform.js +522 -0
- package/lib/contracts/plugin.d.ts +79 -0
- package/lib/contracts/plugin.js +149 -0
- package/lib/contracts/quota.d.ts +32 -0
- package/lib/contracts/quota.js +48 -0
- package/lib/contracts/reporting.d.ts +94 -0
- package/lib/contracts/reporting.js +176 -0
- package/lib/errors/app-errors.d.ts +12 -0
- package/lib/errors/app-errors.js +12 -1
- package/lib/index.d.ts +7 -2
- package/lib/index.js +9 -3
- package/lib/middleware/index.d.ts +1 -1
- package/lib/middleware/index.js +2 -2
- package/lib/middleware/jwt-verify.d.ts +21 -1
- package/lib/middleware/jwt-verify.js +37 -4
- package/lib/services/circuit-breaker.d.ts +6 -0
- package/lib/services/circuit-breaker.js +11 -1
- package/lib/services/compliance-event-subscriber.js +18 -8
- package/lib/services/ecosystem-notify-client.d.ts +1 -1
- package/lib/services/ecosystem-notify-client.js +12 -9
- package/lib/services/http-client.d.ts +36 -0
- package/lib/services/http-client.js +140 -25
- package/lib/services/index.d.ts +3 -3
- package/lib/services/index.js +3 -3
- package/lib/services/org-ai-client.d.ts +3 -3
- package/lib/services/org-ai-client.js +15 -15
- package/lib/services/quota.js +11 -2
- package/lib/services/service-keys.d.ts +2 -11
- package/lib/services/service-keys.js +22 -2
- package/lib/services/sse-ticket-store.d.ts +18 -1
- package/lib/services/sse-ticket-store.js +37 -3
- package/lib/services/system-notification.d.ts +2 -2
- package/lib/services/system-notification.js +27 -19
- package/lib/types/common.d.ts +6 -1
- package/lib/types/common.js +1 -1
- package/lib/types/error-codes.d.ts +3 -0
- package/lib/types/error-codes.js +6 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +3 -1
- package/lib/types/plugin-wire.d.ts +268 -0
- package/lib/types/plugin-wire.js +4 -0
- package/lib/types/remote-audit-actions.d.ts +1 -1
- package/lib/types/remote-audit-actions.js +51 -1
- package/lib/types/reserved-secrets.d.ts +22 -0
- package/lib/types/reserved-secrets.js +29 -0
- package/lib/utils/concurrency.d.ts +33 -0
- package/lib/utils/concurrency.js +70 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/utils/pipeline-identity.d.ts +10 -5
- package/lib/utils/pipeline-identity.js +25 -11
- package/lib/utils/secret-encryption.js +9 -3
- package/lib/utils/semver.d.ts +73 -5
- package/lib/utils/semver.js +175 -45
- package/lib/utils/service-registry.d.ts +1 -1
- package/lib/utils/service-registry.js +2 -2
- package/lib/validation/pipeline-schemas.d.ts +167 -2
- package/lib/validation/pipeline-schemas.js +145 -2
- package/lib/validation/plugin-spec-schema.js +7 -2
- package/package.json +8 -7
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal endpoints SERVED BY image-registry (router mounted at `/internal`,
|
|
3
|
+
* behind `requireAuth`).
|
|
4
|
+
*
|
|
5
|
+
* - plugin → sign a pushed plugin image / discard a refused one;
|
|
6
|
+
* - plugin → the public namespace (`/internal/plugin-publications*`);
|
|
7
|
+
* - plugin → anonymous submissions' quarantine repos (delete, build credential);
|
|
8
|
+
* - quota / plugin → per-org storage reads and a tenant prune;
|
|
9
|
+
* - platform → purge a deleted org's private namespace.
|
|
10
|
+
*
|
|
11
|
+
* The repository-name rules every body is validated against live HERE (and
|
|
12
|
+
* image-registry's `services/namespaces.ts` re-exports them), so the caller's
|
|
13
|
+
* idea of a valid repository and the registry's are one definition.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
/**
|
|
17
|
+
* A publisher handle / org id as ONE registry path component (Distribution's
|
|
18
|
+
* component grammar): `public/<handle>/…`, and the org id in `org-<id>/…`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PUBLISHER_HANDLE_RE: RegExp;
|
|
21
|
+
/** An anonymous submission id: one lowercase path component (`quarantine/<id>`). */
|
|
22
|
+
export declare const QUARANTINE_SUBMISSION_ID_RE: RegExp;
|
|
23
|
+
/** A plugin image repository: `system/<name>`, `org-<orgId>/<name>`, `quarantine/<id>` or `public/<handle>/<name>`. */
|
|
24
|
+
export declare function isPluginRepository(repository: string): boolean;
|
|
25
|
+
/** Exactly `quarantine/<submissionId>`. */
|
|
26
|
+
export declare function isQuarantineRepository(repository: string): boolean;
|
|
27
|
+
/** Exactly `public/<publisherHandle>/<name>`. */
|
|
28
|
+
export declare function isPublicRepository(repository: string): boolean;
|
|
29
|
+
/** `system/<name>` for a plugin (never a `-base` image). */
|
|
30
|
+
export declare function isSystemPluginRepository(repository: string): boolean;
|
|
31
|
+
/** `public/<handle>/<name>` split into its parts, or null. */
|
|
32
|
+
export declare function parsePublicRepository(repository: string): {
|
|
33
|
+
handle: string;
|
|
34
|
+
name: string;
|
|
35
|
+
} | null;
|
|
36
|
+
/** `sha256:<64 lowercase hex>`. */
|
|
37
|
+
export declare function isSha256Digest(digest: string): boolean;
|
|
38
|
+
/** The header names of a signing request (the body is the raw SPDX JSON, streamed to disk). */
|
|
39
|
+
export declare const PLUGIN_SIGNATURE_HEADERS: {
|
|
40
|
+
readonly repository: 'x-pb-repository';
|
|
41
|
+
readonly digest: 'x-pb-digest';
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The signing request's headers. `public/*` is signed only by the publish /
|
|
45
|
+
* resign routes; `quarantine/*` only as exactly `quarantine/<submissionId>`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const PluginSignatureHeadersSchema: z.ZodObject<{
|
|
48
|
+
"x-pb-repository": z.ZodString;
|
|
49
|
+
"x-pb-digest": z.ZodString;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export declare const IMAGE_REGISTRY_INTERNAL: {
|
|
52
|
+
/**
|
|
53
|
+
* Sign a pushed plugin image digest and attach its SBOM as a signed
|
|
54
|
+
* attestation. NOT a JSON body: the raw SPDX document is the body (streamed
|
|
55
|
+
* to disk, 413 past `REGISTRY_SBOM_MAX_BYTES`) and the metadata rides in the
|
|
56
|
+
* {@link PLUGIN_SIGNATURE_HEADERS} ({@link PluginSignatureHeadersSchema}), so
|
|
57
|
+
* it is refused before a byte of the document is read.
|
|
58
|
+
*/
|
|
59
|
+
readonly signPluginImage: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, never, z.ZodObject<{
|
|
60
|
+
repository: z.ZodString;
|
|
61
|
+
digest: z.ZodString;
|
|
62
|
+
signed: z.ZodLiteral<true>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
/**
|
|
65
|
+
* Delete a pushed, signed image the scan gates / compliance refused, with
|
|
66
|
+
* its cosign companions. Idempotent (`deleted: 0` when already gone).
|
|
67
|
+
* `context` is the plugin service's why-and-whose; the registry keeps only
|
|
68
|
+
* the known string fields of it (≤128 chars) for its audit row.
|
|
69
|
+
*/
|
|
70
|
+
readonly discardPluginImage: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, z.ZodObject<{
|
|
71
|
+
repository: z.ZodString;
|
|
72
|
+
digest: z.ZodString;
|
|
73
|
+
context: z.ZodOptional<z.ZodUnknown>;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
repository: z.ZodString;
|
|
76
|
+
digest: z.ZodString;
|
|
77
|
+
deleted: z.ZodNumber;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
/** Copy the pinned digest into `public/<publisher>/<name>`, sign it fresh with the tier, tag the version. */
|
|
80
|
+
readonly publishPublicImage: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, z.ZodObject<{
|
|
81
|
+
sourceRepository: z.ZodString;
|
|
82
|
+
digest: z.ZodString;
|
|
83
|
+
publisherHandle: z.ZodString;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
version: z.ZodString;
|
|
86
|
+
tier: z.ZodEnum<{
|
|
87
|
+
community: "community";
|
|
88
|
+
official: "official";
|
|
89
|
+
unverified: "unverified";
|
|
90
|
+
verified: "verified";
|
|
91
|
+
}>;
|
|
92
|
+
publisherOrgId: z.ZodNullable<z.ZodString>;
|
|
93
|
+
actorId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
+
imageRepository: z.ZodString;
|
|
96
|
+
digest: z.ZodString;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
/** Replace a public image's signature with new trust/publisher annotations. */
|
|
99
|
+
readonly resignPublicImage: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, z.ZodObject<{
|
|
100
|
+
imageRepository: z.ZodString;
|
|
101
|
+
digest: z.ZodString;
|
|
102
|
+
publisherHandle: z.ZodString;
|
|
103
|
+
tier: z.ZodEnum<{
|
|
104
|
+
community: "community";
|
|
105
|
+
official: "official";
|
|
106
|
+
unverified: "unverified";
|
|
107
|
+
verified: "verified";
|
|
108
|
+
}>;
|
|
109
|
+
publisherOrgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
110
|
+
progress: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
completed: z.ZodNumber;
|
|
112
|
+
total: z.ZodNumber;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
actorId: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
116
|
+
imageRepository: z.ZodString;
|
|
117
|
+
digest: z.ZodString;
|
|
118
|
+
tier: z.ZodEnum<{
|
|
119
|
+
community: "community";
|
|
120
|
+
official: "official";
|
|
121
|
+
unverified: "unverified";
|
|
122
|
+
verified: "verified";
|
|
123
|
+
}>;
|
|
124
|
+
publisher: z.ZodString;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
/** Remove a public version TAG (content stays). Idempotent. */
|
|
127
|
+
readonly yankPublicVersion: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, z.ZodObject<{
|
|
128
|
+
imageRepository: z.ZodString;
|
|
129
|
+
version: z.ZodString;
|
|
130
|
+
digest: z.ZodString;
|
|
131
|
+
actorId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
133
|
+
imageRepository: z.ZodString;
|
|
134
|
+
version: z.ZodString;
|
|
135
|
+
digest: z.ZodString;
|
|
136
|
+
yanked: z.ZodLiteral<true>;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
/** Put a yanked version's tag back on its published digest (unyank). Idempotent. */
|
|
139
|
+
readonly retagPublicVersion: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, z.ZodObject<{
|
|
140
|
+
imageRepository: z.ZodString;
|
|
141
|
+
version: z.ZodString;
|
|
142
|
+
digest: z.ZodString;
|
|
143
|
+
actorId: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
145
|
+
imageRepository: z.ZodString;
|
|
146
|
+
version: z.ZodString;
|
|
147
|
+
digest: z.ZodString;
|
|
148
|
+
tagged: z.ZodLiteral<true>;
|
|
149
|
+
}, z.core.$strip>>;
|
|
150
|
+
/** Delete one cleared public digest, or a retired system version's build copy. 409 while a tag resolves to it. */
|
|
151
|
+
readonly collectImage: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, z.ZodUnion<readonly [z.ZodObject<{
|
|
152
|
+
imageRepository: z.ZodString;
|
|
153
|
+
digest: z.ZodString;
|
|
154
|
+
actorId: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
imageRepository: z.ZodString;
|
|
157
|
+
digest: z.ZodString;
|
|
158
|
+
version: z.ZodString;
|
|
159
|
+
actorId: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>]>, z.ZodObject<{
|
|
161
|
+
imageRepository: z.ZodString;
|
|
162
|
+
digest: z.ZodString;
|
|
163
|
+
deleted: z.ZodBoolean;
|
|
164
|
+
}, z.core.$strip>>;
|
|
165
|
+
/** A public image's signature and its signed `pb.trust` / `pb.publisher` annotations. 502 when cosign fails. */
|
|
166
|
+
readonly verifyPublication: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
imageRepository: z.ZodString;
|
|
168
|
+
digest: z.ZodString;
|
|
169
|
+
}, z.core.$strip>, never, z.ZodObject<{
|
|
170
|
+
signed: z.ZodBoolean;
|
|
171
|
+
tier: z.ZodNullable<z.ZodEnum<{
|
|
172
|
+
community: "community";
|
|
173
|
+
official: "official";
|
|
174
|
+
unverified: "unverified";
|
|
175
|
+
verified: "verified";
|
|
176
|
+
}>>;
|
|
177
|
+
publisher: z.ZodNullable<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
/** Drop the verify cache for one repository/digest, one repository, or all of it. */
|
|
180
|
+
readonly invalidateVerifyCache: import("./define.js").InternalEndpointContract<z.ZodObject<{}, z.core.$strip>, never, z.ZodObject<{
|
|
181
|
+
imageRepository: z.ZodOptional<z.ZodString>;
|
|
182
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
184
|
+
invalidated: z.ZodNumber;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
/** Drop an anonymous submission's quarantined build. Idempotent (`deleted: 0`). */
|
|
187
|
+
readonly deleteQuarantineRepository: import("./define.js").InternalEndpointContract<z.ZodObject<{
|
|
188
|
+
submissionId: z.ZodString;
|
|
189
|
+
}, z.core.$strip>, never, never, z.ZodObject<{
|
|
190
|
+
repository: z.ZodString;
|
|
191
|
+
deleted: z.ZodNumber;
|
|
192
|
+
}, z.core.$strip>>;
|
|
193
|
+
/**
|
|
194
|
+
* The registry-only credential a quarantined build pushes with. `ttlSeconds`
|
|
195
|
+
* is clamped by the registry (and read leniently: anything non-numeric is
|
|
196
|
+
* the minimum).
|
|
197
|
+
*/
|
|
198
|
+
readonly mintQuarantineCredential: import("./define.js").InternalEndpointContract<z.ZodObject<{
|
|
199
|
+
submissionId: z.ZodString;
|
|
200
|
+
}, z.core.$strip>, never, z.ZodObject<{
|
|
201
|
+
ttlSeconds: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
203
|
+
username: z.ZodString;
|
|
204
|
+
password: z.ZodString;
|
|
205
|
+
expiresAt: z.ZodString;
|
|
206
|
+
}, z.core.$strip>>;
|
|
207
|
+
/** One org's registry storage in bytes (the push gate's own measurement). 500 when the scan fails. */
|
|
208
|
+
readonly orgStorageUsage: import("./define.js").InternalEndpointContract<z.ZodObject<{
|
|
209
|
+
orgId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
210
|
+
}, z.core.$strip>, never, never, z.ZodObject<{
|
|
211
|
+
bytes: z.ZodNumber;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
/**
|
|
214
|
+
* Per-version storage attribution. `?scope=retention` (system org only)
|
|
215
|
+
* answers the retention view instead (any other `scope` is ignored).
|
|
216
|
+
*/
|
|
217
|
+
readonly orgStorageBreakdown: import("./define.js").InternalEndpointContract<z.ZodObject<{
|
|
218
|
+
orgId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}, z.core.$strip>, never, z.ZodUnion<readonly [z.ZodObject<{
|
|
222
|
+
orgId: z.ZodString;
|
|
223
|
+
bytes: z.ZodNumber;
|
|
224
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
225
|
+
repo: z.ZodString;
|
|
226
|
+
tag: z.ZodString;
|
|
227
|
+
totalBytes: z.ZodNumber;
|
|
228
|
+
marginalBytes: z.ZodNumber;
|
|
229
|
+
published: z.ZodBoolean;
|
|
230
|
+
}, z.core.$strip>>;
|
|
231
|
+
computedAt: z.ZodNumber;
|
|
232
|
+
incomplete: z.ZodBoolean;
|
|
233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
234
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
235
|
+
name: z.ZodString;
|
|
236
|
+
version: z.ZodString;
|
|
237
|
+
totalBytes: z.ZodNumber;
|
|
238
|
+
marginalBytes: z.ZodNumber;
|
|
239
|
+
}, z.core.$strip>>;
|
|
240
|
+
computedAt: z.ZodNumber;
|
|
241
|
+
incomplete: z.ZodBoolean;
|
|
242
|
+
}, z.core.$strip>]>>;
|
|
243
|
+
/**
|
|
244
|
+
* Drop one version TAG in the org's own namespace (never `public/*` or
|
|
245
|
+
* `quarantine/*`). `repo` and `tag` ride the QUERY: a DELETE carries no body.
|
|
246
|
+
* Idempotent (`pruned: false` when the tag is already gone).
|
|
247
|
+
*/
|
|
248
|
+
readonly pruneOrgStorage: import("./define.js").InternalEndpointContract<z.ZodObject<{
|
|
249
|
+
orgId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
250
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
251
|
+
repo: z.ZodString;
|
|
252
|
+
tag: z.ZodString;
|
|
253
|
+
}, z.core.$strip>, never, z.ZodObject<{
|
|
254
|
+
repo: z.ZodString;
|
|
255
|
+
tag: z.ZodString;
|
|
256
|
+
pruned: z.ZodBoolean;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
/**
|
|
259
|
+
* Purge a deleted org's PRIVATE `org-<id>/*` namespace (`public/*` copies are
|
|
260
|
+
* kept). A non-empty `failed` means bytes remain.
|
|
261
|
+
*/
|
|
262
|
+
readonly purgeOrgNamespace: import("./define.js").InternalEndpointContract<z.ZodObject<{
|
|
263
|
+
orgId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
264
|
+
}, z.core.$strip>, never, never, z.ZodObject<{
|
|
265
|
+
repositories: z.ZodNumber;
|
|
266
|
+
deleted: z.ZodNumber;
|
|
267
|
+
failed: z.ZodArray<z.ZodString>;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
};
|