skapi-js 2.0.0-rc.2 → 2.0.0-rc.3

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/dist/skapi.d.mts CHANGED
@@ -1248,6 +1248,31 @@ declare class Skapi {
1248
1248
  statusCode: number;
1249
1249
  url: string;
1250
1250
  }>(params: Params[] | Form<Params>, url?: string): Promise<Response | Response[]>;
1251
+ /**
1252
+ * Relays a request to a destination of your choosing from the server side,
1253
+ * with the service api key added where the browser cannot read it, and
1254
+ * streams the destination's response back as it arrives.
1255
+ *
1256
+ * The body is relayed verbatim, so an html form reaches the destination as the
1257
+ * same multipart or urlencoded payload the browser would have sent, files
1258
+ * included. Supply options.onStream to receive the response chunk by chunk.
1259
+ *
1260
+ * @param form Form element, submit event, FormData, or a plain object. Sent to the destination verbatim.
1261
+ * @param options Destination url, method, headers, and an optional onStream callback.
1262
+ * @returns A promise that resolves to the destination's response.
1263
+ */
1264
+ forwardRequest(form: any, options: {
1265
+ url: string;
1266
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
1267
+ headers?: {
1268
+ [key: string]: string;
1269
+ };
1270
+ apiKeyHeader?: string;
1271
+ apiKeyScheme?: string;
1272
+ onStream?: (chunk: string) => void;
1273
+ signal?: AbortSignal;
1274
+ responseType?: 'json' | 'text' | 'response';
1275
+ }): Promise<any>;
1251
1276
  /**
1252
1277
  * Returns a normalized response object for form-based handler flows.
1253
1278
  * @returns A promise that resolves to Promise<any>.
package/dist/skapi.d.ts CHANGED
@@ -1248,6 +1248,31 @@ declare class Skapi {
1248
1248
  statusCode: number;
1249
1249
  url: string;
1250
1250
  }>(params: Params[] | Form<Params>, url?: string): Promise<Response | Response[]>;
1251
+ /**
1252
+ * Relays a request to a destination of your choosing from the server side,
1253
+ * with the service api key added where the browser cannot read it, and
1254
+ * streams the destination's response back as it arrives.
1255
+ *
1256
+ * The body is relayed verbatim, so an html form reaches the destination as the
1257
+ * same multipart or urlencoded payload the browser would have sent, files
1258
+ * included. Supply options.onStream to receive the response chunk by chunk.
1259
+ *
1260
+ * @param form Form element, submit event, FormData, or a plain object. Sent to the destination verbatim.
1261
+ * @param options Destination url, method, headers, and an optional onStream callback.
1262
+ * @returns A promise that resolves to the destination's response.
1263
+ */
1264
+ forwardRequest(form: any, options: {
1265
+ url: string;
1266
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
1267
+ headers?: {
1268
+ [key: string]: string;
1269
+ };
1270
+ apiKeyHeader?: string;
1271
+ apiKeyScheme?: string;
1272
+ onStream?: (chunk: string) => void;
1273
+ signal?: AbortSignal;
1274
+ responseType?: 'json' | 'text' | 'response';
1275
+ }): Promise<any>;
1251
1276
  /**
1252
1277
  * Returns a normalized response object for form-based handler flows.
1253
1278
  * @returns A promise that resolves to Promise<any>.