@happyvertical/smrt-app-cli 0.51.31 → 0.51.33
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/__tests__/fixtures/mcp-stdio-bridge.d.ts +2 -0
- package/dist/__tests__/fixtures/mcp-stdio-bridge.d.ts.map +1 -0
- package/dist/bin/smrt-app.d.ts +8 -1
- package/dist/bin/smrt-app.d.ts.map +1 -0
- package/dist/bin/smrt-app.js +1 -1
- package/dist/bin/smrt-mcp-bridge.d.ts +24 -1
- package/dist/bin/smrt-mcp-bridge.d.ts.map +1 -0
- package/dist/bridge.d.ts +69 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/commands/auth.d.ts +20 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/mcp.d.ts +17 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/resources.d.ts +20 -0
- package/dist/commands/resources.d.ts.map +1 -0
- package/dist/config.d.ts +137 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/discovery.d.ts +54 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/executable.d.ts +29 -0
- package/dist/executable.d.ts.map +1 -0
- package/dist/index.d.ts +98 -585
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/invoke.d.ts +30 -0
- package/dist/invoke.d.ts.map +1 -0
- package/dist/mcp-oauth.d.ts +52 -0
- package/dist/mcp-oauth.d.ts.map +1 -0
- package/dist/output.d.ts +35 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/parser.d.ts +58 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/{src-DCo67mp8.js → src-DRNQCkh6.js} +1 -1
- package/package.json +4 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,KAAK,SAAS,EAKd,K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,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,cAAc,CAAC,UAAU,CAAC,EAAE;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CA4BjE"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as getStoredToken, c as requestJson, d as saveCliConfig, f as createMcpStdioBridge, i as getServerUrl, l as requestJsonResult, m as runMcpStdioBridge, n as assertSecureServerUrl, o as loadCliConfig, r as clearStoredToken, s as redactTransportValue, t as AppCliRequestError, u as saveAuth } from "./config-CuTFiGxX.js";
|
|
2
|
-
import { a as buildFlagParser, c as createMcpClientIdMetadataDocument, d as buildUrl, f as invokeCommand, h as findResourceBySlug, i as runAppCliExecutable, l as registerMcpClient, m as findCommand, n as createAppCli, o as classifySchema, p as fetchResourceList, r as parseAppCliExecutableConfig, s as renderResponse, t as SMRT_MCP_RESULT_METADATA_KEY, u as resolveMcpClientRegistration } from "./src-
|
|
2
|
+
import { a as buildFlagParser, c as createMcpClientIdMetadataDocument, d as buildUrl, f as invokeCommand, h as findResourceBySlug, i as runAppCliExecutable, l as registerMcpClient, m as findCommand, n as createAppCli, o as classifySchema, p as fetchResourceList, r as parseAppCliExecutableConfig, s as renderResponse, t as SMRT_MCP_RESULT_METADATA_KEY, u as resolveMcpClientRegistration } from "./src-DRNQCkh6.js";
|
|
3
3
|
export { AppCliRequestError, SMRT_MCP_RESULT_METADATA_KEY, assertSecureServerUrl, buildFlagParser, buildUrl, classifySchema, clearStoredToken, createAppCli, createMcpClientIdMetadataDocument, createMcpStdioBridge, fetchResourceList, findCommand, findResourceBySlug, getServerUrl, getStoredToken, invokeCommand, loadCliConfig, parseAppCliExecutableConfig, redactTransportValue, registerMcpClient, renderResponse, requestJson, requestJsonResult, resolveMcpClientRegistration, runAppCliExecutable, runMcpStdioBridge, saveAuth, saveCliConfig };
|
package/dist/invoke.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a parsed `(resource, command, argv)` triple to the actual HTTP
|
|
3
|
+
* request. Single dispatcher for both CRUD and custom commands.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import type { CliConfigContext } from './config.js';
|
|
8
|
+
import type { CliResource, CommandDefinition } from './discovery.js';
|
|
9
|
+
import type { ParsedArgs } from './parser.js';
|
|
10
|
+
export interface InvokeOptions {
|
|
11
|
+
context: CliConfigContext;
|
|
12
|
+
resource: CliResource;
|
|
13
|
+
command: CommandDefinition;
|
|
14
|
+
parsed: ParsedArgs;
|
|
15
|
+
/** Positional `<id>` argument — only meaningful for item-scope commands. */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Custom fetch (tests). */
|
|
18
|
+
fetch?: typeof fetch;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build the URL the CLI should hit for this command, plus the fetch init
|
|
22
|
+
* (headers, body) it should pass. Returns enough so callers can stream
|
|
23
|
+
* the response — they decide how to render it (see `output.ts`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function invokeCommand(options: InvokeOptions): Promise<Response>;
|
|
26
|
+
/**
|
|
27
|
+
* Build only the URL — exposed for tests.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildUrl(context: CliConfigContext, resource: CliResource, command: CommandDefinition, parsed: ParsedArgs, id?: string): Promise<string>;
|
|
30
|
+
//# sourceMappingURL=invoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,4EAA4E;IAC5E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsB7E;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,UAAU,EAClB,EAAE,CAAC,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CA4CjB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** MCP OAuth client-registration helpers for remote HTTP deployments. */
|
|
2
|
+
export type OAuthApplicationType = 'native' | 'web';
|
|
3
|
+
export interface McpClientIdMetadataDocument {
|
|
4
|
+
application_type: OAuthApplicationType;
|
|
5
|
+
client_id: string;
|
|
6
|
+
client_name: string;
|
|
7
|
+
grant_types: ['authorization_code'];
|
|
8
|
+
redirect_uris: string[];
|
|
9
|
+
response_types: ['code'];
|
|
10
|
+
token_endpoint_auth_method: 'none';
|
|
11
|
+
}
|
|
12
|
+
export interface OAuthAuthorizationServerMetadata {
|
|
13
|
+
client_id_metadata_document_supported?: boolean;
|
|
14
|
+
registration_endpoint?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface McpClientRegistrationOptions {
|
|
17
|
+
applicationType: OAuthApplicationType;
|
|
18
|
+
/** HTTPS metadata-document URL. Required only when CIMD is advertised. */
|
|
19
|
+
clientId?: string;
|
|
20
|
+
clientName: string;
|
|
21
|
+
redirectUris: string[];
|
|
22
|
+
}
|
|
23
|
+
export type McpClientRegistration = {
|
|
24
|
+
clientId: string;
|
|
25
|
+
kind: 'client_id_metadata_document';
|
|
26
|
+
metadataDocument: McpClientIdMetadataDocument;
|
|
27
|
+
} | {
|
|
28
|
+
endpoint: string;
|
|
29
|
+
kind: 'dynamic_client_registration';
|
|
30
|
+
request: Omit<McpClientIdMetadataDocument, 'client_id'>;
|
|
31
|
+
};
|
|
32
|
+
export interface McpRegisteredClient {
|
|
33
|
+
clientId: string;
|
|
34
|
+
kind: McpClientRegistration['kind'];
|
|
35
|
+
metadataDocument?: McpClientIdMetadataDocument;
|
|
36
|
+
registrationResponse?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/** Build and validate the document hosted at an HTTPS URL used as client_id. */
|
|
39
|
+
export declare function createMcpClientIdMetadataDocument(options: McpClientRegistrationOptions): McpClientIdMetadataDocument;
|
|
40
|
+
/**
|
|
41
|
+
* Select registration in MCP priority order: Client ID Metadata Documents
|
|
42
|
+
* first, then RFC 7591 DCR as a compatibility fallback.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveMcpClientRegistration(authorizationServer: OAuthAuthorizationServerMetadata, options: McpClientRegistrationOptions): McpClientRegistration;
|
|
45
|
+
/**
|
|
46
|
+
* Complete client registration against discovered authorization-server
|
|
47
|
+
* metadata. A Client ID Metadata Document needs no registration request: the
|
|
48
|
+
* authorization server retrieves it from the HTTPS client_id. The legacy DCR
|
|
49
|
+
* fallback is executed as an RFC 7591 JSON POST.
|
|
50
|
+
*/
|
|
51
|
+
export declare function registerMcpClient(authorizationServer: OAuthAuthorizationServerMetadata, options: McpClientRegistrationOptions, fetchImpl?: typeof fetch): Promise<McpRegisteredClient>;
|
|
52
|
+
//# sourceMappingURL=mcp-oauth.d.ts.map
|
|
@@ -0,0 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O,CAAC,CAAC;CAChD;AAyBD,gFAAgF;AAChF,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CAmB7B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,mBAAmB,EAAE,gCAAgC,EACrD,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CAqBvB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,mBAAmB,EAAE,gCAAgC,EACrD,OAAO,EAAE,4BAA4B,EACrC,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CAqC9B"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render a fetch Response to the CLI's stdout / stderr per content-type
|
|
3
|
+
* rules. Content-Type drives behavior; chunked transfer-encoding is
|
|
4
|
+
* implicit in the streaming path.
|
|
5
|
+
*
|
|
6
|
+
* Status >= 400, JSON → pretty-print to stderr; exit non-zero
|
|
7
|
+
* Status >= 400, text → stream to stderr; exit non-zero
|
|
8
|
+
* Status >= 400, binary → "error: <status> <statusText>" to stderr
|
|
9
|
+
* Status 204 / empty body → silent success
|
|
10
|
+
* application/json (≤10MB) → buffer, pretty-print to stdout
|
|
11
|
+
* application/json (>10MB) → raw stream + stderr warning
|
|
12
|
+
* text/* → stream to stdout
|
|
13
|
+
* binary, TTY stdout → refuse + stderr redirect hint
|
|
14
|
+
* binary, non-TTY stdout → pipe
|
|
15
|
+
* unknown content-type → treat as binary (safer than treating as text)
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
import type { Writable } from 'node:stream';
|
|
20
|
+
export interface OutputOptions {
|
|
21
|
+
stdout?: NodeJS.WriteStream | Writable;
|
|
22
|
+
stderr?: NodeJS.WriteStream | Writable;
|
|
23
|
+
/**
|
|
24
|
+
* Override the TTY detection (tests). Defaults to `stdout.isTTY`.
|
|
25
|
+
*/
|
|
26
|
+
stdoutIsTty?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface RenderResult {
|
|
29
|
+
exitCode: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render the response. Returns the desired exit code.
|
|
33
|
+
*/
|
|
34
|
+
export declare function renderResponse(response: Response, options?: OutputOptions): Promise<RenderResult>;
|
|
35
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;IACvC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID;;GAEG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAWvB"}
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSONSchema → argv flag parser.
|
|
3
|
+
*
|
|
4
|
+
* The CLI surfaces each command's parameters as `--flag` arguments. v0.1
|
|
5
|
+
* supports a deliberate subset of JSONSchema; anything beyond that falls
|
|
6
|
+
* back to a positional `'<json>'` escape hatch.
|
|
7
|
+
*
|
|
8
|
+
* Supported (per top-level property):
|
|
9
|
+
* - `type: "string" | "integer" | "number" | "boolean"`
|
|
10
|
+
* - `type: "string", enum: [...]`
|
|
11
|
+
* - `type: "array", items: { type: "string" | "integer" | "number" }`
|
|
12
|
+
* - `nullable: true` / `type: ["string", "null"]`
|
|
13
|
+
* (omitted = absent from body, NOT null)
|
|
14
|
+
* - `required: [...]` (enforced)
|
|
15
|
+
* - `default: ...`
|
|
16
|
+
* - `additionalProperties: true | false`
|
|
17
|
+
*
|
|
18
|
+
* Not supported (falls back to positional JSON payload):
|
|
19
|
+
* - Nested objects
|
|
20
|
+
* - `oneOf` / `anyOf` / `allOf`
|
|
21
|
+
* - Arrays of objects
|
|
22
|
+
* - `$ref`
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
export interface ParsedArgs {
|
|
27
|
+
/** Body to send (JSON serialised, for POST/PUT/PATCH). May be empty. */
|
|
28
|
+
body: Record<string, unknown>;
|
|
29
|
+
/** Query string parameters (for GET). May be empty. */
|
|
30
|
+
query: Record<string, string | string[]>;
|
|
31
|
+
/** True when the user passed a positional `'<json>'` payload — body is that. */
|
|
32
|
+
fromPositional: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface ParserOptions {
|
|
35
|
+
/** Force-treat schema as unsupported (caller already detected unsupportedness). */
|
|
36
|
+
positionalOnly?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type SchemaSupportStatus = {
|
|
39
|
+
kind: 'ok';
|
|
40
|
+
} | {
|
|
41
|
+
kind: 'unsupported';
|
|
42
|
+
reason: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'missing';
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Classify a JSONSchema. The CLI uses this to decide between rich flag
|
|
48
|
+
* parsing and the positional JSON escape hatch.
|
|
49
|
+
*/
|
|
50
|
+
export declare function classifySchema(schema: Record<string, unknown> | undefined): SchemaSupportStatus;
|
|
51
|
+
export interface BuildParserResult {
|
|
52
|
+
/** Parses argv tail (everything after `<cli> <slug> <cmd> [id]`). */
|
|
53
|
+
parse(argv: string[], httpMethod: string): ParsedArgs;
|
|
54
|
+
/** Status of the underlying schema. */
|
|
55
|
+
status: SchemaSupportStatus;
|
|
56
|
+
}
|
|
57
|
+
export declare function buildFlagParser(schema: Record<string, unknown> | undefined, options?: ParserOptions): BuildParserResult;
|
|
58
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,WAAW,UAAU;IACzB,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACzC,gFAAgF;IAChF,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,mFAAmF;IACnF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACd;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAExB;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,mBAAmB,CAuBrB;AAqDD,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;IACtD,uCAAuC;IACvC,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,OAAO,GAAE,aAAkB,GAC1B,iBAAiB,CAYnB"}
|
|
@@ -469,7 +469,7 @@ function makePositionalParser() {
|
|
|
469
469
|
}
|
|
470
470
|
function makeRichParser(schema) {
|
|
471
471
|
const props = schema.properties ?? {};
|
|
472
|
-
const required = new Set(schema.required ?? []
|
|
472
|
+
const required = new Set(schema.required ?? []);
|
|
473
473
|
const additionalProperties = schema.additionalProperties !== false;
|
|
474
474
|
return (argv, httpMethod) => {
|
|
475
475
|
const out = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-app-cli",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.33",
|
|
4
4
|
"description": "Reusable CLI factory for SMRT apps — branded `<name> <resource> <command>` CLI + stdio MCP bridge with decorator-driven resource discovery",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,17 +21,15 @@
|
|
|
21
21
|
"AGENTS.md"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@happyvertical/smrt-users": "0.51.
|
|
24
|
+
"@happyvertical/smrt-users": "0.51.33",
|
|
25
25
|
"@modelcontextprotocol/server": "2.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@happyvertical/smrt-core": "0.51.
|
|
29
|
-
"@microsoft/api-extractor": "7.59.1",
|
|
28
|
+
"@happyvertical/smrt-core": "0.51.33",
|
|
30
29
|
"@modelcontextprotocol/client": "2.0.0",
|
|
31
30
|
"@types/node": "24.13.6",
|
|
32
|
-
"typescript": "
|
|
31
|
+
"typescript": "6.0.3",
|
|
33
32
|
"vite": "8.1.4",
|
|
34
|
-
"vite-plugin-dts": "5.1.0",
|
|
35
33
|
"vitest": "4.1.10"
|
|
36
34
|
},
|
|
37
35
|
"engines": {
|