@sonatel-os/openapi-runtime 0.1.0

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.
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Save/register an OpenAPI spec by name.
3
+ * Automatically generates operationIds if missing.
4
+ * @param {{ name: string, specName: string|object, autoAuth?: boolean }} opts
5
+ */
6
+ export function save({ name, specName, autoAuth }: {
7
+ name: string;
8
+ specName: string | object;
9
+ autoAuth?: boolean;
10
+ }): Promise<{
11
+ name: string;
12
+ operations: import("./src/registry.js").OperationInfo[];
13
+ }>;
14
+ /** Update an existing spec by name (re-loads). */
15
+ export function update(opts: any): Promise<{
16
+ name: string;
17
+ operations: import("./src/registry.js").OperationInfo[];
18
+ }>;
19
+ /** Remove a spec from registry. */
20
+ export function remove({ name }: {
21
+ name: any;
22
+ }): void;
23
+ /** List saved spec names. */
24
+ export function listSpecs(): any[];
25
+ /** List APIs (operations) for a spec. */
26
+ export function listAPIs({ name }: {
27
+ name: any;
28
+ }): any;
29
+ /** Return raw OpenAPI operation object. */
30
+ export function showContract({ name, api }: {
31
+ name: any;
32
+ api: any;
33
+ }): any;
34
+ /** Build a response sample from schema. */
35
+ export function showResponseSample({ name, api, status }: {
36
+ name: any;
37
+ api: any;
38
+ status: any;
39
+ }): unknown;
40
+ /** Build a request sample for JSON body. */
41
+ export function showRequestSample({ name, api }: {
42
+ name: any;
43
+ api: any;
44
+ }): unknown;
45
+ /** Execute an API by operationId. */
46
+ export function executeAPI({ name, api, params, body, headers, qs }: {
47
+ name: any;
48
+ api: any;
49
+ params?: {} | undefined;
50
+ body: any;
51
+ headers?: {} | undefined;
52
+ qs?: {} | undefined;
53
+ }): Promise<any>;
54
+ /** Validate a response against the operation schema. */
55
+ export function validateResponse(opts: any): {
56
+ valid: boolean;
57
+ errors?: undefined;
58
+ } | {
59
+ valid: boolean;
60
+ errors: import("ajv").ErrorObject<string, Record<string, any>, unknown>[];
61
+ };
62
+ /** Return a mocked response payload (no network). */
63
+ export function mockAPI({ name, api, status }: {
64
+ name: any;
65
+ api: any;
66
+ status: any;
67
+ }): unknown;
68
+ /** Global headers (applied to all specs) */
69
+ export function setGlobalHeaders(headers: any): void;
70
+ /** Per-spec default headers */
71
+ export function setSpecHeaders(name: any, headers: any): void;
72
+ /** Interceptors: { request?, response?, error? } */
73
+ export function setInterceptors(name: any, interceptors: any): void;
74
+ export { setAuth, apiKey, bearer, basic, clientCredentials } from "./src/auth.js";