@substrat-run/control-plane-api 0.109.0 → 0.110.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/dist/api.d.ts +21 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +41 -1
- package/dist/api.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -25
- package/dist/client.js.map +1 -1
- package/dist/vertical-client.d.ts.map +1 -1
- package/dist/vertical-client.js +8 -16
- package/dist/vertical-client.js.map +1 -1
- package/package.json +5 -5
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
+
import { z } from '@substrat-run/contracts';
|
|
2
3
|
import type { Connection, ConnectionActivity, ConnectionActivitySource, ConnectionCredential, ConnectionProbe, PlatformActorId } from '@substrat-run/contracts';
|
|
3
4
|
import type { ScopeHost } from '@substrat-run/kernel';
|
|
4
5
|
import type { PlatformActorAuth, BuilderAuth, Principal } from './auth.js';
|
|
@@ -288,6 +289,26 @@ type Vars = {
|
|
|
288
289
|
actor: PlatformActorId;
|
|
289
290
|
principal: Principal;
|
|
290
291
|
};
|
|
292
|
+
/**
|
|
293
|
+
* The K-35 denial-log filter (#867). Bounded by default like every other HTTP read
|
|
294
|
+
* here: the log's volume is attacker-influenceable by design (a probing client mints
|
|
295
|
+
* rows), so an unbounded `GET` is exactly the wrong default.
|
|
296
|
+
*
|
|
297
|
+
* The DECODER half of contracts' `denialFilterParams` (#971), and deliberately not the
|
|
298
|
+
* same schema: a query param arrives as a string, so `limit` is coerced here and given
|
|
299
|
+
* this route's own default, which the filter itself must not carry. What the two DO owe
|
|
300
|
+
* each other is the field set — Zod strips an unknown key, so a field added to the
|
|
301
|
+
* filter and sent by every client would be dropped here in silence. Exported (not from
|
|
302
|
+
* `index.ts` — this is not public surface) so `api.test.ts` can pin that.
|
|
303
|
+
*/
|
|
304
|
+
export declare const denialLogQuery: z.ZodObject<{
|
|
305
|
+
actor: z.ZodOptional<z.ZodString>;
|
|
306
|
+
permission: z.ZodOptional<z.ZodString>;
|
|
307
|
+
operation: z.ZodOptional<z.ZodString>;
|
|
308
|
+
since: z.ZodOptional<z.ZodString>;
|
|
309
|
+
until: z.ZodOptional<z.ZodString>;
|
|
310
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
311
|
+
}, z.core.$strip>;
|
|
291
312
|
export declare const DEFAULT_MODEL_MARGIN_PERCENT = 20;
|
|
292
313
|
/**
|
|
293
314
|
* The audited HTTP surface over `HostAdmin` (control-plane.md §4.5).
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAmDL,CAAC,EAGF,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EAGf,eAAe,EAOhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAmBrF,OAAO,KAAK,EAEV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAyBtD,OAAO,KAAK,EAAE,mBAAmB,EAAE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,CAAC;IAChC;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AACnE,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;AAKzE,KAAK,IAAI,GAAG;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;AA0O7D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;;;;;;;iBAOzB,CAAC;AA+FH,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAM/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAAE,SAAS,EAAE,IAAI,CAAA;CAAE,CAAC,CAm7IhG"}
|
package/dist/api.js
CHANGED
|
@@ -248,8 +248,15 @@ const auditLogQuery = z.object({
|
|
|
248
248
|
* The K-35 denial-log filter (#867). Bounded by default like every other HTTP read
|
|
249
249
|
* here: the log's volume is attacker-influenceable by design (a probing client mints
|
|
250
250
|
* rows), so an unbounded `GET` is exactly the wrong default.
|
|
251
|
+
*
|
|
252
|
+
* The DECODER half of contracts' `denialFilterParams` (#971), and deliberately not the
|
|
253
|
+
* same schema: a query param arrives as a string, so `limit` is coerced here and given
|
|
254
|
+
* this route's own default, which the filter itself must not carry. What the two DO owe
|
|
255
|
+
* each other is the field set — Zod strips an unknown key, so a field added to the
|
|
256
|
+
* filter and sent by every client would be dropped here in silence. Exported (not from
|
|
257
|
+
* `index.ts` — this is not public surface) so `api.test.ts` can pin that.
|
|
251
258
|
*/
|
|
252
|
-
const denialLogQuery = z.object({
|
|
259
|
+
export const denialLogQuery = z.object({
|
|
253
260
|
actor: z.string().optional(),
|
|
254
261
|
permission: z.string().optional(),
|
|
255
262
|
operation: z.string().optional(),
|
|
@@ -2879,6 +2886,39 @@ export function createControlPlaneApi(options) {
|
|
|
2879
2886
|
// sibling route would cost a second full parse for a field sitting beside this one.
|
|
2880
2887
|
return c.json({ schedules: parsed?.schedules ?? null, freshness: parsed?.freshness ?? null });
|
|
2881
2888
|
});
|
|
2889
|
+
/**
|
|
2890
|
+
* The declared FLOW of one version (#1234): every event type its modules say they
|
|
2891
|
+
* emit or consume, and the providers the vertical requires — the declared half of
|
|
2892
|
+
* a declared-vs-observed finding.
|
|
2893
|
+
*
|
|
2894
|
+
* Its own route rather than a ride on `/model`, unlike freshness on `/schedules`:
|
|
2895
|
+
* the model is the largest thing on a manifest, and the flow card needs none of it.
|
|
2896
|
+
* `declaredEvents` is null for a version pushed before the field existed, which the
|
|
2897
|
+
* caller must keep apart from a version that declares no events at all — the second
|
|
2898
|
+
* is a finding, the first is nothing to say.
|
|
2899
|
+
*/
|
|
2900
|
+
app.get('/verticals/:slug/versions/:id/flow', async (c) => {
|
|
2901
|
+
const p = c.get('principal');
|
|
2902
|
+
const slug = await resolveVerticalId(c, c.req.param('slug'));
|
|
2903
|
+
if (p.kind === 'builder' && (await ownerOf(p.actor, slug)) !== p.tenantId) {
|
|
2904
|
+
return c.json({ error: 'not found' }, 404);
|
|
2905
|
+
}
|
|
2906
|
+
const json = await admin.versionManifest(c.get('actor'), slug, c.req.param('id'));
|
|
2907
|
+
const parsed = json ? storedDeployManifest.parse(JSON.parse(json)) : null;
|
|
2908
|
+
return c.json({
|
|
2909
|
+
declaredEvents: parsed?.declaredEvents ?? null,
|
|
2910
|
+
// Whether that surface is the whole declaration or a sample cut at the cap. The
|
|
2911
|
+
// reader's "N of M checked" is a completeness claim, and it may not be made about
|
|
2912
|
+
// a manifest that says it was truncated.
|
|
2913
|
+
declaredEventsTruncated: parsed?.declaredEventsTruncated ?? false,
|
|
2914
|
+
requires: parsed?.requires ?? [],
|
|
2915
|
+
// The other two bands of the flow map (#1234), off the same parse. `schedules`
|
|
2916
|
+
// also has its own route, which answers a different question — did the run
|
|
2917
|
+
// happen — while this one wants the declaration as a node.
|
|
2918
|
+
schedules: parsed?.schedules ?? [],
|
|
2919
|
+
outbound: parsed?.outbound ?? [],
|
|
2920
|
+
});
|
|
2921
|
+
});
|
|
2882
2922
|
app.get('/verticals/:slug/versions/:id/model', async (c) => {
|
|
2883
2923
|
const p = c.get('principal');
|
|
2884
2924
|
const slug = await resolveVerticalId(c, c.req.param('slug'));
|