apps 0.0.1-beta.25 → 0.0.1-beta.26

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.
@@ -1,11 +1,39 @@
1
1
  /** Shared OpenAPI compilation diagnostics. */
2
2
  import { Schema } from "effect";
3
- export declare const OpenapiCompileErrorCode: 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", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
3
+ export declare const OpenapiCompileErrorCode: 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"]>;
4
+ /** A declared operation the importer left out, and why. */
5
+ export declare const OpenapiSkippedOperation: Schema.Struct<{
6
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
7
+ readonly name: Schema.String;
8
+ /** The HTTP method, such as `GET`. */
9
+ readonly method: Schema.String;
10
+ /** The path as the definition declares it. */
11
+ readonly path: Schema.String;
12
+ 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"]>;
13
+ readonly reason: Schema.String;
14
+ }>;
15
+ export type OpenapiSkippedOperation = typeof OpenapiSkippedOperation.Type;
4
16
  declare const OpenapiCompileError_base: Schema.Class<OpenapiCompileError, Schema.TaggedStruct<"OpenapiCompileError", {
5
- 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", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
17
+ 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"]>;
6
18
  readonly reason: Schema.String;
19
+ readonly skipped: Schema.optionalKey<Schema.$Array<Schema.Struct<{
20
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
21
+ readonly name: Schema.String;
22
+ /** The HTTP method, such as `GET`. */
23
+ readonly method: Schema.String;
24
+ /** The path as the definition declares it. */
25
+ readonly path: Schema.String;
26
+ 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"]>;
27
+ readonly reason: Schema.String;
28
+ }>>>;
29
+ readonly origins: Schema.optionalKey<Schema.$Array<Schema.String>>;
7
30
  }>, import("effect/Cause").YieldableError>;
8
- /** A safe generation failure, translated into product HTTP errors at the boundary. */
31
+ /**
32
+ * A safe generation failure. `reason` explains the cause; `skipped` lists the declared operations
33
+ * it left out and why, and `origins` the origins operations resolve to when none of them matches
34
+ * the allowed origin. Reading one left-out tool fails with this error for that operation alone.
35
+ */
9
36
  export declare class OpenapiCompileError extends OpenapiCompileError_base {
37
+ get message(): string;
10
38
  }
11
39
  export {};
@@ -20,7 +20,8 @@ export type OpenapiErrorResponse = typeof OpenapiErrorResponse.Type;
20
20
  /** Resolved OpenAPI parameter shared by import validation and request construction. */
21
21
  export declare const OpenapiParameter: Schema.Struct<{
22
22
  readonly name: Schema.String;
23
- readonly in: Schema.Literals<readonly ["path", "query", "header", "cookie"]>;
23
+ /** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
24
+ readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
24
25
  readonly required: Schema.optionalKey<Schema.Boolean>;
25
26
  readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
26
27
  readonly style: Schema.optionalKey<Schema.String>;
@@ -45,7 +46,7 @@ export declare const OpenapiOperation: Schema.Struct<{
45
46
  /** The document's operationId, when it declares one. `kinds` overrides are keyed by it. */
46
47
  readonly operationId: Schema.optionalKey<Schema.String>;
47
48
  readonly description: Schema.String;
48
- readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
49
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
49
50
  readonly path: Schema.String;
50
51
  readonly baseUrl: Schema.String;
51
52
  readonly openapi: Schema.String;
@@ -54,7 +55,8 @@ export declare const OpenapiOperation: Schema.Struct<{
54
55
  readonly request: Schema.Struct<{
55
56
  readonly parameters: Schema.$Array<Schema.Struct<{
56
57
  readonly name: Schema.String;
57
- readonly in: Schema.Literals<readonly ["path", "query", "header", "cookie"]>;
58
+ /** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
59
+ readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
58
60
  readonly required: Schema.optionalKey<Schema.Boolean>;
59
61
  readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
60
62
  readonly style: Schema.optionalKey<Schema.String>;
@@ -92,6 +94,8 @@ export declare const OpenapiOperation: Schema.Struct<{
92
94
  }>>>;
93
95
  }>;
94
96
  export type OpenapiOperation = typeof OpenapiOperation.Type;
97
+ /** Safe methods, whose operations are queries unless `kinds` says otherwise. QUERY is OpenAPI 3.2's. */
98
+ export declare const isOpenapiReadMethod: (method: OpenapiOperation["method"]) => method is "GET" | "HEAD" | "OPTIONS" | "QUERY";
95
99
  /** Map a selected account field to one Swagger credential value. */
96
100
  export declare const CredentialBinding: Schema.Struct<{
97
101
  readonly scheme: Schema.String;
@@ -125,7 +129,7 @@ export declare const OpenapiToolsOptions: Schema.Struct<{
125
129
  /** The document's operationId, when it declares one. `kinds` overrides are keyed by it. */
126
130
  readonly operationId: Schema.optionalKey<Schema.String>;
127
131
  readonly description: Schema.String;
128
- readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
132
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
129
133
  readonly path: Schema.String;
130
134
  readonly baseUrl: Schema.String;
131
135
  readonly openapi: Schema.String;
@@ -134,7 +138,8 @@ export declare const OpenapiToolsOptions: Schema.Struct<{
134
138
  readonly request: Schema.Struct<{
135
139
  readonly parameters: Schema.$Array<Schema.Struct<{
136
140
  readonly name: Schema.String;
137
- readonly in: Schema.Literals<readonly ["path", "query", "header", "cookie"]>;
141
+ /** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
142
+ readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
138
143
  readonly required: Schema.optionalKey<Schema.Boolean>;
139
144
  readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
140
145
  readonly style: Schema.optionalKey<Schema.String>;
@@ -223,7 +228,12 @@ export declare const defaultOpenapiResponseLimits: {
223
228
  readonly maxBodyBytes: 16777216;
224
229
  readonly readTimeoutMs: 30000;
225
230
  };
226
- /** Media returned as text rather than a base64 file. NDJSON remains an unparsed text result. */
231
+ /**
232
+ * A sequence of JSON values, one per line or record: NDJSON, JSON Lines and `json-seq`, whose
233
+ * items OpenAPI 3.2 describes with `itemSchema`. The body is not one JSON value.
234
+ */
235
+ export declare const isOpenapiJsonSequence: (type: string) => boolean;
236
+ /** Media returned as text rather than a base64 file. JSON sequences remain unparsed text. */
227
237
  export declare const isOpenapiTextMedia: (type: string) => boolean;
228
238
  /** A form field that carries raw file bytes: OpenAPI 3.1 `contentMediaType` without an
229
239
  * encoding, or the `format: binary` string that 3.1 documents still commonly use. */
@@ -11,6 +11,8 @@ import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/ope
11
11
  export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: JsonObject, options?: {
12
12
  readonly baseUrl?: string;
13
13
  readonly allowedOrigin?: string;
14
+ /** Inserted between every operation's server and path; see `prefixParameters`. */
15
+ readonly pathPrefix?: string;
14
16
  readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
15
17
  readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
16
18
  }) => Effect.Effect<{
@@ -19,7 +21,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
19
21
  readonly request: {
20
22
  readonly parameters: readonly {
21
23
  readonly name: string;
22
- readonly in: "query" | "path" | "header" | "cookie";
24
+ readonly in: "query" | "path" | "querystring" | "header" | "cookie";
23
25
  readonly required?: boolean;
24
26
  readonly schema?: {
25
27
  readonly [x: string]: Schema.Json;
@@ -59,7 +61,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
59
61
  readonly input: {
60
62
  readonly [x: string]: Schema.Json;
61
63
  };
62
- readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
64
+ readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "QUERY";
63
65
  readonly securitySchemes: {
64
66
  readonly [x: string]: {
65
67
  readonly [x: string]: Schema.Json;
@@ -87,6 +89,14 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
87
89
  };
88
90
  }[];
89
91
  }[];
92
+ /** Declared operations left out of `operations`, in definition order. */
93
+ skipped: {
94
+ readonly name: string;
95
+ readonly method: string;
96
+ readonly path: string;
97
+ readonly code: "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";
98
+ readonly reason: string;
99
+ }[];
90
100
  definitions: {
91
101
  [k: string]: {
92
102
  readonly [x: string]: Schema.Json;
@@ -13,10 +13,18 @@ export declare const DocumentObject: Schema.declare<{
13
13
  export declare const documentObject: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
14
14
  readonly [x: string]: Schema.Json;
15
15
  };
16
+ /** One JSON Pointer reference token. */
17
+ export declare const pointerToken: (key: string) => string;
18
+ /**
19
+ * Decode one part of the definition, located by the JSON Pointer `at`. A mismatch names the
20
+ * pointer of the first failing value and what was expected there.
21
+ */
22
+ export declare const decodeDefinition: <S extends Schema.Decoder<unknown>>(schema: S, value: unknown, at: string, what: string) => S["Type"];
16
23
  /** Resolve OpenAPI objects once; schemas retain their original recursive references.
17
- * Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer has one dialect and
18
- * 3.1 keywords that appear in 3.0 documents keep their meaning.
19
- * Unsupported versions, references and conversions throw TemplateError at the import boundary.
24
+ * Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer reads 3.1 and 3.2,
25
+ * whose Schema Objects share one dialect, and 3.1 keywords that appear in 3.0 documents keep
26
+ * their meaning. Unsupported versions, references and conversions throw TemplateError at the
27
+ * import boundary.
20
28
  */
21
29
  export declare function openApiDocument(input: JsonObject): Promise<{
22
30
  spec: {
@@ -51,14 +59,20 @@ export declare function openApiDocument(input: JsonObject): Promise<{
51
59
  definitions: Map<string, {
52
60
  readonly [x: string]: Schema.Json;
53
61
  }>;
62
+ /**
63
+ * The JSON Pointer of the object a local reference resolved to, so a diagnostic can locate
64
+ * a resolved Response, Parameter, Request Body or Path Item where the definition declares it.
65
+ */
66
+ origin(value: unknown): string | undefined;
54
67
  /** Inspect a component schema without expanding its children. OpenAPI object refs must already be resolved by Swagger. */
55
68
  resolve(value: JsonObject): JsonObject;
56
69
  /** Compose a Draft 2020-12 schema around API Schema Objects. Only values passed to
57
70
  * `api` use the document's OpenAPI dialect; Executor-authored wrappers are already
58
- * Draft 2020-12 and must not be reinterpreted. Reached components are converted once into
59
- * the shared `definitions` and stay references here; nothing is inlined or copied per operation.
71
+ * Draft 2020-12 and must not be reinterpreted. `api` takes the schema's JSON Pointer in the
72
+ * definition, which failures name. Reached components are converted once into the shared
73
+ * `definitions` and stay references here; nothing is inlined or copied per operation.
60
74
  */
61
- schema(build: (api: (input: Schema.Json) => JsonObject) => JsonObject): JsonObject;
75
+ schema(build: (api: (input: Schema.Json, at: string) => JsonObject) => JsonObject): JsonObject;
62
76
  }>;
63
77
  /** A parsed document with one reference scope and one schema dialect. */
64
78
  export type OpenApiDocument = Awaited<ReturnType<typeof openApiDocument>>;
@@ -11,8 +11,13 @@ export interface OperationNameInput {
11
11
  readonly path: string;
12
12
  }
13
13
  /**
14
- * Plan one name per input, in input order. Names that collide are refined together: first by
15
- * the path's version segment, then by the HTTP method, then by a stable hash. Refinement only
16
- * touches the colliding names, so adding an operation never renames an unrelated one.
14
+ * Name every input, in input order. Names that collide, whether or not they come from an
15
+ * operationId, are refined together: first by the path's version segment, then by the path
16
+ * segments that tell them apart (`GET /items` and `GET /items/{id}` are `items.getItems` and
17
+ * `items.getItemsById`), then by the whole path, then by the HTTP method, then by a stable hash.
18
+ * Refinement only touches the colliding names, so adding an operation never renames an unrelated
19
+ * one.
17
20
  */
18
- export declare const planOperationNames: (inputs: readonly OperationNameInput[]) => string[];
21
+ export declare const planOperationNames: <I extends OperationNameInput>(inputs: readonly I[]) => (I & {
22
+ readonly name: string;
23
+ })[];
@@ -16,6 +16,12 @@ export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operati
16
16
  readonly allowedOrigin: string;
17
17
  readonly securitySchemes: Readonly<Record<string, JsonObject>>;
18
18
  readonly baseUrl?: string;
19
+ /**
20
+ * A path inserted between the server and every operation's path, for a definition that omits a
21
+ * leading segment, such as `/projects/{project}`. Each `{name}` becomes a required string path
22
+ * parameter of every tool, unless the operation already declares it without placing it.
23
+ */
24
+ readonly pathPrefix?: string;
19
25
  readonly freshFor?: Duration.Input;
20
26
  readonly staleFor?: Duration.Input;
21
27
  /**