@toa.io/extensions.exposition 1.0.0-alpha.287 → 1.0.0-alpha.289
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
- package/components/identity.clients/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
- package/components/identity.grants/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/manifest.toa.yaml +2 -1
- package/components/identity.passkeys/source/errors.test.ts +34 -0
- package/components/identity.passkeys/source/webauthn.test.ts +26 -0
- package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/types/toa.d.ts +1 -1
- package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/documentation/access.md +23 -4
- package/documentation/discovery.md +81 -0
- package/documentation/help.md +122 -0
- package/documentation/introspection.md +42 -9
- package/documentation/mcp.md +13 -16
- package/documentation/octets.md +20 -0
- package/features/cors.feature +31 -1
- package/features/dev.feature +2 -0
- package/features/discovery.feature +213 -0
- package/features/discovery.ui.feature +213 -0
- package/features/help.feature +512 -0
- package/features/introspection.feature +94 -8
- package/features/map.feature +1 -0
- package/features/mcp.feature +74 -12
- package/features/methods.feature +2 -1
- package/features/oauth.grants.feature +3 -1
- package/features/octets.download.feature +1 -0
- package/features/octets.feature +59 -0
- package/features/octets.meta.feature +1 -0
- package/features/site/_app/immutable/asset.js +1 -0
- package/features/site/favicon.ico +0 -0
- package/features/site/index.html +10 -0
- package/features/steps/Components.ts +4 -2
- package/features/steps/Database.ts +7 -1
- package/features/steps/Gateway.ts +23 -21
- package/features/steps/Parameters.ts +37 -16
- package/features/steps/Realtime.ts +3 -3
- package/package.json +7 -5
- package/readme.md +3 -0
- package/source/Directive.ts +4 -11
- package/source/Discovery/Explorer.ts +34 -0
- package/source/Discovery/Site.test.ts +147 -0
- package/source/Discovery/Site.ts +202 -0
- package/source/Discovery/index.ts +3 -0
- package/source/Discovery/tree.test.ts +175 -0
- package/source/Discovery/tree.ts +77 -0
- package/source/Discovery/trunk.ts +33 -0
- package/source/Endpoint.ts +4 -0
- package/source/Factory.ts +3 -86
- package/source/Gateway.ts +34 -4
- package/source/HTTP/Context.ts +7 -0
- package/source/HTTP/Probe.ts +0 -11
- package/source/HTTP/Server.ts +2 -3
- package/source/HTTP/messages.ts +4 -2
- package/source/Introspection.ts +58 -7
- package/source/MCP/schema.ts +16 -5
- package/source/MCP/tools.ts +14 -32
- package/source/Mapping.ts +5 -0
- package/source/Query.ts +17 -2
- package/source/RTD/Directives.ts +10 -0
- package/source/RTD/Endpoint.ts +8 -1
- package/source/RTD/Node.ts +20 -6
- package/source/RTD/Tree.ts +19 -9
- package/source/RTD/factory.ts +37 -1
- package/source/RTD/segment.ts +21 -0
- package/source/const.ts +26 -0
- package/source/deployment.ts +2 -2
- package/source/directives/auth/Anonymous.test.ts +31 -5
- package/source/directives/auth/Anonymous.ts +15 -3
- package/source/directives/auth/Anyone.ts +6 -0
- package/source/directives/auth/Assert.ts +5 -0
- package/source/directives/auth/Delegate.ts +5 -2
- package/source/directives/auth/Federation.ts +11 -0
- package/source/directives/auth/Id.ts +15 -0
- package/source/directives/auth/Input.ts +5 -0
- package/source/directives/auth/Role.ts +17 -0
- package/source/directives/cors/CORS.test.ts +75 -0
- package/source/directives/cors/CORS.ts +10 -3
- package/source/directives/help/Family.ts +122 -0
- package/source/directives/help/Help.test.ts +227 -0
- package/source/directives/help/Help.ts +47 -0
- package/source/directives/help/Parameters.ts +47 -0
- package/source/directives/help/described.ts +57 -0
- package/source/directives/help/index.ts +45 -0
- package/source/directives/index.ts +8 -1
- package/source/directives/map/Headers.ts +6 -6
- package/source/directives/mcp/MCP.ts +12 -21
- package/source/directives/mcp/Tool.test.ts +22 -68
- package/source/directives/mcp/Tool.ts +14 -41
- package/source/directives/octets/Directive.ts +7 -0
- package/source/directives/octets/Octets.ts +8 -0
- package/source/directives/octets/Put.ts +10 -0
- package/source/manifest.ts +1 -1
- package/source/root.ts +2 -2
- package/source/service.ts +94 -0
- package/source/shortcuts.ts +14 -0
- package/transpiled/Directive.d.ts +1 -1
- package/transpiled/Directive.js +3 -11
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/Discovery/Explorer.d.ts +11 -0
- package/transpiled/Discovery/Explorer.js +29 -0
- package/transpiled/Discovery/Explorer.js.map +1 -0
- package/transpiled/Discovery/Site.d.ts +43 -0
- package/transpiled/Discovery/Site.js +171 -0
- package/transpiled/Discovery/Site.js.map +1 -0
- package/transpiled/Discovery/index.d.ts +3 -0
- package/transpiled/Discovery/index.js +4 -0
- package/transpiled/Discovery/index.js.map +1 -0
- package/transpiled/Discovery/tree.d.ts +26 -0
- package/transpiled/Discovery/tree.js +50 -0
- package/transpiled/Discovery/tree.js.map +1 -0
- package/transpiled/Discovery/trunk.d.ts +13 -0
- package/transpiled/Discovery/trunk.js +29 -0
- package/transpiled/Discovery/trunk.js.map +1 -0
- package/transpiled/Endpoint.d.ts +2 -1
- package/transpiled/Endpoint.js +3 -0
- package/transpiled/Endpoint.js.map +1 -1
- package/transpiled/Factory.js +3 -61
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.d.ts +4 -0
- package/transpiled/Gateway.js +29 -4
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Context.d.ts +6 -0
- package/transpiled/HTTP/Context.js +6 -0
- package/transpiled/HTTP/Context.js.map +1 -1
- package/transpiled/HTTP/Probe.d.ts +0 -10
- package/transpiled/HTTP/Probe.js +0 -10
- package/transpiled/HTTP/Probe.js.map +1 -1
- package/transpiled/HTTP/Server.d.ts +0 -1
- package/transpiled/HTTP/Server.js +2 -2
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/messages.js +4 -2
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Introspection.d.ts +38 -6
- package/transpiled/Introspection.js +18 -1
- package/transpiled/Introspection.js.map +1 -1
- package/transpiled/MCP/schema.d.ts +2 -2
- package/transpiled/MCP/schema.js +11 -5
- package/transpiled/MCP/schema.js.map +1 -1
- package/transpiled/MCP/tools.d.ts +1 -1
- package/transpiled/MCP/tools.js +12 -28
- package/transpiled/MCP/tools.js.map +1 -1
- package/transpiled/Mapping.d.ts +2 -0
- package/transpiled/Mapping.js +4 -0
- package/transpiled/Mapping.js.map +1 -1
- package/transpiled/Query.d.ts +12 -0
- package/transpiled/Query.js +16 -2
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RTD/Directives.d.ts +8 -0
- package/transpiled/RTD/Endpoint.d.ts +7 -1
- package/transpiled/RTD/Node.d.ts +11 -2
- package/transpiled/RTD/Node.js +12 -2
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Tree.js +15 -8
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/RTD/factory.js +27 -1
- package/transpiled/RTD/factory.js.map +1 -1
- package/transpiled/RTD/segment.d.ts +7 -0
- package/transpiled/RTD/segment.js +17 -0
- package/transpiled/RTD/segment.js.map +1 -1
- package/transpiled/const.d.ts +21 -0
- package/transpiled/const.js +21 -0
- package/transpiled/const.js.map +1 -1
- package/transpiled/deployment.js +2 -2
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/auth/Anonymous.d.ts +11 -2
- package/transpiled/directives/auth/Anonymous.js +13 -3
- package/transpiled/directives/auth/Anonymous.js.map +1 -1
- package/transpiled/directives/auth/Anyone.d.ts +3 -0
- package/transpiled/directives/auth/Anyone.js +4 -0
- package/transpiled/directives/auth/Anyone.js.map +1 -1
- package/transpiled/directives/auth/Assert.d.ts +2 -0
- package/transpiled/directives/auth/Assert.js +4 -0
- package/transpiled/directives/auth/Assert.js.map +1 -1
- package/transpiled/directives/auth/Delegate.d.ts +4 -1
- package/transpiled/directives/auth/Delegate.js +5 -2
- package/transpiled/directives/auth/Delegate.js.map +1 -1
- package/transpiled/directives/auth/Federation.d.ts +5 -0
- package/transpiled/directives/auth/Federation.js +8 -0
- package/transpiled/directives/auth/Federation.js.map +1 -1
- package/transpiled/directives/auth/Id.d.ts +9 -0
- package/transpiled/directives/auth/Id.js +12 -0
- package/transpiled/directives/auth/Id.js.map +1 -1
- package/transpiled/directives/auth/Input.d.ts +2 -0
- package/transpiled/directives/auth/Input.js +4 -0
- package/transpiled/directives/auth/Input.js.map +1 -1
- package/transpiled/directives/auth/Role.d.ts +7 -0
- package/transpiled/directives/auth/Role.js +11 -0
- package/transpiled/directives/auth/Role.js.map +1 -1
- package/transpiled/directives/cors/CORS.js +9 -2
- package/transpiled/directives/cors/CORS.js.map +1 -1
- package/transpiled/directives/help/Family.d.ts +28 -0
- package/transpiled/directives/help/Family.js +83 -0
- package/transpiled/directives/help/Family.js.map +1 -0
- package/transpiled/directives/help/Help.d.ts +22 -0
- package/transpiled/directives/help/Help.js +36 -0
- package/transpiled/directives/help/Help.js.map +1 -0
- package/transpiled/directives/help/Parameters.d.ts +18 -0
- package/transpiled/directives/help/Parameters.js +34 -0
- package/transpiled/directives/help/Parameters.js.map +1 -0
- package/transpiled/directives/help/described.d.ts +16 -0
- package/transpiled/directives/help/described.js +23 -0
- package/transpiled/directives/help/described.js.map +1 -0
- package/transpiled/directives/help/index.d.ts +22 -0
- package/transpiled/directives/help/index.js +34 -0
- package/transpiled/directives/help/index.js.map +1 -0
- package/transpiled/directives/index.d.ts +4 -0
- package/transpiled/directives/index.js +8 -1
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/map/Headers.d.ts +5 -0
- package/transpiled/directives/map/Headers.js +7 -5
- package/transpiled/directives/map/Headers.js.map +1 -1
- package/transpiled/directives/mcp/MCP.d.ts +8 -5
- package/transpiled/directives/mcp/MCP.js +9 -13
- package/transpiled/directives/mcp/MCP.js.map +1 -1
- package/transpiled/directives/mcp/Tool.d.ts +6 -12
- package/transpiled/directives/mcp/Tool.js +10 -23
- package/transpiled/directives/mcp/Tool.js.map +1 -1
- package/transpiled/directives/octets/Directive.d.ts +6 -0
- package/transpiled/directives/octets/Directive.js.map +1 -1
- package/transpiled/directives/octets/Octets.d.ts +3 -0
- package/transpiled/directives/octets/Octets.js +6 -0
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/octets/Put.d.ts +3 -0
- package/transpiled/directives/octets/Put.js +8 -0
- package/transpiled/directives/octets/Put.js.map +1 -1
- package/transpiled/manifest.js +1 -1
- package/transpiled/root.js +2 -2
- package/transpiled/root.js.map +1 -1
- package/transpiled/service.d.ts +7 -0
- package/transpiled/service.js +74 -0
- package/transpiled/service.js.map +1 -0
- package/transpiled/shortcuts.d.ts +3 -0
- package/transpiled/shortcuts.js +13 -0
- package/transpiled/shortcuts.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/dist/_app/env.js +1 -0
- package/ui/dist/_app/immutable/assets/0.Bl7vLmIK.css +2 -0
- package/ui/dist/_app/immutable/assets/2.BC0-Jhqu.css +1 -0
- package/ui/dist/_app/immutable/assets/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
- package/ui/dist/_app/immutable/assets/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
- package/ui/dist/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/ui/dist/_app/immutable/chunks/CDMRPWCx.js +6 -0
- package/ui/dist/_app/immutable/chunks/DJTKIUs8.js +1 -0
- package/ui/dist/_app/immutable/chunks/DjIYL2zC.js +3 -0
- package/ui/dist/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/ui/dist/_app/immutable/chunks/z-DVUbQC.js +1 -0
- package/ui/dist/_app/immutable/entry/app.5S2Jtv46.js +2 -0
- package/ui/dist/_app/immutable/entry/start.Bqi6IBmH.js +1 -0
- package/ui/dist/_app/immutable/nodes/0.D4LwNilH.js +1 -0
- package/ui/dist/_app/immutable/nodes/1.CSRya9So.js +1 -0
- package/ui/dist/_app/immutable/nodes/2.BtiGmR6I.js +14 -0
- package/ui/dist/_app/version.json +1 -0
- package/ui/dist/apple-touch-icon.png +0 -0
- package/ui/dist/favicon-96x96.png +0 -0
- package/ui/dist/favicon.ico +0 -0
- package/ui/dist/index.html +66 -0
- package/components/identity.bans/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.basic/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.clients/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.federation/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.grants/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.keys/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.otp/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.passkeys/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.roles/migrations/0001-system-properties.yaml +0 -14
- package/components/identity.tokens/migrations/0001-system-properties.yaml +0 -14
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Tool } from './Tool.js';
|
|
2
|
+
import type { DirectiveFamily } from '../../RTD/index.js';
|
|
2
3
|
import type { Context } from '../../HTTP/index.js';
|
|
3
4
|
import type { Introspection } from '../../Introspection.js';
|
|
4
|
-
import type { DirectiveFamily } from '../../RTD/index.js';
|
|
5
5
|
/** The name the family is declared under, and what `MCP` asks a method for. */
|
|
6
6
|
export declare const FAMILY = "mcp";
|
|
7
7
|
export declare class MCP implements DirectiveFamily<Tool> {
|
|
8
8
|
readonly name = "mcp";
|
|
9
9
|
readonly mandatory = false;
|
|
10
|
-
/**
|
|
11
|
-
static published(directives: Tool[] | undefined):
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/** Whether this method is published, which is what the nearest declaration says. */
|
|
11
|
+
static published(directives: Tool[] | undefined): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether this method is published to a model, which is what the route declares. Whether
|
|
14
|
+
* one is served at all is the annotation's, and a route says nothing of that.
|
|
15
|
+
*/
|
|
14
16
|
explain(directives: Tool[], _: Context, introspection: Introspection): Introspection;
|
|
17
|
+
create(name: string, value: unknown, _: unknown, route: string): Tool;
|
|
15
18
|
}
|
|
@@ -5,25 +5,21 @@ export const FAMILY = 'mcp';
|
|
|
5
5
|
export class MCP {
|
|
6
6
|
name = FAMILY;
|
|
7
7
|
mandatory = false;
|
|
8
|
-
/**
|
|
8
|
+
/** Whether this method is published, which is what the nearest declaration says. */
|
|
9
9
|
static published(directives) {
|
|
10
|
-
return directives?.[0] ??
|
|
10
|
+
return directives?.[0]?.published ?? false;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Whether this method is published to a model, which is what the route declares. Whether
|
|
14
|
+
* one is served at all is the annotation's, and a route says nothing of that.
|
|
15
|
+
*/
|
|
16
|
+
explain(directives, _, introspection) {
|
|
17
|
+
return MCP.published(directives) ? { ...introspection, mcp: true } : introspection;
|
|
11
18
|
}
|
|
12
19
|
// eslint-disable-next-line max-params
|
|
13
20
|
create(name, value, _, route) {
|
|
14
21
|
assert.ok(name === 'tool', `Unknown directive: mcp:${name}`);
|
|
15
22
|
return new Tool(value, route);
|
|
16
23
|
}
|
|
17
|
-
/** What the route states this method is, which is the only thing that states it. */
|
|
18
|
-
explain(directives, _, introspection) {
|
|
19
|
-
const tool = MCP.published(directives);
|
|
20
|
-
if (tool === null)
|
|
21
|
-
return introspection;
|
|
22
|
-
return {
|
|
23
|
-
...introspection,
|
|
24
|
-
description: tool.description,
|
|
25
|
-
...(tool.title === undefined ? {} : { title: tool.title })
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
24
|
}
|
|
29
25
|
//# sourceMappingURL=MCP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MCP.js","sourceRoot":"","sources":["../../../source/directives/mcp/MCP.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAKhC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAA;AAE3B,MAAM,OAAO,GAAG;IACE,IAAI,GAAG,MAAM,CAAA;IACb,SAAS,GAAG,KAAK,CAAA;IAEjC,oFAAoF;IAC7E,MAAM,CAAC,SAAS,CAAC,UAA8B;QACpD,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"MCP.js","sourceRoot":"","sources":["../../../source/directives/mcp/MCP.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAKhC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAA;AAE3B,MAAM,OAAO,GAAG;IACE,IAAI,GAAG,MAAM,CAAA;IACb,SAAS,GAAG,KAAK,CAAA;IAEjC,oFAAoF;IAC7E,MAAM,CAAC,SAAS,CAAC,UAA8B;QACpD,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,KAAK,CAAA;IAC5C,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,UAAkB,EAAE,CAAU,EAAE,aAA4B;QACzE,OAAO,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,aAAa,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,aAAa,CAAA;IACpF,CAAC;IAED,sCAAsC;IAC/B,MAAM,CAAC,IAAY,EAAE,KAAc,EAAE,CAAU,EAAE,KAAa;QACnE,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,MAAM,EAAE,0BAA0B,IAAI,EAAE,CAAC,CAAA;QAE5D,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;CACF"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* says
|
|
4
|
-
*
|
|
2
|
+
* Whether one method is published to a model. Declaring it is what publishes it, and it
|
|
3
|
+
* says nothing else — what a tool is, is [`help:method`](../help/Help.ts), which is what
|
|
4
|
+
* describes the method to everything else as well.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* a mapping.
|
|
9
|
-
*
|
|
10
|
-
* The operation states what it is too, and that is not this. An operation is written without
|
|
11
|
-
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
12
|
-
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
6
|
+
* `false` withdraws one: the declaration is inherited, as every directive is, and a node
|
|
7
|
+
* publishing what is under it is how a subtree is published at all.
|
|
13
8
|
*/
|
|
14
9
|
export declare class Tool {
|
|
15
|
-
readonly
|
|
16
|
-
readonly title: string | undefined;
|
|
10
|
+
readonly published: boolean;
|
|
17
11
|
constructor(value: unknown, route: string);
|
|
18
12
|
}
|
|
@@ -2,35 +2,22 @@ import assert from 'node:assert';
|
|
|
2
2
|
import { refusal } from '../../RPC/names.js';
|
|
3
3
|
import { segment } from '../../RTD/segment.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* says
|
|
7
|
-
*
|
|
5
|
+
* Whether one method is published to a model. Declaring it is what publishes it, and it
|
|
6
|
+
* says nothing else — what a tool is, is [`help:method`](../help/Help.ts), which is what
|
|
7
|
+
* describes the method to everything else as well.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* a mapping.
|
|
12
|
-
*
|
|
13
|
-
* The operation states what it is too, and that is not this. An operation is written without
|
|
14
|
-
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
15
|
-
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
9
|
+
* `false` withdraws one: the declaration is inherited, as every directive is, and a node
|
|
10
|
+
* publishing what is under it is how a subtree is published at all.
|
|
16
11
|
*/
|
|
17
12
|
export class Tool {
|
|
18
|
-
|
|
19
|
-
title;
|
|
13
|
+
published;
|
|
20
14
|
constructor(value, route) {
|
|
21
|
-
|
|
22
|
-
assert.ok(typeof stated === 'object' && stated !== null && !Array.isArray(stated), 'Directive mcp:tool: the value is what the tool is, or a `title` and a `description`');
|
|
23
|
-
const { description, title, ...rest } = stated;
|
|
24
|
-
assert.ok(Object.keys(rest).length === 0, `Directive mcp:tool: unknown ${Object.keys(rest)
|
|
25
|
-
.map((key) => `'${key}'`)
|
|
26
|
-
.join(', ')}`);
|
|
27
|
-
assert.ok(typeof description === 'string' && description.trim().length > 0, 'Directive mcp:tool: a description cannot be empty');
|
|
28
|
-
assert.ok(title === undefined || (typeof title === 'string' && title.trim().length > 0), 'Directive mcp:tool: a title cannot be empty');
|
|
15
|
+
assert.ok(typeof value === 'boolean', 'Directive mcp:tool: the value is whether the method is published; what it is, is `help:method`');
|
|
29
16
|
// a tool is called by name, so a route that cannot be named cannot be one — said where
|
|
30
17
|
// the mistake is, rather than as a tool that is quietly never listed
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
18
|
+
if (value)
|
|
19
|
+
assert.ok(refusal(segment(route)) === null, `Directive mcp:tool: '${route}' holds a segment no tool name can spell`);
|
|
20
|
+
this.published = value;
|
|
34
21
|
}
|
|
35
22
|
}
|
|
36
23
|
//# sourceMappingURL=Tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../../source/directives/mcp/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C
|
|
1
|
+
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../../source/directives/mcp/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C;;;;;;;GAOG;AACH,MAAM,OAAO,IAAI;IACC,SAAS,CAAS;IAElC,YAAmB,KAAc,EAAE,KAAa;QAC9C,MAAM,CAAC,EAAE,CACP,OAAO,KAAK,KAAK,SAAS,EAC1B,gGAAgG,CACjG,CAAA;QAED,uFAAuF;QACvF,qEAAqE;QACrE,IAAI,KAAK;YACP,MAAM,CAAC,EAAE,CACP,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,EAChC,wBAAwB,KAAK,0CAA0C,CACxE,CAAA;QAEH,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;IACxB,CAAC;CACF"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { Input } from './types.js';
|
|
2
2
|
import type { Parameter } from '../../RTD/index.js';
|
|
3
|
+
import type { Introspection } from '../../Introspection.js';
|
|
3
4
|
import type * as io from '../../io.js';
|
|
4
5
|
export declare abstract class Directive {
|
|
5
6
|
readonly name: string;
|
|
6
7
|
abstract readonly targeted: boolean;
|
|
7
8
|
abstract apply(storage: string, input: Input, parameters: Parameter[]): Promise<io.Output>;
|
|
9
|
+
/**
|
|
10
|
+
* What a caller has to know to make the request. Only sending a file takes anything a
|
|
11
|
+
* schema does not already say; reading one and deleting one take nothing.
|
|
12
|
+
*/
|
|
13
|
+
describe?(introspection: Introspection): void;
|
|
8
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Directive.js","sourceRoot":"","sources":["../../../source/directives/octets/Directive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Directive.js","sourceRoot":"","sources":["../../../source/directives/octets/Directive.ts"],"names":[],"mappings":"AAKA,MAAM,OAAgB,SAAS;IACb,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAA;CAcvE"}
|
|
@@ -2,11 +2,14 @@ import type { Directive } from './Directive.js';
|
|
|
2
2
|
import type { Output } from '../../io.js';
|
|
3
3
|
import type { Remotes } from '../../Remotes.js';
|
|
4
4
|
import type { Parameter, DirectiveFamily } from '../../RTD/index.js';
|
|
5
|
+
import type { Introspection } from '../../Introspection.js';
|
|
5
6
|
import type { Input } from './types.js';
|
|
6
7
|
export declare class Octets implements DirectiveFamily<Directive> {
|
|
7
8
|
readonly name: string;
|
|
8
9
|
readonly mandatory: boolean;
|
|
9
10
|
private discovery;
|
|
10
11
|
create(name: string, value: any, remotes: Remotes): Directive;
|
|
12
|
+
/** What the request takes, which only sending a file says anything about. */
|
|
13
|
+
explain(directives: Directive[], _: Input, introspection: Introspection): Introspection;
|
|
11
14
|
precall(directives: Directive[], input: Input, parameters: Parameter[]): Promise<Output>;
|
|
12
15
|
}
|
|
@@ -15,6 +15,12 @@ export class Octets {
|
|
|
15
15
|
this.discovery ??= remotes.discover('exposition', 'octets');
|
|
16
16
|
return new Class(value, this.discovery, remotes);
|
|
17
17
|
}
|
|
18
|
+
/** What the request takes, which only sending a file says anything about. */
|
|
19
|
+
explain(directives, _, introspection) {
|
|
20
|
+
for (const directive of directives)
|
|
21
|
+
directive.describe?.(introspection);
|
|
22
|
+
return introspection;
|
|
23
|
+
}
|
|
18
24
|
async precall(directives, input, parameters) {
|
|
19
25
|
let context = null;
|
|
20
26
|
let action = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Octets.js","sourceRoot":"","sources":["../../../source/directives/octets/Octets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Octets.js","sourceRoot":"","sources":["../../../source/directives/octets/Octets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AASjD,MAAM,OAAO,MAAM;IACD,IAAI,GAAW,QAAQ,CAAA;IACvB,SAAS,GAAY,KAAK,CAAA;IAElC,SAAS,GAAG,IAAqC,CAAA;IAElD,MAAM,CAAC,IAAY,EAAE,KAAU,EAAE,OAAgB;QACtD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;QAE9B,IAAI,KAAK,KAAK,SAAS;YACrB,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,sBAAsB,CAAC,CAAA;QAElE,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;QAE3D,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,SAA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B,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,iBAAiB;CAC5B,CAAA"}
|
|
@@ -3,6 +3,7 @@ import type { Parameter } from '../../RTD/index.js';
|
|
|
3
3
|
import type { Unit } from './workflows/index.js';
|
|
4
4
|
import type { Remotes } from '../../Remotes.js';
|
|
5
5
|
import type { Component } from '@toa.io/core';
|
|
6
|
+
import type { Introspection } from '../../Introspection.js';
|
|
6
7
|
import type { Output } from '../../io.js';
|
|
7
8
|
import type { Input } from './types.js';
|
|
8
9
|
export declare class Put extends Directive {
|
|
@@ -16,6 +17,8 @@ export declare class Put extends Directive {
|
|
|
16
17
|
private readonly discovery;
|
|
17
18
|
private storage;
|
|
18
19
|
constructor(options: Options | null, discovery: Promise<Component>, remotes: Remotes);
|
|
20
|
+
/** What sending a file here takes: what may be sent, how much of it, and what comes back. */
|
|
21
|
+
describe(introspection: Introspection): void;
|
|
19
22
|
apply(storage: string, input: Input, parameters: Parameter[]): Promise<Output>;
|
|
20
23
|
private reply;
|
|
21
24
|
private execute;
|
|
@@ -32,6 +32,14 @@ export class Put extends Directive {
|
|
|
32
32
|
cors.allow('content-attributes');
|
|
33
33
|
cors.allow('content-location');
|
|
34
34
|
}
|
|
35
|
+
/** What sending a file here takes: what may be sent, how much of it, and what comes back. */
|
|
36
|
+
describe(introspection) {
|
|
37
|
+
introspection.octets = {
|
|
38
|
+
...(this.accept === undefined ? {} : { accept: this.accept }),
|
|
39
|
+
limit: this.limitString,
|
|
40
|
+
...(this.workflow === undefined ? {} : { stream: true })
|
|
41
|
+
};
|
|
42
|
+
}
|
|
35
43
|
async apply(storage, input, parameters) {
|
|
36
44
|
this.storage ??= await this.discovery.storage;
|
|
37
45
|
const request = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Put.js","sourceRoot":"","sources":["../../../source/directives/octets/Put.ts"],"names":[],"mappings":"AAA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AI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,EACxC,KAAK,CACN,CAAA;IACH,CAAC;CACF"}
|
package/transpiled/manifest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { parse } from './RTD/syntax/index.js';
|
|
3
|
-
import { shortcuts } from './
|
|
3
|
+
import { shortcuts } from './shortcuts.js';
|
|
4
4
|
import * as schemas from './schemas.js';
|
|
5
5
|
export function manifest(declaration, manifest) {
|
|
6
6
|
assert.ok(typeof declaration === 'object' && declaration !== null, 'Exposition declaration must be an object');
|
package/transpiled/root.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { merge } from '@toa.io/generic';
|
|
1
|
+
import { environment, merge } from '@toa.io/generic';
|
|
2
2
|
import { syntax } from './RTD/index.js';
|
|
3
3
|
export function resolve() {
|
|
4
|
-
const value =
|
|
4
|
+
const value = environment.get('TOA_EXPOSITION');
|
|
5
5
|
const root = value !== undefined ? JSON.parse(value) : syntax.createNode();
|
|
6
6
|
merge(root, PREDEFINED);
|
|
7
7
|
return root;
|
package/transpiled/root.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../source/root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../source/root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC,MAAM,UAAU,OAAO;IACrB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC/C,MAAM,IAAI,GACR,KAAK,KAAK,SAAS,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;IAEhF,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAEvB,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,GAAgB;IAC9B,MAAM,EAAE;QACN;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE;gBACJ,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,KAAK;wBACX,UAAU,EAAE;4BACV;gCACE,MAAM,EAAE,IAAI;gCACZ,IAAI,EAAE,QAAQ;gCACd,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC;6BACvB;4BACD;gCACE,MAAM,EAAE,MAAM;gCACd,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,IAAI;6BACZ;yBACF;qBACF;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,UAAU,EAAE;4BACV;gCACE,MAAM,EAAE,IAAI;gCACZ,IAAI,EAAE,QAAQ;gCACd,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC;6BACvB;4BACD;gCACE,MAAM,EAAE,MAAM;gCACd,IAAI,EAAE,QAAQ;gCACd,KAAK,EAAE,IAAI;6BACZ;yBACF;qBACF;iBACF;gBACD,UAAU,EAAE,EAAE;aACf;SACF;KACF;IACD,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,EAAE;CACf,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Connector } from '@toa.io/core';
|
|
2
|
+
import type { Host } from './Factory.js';
|
|
3
|
+
/**
|
|
4
|
+
* The gateway. A composition loads this extension for its tenants alone, so what the
|
|
5
|
+
* gateway is made of is reached from here and nowhere the factory imports.
|
|
6
|
+
*/
|
|
7
|
+
export declare function service(host: Host): Promise<Connector | null>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { console, traces } from 'openspan';
|
|
3
|
+
import { Gateway } from './Gateway.js';
|
|
4
|
+
import { Remotes } from './Remotes.js';
|
|
5
|
+
import { Tree } from './RTD/index.js';
|
|
6
|
+
import { EndpointsFactory } from './Endpoint.js';
|
|
7
|
+
import { families, interceptors } from './directives/index.js';
|
|
8
|
+
import { DirectivesFactory } from './Directive.js';
|
|
9
|
+
import { Composition } from './Composition.js';
|
|
10
|
+
import * as root from './root.js';
|
|
11
|
+
import { ATOM_GROUP, CHANNEL } from './const.js';
|
|
12
|
+
import { Interception } from './Interception.js';
|
|
13
|
+
import { Dispatcher } from './RPC/index.js';
|
|
14
|
+
import { Server as Model } from './MCP/index.js';
|
|
15
|
+
import * as http from './HTTP/index.js';
|
|
16
|
+
import { environment } from '@toa.io/generic';
|
|
17
|
+
/**
|
|
18
|
+
* The gateway. A composition loads this extension for its tenants alone, so what the
|
|
19
|
+
* gateway is made of is reached from here and nowhere the factory imports.
|
|
20
|
+
*/
|
|
21
|
+
export async function service(host) {
|
|
22
|
+
const properties = environment.get('TOA_EXPOSITION_PROPERTIES');
|
|
23
|
+
assert.ok(properties !== undefined, 'TOA_EXPOSITION_PROPERTIES is undefined');
|
|
24
|
+
configureLogs();
|
|
25
|
+
const options = JSON.parse(properties);
|
|
26
|
+
const broadcast = await host.broadcast(CHANNEL);
|
|
27
|
+
const server = http.Server.create({ ...options });
|
|
28
|
+
const remotes = new Remotes(host);
|
|
29
|
+
const node = root.resolve();
|
|
30
|
+
const methods = new EndpointsFactory(remotes);
|
|
31
|
+
const directives = new DirectivesFactory(families, remotes, host, options);
|
|
32
|
+
const interception = new Interception(interceptors, options);
|
|
33
|
+
const tree = new Tree(node, methods, directives);
|
|
34
|
+
const composition = new Composition(host);
|
|
35
|
+
const dispatcher = options.rpc === undefined ? null : new Dispatcher(options.rpc);
|
|
36
|
+
const mcp = options.mcp === undefined ? null : new Model(options.mcp, tree);
|
|
37
|
+
const gateway = new Gateway(broadcast, tree, interception, directives, dispatcher, mcp);
|
|
38
|
+
gateway.depends(remotes);
|
|
39
|
+
gateway.depends(composition);
|
|
40
|
+
// what the directives meter through; one atom per process, connected once
|
|
41
|
+
gateway.depends(host.atom(ATOM_GROUP));
|
|
42
|
+
server.attach(gateway.process.bind(gateway));
|
|
43
|
+
server.depends(gateway);
|
|
44
|
+
return server;
|
|
45
|
+
}
|
|
46
|
+
const LOGS_PREFIX = 'TOA_TELEMETRY_LOGS';
|
|
47
|
+
const TRACES_ENV = 'TOA_TELEMETRY_TRACES';
|
|
48
|
+
function configureLogs() {
|
|
49
|
+
const globEnv = environment.get(LOGS_PREFIX);
|
|
50
|
+
const level = environment.get('TOA_DEV') === '1' ? 'trace' : 'info';
|
|
51
|
+
const options = globEnv === undefined ? { level } : JSON.parse(globEnv);
|
|
52
|
+
console.configure({ level: options.level ?? level });
|
|
53
|
+
const tracesEnv = environment.get(TRACES_ENV);
|
|
54
|
+
const tracing = tracesEnv === undefined ? development() : JSON.parse(tracesEnv);
|
|
55
|
+
// `openspan` is not Toa's and reads the environment, which no longer holds the context by
|
|
56
|
+
// the time the exporter is made — so the service is named here
|
|
57
|
+
if (tracing.exporters?.otlp !== undefined)
|
|
58
|
+
tracing.exporters.otlp.service ??= environment.get('TOA_CONTEXT');
|
|
59
|
+
traces(tracing);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Tracing is off unless it is configured. The console exporter is a local development
|
|
63
|
+
* mechanism, so it is turned on for `toa dev` and for a boot trace the CLI has already
|
|
64
|
+
* asked for (`runtime/boot/src/span.js`), and nowhere else — a deployment that wants
|
|
65
|
+
* traces annotates `telemetry.traces.exporters`.
|
|
66
|
+
*
|
|
67
|
+
* The gateway boots without the telemetry extension, hence the copy of
|
|
68
|
+
* `extensions/telemetry/source/extension.ts`.
|
|
69
|
+
*/
|
|
70
|
+
function development() {
|
|
71
|
+
const local = environment.get('TOA_DEV') === '1' || environment.get('TOA_BOOT_TRACE') === '1';
|
|
72
|
+
return local ? { exporters: { console: {} } }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;;;;;;;GAQG;AACH,SAAS,WAAW;IAClB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,GAAG,CAAA;IAE7F,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** What a directive may be written as, where the family is implied. */
|
|
2
|
+
export const shortcuts = new Map([
|
|
3
|
+
['anonymous', 'auth:anonymous'],
|
|
4
|
+
['anyone', 'auth:anyone'],
|
|
5
|
+
['id', 'auth:id'],
|
|
6
|
+
['role', 'auth:role'],
|
|
7
|
+
['rule', 'auth:rule'],
|
|
8
|
+
['incept', 'auth:incept'],
|
|
9
|
+
['input', 'io:input'],
|
|
10
|
+
['output', 'io:output'],
|
|
11
|
+
['languages', 'map:languages']
|
|
12
|
+
]);
|
|
13
|
+
//# sourceMappingURL=shortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcuts.js","sourceRoot":"","sources":["../source/shortcuts.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAc,IAAI,GAAG,CAAC;IAC1C,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAC/B,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,IAAI,EAAE,SAAS,CAAC;IACjB,CAAC,MAAM,EAAE,WAAW,CAAC;IACrB,CAAC,MAAM,EAAE,WAAW,CAAC;IACrB,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,OAAO,EAAE,UAAU,CAAC;IACrB,CAAC,QAAQ,EAAE,WAAW,CAAC;IACvB,CAAC,WAAW,EAAE,eAAe,CAAC;CAC/B,CAAC,CAAA"}
|