apps 0.0.1-beta.13 → 0.0.1-beta.15
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/framework-reference.json +1 -1
- package/js/{chunk-QS6CAHKC.js → chunk-4J3IQXFD.js} +2 -2
- package/js/{chunk-6HSH75OI.js → chunk-CL3O2NIN.js} +203 -13
- package/js/{chunk-G4FT53I7.js → chunk-GKHJITGG.js} +2 -2
- package/js/{chunk-S73JGVR5.js → chunk-H34RQANV.js} +2 -2
- package/js/{chunk-4DWF4ZWI.js → chunk-JAKBOQ5T.js} +4 -4
- package/js/{chunk-4ASNKGCV.js → chunk-O5G3NDEO.js} +2 -2
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-YPKG2QO5.js → chunk-SWXGYMUW.js} +1 -1
- package/js/{chunk-TG6DOCRO.js → chunk-YHLXXXKH.js} +3 -3
- package/js/contracts.js +3 -1
- package/js/effect.js +5 -5
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +6 -6
- package/js/host.js +5 -5
- package/js/index.js +3 -3
- package/js/mcp/effect.js +7 -7
- package/js/mcp/stdio.js +7 -7
- package/js/mcp.js +8 -8
- package/js/openapi.js +3282 -1088
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/host.d.ts +5 -4
- package/types/apps/src/contracts/protocol-version.d.ts +1 -1
- package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
- package/types/apps/src/contracts/provider.d.ts +6 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +5 -2
- package/types/apps/src/implementation/openapi-document.d.ts +15 -2
- package/types/apps/src/implementation/openapi-request.d.ts +8 -1
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** OAuth declarations frozen for host protocols 1 through 5. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** How an OAuth client authenticates at the token endpoint; raw Basic is an explicit provider compatibility option. */
|
|
4
|
+
export declare const OAuthClientAuth: Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
5
|
+
export type OAuthClientAuth = typeof OAuthClientAuth.Type;
|
|
6
|
+
/** Machine clients always authenticate; public clients cannot use the client-credentials grant. */
|
|
7
|
+
export declare const OAuthSecretClientAuth: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
8
|
+
/** Parameters the host sets on every authorization request; a declaration cannot replace them. */
|
|
9
|
+
export declare const reservedAuthorizationParams: readonly ["response_type", "client_id", "redirect_uri", "state", "scope", "code_challenge", "code_challenge_method", "nonce", "resource", "request", "request_uri"];
|
|
10
|
+
/** A protocol parameter only the host sets on the authorization request. */
|
|
11
|
+
export type ReservedAuthorizationParam = (typeof reservedAuthorizationParams)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Extra authorization request parameters, such as `access_type: "offline"`. RFC 6749 §3.1
|
|
14
|
+
* lets services define their own; the protocol and security parameters stay host-owned.
|
|
15
|
+
*/
|
|
16
|
+
export declare const OAuthAuthorizationParams: Schema.$Record<Schema.String, Schema.String>;
|
|
17
|
+
/** How the token endpoint reads requests. RFC 6749 uses a form; some services want JSON. */
|
|
18
|
+
export declare const OAuthTokenRequestFormat: Schema.Literals<readonly ["form", "json"]>;
|
|
19
|
+
export type OAuthTokenRequestFormat = typeof OAuthTokenRequestFormat.Type;
|
|
20
|
+
/**
|
|
21
|
+
* Where a service nests the grant in its token response, as a dot-separated member path. Slack
|
|
22
|
+
* returns a user token under `authed_user`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const OAuthTokenResponse: Schema.Struct<{
|
|
25
|
+
readonly path: Schema.String;
|
|
26
|
+
}>;
|
|
27
|
+
export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
|
|
28
|
+
/**
|
|
29
|
+
* OAuth endpoints and protocol choices. Omitted grant means authorization code; clients remain
|
|
30
|
+
* host-owned. Declared endpoints may name an RFC 7009 `revocationUrl`; discovery reads the
|
|
31
|
+
* server's `revocation_endpoint` metadata instead.
|
|
32
|
+
*/
|
|
33
|
+
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
34
|
+
readonly discover: Schema.String;
|
|
35
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
36
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
37
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
38
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
39
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
40
|
+
readonly path: Schema.String;
|
|
41
|
+
}>>;
|
|
42
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
43
|
+
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
44
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
45
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
46
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
47
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
48
|
+
}>, Schema.Struct<{
|
|
49
|
+
/** Its query is kept; it cannot set protocol parameters or repeat `authorizationParams`. */
|
|
50
|
+
readonly authorizationUrl: Schema.String;
|
|
51
|
+
readonly tokenUrl: Schema.String;
|
|
52
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
53
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
54
|
+
/** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
|
|
55
|
+
readonly issuer: Schema.optionalKey<Schema.String>;
|
|
56
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
57
|
+
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
58
|
+
readonly path: Schema.String;
|
|
59
|
+
}>>;
|
|
60
|
+
readonly grant: Schema.optionalKey<Schema.Literal<"authorization_code">>;
|
|
61
|
+
readonly authorizationParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
62
|
+
readonly tokenEndpointAuthMethod: Schema.optionalKey<Schema.Literals<readonly ["none", "client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>>;
|
|
63
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
64
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
65
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
66
|
+
}>, Schema.Struct<{
|
|
67
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
68
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
69
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
70
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
71
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
72
|
+
readonly discover: Schema.String;
|
|
73
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
74
|
+
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
75
|
+
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
76
|
+
readonly scopes: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
77
|
+
}>, Schema.Struct<{
|
|
78
|
+
readonly tokenEndpointAuthMethod: Schema.Literals<readonly ["client_secret_post", "client_secret_basic", "client_secret_basic_raw"]>;
|
|
79
|
+
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
80
|
+
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
81
|
+
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
82
|
+
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
83
|
+
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
84
|
+
readonly grant: Schema.Literal<"client_credentials">;
|
|
85
|
+
readonly tokenUrl: Schema.String;
|
|
86
|
+
readonly revocationUrl: Schema.optionalKey<Schema.String>;
|
|
87
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
88
|
+
}>]>;
|
|
89
|
+
export type OAuth2Config = typeof OAuth2Config.Type;
|
|
@@ -42,6 +42,8 @@ export type OAuthTokenResponse = typeof OAuthTokenResponse.Type;
|
|
|
42
42
|
*/
|
|
43
43
|
export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
44
44
|
readonly discover: Schema.String;
|
|
45
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
46
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
45
47
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
46
48
|
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
47
49
|
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
@@ -64,6 +66,7 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
|
64
66
|
/** RFC 8414 issuer identifier. Declared issuers are checked against the callback's `iss`. */
|
|
65
67
|
readonly issuer: Schema.optionalKey<Schema.String>;
|
|
66
68
|
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
69
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
67
70
|
readonly tokenResponse: Schema.optionalKey<Schema.Struct<{
|
|
68
71
|
readonly path: Schema.String;
|
|
69
72
|
}>>;
|
|
@@ -80,6 +83,8 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
|
80
83
|
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
81
84
|
readonly grant: Schema.Literal<"client_credentials">;
|
|
82
85
|
readonly discover: Schema.String;
|
|
86
|
+
/** Fetch this exact metadata document and verify its issuer against discovery. */
|
|
87
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.String>;
|
|
83
88
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
84
89
|
readonly tokenUrl: Schema.optionalKey<Schema.Never>;
|
|
85
90
|
readonly revocationUrl: Schema.optionalKey<Schema.Never>;
|
|
@@ -89,6 +94,7 @@ export declare const OAuth2Config: Schema.Union<readonly [Schema.Struct<{
|
|
|
89
94
|
readonly resource: Schema.optionalKey<Schema.NullOr<Schema.String>>;
|
|
90
95
|
readonly authorizationUrl: Schema.optionalKey<Schema.Never>;
|
|
91
96
|
readonly discover: Schema.optionalKey<Schema.Never>;
|
|
97
|
+
readonly authorizationServerMetadataUrl: Schema.optionalKey<Schema.Never>;
|
|
92
98
|
readonly scopeSeparator: Schema.optionalKey<Schema.String>;
|
|
93
99
|
readonly tokenRequestFormat: Schema.optionalKey<Schema.Literals<readonly ["form", "json"]>>;
|
|
94
100
|
readonly grant: Schema.Literal<"client_credentials">;
|
|
@@ -4,8 +4,11 @@ import { JsonObject } from "../contracts/schema.js";
|
|
|
4
4
|
import { OpenapiCompileError as TemplateError } from "../contracts/openapi-compile.js";
|
|
5
5
|
import type { OpenApiImport } from "../contracts/openapi-document.js";
|
|
6
6
|
import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/openapi-document.js";
|
|
7
|
-
/** Compile a revision of a live OpenAPI source into tool declarations for the app runtime.
|
|
8
|
-
|
|
7
|
+
/** Compile a revision of a live OpenAPI source into tool declarations for the app runtime.
|
|
8
|
+
* The document is consumed: compilation upgrades it in place instead of copying it. It must be a
|
|
9
|
+
* tree, with no object reached twice, as parsed JSON is.
|
|
10
|
+
*/
|
|
11
|
+
export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: JsonObject, options?: {
|
|
9
12
|
readonly baseUrl?: string;
|
|
10
13
|
readonly allowedOrigin?: string;
|
|
11
14
|
readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { JsonObject } from "../contracts/schema.js";
|
|
3
|
-
/**
|
|
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
|
+
*/
|
|
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
|
+
/** Resolve OpenAPI objects once; schemas retain their original recursive references.
|
|
4
17
|
* Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer has one dialect and
|
|
5
18
|
* 3.1 keywords that appear in 3.0 documents keep their meaning.
|
|
6
19
|
* Unsupported versions, references and conversions throw TemplateError at the import boundary.
|
|
7
20
|
*/
|
|
8
|
-
export declare function openApiDocument(input:
|
|
21
|
+
export declare function openApiDocument(input: JsonObject): Promise<{
|
|
9
22
|
spec: {
|
|
10
23
|
readonly openapi: string;
|
|
11
24
|
readonly paths: {
|
|
@@ -6,12 +6,19 @@ import { OpenapiError, type CredentialBinding, type OpenapiOperation, type Opena
|
|
|
6
6
|
type DeclaredError = OpenapiErrorResponse & {
|
|
7
7
|
readonly decoder: Schema.Decoder<Schema.Json>;
|
|
8
8
|
};
|
|
9
|
+
/** What decides whether an account can call an operation: its transport and security. */
|
|
10
|
+
export interface OpenapiOperationAccess {
|
|
11
|
+
readonly streaming?: true;
|
|
12
|
+
readonly request: {
|
|
13
|
+
readonly security: OpenapiOperation["request"]["security"];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
9
16
|
/** Create request helpers from credential-free generated authentication metadata. */
|
|
10
17
|
export declare function createRequest(config: {
|
|
11
18
|
readonly methods: Readonly<Record<string, readonly CredentialBinding[]>>;
|
|
12
19
|
readonly oauth: readonly string[];
|
|
13
20
|
}): {
|
|
14
|
-
available: (op:
|
|
21
|
+
available: (op: OpenapiOperationAccess, account: OpenapiAccount | undefined) => boolean;
|
|
15
22
|
call: (op: OpenapiOperation, input: unknown, account: OpenapiAccount | undefined, errors: readonly DeclaredError[]) => Effect.Effect<Schema.Json, ProviderError | OpenapiResponseError | OpenapiError, never>;
|
|
16
23
|
};
|
|
17
24
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Let the runtime run its own tasks between long synchronous steps. In a Worker, a large OpenAPI
|
|
3
|
+
* compilation that never yields leaves the garbage collector only long, full pauses; yielding
|
|
4
|
+
* between steps measurably shortens it. A timer is used because a resolved promise would continue
|
|
5
|
+
* without leaving the current task.
|
|
6
|
+
*/
|
|
7
|
+
export declare const yieldToRuntime: () => Promise<void>;
|