@arbol-ai/maximus 7.1.0 → 7.3.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/config/oxfmt.mjs +1 -0
- package/config/oxlint.mjs +1 -0
- package/dist/analytics/analytics.d.ts +2 -4
- package/dist/analytics/analytics.js +3 -4
- package/dist/body.d.ts +1 -1
- package/dist/body.js +2 -2
- package/dist/chunks/{body-BcMbreNd.js → body-6LichrQm.js} +1 -2
- package/dist/chunks/{correlation-gaiEoMBr.js → correlation-BEkcFFGT.js} +1 -2
- package/dist/chunks/{execution-qfZuMSIu.js → execution-B-yy4C7N.js} +14 -23
- package/dist/chunks/{json-Dwni3u4c.js → json-Bu4BLT25.js} +2 -3
- package/dist/chunks/prepare-project-zi106pWF.js +146 -0
- package/dist/chunks/{record-D2H3cg8S.js → record-DY-lX9w1.js} +2 -4
- package/dist/chunks/runtime-BPnaa-NK.js +223 -0
- package/dist/chunks/{schemas-q-51wBMQ.js → schemas-CzTvbXb6.js} +6 -11
- package/dist/chunks/{src-Ph5KHCRP.js → src-DPSpGNnT.js} +25 -21
- package/dist/chunks/{telemetry-DvZgrzZn.js → telemetry-BTwB68m5.js} +2 -4
- package/dist/chunks/{types-CGwAhnTE.d.ts → types-BWxDd3tY.d.ts} +128 -64
- package/dist/chunks/{validation-DWxKk1Js.js → validation-r-sgmsqb.js} +3 -6
- package/dist/client/client.d.ts +1 -3
- package/dist/client/client.js +7 -11
- package/dist/diagnostics.d.ts +1 -3
- package/dist/diagnostics.js +2 -2
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +3 -4
- package/dist/http-paths.d.ts +1 -1
- package/dist/http-paths.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +2 -2
- package/dist/mcp/index.d.ts +2 -4
- package/dist/mcp/index.js +5 -7
- package/dist/postgres/index.d.ts +0 -4
- package/dist/postgres/index.js +2 -4
- package/dist/project/index.d.ts +24 -0
- package/dist/project/index.js +82 -0
- package/dist/projection.d.ts +1 -3
- package/dist/projection.js +1 -2
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +2 -2
- package/dist/standard-failures.d.ts +1 -3
- package/dist/standard-failures.js +1 -2
- package/dist/tooling/cli.js +41 -24
- package/dist/tooling/testing.d.ts +1 -3
- package/dist/tooling/testing.js +1 -2
- package/dist/tooling/vite.d.ts +3 -0
- package/dist/tooling/vite.js +44 -0
- package/dist/webhooks.d.ts +2 -4
- package/dist/webhooks.js +1 -2
- package/dist/workers/runtime.d.ts +2 -112
- package/dist/workers/runtime.js +1 -226
- package/package.json +19 -6
- package/skills/maximus/SKILL.md +1 -1
- package/skills/maximus/references/building-a-service.md +9 -0
- package/templates/project/.agents/skills/project/SKILL.md.template +17 -0
- package/templates/project/.github/workflows/ci.yml.template +36 -0
- package/templates/project/.gitignore.template +10 -0
- package/templates/project/CLAUDE.md.template +34 -0
- package/templates/project/README.md.template +47 -0
- package/templates/project/cloudflare.config.ts.template +24 -0
- package/templates/project/package.json.template +38 -0
- package/templates/project/pages/index.ts.template +11 -0
- package/templates/project/routes/v1/greeting.ts.template +22 -0
- package/templates/project/src/app.ts.template +2 -0
- package/templates/project/src/application.ts.template +26 -0
- package/templates/project/src/index.ts.template +3 -0
- package/templates/project/src/worker.ts.template +6 -0
- package/templates/project/tsconfig.json.template +30 -0
- package/templates/project/vite.config.ts.template +11 -0
- package/templates/service/.github/workflows/ci.yml.template +1 -1
- package/templates/service/.gitignore.template +1 -0
- package/templates/service/CLAUDE.md.template +2 -0
- package/templates/service/README.md.template +7 -7
- package/templates/service/package.json.template +14 -9
- package/templates/service/tests/contract.test.ts.template +1 -1
- package/templates/service/vite.config.ts.template +8 -2
- package/templates/service/vitest.config.ts.template +1 -1
- package/templates/service/oxfmt.config.ts.template +0 -1
- package/templates/service/oxlint.config.ts.template +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as decodeIssues, n as decodeSchema, o as SchemaValidationError, s as defaultSchema, u as inputSchema } from "./validation-
|
|
1
|
+
import { a as decodeIssues, n as decodeSchema, o as SchemaValidationError, s as defaultSchema, u as inputSchema } from "./validation-r-sgmsqb.js";
|
|
2
2
|
import { Kind, Type, Type as Type$1, Type as t } from "@sinclair/typebox";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/schema-reader.ts
|
|
5
5
|
/**
|
|
6
6
|
* Reads untrusted data — a stored record, a provider or model answer — through its schema's owner
|
|
7
7
|
* semantics: defaults applied, normalizers run before their checks, unknown keys of a strip object
|
|
@@ -29,8 +29,7 @@ function readSchema(schema, input) {
|
|
|
29
29
|
return checked.data;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
//#region src/attachment-schema.ts
|
|
32
|
+
// src/attachment-schema.ts
|
|
34
33
|
/** Runtime-free descriptor for a validated HTTP attachment, never a JSON or RPC value. */
|
|
35
34
|
/** The output of an operation that answers with a file (`http.response: 'attachment'`). */
|
|
36
35
|
const AttachmentOutputSchema = Type.Unsafe({
|
|
@@ -40,8 +39,7 @@ const AttachmentOutputSchema = Type.Unsafe({
|
|
|
40
39
|
description: "Authenticated attachment bytes with validated media type, filename and exact length."
|
|
41
40
|
});
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
//#region src/pagination.ts
|
|
42
|
+
// src/pagination.ts
|
|
45
43
|
/**
|
|
46
44
|
* The one list contract: bidirectional keyset pagination. A list takes the query fields `cursor`,
|
|
47
45
|
* `direction` and `limit` and answers `{ object: 'list', data, pageInfo }`. The cursor is opaque to
|
|
@@ -103,8 +101,7 @@ function Page(item, options) {
|
|
|
103
101
|
});
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
|
|
107
|
-
//#region src/common-schemas.ts
|
|
104
|
+
// src/common-schemas.ts
|
|
108
105
|
/**
|
|
109
106
|
* Values and objects that services publish alike, each named by its `$id`: an OpenAPI document carries
|
|
110
107
|
* it once as `#/components/schemas/<name>`, and every SDK generated from those documents has one type
|
|
@@ -186,8 +183,7 @@ const PostalAddressSchema = Type.Object({
|
|
|
186
183
|
additionalProperties: false
|
|
187
184
|
});
|
|
188
185
|
|
|
189
|
-
|
|
190
|
-
//#region src/schemas.ts
|
|
186
|
+
// src/schemas.ts
|
|
191
187
|
/**
|
|
192
188
|
* `@arbol-ai/maximus/schemas`: the browser-safe schema vocabulary: TypeBox (`t`), its types, the validators
|
|
193
189
|
* and the shared identifier schemas, with nothing that needs a Worker runtime. A contract module that
|
|
@@ -212,5 +208,4 @@ const UuidSchema = Type.String({
|
|
|
212
208
|
pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
213
209
|
});
|
|
214
210
|
|
|
215
|
-
//#endregion
|
|
216
211
|
export { pageLimit as _, t as a, readSchema as b, HexColorSchema as c, PhoneNumberSchema as d, PostalAddressSchema as f, PageQueryFields as g, PageInfoSchema as h, UuidSchema as i, HttpsUrlSchema as l, Page as m, OrganizationIdSchema as n, DeletedObjectSchema as o, SignedUrlSchema as p, Type$1 as r, EmailAddressSchema as s, EmptyInputSchema as t, NamedReferenceSchema as u, AttachmentOutputSchema as v, checkSchema as y };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FailureSchema, standardErrors } from "../errors.js";
|
|
2
|
-
import { r as readBodyText } from "./body-
|
|
3
|
-
import { t as isRecord } from "./record-
|
|
4
|
-
import { C as operationMatchesScopes, D as pathParameterSchemas, O as attachmentResponse, S as operationBodyLimit, T as operationScopes, _ as STANDARD_CODES, b as mcpOpenWorld, c as tokenEndpoints, d as err, h as DEFAULT_MAX_BODY_BYTES, i as createTokenAuthorization, k as binaryBody, l as tokenIssuer, m as sha256Hex, n as defineApp, p as ok, s as tokenAudiences, t as executeOperation, u as usesOwnBearer, v as composeOperations, w as operationOutputLimit, y as isPublicOperation } from "./execution-
|
|
2
|
+
import { r as readBodyText } from "./body-6LichrQm.js";
|
|
3
|
+
import { t as isRecord } from "./record-DY-lX9w1.js";
|
|
4
|
+
import { C as operationMatchesScopes, D as pathParameterSchemas, O as attachmentResponse, S as operationBodyLimit, T as operationScopes, _ as STANDARD_CODES, b as mcpOpenWorld, c as tokenEndpoints, d as err, h as DEFAULT_MAX_BODY_BYTES, i as createTokenAuthorization, k as binaryBody, l as tokenIssuer, m as sha256Hex, n as defineApp, p as ok, s as tokenAudiences, t as executeOperation, u as usesOwnBearer, v as composeOperations, w as operationOutputLimit, y as isPublicOperation } from "./execution-B-yy4C7N.js";
|
|
5
5
|
import { createHttpRouteResolver, operationPathParameters } from "../http-paths.js";
|
|
6
|
-
import { a as telemetryEnabled, i as reportUnexpected, n as recordAdmission, r as recordExecution, s as withTelemetry } from "./telemetry-
|
|
7
|
-
import { n as mediaType } from "./json-
|
|
6
|
+
import { a as telemetryEnabled, i as reportUnexpected, n as recordAdmission, r as recordExecution, s as withTelemetry } from "./telemetry-BTwB68m5.js";
|
|
7
|
+
import { n as mediaType } from "./json-Bu4BLT25.js";
|
|
8
8
|
import { Type, Type as Type$1, Type as t } from "@sinclair/typebox";
|
|
9
9
|
import { stringify } from "yaml";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// src/builder.ts
|
|
12
12
|
/** Immutable builders let independent resource modules share inferred context without overwriting routes. */
|
|
13
13
|
var ApplicationBuilder = class ApplicationBuilder {
|
|
14
14
|
/**
|
|
@@ -105,8 +105,7 @@ function maximus(configuration) {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
//#region src/oauth.ts
|
|
108
|
+
// src/oauth.ts
|
|
110
109
|
/** A scope token as RFC 6749 defines it: printable ASCII without spaces, quotes or backslashes. */
|
|
111
110
|
const SCOPE = /^[\u0021\u0023-\u005B\u005D-\u007E]+$/;
|
|
112
111
|
/** Whether a value is an HTTPS URL without credentials or a fragment, and, for an issuer, without a query. */
|
|
@@ -131,8 +130,7 @@ function protectedResourceMetadata(resource, env) {
|
|
|
131
130
|
};
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
|
|
135
|
-
//#region src/internal/http-layout.ts
|
|
133
|
+
// src/internal/http-layout.ts
|
|
136
134
|
/** The paths an application answers itself, below its base path: discovery and liveness. */
|
|
137
135
|
const NATIVE_PATHS = [
|
|
138
136
|
"/",
|
|
@@ -242,8 +240,7 @@ function composition(paths, operations, transports, hooks) {
|
|
|
242
240
|
};
|
|
243
241
|
}
|
|
244
242
|
|
|
245
|
-
|
|
246
|
-
//#region src/internal/http-query.ts
|
|
243
|
+
// src/internal/http-query.ts
|
|
247
244
|
/**
|
|
248
245
|
* The typed GET query codec: which input fields travel in the query string, and how each value is read as
|
|
249
246
|
* its kind.
|
|
@@ -315,8 +312,7 @@ function queryInput(kinds, params) {
|
|
|
315
312
|
return input;
|
|
316
313
|
}
|
|
317
314
|
|
|
318
|
-
|
|
319
|
-
//#region src/schema-bundle.ts
|
|
315
|
+
// src/schema-bundle.ts
|
|
320
316
|
/**
|
|
321
317
|
* Schema bundling: named schemas (`$id`) become shared components for an OpenAPI document, or are written
|
|
322
318
|
* in place for a reader without components, such as an MCP tool listing.
|
|
@@ -475,8 +471,7 @@ function standaloneSchema(value) {
|
|
|
475
471
|
};
|
|
476
472
|
}
|
|
477
473
|
|
|
478
|
-
|
|
479
|
-
//#region src/openapi.ts
|
|
474
|
+
// src/openapi.ts
|
|
480
475
|
/**
|
|
481
476
|
* An application's OpenAPI 3.1 document, as its origin serves it: paths, response envelopes, failures by
|
|
482
477
|
* status, security schemes, and the `x-*` extensions that carry what OpenAPI cannot say (scopes, effects,
|
|
@@ -529,8 +524,19 @@ function failureResponse(status, failures) {
|
|
|
529
524
|
* schemas of its paths and components (TypeBox Recursive/Ref) become components, as `bundleSchemas`
|
|
530
525
|
* describes.
|
|
531
526
|
*/
|
|
532
|
-
function createOpenApi(manifest) {
|
|
527
|
+
function createOpenApi(manifest, options) {
|
|
533
528
|
const document = openApiDocument(manifest);
|
|
529
|
+
if (options?.operationExtensions) {
|
|
530
|
+
const paths = document.paths;
|
|
531
|
+
for (const methods of Object.values(paths)) for (const declared of Object.values(methods)) {
|
|
532
|
+
const name = String(declared.operationId);
|
|
533
|
+
const operation = manifest.operations[name];
|
|
534
|
+
if (!operation) throw new TypeError("The document names an undeclared operation.");
|
|
535
|
+
const extensions = options.operationExtensions(name, operation);
|
|
536
|
+
if (Object.keys(extensions).some((key) => !key.startsWith("x-"))) throw new TypeError("OpenAPI extensions must use x- names.");
|
|
537
|
+
Object.assign(declared, extensions);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
534
540
|
const own = Object.entries(document.components.schemas);
|
|
535
541
|
const bundled = bundleSchemas([document.paths, ...own.map(([, schema]) => schema)], document.components.schemas);
|
|
536
542
|
const [paths, ...schemas] = bundled.values;
|
|
@@ -759,8 +765,7 @@ function securitySchemes(tokens, scopes) {
|
|
|
759
765
|
};
|
|
760
766
|
}
|
|
761
767
|
|
|
762
|
-
|
|
763
|
-
//#region src/http.ts
|
|
768
|
+
// src/http.ts
|
|
764
769
|
/**
|
|
765
770
|
* The native HTTP handler: one `fetch` function that serves an application's operations, its
|
|
766
771
|
* discovery documents (OpenAPI, OAuth protected-resource metadata, liveness), its transports (MCP),
|
|
@@ -1156,5 +1161,4 @@ function operationInput(route, request, url, bodyText) {
|
|
|
1156
1161
|
});
|
|
1157
1162
|
}
|
|
1158
1163
|
|
|
1159
|
-
|
|
1160
|
-
export { canonical as a, maximus as c, createOpenApi as i, t as n, standaloneSchema as o, createHttpHandler as r, protectedResourceMetadata as s, Type$1 as t };
|
|
1164
|
+
export { canonical as a, nativePaths as c, maximus as d, createOpenApi as i, ownsPrefix as l, t as n, standaloneSchema as o, createHttpHandler as r, VERSIONED_PATH as s, Type$1 as t, protectedResourceMetadata as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/internal/diagnostics.ts
|
|
4
4
|
/**
|
|
5
5
|
* Safe error descriptions for diagnostics: an error's known names, its causes' names, its issue count and
|
|
6
6
|
* its stack locations, never a message.
|
|
@@ -85,8 +85,7 @@ function createDiagnostics(errorNames = []) {
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
//#region src/telemetry.ts
|
|
88
|
+
// src/telemetry.ts
|
|
90
89
|
/**
|
|
91
90
|
* Telemetry: invocation-local diagnostics kept in AsyncLocalStorage, safe native log events, and observers
|
|
92
91
|
* that receive execution and admission observations as background work.
|
|
@@ -216,5 +215,4 @@ function recordExecution(manifest, env, background, invocation) {
|
|
|
216
215
|
for (const observer of manifest.telemetry?.observers ?? []) if (observer.execution) deliver(background, event.principal.requestId, () => observer.execution?.(event, env));
|
|
217
216
|
}
|
|
218
217
|
|
|
219
|
-
//#endregion
|
|
220
218
|
export { telemetryEnabled as a, createDiagnostics as c, reportUnexpected as i, recordAdmission as n, withDiagnostics as o, recordExecution as r, withTelemetry as s, diagnosticsEnabled as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OptionalKind, Static, Static as Static$1, Static as Static$2, StaticDecode,
|
|
2
|
-
|
|
1
|
+
import { Kind, OptionalKind, Static, Static as Static$1, Static as Static$2, StaticDecode, TArray, TLiteral, TObject, TOptional, TProperties, TRecord, TSchema, TSchema as TSchema$1, TSchema as TSchema$2, TString, TTransform, TTuple, TUnion, TUnsafe, TransformKind, Type as Type$1, Type as Type$2, Type as t, Type as t$1 } from "@sinclair/typebox";
|
|
2
|
+
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
|
3
3
|
/** A file an HTTP operation answers with: its bytes, media type, filename and exact length. */
|
|
4
4
|
interface Attachment {
|
|
5
5
|
/** The file's bytes, as a buffer or an unlocked stream. */
|
|
@@ -13,8 +13,6 @@ interface Attachment {
|
|
|
13
13
|
}
|
|
14
14
|
/** The output of an operation that answers with a file (`http.response: 'attachment'`). */
|
|
15
15
|
declare const AttachmentOutputSchema: import("@sinclair/typebox").TUnsafe<Attachment>;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/internal/correlation.d.ts
|
|
18
16
|
/**
|
|
19
17
|
* Request correlation: request ids (a UUID, or a ray id from a trusted Cloudflare edge), W3C `traceparent`
|
|
20
18
|
* parsing, and the correlation that durable work persists.
|
|
@@ -57,8 +55,6 @@ interface DurableCorrelation {
|
|
|
57
55
|
* `traceparent`.
|
|
58
56
|
*/
|
|
59
57
|
declare function durableCorrelation(requestId: string, originTraceParent?: string): DurableCorrelation;
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/errors.d.ts
|
|
62
58
|
/** The `data` of a failure whose code declares none: an empty object. */
|
|
63
59
|
interface FailureData {}
|
|
64
60
|
/**
|
|
@@ -269,8 +265,6 @@ declare function resultSchema<O extends TSchema, F extends TSchema>(value: O, er
|
|
|
269
265
|
ok: TLiteral<false>;
|
|
270
266
|
error: F;
|
|
271
267
|
}>]>;
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/result.d.ts
|
|
274
268
|
/** Explicit operation outcome. Transports keep their own status and protocol envelope. */
|
|
275
269
|
interface Success<T> {
|
|
276
270
|
/** Always `true`, which marks a success. */
|
|
@@ -299,15 +293,18 @@ declare function err<E>(error: E): FailureResult<E>;
|
|
|
299
293
|
* its value, or a failure with a well-formed error. Anything else is not an answer at all.
|
|
300
294
|
*/
|
|
301
295
|
declare function isResult(value: unknown): value is Result<unknown, Failure>;
|
|
302
|
-
//#endregion
|
|
303
|
-
//#region src/binary.d.ts
|
|
304
296
|
/** The raw body of an operation declared with `http.body: 'bytes'`, read on demand. */
|
|
305
297
|
interface BinaryBody {
|
|
306
298
|
/** Read once within this operation's byte limit, after the owner admits the target resource. */
|
|
307
299
|
read: () => Promise<Result<Uint8Array<ArrayBuffer>, Failure>>;
|
|
308
300
|
}
|
|
309
|
-
|
|
310
|
-
|
|
301
|
+
/** Opaque owner codecs already carry their decoded static type; only native transforms need traversal. */
|
|
302
|
+
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;
|
|
303
|
+
/**
|
|
304
|
+
* A schema's decoded value. TypeBox's deep decoder can recurse indefinitely through opaque owner
|
|
305
|
+
* codecs; a schema without native transforms already has exactly its decoded `Static` type.
|
|
306
|
+
*/
|
|
307
|
+
type StaticDecode$1<S extends TSchema> = true extends HasNativeTransform<S> ? StaticDecode<S> : Static<S>;
|
|
311
308
|
/**
|
|
312
309
|
* Scope names and matching: the namespaced form every scope takes, and whether granted scopes admit a
|
|
313
310
|
* request.
|
|
@@ -319,8 +316,6 @@ type ScopeMatch = 'any' | 'all';
|
|
|
319
316
|
* An empty requirement admits nobody.
|
|
320
317
|
*/
|
|
321
318
|
declare function matchesScopes(required: readonly string[], granted: readonly string[], match?: ScopeMatch): boolean;
|
|
322
|
-
//#endregion
|
|
323
|
-
//#region src/oauth.d.ts
|
|
324
319
|
/**
|
|
325
320
|
* OAuth protected-resource metadata (RFC 9728): the resources an application publishes and the document
|
|
326
321
|
* that describes each one.
|
|
@@ -341,8 +336,6 @@ declare function protectedResourceMetadata<E>(resource: OAuthResource<E>, env: E
|
|
|
341
336
|
bearer_methods_supported: string[];
|
|
342
337
|
scopes_supported: string[];
|
|
343
338
|
};
|
|
344
|
-
//#endregion
|
|
345
|
-
//#region src/tokens.d.ts
|
|
346
339
|
/**
|
|
347
340
|
* Who calls, as every operation receives it: the actor, its kind, its verified organization and the request
|
|
348
341
|
* id.
|
|
@@ -536,8 +529,6 @@ declare function createTokenVerifier<E>(policy: TokenPolicy<E>): (token: string)
|
|
|
536
529
|
* that it carries the required scope. Refusals are `UNAUTHORIZED` or `FORBIDDEN` failures, never exceptions.
|
|
537
530
|
*/
|
|
538
531
|
declare function createTokenAuthorization<E>(policy: TokenPolicy<E>, given?: (token: string) => Promise<unknown>): (request: Request, scope: string | readonly string[], context?: TokenResolutionContext<E>, scopeMatch?: ScopeMatch) => Promise<Result<TokenPrincipal, Failure>>;
|
|
539
|
-
//#endregion
|
|
540
|
-
//#region src/telemetry.d.ts
|
|
541
532
|
/** Where background work goes: the runtime's `waitUntil`, such as a Worker's ExecutionContext. */
|
|
542
533
|
interface BackgroundContext {
|
|
543
534
|
/**
|
|
@@ -675,8 +666,6 @@ declare function recordExecution<E>(manifest: {
|
|
|
675
666
|
started: number;
|
|
676
667
|
result: Result<unknown, Failure>;
|
|
677
668
|
}): void;
|
|
678
|
-
//#endregion
|
|
679
|
-
//#region src/manifest.d.ts
|
|
680
669
|
/** Transport-verified authority, separate from the unchanged ordinary RPC principal. */
|
|
681
670
|
interface InvocationAuthority {
|
|
682
671
|
/** The transport whose admission verified the token, such as `http` or `mcp`. */
|
|
@@ -852,7 +841,7 @@ declare function operation<C, I extends TSchema, O extends TSchema, const X exte
|
|
|
852
841
|
effect: OperationShape['effect'];
|
|
853
842
|
input: I;
|
|
854
843
|
output: O;
|
|
855
|
-
execute: (context: C, input: StaticDecode<I>) => Promise<Result<Static<O>, Failure>>;
|
|
844
|
+
execute: (context: C, input: StaticDecode$1<I>) => Promise<Result<Static<O>, Failure>>;
|
|
856
845
|
}): X & {
|
|
857
846
|
scope: OperationScope;
|
|
858
847
|
scopeMatch?: ScopeMatch;
|
|
@@ -863,7 +852,7 @@ declare function operation<C, I extends TSchema, O extends TSchema, const X exte
|
|
|
863
852
|
effect: OperationShape['effect'];
|
|
864
853
|
input: I;
|
|
865
854
|
output: O;
|
|
866
|
-
execute: (context: C, input: StaticDecode<I>) => Promise<Result<Static<O>, Failure>>;
|
|
855
|
+
execute: (context: C, input: StaticDecode$1<I>) => Promise<Result<Static<O>, Failure>>;
|
|
867
856
|
};
|
|
868
857
|
/** The intersection of a union's members: the operations of every composed group. */
|
|
869
858
|
type Intersection<U> = (U extends unknown ? (value: U) => void : never) extends ((value: infer I) => void) ? I : never;
|
|
@@ -984,8 +973,6 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
|
|
|
984
973
|
/** The MCP server's instructions, guides and skills; setting it requires the MCP transport. */
|
|
985
974
|
mcp?: McpConfiguration;
|
|
986
975
|
}
|
|
987
|
-
//#endregion
|
|
988
|
-
//#region src/builder.d.ts
|
|
989
976
|
/**
|
|
990
977
|
* What `maximus()` takes: the application without its operations, context and middleware, which the builder
|
|
991
978
|
* adds.
|
|
@@ -1025,7 +1012,7 @@ declare class ApplicationBuilder<E, C, Ops extends Record<string, OperationShape
|
|
|
1025
1012
|
};
|
|
1026
1013
|
} ? {
|
|
1027
1014
|
body: BinaryBody;
|
|
1028
|
-
} : object), input: StaticDecode<I>) => Promise<Result<Static<O>, Failure>>): ApplicationBuilder<E, C, Ops & Record<N, Definition<I, O, X> & {
|
|
1015
|
+
} : object), input: StaticDecode$1<I>) => Promise<Result<Static<O>, Failure>>): ApplicationBuilder<E, C, Ops & Record<N, Definition<I, O, X> & {
|
|
1029
1016
|
execute: typeof execute;
|
|
1030
1017
|
}>>;
|
|
1031
1018
|
/**
|
|
@@ -1055,8 +1042,6 @@ declare class ApplicationBuilder<E, C, Ops extends Record<string, OperationShape
|
|
|
1055
1042
|
* compose resource modules that share this base, then `.build()`.
|
|
1056
1043
|
*/
|
|
1057
1044
|
declare function maximus<E>(configuration: ApplicationConfiguration<E>): ApplicationBuilder<E, Invocation<E>, Record<never, never>>;
|
|
1058
|
-
//#endregion
|
|
1059
|
-
//#region src/validation.d.ts
|
|
1060
1045
|
/**
|
|
1061
1046
|
* Checks a value against a schema without decoding it: the value when it matches, else an `INVALID_INPUT`
|
|
1062
1047
|
* failure without issues. Use `decodeInput` for input with defaults and codecs.
|
|
@@ -1081,7 +1066,7 @@ declare function parseInput<Schema extends TSchema>(schema: Schema, input: unkno
|
|
|
1081
1066
|
declare function parseSchema<Schema extends TSchema>(schema: Schema, input: unknown): Static<Schema>;
|
|
1082
1067
|
/** Admit a real wire schema once, materialize declared defaults, and decode native TypeBox transforms.
|
|
1083
1068
|
* Output validation deliberately remains check-only: response data must already be canonical. */
|
|
1084
|
-
declare function decodeSchema<Schema extends TSchema>(schema: Schema, input: unknown): StaticDecode<Schema>;
|
|
1069
|
+
declare function decodeSchema<Schema extends TSchema>(schema: Schema, input: unknown): StaticDecode$1<Schema>;
|
|
1085
1070
|
/** Field issues a refusal carries: enough to correct the input, never an input value. */
|
|
1086
1071
|
interface InputIssue {
|
|
1087
1072
|
/** RFC 6901 JSON Pointer to the refused field; empty for the whole input. */
|
|
@@ -1096,9 +1081,7 @@ interface InputIssue {
|
|
|
1096
1081
|
declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unknown): {
|
|
1097
1082
|
error?: undefined;
|
|
1098
1083
|
ok: true;
|
|
1099
|
-
value:
|
|
1100
|
-
params: [];
|
|
1101
|
-
})["static"];
|
|
1084
|
+
value: StaticDecode$1<Schema>;
|
|
1102
1085
|
} | {
|
|
1103
1086
|
value?: undefined;
|
|
1104
1087
|
ok: false;
|
|
@@ -1111,8 +1094,6 @@ declare function decodeInput<Schema extends TSchema>(schema: Schema, input: unkn
|
|
|
1111
1094
|
};
|
|
1112
1095
|
};
|
|
1113
1096
|
};
|
|
1114
|
-
//#endregion
|
|
1115
|
-
//#region src/input-schemas.d.ts
|
|
1116
1097
|
/** Type-only: the key under which a codec's schema type carries its wire type. No schema object has it. */
|
|
1117
1098
|
declare const WIRE: unique symbol;
|
|
1118
1099
|
/**
|
|
@@ -1134,7 +1115,7 @@ type InputKeys<P extends TProperties> = { [K in keyof P]: P[K] extends {
|
|
|
1134
1115
|
* The type a schema accepts on the wire: a field that is optional or has a default may be omitted, and a
|
|
1135
1116
|
* field a codec declares (`normalizeSchema`, `transformSchema`, `pipeSchema`) is sent as its source.
|
|
1136
1117
|
*/
|
|
1137
|
-
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]>; } & { [K in InputKeys<P>]?: SchemaInput<P[K]>; } : S extends TArray<infer I> ? SchemaInput<I>[] : S extends TUnion<infer U> ? SchemaInput<U[number]> : Static<S>;
|
|
1118
|
+
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>;
|
|
1138
1119
|
/**
|
|
1139
1120
|
* One refused field: a code, a message that names the expectation and never the value, and the path to the
|
|
1140
1121
|
* field.
|
|
@@ -1154,7 +1135,7 @@ declare class SchemaValidationError extends TypeError {
|
|
|
1154
1135
|
constructor(issues: SchemaIssue[]);
|
|
1155
1136
|
}
|
|
1156
1137
|
/** A union of literals: `literalUnion(['open', 'done'])`. */
|
|
1157
|
-
declare const literalUnion: <const V extends readonly (string | number | boolean)[]>(values: V) => TUnion<
|
|
1138
|
+
declare const literalUnion: <const V extends readonly (string | number | boolean)[]>(values: V) => TUnion<{ -readonly [K in keyof V]: TLiteral<V[K]>; }>;
|
|
1158
1139
|
/**
|
|
1159
1140
|
* The schema with a default that decoding applies when the field is absent, so the field is optional on the
|
|
1160
1141
|
* wire.
|
|
@@ -1224,18 +1205,16 @@ declare const urlSchema: (options: {
|
|
|
1224
1205
|
*/
|
|
1225
1206
|
declare function inputSchema<S extends TSchema>(schema: S, options?: {
|
|
1226
1207
|
stripUnknown?: boolean;
|
|
1227
|
-
}): TTransform<TUnsafe<SchemaInput<S>>, StaticDecode<S>>;
|
|
1208
|
+
}): TTransform<TUnsafe<SchemaInput<S>>, StaticDecode$1<S>>;
|
|
1228
1209
|
/** The same, reading another wire shape `wire` and decoding it into `schema`'s canonical type. */
|
|
1229
|
-
declare function inputSchema<S extends TSchema, W extends TSchema>(schema: S, wire: W): TTransform<W, StaticDecode<S>>;
|
|
1230
|
-
//#endregion
|
|
1231
|
-
//#region src/schema-reader.d.ts
|
|
1210
|
+
declare function inputSchema<S extends TSchema, W extends TSchema>(schema: S, wire: W): TTransform<W, StaticDecode$1<S>>;
|
|
1232
1211
|
/**
|
|
1233
1212
|
* What `checkSchema` answers: the decoded data, `StaticDecode<S>` (which is `Static<S>` unless `S` holds a
|
|
1234
1213
|
* TypeBox transform), or the error that lists every issue.
|
|
1235
1214
|
*/
|
|
1236
1215
|
type Checked<S extends TSchema> = {
|
|
1237
1216
|
success: true;
|
|
1238
|
-
data: StaticDecode<S>;
|
|
1217
|
+
data: StaticDecode$1<S>;
|
|
1239
1218
|
error?: never;
|
|
1240
1219
|
} | {
|
|
1241
1220
|
success: false;
|
|
@@ -1249,9 +1228,7 @@ type Checked<S extends TSchema> = {
|
|
|
1249
1228
|
*/
|
|
1250
1229
|
declare function checkSchema<S extends TSchema>(schema: S, input: unknown): Checked<S>;
|
|
1251
1230
|
/** `checkSchema`, throwing its SchemaValidationError on refusal. */
|
|
1252
|
-
declare function readSchema<S extends TSchema>(schema: S, input: unknown): StaticDecode<S>;
|
|
1253
|
-
//#endregion
|
|
1254
|
-
//#region src/pagination.d.ts
|
|
1231
|
+
declare function readSchema<S extends TSchema>(schema: S, input: unknown): StaticDecode$1<S>;
|
|
1255
1232
|
/**
|
|
1256
1233
|
* How to reach a list's neighboring pages: whether they exist and their opaque cursors, named `PageInfo`.
|
|
1257
1234
|
*/
|
|
@@ -1308,8 +1285,6 @@ interface Page<Item> {
|
|
|
1308
1285
|
declare function Page<Item extends TSchema>(item: Item, options: {
|
|
1309
1286
|
$id: string;
|
|
1310
1287
|
}): TPage<Item>;
|
|
1311
|
-
//#endregion
|
|
1312
|
-
//#region src/common-schemas.d.ts
|
|
1313
1288
|
/** An email address of at most 254 characters, named `EmailAddress`. */
|
|
1314
1289
|
declare const EmailAddressSchema: TString;
|
|
1315
1290
|
/** A phone number in E.164 format, named `PhoneNumber`. */
|
|
@@ -1350,8 +1325,6 @@ declare const PostalAddressSchema: import("@sinclair/typebox").TObject<{
|
|
|
1350
1325
|
}>;
|
|
1351
1326
|
/** A postal address, shaped as FHIR `Address`. */
|
|
1352
1327
|
type PostalAddress = Static<typeof PostalAddressSchema>;
|
|
1353
|
-
//#endregion
|
|
1354
|
-
//#region src/schemas.d.ts
|
|
1355
1328
|
/** The input of an operation that takes none: an empty strict object. */
|
|
1356
1329
|
declare const EmptyInputSchema: import("@sinclair/typebox").TObject<{}>;
|
|
1357
1330
|
/**
|
|
@@ -1362,8 +1335,6 @@ declare const EmptyInputSchema: import("@sinclair/typebox").TObject<{}>;
|
|
|
1362
1335
|
declare const OrganizationIdSchema: import("@sinclair/typebox").TString;
|
|
1363
1336
|
/** A lowercase RFC 9562 UUID of version 1 to 8, named `Uuid`. */
|
|
1364
1337
|
declare const UuidSchema: import("@sinclair/typebox").TString;
|
|
1365
|
-
//#endregion
|
|
1366
|
-
//#region src/http.d.ts
|
|
1367
1338
|
/**
|
|
1368
1339
|
* What a transport receives for one admitted request: the request and its id, the verified caller, the
|
|
1369
1340
|
* application, the operations it may serve, the OpenAPI document, and `invoke`, which runs an operation
|
|
@@ -1512,8 +1483,6 @@ interface HttpOptions<E = unknown> {
|
|
|
1512
1483
|
* such as MCP, plain routes and mounts. Construction refuses a path two of them would claim.
|
|
1513
1484
|
*/
|
|
1514
1485
|
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>;
|
|
1515
|
-
//#endregion
|
|
1516
|
-
//#region src/http-paths.d.ts
|
|
1517
1486
|
/**
|
|
1518
1487
|
* `@arbol-ai/maximus/http-paths`: versioned route templates, path parameter decoding, and the router that
|
|
1519
1488
|
* matches a request to exactly one operation.
|
|
@@ -1553,8 +1522,6 @@ declare function createHttpRouteResolver<D extends HttpRouteDefinition>(definiti
|
|
|
1553
1522
|
/** Used only at construction to prevent a transport from bypassing item-route authorization. */
|
|
1554
1523
|
ownsPath(path: string): boolean;
|
|
1555
1524
|
};
|
|
1556
|
-
//#endregion
|
|
1557
|
-
//#region src/internal/body.d.ts
|
|
1558
1525
|
/** Closed decoding vocabulary used by bounded transport readers. */
|
|
1559
1526
|
declare const HTTP_BODY_FAILURES: readonly ['too_large', 'invalid_length', 'invalid_json', 'invalid_utf8', 'unexpected_content_type', 'aborted', 'read_failed'];
|
|
1560
1527
|
/** Why a body could not be read. */
|
|
@@ -1585,8 +1552,6 @@ declare function readBodyBytes(source: BodySource, options: BodyReadOptions): Pr
|
|
|
1585
1552
|
declare function readBodyText(source: BodySource, options: BodyReadOptions & {
|
|
1586
1553
|
fatalUtf8?: boolean;
|
|
1587
1554
|
}): Promise<Result<string, HttpBodyFailure>>;
|
|
1588
|
-
//#endregion
|
|
1589
|
-
//#region src/internal/json.d.ts
|
|
1590
1555
|
/** `application/json`, or a structured `+json` type such as `application/problem+json`. */
|
|
1591
1556
|
declare function isJsonMediaType(value: string | null): boolean;
|
|
1592
1557
|
/** Decode bounded JSON into unknown for the owner's input/output validator. */
|
|
@@ -1602,8 +1567,6 @@ declare function readJsonResponse(response: Response, options: {
|
|
|
1602
1567
|
}): Promise<Result<unknown, HttpBodyFailure>>;
|
|
1603
1568
|
/** Bounded Retry-After hint only. A hint never makes repeating a mutation safe. */
|
|
1604
1569
|
declare function retryAfterSeconds(value: string | null, nowMs: number, maximum?: number): number | undefined;
|
|
1605
|
-
//#endregion
|
|
1606
|
-
//#region src/openapi.d.ts
|
|
1607
1570
|
/**
|
|
1608
1571
|
* The document the origin serves at `/openapi.json`: every public operation that declares an HTTP route,
|
|
1609
1572
|
* never an internal one. Each operation also carries its scopes, effect, limits in force, MCP tool hints
|
|
@@ -1613,18 +1576,119 @@ declare function retryAfterSeconds(value: string | null, nowMs: number, maximum?
|
|
|
1613
1576
|
* schemas of its paths and components (TypeBox Recursive/Ref) become components, as `bundleSchemas`
|
|
1614
1577
|
* describes.
|
|
1615
1578
|
*/
|
|
1616
|
-
declare function createOpenApi<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O
|
|
1617
|
-
|
|
1618
|
-
|
|
1579
|
+
declare function createOpenApi<E, C, O extends Record<string, OperationShape>>(manifest: AppManifest<E, C, O>, options?: {
|
|
1580
|
+
/** Adapter-owned operation metadata; schemas in extensions share the document's components. */
|
|
1581
|
+
operationExtensions?: (name: string, operation: OperationShape) => Record<`x-${string}`, unknown>;
|
|
1582
|
+
}): Record<string, unknown>;
|
|
1619
1583
|
/**
|
|
1620
1584
|
* The execution path every transport shares: checks that the caller may run the operation, decodes the input,
|
|
1621
1585
|
* prepares the context, runs the middleware and the handler, then checks the result against the declared
|
|
1622
1586
|
* output and failures. An unexpected error becomes `INTERNAL_ERROR` and is reported, never thrown.
|
|
1623
1587
|
*/
|
|
1624
1588
|
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>>;
|
|
1625
|
-
//#endregion
|
|
1626
|
-
//#region src/define-app.d.ts
|
|
1627
1589
|
/** Checks the application, then hands it back unchanged. */
|
|
1628
1590
|
declare function defineApp<Env, C>(): <const Ops extends Record<string, OperationShape>>(manifest: AppManifest<Env, C, Ops>) => AppManifest<Env, C, Ops>;
|
|
1629
|
-
|
|
1630
|
-
|
|
1591
|
+
/** A Workers static-assets binding; product stores and secrets never satisfy this capability. */
|
|
1592
|
+
interface AssetBinding {
|
|
1593
|
+
/** Answers a request with the uploaded build file at its URL path. */
|
|
1594
|
+
fetch: (request: Request) => Promise<Response>;
|
|
1595
|
+
}
|
|
1596
|
+
/** The names of the env bindings that are asset bindings. */
|
|
1597
|
+
type AssetBindingName<E> = { [K in keyof E]-?: E[K] extends AssetBinding ? K : never; }[keyof E] & string;
|
|
1598
|
+
/** Explicit assets policy. Unknown paths never receive the SPA shell. */
|
|
1599
|
+
interface WorkerAssetsOptions<E> {
|
|
1600
|
+
/** Environment binding whose fetch method serves the uploaded build files. */
|
|
1601
|
+
binding: AssetBindingName<E>;
|
|
1602
|
+
/** Known SPA routes. Stateless expressions may admit product-owned detail routes. */
|
|
1603
|
+
pages?: {
|
|
1604
|
+
paths: readonly string[];
|
|
1605
|
+
patterns?: readonly RegExp[];
|
|
1606
|
+
/** Build shell fetched for admitted pages; defaults to /index.html. */
|
|
1607
|
+
shell?: string;
|
|
1608
|
+
};
|
|
1609
|
+
/** Named build files that must revalidate, such as manifests and service workers. */
|
|
1610
|
+
files?: readonly string[];
|
|
1611
|
+
/** Slash-delimited namespaces containing content-hashed, immutable build files. */
|
|
1612
|
+
immutablePrefixes?: readonly string[];
|
|
1613
|
+
/** Product browser policy, including CSP. Native content type and cache policy remain authoritative. */
|
|
1614
|
+
headers?: HeadersInit | ((request: Request, env: E) => HeadersInit);
|
|
1615
|
+
/**
|
|
1616
|
+
* Development under Vite (the Cloudflare Vite plugin), whose dev server stands behind the binding:
|
|
1617
|
+
* a GET the Worker does not serve as a page, file or immutable asset (Vite's client, modules and
|
|
1618
|
+
* sources) is forwarded to it as it came. Pass `import.meta.env.DEV`, which a production build sets to
|
|
1619
|
+
* false: a deployed Worker must never forward unknown paths.
|
|
1620
|
+
*/
|
|
1621
|
+
development?: boolean;
|
|
1622
|
+
}
|
|
1623
|
+
/** Typed organization credential preparation for one derived operation group. */
|
|
1624
|
+
declare function credentials<Schema extends TSchema$1>(options: {
|
|
1625
|
+
principal: Principal;
|
|
1626
|
+
accounts: {
|
|
1627
|
+
getByName: (name: string) => {
|
|
1628
|
+
readCredential: (organizationId: string) => Promise<Result<unknown, Failure>>;
|
|
1629
|
+
};
|
|
1630
|
+
};
|
|
1631
|
+
schema: Schema;
|
|
1632
|
+
}): Promise<Result<{
|
|
1633
|
+
credential: Static$1<Schema>;
|
|
1634
|
+
}, Failure>>;
|
|
1635
|
+
/**
|
|
1636
|
+
* The RPC methods of a Worker's entrypoint: one per operation that declares `rpc`, taking the caller's
|
|
1637
|
+
* principal and the input and answering a Result.
|
|
1638
|
+
*/
|
|
1639
|
+
type RpcMethods<Ops extends Record<string, OperationShape>> = { [K in keyof Ops as Ops[K] extends {
|
|
1640
|
+
rpc: true | {
|
|
1641
|
+
callers: readonly string[];
|
|
1642
|
+
};
|
|
1643
|
+
} ? K : never]: (principal: Principal, input: Static$1<Ops[K]['input']>) => Promise<Result<Static$1<Ops[K]['output']>, Failure>>; };
|
|
1644
|
+
/**
|
|
1645
|
+
* What `createWorker` returns: the default export's handler, the named entrypoint for Worker RPC, and
|
|
1646
|
+
* wrappers that run your own entrypoints and Durable Objects inside the application's diagnostics.
|
|
1647
|
+
*/
|
|
1648
|
+
interface WorkerRuntime<E, O extends Record<string, OperationShape>> {
|
|
1649
|
+
/** The Worker's default export: `fetch` for HTTP, plus the other `handlers` given to `createWorker`. */
|
|
1650
|
+
handler: ExportedHandler<E>;
|
|
1651
|
+
/**
|
|
1652
|
+
* A `WorkerEntrypoint` class with one method per operation that declares `rpc`; export it by name for
|
|
1653
|
+
* Service Bindings to call.
|
|
1654
|
+
*/
|
|
1655
|
+
entrypoint: new (ctx: ExecutionContext, env: E) => WorkerEntrypoint<E> & RpcMethods<O>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Wraps your own `WorkerEntrypoint` class so its methods run inside the application's diagnostics; it keeps
|
|
1658
|
+
* its methods and type.
|
|
1659
|
+
*/
|
|
1660
|
+
service: <D extends new (ctx: ExecutionContext, env: E) => WorkerEntrypoint<E>>(implementation: D) => D;
|
|
1661
|
+
/**
|
|
1662
|
+
* Wraps a Durable Object class so its methods run inside the application's diagnostics; it keeps its
|
|
1663
|
+
* methods and type.
|
|
1664
|
+
*/
|
|
1665
|
+
durableObject: <T extends DurableObject<E>, D extends new (state: DurableObject['ctx'], env: E) => T>(implementation: D) => D;
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* What `createWorker` takes besides the application: the Worker's other handlers, its transports, the HTTP
|
|
1669
|
+
* handler's options, its static assets and its plain routes.
|
|
1670
|
+
*/
|
|
1671
|
+
interface WorkerOptions<E> {
|
|
1672
|
+
/** The Worker's other handlers (`scheduled`, `queue`, …), merged into the default export. */
|
|
1673
|
+
handlers?: Omit<ExportedHandler<E>, 'fetch'>;
|
|
1674
|
+
/** Protocol transports served beside the operations, such as `mcp()`. */
|
|
1675
|
+
transports?: HttpOptions<E>['transports'];
|
|
1676
|
+
/** Native HTTP mounting, product admission and static/protocol composition. */
|
|
1677
|
+
http?: Omit<HttpOptions<E>, 'transports' | 'routes' | 'annotate'>;
|
|
1678
|
+
/** Explicit build files and SPA page admission, served through the native HTTP fallback. */
|
|
1679
|
+
assets?: WorkerAssetsOptions<E>;
|
|
1680
|
+
/**
|
|
1681
|
+
* Plain routes outside token admission (provider webhooks, signed links,
|
|
1682
|
+
* OAuth callbacks), by exact path. Each handler verifies its own signature
|
|
1683
|
+
* or token before reading the request. They run inside the same handler,
|
|
1684
|
+
* so diagnostics cover them too.
|
|
1685
|
+
*/
|
|
1686
|
+
routes?: Readonly<Record<string, HttpRoute<E>>>;
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Turns an application into a Cloudflare Worker: `handler` (export it as default) serves HTTP and the other
|
|
1690
|
+
* handlers you pass; `entrypoint` (export it by name) serves every operation that declares `rpc` to the
|
|
1691
|
+
* Workers whose Service Binding names an allowed `caller`.
|
|
1692
|
+
*/
|
|
1693
|
+
declare function createWorker<E, C, O extends Record<string, OperationShape>>(application: AppManifest<E, C, O>, options?: WorkerOptions<E>): WorkerRuntime<E, O>;
|
|
1694
|
+
export { SignedUrl as $, Observer as $t, HttpOptions as A, ok as An, parseInput as At, Type$2 as B, standardErrors as Bn, McpGuide as Bt, HttpRouteDefinition as C, StaticDecode$1 as Cn, strictObject as Ct, isInputHeaderName as D, Success as Dn, InputIssue as Dt, decodePathParameter as E, Result as En, urlSchema as Et, createHttpHandler as F, Failure as Fn, AppManifest as Ft, EmailAddressSchema as G, isRequestId as Gn, composeOperations as Gt, t$1 as H, TraceParent as Hn, OperationMiddleware as Ht, EmptyInputSchema as I, FailureData as In, Exposure as It, NamedReference as J, AttachmentOutputSchema as Jn, operationMatchesScopes as Jt, HexColorSchema as K, parseTraceParent as Kn, isPublicOperation as Kt, OrganizationIdSchema as L, FailureSchema as Ln, Invocation as Lt, HttpTransport as M, ErrorCatalog as Mn, ApplicationBuilder as Mt, RouteContext as N, ErrorDefinition as Nn, ApplicationConfiguration as Nt, isPathParameterValue as O, err as On, decodeInput as Ot, TransportContext as P, ErrorFactory as Pn, maximus as Pt, PostalAddressSchema as Q, ExecutionObservation as Qt, Static$2 as R, defineErrors as Rn, InvocationAuthority as Rt, readBodyText as S, matchesScopes as Sn, refineSchema as St, createHttpRouteResolver as T, FailureResult as Tn, transformSchema as Tt, DeletedObject as U, createRequestId as Un, OperationScope as Ut, UuidSchema as V, DurableCorrelation as Vn, McpSkill as Vt, DeletedObjectSchema as W, durableCorrelation as Wn, OperationShape as Wt, PhoneNumberSchema as X, AdmissionObservation as Xt, NamedReferenceSchema as Y, operationScopes as Yt, PostalAddress as Z, BackgroundContext as Zt, retryAfterSeconds as _, createTokenVerifier as _n, inspectSchema as _t, credentials as a, withDiagnostics as an, PageQueryFields as at, HttpBodyFailureReason as b, protectedResourceMetadata as bn, normalizeSchema as bt, executeOperation as c, TokenAlgorithm as cn, Checked as ct, Type$1 as d, TokenDevelopment as dn, SchemaInput as dt, TelemetryConfig as en, SignedUrlSchema as et, t as f, TokenPolicy as fn, SchemaIssue as ft, readJsonResponse as g, createTokenAuthorization as gn, inputSchema as gt, readJsonBody as h, TokenScheme as hn, extendObject as ht, createWorker as i, telemetryEnabled as in, PageQuery as it, HttpRoute as j, DefinedErrors as jn, parseSchema as jt, operationPathParameters as k, isResult as kn, decodeSchema as kt, Static$1 as l, TokenClaims as ln, checkSchema as lt, isJsonMediaType as m, TokenResolutionContext as mn, defaultSchema as mt, WorkerOptions as n, recordExecution as nn, PageInfo as nt, WorkerAssetsOptions as o, Principal as on, TPage as ot, createOpenApi as p, TokenPrincipal as pn, SchemaValidationError as pt, HttpsUrlSchema as q, Attachment as qn, operation as qt, WorkerRuntime as r, reportUnexpected as rn, PageInfoSchema as rt, defineApp as s, PrincipalSchema as sn, pageLimit as st, RpcMethods as t, diagnosticsEnabled as tn, Page as tt, TSchema$1 as u, TokenClient as un, readSchema as ut, BodyReadOptions as v, projectToken as vn, literalUnion as vt, HttpRouteMatch as w, BinaryBody as wn, stripObject as wt, readBodyBytes as x, ScopeMatch as xn, pipeSchema as xt, HttpBodyFailure as y, OAuthResource as yn, looseObject as yt, TSchema$2 as z, resultSchema as zn, McpConfiguration as zt };
|
|
@@ -2,7 +2,7 @@ import { FormatRegistry, Kind, TransformKind, Type } from "@sinclair/typebox";
|
|
|
2
2
|
import { AssertError, HasTransform, TransformDecode, TransformDecodeError, Value } from "@sinclair/typebox/value";
|
|
3
3
|
import { fullFormats } from "ajv-formats/dist/formats.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/input-schemas.ts
|
|
6
6
|
/**
|
|
7
7
|
* Owner codecs on TypeBox schemas: defaults, normalizers, transforms, inspections, refinements, pipes and
|
|
8
8
|
* unknown-key stripping. `inputSchema()` compiles them into one input schema, so the wire is checked as
|
|
@@ -232,8 +232,7 @@ function inputSchema(schema, source) {
|
|
|
232
232
|
}).Encode((value) => value);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
//#region src/internal/decode-issues.ts
|
|
235
|
+
// src/internal/decode-issues.ts
|
|
237
236
|
/**
|
|
238
237
|
* Turns a failed TypeBox decode into field issues whose paths start at the input's root, as the
|
|
239
238
|
* INVALID_INPUT failure carries them.
|
|
@@ -282,8 +281,7 @@ function jsonPointer(path) {
|
|
|
282
281
|
return path.map((part) => `/${String(part).replaceAll("~", "~0").replaceAll("/", "~1")}`).join("");
|
|
283
282
|
}
|
|
284
283
|
|
|
285
|
-
|
|
286
|
-
//#region src/validation.ts
|
|
284
|
+
// src/validation.ts
|
|
287
285
|
/**
|
|
288
286
|
* Schema validation: the check-only and the decoding validators, the guard that admits only bounded plain
|
|
289
287
|
* JSON, and the RFC format validators registered once with TypeBox.
|
|
@@ -378,5 +376,4 @@ function decodeInput(schema, input) {
|
|
|
378
376
|
}
|
|
379
377
|
}
|
|
380
378
|
|
|
381
|
-
//#endregion
|
|
382
379
|
export { strictObject as _, decodeIssues as a, urlSchema as b, extendObject as c, inspectSchema as d, literalUnion as f, refineSchema as g, pipeSchema as h, parseSchema as i, hasUncompiledCodecs as l, normalizeSchema as m, decodeSchema as n, SchemaValidationError as o, looseObject as p, parseInput as r, defaultSchema as s, decodeInput as t, inputSchema as u, stripObject as v, transformSchema as y };
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/client/client.d.ts
|
|
1
|
+
import { Fn as Failure, Wt as OperationShape, l as Static } from "../chunks/types-BWxDd3tY.js";
|
|
3
2
|
/** What every HTTP operation answers: its data on success, its failure otherwise, and the request id. */
|
|
4
3
|
export type Envelope<T> = {
|
|
5
4
|
success: true;
|
|
@@ -127,5 +126,4 @@ export declare function createClient<M extends ClientManifest>(origin: string, t
|
|
|
127
126
|
export declare function createClient<M extends ClientManifest>(origin: string, token: string | (() => Promise<string>), options?: ClientOptions & {
|
|
128
127
|
response?: 'envelope';
|
|
129
128
|
}): AppClientContract<M>;
|
|
130
|
-
//#endregion
|
|
131
129
|
export {};
|