@travetto/web-rpc 8.0.0-alpha.18 → 8.0.0-alpha.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/web-rpc",
3
- "version": "8.0.0-alpha.18",
3
+ "version": "8.0.0-alpha.19",
4
4
  "type": "module",
5
5
  "description": "RPC support for a Web Application",
6
6
  "keywords": [
@@ -7,7 +7,7 @@ type PromiseResult<V extends PromiseFn> = Awaited<ReturnType<V>>;
7
7
 
8
8
 
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- const triggerRedirect = (world: any, url: URL): boolean => {
10
+ const triggerBrowserRedirect = (world: any, url: URL): boolean => {
11
11
  const location = world?.window?.location;
12
12
  if (location) {
13
13
  location.href = url.toString();
@@ -63,7 +63,7 @@ export type RpcRequest = {
63
63
  controller: string;
64
64
  endpoint: string;
65
65
  method: string;
66
- redirect?: boolean;
66
+ browserRedirect?: boolean;
67
67
  };
68
68
  url: URL | string;
69
69
  consumeJSON?: <T>(text?: unknown) => (T | Promise<T>);
@@ -109,11 +109,11 @@ function registerTimeout<T>(
109
109
 
110
110
  function buildRequest<T extends RequestInit>(base: T, controller: string, endpoint: string): T {
111
111
  let verb: string;
112
- let redirect = false;
112
+ let browserRedirect = false;
113
113
  switch (endpoint.split(/[A-Z]/)[0]) {
114
114
  case 'redirect': {
115
115
  verb = 'GET';
116
- redirect = true;
116
+ browserRedirect = true;
117
117
  break;
118
118
  }
119
119
  case 'get': verb = 'GET'; break;
@@ -123,7 +123,7 @@ function buildRequest<T extends RequestInit>(base: T, controller: string, endpoi
123
123
  }
124
124
  return {
125
125
  ...base,
126
- redirect,
126
+ browserRedirect,
127
127
  method: verb,
128
128
  path: `${controller}:${endpoint}`,
129
129
  controller,
@@ -254,7 +254,7 @@ export async function invokeFetch<T>(request: RpcRequest, ...params: unknown[]):
254
254
  url.searchParams.append(key, value);
255
255
  }
256
256
 
257
- if (core.redirect && triggerRedirect(globalThis, url)) {
257
+ if (core.browserRedirect && triggerBrowserRedirect(globalThis, url)) {
258
258
  return Promise.resolve(undefined!);
259
259
  }
260
260