apps 0.0.1-beta.55 → 0.0.1-beta.59

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.
@@ -37,4 +37,54 @@ declare const OpenapiCompileError_base: Schema.Class<OpenapiCompileError, Schema
37
37
  export declare class OpenapiCompileError extends OpenapiCompileError_base {
38
38
  get message(): string;
39
39
  }
40
+ /** A tool a generated OpenAPI router exposes, read from the definition alone. */
41
+ export declare const OpenapiToolName: Schema.Struct<{
42
+ /** The tool name relative to the router, as `withApprovals` receives it. */
43
+ readonly name: Schema.String;
44
+ /** The HTTP method, such as `GET`. */
45
+ readonly method: Schema.String;
46
+ /** The request path, including any `pathPrefix`. */
47
+ readonly path: Schema.String;
48
+ readonly operationId: Schema.optionalKey<Schema.String>;
49
+ /** After `kinds` (keyed by `operationId`, else `name`); otherwise reading methods are queries. */
50
+ readonly kind: Schema.Literals<readonly ["query", "mutation"]>;
51
+ /** Callable without credentials, so every account and a router without one expose it. */
52
+ readonly public: Schema.Boolean;
53
+ /** The `methods` and `oauth` entries whose accounts expose it. */
54
+ readonly methods: Schema.$Array<Schema.String>;
55
+ }>;
56
+ export type OpenapiToolName = typeof OpenapiToolName.Type;
57
+ /** Every tool a definition yields for some account, and the operations the compiler left out. */
58
+ export declare const OpenapiToolNames: Schema.Struct<{
59
+ readonly tools: Schema.$Array<Schema.Struct<{
60
+ /** The tool name relative to the router, as `withApprovals` receives it. */
61
+ readonly name: Schema.String;
62
+ /** The HTTP method, such as `GET`. */
63
+ readonly method: Schema.String;
64
+ /** The request path, including any `pathPrefix`. */
65
+ readonly path: Schema.String;
66
+ readonly operationId: Schema.optionalKey<Schema.String>;
67
+ /** After `kinds` (keyed by `operationId`, else `name`); otherwise reading methods are queries. */
68
+ readonly kind: Schema.Literals<readonly ["query", "mutation"]>;
69
+ /** Callable without credentials, so every account and a router without one expose it. */
70
+ readonly public: Schema.Boolean;
71
+ /** The `methods` and `oauth` entries whose accounts expose it. */
72
+ readonly methods: Schema.$Array<Schema.String>;
73
+ }>>;
74
+ /**
75
+ * Operations the compiler left out, and why. An operation it imports but no configured `methods`
76
+ * or `oauth` entry can authorize is missing from `tools` and is not listed here.
77
+ */
78
+ readonly skipped: Schema.$Array<Schema.Struct<{
79
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
80
+ readonly name: Schema.String;
81
+ /** The HTTP method, such as `GET`. */
82
+ readonly method: Schema.String;
83
+ /** The path as the definition declares it. */
84
+ readonly path: Schema.String;
85
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
86
+ readonly reason: Schema.String;
87
+ }>>;
88
+ }>;
89
+ export type OpenapiToolNames = typeof OpenapiToolNames.Type;
40
90
  export {};
@@ -3,6 +3,7 @@ import { Duration } from "effect";
3
3
  import type { AppCache } from "../contracts/cache.js";
4
4
  import { OpenapiOperation, type OpenapiToolsOptions } from "../contracts/openapi.js";
5
5
  import { JsonObject, JsonValue } from "../contracts/schema.js";
6
+ import { type OpenapiToolNames } from "../contracts/openapi-compile.js";
6
7
  import { type OperationKinds } from "./protocol-operations.js";
7
8
  import { type RouterDeclaration } from "./router.js";
8
9
  /** Static credential placement and destination are reviewed when the app is authored/imported. */
@@ -40,3 +41,14 @@ export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operati
40
41
  export declare function patchOpenapi(root: JsonObject, patches: OpenapiSourceOptions["patches"]): JsonObject;
41
42
  /** No I/O during app construction. All accounts share credential-free compilation. */
42
43
  export declare const liveOpenapiRouter: (options: OpenapiSourceOptions) => RouterDeclaration;
44
+ /** The settings `openapiToolNames` reads: the router's, without an account or cache. */
45
+ export type OpenapiToolNamesOptions = Omit<OpenapiSourceOptions, "cache" | "account" | "parameterDefaults" | "freshFor" | "staleFor">;
46
+ /**
47
+ * The tools `liveOpenapiRouter` with the same options exposes, from the definition alone: no
48
+ * account, cache or deployment. Each tool says which `methods` and `oauth` entries expose it, so
49
+ * an author can check the names a `withApprovals` policy matches before any account connects.
50
+ * `skipped` lists only the operations the compiler left out and why. An operation no configured
51
+ * `methods` or `oauth` entry can authorize is missing from `tools` and not listed in `skipped`.
52
+ * `fetch` defaults to the global fetch.
53
+ */
54
+ export declare const openapiToolNames: (options: OpenapiToolNamesOptions) => Promise<OpenapiToolNames>;
@@ -9,4 +9,4 @@ export { OpenapiError, isOpenapiTextMedia, openapiBinaryResultSchema, OpenapiErr
9
9
  export declare const openapiRouter: (options: OpenapiToolsOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
10
10
  export type { OperationKinds } from "./implementation/protocol-operations.js";
11
11
  export * from "./contracts/openapi-compile.js";
12
- export { liveOpenapiRouter, type OpenapiSourceOptions } from "./implementation/openapi-source.js";
12
+ export { liveOpenapiRouter, openapiToolNames, type OpenapiSourceOptions, type OpenapiToolNamesOptions, } from "./implementation/openapi-source.js";