@cloud-cli/px 4.1.3 → 4.1.5

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.
@@ -2,7 +2,7 @@ import { ProxyServer } from '@cloud-cli/proxy';
2
2
  import type { DomainAndTarget, DomainName, Proxy, WithOptionalProps } from './types.js';
3
3
  export declare class ProxyManager {
4
4
  server: ProxyServer;
5
- addProxy(proxy: WithOptionalProps<Proxy>): Promise<Proxy>;
5
+ addProxy(properties: WithOptionalProps<Proxy>): Promise<Proxy>;
6
6
  updateProxy(options: WithOptionalProps<Proxy>): Promise<Proxy>;
7
7
  removeProxy(options: WithOptionalProps<DomainAndTarget>): Promise<boolean>;
8
8
  getDomainList(): Promise<string[]>;
@@ -22,7 +22,6 @@ const emptyProxy = {
22
22
  target: '',
23
23
  cors: false,
24
24
  redirect: false,
25
- preserveHost: false,
26
25
  redirectUrl: '',
27
26
  headers: '',
28
27
  authorization: '',
@@ -42,7 +41,7 @@ const readOption = value => {
42
41
  }
43
42
  };
44
43
  function applyProperties(proxy, options) {
45
- const properties = ['target', 'cors', 'redirect', 'redirectUrl', 'headers', 'authorization', 'preserveHost'];
44
+ const properties = ['target', 'cors', 'redirect', 'redirectUrl', 'headers', 'authorization'];
46
45
  properties.forEach((p) => {
47
46
  if (p in options) {
48
47
  proxy[p] = readOption(options[p]);
@@ -53,19 +52,19 @@ export class ProxyManager {
53
52
  constructor() {
54
53
  this.server = px;
55
54
  }
56
- async addProxy(proxy) {
57
- readDomain(proxy);
58
- if (!proxy.domain) {
55
+ async addProxy(properties) {
56
+ readDomain(properties);
57
+ if (!properties.domain) {
59
58
  throw domainNotSpecifiedError;
60
59
  }
61
- if (!proxy.target && !proxy.redirectUrl) {
60
+ if (!properties.target && !properties.redirectUrl) {
62
61
  throw targetNotSpecifiedError;
63
62
  }
64
- const entry = { ...emptyProxy };
65
- applyProperties(entry, proxy);
66
- set(proxy.domain, entry);
63
+ const proxy = { ...emptyProxy, domain: properties.domain };
64
+ applyProperties(proxy, properties);
65
+ set(properties.domain, proxy);
67
66
  await this.reload();
68
- return entry;
67
+ return proxy;
69
68
  }
70
69
  async updateProxy(options) {
71
70
  readDomain(options);
package/dist/types.d.ts CHANGED
@@ -16,7 +16,6 @@ export interface Proxy {
16
16
  headers: string;
17
17
  authorization: string;
18
18
  cors: boolean;
19
- preserveHost: boolean;
20
19
  }
21
20
  export type WithOptionalProps<T extends object> = T & OptionalProps;
22
21
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/px",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
4
4
  "description": "Reverse Proxy",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",