airbrowser-client 1.12.0 → 1.13.1

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.
@@ -1 +1 @@
1
- 7.19.0-SNAPSHOT
1
+ 7.21.0-SNAPSHOT
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## airbrowser-client@1.12.0
1
+ ## airbrowser-client@1.13.1
2
2
 
3
3
  This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
4
4
 
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
36
36
  _published:_
37
37
 
38
38
  ```
39
- npm install airbrowser-client@1.12.0 --save
39
+ npm install airbrowser-client@1.13.1 --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_
package/api.ts CHANGED
@@ -18,7 +18,7 @@ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
18
18
  import globalAxios from 'axios';
19
19
  // Some imports not used depending on template conditions
20
20
  // @ts-ignore
21
- import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
21
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, replaceWithSerializableTypeIfNeeded } from './common';
22
22
  import type { RequestArgs } from './base';
23
23
  // @ts-ignore
24
24
  import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
@@ -54,7 +54,7 @@ export const BrowsersRequestActionEnum = {
54
54
  CloseAll: 'close_all',
55
55
  Kill: 'kill',
56
56
  KillAll: 'kill_all',
57
- Restore: 'restore'
57
+ Restore: 'restore',
58
58
  } as const;
59
59
 
60
60
  export type BrowsersRequestActionEnum = typeof BrowsersRequestActionEnum[keyof typeof BrowsersRequestActionEnum];
@@ -92,7 +92,7 @@ export const ConsoleLogsRequestActionEnum = {
92
92
  Get: 'get',
93
93
  Clear: 'clear',
94
94
  Enable: 'enable',
95
- Disable: 'disable'
95
+ Disable: 'disable',
96
96
  } as const;
97
97
 
98
98
  export type ConsoleLogsRequestActionEnum = typeof ConsoleLogsRequestActionEnum[keyof typeof ConsoleLogsRequestActionEnum];
@@ -120,7 +120,7 @@ export const CookiesRequestActionEnum = {
120
120
  Get: 'get',
121
121
  Set: 'set',
122
122
  Delete: 'delete',
123
- Clear: 'clear'
123
+ Clear: 'clear',
124
124
  } as const;
125
125
 
126
126
  export type CookiesRequestActionEnum = typeof CookiesRequestActionEnum[keyof typeof CookiesRequestActionEnum];
@@ -201,7 +201,7 @@ export interface DialogRequest {
201
201
  export const DialogRequestActionEnum = {
202
202
  Get: 'get',
203
203
  Accept: 'accept',
204
- Dismiss: 'dismiss'
204
+ Dismiss: 'dismiss',
205
205
  } as const;
206
206
 
207
207
  export type DialogRequestActionEnum = typeof DialogRequestActionEnum[keyof typeof DialogRequestActionEnum];
@@ -240,7 +240,7 @@ export interface EmulateRequest {
240
240
  export const EmulateRequestActionEnum = {
241
241
  Set: 'set',
242
242
  Clear: 'clear',
243
- ListDevices: 'list_devices'
243
+ ListDevices: 'list_devices',
244
244
  } as const;
245
245
 
246
246
  export type EmulateRequestActionEnum = typeof EmulateRequestActionEnum[keyof typeof EmulateRequestActionEnum];
@@ -407,7 +407,7 @@ export interface HistoryRequest {
407
407
  export const HistoryRequestActionEnum = {
408
408
  Back: 'back',
409
409
  Forward: 'forward',
410
- Refresh: 'refresh'
410
+ Refresh: 'refresh',
411
411
  } as const;
412
412
 
413
413
  export type HistoryRequestActionEnum = typeof HistoryRequestActionEnum[keyof typeof HistoryRequestActionEnum];
@@ -437,7 +437,7 @@ export interface MouseRequest {
437
437
 
438
438
  export const MouseRequestActionEnum = {
439
439
  Hover: 'hover',
440
- Drag: 'drag'
440
+ Drag: 'drag',
441
441
  } as const;
442
442
 
443
443
  export type MouseRequestActionEnum = typeof MouseRequestActionEnum[keyof typeof MouseRequestActionEnum];
@@ -467,7 +467,7 @@ export const NetworkLogsRequestActionEnum = {
467
467
  Get: 'get',
468
468
  Clear: 'clear',
469
469
  Enable: 'enable',
470
- Disable: 'disable'
470
+ Disable: 'disable',
471
471
  } as const;
472
472
 
473
473
  export type NetworkLogsRequestActionEnum = typeof NetworkLogsRequestActionEnum[keyof typeof NetworkLogsRequestActionEnum];
@@ -487,7 +487,7 @@ export const PerformanceRequestActionEnum = {
487
487
  StartTrace: 'start_trace',
488
488
  StopTrace: 'stop_trace',
489
489
  Metrics: 'metrics',
490
- Analyze: 'analyze'
490
+ Analyze: 'analyze',
491
491
  } as const;
492
492
 
493
493
  export type PerformanceRequestActionEnum = typeof PerformanceRequestActionEnum[keyof typeof PerformanceRequestActionEnum];
@@ -663,7 +663,7 @@ export interface SelectRequest {
663
663
 
664
664
  export const SelectRequestActionEnum = {
665
665
  Select: 'select',
666
- Options: 'options'
666
+ Options: 'options',
667
667
  } as const;
668
668
 
669
669
  export type SelectRequestActionEnum = typeof SelectRequestActionEnum[keyof typeof SelectRequestActionEnum];
@@ -698,7 +698,7 @@ export const TabsRequestActionEnum = {
698
698
  New: 'new',
699
699
  Switch: 'switch',
700
700
  Close: 'close',
701
- Current: 'current'
701
+ Current: 'current',
702
702
  } as const;
703
703
 
704
704
  export type TabsRequestActionEnum = typeof TabsRequestActionEnum[keyof typeof TabsRequestActionEnum];
@@ -762,7 +762,7 @@ export interface WaitElementRequest {
762
762
 
763
763
  export const WaitElementRequestUntilEnum = {
764
764
  Visible: 'visible',
765
- Hidden: 'hidden'
765
+ Hidden: 'hidden',
766
766
  } as const;
767
767
 
768
768
  export type WaitElementRequestUntilEnum = typeof WaitElementRequestUntilEnum[keyof typeof WaitElementRequestUntilEnum];
package/common.ts CHANGED
@@ -66,7 +66,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope
66
66
  function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
67
67
  if (parameter == null) return;
68
68
  if (typeof parameter === "object") {
69
- if (Array.isArray(parameter)) {
69
+ if (Array.isArray(parameter) || parameter instanceof Set) {
70
70
  (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
71
71
  }
72
72
  else {
@@ -91,13 +91,27 @@ export const setSearchParams = function (url: URL, ...objects: any[]) {
91
91
  url.search = searchParams.toString();
92
92
  }
93
93
 
94
+ /**
95
+ * JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96
+ * This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97
+ * Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98
+ */
99
+ // @ts-ignore
100
+ export const replaceWithSerializableTypeIfNeeded = function(key: string, value: any) {
101
+ if (value instanceof Set) {
102
+ return Array.from(value);
103
+ } else {
104
+ return value;
105
+ }
106
+ }
107
+
94
108
  export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
95
109
  const nonString = typeof value !== 'string';
96
110
  const needsSerialization = nonString && configuration && configuration.isJsonMime
97
111
  ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
98
112
  : nonString;
99
113
  return needsSerialization
100
- ? JSON.stringify(value !== undefined ? value : {})
114
+ ? JSON.stringify(value !== undefined ? value : {}, replaceWithSerializableTypeIfNeeded)
101
115
  : (value || "");
102
116
  }
103
117
 
package/dist/api.js CHANGED
@@ -35,65 +35,65 @@ exports.BrowsersRequestActionEnum = {
35
35
  CloseAll: 'close_all',
36
36
  Kill: 'kill',
37
37
  KillAll: 'kill_all',
38
- Restore: 'restore'
38
+ Restore: 'restore',
39
39
  };
40
40
  exports.ConsoleLogsRequestActionEnum = {
41
41
  Get: 'get',
42
42
  Clear: 'clear',
43
43
  Enable: 'enable',
44
- Disable: 'disable'
44
+ Disable: 'disable',
45
45
  };
46
46
  exports.CookiesRequestActionEnum = {
47
47
  Get: 'get',
48
48
  Set: 'set',
49
49
  Delete: 'delete',
50
- Clear: 'clear'
50
+ Clear: 'clear',
51
51
  };
52
52
  exports.DialogRequestActionEnum = {
53
53
  Get: 'get',
54
54
  Accept: 'accept',
55
- Dismiss: 'dismiss'
55
+ Dismiss: 'dismiss',
56
56
  };
57
57
  exports.EmulateRequestActionEnum = {
58
58
  Set: 'set',
59
59
  Clear: 'clear',
60
- ListDevices: 'list_devices'
60
+ ListDevices: 'list_devices',
61
61
  };
62
62
  exports.HistoryRequestActionEnum = {
63
63
  Back: 'back',
64
64
  Forward: 'forward',
65
- Refresh: 'refresh'
65
+ Refresh: 'refresh',
66
66
  };
67
67
  exports.MouseRequestActionEnum = {
68
68
  Hover: 'hover',
69
- Drag: 'drag'
69
+ Drag: 'drag',
70
70
  };
71
71
  exports.NetworkLogsRequestActionEnum = {
72
72
  Get: 'get',
73
73
  Clear: 'clear',
74
74
  Enable: 'enable',
75
- Disable: 'disable'
75
+ Disable: 'disable',
76
76
  };
77
77
  exports.PerformanceRequestActionEnum = {
78
78
  StartTrace: 'start_trace',
79
79
  StopTrace: 'stop_trace',
80
80
  Metrics: 'metrics',
81
- Analyze: 'analyze'
81
+ Analyze: 'analyze',
82
82
  };
83
83
  exports.SelectRequestActionEnum = {
84
84
  Select: 'select',
85
- Options: 'options'
85
+ Options: 'options',
86
86
  };
87
87
  exports.TabsRequestActionEnum = {
88
88
  List: 'list',
89
89
  New: 'new',
90
90
  Switch: 'switch',
91
91
  Close: 'close',
92
- Current: 'current'
92
+ Current: 'current',
93
93
  };
94
94
  exports.WaitElementRequestUntilEnum = {
95
95
  Visible: 'visible',
96
- Hidden: 'hidden'
96
+ Hidden: 'hidden',
97
97
  };
98
98
  /**
99
99
  * BrowserApi - axios parameter creator
package/dist/common.d.ts CHANGED
@@ -23,6 +23,12 @@ export declare const setBasicAuthToObject: (object: any, configuration?: Configu
23
23
  export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
24
24
  export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
25
25
  export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
26
+ /**
27
+ * JSON serialization helper function which replaces instances of unserializable types with serializable ones.
28
+ * This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
29
+ * Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
30
+ */
31
+ export declare const replaceWithSerializableTypeIfNeeded: (key: string, value: any) => any;
26
32
  export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
27
33
  export declare const toPathString: (url: URL) => string;
28
34
  export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
package/dist/common.js CHANGED
@@ -22,7 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  });
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
25
+ exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.replaceWithSerializableTypeIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
26
26
  const base_1 = require("./base");
27
27
  exports.DUMMY_BASE_URL = 'https://example.com';
28
28
  /**
@@ -78,7 +78,7 @@ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
78
78
  if (parameter == null)
79
79
  return;
80
80
  if (typeof parameter === "object") {
81
- if (Array.isArray(parameter)) {
81
+ if (Array.isArray(parameter) || parameter instanceof Set) {
82
82
  parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
83
83
  }
84
84
  else {
@@ -100,13 +100,28 @@ const setSearchParams = function (url, ...objects) {
100
100
  url.search = searchParams.toString();
101
101
  };
102
102
  exports.setSearchParams = setSearchParams;
103
+ /**
104
+ * JSON serialization helper function which replaces instances of unserializable types with serializable ones.
105
+ * This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
106
+ * Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
107
+ */
108
+ // @ts-ignore
109
+ const replaceWithSerializableTypeIfNeeded = function (key, value) {
110
+ if (value instanceof Set) {
111
+ return Array.from(value);
112
+ }
113
+ else {
114
+ return value;
115
+ }
116
+ };
117
+ exports.replaceWithSerializableTypeIfNeeded = replaceWithSerializableTypeIfNeeded;
103
118
  const serializeDataIfNeeded = function (value, requestOptions, configuration) {
104
119
  const nonString = typeof value !== 'string';
105
120
  const needsSerialization = nonString && configuration && configuration.isJsonMime
106
121
  ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
107
122
  : nonString;
108
123
  return needsSerialization
109
- ? JSON.stringify(value !== undefined ? value : {})
124
+ ? JSON.stringify(value !== undefined ? value : {}, exports.replaceWithSerializableTypeIfNeeded)
110
125
  : (value || "");
111
126
  };
112
127
  exports.serializeDataIfNeeded = serializeDataIfNeeded;
package/dist/esm/api.js CHANGED
@@ -32,65 +32,65 @@ export const BrowsersRequestActionEnum = {
32
32
  CloseAll: 'close_all',
33
33
  Kill: 'kill',
34
34
  KillAll: 'kill_all',
35
- Restore: 'restore'
35
+ Restore: 'restore',
36
36
  };
37
37
  export const ConsoleLogsRequestActionEnum = {
38
38
  Get: 'get',
39
39
  Clear: 'clear',
40
40
  Enable: 'enable',
41
- Disable: 'disable'
41
+ Disable: 'disable',
42
42
  };
43
43
  export const CookiesRequestActionEnum = {
44
44
  Get: 'get',
45
45
  Set: 'set',
46
46
  Delete: 'delete',
47
- Clear: 'clear'
47
+ Clear: 'clear',
48
48
  };
49
49
  export const DialogRequestActionEnum = {
50
50
  Get: 'get',
51
51
  Accept: 'accept',
52
- Dismiss: 'dismiss'
52
+ Dismiss: 'dismiss',
53
53
  };
54
54
  export const EmulateRequestActionEnum = {
55
55
  Set: 'set',
56
56
  Clear: 'clear',
57
- ListDevices: 'list_devices'
57
+ ListDevices: 'list_devices',
58
58
  };
59
59
  export const HistoryRequestActionEnum = {
60
60
  Back: 'back',
61
61
  Forward: 'forward',
62
- Refresh: 'refresh'
62
+ Refresh: 'refresh',
63
63
  };
64
64
  export const MouseRequestActionEnum = {
65
65
  Hover: 'hover',
66
- Drag: 'drag'
66
+ Drag: 'drag',
67
67
  };
68
68
  export const NetworkLogsRequestActionEnum = {
69
69
  Get: 'get',
70
70
  Clear: 'clear',
71
71
  Enable: 'enable',
72
- Disable: 'disable'
72
+ Disable: 'disable',
73
73
  };
74
74
  export const PerformanceRequestActionEnum = {
75
75
  StartTrace: 'start_trace',
76
76
  StopTrace: 'stop_trace',
77
77
  Metrics: 'metrics',
78
- Analyze: 'analyze'
78
+ Analyze: 'analyze',
79
79
  };
80
80
  export const SelectRequestActionEnum = {
81
81
  Select: 'select',
82
- Options: 'options'
82
+ Options: 'options',
83
83
  };
84
84
  export const TabsRequestActionEnum = {
85
85
  List: 'list',
86
86
  New: 'new',
87
87
  Switch: 'switch',
88
88
  Close: 'close',
89
- Current: 'current'
89
+ Current: 'current',
90
90
  };
91
91
  export const WaitElementRequestUntilEnum = {
92
92
  Visible: 'visible',
93
- Hidden: 'hidden'
93
+ Hidden: 'hidden',
94
94
  };
95
95
  /**
96
96
  * BrowserApi - axios parameter creator
@@ -23,6 +23,12 @@ export declare const setBasicAuthToObject: (object: any, configuration?: Configu
23
23
  export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
24
24
  export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
25
25
  export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
26
+ /**
27
+ * JSON serialization helper function which replaces instances of unserializable types with serializable ones.
28
+ * This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
29
+ * Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
30
+ */
31
+ export declare const replaceWithSerializableTypeIfNeeded: (key: string, value: any) => any;
26
32
  export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
27
33
  export declare const toPathString: (url: URL) => string;
28
34
  export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
@@ -70,7 +70,7 @@ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
70
70
  if (parameter == null)
71
71
  return;
72
72
  if (typeof parameter === "object") {
73
- if (Array.isArray(parameter)) {
73
+ if (Array.isArray(parameter) || parameter instanceof Set) {
74
74
  parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
75
75
  }
76
76
  else {
@@ -91,13 +91,27 @@ export const setSearchParams = function (url, ...objects) {
91
91
  setFlattenedQueryParams(searchParams, objects);
92
92
  url.search = searchParams.toString();
93
93
  };
94
+ /**
95
+ * JSON serialization helper function which replaces instances of unserializable types with serializable ones.
96
+ * This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
97
+ * Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
98
+ */
99
+ // @ts-ignore
100
+ export const replaceWithSerializableTypeIfNeeded = function (key, value) {
101
+ if (value instanceof Set) {
102
+ return Array.from(value);
103
+ }
104
+ else {
105
+ return value;
106
+ }
107
+ };
94
108
  export const serializeDataIfNeeded = function (value, requestOptions, configuration) {
95
109
  const nonString = typeof value !== 'string';
96
110
  const needsSerialization = nonString && configuration && configuration.isJsonMime
97
111
  ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
98
112
  : nonString;
99
113
  return needsSerialization
100
- ? JSON.stringify(value !== undefined ? value : {})
114
+ ? JSON.stringify(value !== undefined ? value : {}, replaceWithSerializableTypeIfNeeded)
101
115
  : (value || "");
102
116
  };
103
117
  export const toPathString = function (url) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airbrowser-client",
3
- "version": "1.12.0",
3
+ "version": "1.13.1",
4
4
  "description": "OpenAPI client for airbrowser-client",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "prepare": "npm run build"
25
25
  },
26
26
  "dependencies": {
27
- "axios": "^1.6.1"
27
+ "axios": "^1.13.5"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "12.11.5 - 12.20.42",