apps 0.0.1-beta.9 → 0.0.1-beta.91
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/README.md +56 -38
- package/framework-reference.json +1 -1
- package/js/chunk-3LEVTFD4.js +712 -0
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/{chunk-FL2QR3XW.js → chunk-5MDA7MKL.js} +338 -73
- package/js/chunk-6XQLA5NC.js +5047 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/chunk-7PHHWYV4.js +335 -0
- package/js/chunk-DADXWWRZ.js +449 -0
- package/js/{chunk-27F7W2LG.js → chunk-DDHBUKXX.js} +18 -2
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/{chunk-5T57N25Q.js → chunk-GQ33QSNB.js} +583 -69
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/chunk-I5C7FD5Z.js +171 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/{chunk-RFVIONFX.js → chunk-KUCCHNVY.js} +123 -44
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/{chunk-72JNVHPK.js → chunk-PYQLOLOC.js} +4 -3
- package/js/{chunk-ODEIDRGW.js → chunk-QWQM3CLH.js} +795 -176
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/chunk-XPRZTLHD.js +1915 -0
- package/js/chunk-YNJ5CZMJ.js +93 -0
- package/js/chunk-YRGL4QEF.js +49 -0
- package/js/{chunk-Z5M2LQOZ.js → chunk-YWFUWTUJ.js} +113 -58
- package/js/client.js +142 -78
- package/js/contracts.js +142 -21
- package/js/effect.js +18 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +49 -40
- package/js/host.js +85 -62
- package/js/index.js +165 -70
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +76 -56
- package/js/openapi.js +4189 -1411
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8605 -225
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +60 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +1446 -17
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +14 -7
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +157 -47
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +6669 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +90 -6
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +44 -14
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +19 -17
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +28 -7
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +57 -7
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +20 -18
- package/types/apps/src/implementation/router.d.ts +24 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +98 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +26 -9
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +68 -19
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +6 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-7EK2JDX4.js +0 -299
- package/js/chunk-IKS2C5MQ.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-SJFZCGXG.js +0 -1243
- package/js/chunk-WLE7WX2U.js +0 -2645
- package/js/chunk-YXQHV65J.js +0 -242
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
/** Compile an OpenAPI document into tool declarations inside the app runtime, never a second execution engine. */
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
import { JsonObject } from "../contracts/schema.js";
|
|
4
|
+
import { OpenapiErrorResponse } from "../contracts/openapi.js";
|
|
4
5
|
import { OpenapiCompileError as TemplateError } from "../contracts/openapi-compile.js";
|
|
5
6
|
import type { OpenApiImport } from "../contracts/openapi-document.js";
|
|
6
7
|
import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/openapi-document.js";
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import { type OpenApiDocument } from "./openapi-document.js";
|
|
9
|
+
/** Keep tagged errors, including response/component refs and anyOf alternatives.
|
|
10
|
+
* Public text comes from a declared string message or the schema's static description.
|
|
11
|
+
* `scripts/check-api-errors.ts` applies this to Executor's own API documents.
|
|
12
|
+
*/
|
|
13
|
+
export declare function errorResponses(document: OpenApiDocument, operation: JsonObject, at: string): OpenapiErrorResponse[];
|
|
14
|
+
/** Compile a revision of a live OpenAPI source into tool declarations for the app runtime.
|
|
15
|
+
* The document is consumed: compilation upgrades it in place instead of copying it. It must be a
|
|
16
|
+
* tree, with no object reached twice, as parsed JSON is.
|
|
17
|
+
*/
|
|
18
|
+
export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: JsonObject, options?: {
|
|
9
19
|
readonly baseUrl?: string;
|
|
10
|
-
|
|
20
|
+
/** The origins operations may address; every other operation is left out. */
|
|
21
|
+
readonly allowedOrigin?: string | readonly string[];
|
|
22
|
+
/** Inserted between every operation's server and path; see `prefixParameters`. */
|
|
23
|
+
readonly pathPrefix?: string;
|
|
11
24
|
readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
|
|
12
25
|
readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
|
|
13
26
|
}) => Effect.Effect<{
|
|
14
27
|
operations: {
|
|
15
|
-
readonly name: string;
|
|
16
28
|
readonly path: string;
|
|
29
|
+
readonly method: "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "QUERY";
|
|
17
30
|
readonly description: string;
|
|
31
|
+
readonly name: string;
|
|
18
32
|
readonly request: {
|
|
19
33
|
readonly parameters: readonly {
|
|
34
|
+
readonly in: "path" | "header" | "query" | "querystring" | "cookie";
|
|
20
35
|
readonly name: string;
|
|
21
|
-
readonly in: "query" | "path" | "header" | "cookie";
|
|
22
36
|
readonly required?: boolean;
|
|
23
37
|
readonly schema?: {
|
|
24
38
|
readonly [x: string]: Schema.Json;
|
|
@@ -56,7 +70,6 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
56
70
|
readonly input: {
|
|
57
71
|
readonly [x: string]: Schema.Json;
|
|
58
72
|
};
|
|
59
|
-
readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
60
73
|
readonly securitySchemes: {
|
|
61
74
|
readonly [x: string]: {
|
|
62
75
|
readonly [x: string]: Schema.Json;
|
|
@@ -84,6 +97,14 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
84
97
|
};
|
|
85
98
|
}[];
|
|
86
99
|
}[];
|
|
100
|
+
/** Declared operations left out of `operations`, in definition order. */
|
|
101
|
+
skipped: {
|
|
102
|
+
readonly name: string;
|
|
103
|
+
readonly method: string;
|
|
104
|
+
readonly path: string;
|
|
105
|
+
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";
|
|
106
|
+
readonly reason: string;
|
|
107
|
+
}[];
|
|
87
108
|
definitions: {
|
|
88
109
|
[k: string]: {
|
|
89
110
|
readonly [x: string]: Schema.Json;
|
|
@@ -113,7 +134,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
113
134
|
readonly [x: string]: Schema.Json;
|
|
114
135
|
};
|
|
115
136
|
};
|
|
116
|
-
|
|
137
|
+
pinnedOrigins: string[];
|
|
117
138
|
fallback: readonly {
|
|
118
139
|
readonly [x: string]: readonly string[];
|
|
119
140
|
}[] | undefined;
|
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { JsonObject } from "../contracts/schema.js";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
/**
|
|
4
|
+
* An object in a document that was validated as JSON when it was read. Compilation only turns JSON
|
|
5
|
+
* into JSON, so inside it an object's shape is checked, not its every leaf again: re-validating
|
|
6
|
+
* whole documents was most of a large API's compile time.
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare const DocumentObject: Schema.declare<{
|
|
9
|
+
readonly [x: string]: Schema.Json;
|
|
10
|
+
}, {
|
|
11
|
+
readonly [x: string]: Schema.Json;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const documentObject: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
14
|
+
readonly [x: string]: Schema.Json;
|
|
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"];
|
|
23
|
+
/** Resolve OpenAPI objects once; schemas retain their original recursive references.
|
|
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.
|
|
28
|
+
*/
|
|
29
|
+
export declare function openApiDocument(input: JsonObject): Promise<{
|
|
9
30
|
spec: {
|
|
10
31
|
readonly openapi: string;
|
|
11
32
|
readonly paths: {
|
|
@@ -13,39 +34,45 @@ export declare function openApiDocument(input: unknown): Promise<{
|
|
|
13
34
|
readonly [x: string]: Schema.Json;
|
|
14
35
|
};
|
|
15
36
|
};
|
|
16
|
-
readonly security?: readonly {
|
|
17
|
-
readonly [x: string]: readonly string[];
|
|
18
|
-
}[];
|
|
19
|
-
readonly servers?: readonly {
|
|
20
|
-
readonly url: string;
|
|
21
|
-
readonly variables?: {
|
|
22
|
-
readonly [x: string]: Schema.Json;
|
|
23
|
-
};
|
|
24
|
-
}[];
|
|
25
37
|
readonly components?: {
|
|
26
|
-
readonly
|
|
38
|
+
readonly schemas?: {
|
|
27
39
|
readonly [x: string]: {
|
|
28
40
|
readonly [x: string]: Schema.Json;
|
|
29
41
|
};
|
|
30
42
|
};
|
|
31
|
-
readonly
|
|
43
|
+
readonly securitySchemes?: {
|
|
32
44
|
readonly [x: string]: {
|
|
33
45
|
readonly [x: string]: Schema.Json;
|
|
34
46
|
};
|
|
35
47
|
};
|
|
36
48
|
};
|
|
49
|
+
readonly security?: readonly {
|
|
50
|
+
readonly [x: string]: readonly string[];
|
|
51
|
+
}[];
|
|
52
|
+
readonly servers?: readonly {
|
|
53
|
+
readonly url: string;
|
|
54
|
+
readonly variables?: {
|
|
55
|
+
readonly [x: string]: Schema.Json;
|
|
56
|
+
};
|
|
57
|
+
}[];
|
|
37
58
|
};
|
|
38
59
|
definitions: Map<string, {
|
|
39
60
|
readonly [x: string]: Schema.Json;
|
|
40
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;
|
|
41
67
|
/** Inspect a component schema without expanding its children. OpenAPI object refs must already be resolved by Swagger. */
|
|
42
68
|
resolve(value: JsonObject): JsonObject;
|
|
43
69
|
/** Compose a Draft 2020-12 schema around API Schema Objects. Only values passed to
|
|
44
70
|
* `api` use the document's OpenAPI dialect; Executor-authored wrappers are already
|
|
45
|
-
* Draft 2020-12 and must not be reinterpreted.
|
|
46
|
-
*
|
|
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.
|
|
47
74
|
*/
|
|
48
|
-
schema(build: (api: (input: Schema.Json) => JsonObject) => JsonObject): JsonObject;
|
|
75
|
+
schema(build: (api: (input: Schema.Json, at: string) => JsonObject) => JsonObject): JsonObject;
|
|
49
76
|
}>;
|
|
50
77
|
/** A parsed document with one reference scope and one schema dialect. */
|
|
51
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
|
-
*
|
|
15
|
-
* the path's version segment, then by the
|
|
16
|
-
*
|
|
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
|
|
21
|
+
export declare const planOperationNames: <I extends OperationNameInput>(inputs: readonly I[]) => (I & {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
})[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NetworkRefused } from "../contracts/network.js";
|
|
1
2
|
import { ProviderError } from "../contracts/provider-error.js";
|
|
2
3
|
/** Swagger constructs requests; Effect owns HTTP policy and bounded results. */
|
|
3
4
|
import { Effect, Schema } from "effect";
|
|
@@ -6,12 +7,19 @@ import { OpenapiError, type CredentialBinding, type OpenapiOperation, type Opena
|
|
|
6
7
|
type DeclaredError = OpenapiErrorResponse & {
|
|
7
8
|
readonly decoder: Schema.Decoder<Schema.Json>;
|
|
8
9
|
};
|
|
10
|
+
/** What decides whether an account can call an operation: its transport and security. */
|
|
11
|
+
export interface OpenapiOperationAccess {
|
|
12
|
+
readonly streaming?: true;
|
|
13
|
+
readonly request: {
|
|
14
|
+
readonly security: OpenapiOperation["request"]["security"];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
9
17
|
/** Create request helpers from credential-free generated authentication metadata. */
|
|
10
18
|
export declare function createRequest(config: {
|
|
11
19
|
readonly methods: Readonly<Record<string, readonly CredentialBinding[]>>;
|
|
12
20
|
readonly oauth: readonly string[];
|
|
13
21
|
}): {
|
|
14
|
-
available: (op:
|
|
15
|
-
call: (op: OpenapiOperation, input: unknown, account: OpenapiAccount | undefined, errors: readonly DeclaredError[]) => Effect.Effect<Schema.Json, ProviderError | OpenapiResponseError | OpenapiError, never>;
|
|
22
|
+
available: (op: OpenapiOperationAccess, account: OpenapiAccount | undefined) => boolean;
|
|
23
|
+
call: (op: OpenapiOperation, input: unknown, account: OpenapiAccount | undefined, errors: readonly DeclaredError[]) => Effect.Effect<Schema.Json, ProviderError | NetworkRefused | OpenapiResponseError | OpenapiError, never>;
|
|
16
24
|
};
|
|
17
25
|
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. */
|
|
@@ -13,9 +14,19 @@ export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operati
|
|
|
13
14
|
} | {
|
|
14
15
|
readonly document: JsonObject;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The origin that may receive credentials, or several origins of one service, such as its API
|
|
19
|
+
* and upload hosts. Operations on any other origin are left out.
|
|
20
|
+
*/
|
|
21
|
+
readonly allowedOrigin: string | readonly string[];
|
|
17
22
|
readonly securitySchemes: Readonly<Record<string, JsonObject>>;
|
|
18
23
|
readonly baseUrl?: string;
|
|
24
|
+
/**
|
|
25
|
+
* A path inserted between the server and every operation's path, for a definition that omits a
|
|
26
|
+
* leading segment, such as `/projects/{project}`. Each `{name}` becomes a required string path
|
|
27
|
+
* parameter of every tool, unless the operation already declares it without placing it.
|
|
28
|
+
*/
|
|
29
|
+
readonly pathPrefix?: string;
|
|
19
30
|
readonly freshFor?: Duration.Input;
|
|
20
31
|
readonly staleFor?: Duration.Input;
|
|
21
32
|
/**
|
|
@@ -34,3 +45,14 @@ export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operati
|
|
|
34
45
|
export declare function patchOpenapi(root: JsonObject, patches: OpenapiSourceOptions["patches"]): JsonObject;
|
|
35
46
|
/** No I/O during app construction. All accounts share credential-free compilation. */
|
|
36
47
|
export declare const liveOpenapiRouter: (options: OpenapiSourceOptions) => RouterDeclaration;
|
|
48
|
+
/** The settings `openapiToolNames` reads: the router's, without an account or cache. */
|
|
49
|
+
export type OpenapiToolNamesOptions = Omit<OpenapiSourceOptions, "cache" | "account" | "parameterDefaults" | "freshFor" | "staleFor">;
|
|
50
|
+
/**
|
|
51
|
+
* The tools `liveOpenapiRouter` with the same options exposes, from the definition alone: no
|
|
52
|
+
* account, cache or deployment. Each tool says which `methods` and `oauth` entries expose it, so
|
|
53
|
+
* an author can check the names a `withApprovals` policy matches before any account connects.
|
|
54
|
+
* `skipped` lists only the operations the compiler left out and why. An operation no configured
|
|
55
|
+
* `methods` or `oauth` entry can authorize is missing from `tools` and not listed in `skipped`.
|
|
56
|
+
* `fetch` defaults to the global fetch.
|
|
57
|
+
*/
|
|
58
|
+
export declare const openapiToolNames: (options: OpenapiToolNamesOptions) => Promise<OpenapiToolNames>;
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
/** Pure operation declarations. Only the author callback crosses the Promise boundary. */
|
|
2
|
-
import {
|
|
2
|
+
import { Schema as EffectSchema } from "effect";
|
|
3
3
|
import type { AppOperation } from "../contracts/operations.js";
|
|
4
|
-
import type { AppContext,
|
|
4
|
+
import type { AppContext, AppRequirements, AnyScopeMutationContext, MutationContext, QueryContext } from "../contracts/context.js";
|
|
5
|
+
import type { AccountScope } from "../contracts/app.js";
|
|
5
6
|
import type { Approval } from "../approval.js";
|
|
6
7
|
import type { ToolAnnotations } from "../contracts/tools.js";
|
|
7
8
|
import type { JsonObject } from "../contracts/schema.js";
|
|
8
9
|
import { type Schema } from "./schema.js";
|
|
9
10
|
declare const NativeOperation: unique symbol;
|
|
11
|
+
declare const ApprovalDeclared: unique symbol;
|
|
12
|
+
/**
|
|
13
|
+
* Marks an operation declared with an approval. App-scope work, such as an app schedule, has no
|
|
14
|
+
* person to approve a call, so it accepts only operations without this mark.
|
|
15
|
+
*/
|
|
16
|
+
export interface Approved {
|
|
17
|
+
readonly [ApprovalDeclared]: true;
|
|
18
|
+
}
|
|
19
|
+
/** An operation declared without an approval. */
|
|
20
|
+
export interface WithoutApproval {
|
|
21
|
+
readonly [ApprovalDeclared]?: never;
|
|
22
|
+
}
|
|
23
|
+
/** The context any handler may declare: either scope, so `user` may be absent. */
|
|
24
|
+
export type AnyContext = AppContext<AppRequirements, AccountScope>;
|
|
10
25
|
declare const QueryHandlerContext: unique symbol;
|
|
11
26
|
declare const MutationHandlerContext: unique symbol;
|
|
12
27
|
/**
|
|
@@ -38,6 +53,11 @@ export interface RouterChild<Query, Mutation> {
|
|
|
38
53
|
readonly [QueryHandlerContext]?: (context: Query) => void;
|
|
39
54
|
readonly [MutationHandlerContext]?: (context: Mutation) => void;
|
|
40
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* A query or mutation whose handler context is checked by its kind, as a dynamic router resolves
|
|
58
|
+
* one. `query()` and `mutation()` results fit with their inferred contexts.
|
|
59
|
+
*/
|
|
60
|
+
export type OperationChild<Query, Mutation> = RouterChild<Query, Mutation> & Pick<OperationDeclaration<"query" | "mutation">, "kind" | typeof NativeOperation>;
|
|
41
61
|
/** Private key for a router's native definition. */
|
|
42
62
|
export declare const NativeRouterKey: unique symbol;
|
|
43
63
|
/** Typed operation handles drive browser reference inference without bundling handlers. */
|
|
@@ -64,7 +84,7 @@ export interface OperationOptions<Input, Output> {
|
|
|
64
84
|
}
|
|
65
85
|
/** Adapt metadata and approval without running user code. */
|
|
66
86
|
export declare const operationOptions: <Input, Output>(options: OperationOptions<Input, Output>) => {
|
|
67
|
-
approval?: (context: Parameters<Approval<Input>>[0]) => Effect.Effect<"approved" | "denied" | "user-approval", unknown, never>;
|
|
87
|
+
approval?: (context: Parameters<Approval<Input>>[0]) => import("effect/Effect").Effect<"approved" | "denied" | "user-approval", unknown, never>;
|
|
68
88
|
input: EffectSchema.Decoder<Input, never>;
|
|
69
89
|
_meta?: {
|
|
70
90
|
readonly [x: string]: EffectSchema.Json;
|
|
@@ -79,10 +99,40 @@ export declare const operationOptions: <Input, Output>(options: OperationOptions
|
|
|
79
99
|
title?: string;
|
|
80
100
|
description?: string;
|
|
81
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* Replace a native operation's approval. Property descriptors are copied so an output schema that
|
|
104
|
+
* a protocol adapter builds only when read stays lazy.
|
|
105
|
+
*/
|
|
106
|
+
export declare const approvedOperation: <Input, Native extends AppOperation<Input, unknown>>(operation: Native, approval: Approval<Input>) => Native;
|
|
82
107
|
/** Attach the same approval function to a generated or shared operation. */
|
|
83
|
-
export declare const withApproval: <Input, Output, Kind extends "query" | "mutation", Context>(operation: Operation<Input, Output, Kind, Context>, approval: Approval<Input>) => Operation<Input, Output, Kind, Context
|
|
108
|
+
export declare const withApproval: <Input, Output, Kind extends "query" | "mutation", Context>(operation: Operation<Input, Output, Kind, Context>, approval: Approval<Input>) => Operation<Input, Output, Kind, Context> & Approved;
|
|
109
|
+
/**
|
|
110
|
+
* The advisory hints an operation carries, such as an MCP server's `destructiveHint`. App code
|
|
111
|
+
* reads them to choose an approval; the framework never infers one from them.
|
|
112
|
+
*/
|
|
113
|
+
export declare const toolAnnotations: (operation: OperationDeclaration<"query" | "mutation", never>) => ToolAnnotations | undefined;
|
|
84
114
|
/** Read operation. External reads are allowed; only database writes are mechanically prohibited. */
|
|
85
|
-
export declare const query: <Input, Output, Context extends
|
|
86
|
-
/**
|
|
87
|
-
|
|
115
|
+
export declare const query: <Input, Output, Context extends AnyContext = QueryContext>(options: OperationOptions<Input, Output>, run: (context: Context, input: Input) => Promise<Output>) => Operation<Input, Output, "query", Context>;
|
|
116
|
+
/** The parameters a mutation's handler declares: its context and input, its context, or none. */
|
|
117
|
+
type HandlerParameters<Context, Input> = [context: Context, input: Input] | [context: Context] | [];
|
|
118
|
+
/** The context a handler declares; one without parameters may run in either scope. */
|
|
119
|
+
type DeclaredContext<Signature, Context> = Signature extends [] ? AnyScopeMutationContext : Signature extends readonly [infer Declared, ...unknown[]] ? Declared : Context;
|
|
120
|
+
/**
|
|
121
|
+
* Explicit write operation. Database writes roll back on failure; external effects cannot be undone.
|
|
122
|
+
* A handler that declares a context gets the caller's, with `user`, unless its type says otherwise.
|
|
123
|
+
* One that declares no parameters, in a call without explicit type arguments, uses no context, so
|
|
124
|
+
* it may run as the app, as an app schedule runs it. Explicit type arguments name the context with
|
|
125
|
+
* the third, which defaults to the caller's. One declared with an approval is marked `Approved`, so
|
|
126
|
+
* app-scope schedules refuse it.
|
|
127
|
+
*/
|
|
128
|
+
export declare function mutation<Input, Output, Context extends AnyContext = MutationContext>(options: OperationOptions<Input, Output> & {
|
|
129
|
+
readonly approval: Approval<Input>;
|
|
130
|
+
}, run: (context: Context, input: Input) => Promise<Output>): Operation<Input, Output, "mutation", Context> & Approved;
|
|
131
|
+
export declare function mutation<Input, Output, Context extends AnyContext = MutationContext, Signature extends HandlerParameters<Context, Input> = [context: Context, input: Input]>(options: OperationOptions<Input, Output> & {
|
|
132
|
+
readonly approval?: undefined;
|
|
133
|
+
}, run: (...parameters: Signature) => Promise<Output>): Operation<Input, Output, "mutation", DeclaredContext<Signature, Context>>;
|
|
134
|
+
/** A handler whose context's type the caller's does not fit, such as one of the `"app"` scope. */
|
|
135
|
+
export declare function mutation<Input, Output, Context extends AnyContext>(options: OperationOptions<Input, Output> & {
|
|
136
|
+
readonly approval?: undefined;
|
|
137
|
+
}, run: (context: Context, input: Input) => Promise<Output>): Operation<Input, Output, "mutation", Context>;
|
|
88
138
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** One client's mounted queries and ordered optimistic write/read handoffs. */
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import { Atom, AsyncResult } from "effect/
|
|
3
|
+
import { Atom, AsyncResult } from "effect/reactivity";
|
|
4
4
|
import type { AppMutation } from "../contracts/optimistic.js";
|
|
5
5
|
import type { OperationReference } from "../contracts/live.js";
|
|
6
6
|
import { JsonValue } from "../contracts/schema.js";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoring credential placements. A method's `request` callback runs once, when the provider is
|
|
3
|
+
* declared, with an opaque reference for each of the method's fields. It returns placements built
|
|
4
|
+
* from `header` or `query` and a value from `t`, `base64` and references; the result is stored
|
|
5
|
+
* as data. A reference is not a string: an untagged template literal fails when it is evaluated.
|
|
6
|
+
*/
|
|
7
|
+
import { Placement, type PlacementPart } from "../contracts/placement.js";
|
|
8
|
+
import type { AccountRequest, FieldExposure } from "../contracts/provider.js";
|
|
9
|
+
/** Throw when JavaScript turns a placement into a string, so untagged templates fail. */
|
|
10
|
+
declare class NotAString {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(described: string);
|
|
13
|
+
[Symbol.toPrimitive](): never;
|
|
14
|
+
toString(): never;
|
|
15
|
+
toJSON(): never;
|
|
16
|
+
}
|
|
17
|
+
/** A reference to one of the method's account fields, given to its `request` callback. */
|
|
18
|
+
export declare class FieldRef<Name extends string = string> extends NotAString {
|
|
19
|
+
readonly field: Name;
|
|
20
|
+
constructor(field: Name);
|
|
21
|
+
}
|
|
22
|
+
/** A value template built with `t` or `base64`. */
|
|
23
|
+
export declare class PlacementValue extends NotAString {
|
|
24
|
+
readonly parts: readonly PlacementPart[];
|
|
25
|
+
constructor(parts: readonly PlacementPart[]);
|
|
26
|
+
}
|
|
27
|
+
/** What a template may interpolate: literal text, a field reference or another value. */
|
|
28
|
+
export type PlacementInput = string | FieldRef | PlacementValue;
|
|
29
|
+
/** A value template: literal text with interpolated field references and values. */
|
|
30
|
+
export declare const t: (strings: TemplateStringsArray, ...values: readonly PlacementInput[]) => PlacementValue;
|
|
31
|
+
/** Base64 of a value's UTF-8 bytes, such as the `user:password` of Basic credentials. */
|
|
32
|
+
export declare const base64: (value: PlacementInput) => PlacementValue;
|
|
33
|
+
/** Send a value as the whole value of this header. The name is case-insensitive. */
|
|
34
|
+
export declare const header: (name: string, input: PlacementInput) => Placement;
|
|
35
|
+
/** Send a value as the whole value of this query parameter. */
|
|
36
|
+
export declare const query: (name: string, input: unknown) => Placement;
|
|
37
|
+
/** `Authorization: Bearer <token>`. */
|
|
38
|
+
export declare const bearer: (token: FieldRef) => Placement;
|
|
39
|
+
/** `Authorization: Basic base64(<user>:<password>)`. */
|
|
40
|
+
export declare const basic: (user: PlacementInput, password: PlacementInput) => Placement;
|
|
41
|
+
/** The field references a `request` callback receives, by field name. */
|
|
42
|
+
export type FieldRefs<Name extends string> = {
|
|
43
|
+
readonly [Key in Name]: FieldRef<Key>;
|
|
44
|
+
};
|
|
45
|
+
/** How a method declares its placements: called once with its field references. */
|
|
46
|
+
export type RequestPlacements<Name extends string> = (fields: FieldRefs<Name>) => Placement | readonly Placement[];
|
|
47
|
+
/**
|
|
48
|
+
* Run a method's `request` callback once and check its placements. Every reference names one of
|
|
49
|
+
* the method's fields, no `raw()` field appears, and each placement references a secret field.
|
|
50
|
+
*/
|
|
51
|
+
export declare const declarePlacements: (method: string, names: readonly string[], exposure: Readonly<Record<string, FieldExposure>> | undefined, request: RequestPlacements<string>) => readonly Placement[];
|
|
52
|
+
/**
|
|
53
|
+
* Give a bound account `headers()` and `url()`, rendering the placements the host granted with the
|
|
54
|
+
* fields app code holds. They are not enumerable, so the account's JSON is unchanged.
|
|
55
|
+
*/
|
|
56
|
+
export declare const withPlacements: <Account extends {
|
|
57
|
+
readonly method: string;
|
|
58
|
+
readonly fields: unknown;
|
|
59
|
+
}>(account: Account, placements: readonly Placement[] | undefined) => Account & AccountRequest;
|
|
60
|
+
export {};
|
|
@@ -13,6 +13,9 @@ interface ProtocolOperation {
|
|
|
13
13
|
readonly annotations?: ToolAnnotations | undefined;
|
|
14
14
|
readonly _meta?: JsonObject | undefined;
|
|
15
15
|
readonly input: Schema.Decoder<JsonValue>;
|
|
16
|
+
/** Checks and describes every returned value. */
|
|
17
|
+
readonly output?: Schema.Decoder<JsonValue> | undefined;
|
|
18
|
+
/** Describes the returned value without checking it; ignored when `output` is declared. */
|
|
16
19
|
readonly outputSchema?: JsonObject | undefined;
|
|
17
20
|
readonly run: (context: OperationContext, input: JsonValue) => Effect.Effect<unknown, unknown>;
|
|
18
21
|
}
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import { Option } from "effect";
|
|
2
|
+
import type { FailurePhase, UpstreamError } from "../contracts/failure.js";
|
|
2
3
|
import { ProviderError } from "../contracts/provider-error.js";
|
|
4
|
+
import { AccountId } from "../contracts/schema.js";
|
|
5
|
+
/** A provider failure's fields, each optional one possibly absent. */
|
|
6
|
+
interface ProviderErrorFields {
|
|
7
|
+
readonly reason: ProviderError["reason"];
|
|
8
|
+
readonly status?: number | undefined;
|
|
9
|
+
readonly accountId?: AccountId | undefined;
|
|
10
|
+
readonly phase?: FailurePhase | undefined;
|
|
11
|
+
readonly upstream?: UpstreamError | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Construct a provider failure without keys for absent fields. Failures inside a catalog cross the
|
|
15
|
+
* boundary as JSON values, which have no `undefined`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const providerError: ({ reason, status, accountId, phase, upstream, }: ProviderErrorFields) => ProviderError;
|
|
3
18
|
/** Parse and rebuild the allowlisted fields, including when the input is already an Error instance. */
|
|
4
19
|
export declare function parseProviderError(error: unknown): Option.Option<ProviderError>;
|
|
5
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The same failure with detail its raiser could not know: the phase it happened in, and the
|
|
22
|
+
* error the service stated. Detail the failure already carries is kept.
|
|
23
|
+
*/
|
|
24
|
+
export declare function providerErrorDetail(error: ProviderError, detail: {
|
|
25
|
+
readonly phase?: FailurePhase;
|
|
26
|
+
readonly upstream?: UpstreamError | undefined;
|
|
27
|
+
}): ProviderError;
|
|
28
|
+
/**
|
|
29
|
+
* Classify only explicit HTTP evidence. Raw provider content never enters the error; a Bearer
|
|
30
|
+
* challenge's documented error code and description do.
|
|
31
|
+
*/
|
|
6
32
|
export declare function httpProviderError(status: number, headers?: Readonly<Record<string, string>>): ProviderError | undefined;
|
|
7
33
|
/** Attach the account used by the enclosing operation, without preserving arbitrary thrown fields. */
|
|
8
34
|
export declare function accountProviderError<E>(error: E, accountId: string): E | ProviderError;
|
|
9
35
|
/** GraphQL has no standard auth code; recognize these documented codes without guessing from prose. */
|
|
10
36
|
export declare function graphqlProviderError(errors: readonly unknown[], status: number): ProviderError | undefined;
|
|
37
|
+
export {};
|
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
/** Pure constructors over the native provider contracts. */
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
import { type PromiseMethod } from "./authoring.js";
|
|
4
|
-
import { type AccountCheck, type AuthMethods, OAuth2Config, OAuth2Method, Provider, SecretsMethod } from "../contracts/provider.js";
|
|
5
|
-
import type {
|
|
4
|
+
import { type AccountCheck, type AuthMethods, type FieldExposure, OAuth2Config, OAuth2Method, Provider, SecretsMethod } from "../contracts/provider.js";
|
|
5
|
+
import type { Placement } from "../contracts/placement.js";
|
|
6
|
+
import type { DeclarationInvalid } from "../contracts/schema.js";
|
|
6
7
|
/** Declare a secrets method with an Effect decoder. */
|
|
7
8
|
export declare const secrets: <Fields extends Schema.Decoder<unknown>>(options: {
|
|
8
9
|
readonly label: string;
|
|
9
10
|
readonly fields: Fields;
|
|
11
|
+
readonly exposure?: Readonly<Record<string, FieldExposure>>;
|
|
12
|
+
readonly request?: readonly Placement[];
|
|
10
13
|
}) => SecretsMethod<Fields>;
|
|
11
14
|
/** Validate OAuth endpoints while declaring their app-visible response projection. */
|
|
12
|
-
export declare const oauth2: <Response extends Schema.Decoder<unknown>>(config: OAuth2Config, response: Response) => Effect.Effect<OAuth2Method<Response>,
|
|
15
|
+
export declare const oauth2: <Response extends Schema.Decoder<unknown>>(config: OAuth2Config, response: Response, exposure?: Readonly<Record<string, FieldExposure>>, request?: readonly Placement[]) => Effect.Effect<OAuth2Method<Response>, DeclarationInvalid>;
|
|
13
16
|
/** Author options: the account check is an ordinary async function. */
|
|
14
17
|
export interface ProviderOptions<Auth extends AuthMethods> {
|
|
15
18
|
readonly name: string;
|
|
16
19
|
readonly auth: Auth;
|
|
20
|
+
/**
|
|
21
|
+
* Hosts the credentials may be sent to: `api.example.com`, `api.example.com:8443`, or
|
|
22
|
+
* `*.example.com` for one level of subdomain. Secret fields then reach app code as handles
|
|
23
|
+
* that the outbound network replaces only on requests to these hosts. An account records the
|
|
24
|
+
* hosts it was connected for; changing them does not change the provider, but an existing
|
|
25
|
+
* account sends only to hosts it was connected for until it is connected again.
|
|
26
|
+
*/
|
|
27
|
+
readonly hosts?: readonly string[];
|
|
17
28
|
/** Verify a connected account with a safe read, optionally reporting its upstream identity. */
|
|
18
29
|
readonly health?: PromiseMethod<AccountCheck<Auth>["run"]>;
|
|
19
30
|
}
|
|
20
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Retain the provider and literal method names without registering or authenticating it. A
|
|
33
|
+
* method's `request` restricts where its credentials go only among the provider's `hosts`, so a
|
|
34
|
+
* provider that declares a `request` declares `hosts` too.
|
|
35
|
+
*/
|
|
21
36
|
export declare const defineProvider: <const Auth extends AuthMethods>({ health, ...options }: ProviderOptions<Auth>) => Provider<Auth>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncResult } from "effect/
|
|
1
|
+
import { AsyncResult } from "effect/reactivity";
|
|
2
2
|
/** Per-result metadata follows the exact Atom registry snapshot, including concurrent mounts. */
|
|
3
3
|
export interface ObservedQueryValue<A> {
|
|
4
4
|
readonly value: A;
|