apps 0.0.1-beta.13 → 0.0.1-beta.14
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-OD3KFKZD.js +1617 -0
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/openapi.js +3278 -1084
- package/package.json +1 -1
- package/runtime.json +1 -1
- 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
|
@@ -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>;
|