@arbol-ai/maximus 8.6.0 → 8.7.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 +1 -1
- package/dist/body.d.ts +1 -1
- package/dist/capture/index.d.ts +1 -1
- package/dist/chunks/{define-app-BpSKvXET.js → define-app-CRKaiTzi.js} +2 -1
- package/dist/chunks/{http-layout-BsQlLNeo.js → http-layout-CB6MdZOO.js} +1 -1
- package/dist/chunks/{meter-B_WuFl_c.js → meter-Mddtgv9_.js} +1 -1
- package/dist/chunks/{openapi-file-DlBVI3lc.js → openapi-file-D1Fz9-oO.js} +1 -1
- package/dist/chunks/{openapi-C2A4SxMi.js → openapi-tJeJfq1G.js} +4 -2
- package/dist/chunks/{pages-B0xdWws9.js → pages-DzAPVx2p.js} +1 -1
- package/dist/chunks/{runtime-DjCjXIdf.js → runtime-D-yNrgEP.js} +3 -3
- package/dist/chunks/{server-UtQtcegf.js → server-D49V-Sd4.js} +1 -1
- package/dist/chunks/{src-CYk0Af0t.js → src-DPB9t4u0.js} +5 -5
- package/dist/chunks/{tokens-D6yVDtEU.js → tokens-CS3E9OGg.js} +82 -2
- package/dist/chunks/{types-AjJyXA62.d.ts → types-hP7p4Rsp.d.ts} +53 -2
- package/dist/chunks/{workers-types-B6F5WEuu.d.ts → workers-types-qWuu8LZ0.d.ts} +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/http-paths.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +2 -2
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/tasks.d.ts +1 -1
- package/dist/project/config.d.ts +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +2 -2
- package/dist/schemas.d.ts +1 -1
- package/dist/standard-failures.d.ts +1 -1
- package/dist/tooling/cli.js +1 -1
- package/dist/vite/index.d.ts +7 -1
- package/dist/vite/index.js +6 -4
- package/dist/webhooks.d.ts +1 -1
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +4 -4
- package/skills/maximus/references/project.md +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rr as Observer } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
import { Static, Type } from "typebox";
|
|
3
3
|
/** An analytics event: the allowlisted metadata of one operation call, flattened, with an id of its own. */
|
|
4
4
|
export declare const ExecutionEventSchema: Type.TObject<{
|
package/dist/body.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as readBodyText, c as isJsonMediaType, d as retryAfterSeconds, f as publicDestination, g as readBodyBytes, h as HttpBodyFailureReason, l as readJsonBody, m as HttpBodyFailure, p as BodyReadOptions, u as readJsonResponse } from "./chunks/types-
|
|
1
|
+
import { _ as readBodyText, c as isJsonMediaType, d as retryAfterSeconds, f as publicDestination, g as readBodyBytes, h as HttpBodyFailureReason, l as readJsonBody, m as HttpBodyFailure, p as BodyReadOptions, u as readJsonResponse } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { type BodyReadOptions, type HttpBodyFailure, type HttpBodyFailureReason, isJsonMediaType, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, retryAfterSeconds };
|
package/dist/capture/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ar as CaptureRecordSchema, Gn as CaptureConfig, Jn as CaptureSink, Kn as CaptureDimensions, Kt as RegisteredEnv, Wn as AnyContext, ct as withoutSecrets, kr as CaptureRecord, qn as CaptureInvocation } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/** What `pipeline()` takes. */
|
|
3
3
|
interface PipelineOptions<E> {
|
|
4
4
|
/**
|
|
@@ -4,7 +4,7 @@ import { a as operationPathParameters, r as isInputHeaderName, t as createHttpRo
|
|
|
4
4
|
import { R as holdsSecrets, T as hasUncompiledCodecs } from "./schemas-_UJcx_uY.js";
|
|
5
5
|
import { t as pathParameterSchemas } from "./http-routes-B6tCsnxB.js";
|
|
6
6
|
import { b as operationScopes, d as MAX_BODY_BYTES_CEILING, f as STANDARD_CODES, t as MAX_TASK_TTL_MS, x as isNamespacedScope } from "./tasks-CD-B6_nv.js";
|
|
7
|
-
import { g as hasSchemaReferences, m as bundleSchemas, o as tokenAudiences, t as checkTokenAuthority } from "./tokens-
|
|
7
|
+
import { b as checkRoles, g as hasSchemaReferences, m as bundleSchemas, o as tokenAudiences, t as checkTokenAuthority } from "./tokens-CS3E9OGg.js";
|
|
8
8
|
import { IsKind } from "typebox";
|
|
9
9
|
|
|
10
10
|
// src/internal/exact-length.ts
|
|
@@ -208,6 +208,7 @@ function checkApplication(manifest) {
|
|
|
208
208
|
checkTelemetry(manifest.telemetry);
|
|
209
209
|
checkCapture(manifest.capture);
|
|
210
210
|
checkMeter(manifest.meter);
|
|
211
|
+
checkRoles(manifest);
|
|
211
212
|
checkTokenAuthority(manifest.tokens, manifest.namespace);
|
|
212
213
|
tokenAudiences(manifest.tokens);
|
|
213
214
|
if (Object.keys(manifest.tokens.resources ?? {}).length > 0 && manifest.tokens.resourceMetadataUrl === void 0) throw new TypeError("tokens.resources requires tokens.resourceMetadataUrl: name the metadata a 401 challenge points at.");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { f as Value, t as admitInput } from "./validation-CpzAxj2_.js";
|
|
2
2
|
import { B as withoutSecrets, R as holdsSecrets } from "./schemas-_UJcx_uY.js";
|
|
3
3
|
import { i as standardErrors } from "./errors-BoutSmiy.js";
|
|
4
|
-
import { a as isAttachmentSchema, o as validAttachment } from "./define-app-
|
|
4
|
+
import { a as isAttachmentSchema, o as validAttachment } from "./define-app-CRKaiTzi.js";
|
|
5
5
|
import { b as operationScopes, c as ADMISSION_CODES, f as STANDARD_CODES, l as BODY_CODES, v as operationMatchesScopes, y as operationOutputLimit } from "./tasks-CD-B6_nv.js";
|
|
6
6
|
import { t as err } from "./result-CF4OzG9O.js";
|
|
7
7
|
import { t as sha256Hex } from "./digest-C51F1bhA.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createRpcOpenApi } from "./openapi-
|
|
1
|
+
import { n as createRpcOpenApi } from "./openapi-tJeJfq1G.js";
|
|
2
2
|
import { t as prepareConfiguredProject } from "./prepare-configured-Cithjf80.js";
|
|
3
3
|
import { t as packageDirectory } from "./scaffold-BfrJN0Yk.js";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as schemaIds, f as usesCloudflareAccess, h as canonical, m as bundleSchemas, s as tokenEndpoints } from "./tokens-
|
|
1
|
+
import { S as resolveRoles, _ as schemaIds, f as usesCloudflareAccess, h as canonical, m as bundleSchemas, s as tokenEndpoints } from "./tokens-CS3E9OGg.js";
|
|
2
2
|
import { a as operationPathParameters } from "./http-paths-D043DkJv.js";
|
|
3
3
|
import { L as wireInput } from "./schemas-_UJcx_uY.js";
|
|
4
4
|
import { t as queryKind } from "./query-kind-CWKAXEME.js";
|
|
@@ -323,7 +323,8 @@ function bodyWithoutPathParameters(input, names) {
|
|
|
323
323
|
* The document the origin serves at `/openapi.json`: every public operation that declares an HTTP route,
|
|
324
324
|
* never an internal one, under one tag per group. Each request body, success envelope and failure is a named
|
|
325
325
|
* component, which a generated client names its types after; each operation also carries its scopes,
|
|
326
|
-
* effect, limits in force, MCP tool hints and native RPC as `x-*` extensions.
|
|
326
|
+
* effect, limits in force, MCP tool hints and native RPC as `x-*` extensions. An application that declares
|
|
327
|
+
* roles publishes each with the scopes it holds, as `x-maximus-roles`.
|
|
327
328
|
*
|
|
328
329
|
* Every schema reference in it is a local `#/components/schemas/<name>` pointer: the `$id`-named
|
|
329
330
|
* schemas of its paths and components (TypeBox Cyclic/Ref) become components, as `bundleSchemas`
|
|
@@ -478,6 +479,7 @@ function openApiDocument(manifest, kind) {
|
|
|
478
479
|
} : { name: group };
|
|
479
480
|
}),
|
|
480
481
|
paths,
|
|
482
|
+
...rpc || !manifest.roles ? {} : { "x-maximus-roles": resolveRoles(manifest) },
|
|
481
483
|
components: {
|
|
482
484
|
schemas: components.schemas,
|
|
483
485
|
...headers.size ? { headers: Object.fromEntries([...headers].map((name) => [name, HEADERS[name]])) } : {},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as executeOperation, r as recordCapture, t as recordMeter } from "./meter-
|
|
1
|
+
import { n as executeOperation, r as recordCapture, t as recordMeter } from "./meter-Mddtgv9_.js";
|
|
2
2
|
import { i as standardErrors } from "./errors-BoutSmiy.js";
|
|
3
|
-
import { r as createHttpHandler } from "./src-
|
|
3
|
+
import { r as createHttpHandler } from "./src-DPB9t4u0.js";
|
|
4
4
|
import { r as ok, t as err } from "./result-CF4OzG9O.js";
|
|
5
|
-
import { p as PrincipalSchema } from "./tokens-
|
|
5
|
+
import { p as PrincipalSchema } from "./tokens-CS3E9OGg.js";
|
|
6
6
|
import { i as parseInput } from "./validation-CpzAxj2_.js";
|
|
7
7
|
import { a as recordExecution, l as withTelemetry, o as reportUnexpected, s as telemetryEnabled } from "./telemetry-BtxJh69Q.js";
|
|
8
8
|
import { r as isRequestId } from "./correlation-4b23a-a4.js";
|
|
@@ -2,7 +2,7 @@ import { d as MAX_BODY_BYTES_CEILING, h as mcpOpenWorld, v as operationMatchesSc
|
|
|
2
2
|
import { o as reportUnexpected } from "./telemetry-BtxJh69Q.js";
|
|
3
3
|
import { i as standardErrors } from "./errors-BoutSmiy.js";
|
|
4
4
|
import { L as wireInput } from "./schemas-_UJcx_uY.js";
|
|
5
|
-
import { h as canonical, v as standaloneSchema } from "./tokens-
|
|
5
|
+
import { h as canonical, v as standaloneSchema } from "./tokens-CS3E9OGg.js";
|
|
6
6
|
import { t as toYaml } from "./yaml-Dk2L24yQ.js";
|
|
7
7
|
import { a as mcpTask, n as attachTasks, o as toolResult, r as declaresTasks } from "./tasks-DELqUSq8.js";
|
|
8
8
|
import { McpServer, ProtocolError, ProtocolErrorCode, createMcpHandler } from "@modelcontextprotocol/server";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { i as binaryBody, n as defineApp, r as attachmentResponse } from "./define-app-
|
|
1
|
+
import { i as binaryBody, n as defineApp, r as attachmentResponse } from "./define-app-CRKaiTzi.js";
|
|
2
2
|
import { a as taskAccess, b as operationScopes, m as isPublicOperation, o as taskView, p as composeOperations, s as withTaskOperations, u as DEFAULT_MAX_BODY_BYTES, v as operationMatchesScopes } from "./tasks-CD-B6_nv.js";
|
|
3
3
|
import { r as ok, t as err } from "./result-CF4OzG9O.js";
|
|
4
4
|
import { i as standardErrors } from "./errors-BoutSmiy.js";
|
|
5
|
-
import { c as tokenIssuer, i as presentedToken, n as createTokenAuthorization, o as tokenAudiences, u as isCrossSiteWrite } from "./tokens-
|
|
6
|
-
import { n as executeOperation, r as recordCapture, t as recordMeter } from "./meter-
|
|
5
|
+
import { c as tokenIssuer, i as presentedToken, n as createTokenAuthorization, o as tokenAudiences, u as isCrossSiteWrite } from "./tokens-CS3E9OGg.js";
|
|
6
|
+
import { n as executeOperation, r as recordCapture, t as recordMeter } from "./meter-Mddtgv9_.js";
|
|
7
7
|
import { t as createHttpRouteResolver } from "./http-paths-D043DkJv.js";
|
|
8
8
|
import { r as readBodyText } from "./body-DOIHwIIl.js";
|
|
9
9
|
import { t as sha256Hex } from "./digest-C51F1bhA.js";
|
|
10
|
-
import { a as ownsPrefix, i as nativePaths, n as composition, o as servesCloudflareAccess, r as httpTransports, s as servesOwnBearer, t as VERSIONED_PATH } from "./http-layout-
|
|
11
|
-
import { i as queryKinds, r as queryInput, t as createOpenApi } from "./openapi-
|
|
10
|
+
import { a as ownsPrefix, i as nativePaths, n as composition, o as servesCloudflareAccess, r as httpTransports, s as servesOwnBearer, t as VERSIONED_PATH } from "./http-layout-CB6MdZOO.js";
|
|
11
|
+
import { i as queryKinds, r as queryInput, t as createOpenApi } from "./openapi-tJeJfq1G.js";
|
|
12
12
|
import { n as mediaType } from "./json-B14evE6-.js";
|
|
13
13
|
import { t as toYaml } from "./yaml-Dk2L24yQ.js";
|
|
14
14
|
import { a as recordExecution, i as recordAdmission, l as withTelemetry, o as reportUnexpected, s as telemetryEnabled } from "./telemetry-BtxJh69Q.js";
|
|
@@ -2,12 +2,92 @@ import { i as parseInput } from "./validation-CpzAxj2_.js";
|
|
|
2
2
|
import { i as UuidSchema, n as OrganizationIdSchema, z as withoutSecretKeyword } from "./schemas-_UJcx_uY.js";
|
|
3
3
|
import { t as isRecord } from "./record-DQUDTpEA.js";
|
|
4
4
|
import { i as standardErrors } from "./errors-BoutSmiy.js";
|
|
5
|
-
import { S as matchesScopes, x as isNamespacedScope } from "./tasks-CD-B6_nv.js";
|
|
5
|
+
import { S as matchesScopes, b as operationScopes, m as isPublicOperation, v as operationMatchesScopes, x as isNamespacedScope } from "./tasks-CD-B6_nv.js";
|
|
6
6
|
import { r as ok, t as err } from "./result-CF4OzG9O.js";
|
|
7
7
|
import { t as sha256Hex } from "./digest-C51F1bhA.js";
|
|
8
8
|
import { Type } from "typebox";
|
|
9
9
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
10
10
|
|
|
11
|
+
// src/roles.ts
|
|
12
|
+
/**
|
|
13
|
+
* A service's roles: what a person, or a key that stands for one, may do there, in the few words an
|
|
14
|
+
* administrator chooses among. A role names resources and what it may do with them; its scopes are derived
|
|
15
|
+
* from that, so nobody lists permissions by hand.
|
|
16
|
+
*/
|
|
17
|
+
/** The most roles a service declares: few enough that each is explained in one sentence. */
|
|
18
|
+
const MAX_ROLES = 3;
|
|
19
|
+
/**
|
|
20
|
+
* Declares a service's roles for its application's `roles`. It returns them unchanged: what it adds is the
|
|
21
|
+
* type check that a role extends another declared role and never itself. `.build()` checks the rest
|
|
22
|
+
* against the application's operations.
|
|
23
|
+
*/
|
|
24
|
+
function defineRoles(roles) {
|
|
25
|
+
return roles;
|
|
26
|
+
}
|
|
27
|
+
const ROLE_NAME = /^[a-z][a-z0-9-]{1,31}$/;
|
|
28
|
+
const ROLE_FIELDS = /* @__PURE__ */ new Set([
|
|
29
|
+
"description",
|
|
30
|
+
"extends",
|
|
31
|
+
"can",
|
|
32
|
+
"all"
|
|
33
|
+
]);
|
|
34
|
+
/** Every scope a public operation takes: the ones that admit a call and the ones its handler checks. */
|
|
35
|
+
function publicScopes(operations) {
|
|
36
|
+
return new Set(Object.values(operations).filter(isPublicOperation).flatMap((operation) => [...operationScopes(operation), ...operation.conditionalScopes ?? []]));
|
|
37
|
+
}
|
|
38
|
+
/** The scopes a role names itself, without the ones it extends. */
|
|
39
|
+
function ownScopes(namespace, role) {
|
|
40
|
+
return Object.entries(role.can ?? {}).flatMap(([action, resources]) => resources.map((resource) => `${namespace}:${resource}:${action}`));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Each role of an application with every scope it holds; an application without roles has none. Call it on
|
|
44
|
+
* a built application: `.build()` has then checked the roles, and this only expands them.
|
|
45
|
+
*/
|
|
46
|
+
function resolveRoles(application) {
|
|
47
|
+
const roles = application.roles ?? {};
|
|
48
|
+
const everything = publicScopes(application.operations);
|
|
49
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
50
|
+
const scopesOf = (name, path) => {
|
|
51
|
+
const known = resolved.get(name);
|
|
52
|
+
if (known) return known;
|
|
53
|
+
const role = roles[name];
|
|
54
|
+
if (!role || path.includes(name)) throw new TypeError(`Role "${path[0] ?? name}": it extends a role that is not declared, or itself.`);
|
|
55
|
+
const scopes = role.all ? [...everything] : [...ownScopes(application.namespace, role), ...role.extends ? scopesOf(role.extends, [...path, name]) : []];
|
|
56
|
+
const sorted = [...new Set(scopes)].toSorted();
|
|
57
|
+
resolved.set(name, sorted);
|
|
58
|
+
return sorted;
|
|
59
|
+
};
|
|
60
|
+
return Object.fromEntries(Object.entries(roles).map(([name, role]) => [name, {
|
|
61
|
+
description: role.description,
|
|
62
|
+
permissions: scopesOf(name, [])
|
|
63
|
+
}]));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Refuses roles an application cannot have, with a TypeError that names the role: more than `MAX_ROLES`, a
|
|
67
|
+
* name that is not a word, an unknown field, a missing description, `all` beside `can` or `extends`, a role
|
|
68
|
+
* extending an undeclared one or itself, a scope no public operation takes, a role that holds nothing, and
|
|
69
|
+
* a public operation no role may call.
|
|
70
|
+
*/
|
|
71
|
+
function checkRoles(application) {
|
|
72
|
+
const { roles } = application;
|
|
73
|
+
if (roles === void 0) return;
|
|
74
|
+
const names = Object.keys(roles);
|
|
75
|
+
if (names.length === 0 || names.length > 3) throw new TypeError(`An application declares between one and ${3} roles, or none at all.`);
|
|
76
|
+
const everything = publicScopes(application.operations);
|
|
77
|
+
for (const [name, role] of Object.entries(roles)) {
|
|
78
|
+
if (!ROLE_NAME.test(name)) throw new TypeError(`Role "${name}": a role's name is a lowercase kebab-case word of 2 to 32 characters.`);
|
|
79
|
+
const unknown = Object.keys(role).find((field) => !ROLE_FIELDS.has(field));
|
|
80
|
+
if (unknown) throw new TypeError(`Role "${name}": "${unknown}" is not a role field.`);
|
|
81
|
+
if (typeof role.description !== "string" || !role.description.trim()) throw new TypeError(`Role "${name}": a description says what the role is for.`);
|
|
82
|
+
if (role.all !== void 0 && (role.all !== true || role.can !== void 0 || role.extends !== void 0)) throw new TypeError(`Role "${name}": "all: true" stands alone, without "can" or "extends".`);
|
|
83
|
+
for (const scope of ownScopes(application.namespace, role)) if (!isNamespacedScope(scope, application.namespace) || !everything.has(scope)) throw new TypeError(`Role "${name}": no public operation takes the scope "${scope}".`);
|
|
84
|
+
}
|
|
85
|
+
const resolved = resolveRoles(application);
|
|
86
|
+
for (const [name, role] of Object.entries(resolved)) if (role.permissions.length === 0) throw new TypeError(`Role "${name}": it holds no scope.`);
|
|
87
|
+
const held = Object.values(resolved).map((role) => role.permissions);
|
|
88
|
+
for (const [operation, declared] of Object.entries(application.operations)) if (isPublicOperation(declared) && !held.some((permissions) => operationMatchesScopes(declared, permissions))) throw new TypeError(`Operation "${operation}": it is public and no role may call it.`);
|
|
89
|
+
}
|
|
90
|
+
|
|
11
91
|
// src/schema-bundle.ts
|
|
12
92
|
/**
|
|
13
93
|
* Schema bundling: named schemas (`$id`) become shared components for an OpenAPI document, or are written
|
|
@@ -702,4 +782,4 @@ function createTokenAuthorization(policy, given) {
|
|
|
702
782
|
};
|
|
703
783
|
}
|
|
704
784
|
|
|
705
|
-
export { schemaIds as _, projectToken as a, tokenIssuer as c, projectAccessToken as d, usesCloudflareAccess as f, hasSchemaReferences as g, canonical as h, presentedToken as i, usesOwnBearer as l, bundleSchemas as m, createTokenAuthorization as n, tokenAudiences as o, PrincipalSchema as p, createTokenVerifier as r, tokenEndpoints as s, checkTokenAuthority as t, isCrossSiteWrite as u, standaloneSchema as v };
|
|
785
|
+
export { resolveRoles as S, schemaIds as _, projectToken as a, checkRoles as b, tokenIssuer as c, projectAccessToken as d, usesCloudflareAccess as f, hasSchemaReferences as g, canonical as h, presentedToken as i, usesOwnBearer as l, bundleSchemas as m, createTokenAuthorization as n, tokenAudiences as o, PrincipalSchema as p, createTokenVerifier as r, tokenEndpoints as s, checkTokenAuthority as t, isCrossSiteWrite as u, standaloneSchema as v, defineRoles as x, MAX_ROLES as y };
|
|
@@ -1121,6 +1121,49 @@ interface MeterApplication<E> {
|
|
|
1121
1121
|
* failure, without a background context, or while the env has no such binding, as in a preview.
|
|
1122
1122
|
*/
|
|
1123
1123
|
declare function recordMeter<E>(application: MeterApplication<E>, env: E, background: BackgroundContext | undefined, metered: MeteredCall): void;
|
|
1124
|
+
/** The most roles a service declares: few enough that each is explained in one sentence. */
|
|
1125
|
+
declare const MAX_ROLES = 3;
|
|
1126
|
+
/** One role of a service. */
|
|
1127
|
+
interface RoleDefinition<Name extends string = string> {
|
|
1128
|
+
/** What the role is for, in a sentence a person reads before giving it. */
|
|
1129
|
+
description: string;
|
|
1130
|
+
/** Another role of the service this one includes: whatever that role may do, this one may too. */
|
|
1131
|
+
extends?: Name;
|
|
1132
|
+
/**
|
|
1133
|
+
* What the role may do, by action: `{ read: ['notes'], write: ['notes'] }` holds `<namespace>:notes:read`
|
|
1134
|
+
* and `<namespace>:notes:write`. Each scope it names is one a public operation takes.
|
|
1135
|
+
*/
|
|
1136
|
+
can?: Readonly<Record<string, readonly string[]>>;
|
|
1137
|
+
/** Every scope a public operation takes. A role with it declares neither `can` nor `extends`. */
|
|
1138
|
+
all?: true;
|
|
1139
|
+
}
|
|
1140
|
+
/** A service's roles by name: a lowercase kebab-case word, such as `viewer`. At most `MAX_ROLES`. */
|
|
1141
|
+
type RoleDefinitions = Readonly<Record<string, RoleDefinition>>;
|
|
1142
|
+
/** A role as it is published: what it is for and every scope it holds, the ones it extends included. */
|
|
1143
|
+
interface ResolvedRole {
|
|
1144
|
+
description: string;
|
|
1145
|
+
/** In name order, each once. */
|
|
1146
|
+
permissions: readonly string[];
|
|
1147
|
+
}
|
|
1148
|
+
/** Refuses, in the type, a role field no role has, such as a misspelled one, which would do nothing. */
|
|
1149
|
+
type KnownRoleFields<R> = Readonly<Record<Exclude<keyof R, keyof RoleDefinition>, never>>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Declares a service's roles for its application's `roles`. It returns them unchanged: what it adds is the
|
|
1152
|
+
* type check that a role extends another declared role and never itself. `.build()` checks the rest
|
|
1153
|
+
* against the application's operations.
|
|
1154
|
+
*/
|
|
1155
|
+
declare function defineRoles<const R extends { readonly [K in keyof R]: RoleDefinition<Exclude<Extract<keyof R, string>, K>> & KnownRoleFields<R[K]>; }>(roles: R): R;
|
|
1156
|
+
/** What `resolveRoles` and `checkRoles` read of an application. */
|
|
1157
|
+
interface RoleSource {
|
|
1158
|
+
namespace: string;
|
|
1159
|
+
operations: Readonly<Record<string, OperationShape>>;
|
|
1160
|
+
roles?: RoleDefinitions;
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Each role of an application with every scope it holds; an application without roles has none. Call it on
|
|
1164
|
+
* a built application: `.build()` has then checked the roles, and this only expands them.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function resolveRoles(application: RoleSource): Record<string, ResolvedRole>;
|
|
1124
1167
|
/**
|
|
1125
1168
|
* A schema's JSON Schema keywords, as Maximus reads them to publish, route and check a contract. TypeBox 1.x
|
|
1126
1169
|
* types a schema without its options, so a service reads one through this view:
|
|
@@ -1492,6 +1535,13 @@ interface AppManifest<Env, C, Ops extends Record<string, OperationShape>> {
|
|
|
1492
1535
|
* `{ Notes: "The notes of the caller's organization." }`: the description of its OpenAPI tag.
|
|
1493
1536
|
*/
|
|
1494
1537
|
groups?: Readonly<Record<string, string>>;
|
|
1538
|
+
/**
|
|
1539
|
+
* The service's roles, from `defineRoles()`: at most three, each saying what it may do with the service's
|
|
1540
|
+
* resources. `.build()` refuses a role that names a scope no public operation takes and a public operation
|
|
1541
|
+
* no role may call; the OpenAPI document publishes each role with the scopes it holds. Omitted, the service
|
|
1542
|
+
* declares no roles and who holds its scopes is decided elsewhere.
|
|
1543
|
+
*/
|
|
1544
|
+
roles?: RoleDefinitions;
|
|
1495
1545
|
/**
|
|
1496
1546
|
* The service's version: OpenAPI `info.version`, the MCP server version and the `version` that `/health`
|
|
1497
1547
|
* reports.
|
|
@@ -2914,7 +2964,8 @@ declare function retryAfterSeconds(value: string | null, nowMs: number, maximum?
|
|
|
2914
2964
|
* The document the origin serves at `/openapi.json`: every public operation that declares an HTTP route,
|
|
2915
2965
|
* never an internal one, under one tag per group. Each request body, success envelope and failure is a named
|
|
2916
2966
|
* component, which a generated client names its types after; each operation also carries its scopes,
|
|
2917
|
-
* effect, limits in force, MCP tool hints and native RPC as `x-*` extensions.
|
|
2967
|
+
* effect, limits in force, MCP tool hints and native RPC as `x-*` extensions. An application that declares
|
|
2968
|
+
* roles publishes each with the scopes it holds, as `x-maximus-roles`.
|
|
2918
2969
|
*
|
|
2919
2970
|
* Every schema reference in it is a local `#/components/schemas/<name>` pointer: the `$id`-named
|
|
2920
2971
|
* schemas of its paths and components (TypeBox Cyclic/Ref) become components, as `bundleSchemas`
|
|
@@ -2944,4 +2995,4 @@ declare function createRpcOpenApi<E, C, O extends Record<string, OperationShape>
|
|
|
2944
2995
|
* the argument.
|
|
2945
2996
|
*/
|
|
2946
2997
|
declare function defineApp<Env, C>(): <const Ops extends Record<string, OperationShape>>(manifest: AppManifest<Env, C, Ops>) => AppManifest<Env, C, Ops>;
|
|
2947
|
-
export { PageInfo as $,
|
|
2998
|
+
export { PageInfo as $, executeOperation as $n, TraceParent as $r, defineContext as $t, TransportContext as A, ResolvedRole as An, CaptureRecordSchema as Ar, decodeSchema as At, DeletedObject as B, TokenUsage as Bn, AttachmentOutputSchema as Br, HandlerArguments as Bt, isPathParameterValue as C, isPublicOperation as Cn, Principal as Cr, stripObject as Ct, HttpRoute as D, SchemaKeywords as Dn, OAuthResource as Dr, SchemaValidationError as Dt, HttpOptions as E, operationScopes as En, TokenPrincipal as Er, SchemaIssue as Et, Static$2 as F, BillingService as Fn, Success as Fr, ContextDeclaration as Ft, NamedReference as G, CaptureConfig as Gn, ErrorFactory as Gr, PreparedContext as Gt, EmailAddressSchema as H, UsageReceipt as Hn, DefinedErrors as Hr, HandlerHttp as Ht, TSchema$2 as I, LimitVerdict as In, err as Ir, DomainCode as It, PostalAddress as J, CaptureSink as Jn, FailureSchema as Jr, SchemaOf as Jt, NamedReferenceSchema as K, CaptureDimensions as Kn, Failure as Kr, RegisteredEnv as Kt, Type$2 as L, MeteredCall as Ln, isResult as Lr, Fail as Lt, projectAccessToken as M, RoleDefinitions as Mn, BodyFailure as Mr, parseSchema as Mt, EmptyInputSchema as N, defineRoles as Nn, FailureResult as Nr, AuthOptions as Nt, HttpTransport as O, StaticDecode as On, protectedResourceMetadata as Or, InputIssue as Ot, OrganizationIdSchema as P, resolveRoles as Pn, Result as Pr, ContextArguments as Pt, Page as Q, ExecutionCall as Qn, DurableCorrelation as Qr, defineAuth as Qt, UuidSchema as R, OperationMeter as Rn, ok as Rr, Failed as Rt, isInputHeaderName as S, composeOperations as Sn, matchesScopes as Sr, strictObject as St, HttpMiddleware as T, operationMatchesScopes as Tn, TokenClient as Tr, urlSchema as Tt, HexColorSchema as U, recordMeter as Un, ErrorCatalog as Ur, HandlerMcp as Ut, DeletedObjectSchema as V, UsageEvent as Vn, CreateArguments as Vr, HandlerDeclaration as Vt, HttpsUrlSchema as W, AnyContext as Wn, ErrorDefinition as Wr, HandlerOptions as Wt, SignedUrl as X, VerifiedCaller as Xn, resultSchema as Xr, ToolDeclaration as Xt, PostalAddressSchema as Y, CapturedCall as Yn, defineErrors as Yr, SchemaOrFields as Yt, SignedUrlSchema as Z, recordCapture as Zn, standardErrors as Zr, ToolOptions as Zt, readBodyText as _, McpSkill as _n, TokenSource as _r, literalUnion as _t, t as a, ApplicationBuilder as an, diagnosticsEnabled as ar, cursorKey as at, createHttpRouteResolver as b, OperationScope as bn, projectToken as br, pipeSchema as bt, isJsonMediaType as c, TaskAccess as cn, telemetryEnabled as cr, withoutSecrets as ct, retryAfterSeconds as d, AppManifest as dn, TokenAlgorithm as dr, readSchema as dt, createRequestId as ei, defineHandler as en, AdmissionObservation as er, PageInfoSchema as et, publicDestination as f, Exposure as fn, TokenClaims as fr, SchemaInput as ft, readBodyBytes as g, McpGuide as gn, TokenScheme as gr, inspectSchema as gt, HttpBodyFailureReason as h, McpConfiguration as hn, TokenResolutionContext as hr, inputSchema as ht, Type$1 as i, StandardFailure as in, TelemetryConfig as ir, TPage as it, createHttpHandler as j, RoleDefinition as jn, BinaryBody as jr, parseInput as jt, RouteContext as k, MAX_ROLES as kn, CaptureRecord as kr, decodeInput as kt, readJsonBody as l, TaskRecord as ln, withDiagnostics as lr, Checked as lt, HttpBodyFailure as m, InvocationAuthority as mn, TokenPolicy as mr, extendObject as mt, Static$1 as n, isRequestId as ni, defineTool as nn, ExecutionObservation as nr, PageQuery as nt, createOpenApi as o, ApplicationConfiguration as on, recordExecution as or, cutPage as ot, BodyReadOptions as p, Invocation as pn, TokenDevelopment as pr, defaultSchema as pt, PhoneNumberSchema as q, CaptureInvocation as qn, FailureData as qr, RouteBody as qt, TSchema$1 as r, parseTraceParent as ri, STANDARD_FAILURES as rn, Observer as rr, PageQueryFields as rt, createRpcOpenApi as s, maximus as sn, reportUnexpected as sr, pageLimit as st, defineApp as t, durableCorrelation as ti, defineTelemetry as tn, BackgroundContext as tr, PageOrder as tt, readJsonResponse as u, TaskStore as un, TokenAccess as ur, checkSchema as ut, HttpRouteDefinition as v, OperationHandler as vn, createTokenAuthorization as vr, looseObject as vt, operationPathParameters as w, operation as wn, PrincipalSchema as wr, transformSchema as wt, decodePathParameter as x, OperationShape as xn, ScopeMatch as xr, refineSchema as xt, HttpRouteMatch as y, OperationMiddleware as yn, createTokenVerifier as yr, normalizeSchema as yt, t$1 as z, SpendVerdict as zn, Attachment as zr, HandlerAnswer as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cr as Principal, D as HttpRoute, E as HttpOptions, Kr as Failure, Pr as Result, dn as AppManifest, n as Static, r as TSchema, un as TaskStore, xn as OperationShape } from "./types-hP7p4Rsp.js";
|
|
2
2
|
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
|
3
3
|
/** A Workers static-assets binding; product stores and secrets never satisfy this capability. */
|
|
4
4
|
interface AssetBinding {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as Static, Kr as Failure, xn as OperationShape } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/** What every HTTP operation answers: its data on success, its failure otherwise, and the request id. */
|
|
3
3
|
export type Envelope<T> = {
|
|
4
4
|
success: true;
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $r as TraceParent, Qr as DurableCorrelation, ar as diagnosticsEnabled, cr as telemetryEnabled, ei as createRequestId, ir as TelemetryConfig, lr as withDiagnostics, ni as isRequestId, nr as ExecutionObservation, or as recordExecution, ri as parseTraceParent, rr as Observer, sr as reportUnexpected, ti as durableCorrelation, tr as BackgroundContext } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/**
|
|
3
3
|
* What diagnostics may say about an error: its name, its causes' names, its issue count and its stack
|
|
4
4
|
* locations.
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gr as ErrorFactory, Hr as DefinedErrors, Jr as FailureSchema, Kr as Failure, Ur as ErrorCatalog, Vr as CreateArguments, Wr as ErrorDefinition, Xr as resultSchema, Yr as defineErrors, Zr as standardErrors, ni as isRequestId, qr as FailureData } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { CreateArguments, DefinedErrors, ErrorCatalog, ErrorDefinition, ErrorFactory, Failure, FailureData, FailureSchema, defineErrors, isRequestId, resultSchema, standardErrors };
|
package/dist/http-paths.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as isPathParameterValue, S as isInputHeaderName, b as createHttpRouteResolver, v as HttpRouteDefinition, w as operationPathParameters, x as decodePathParameter, y as HttpRouteMatch } from "./chunks/types-
|
|
1
|
+
import { C as isPathParameterValue, S as isInputHeaderName, b as createHttpRouteResolver, v as HttpRouteDefinition, w as operationPathParameters, x as decodePathParameter, y as HttpRouteMatch } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { HttpRouteDefinition, HttpRouteMatch, createHttpRouteResolver, decodePathParameter, isInputHeaderName, isPathParameterValue, operationPathParameters };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as PageInfo, $t as defineContext, A as TransportContext, An as
|
|
2
|
-
export { type AdmissionObservation, type AppManifest, type ApplicationBuilder, type ApplicationConfiguration, type Attachment, AttachmentOutputSchema, type AuthOptions, type BackgroundContext, type BillingService, type BinaryBody, type BodyFailure, type BodyReadOptions, type ContextArguments, type ContextDeclaration, type DefinedErrors, type DeletedObject, DeletedObjectSchema, type DomainCode, EmailAddressSchema, EmptyInputSchema, type ErrorCatalog, type ErrorDefinition, type ErrorFactory, type ExecutionObservation, type Exposure, type Fail, type Failed, type Failure, type FailureData, type FailureResult, FailureSchema, type HandlerAnswer, type HandlerArguments, type HandlerDeclaration, type HandlerHttp, type HandlerMcp, type HandlerOptions, HexColorSchema, type HttpBodyFailure, type HttpBodyFailureReason, type HttpMiddleware, type HttpOptions, type HttpRoute, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, HttpsUrlSchema, type Invocation, type InvocationAuthority, type LimitVerdict, type McpConfiguration, type McpGuide, type McpSkill, type NamedReference, NamedReferenceSchema, type OAuthResource, type Observer, type OperationMeter, type OperationMiddleware, type OperationScope, type OperationShape, OrganizationIdSchema, Page, type PageInfo, PageInfoSchema, type PageOrder, type PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type PreparedContext, type Principal, PrincipalSchema, type Result, type RouteBody, type RouteContext, type SchemaKeywords, type SchemaOf, type SchemaOrFields, type ScopeMatch, type SignedUrl, SignedUrlSchema, type SpendVerdict, type Static, type Success, type TPage, type TSchema, type TelemetryConfig, type TokenAccess, type TokenAlgorithm, type TokenClaims, type TokenClient, type TokenDevelopment, type TokenPolicy, type TokenPrincipal, type TokenResolutionContext, type TokenScheme, type TokenSource, type TokenUsage, type ToolDeclaration, type ToolOptions, type TransportContext, Type, type UsageEvent, type UsageReceipt, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
1
|
+
import { $ as PageInfo, $t as defineContext, A as TransportContext, An as ResolvedRole, B as DeletedObject, Bn as TokenUsage, Br as AttachmentOutputSchema, Bt as HandlerArguments, Cn as isPublicOperation, Cr as Principal, D as HttpRoute, Dn as SchemaKeywords, Dr as OAuthResource, E as HttpOptions, En as operationScopes, Er as TokenPrincipal, Fn as BillingService, Fr as Success, Ft as ContextDeclaration, G as NamedReference, Gr as ErrorFactory, Gt as PreparedContext, H as EmailAddressSchema, Hn as UsageReceipt, Hr as DefinedErrors, Ht as HandlerHttp, In as LimitVerdict, Ir as err, It as DomainCode, J as PostalAddress, Jr as FailureSchema, Jt as SchemaOf, K as NamedReferenceSchema, Kr as Failure, Lr as isResult, Lt as Fail, M as projectAccessToken, Mn as RoleDefinitions, Mr as BodyFailure, Mt as parseSchema, N as EmptyInputSchema, Nn as defineRoles, Nr as FailureResult, Nt as AuthOptions, O as HttpTransport, Or as protectedResourceMetadata, P as OrganizationIdSchema, Pn as resolveRoles, Pr as Result, Pt as ContextArguments, Q as Page, Qt as defineAuth, R as UuidSchema, Rn as OperationMeter, Rr as ok, Rt as Failed, Sr as matchesScopes, T as HttpMiddleware, Tn as operationMatchesScopes, Tr as TokenClient, U as HexColorSchema, Ur as ErrorCatalog, Ut as HandlerMcp, V as DeletedObjectSchema, Vn as UsageEvent, Vt as HandlerDeclaration, W as HttpsUrlSchema, Wr as ErrorDefinition, Wt as HandlerOptions, X as SignedUrl, Xr as resultSchema, Xt as ToolDeclaration, Y as PostalAddressSchema, Yr as defineErrors, Yt as SchemaOrFields, Z as SignedUrlSchema, Zr as standardErrors, Zt as ToolOptions, _ as readBodyText, _n as McpSkill, _r as TokenSource, a as t, an as ApplicationBuilder, at as cursorKey, b as createHttpRouteResolver, bn as OperationScope, br as projectToken, c as isJsonMediaType, d as retryAfterSeconds, dn as AppManifest, dr as TokenAlgorithm, en as defineHandler, er as AdmissionObservation, et as PageInfoSchema, f as publicDestination, fn as Exposure, fr as TokenClaims, g as readBodyBytes, gn as McpGuide, gr as TokenScheme, h as HttpBodyFailureReason, hn as McpConfiguration, hr as TokenResolutionContext, i as Type, ir as TelemetryConfig, it as TPage, j as createHttpHandler, jn as RoleDefinition, jr as BinaryBody, jt as parseInput, k as RouteContext, kn as MAX_ROLES, l as readJsonBody, m as HttpBodyFailure, mn as InvocationAuthority, mr as TokenPolicy, n as Static, nn as defineTool, nr as ExecutionObservation, nt as PageQuery, o as createOpenApi, on as ApplicationConfiguration, ot as cutPage, p as BodyReadOptions, pn as Invocation, pr as TokenDevelopment, q as PhoneNumberSchema, qr as FailureData, qt as RouteBody, r as TSchema, rr as Observer, rt as PageQueryFields, s as createRpcOpenApi, sn as maximus, sr as reportUnexpected, st as pageLimit, tn as defineTelemetry, tr as BackgroundContext, tt as PageOrder, u as readJsonResponse, ur as TokenAccess, v as HttpRouteDefinition, vr as createTokenAuthorization, wr as PrincipalSchema, xn as OperationShape, xr as ScopeMatch, y as HttpRouteMatch, yn as OperationMiddleware, yr as createTokenVerifier, zn as SpendVerdict, zr as Attachment, zt as HandlerAnswer } from "./chunks/types-hP7p4Rsp.js";
|
|
2
|
+
export { type AdmissionObservation, type AppManifest, type ApplicationBuilder, type ApplicationConfiguration, type Attachment, AttachmentOutputSchema, type AuthOptions, type BackgroundContext, type BillingService, type BinaryBody, type BodyFailure, type BodyReadOptions, type ContextArguments, type ContextDeclaration, type DefinedErrors, type DeletedObject, DeletedObjectSchema, type DomainCode, EmailAddressSchema, EmptyInputSchema, type ErrorCatalog, type ErrorDefinition, type ErrorFactory, type ExecutionObservation, type Exposure, type Fail, type Failed, type Failure, type FailureData, type FailureResult, FailureSchema, type HandlerAnswer, type HandlerArguments, type HandlerDeclaration, type HandlerHttp, type HandlerMcp, type HandlerOptions, HexColorSchema, type HttpBodyFailure, type HttpBodyFailureReason, type HttpMiddleware, type HttpOptions, type HttpRoute, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, HttpsUrlSchema, type Invocation, type InvocationAuthority, type LimitVerdict, MAX_ROLES, type McpConfiguration, type McpGuide, type McpSkill, type NamedReference, NamedReferenceSchema, type OAuthResource, type Observer, type OperationMeter, type OperationMiddleware, type OperationScope, type OperationShape, OrganizationIdSchema, Page, type PageInfo, PageInfoSchema, type PageOrder, type PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type PreparedContext, type Principal, PrincipalSchema, type ResolvedRole, type Result, type RoleDefinition, type RoleDefinitions, type RouteBody, type RouteContext, type SchemaKeywords, type SchemaOf, type SchemaOrFields, type ScopeMatch, type SignedUrl, SignedUrlSchema, type SpendVerdict, type Static, type Success, type TPage, type TSchema, type TelemetryConfig, type TokenAccess, type TokenAlgorithm, type TokenClaims, type TokenClient, type TokenDevelopment, type TokenPolicy, type TokenPrincipal, type TokenResolutionContext, type TokenScheme, type TokenSource, type TokenUsage, type ToolDeclaration, type ToolOptions, type TransportContext, Type, type UsageEvent, type UsageReceipt, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineRoles, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resolveRoles, resultSchema, retryAfterSeconds, standardErrors, t };
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ import { i as standardErrors, n as defineErrors, r as resultSchema, t as Failure
|
|
|
4
4
|
import { n as readBodyBytes, r as readBodyText } from "./chunks/body-DOIHwIIl.js";
|
|
5
5
|
import { t as createHttpRouteResolver } from "./chunks/http-paths-D043DkJv.js";
|
|
6
6
|
import { S as matchesScopes, b as operationScopes, m as isPublicOperation, v as operationMatchesScopes } from "./chunks/tasks-CD-B6_nv.js";
|
|
7
|
-
import { a as projectToken, d as projectAccessToken, n as createTokenAuthorization, p as PrincipalSchema, r as createTokenVerifier } from "./chunks/tokens-
|
|
7
|
+
import { S as resolveRoles, a as projectToken, d as projectAccessToken, n as createTokenAuthorization, p as PrincipalSchema, r as createTokenVerifier, x as defineRoles, y as MAX_ROLES } from "./chunks/tokens-CS3E9OGg.js";
|
|
8
8
|
import { n as isResult, r as ok, t as err } from "./chunks/result-CF4OzG9O.js";
|
|
9
|
-
import { a as maximus, i as protectedResourceMetadata, n as t, r as createHttpHandler, t as Type } from "./chunks/src-
|
|
9
|
+
import { a as maximus, i as protectedResourceMetadata, n as t, r as createHttpHandler, t as Type } from "./chunks/src-DPB9t4u0.js";
|
|
10
10
|
import { a as defineTelemetry, i as defineHandler, n as defineAuth, o as defineTool, r as defineContext } from "./chunks/handler-DSpyrWc-.js";
|
|
11
11
|
import { o as reportUnexpected } from "./chunks/telemetry-BtxJh69Q.js";
|
|
12
|
-
import { n as createRpcOpenApi, t as createOpenApi } from "./chunks/openapi-
|
|
12
|
+
import { n as createRpcOpenApi, t as createOpenApi } from "./chunks/openapi-tJeJfq1G.js";
|
|
13
13
|
import { a as retryAfterSeconds, i as readJsonResponse, r as readJsonBody, t as isJsonMediaType } from "./chunks/json-B14evE6-.js";
|
|
14
14
|
import { t as publicDestination } from "./chunks/destination-5xTX0b7E.js";
|
|
15
15
|
|
|
16
|
-
export { AttachmentOutputSchema, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, FailureSchema, HexColorSchema, HttpsUrlSchema, NamedReferenceSchema, OrganizationIdSchema, Page, PageInfoSchema, PageQueryFields, PhoneNumberSchema, PostalAddressSchema, PrincipalSchema, SignedUrlSchema, Type, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
16
|
+
export { AttachmentOutputSchema, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, FailureSchema, HexColorSchema, HttpsUrlSchema, MAX_ROLES, NamedReferenceSchema, OrganizationIdSchema, Page, PageInfoSchema, PageQueryFields, PhoneNumberSchema, PostalAddressSchema, PrincipalSchema, SignedUrlSchema, Type, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createRpcOpenApi, createTokenAuthorization, createTokenVerifier, cursorKey, cutPage, defineAuth, defineContext, defineErrors, defineHandler, defineRoles, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, publicDestination, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resolveRoles, resultSchema, retryAfterSeconds, standardErrors, t };
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as TransportContext, E as HttpOptions, En as operationScopes, Gn as
|
|
1
|
+
import { $n as executeOperation, A as TransportContext, E as HttpOptions, En as operationScopes, Gn as CaptureConfig, Ln as MeteredCall, O as HttpTransport, Qn as ExecutionCall, Sn as composeOperations, Un as recordMeter, Xn as VerifiedCaller, Yn as CapturedCall, Zn as recordCapture, b as createHttpRouteResolver, cr as telemetryEnabled, dn as AppManifest, ir as TelemetryConfig, lr as withDiagnostics, mn as InvocationAuthority, or as recordExecution, pn as Invocation, t as defineApp, tr as BackgroundContext, v as HttpRouteDefinition, wn as operation, xn as OperationShape, y as HttpRouteMatch, yn as OperationMiddleware } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { type AppManifest, type BackgroundContext, type CaptureConfig, type CapturedCall, type ExecutionCall, type HttpOptions, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, type Invocation, type InvocationAuthority, type MeteredCall, type OperationMiddleware, type OperationShape, type TelemetryConfig, type TransportContext, type VerifiedCaller, composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordCapture, recordExecution, recordMeter, telemetryEnabled, withDiagnostics };
|
package/dist/internals.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as executeOperation, r as recordCapture, t as recordMeter } from "./chunks/meter-
|
|
2
|
-
import { n as defineApp } from "./chunks/define-app-
|
|
1
|
+
import { n as executeOperation, r as recordCapture, t as recordMeter } from "./chunks/meter-Mddtgv9_.js";
|
|
2
|
+
import { n as defineApp } from "./chunks/define-app-CRKaiTzi.js";
|
|
3
3
|
import { b as operationScopes, g as operation, p as composeOperations } from "./chunks/tasks-CD-B6_nv.js";
|
|
4
4
|
import { a as recordExecution, c as withDiagnostics, s as telemetryEnabled } from "./chunks/telemetry-BtxJh69Q.js";
|
|
5
5
|
import { t as createHttpRouteResolver } from "./chunks/http-paths-D043DkJv.js";
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as HttpTransport } from "../chunks/types-
|
|
1
|
+
import { O as HttpTransport } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/**
|
|
3
3
|
* The MCP transport, for `createWorker(app, { transports: [mcp()] })`: serves the operations that declare
|
|
4
4
|
* `mcp` as tools over Streamable HTTP at `/mcp` (or `path`), with the OpenAPI document and guides as
|
package/dist/mcp/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function mcp(options = {}) {
|
|
|
13
13
|
scope: (namespace) => `${namespace}:mcp:use`,
|
|
14
14
|
maxBodyBytes: (operations, fallback) => Math.max(fallback, ...operations.flatMap(([, op]) => op.mcp ? [op.maxBodyBytes ?? fallback] : [])),
|
|
15
15
|
async handle(context) {
|
|
16
|
-
const { handleMcp } = await import("../chunks/server-
|
|
16
|
+
const { handleMcp } = await import("../chunks/server-D49V-Sd4.js");
|
|
17
17
|
return handleMcp(context);
|
|
18
18
|
}
|
|
19
19
|
};
|
package/dist/mcp/tasks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Kr as Failure, Pr as Result, cn as TaskAccess, ln as TaskRecord } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
import { CallToolResult, McpServer } from "@modelcontextprotocol/server";
|
|
3
3
|
/** The Tasks extension's id, which a client declares on each request and a server among its capabilities. */
|
|
4
4
|
export declare const TASKS_EXTENSION = "io.modelcontextprotocol/tasks";
|
package/dist/project/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ft as ContextDeclaration,
|
|
1
|
+
import { Ft as ContextDeclaration, Rn as OperationMeter, T as HttpMiddleware, Vt as HandlerDeclaration, Xt as ToolDeclaration, an as ApplicationBuilder, dn as AppManifest, fn as Exposure, pn as Invocation, vn as OperationHandler, xn as OperationShape, yn as OperationMiddleware } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
import { TSchema } from "typebox";
|
|
3
3
|
/** A route's HTTP method. */
|
|
4
4
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
package/dist/project/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as HttpRoute, dn as AppManifest, xn as OperationShape } from "../chunks/types-
|
|
2
|
-
import { n as WorkerOptions, r as WorkerRuntime } from "../chunks/workers-types-
|
|
1
|
+
import { D as HttpRoute, dn as AppManifest, xn as OperationShape } from "../chunks/types-hP7p4Rsp.js";
|
|
2
|
+
import { n as WorkerOptions, r as WorkerRuntime } from "../chunks/workers-types-qWuu8LZ0.js";
|
|
3
3
|
/** File modules use native Workers handlers; unmatched events fail instead of disappearing. */
|
|
4
4
|
type Handlers<E> = Omit<ExportedHandler<E>, 'fetch'>;
|
|
5
5
|
/** One schedule, declared beside the code it runs. Configure its trigger in Cloudflare as well. */
|
package/dist/project/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as standardErrors } from "../chunks/errors-BoutSmiy.js";
|
|
2
|
-
import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-
|
|
3
|
-
import { t as checkPagePaths } from "../chunks/pages-
|
|
2
|
+
import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-D-yNrgEP.js";
|
|
3
|
+
import { t as checkPagePaths } from "../chunks/pages-DzAPVx2p.js";
|
|
4
4
|
|
|
5
5
|
// src/project/handlers.ts
|
|
6
6
|
/** Compose file handlers with explicit fallbacks, preserving the platform's execution context. */
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as PageInfo, At as decodeSchema, B as DeletedObject, Ct as stripObject, Dn as SchemaKeywords, Dt as SchemaValidationError, Et as SchemaIssue, F as Static, G as NamedReference, H as EmailAddressSchema, I as TSchema, J as PostalAddress, K as NamedReferenceSchema, L as Type, Mt as parseSchema, N as EmptyInputSchema,
|
|
1
|
+
import { $ as PageInfo, At as decodeSchema, B as DeletedObject, Br as AttachmentOutputSchema, Ct as stripObject, Dn as SchemaKeywords, Dt as SchemaValidationError, Et as SchemaIssue, F as Static, G as NamedReference, H as EmailAddressSchema, I as TSchema, J as PostalAddress, K as NamedReferenceSchema, L as Type, Mt as parseSchema, N as EmptyInputSchema, On as StaticDecode, Ot as InputIssue, P as OrganizationIdSchema, Q as Page, R as UuidSchema, St as strictObject, Tt as urlSchema, U as HexColorSchema, V as DeletedObjectSchema, W as HttpsUrlSchema, X as SignedUrl, Y as PostalAddressSchema, Z as SignedUrlSchema, _t as literalUnion, at as cursorKey, bt as pipeSchema, ct as withoutSecrets, dt as readSchema, et as PageInfoSchema, ft as SchemaInput, gt as inspectSchema, ht as inputSchema, it as TPage, jt as parseInput, kt as decodeInput, lt as Checked, mt as extendObject, nt as PageQuery, ot as cutPage, pt as defaultSchema, q as PhoneNumberSchema, rt as PageQueryFields, st as pageLimit, tt as PageOrder, ut as checkSchema, vt as looseObject, wt as transformSchema, xt as refineSchema, yt as normalizeSchema, z as t, zr as Attachment } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { type Attachment, AttachmentOutputSchema, type Checked, type DeletedObject, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, HexColorSchema, HttpsUrlSchema, type InputIssue, type NamedReference, NamedReferenceSchema, OrganizationIdSchema, Page, type PageInfo, PageInfoSchema, type PageOrder, type PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type SchemaInput, type SchemaIssue, type SchemaKeywords, SchemaValidationError, type SignedUrl, SignedUrlSchema, type Static, type StaticDecode, type TPage, type TSchema, Type, UuidSchema, checkSchema, cursorKey, cutPage, decodeInput, decodeSchema, defaultSchema, extendObject, inputSchema, inspectSchema, literalUnion, looseObject, normalizeSchema, pageLimit, parseInput, parseSchema, pipeSchema, readSchema, refineSchema, strictObject, stripObject, t, transformSchema, urlSchema, withoutSecrets };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { in as StandardFailure, rn as STANDARD_FAILURES } from "./chunks/types-
|
|
1
|
+
import { in as StandardFailure, rn as STANDARD_FAILURES } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
export { STANDARD_FAILURES, StandardFailure };
|
package/dist/tooling/cli.js
CHANGED
|
@@ -139,7 +139,7 @@ async function run() {
|
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
case "openapi": {
|
|
142
|
-
const { writeOpenApi } = await import("../chunks/openapi-file-
|
|
142
|
+
const { writeOpenApi } = await import("../chunks/openapi-file-D1Fz9-oO.js");
|
|
143
143
|
const written = await writeOpenApi(rest[0] ?? ".", {
|
|
144
144
|
...values.out === void 0 ? {} : { out: values.out },
|
|
145
145
|
check: values.check
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mn as RoleDefinitions, dr as TokenAlgorithm, mr as TokenPolicy, pr as TokenDevelopment } from "../chunks/types-hP7p4Rsp.js";
|
|
2
2
|
import { WorkerConfig } from "cf/config";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
4
|
/** Where the Worker runs: `development` under `vp dev`, `production` in every build. */
|
|
@@ -55,6 +55,12 @@ interface MaximusOptions extends Omit<WorkerConfig, 'name' | 'entrypoint' | 'env
|
|
|
55
55
|
* after the version, in words, unless its contract declares one.
|
|
56
56
|
*/
|
|
57
57
|
groups?: Readonly<Record<string, string>>;
|
|
58
|
+
/**
|
|
59
|
+
* The service's roles, from `defineRoles()`: at most three, each saying what it may do with the service's
|
|
60
|
+
* resources. The build refuses a role that names a scope no public route takes and a public route no role
|
|
61
|
+
* may call; OpenAPI publishes each role with the scopes it holds.
|
|
62
|
+
*/
|
|
63
|
+
roles?: RoleDefinitions;
|
|
58
64
|
/** The version OpenAPI, the MCP server and `/health` report; by default, the package's version. */
|
|
59
65
|
version?: string;
|
|
60
66
|
/**
|
package/dist/vite/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as operationPathParameters } from "../chunks/http-paths-D043DkJv.js";
|
|
2
|
-
import { a as ownsPrefix, t as VERSIONED_PATH } from "../chunks/http-layout-
|
|
2
|
+
import { a as ownsPrefix, t as VERSIONED_PATH } from "../chunks/http-layout-CB6MdZOO.js";
|
|
3
3
|
import { t as routeName } from "../chunks/names-ncD7A3DV.js";
|
|
4
|
-
import { t as checkPagePaths } from "../chunks/pages-
|
|
4
|
+
import { t as checkPagePaths } from "../chunks/pages-DzAPVx2p.js";
|
|
5
5
|
import { a as projectPath, i as projectFiles, o as publicFiles, r as compareNames, s as routeShape, t as PROJECT_DIRECTORIES } from "../chunks/project-files-C0OX7MQQ.js";
|
|
6
|
-
import { t as checkMcpResourceNames } from "../chunks/define-app-
|
|
6
|
+
import { t as checkMcpResourceNames } from "../chunks/define-app-CRKaiTzi.js";
|
|
7
7
|
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { dirname, join, posix, relative, resolve, sep } from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
@@ -44,7 +44,7 @@ const SERVICE_NAME = /^(?=.{2,63}$)[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
|
44
44
|
/** The application's options and the Worker's settings, apart. `assets` is maximus()'s own. */
|
|
45
45
|
function split(options) {
|
|
46
46
|
if ("assets" in options) throw new TypeError("maximus() configures the assets: index.html at the root makes the project a web app.");
|
|
47
|
-
const { name, namespace, title, description, groups, version, origin, tokens, rpc, http, maxBodyBytes, maxOutputBytes, rateLimit, meter, env, services, webApp, ...worker } = options;
|
|
47
|
+
const { name, namespace, title, description, groups, roles, version, origin, tokens, rpc, http, maxBodyBytes, maxOutputBytes, rateLimit, meter, env, services, webApp, ...worker } = options;
|
|
48
48
|
return {
|
|
49
49
|
application: {
|
|
50
50
|
name,
|
|
@@ -52,6 +52,7 @@ function split(options) {
|
|
|
52
52
|
title,
|
|
53
53
|
description,
|
|
54
54
|
groups,
|
|
55
|
+
roles,
|
|
55
56
|
version,
|
|
56
57
|
origin,
|
|
57
58
|
tokens,
|
|
@@ -208,6 +209,7 @@ function projectOptions(root, options, phase = "production") {
|
|
|
208
209
|
title: application.title ?? name,
|
|
209
210
|
...application.description === void 0 ? {} : { description: application.description },
|
|
210
211
|
...application.groups === void 0 ? {} : { groups: application.groups },
|
|
212
|
+
...application.roles === void 0 ? {} : { roles: application.roles },
|
|
211
213
|
version,
|
|
212
214
|
origin: application.origin,
|
|
213
215
|
tokens: {
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Kr as Failure, Pr as Result } from "./chunks/types-hP7p4Rsp.js";
|
|
2
2
|
/** Why a webhook signature was refused: absent, malformed, outside the time tolerance, or not matching. */
|
|
3
3
|
export declare const WEBHOOK_SIGNATURE_FAILURES: readonly ['missing', 'malformed', 'expired', 'mismatch'];
|
|
4
4
|
/** Why a webhook signature was refused. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as credentials, i as createWorker, n as WorkerOptions, o as WorkerAssetsOptions, r as WorkerRuntime, t as RpcMethods } from "../chunks/workers-types-
|
|
1
|
+
import { a as credentials, i as createWorker, n as WorkerOptions, o as WorkerAssetsOptions, r as WorkerRuntime, t as RpcMethods } from "../chunks/workers-types-qWuu8LZ0.js";
|
|
2
2
|
export { RpcMethods, type WorkerAssetsOptions, WorkerOptions, WorkerRuntime, createWorker, credentials };
|
package/dist/workers/runtime.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbol-ai/maximus",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"description": "Maximus: define a service once and serve it over HTTP, MCP and Worker RPC on Cloudflare Workers, configured in vite.config.ts, with its OpenAPI and CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
},
|
|
143
143
|
"dependencies": {
|
|
144
144
|
"@modelcontextprotocol/server": "2.4.0",
|
|
145
|
-
"@scalar/openapi-parser": "0.29.
|
|
145
|
+
"@scalar/openapi-parser": "0.29.29",
|
|
146
146
|
"ajv-formats": "3.0.1",
|
|
147
147
|
"jose": "6.2.18",
|
|
148
148
|
"rou3": "1.0.0",
|
|
@@ -150,12 +150,12 @@
|
|
|
150
150
|
"typebox": "1.4.7"
|
|
151
151
|
},
|
|
152
152
|
"devDependencies": {
|
|
153
|
-
"@cloudflare/vite-plugin": "2.0.0-rc.
|
|
153
|
+
"@cloudflare/vite-plugin": "2.0.0-rc.7",
|
|
154
154
|
"@modelcontextprotocol/ext-tasks": "0.2.3",
|
|
155
155
|
"@types/pg": "8.23.1",
|
|
156
156
|
"ajv": "8.20.0",
|
|
157
157
|
"cf": "1.0.0-rc.6",
|
|
158
|
-
"miniflare": "5.
|
|
158
|
+
"miniflare": "5.20261127.1-beta",
|
|
159
159
|
"pg": "8.23.1",
|
|
160
160
|
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001",
|
|
161
161
|
"vite-plus": "1.8.0",
|
|
@@ -29,6 +29,7 @@ export default defineConfig({
|
|
|
29
29
|
| `name` | The Worker's name, the MCP server's and the scopes' prefix: lowercase letters, digits and single hyphens. By default, the package's name without its scope. |
|
|
30
30
|
| `namespace`, `title`, `version` | The scopes' prefix (the name), the human name (the name), the version `/health` reports (the package's). |
|
|
31
31
|
| `description`, `groups` | The OpenAPI document's description of the service, and of each group of routes by its name: `{ Notes: "The notes of the caller's organization." }`. |
|
|
32
|
+
| `roles` | The service's roles, from `defineRoles()`: at most three, each `{ description, can?, extends?, all? }`. `can: { read: ['notes'] }` holds `notes:notes:read`; `all: true` holds every public scope. The build refuses a scope no public route takes and a public route no role may call; OpenAPI publishes them as `x-maximus-roles`. Only a service people hold roles in declares them. |
|
|
32
33
|
| `rpc` | `{ callers: ['example-orders'] }`: the services allowed to call RPC methods, by the `caller` their binding's props name, which is the calling service's `name`. None by default. |
|
|
33
34
|
| `services` | `{ PRICING: { worker: 'example-pricing', openapi: '../pricing/openapi.rpc.json' } }`: other Maximus services this one calls over RPC, each bound to its Worker's `Service` entrypoint with this service as the caller, and typed from the RPC document it publishes. See [transports.md](transports.md#worker-rpc). |
|
|
34
35
|
| `http` | `{ basePath, healthPath }`: `/api` and `/health` by default. |
|