@arbol-ai/maximus 8.0.1 → 8.4.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/analytics/analytics.d.ts +16 -16
- package/dist/analytics/analytics.js +4 -4
- package/dist/body.d.ts +2 -2
- package/dist/body.js +2 -2
- package/dist/capture/index.d.ts +37 -0
- package/dist/capture/index.js +181 -0
- package/dist/chunks/{define-app-x7uY70_1.js → define-app-CQpWqqqE.js} +44 -14
- package/dist/chunks/delay-BsKQP_lF.js +12 -0
- package/dist/chunks/{json-B14evE6-.js → destination-DIkn8W6K.js} +65 -1
- package/dist/chunks/digest-C51F1bhA.js +12 -0
- package/dist/chunks/{errors-C5w9WY1l.js → errors-BoutSmiy.js} +2 -3
- package/dist/chunks/execution-Bpq6s4nA.js +265 -0
- package/dist/chunks/{generate-C-9FKW0o.js → generate-Dg88LzLU.js} +1 -1
- package/dist/chunks/{handler-iebR-urt.js → handler-DSpyrWc-.js} +6 -2
- package/dist/chunks/{http-layout-DS8DnPyu.js → http-layout-BcYH4I2w.js} +1 -1
- package/dist/chunks/{http-paths-DMBxwpp6.js → http-paths-D043DkJv.js} +50 -81
- package/dist/chunks/http-routes-B6tCsnxB.js +29 -0
- package/dist/chunks/{openapi-CeolxIqa.js → openapi-D2rds7vy.js} +32 -130
- package/dist/chunks/{openapi-file-Bz9FRaE6.js → openapi-file-BK8zET5U.js} +24 -6
- package/dist/chunks/{pages-iZTvFs5a.js → pages-B7ysoFAM.js} +1 -1
- package/dist/chunks/result-CF4OzG9O.js +29 -0
- package/dist/chunks/{runtime-D94vx21X.js → runtime-CGtS2rOb.js} +165 -11
- package/dist/chunks/schemas-_UJcx_uY.js +813 -0
- package/dist/chunks/{server-Bzf1Q1_4.js → server-CVhTLNj2.js} +38 -101
- package/dist/chunks/{src-CPrJpbOM.js → src-D67OfW9B.js} +94 -27
- package/dist/chunks/tasks-C873C3le.js +100 -0
- package/dist/chunks/tasks-DYdY-dBI.js +267 -0
- package/dist/chunks/{telemetry-C3LfZcOB.js → telemetry-BtxJh69Q.js} +4 -4
- package/dist/chunks/{types-DTIuIEJ-.d.ts → types-BfGa2aJT.d.ts} +537 -124
- package/dist/chunks/validation-CpzAxj2_.js +201 -0
- package/dist/chunks/{workers-types-BRk_Xa_5.d.ts → workers-types-Cxf-5cH7.d.ts} +6 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/http-paths.d.ts +1 -1
- package/dist/http-paths.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -11
- package/dist/internals.d.ts +2 -2
- package/dist/internals.js +6 -6
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/tasks.d.ts +33 -0
- package/dist/mcp/tasks.js +3 -0
- package/dist/project/config.d.ts +2 -2
- package/dist/project/config.js +3 -2
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +3 -3
- package/dist/schemas.d.ts +2 -2
- package/dist/schemas.js +3 -3
- package/dist/standard-failures.d.ts +1 -1
- package/dist/tooling/cli.js +2 -2
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +15 -9
- package/dist/webhooks.d.ts +13 -2
- package/dist/webhooks.js +38 -1
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +15 -3
- package/skills/maximus/SKILL.md +14 -4
- package/skills/maximus/references/project.md +4 -0
- package/skills/maximus/references/routes-and-tools.md +11 -1
- package/templates/project/CLAUDE.md.template +3 -3
- package/templates/project/README.md.template +1 -0
- package/templates/project/tsconfig.json.template +1 -0
- package/dist/chunks/execution-rOiLo8VG.js +0 -84
- package/dist/chunks/result-CKgZHrnj.js +0 -56
- package/dist/chunks/schemas-p_aRcMC1.js +0 -227
- package/dist/chunks/validation-fTohBT6R.js +0 -420
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Static, Static as Static$1, Static as Static$2, StaticDecode, TArray, TCodec, TLiteral, TObject, TOptional, TProperties, TSchema, TSchema as TSchema$1, TSchema as TSchema$2, TString, TUnion, TUnsafe, Type, Type as Type$1, Type as Type$2, Type as t, Type as t$1 } from "typebox";
|
|
2
|
+
import "typebox/error";
|
|
2
3
|
/**
|
|
3
4
|
* Request correlation: request ids (a UUID, or a ray id from a trusted Cloudflare edge), W3C `traceparent`
|
|
4
5
|
* parsing, and the correlation that durable work persists.
|
|
@@ -84,9 +85,9 @@ interface ErrorDefinition {
|
|
|
84
85
|
* share. The OpenAPI document names each code's own failure, `NoteNotFoundFailure`, which fixes its code.
|
|
85
86
|
*/
|
|
86
87
|
declare const FailureSchema: TObject<{
|
|
87
|
-
code:
|
|
88
|
-
message:
|
|
89
|
-
retryable:
|
|
88
|
+
code: Type.TString;
|
|
89
|
+
message: Type.TString;
|
|
90
|
+
retryable: Type.TBoolean;
|
|
90
91
|
data: TObject<{}>;
|
|
91
92
|
}>;
|
|
92
93
|
/** The standard failures as a catalog defines them; INVALID_INPUT carries its field issues. */
|
|
@@ -155,9 +156,9 @@ declare const STANDARD: {
|
|
|
155
156
|
readonly status: 400;
|
|
156
157
|
readonly message: 'The request does not match the published schema.';
|
|
157
158
|
readonly dataSchema: TObject<{
|
|
158
|
-
issues:
|
|
159
|
-
path:
|
|
160
|
-
message:
|
|
159
|
+
issues: Type.TOptional<Type.TArray<TObject<{
|
|
160
|
+
path: Type.TString;
|
|
161
|
+
message: Type.TString;
|
|
161
162
|
}>>>;
|
|
162
163
|
}>;
|
|
163
164
|
};
|
|
@@ -207,8 +208,11 @@ interface ErrorCatalog {
|
|
|
207
208
|
/** The value as one of the catalog's failures; throws a TypeError when it is none of them. */
|
|
208
209
|
validate: (error: unknown) => Failure;
|
|
209
210
|
}
|
|
210
|
-
/**
|
|
211
|
-
|
|
211
|
+
/**
|
|
212
|
+
* The union schema of a set of definitions: one strict failure schema per definition. TypeBox reads a union's
|
|
213
|
+
* members as a tuple; one member that is the union of every failure schema types the same values.
|
|
214
|
+
*/
|
|
215
|
+
type CatalogSchema<Definitions extends Record<string, ErrorDefinition>> = TUnion<[{ [K in keyof Definitions]: FailureSchemaOf<Definitions[K]>; }[keyof Definitions]]>;
|
|
212
216
|
/** A catalog over a set of definitions: a factory per name, and the members of `ErrorCatalog`. */
|
|
213
217
|
type Catalog<Definitions extends Record<string, ErrorDefinition>> = Factories<Definitions> & {
|
|
214
218
|
/** The union of the catalog's failure schemas. */
|
|
@@ -272,7 +276,7 @@ interface Attachment {
|
|
|
272
276
|
byteLength: number;
|
|
273
277
|
}
|
|
274
278
|
/** The output of an operation that answers with a file (`http.response: 'attachment'`). */
|
|
275
|
-
declare const AttachmentOutputSchema:
|
|
279
|
+
declare const AttachmentOutputSchema: Type.TUnsafe<Attachment>;
|
|
276
280
|
/** A successful outcome and its value. Each transport presents it in its own envelope. */
|
|
277
281
|
interface Success<T> {
|
|
278
282
|
/** Always `true`, which marks a success. */
|
|
@@ -315,24 +319,54 @@ interface BinaryBody {
|
|
|
315
319
|
*/
|
|
316
320
|
read: () => Promise<Result<Uint8Array<ArrayBuffer>, BodyFailure>>;
|
|
317
321
|
}
|
|
318
|
-
/** Opaque owner codecs already carry their decoded static type; only native transforms need traversal. */
|
|
319
|
-
type HasNativeTransform<S extends TSchema> = typeof TransformKind extends keyof S ? true : string extends S[typeof Kind] ? false : S extends TObject<infer P> ? true extends { [K in keyof P]: HasNativeTransform<P[K]>; }[keyof P] ? true : false : S extends TArray<infer I> ? HasNativeTransform<I> : S extends TUnion<infer U> | TTuple<infer U> ? HasNativeTransform<U[number]> : S extends TRecord<TSchema, infer V> ? HasNativeTransform<V> : false;
|
|
320
|
-
/**
|
|
321
|
-
* A schema's decoded value. TypeBox's deep decoder can recurse indefinitely through opaque owner
|
|
322
|
-
* codecs; a schema without native transforms already has exactly its decoded `Static` type.
|
|
323
|
-
*/
|
|
324
|
-
type StaticDecode$1<S extends TSchema> = true extends HasNativeTransform<S> ? StaticDecode<S> : Static<S>;
|
|
325
322
|
/**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
323
|
+
* One complete record of a call: who called which operation over which transport, when and for how long, what
|
|
324
|
+
* it answered, and, under `payloads: 'all'`, its input and output without what their schemas mark
|
|
325
|
+
* `secret: true`. A refusal before the operation ran has `stage: 'admission'` and null wherever admission had
|
|
326
|
+
* not learned the value: a token is never read before it is verified.
|
|
327
|
+
*/
|
|
328
|
+
declare const CaptureRecordSchema: Type.TObject<{
|
|
329
|
+
id: Type.TString;
|
|
330
|
+
service: Type.TString;
|
|
331
|
+
operation: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
332
|
+
organizationId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
333
|
+
actorId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
334
|
+
actorKind: Type.TUnion<[Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"service">]>, Type.TNull]>;
|
|
335
|
+
requestId: Type.TString;
|
|
336
|
+
traceId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
337
|
+
surface: Type.TUnion<[Type.TLiteral<"http">, Type.TLiteral<"mcp">, Type.TLiteral<"rpc">]>;
|
|
338
|
+
occurredAt: Type.TInteger;
|
|
339
|
+
durationMicros: Type.TInteger;
|
|
340
|
+
outcome: Type.TUnion<[Type.TLiteral<"success">, Type.TLiteral<"failure">]>;
|
|
341
|
+
errorCode: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
342
|
+
stage: Type.TUnion<[Type.TLiteral<"execution">, Type.TLiteral<"admission">]>;
|
|
343
|
+
version: Type.TString;
|
|
344
|
+
effect: Type.TUnion<[Type.TUnion<[Type.TLiteral<"read">, Type.TLiteral<"write">, Type.TLiteral<"delete">]>, Type.TNull]>;
|
|
345
|
+
scopes: Type.TArray<Type.TString>;
|
|
346
|
+
visibility: Type.TUnion<[Type.TUnion<[Type.TLiteral<"public">, Type.TLiteral<"internal">]>, Type.TNull]>;
|
|
347
|
+
httpMethod: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
348
|
+
httpPath: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
349
|
+
mcpTool: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
350
|
+
rpcCaller: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
351
|
+
clientId: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
352
|
+
clientClass: Type.TUnion<[Type.TUnion<[Type.TLiteral<"human">, Type.TLiteral<"machine">, Type.TLiteral<"dcr">]>, Type.TNull]>;
|
|
353
|
+
grantedScopes: Type.TUnion<[Type.TArray<Type.TString>, Type.TNull]>;
|
|
354
|
+
userAgent: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
355
|
+
tokenSha256: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
356
|
+
dimensions: Type.TRecord<"^.*$", Type.TString>;
|
|
357
|
+
startedAt: Type.TInteger;
|
|
358
|
+
admissionMicros: Type.TInteger;
|
|
359
|
+
input: Type.TUnknown;
|
|
360
|
+
output: Type.TUnknown;
|
|
361
|
+
failureData: Type.TUnknown;
|
|
362
|
+
payloadRef: Type.TUnion<[Type.TObject<{
|
|
363
|
+
$ref: Type.TString;
|
|
364
|
+
bytes: Type.TInteger;
|
|
365
|
+
sha256: Type.TString;
|
|
366
|
+
}>, Type.TNull]>;
|
|
367
|
+
}>;
|
|
368
|
+
/** One capture record. */
|
|
369
|
+
type CaptureRecord = Static<typeof CaptureRecordSchema>;
|
|
336
370
|
/**
|
|
337
371
|
* OAuth protected-resource metadata (RFC 9728): the resources an application publishes and the document
|
|
338
372
|
* that describes each one.
|
|
@@ -371,11 +405,11 @@ declare function protectedResourceMetadata<E>(resource: OAuthResource<E>, env: E
|
|
|
371
405
|
* Who calls, as every operation receives it: the actor, its kind, its verified organization and the request
|
|
372
406
|
* id.
|
|
373
407
|
*/
|
|
374
|
-
declare const PrincipalSchema:
|
|
375
|
-
actorId:
|
|
376
|
-
actorKind:
|
|
377
|
-
organizationId:
|
|
378
|
-
requestId:
|
|
408
|
+
declare const PrincipalSchema: Type.TObject<{
|
|
409
|
+
actorId: Type.TString;
|
|
410
|
+
actorKind: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"service">]>;
|
|
411
|
+
organizationId: Type.TString;
|
|
412
|
+
requestId: Type.TString;
|
|
379
413
|
}>;
|
|
380
414
|
/** Who calls: the actor, its kind, its organization and the request id. */
|
|
381
415
|
type Principal = Static<typeof PrincipalSchema>;
|
|
@@ -383,9 +417,9 @@ type Principal = Static<typeof PrincipalSchema>;
|
|
|
383
417
|
* The OAuth client a token was issued to: its id and its class, `human`, `machine` or `dcr` (a dynamically
|
|
384
418
|
* registered client).
|
|
385
419
|
*/
|
|
386
|
-
declare const TokenClientSchema:
|
|
387
|
-
id:
|
|
388
|
-
class:
|
|
420
|
+
declare const TokenClientSchema: Type.TObject<{
|
|
421
|
+
id: Type.TString;
|
|
422
|
+
class: Type.TUnion<[Type.TLiteral<"human">, Type.TLiteral<"machine">, Type.TLiteral<"dcr">]>;
|
|
389
423
|
}>;
|
|
390
424
|
/** The OAuth client a token was issued to. */
|
|
391
425
|
type TokenClient = Static<typeof TokenClientSchema>;
|
|
@@ -393,19 +427,30 @@ type TokenClient = Static<typeof TokenClientSchema>;
|
|
|
393
427
|
* What a verified token grants: the principal without a request id, its scopes and, for an OAuth token, its
|
|
394
428
|
* client. A custom `tokens.resolve` returns this shape.
|
|
395
429
|
*/
|
|
396
|
-
declare const TokenPrincipalSchema:
|
|
397
|
-
actorId:
|
|
398
|
-
actorKind:
|
|
399
|
-
organizationId:
|
|
400
|
-
scopes:
|
|
430
|
+
declare const TokenPrincipalSchema: Type.TObject<{
|
|
431
|
+
actorId: Type.TString;
|
|
432
|
+
actorKind: Type.TUnion<[Type.TLiteral<"user">, Type.TLiteral<"service">]>;
|
|
433
|
+
organizationId: Type.TString;
|
|
434
|
+
scopes: Type.TArray<Type.TString>;
|
|
401
435
|
/** Custom resolvers must classify DCR from verified application policy, never request headers. */
|
|
402
|
-
client:
|
|
403
|
-
id:
|
|
404
|
-
class:
|
|
436
|
+
client: Type.TOptional<Type.TObject<{
|
|
437
|
+
id: Type.TString;
|
|
438
|
+
class: Type.TUnion<[Type.TLiteral<"human">, Type.TLiteral<"machine">, Type.TLiteral<"dcr">]>;
|
|
405
439
|
}>>;
|
|
406
440
|
}>;
|
|
407
441
|
/** What a verified token grants. */
|
|
408
442
|
type TokenPrincipal = Static<typeof TokenPrincipalSchema>;
|
|
443
|
+
/**
|
|
444
|
+
* Scope names and matching: the namespaced form every scope takes, and whether granted scopes admit a
|
|
445
|
+
* request.
|
|
446
|
+
*/
|
|
447
|
+
/** Whether a caller needs any one of several scopes (`any`, the default) or all of them. */
|
|
448
|
+
type ScopeMatch = 'any' | 'all';
|
|
449
|
+
/**
|
|
450
|
+
* Whether granted scopes admit a requirement: any one of the required scopes, or all of them with `all`.
|
|
451
|
+
* An empty requirement admits nobody.
|
|
452
|
+
*/
|
|
453
|
+
declare function matchesScopes(required: readonly string[], granted: readonly string[], match?: ScopeMatch): boolean;
|
|
409
454
|
/**
|
|
410
455
|
* How callers obtain and present the access token, as published in OpenAPI
|
|
411
456
|
* and OAuth discovery.
|
|
@@ -797,6 +842,173 @@ declare function recordExecution<E>(manifest: {
|
|
|
797
842
|
started: number;
|
|
798
843
|
result: Result<unknown, Failure>;
|
|
799
844
|
}): void;
|
|
845
|
+
/**
|
|
846
|
+
* What a transport knows of one call beyond its principal and token, and where execution leaves what the
|
|
847
|
+
* recording points read once the call has answered.
|
|
848
|
+
*/
|
|
849
|
+
interface ExecutionCall {
|
|
850
|
+
/** Over native RPC, the caller admission checked: `Invocation.rpcCaller`. */
|
|
851
|
+
readonly rpcCaller?: string;
|
|
852
|
+
/** On HTTP and MCP, the request's user agent: `Invocation.userAgent`. */
|
|
853
|
+
readonly userAgent?: string;
|
|
854
|
+
/** The task the call runs as, which only the task store sets: `Invocation.taskId`. */
|
|
855
|
+
readonly taskId?: string;
|
|
856
|
+
/** Set once the input is admitted: what its schema checked, and the decoded value the handler receives. */
|
|
857
|
+
admitted?: {
|
|
858
|
+
readonly checked: unknown;
|
|
859
|
+
readonly decoded: unknown;
|
|
860
|
+
};
|
|
861
|
+
/** Set once preparation answers: the context the handler receives. */
|
|
862
|
+
context?: unknown;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* The execution path every transport shares: checks that the caller may run the operation (its scopes when
|
|
866
|
+
* `authority` is given, its actor kind, and `authority` itself when the operation has conditional scopes),
|
|
867
|
+
* decodes the input, prepares the context, runs the middleware and the handler, then checks the result
|
|
868
|
+
* against the catalog, the declared failures, the output schema and the output limit. A refused caller
|
|
869
|
+
* answers `FORBIDDEN` and a refused input `INVALID_INPUT`. An unexpected error becomes `INTERNAL_ERROR`,
|
|
870
|
+
* reported while telemetry is on, and is never thrown. `call` hands the admitted input and the prepared context
|
|
871
|
+
* to the recording points, which only the Result would otherwise reach.
|
|
872
|
+
*/
|
|
873
|
+
declare function executeOperation<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>, operation: OperationShape, env: E, principal: Principal, input: unknown, authority?: InvocationAuthority, background?: BackgroundContext, body?: BinaryBody, call?: ExecutionCall): Promise<Result<unknown, Failure>>;
|
|
874
|
+
/** What a context is read as unless `defineCapture` names its type. */
|
|
875
|
+
type AnyContext = Record<string, any>;
|
|
876
|
+
/**
|
|
877
|
+
* What a `dimensions` callback learns of a call. It belongs to that call: read what it already knows, and start
|
|
878
|
+
* nothing.
|
|
879
|
+
*/
|
|
880
|
+
interface CaptureInvocation<E, C = AnyContext> {
|
|
881
|
+
/** The Worker's bindings. */
|
|
882
|
+
readonly env: E;
|
|
883
|
+
/** The operation's name; null when a refusal names none. */
|
|
884
|
+
readonly operation: string | null;
|
|
885
|
+
/** The transport that admitted the call. */
|
|
886
|
+
readonly surface: CaptureRecord['surface'];
|
|
887
|
+
/** The verified caller; null when the refusal came before it was verified. */
|
|
888
|
+
readonly principal: Principal | null;
|
|
889
|
+
/** What admission verified about the token, without the token. Absent as `Invocation.authority` is. */
|
|
890
|
+
readonly authority?: Omit<InvocationAuthority, 'token'>;
|
|
891
|
+
/** Over RPC, the caller admission checked. */
|
|
892
|
+
readonly rpcCaller?: string;
|
|
893
|
+
/** On HTTP and MCP, the request's user agent. What the caller claims. */
|
|
894
|
+
readonly userAgent?: string;
|
|
895
|
+
/** What the handler received, when the call got that far; empty before its context was prepared. */
|
|
896
|
+
readonly context: Partial<C>;
|
|
897
|
+
/** The decoded input, secrets included, for the callback to read ids from; absent for a refused input. */
|
|
898
|
+
readonly input?: unknown;
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* What a call is about, in the service's own words: `{ agentId, conversationId }`. Each value is an identifier
|
|
902
|
+
* of up to 256 characters that the record may carry; any other value is left out.
|
|
903
|
+
*/
|
|
904
|
+
type CaptureDimensions = Readonly<Record<string, string | null | undefined>>;
|
|
905
|
+
/** Where records go. */
|
|
906
|
+
interface CaptureSink<E> {
|
|
907
|
+
/**
|
|
908
|
+
* Keeps one record; a rejection is a failed delivery. Capture itself never retries: a sink retries what it
|
|
909
|
+
* can safely repeat, as `pipeline` does, and one that cannot, an append whose outcome may be lost, does not.
|
|
910
|
+
*/
|
|
911
|
+
send: (record: CaptureRecord, env: E) => Promise<unknown>;
|
|
912
|
+
/**
|
|
913
|
+
* Whether this env can take records at all, such as a binding that exists in production and not in a preview.
|
|
914
|
+
* When it answers false, the call builds no record and logs nothing. Always when omitted.
|
|
915
|
+
*/
|
|
916
|
+
available?: (env: E) => boolean;
|
|
917
|
+
}
|
|
918
|
+
/** What a project's `capture.ts` declares, and what `maximus()` takes as `capture`. */
|
|
919
|
+
interface CaptureConfig<E = unknown, C = AnyContext> {
|
|
920
|
+
/**
|
|
921
|
+
* Whether calls are captured: a boolean, or a function that decides for each env; on by default. It is apart
|
|
922
|
+
* from `telemetry.enabled`. A function that throws turns capture off for that call and logs
|
|
923
|
+
* `maximus.capture.switch_failed`.
|
|
924
|
+
*/
|
|
925
|
+
enabled?: boolean | ((env: E) => boolean);
|
|
926
|
+
/** Where records go. */
|
|
927
|
+
sink: CaptureSink<E>;
|
|
928
|
+
/**
|
|
929
|
+
* `all` also records each decoded input, checked output and failure data, without what their schemas mark
|
|
930
|
+
* `secret: true`; `none`, the default, records the metadata alone.
|
|
931
|
+
*/
|
|
932
|
+
payloads?: 'all' | 'none';
|
|
933
|
+
/**
|
|
934
|
+
* What the call is about, as `record.dimensions`. It runs as background work, and one that throws leaves the
|
|
935
|
+
* record without dimensions and logs `maximus.capture.dimensions_failed`.
|
|
936
|
+
*/
|
|
937
|
+
dimensions?: (invocation: CaptureInvocation<E, C>) => CaptureDimensions;
|
|
938
|
+
}
|
|
939
|
+
/** What a recording point reads of the application. */
|
|
940
|
+
interface CaptureApplication<E> {
|
|
941
|
+
name: string;
|
|
942
|
+
version: string;
|
|
943
|
+
operations: Readonly<Record<string, OperationShape>>;
|
|
944
|
+
errors: ErrorCatalog;
|
|
945
|
+
capture?: CaptureConfig<E>;
|
|
946
|
+
telemetry?: TelemetryConfig<E>;
|
|
947
|
+
}
|
|
948
|
+
/** What admission verified about a token, once it has. */
|
|
949
|
+
interface VerifiedCaller {
|
|
950
|
+
/** The scopes the token grants. */
|
|
951
|
+
readonly scopes: readonly string[];
|
|
952
|
+
/** The OAuth client it was issued to, when it names one. */
|
|
953
|
+
readonly client?: TokenClient;
|
|
954
|
+
/** The token as presented, which only its digest leaves this module as. */
|
|
955
|
+
readonly token?: string;
|
|
956
|
+
}
|
|
957
|
+
/** One call, or one refusal, as a transport hands it to `recordCapture`. */
|
|
958
|
+
interface CapturedCall {
|
|
959
|
+
/** The operation's name; null when a refusal names none. */
|
|
960
|
+
operation: string | null;
|
|
961
|
+
/** The transport that admitted the call. */
|
|
962
|
+
surface: CaptureRecord['surface'];
|
|
963
|
+
/** The request's id. */
|
|
964
|
+
requestId: string;
|
|
965
|
+
/** The verified caller; null before it was verified. */
|
|
966
|
+
principal: Principal | null;
|
|
967
|
+
/** What admission verified about the token; absent before it did, and over RPC. */
|
|
968
|
+
verified?: VerifiedCaller;
|
|
969
|
+
/** A `performance.now()` reading when the transport began admitting the call. */
|
|
970
|
+
requestStarted: number;
|
|
971
|
+
/** A `performance.now()` reading when execution began; absent for a refusal before it. */
|
|
972
|
+
executionStarted?: number;
|
|
973
|
+
/** What the caller received. */
|
|
974
|
+
result: Result<unknown, Failure>;
|
|
975
|
+
/** What the transport knows of the call beyond this, and what execution left for the record. */
|
|
976
|
+
call?: ExecutionCall;
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Captures one call beside `recordExecution` or `recordAdmission`, as background work: it never throws, never
|
|
980
|
+
* delays or changes the response and never affects an observer. A failed delivery logs
|
|
981
|
+
* `maximus.capture.delivery_failed` with the request id alone. Nothing is recorded without a background context,
|
|
982
|
+
* or while capture is off, whether telemetry is on or not.
|
|
983
|
+
*/
|
|
984
|
+
declare function recordCapture<E>(application: CaptureApplication<E>, env: E, background: BackgroundContext | undefined, captured: CapturedCall): void;
|
|
985
|
+
/**
|
|
986
|
+
* A schema's JSON Schema keywords, as Maximus reads them to publish, route and check a contract. TypeBox 1.x
|
|
987
|
+
* types a schema without its options, so a service reads one through this view:
|
|
988
|
+
* `(schema as SchemaKeywords).pattern`.
|
|
989
|
+
*/
|
|
990
|
+
interface SchemaKeywords extends TSchema {
|
|
991
|
+
$id?: string;
|
|
992
|
+
type?: string | string[];
|
|
993
|
+
description?: string;
|
|
994
|
+
default?: unknown;
|
|
995
|
+
properties?: Record<string, SchemaKeywords>;
|
|
996
|
+
required?: string[];
|
|
997
|
+
additionalProperties?: boolean | SchemaKeywords;
|
|
998
|
+
patternProperties?: Record<string, SchemaKeywords>;
|
|
999
|
+
items?: SchemaKeywords | SchemaKeywords[];
|
|
1000
|
+
anyOf?: SchemaKeywords[];
|
|
1001
|
+
allOf?: SchemaKeywords[];
|
|
1002
|
+
oneOf?: SchemaKeywords[];
|
|
1003
|
+
minProperties?: number;
|
|
1004
|
+
maxProperties?: number;
|
|
1005
|
+
$ref?: string;
|
|
1006
|
+
$defs?: Record<string, SchemaKeywords>;
|
|
1007
|
+
pattern?: string;
|
|
1008
|
+
format?: string;
|
|
1009
|
+
minLength?: number;
|
|
1010
|
+
maxLength?: number;
|
|
1011
|
+
}
|
|
800
1012
|
/**
|
|
801
1013
|
* What the transport verified about a call's token, kept apart from the principal: the surface, the granted
|
|
802
1014
|
* scopes, the OAuth client and the token itself. Context preparation and handlers receive a frozen copy.
|
|
@@ -836,10 +1048,25 @@ interface Invocation<Env> {
|
|
|
836
1048
|
* absent over RPC and for a token that names no client.
|
|
837
1049
|
*/
|
|
838
1050
|
readonly authority?: InvocationAuthority;
|
|
1051
|
+
/**
|
|
1052
|
+
* Over native RPC, the `caller` of the Service Binding, which admission checked against the operation's
|
|
1053
|
+
* callers; absent on HTTP and MCP.
|
|
1054
|
+
*/
|
|
1055
|
+
readonly rpcCaller?: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* On HTTP and MCP, the request's `user-agent`, cut to 200 characters; absent over RPC. It is what the caller
|
|
1058
|
+
* claims, for an audit to read: never authorization.
|
|
1059
|
+
*/
|
|
1060
|
+
readonly userAgent?: string;
|
|
839
1061
|
/** The operation's input, decoded and checked once; preparation must neither check it again nor log it. */
|
|
840
1062
|
readonly input?: unknown;
|
|
841
1063
|
/** The name of the operation being called, which the builder sets; never taken from caller input. */
|
|
842
1064
|
readonly operation?: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* The id of the task the call runs as, when it runs as one: the task store sets it, never caller input.
|
|
1067
|
+
* Absent on a call that answers its own result.
|
|
1068
|
+
*/
|
|
1069
|
+
readonly taskId?: string;
|
|
843
1070
|
/**
|
|
844
1071
|
* Where the call keeps best-effort work running after its answer, the runtime's `waitUntil`; absent when
|
|
845
1072
|
* the runtime gives none.
|
|
@@ -923,6 +1150,16 @@ interface Exposure {
|
|
|
923
1150
|
rpc?: true | {
|
|
924
1151
|
callers: readonly string[];
|
|
925
1152
|
};
|
|
1153
|
+
/**
|
|
1154
|
+
* Whether a call that outlasts a short wait may answer a task instead of its result: over MCP when the client
|
|
1155
|
+
* declares the Tasks extension, over HTTP when it sends `Prefer: respond-async`. The work then goes on in the
|
|
1156
|
+
* `MAXIMUS_TASKS` task store, at most once; without that binding the operation always answers its result.
|
|
1157
|
+
* `{ ttlMs }` keeps the task and its result for that long after the call, instead of an hour.
|
|
1158
|
+
*/
|
|
1159
|
+
task?: true | {
|
|
1160
|
+
/** How long the task and its result are kept after the call, in milliseconds, at most a day. */
|
|
1161
|
+
ttlMs: number;
|
|
1162
|
+
};
|
|
926
1163
|
}
|
|
927
1164
|
/**
|
|
928
1165
|
* An operation as an application holds it: its scope, words, effect, schemas, limits, exposure and handler.
|
|
@@ -1018,7 +1255,7 @@ type OperationContext<C, X> = C & (X extends {
|
|
|
1018
1255
|
body: BinaryBody;
|
|
1019
1256
|
} : object);
|
|
1020
1257
|
/** An operation's handler: the prepared context and the decoded input in, a Result of its output out. */
|
|
1021
|
-
type OperationHandler<C, I extends TSchema, O extends TSchema, X> = (context: OperationContext<C, X>, input: StaticDecode
|
|
1258
|
+
type OperationHandler<C, I extends TSchema, O extends TSchema, X> = (context: OperationContext<C, X>, input: StaticDecode<I>) => Promise<Result<Static<O>, Failure>>;
|
|
1022
1259
|
/**
|
|
1023
1260
|
* Declares one operation on its own, keeping its literal types. The builder's `.operation()` is the usual way
|
|
1024
1261
|
* to declare one. As there, `execute` receives the decoded input, `StaticDecode<typeof input>`.
|
|
@@ -1147,6 +1384,11 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
|
|
|
1147
1384
|
* where the trace id comes from.
|
|
1148
1385
|
*/
|
|
1149
1386
|
telemetry?: TelemetryConfig<Env>;
|
|
1387
|
+
/**
|
|
1388
|
+
* One complete record of every operation call and refusal for a store the application declares, apart from
|
|
1389
|
+
* telemetry: `defineCapture` from `@arbol-ai/maximus/capture`.
|
|
1390
|
+
*/
|
|
1391
|
+
capture?: CaptureConfig<Env>;
|
|
1150
1392
|
/**
|
|
1151
1393
|
* A Workers rate limiting binding each HTTP and MCP call must pass, per organization and actor; each
|
|
1152
1394
|
* message of an MCP batch counts as a call. A refusal answers `RATE_LIMITED`.
|
|
@@ -1166,6 +1408,128 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
|
|
|
1166
1408
|
/** The MCP server's instructions, guides and skills; setting it requires the MCP transport. */
|
|
1167
1409
|
mcp?: McpConfiguration;
|
|
1168
1410
|
}
|
|
1411
|
+
/** A task as the store keeps it: the call it runs, as whom, and how it ended; never its input. */
|
|
1412
|
+
interface TaskRecord {
|
|
1413
|
+
/** The application's namespace, a dot, and a random UUID, so a gateway can tell whose task it is. */
|
|
1414
|
+
taskId: string;
|
|
1415
|
+
operation: string;
|
|
1416
|
+
principal: Principal;
|
|
1417
|
+
/** The verified authority of the call, without its bearer token, which is never stored. */
|
|
1418
|
+
authority?: Omit<InvocationAuthority, 'token'>;
|
|
1419
|
+
status: 'working' | 'completed' | 'failed' | 'cancelled';
|
|
1420
|
+
/** Set before the work runs, so a task found started but still working is never run again. */
|
|
1421
|
+
started: boolean;
|
|
1422
|
+
result?: Result<unknown, Failure>;
|
|
1423
|
+
createdAt: number;
|
|
1424
|
+
lastUpdatedAt: number;
|
|
1425
|
+
/** How long after `createdAt` the task and its result are kept. */
|
|
1426
|
+
ttlMs: number;
|
|
1427
|
+
}
|
|
1428
|
+
/** The task store's methods, as the Worker calls the Durable Object that keeps one task. */
|
|
1429
|
+
interface TaskStore {
|
|
1430
|
+
/** Keeps the task, runs it with `input`, which stays in memory, and answers it once settled or after `waitMs`. */
|
|
1431
|
+
run: (task: TaskRecord, input: unknown, waitMs: number) => Promise<TaskRecord>;
|
|
1432
|
+
get: (taskId: string, principal: Principal) => Promise<TaskRecord | undefined>;
|
|
1433
|
+
cancel: (taskId: string, principal: Principal) => Promise<TaskRecord | undefined>;
|
|
1434
|
+
}
|
|
1435
|
+
/** One caller's tasks: start one of the application's operations as a task, read one, or cancel one. */
|
|
1436
|
+
interface TaskAccess {
|
|
1437
|
+
start: (operation: string, input: unknown) => Promise<TaskRecord>;
|
|
1438
|
+
get: (taskId: string) => Promise<TaskRecord | undefined>;
|
|
1439
|
+
cancel: (taskId: string) => Promise<TaskRecord | undefined>;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* `getOperationTask`, `GET /v1/operation-tasks/{taskId}`, which reads a task the caller started, and
|
|
1443
|
+
* `cancelOperationTask`, `POST /v1/operation-tasks/{taskId}/cancel`, which cancels one that has not started
|
|
1444
|
+
* running: names and paths no resource of a service uses. Either admits any scope of the task operations;
|
|
1445
|
+
* someone else's task, or an unknown or expired one, is `INVALID_INPUT` at `/taskId`, their only failure
|
|
1446
|
+
* besides admission's.
|
|
1447
|
+
*/
|
|
1448
|
+
declare function taskOperations(scope: readonly [string, ...string[]], application: {
|
|
1449
|
+
namespace: string;
|
|
1450
|
+
operations: Record<string, OperationShape>;
|
|
1451
|
+
}): {
|
|
1452
|
+
getOperationTask: {
|
|
1453
|
+
scope: readonly [string, ...string[]];
|
|
1454
|
+
group: string;
|
|
1455
|
+
failures: never[];
|
|
1456
|
+
input: Type.TObject<{
|
|
1457
|
+
taskId: Type.TString;
|
|
1458
|
+
}>;
|
|
1459
|
+
output: Type.TObject<{
|
|
1460
|
+
taskId: Type.TString;
|
|
1461
|
+
status: Type.TUnion<[Type.TLiteral<"working">, Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"cancelled">]>;
|
|
1462
|
+
createdAt: Type.TString;
|
|
1463
|
+
lastUpdatedAt: Type.TString;
|
|
1464
|
+
ttlMs: Type.TInteger;
|
|
1465
|
+
pollIntervalMs: Type.TInteger;
|
|
1466
|
+
result: Type.TOptional<Type.TUnknown>;
|
|
1467
|
+
error: Type.TOptional<Type.TWith<Type.TObject<{
|
|
1468
|
+
code: Type.TString;
|
|
1469
|
+
message: Type.TString;
|
|
1470
|
+
retryable: Type.TBoolean;
|
|
1471
|
+
data: Type.TObject<{}>;
|
|
1472
|
+
}>, {
|
|
1473
|
+
readonly description: "The operation's failure, once failed.";
|
|
1474
|
+
}>>;
|
|
1475
|
+
}>;
|
|
1476
|
+
pipeline: {
|
|
1477
|
+
context: (invocation: never) => Promise<Success<never>>;
|
|
1478
|
+
middleware: never[];
|
|
1479
|
+
};
|
|
1480
|
+
title: string;
|
|
1481
|
+
description: string;
|
|
1482
|
+
effect: 'read';
|
|
1483
|
+
http: {
|
|
1484
|
+
method: 'GET';
|
|
1485
|
+
path: string;
|
|
1486
|
+
};
|
|
1487
|
+
execute: OperationShape['execute'];
|
|
1488
|
+
};
|
|
1489
|
+
cancelOperationTask: {
|
|
1490
|
+
scope: readonly [string, ...string[]];
|
|
1491
|
+
group: string;
|
|
1492
|
+
failures: never[];
|
|
1493
|
+
input: Type.TObject<{
|
|
1494
|
+
taskId: Type.TString;
|
|
1495
|
+
}>;
|
|
1496
|
+
output: Type.TObject<{
|
|
1497
|
+
taskId: Type.TString;
|
|
1498
|
+
status: Type.TUnion<[Type.TLiteral<"working">, Type.TLiteral<"completed">, Type.TLiteral<"failed">, Type.TLiteral<"cancelled">]>;
|
|
1499
|
+
createdAt: Type.TString;
|
|
1500
|
+
lastUpdatedAt: Type.TString;
|
|
1501
|
+
ttlMs: Type.TInteger;
|
|
1502
|
+
pollIntervalMs: Type.TInteger;
|
|
1503
|
+
result: Type.TOptional<Type.TUnknown>;
|
|
1504
|
+
error: Type.TOptional<Type.TWith<Type.TObject<{
|
|
1505
|
+
code: Type.TString;
|
|
1506
|
+
message: Type.TString;
|
|
1507
|
+
retryable: Type.TBoolean;
|
|
1508
|
+
data: Type.TObject<{}>;
|
|
1509
|
+
}>, {
|
|
1510
|
+
readonly description: "The operation's failure, once failed.";
|
|
1511
|
+
}>>;
|
|
1512
|
+
}>;
|
|
1513
|
+
pipeline: {
|
|
1514
|
+
context: (invocation: never) => Promise<Success<never>>;
|
|
1515
|
+
middleware: never[];
|
|
1516
|
+
};
|
|
1517
|
+
title: string;
|
|
1518
|
+
description: string;
|
|
1519
|
+
effect: 'write';
|
|
1520
|
+
http: {
|
|
1521
|
+
method: 'POST';
|
|
1522
|
+
path: string;
|
|
1523
|
+
};
|
|
1524
|
+
execute: OperationShape['execute'];
|
|
1525
|
+
};
|
|
1526
|
+
};
|
|
1527
|
+
/** The operations `.build()` adds once an operation declares `task`: `getOperationTask` and `cancelOperationTask`. */
|
|
1528
|
+
type TaskOperations = ReturnType<typeof taskOperations>;
|
|
1529
|
+
/** An application's operations, with the task operations when one of them declares `task`. */
|
|
1530
|
+
type WithTaskOperations<Ops> = true extends { [K in keyof Ops]: Ops[K] extends {
|
|
1531
|
+
task: NonNullable<OperationShape['task']>;
|
|
1532
|
+
} ? true : false; }[keyof Ops] ? Ops & TaskOperations : Ops;
|
|
1169
1533
|
/**
|
|
1170
1534
|
* What `maximus()` takes: the application without its operations, context and middleware, which the builder
|
|
1171
1535
|
* adds.
|
|
@@ -1226,7 +1590,7 @@ declare class ApplicationBuilder<E, C, Ops extends Record<string, OperationShape
|
|
|
1226
1590
|
* Checks every rule the application must keep and returns it. A refusal is a TypeError whose message names
|
|
1227
1591
|
* the rule; most of the rules about one operation also name that operation.
|
|
1228
1592
|
*/
|
|
1229
|
-
build(): AppManifest<E, C, Ops
|
|
1593
|
+
build(): AppManifest<E, C, WithTaskOperations<Ops>>;
|
|
1230
1594
|
}
|
|
1231
1595
|
/**
|
|
1232
1596
|
* Starts an application: its name, scope namespace, title, version, origin, token policy, error catalog and
|
|
@@ -1393,10 +1757,19 @@ declare class Failed<Code extends string = string> {
|
|
|
1393
1757
|
}
|
|
1394
1758
|
/** Answers a failure of the catalog by its code, with the data the code declares. */
|
|
1395
1759
|
type Fail<Codes extends string> = <const Code extends Codes>(code: Code, ...data: FailureArguments<Code>) => Failed<Code>;
|
|
1760
|
+
/**
|
|
1761
|
+
* A TypeBox type rather than a record of fields: TypeBox marks every type it builds with a hidden kind, and
|
|
1762
|
+
* `Type.Unsafe` its own. Every object is a `TSchema`, so the marks are what tell the two apart.
|
|
1763
|
+
*/
|
|
1764
|
+
type TypeBoxType = {
|
|
1765
|
+
readonly '~kind': string;
|
|
1766
|
+
} | {
|
|
1767
|
+
readonly '~unsafe': unknown;
|
|
1768
|
+
};
|
|
1396
1769
|
/** A schema, or the fields of a strict object schema. */
|
|
1397
1770
|
type SchemaOrFields = TSchema | TProperties;
|
|
1398
1771
|
/** The schema `input` or `output` stands for: itself, or the strict object of its fields. */
|
|
1399
|
-
type SchemaOf<S> = S extends
|
|
1772
|
+
type SchemaOf<S> = S extends TypeBoxType ? S : S extends TProperties ? TObject<S> : never;
|
|
1400
1773
|
/** A field a declaration names, or none when it leaves the field out (its type parameter stays `never`). */
|
|
1401
1774
|
type Field<K extends string, T> = [T] extends [never] ? unknown : Record<K, T>;
|
|
1402
1775
|
/**
|
|
@@ -1418,7 +1791,7 @@ interface RouteBody {
|
|
|
1418
1791
|
/** What a handler receives: the prepared context, its decoded input, `fail` and, for a byte body, its reader. */
|
|
1419
1792
|
type HandlerArguments<C, I extends TSchema, X> = Omit<C, 'input' | 'body'> & {
|
|
1420
1793
|
/** The input, decoded against its schema. */
|
|
1421
|
-
readonly input: StaticDecode
|
|
1794
|
+
readonly input: StaticDecode<I>;
|
|
1422
1795
|
/** Answers a failure of the catalog: `return fail('TASK_NOT_FOUND')`. */
|
|
1423
1796
|
readonly fail: Fail<AllowedCode<X>>;
|
|
1424
1797
|
} & (X extends {
|
|
@@ -1515,6 +1888,8 @@ interface HandlerOptions {
|
|
|
1515
1888
|
mcp?: HandlerMcp;
|
|
1516
1889
|
/** Also serve it as a native RPC method, to every allowed caller or to the listed ones. */
|
|
1517
1890
|
rpc?: Exposure['rpc'];
|
|
1891
|
+
/** `true`, or `{ ttlMs }`: a call that outlasts one second may answer a task instead of its result. */
|
|
1892
|
+
task?: Exposure['task'];
|
|
1518
1893
|
/**
|
|
1519
1894
|
* The largest request body it accepts, in bytes: its JSON body, or its byte body. By default, the
|
|
1520
1895
|
* application's limit.
|
|
@@ -1652,9 +2027,7 @@ declare function defineTelemetry(telemetry: TelemetryConfig<RegisteredEnv>): Tel
|
|
|
1652
2027
|
*/
|
|
1653
2028
|
declare function parseInput<Schema extends TSchema>(schema: Schema, input: unknown): {
|
|
1654
2029
|
ok: true;
|
|
1655
|
-
value:
|
|
1656
|
-
params: [];
|
|
1657
|
-
})["static"];
|
|
2030
|
+
value: Static<Schema>;
|
|
1658
2031
|
error?: undefined;
|
|
1659
2032
|
} | {
|
|
1660
2033
|
value?: undefined;
|
|
@@ -1670,11 +2043,11 @@ declare function parseInput<Schema extends TSchema>(schema: Schema, input: unkno
|
|
|
1670
2043
|
declare function parseSchema<Schema extends TSchema>(schema: Schema, input: unknown): Static<Schema>;
|
|
1671
2044
|
/**
|
|
1672
2045
|
* Decodes input against its schema: admits only a bounded plain JSON tree, applies the declared defaults to a
|
|
1673
|
-
* copy, checks it and runs its codecs. Throws a `SchemaValidationError` (or TypeBox's
|
|
1674
|
-
* input is refused, and whatever an owner codec throws otherwise. Output is checked,
|
|
1675
|
-
* handler returns must already be canonical.
|
|
2046
|
+
* copy, checks it, refinements included, and runs its codecs. Throws a `SchemaValidationError` (or TypeBox's
|
|
2047
|
+
* assertion error) when the input is refused, and whatever an owner codec throws otherwise. Output is checked,
|
|
2048
|
+
* never decoded: what a handler returns must already be canonical.
|
|
1676
2049
|
*/
|
|
1677
|
-
declare function decodeSchema<Schema extends TSchema>(schema: Schema, input: unknown): StaticDecode
|
|
2050
|
+
declare function decodeSchema<Schema extends TSchema>(schema: Schema, input: unknown): StaticDecode<Schema>;
|
|
1678
2051
|
/** Field issues a refusal carries: enough to correct the input, never an input value. */
|
|
1679
2052
|
interface InputIssue {
|
|
1680
2053
|
/** RFC 6901 JSON Pointer to the refused field; empty for the whole input. */
|
|
@@ -1688,6 +2061,9 @@ interface InputIssue {
|
|
|
1688
2061
|
* error that refuses nothing, is thrown for the caller to report: it is the server's failure, not the input's.
|
|
1689
2062
|
*/
|
|
1690
2063
|
declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unknown): {
|
|
2064
|
+
ok: true;
|
|
2065
|
+
value: StaticDecode<Schema>;
|
|
2066
|
+
} | {
|
|
1691
2067
|
value?: undefined;
|
|
1692
2068
|
ok: false;
|
|
1693
2069
|
error: {
|
|
@@ -1698,11 +2074,26 @@ declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unkn
|
|
|
1698
2074
|
issues: InputIssue[];
|
|
1699
2075
|
};
|
|
1700
2076
|
};
|
|
1701
|
-
|
|
1702
|
-
error?: undefined;
|
|
1703
|
-
ok: true;
|
|
1704
|
-
value: StaticDecode$1<Schema>;
|
|
2077
|
+
checked?: undefined;
|
|
1705
2078
|
};
|
|
2079
|
+
/**
|
|
2080
|
+
* One refused field: a code, a message that names the expectation and never the value, and the path to the
|
|
2081
|
+
* field.
|
|
2082
|
+
*/
|
|
2083
|
+
interface SchemaIssue {
|
|
2084
|
+
/** The kind of issue, such as `invalid_input` for a schema mismatch or `custom` for a refinement. */
|
|
2085
|
+
code: string;
|
|
2086
|
+
/** Why the field was refused, for people; it names the expectation, never the value. */
|
|
2087
|
+
message: string;
|
|
2088
|
+
/** The keys and array indexes that lead to the refused field; empty when the whole value is refused. */
|
|
2089
|
+
path: (string | number)[];
|
|
2090
|
+
}
|
|
2091
|
+
/** Every issue of a refused value, as `readSchema` throws it and `checkSchema` returns it. */
|
|
2092
|
+
declare class SchemaValidationError extends TypeError {
|
|
2093
|
+
/** Every issue of the refused value; the error's message is the first one's. */
|
|
2094
|
+
readonly issues: SchemaIssue[];
|
|
2095
|
+
constructor(issues: SchemaIssue[]);
|
|
2096
|
+
}
|
|
1706
2097
|
/** Type-only: the key under which a codec's schema type carries its wire type. No schema object has it. */
|
|
1707
2098
|
declare const WIRE: unique symbol;
|
|
1708
2099
|
/**
|
|
@@ -1726,25 +2117,12 @@ type InputKeys<P extends TProperties> = { [K in keyof P]: P[K] extends {
|
|
|
1726
2117
|
*/
|
|
1727
2118
|
type SchemaInput<S extends TSchema, Depth extends unknown[] = []> = Depth['length'] extends 6 ? Static<S> : typeof WIRE extends keyof S ? S extends WireType<infer W> ? W : never : S extends TObject<infer P> ? { [K in Exclude<keyof P, InputKeys<P>>]: SchemaInput<P[K], [...Depth, unknown]>; } & { [K in InputKeys<P>]?: SchemaInput<P[K], [...Depth, unknown]>; } : S extends TArray<infer I> ? SchemaInput<I, [...Depth, unknown]>[] : S extends TUnion<infer U> ? SchemaInput<U[number], [...Depth, unknown]> : Static<S>;
|
|
1728
2119
|
/**
|
|
1729
|
-
*
|
|
1730
|
-
*
|
|
2120
|
+
* The literals of a union, as TypeBox types its members: one per value of a tuple, or for an array of unknown
|
|
2121
|
+
* length one literal of every value it may hold, since TypeBox reads a union's members as a tuple.
|
|
1731
2122
|
*/
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
/** Why the field was refused, for people; it names the expectation, never the value. */
|
|
1736
|
-
message: string;
|
|
1737
|
-
/** The keys and array indexes that lead to the refused field; empty when the whole value is refused. */
|
|
1738
|
-
path: (string | number)[];
|
|
1739
|
-
}
|
|
1740
|
-
/** Every issue of a refused value, as `readSchema` throws it and `checkSchema` returns it. */
|
|
1741
|
-
declare class SchemaValidationError extends TypeError {
|
|
1742
|
-
/** Every issue of the refused value; the error's message is the first one's. */
|
|
1743
|
-
readonly issues: SchemaIssue[];
|
|
1744
|
-
constructor(issues: SchemaIssue[]);
|
|
1745
|
-
}
|
|
1746
|
-
/** A union of literals: `literalUnion(['open', 'done'])`. */
|
|
1747
|
-
declare const literalUnion: <const V extends readonly (string | number | boolean)[]>(values: V) => TUnion<{ -readonly [K in keyof V]: TLiteral<V[K]>; }>;
|
|
2123
|
+
type LiteralMembers<V extends readonly (string | number | boolean)[]> = number extends V['length'] ? [TLiteral<V[number]>] : { -readonly [K in keyof V]: TLiteral<V[K]>; };
|
|
2124
|
+
/** A union of literals: `literalUnion(['open', 'done'])`, or the values of a list, `literalUnion(ids)`. */
|
|
2125
|
+
declare const literalUnion: <const V extends readonly (string | number | boolean)[]>(values: V) => TUnion<LiteralMembers<V>>;
|
|
1748
2126
|
/**
|
|
1749
2127
|
* The schema with a default that decoding applies when the field is absent, so the field is optional on the
|
|
1750
2128
|
* wire.
|
|
@@ -1770,7 +2148,7 @@ declare const extendObject: <P extends TProperties, Q extends TProperties>(schem
|
|
|
1770
2148
|
* `inputSchema()`.
|
|
1771
2149
|
*/
|
|
1772
2150
|
declare const normalizeSchema: <S extends TSchema, O>(schema: S, normalize: (value: Static<S>) => O) => TUnsafe<O> & WireType<SchemaInput<S>> & (S extends TOptional<TSchema> ? {
|
|
1773
|
-
|
|
2151
|
+
'~optional': true;
|
|
1774
2152
|
} : Record<never, never>) & (S extends {
|
|
1775
2153
|
default: infer D;
|
|
1776
2154
|
} ? {
|
|
@@ -1781,7 +2159,7 @@ declare const normalizeSchema: <S extends TSchema, O>(schema: S, normalize: (val
|
|
|
1781
2159
|
* the handler receives what `transform` returns. Runs inside `inputSchema()`.
|
|
1782
2160
|
*/
|
|
1783
2161
|
declare const transformSchema: <S extends TSchema, O>(schema: S, transform: (value: Static<S>) => O) => TUnsafe<O> & WireType<SchemaInput<S>> & (S extends TOptional<TSchema> ? {
|
|
1784
|
-
|
|
2162
|
+
'~optional': true;
|
|
1785
2163
|
} : Record<never, never>) & (S extends {
|
|
1786
2164
|
default: infer D;
|
|
1787
2165
|
} ? {
|
|
@@ -1789,7 +2167,8 @@ declare const transformSchema: <S extends TSchema, O>(schema: S, transform: (val
|
|
|
1789
2167
|
} : Record<never, never>);
|
|
1790
2168
|
/**
|
|
1791
2169
|
* Admits a value as `source`, then checks and decodes the result as `target`: a wire shape read into its
|
|
1792
|
-
* canonical one. Runs inside `inputSchema()`.
|
|
2170
|
+
* canonical one. Runs inside `inputSchema()`. A `target` that marks a field `secret: true` needs `source` to
|
|
2171
|
+
* mark it too, or it throws a TypeError.
|
|
1793
2172
|
*/
|
|
1794
2173
|
declare const pipeSchema: <S extends TSchema, O extends TSchema>(source: S, target: O) => O & WireType<SchemaInput<S>>;
|
|
1795
2174
|
/**
|
|
@@ -1816,7 +2195,7 @@ declare const urlSchema: (options: {
|
|
|
1816
2195
|
protocol: RegExp;
|
|
1817
2196
|
hostname?: RegExp;
|
|
1818
2197
|
maxLength?: number;
|
|
1819
|
-
}) =>
|
|
2198
|
+
}) => Type.TString;
|
|
1820
2199
|
/**
|
|
1821
2200
|
* Compiles a schema's codecs (defaults, normalizers, transforms, inspections, refinements, pipes and
|
|
1822
2201
|
* stripping) into one input schema: the wire accepts `SchemaInput<S>`, and the handler receives the
|
|
@@ -1825,16 +2204,16 @@ declare const urlSchema: (options: {
|
|
|
1825
2204
|
*/
|
|
1826
2205
|
declare function inputSchema<S extends TSchema>(schema: S, options?: {
|
|
1827
2206
|
stripUnknown?: boolean;
|
|
1828
|
-
}):
|
|
2207
|
+
}): TCodec<TUnsafe<SchemaInput<S>>, StaticDecode<S>>;
|
|
1829
2208
|
/** The same, reading another wire shape `wire` and decoding it into `schema`'s canonical type. */
|
|
1830
|
-
declare function inputSchema<S extends TSchema, W extends TSchema>(schema: S, wire: W):
|
|
2209
|
+
declare function inputSchema<S extends TSchema, W extends TSchema>(schema: S, wire: W): TCodec<W, StaticDecode<S>>;
|
|
1831
2210
|
/**
|
|
1832
2211
|
* What `checkSchema` answers: the decoded data, `StaticDecode<S>` (which is `Static<S>` unless `S` holds a
|
|
1833
|
-
* TypeBox
|
|
2212
|
+
* TypeBox codec), or the error that lists every issue.
|
|
1834
2213
|
*/
|
|
1835
2214
|
type Checked<S extends TSchema> = {
|
|
1836
2215
|
success: true;
|
|
1837
|
-
data: StaticDecode
|
|
2216
|
+
data: StaticDecode<S>;
|
|
1838
2217
|
error?: never;
|
|
1839
2218
|
} | {
|
|
1840
2219
|
success: false;
|
|
@@ -1849,15 +2228,27 @@ type Checked<S extends TSchema> = {
|
|
|
1849
2228
|
*/
|
|
1850
2229
|
declare function checkSchema<S extends TSchema>(schema: S, input: unknown): Checked<S>;
|
|
1851
2230
|
/** `checkSchema`, throwing its SchemaValidationError on refusal. */
|
|
1852
|
-
declare function readSchema<S extends TSchema>(schema: S, input: unknown): StaticDecode
|
|
2231
|
+
declare function readSchema<S extends TSchema>(schema: S, input: unknown): StaticDecode<S>;
|
|
2232
|
+
/**
|
|
2233
|
+
* A copy of a value without every field its schema marks with `secret: true`, at any depth: through objects,
|
|
2234
|
+
* records, arrays, tuples, unions, intersections, optional fields and references. The input is never changed.
|
|
2235
|
+
* A marked list element goes with its value, a marked tuple position becomes `null`, and a schema marked at
|
|
2236
|
+
* its root answers `undefined`.
|
|
2237
|
+
*
|
|
2238
|
+
* Pass a value of the shape the schema describes: what it checked, before any codec ran. It fails closed where
|
|
2239
|
+
* a schema cannot speak for a value: a name marked in any member of a union is removed from all of them, a
|
|
2240
|
+
* key a strict object refuses is removed, as is a value of another type, or one under a `$ref` the schema does
|
|
2241
|
+
* not define.
|
|
2242
|
+
*/
|
|
2243
|
+
declare function withoutSecrets(schema: TSchema, value: unknown): unknown;
|
|
1853
2244
|
/**
|
|
1854
2245
|
* How to reach a list's neighboring pages: whether they exist and their opaque cursors, named `PageInfo`.
|
|
1855
2246
|
*/
|
|
1856
2247
|
declare const PageInfoSchema: TObject<{
|
|
1857
|
-
hasNextPage:
|
|
1858
|
-
hasPreviousPage:
|
|
1859
|
-
nextCursor:
|
|
1860
|
-
previousCursor:
|
|
2248
|
+
hasNextPage: Type.TBoolean;
|
|
2249
|
+
hasPreviousPage: Type.TBoolean;
|
|
2250
|
+
nextCursor: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
2251
|
+
previousCursor: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
1861
2252
|
}>;
|
|
1862
2253
|
/** How to reach a list's neighboring pages. */
|
|
1863
2254
|
type PageInfo = Static<typeof PageInfoSchema>;
|
|
@@ -1870,7 +2261,7 @@ type PageInfo = Static<typeof PageInfoSchema>;
|
|
|
1870
2261
|
declare function pageLimit(options?: {
|
|
1871
2262
|
maximum?: number;
|
|
1872
2263
|
default?: number;
|
|
1873
|
-
}):
|
|
2264
|
+
}): Type.TInteger & {
|
|
1874
2265
|
default: number;
|
|
1875
2266
|
};
|
|
1876
2267
|
/**
|
|
@@ -1878,11 +2269,11 @@ declare function pageLimit(options?: {
|
|
|
1878
2269
|
* `direction` (`forward` by default, or `backward`) and a `limit` (`pageLimit()`).
|
|
1879
2270
|
*/
|
|
1880
2271
|
declare const PageQueryFields: {
|
|
1881
|
-
cursor:
|
|
1882
|
-
direction:
|
|
2272
|
+
cursor: Type.TOptional<Type.TString>;
|
|
2273
|
+
direction: Type.TUnion<[TLiteral<"forward">, TLiteral<"backward">]> & {
|
|
1883
2274
|
default: "forward";
|
|
1884
2275
|
};
|
|
1885
|
-
limit:
|
|
2276
|
+
limit: Type.TInteger & {
|
|
1886
2277
|
default: number;
|
|
1887
2278
|
};
|
|
1888
2279
|
};
|
|
@@ -1911,6 +2302,28 @@ interface Page<Item> {
|
|
|
1911
2302
|
declare function Page<Item extends TSchema>(item: Item, options: {
|
|
1912
2303
|
$id: string;
|
|
1913
2304
|
}): TPage<Item>;
|
|
2305
|
+
/** How a list a service holds whole is ordered: by each item's key, compared part by part as text. */
|
|
2306
|
+
interface PageOrder<Item> {
|
|
2307
|
+
/** The values an item sorts by, which together tell it from every other item, such as `[createdAt, id]`. */
|
|
2308
|
+
key: (item: Item) => readonly string[];
|
|
2309
|
+
/** `desc` lists the greatest key first, such as the newest; `asc`, the default, the least. */
|
|
2310
|
+
order?: 'asc' | 'desc';
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* The key of the item a cursor of `cutPage` sits beside, or undefined for text that is not such a cursor: a
|
|
2314
|
+
* service checks with it that a cursor belongs to the list it is asked for before it reads that list.
|
|
2315
|
+
*/
|
|
2316
|
+
declare function cursorKey(cursor: string): readonly string[] | undefined;
|
|
2317
|
+
/**
|
|
2318
|
+
* One page of a list a service holds whole, such as one a provider answers complete. A cursor is a
|
|
2319
|
+
* place between two items, right after one page's last item (`nextCursor`) or right before its first
|
|
2320
|
+
* (`previousCursor`), never an offset: it keeps its meaning while items come and go, the one it names
|
|
2321
|
+
* included. `forward` takes the items after the place and `backward` the ones before it, and both answer in
|
|
2322
|
+
* the list's `ordering`; without a cursor, `forward` starts at the first item and `backward` at the last. A cursor
|
|
2323
|
+
* is null exactly when there is no such page. Undefined when the query's cursor is not one this list made,
|
|
2324
|
+
* including a key of another length, for the service to refuse as it does.
|
|
2325
|
+
*/
|
|
2326
|
+
declare function cutPage<Item>(items: readonly Item[], ordering: PageOrder<Item>, query: PageQuery): Page<Item> | undefined;
|
|
1914
2327
|
/** An email address of at most 254 characters, named `EmailAddress`. */
|
|
1915
2328
|
declare const EmailAddressSchema: TString;
|
|
1916
2329
|
/** A phone number in E.164 format, named `PhoneNumber`. */
|
|
@@ -1920,9 +2333,9 @@ declare const HttpsUrlSchema: TString;
|
|
|
1920
2333
|
/** A `#rrggbb` color, named `HexColor`. */
|
|
1921
2334
|
declare const HexColorSchema: TString;
|
|
1922
2335
|
/** What a delete answers: the deleted resource's id and `deleted: true`, named `DeletedObject`. */
|
|
1923
|
-
declare const DeletedObjectSchema:
|
|
2336
|
+
declare const DeletedObjectSchema: Type.TObject<{
|
|
1924
2337
|
id: TString;
|
|
1925
|
-
deleted:
|
|
2338
|
+
deleted: Type.TLiteral<true>;
|
|
1926
2339
|
}>;
|
|
1927
2340
|
/** What a `delete` answers: the id and `deleted: true`. */
|
|
1928
2341
|
type DeletedObject = Static<typeof DeletedObjectSchema>;
|
|
@@ -1930,14 +2343,14 @@ type DeletedObject = Static<typeof DeletedObjectSchema>;
|
|
|
1930
2343
|
* A link that grants access by itself until it expires, such as a file download: its HTTPS `url` and its
|
|
1931
2344
|
* `expiresAt` date-time, named `SignedUrl`.
|
|
1932
2345
|
*/
|
|
1933
|
-
declare const SignedUrlSchema:
|
|
2346
|
+
declare const SignedUrlSchema: Type.TObject<{
|
|
1934
2347
|
url: TString;
|
|
1935
2348
|
expiresAt: TString;
|
|
1936
2349
|
}>;
|
|
1937
2350
|
/** A URL that grants access by itself, and when it expires. */
|
|
1938
2351
|
type SignedUrl = Static<typeof SignedUrlSchema>;
|
|
1939
2352
|
/** Another resource, by its id and the name people know it by, named `NamedReference`. */
|
|
1940
|
-
declare const NamedReferenceSchema:
|
|
2353
|
+
declare const NamedReferenceSchema: Type.TObject<{
|
|
1941
2354
|
id: TString;
|
|
1942
2355
|
name: TString;
|
|
1943
2356
|
}>;
|
|
@@ -1947,26 +2360,26 @@ type NamedReference = Static<typeof NamedReferenceSchema>;
|
|
|
1947
2360
|
* A postal address, shaped as FHIR `Address` (its lines, city, state, postal code, ISO 3166-1 alpha-2 country
|
|
1948
2361
|
* code and use), every field optional, named `PostalAddress`.
|
|
1949
2362
|
*/
|
|
1950
|
-
declare const PostalAddressSchema:
|
|
1951
|
-
city:
|
|
1952
|
-
countryCode:
|
|
1953
|
-
line:
|
|
1954
|
-
postalCode:
|
|
1955
|
-
state:
|
|
1956
|
-
use:
|
|
2363
|
+
declare const PostalAddressSchema: Type.TObject<{
|
|
2364
|
+
city: Type.TOptional<TString>;
|
|
2365
|
+
countryCode: Type.TOptional<TString>;
|
|
2366
|
+
line: Type.TOptional<Type.TArray<TString>>;
|
|
2367
|
+
postalCode: Type.TOptional<TString>;
|
|
2368
|
+
state: Type.TOptional<TString>;
|
|
2369
|
+
use: Type.TOptional<Type.TUnion<[Type.TLiteral<"home">, Type.TLiteral<"work">]>>;
|
|
1957
2370
|
}>;
|
|
1958
2371
|
/** A postal address, shaped as FHIR `Address`. */
|
|
1959
2372
|
type PostalAddress = Static<typeof PostalAddressSchema>;
|
|
1960
2373
|
/** The input of an operation that takes none: an empty strict object. */
|
|
1961
|
-
declare const EmptyInputSchema:
|
|
2374
|
+
declare const EmptyInputSchema: Type.TObject<{}>;
|
|
1962
2375
|
/**
|
|
1963
2376
|
* An organization id as identity providers issue them (`org_…`, a UUID, a slug): 1 to 128 letters, digits,
|
|
1964
2377
|
* `_` and `-`, starting with a letter or digit, named `OrganizationId`. Nothing in it can change the meaning
|
|
1965
2378
|
* of a storage key, a path or a log line.
|
|
1966
2379
|
*/
|
|
1967
|
-
declare const OrganizationIdSchema:
|
|
2380
|
+
declare const OrganizationIdSchema: Type.TString;
|
|
1968
2381
|
/** A lowercase RFC 9562 UUID of version 1 to 8, named `Uuid`. */
|
|
1969
|
-
declare const UuidSchema:
|
|
2382
|
+
declare const UuidSchema: Type.TString;
|
|
1970
2383
|
/**
|
|
1971
2384
|
* The principal a verified Access application token grants under `policy.access`. A person, whose token
|
|
1972
2385
|
* names them in `sub` and carries no `common_name`, acts as `sub` (never as their email) through a `human`
|
|
@@ -2042,6 +2455,8 @@ interface TransportContext {
|
|
|
2042
2455
|
body: string;
|
|
2043
2456
|
/** The body limit HTTP applies to an operation; a transport holds each invocation to it. */
|
|
2044
2457
|
bodyLimit: (operation: OperationShape) => number;
|
|
2458
|
+
/** The caller's tasks, which an operation that declares `task` may answer; absent without a task store. */
|
|
2459
|
+
tasks?: TaskAccess;
|
|
2045
2460
|
}
|
|
2046
2461
|
/**
|
|
2047
2462
|
* A protocol served at one path beside the operations, such as MCP: the scope a caller needs, the body it
|
|
@@ -2188,10 +2603,6 @@ interface HttpOptions<E = unknown> {
|
|
|
2188
2603
|
* path two of them would claim, and for an option, token scheme or token source it cannot serve.
|
|
2189
2604
|
*/
|
|
2190
2605
|
declare function createHttpHandler<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>, hooks?: HttpOptions<E>): (request: Request, env: E, background?: BackgroundContext) => Promise<Response>;
|
|
2191
|
-
/**
|
|
2192
|
-
* `@arbol-ai/maximus/http-paths`: versioned route templates, path parameter decoding, and the router that
|
|
2193
|
-
* matches a request to exactly one operation.
|
|
2194
|
-
*/
|
|
2195
2606
|
/** Whether a byte operation may read one of its input fields from this header. */
|
|
2196
2607
|
declare function isInputHeaderName(header: string): boolean;
|
|
2197
2608
|
/**
|
|
@@ -2235,8 +2646,8 @@ interface HttpRouteMatch<D> {
|
|
|
2235
2646
|
* The router for a set of definitions: `match(method, path)` finds the one route a request reaches, with its
|
|
2236
2647
|
* decoded parameters, and `ownsPath(path)` says whether any route answers a path. A definition without `http`
|
|
2237
2648
|
* is skipped. Construction throws a TypeError for an unsupported method, a malformed template, a duplicate
|
|
2238
|
-
* route, or two templates that could match the same path
|
|
2239
|
-
*
|
|
2649
|
+
* route, or two templates that could match the same path; a fixed route may share its path with a template,
|
|
2650
|
+
* and wins it. Matching is rou3's route tree, fixed segments before parameters.
|
|
2240
2651
|
*/
|
|
2241
2652
|
declare function createHttpRouteResolver<D extends HttpRouteDefinition>(definitions: readonly D[]): {
|
|
2242
2653
|
match: (method: string, path: string) => HttpRouteMatch<D> | null;
|
|
@@ -2284,6 +2695,17 @@ declare function readBodyBytes(source: BodySource, options: BodyReadOptions): Pr
|
|
|
2284
2695
|
declare function readBodyText(source: BodySource, options: BodyReadOptions & {
|
|
2285
2696
|
fatalUtf8?: boolean;
|
|
2286
2697
|
}): Promise<Result<string, HttpBodyFailure>>;
|
|
2698
|
+
/**
|
|
2699
|
+
* Where a Worker may send a request for someone it does not control, such as a server an organization
|
|
2700
|
+
* registered. A Worker cannot resolve a name before it fetches it, so the rules hold on the URL itself.
|
|
2701
|
+
*/
|
|
2702
|
+
/**
|
|
2703
|
+
* The URL, when a Worker may send a request there for someone it does not control: https on its default port,
|
|
2704
|
+
* with no credentials or fragment, to a public DNS name; never an IP literal, a special-use or private-network
|
|
2705
|
+
* name, nor Cloudflare's or Arbol's own hosts. Undefined for anything else. Send the request with
|
|
2706
|
+
* `redirect: 'manual'` and refuse a `3xx`, so no redirect takes it elsewhere.
|
|
2707
|
+
*/
|
|
2708
|
+
declare function publicDestination(value: string | URL): URL | undefined;
|
|
2287
2709
|
/**
|
|
2288
2710
|
* Whether a Content-Type value is `application/json` or a structured `+json` type such as
|
|
2289
2711
|
* `application/problem+json`, whatever its parameters and case.
|
|
@@ -2322,7 +2744,7 @@ declare function retryAfterSeconds(value: string | null, nowMs: number, maximum?
|
|
|
2322
2744
|
* effect, limits in force, MCP tool hints and native RPC as `x-*` extensions.
|
|
2323
2745
|
*
|
|
2324
2746
|
* Every schema reference in it is a local `#/components/schemas/<name>` pointer: the `$id`-named
|
|
2325
|
-
* schemas of its paths and components (TypeBox
|
|
2747
|
+
* schemas of its paths and components (TypeBox Cyclic/Ref) become components, as `bundleSchemas`
|
|
2326
2748
|
* describes. A schema `$id` that takes the name of a component the document writes itself, and a component
|
|
2327
2749
|
* named as a generator names an operation's own types, such as `CreateNoteResponse`, throw a TypeError.
|
|
2328
2750
|
*/
|
|
@@ -2343,19 +2765,10 @@ declare function createOpenApi<E, C, O extends Record<string, OperationShape>>(m
|
|
|
2343
2765
|
* `services` option types its binding from it.
|
|
2344
2766
|
*/
|
|
2345
2767
|
declare function createRpcOpenApi<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>): Record<string, unknown>;
|
|
2346
|
-
/**
|
|
2347
|
-
* The execution path every transport shares: checks that the caller may run the operation (its scopes when
|
|
2348
|
-
* `authority` is given, its actor kind, and `authority` itself when the operation has conditional scopes),
|
|
2349
|
-
* decodes the input, prepares the context, runs the middleware and the handler, then checks the result
|
|
2350
|
-
* against the catalog, the declared failures, the output schema and the output limit. A refused caller
|
|
2351
|
-
* answers `FORBIDDEN` and a refused input `INVALID_INPUT`. An unexpected error becomes `INTERNAL_ERROR`,
|
|
2352
|
-
* reported while telemetry is on, and is never thrown.
|
|
2353
|
-
*/
|
|
2354
|
-
declare function executeOperation<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>, operation: OperationShape, env: E, principal: Principal, input: unknown, authority?: InvocationAuthority, background?: BackgroundContext, body?: BinaryBody): Promise<Result<unknown, Failure>>;
|
|
2355
2768
|
/**
|
|
2356
2769
|
* Checks an application against every rule `.build()` enforces, then hands it back unchanged; a refusal is a
|
|
2357
2770
|
* TypeError. Curried, so `Env` and `C` can be given explicitly while the operations' types are inferred from
|
|
2358
2771
|
* the argument.
|
|
2359
2772
|
*/
|
|
2360
2773
|
declare function defineApp<Env, C>(): <const Ops extends Record<string, OperationShape>>(manifest: AppManifest<Env, C, Ops>) => AppManifest<Env, C, Ops>;
|
|
2361
|
-
export { PageInfo as $,
|
|
2774
|
+
export { PageInfo as $, TokenPolicy as $n, defineContext as $t, TransportContext as A, CaptureConfig as An, ErrorFactory as Ar, decodeSchema as At, DeletedObject as B, BackgroundContext as Bn, durableCorrelation as Br, HandlerArguments as Bt, isPathParameterValue as C, isPublicOperation as Cn, ok as Cr, stripObject as Ct, HttpRoute as D, SchemaKeywords as Dn, DefinedErrors as Dr, SchemaValidationError as Dt, HttpOptions as E, operationScopes as En, CreateArguments as Er, SchemaIssue as Et, Static$2 as F, VerifiedCaller as Fn, resultSchema as Fr, ContextDeclaration as Ft, NamedReference as G, recordExecution as Gn, PreparedContext as Gt, EmailAddressSchema as H, Observer as Hn, parseTraceParent as Hr, HandlerHttp as Ht, TSchema$2 as I, recordCapture as In, standardErrors as Ir, DomainCode as It, PostalAddress as J, withDiagnostics as Jn, SchemaOf as Jt, NamedReferenceSchema as K, reportUnexpected as Kn, RegisteredEnv as Kt, Type$2 as L, ExecutionCall as Ln, DurableCorrelation as Lr, Fail as Lt, projectAccessToken as M, CaptureInvocation as Mn, FailureData as Mr, parseSchema as Mt, EmptyInputSchema as N, CaptureSink as Nn, FailureSchema as Nr, AuthOptions as Nt, HttpTransport as O, StaticDecode as On, ErrorCatalog as Or, InputIssue as Ot, OrganizationIdSchema as P, CapturedCall as Pn, defineErrors as Pr, ContextArguments as Pt, Page as Q, TokenDevelopment as Qn, defineAuth as Qt, UuidSchema as R, executeOperation as Rn, TraceParent as Rr, Failed as Rt, isInputHeaderName as S, composeOperations as Sn, isResult as Sr, strictObject as St, HttpMiddleware as T, operationMatchesScopes as Tn, AttachmentOutputSchema as Tr, urlSchema as Tt, HexColorSchema as U, TelemetryConfig as Un, HandlerMcp as Ut, DeletedObjectSchema as V, ExecutionObservation as Vn, isRequestId as Vr, HandlerDeclaration as Vt, HttpsUrlSchema as W, diagnosticsEnabled as Wn, HandlerOptions as Wt, SignedUrl as X, TokenAlgorithm as Xn, ToolDeclaration as Xt, PostalAddressSchema as Y, TokenAccess as Yn, SchemaOrFields as Yt, SignedUrlSchema as Z, TokenClaims as Zn, ToolOptions as Zt, readBodyText as _, McpSkill as _n, BodyFailure as _r, literalUnion as _t, t as a, ApplicationBuilder as an, projectToken as ar, cursorKey as at, createHttpRouteResolver as b, OperationScope as bn, Success as br, pipeSchema as bt, isJsonMediaType as c, TaskAccess as cn, Principal as cr, withoutSecrets as ct, retryAfterSeconds as d, AppManifest as dn, TokenPrincipal as dr, readSchema as dt, defineHandler as en, TokenResolutionContext as er, PageInfoSchema as et, publicDestination as f, Exposure as fn, OAuthResource as fr, SchemaInput as ft, readBodyBytes as g, McpGuide as gn, BinaryBody as gr, inspectSchema as gt, HttpBodyFailureReason as h, McpConfiguration as hn, CaptureRecordSchema as hr, inputSchema as ht, Type$1 as i, StandardFailure as in, createTokenVerifier as ir, TPage as it, createHttpHandler as j, CaptureDimensions as jn, Failure as jr, parseInput as jt, RouteContext as k, AnyContext as kn, ErrorDefinition as kr, decodeInput as kt, readJsonBody as l, TaskRecord as ln, PrincipalSchema as lr, Checked as lt, HttpBodyFailure as m, InvocationAuthority as mn, CaptureRecord as mr, extendObject as mt, Static$1 as n, defineTool as nn, TokenSource as nr, PageQuery as nt, createOpenApi as o, ApplicationConfiguration as on, ScopeMatch as or, cutPage as ot, BodyReadOptions as p, Invocation as pn, protectedResourceMetadata as pr, defaultSchema as pt, PhoneNumberSchema as q, telemetryEnabled as qn, RouteBody as qt, TSchema$1 as r, STANDARD_FAILURES as rn, createTokenAuthorization as rr, PageQueryFields as rt, createRpcOpenApi as s, maximus as sn, matchesScopes as sr, pageLimit as st, defineApp as t, defineTelemetry as tn, TokenScheme as tr, PageOrder as tt, readJsonResponse as u, TaskStore as un, TokenClient as ur, checkSchema as ut, HttpRouteDefinition as v, OperationHandler as vn, FailureResult as vr, looseObject as vt, operationPathParameters as w, operation as wn, Attachment as wr, transformSchema as wt, decodePathParameter as x, OperationShape as xn, err as xr, refineSchema as xt, HttpRouteMatch as y, OperationMiddleware as yn, Result as yr, normalizeSchema as yt, t$1 as z, AdmissionObservation as zn, createRequestId as zr, HandlerAnswer as zt };
|