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

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,35 @@ 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
1257
+ * multipart/form-data, files included; the form's own enctype and method
1258
+ * attributes are not used. Supply options.onStream to receive the response
1259
+ * chunk by chunk. An error response throws a SkapiError either way; reading
1260
+ * the status code or a response header needs options.responseType
1261
+ * 'response'. options.signal stops the client receiving the response, it
1262
+ * does not cancel the request already sent to the destination.
1263
+ *
1264
+ * @param form Form element, submit event, FormData, or a plain object. Sent to the destination verbatim.
1265
+ * @param options Destination url, method, headers, and an optional onStream callback.
1266
+ * @returns A promise that resolves to the destination's response.
1267
+ */
1268
+ forwardRequest(form: any, options: {
1269
+ url: string;
1270
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
1271
+ headers?: {
1272
+ [key: string]: string;
1273
+ };
1274
+ apiKeyHeader?: string;
1275
+ apiKeyScheme?: string;
1276
+ onStream?: (chunk: string) => void;
1277
+ signal?: AbortSignal;
1278
+ responseType?: 'json' | 'text' | 'response';
1279
+ }): Promise<any>;
1251
1280
  /**
1252
1281
  * Returns a normalized response object for form-based handler flows.
1253
1282
  * @returns A promise that resolves to Promise<any>.
package/dist/skapi.d.ts CHANGED
@@ -1248,6 +1248,35 @@ 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
1257
+ * multipart/form-data, files included; the form's own enctype and method
1258
+ * attributes are not used. Supply options.onStream to receive the response
1259
+ * chunk by chunk. An error response throws a SkapiError either way; reading
1260
+ * the status code or a response header needs options.responseType
1261
+ * 'response'. options.signal stops the client receiving the response, it
1262
+ * does not cancel the request already sent to the destination.
1263
+ *
1264
+ * @param form Form element, submit event, FormData, or a plain object. Sent to the destination verbatim.
1265
+ * @param options Destination url, method, headers, and an optional onStream callback.
1266
+ * @returns A promise that resolves to the destination's response.
1267
+ */
1268
+ forwardRequest(form: any, options: {
1269
+ url: string;
1270
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
1271
+ headers?: {
1272
+ [key: string]: string;
1273
+ };
1274
+ apiKeyHeader?: string;
1275
+ apiKeyScheme?: string;
1276
+ onStream?: (chunk: string) => void;
1277
+ signal?: AbortSignal;
1278
+ responseType?: 'json' | 'text' | 'response';
1279
+ }): Promise<any>;
1251
1280
  /**
1252
1281
  * Returns a normalized response object for form-based handler flows.
1253
1282
  * @returns A promise that resolves to Promise<any>.