specli 0.0.36 → 0.0.37

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.
@@ -16,6 +16,8 @@ export type ExecuteInput = {
16
16
  bodyFlagDefs?: BodyFlagDef[];
17
17
  /** Resource name for error messages (e.g. "plans") */
18
18
  resourceName?: string;
19
+ /** Custom fetch implementation */
20
+ fetch?: typeof fetch;
19
21
  };
20
22
  /**
21
23
  * Build a prepared request without executing it.
@@ -81,7 +81,8 @@ export async function execute(input) {
81
81
  return result;
82
82
  }
83
83
  // Execute the request
84
- const res = await fetch(request);
84
+ const fetchFn = input.fetch ?? fetch;
85
+ const res = await fetchFn(request);
85
86
  const durationMs = Date.now() - startTime;
86
87
  const contentType = res.headers.get("content-type") ?? "";
87
88
  const rawBody = await res.text();
@@ -22,6 +22,8 @@ export type SpecliOptions = {
22
22
  };
23
23
  /** Auth scheme to use (if multiple are available) */
24
24
  authScheme?: string;
25
+ /** Custom fetch implementation */
26
+ fetch?: typeof fetch;
25
27
  };
26
28
  export type ResourceInfo = {
27
29
  name: string;
@@ -11,7 +11,7 @@ function findAction(ctx, resource, action) {
11
11
  * Create a specli client for interacting with an OpenAPI spec.
12
12
  */
13
13
  export async function createClient(options) {
14
- const { spec, server, serverVars, bearerToken, apiKey, basicAuth, authScheme, } = options;
14
+ const { spec, server, serverVars, bearerToken, apiKey, basicAuth, authScheme, fetch: customFetch, } = options;
15
15
  const ctx = await buildRuntimeContext({ spec });
16
16
  const globals = {
17
17
  server,
@@ -78,6 +78,7 @@ export async function createClient(options) {
78
78
  globals,
79
79
  servers: ctx.servers,
80
80
  authSchemes: ctx.authSchemes,
81
+ fetch: customFetch,
81
82
  });
82
83
  // Add context to the result
83
84
  result.resource = resource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specli",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "Run any OpenAPI spec as an Agent optimized executable",
5
5
  "repository": {
6
6
  "type": "git",