swagger-client 3.33.2 → 3.34.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.
- package/dist/swagger-client.browser.js +45068 -42797
- package/dist/swagger-client.browser.min.js +1 -1
- package/dist/swagger-client.browser.min.js.map +1 -1
- package/es/constants.js +2 -1
- package/es/execute/index.js +68 -20
- package/es/execute/oas3/parameter-builders.js +1 -10
- package/es/execute/oas3/style-serializer.js +1 -2
- package/es/helpers/cookie.js +18 -0
- package/es/resolver/specmap/index.js +1 -1
- package/lib/constants.js +3 -2
- package/lib/execute/index.js +66 -18
- package/lib/execute/oas3/parameter-builders.js +3 -12
- package/lib/execute/oas3/style-serializer.js +1 -2
- package/lib/helpers/cookie.js +24 -0
- package/lib/resolver/specmap/index.js +2 -2
- package/package.json +13 -13
- package/es/helpers/cookie-value-encoder.js +0 -5
- package/lib/helpers/cookie-value-encoder.js +0 -9
package/es/constants.js
CHANGED
package/es/execute/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { identity } from 'ramda';
|
|
1
|
+
import { identity, has } from 'ramda';
|
|
2
2
|
import { isPlainObject, isNonEmptyString } from 'ramda-adjunct';
|
|
3
3
|
import { test as testServerURLTemplate, substitute as substituteServerURLTemplate } from 'openapi-server-url-templating';
|
|
4
|
-
import { serializeCookie, cookieValueLenientEncoder, cookieNameLenientValidator, cookieValueLenientValidator } from '@swaggerexpert/cookie';
|
|
5
4
|
import { ApiDOMStructuredError } from '@swagger-api/apidom-error';
|
|
6
5
|
import { url } from '@swagger-api/apidom-reference/configuration/empty';
|
|
7
|
-
import { DEFAULT_BASE_URL, DEFAULT_OPENAPI_3_SERVER } from '../constants.js';
|
|
6
|
+
import { DEFAULT_BASE_URL, DEFAULT_OPENAPI_3_SERVER, TRAVERSE_LIMIT } from '../constants.js';
|
|
8
7
|
import stockHttp from '../http/index.js';
|
|
9
8
|
import { serializeRequest } from '../http/serializers/request/index.js';
|
|
10
9
|
import SWAGGER2_PARAMETER_BUILDERS from './swagger2/parameter-builders.js';
|
|
@@ -13,7 +12,55 @@ import oas3BuildRequest from './oas3/build-request.js';
|
|
|
13
12
|
import swagger2BuildRequest from './swagger2/build-request.js';
|
|
14
13
|
import { getOperationRaw, idFromPathMethodLegacy } from '../helpers/index.js';
|
|
15
14
|
import { isOpenAPI3 } from '../helpers/openapi-predicates.js';
|
|
15
|
+
import { serialize as serializeCookie } from '../helpers/cookie.js';
|
|
16
16
|
const arrayOrEmpty = ar => Array.isArray(ar) ? ar : [];
|
|
17
|
+
const findObjectSchema = (schema, {
|
|
18
|
+
recurse = true,
|
|
19
|
+
depth = 1
|
|
20
|
+
} = {}) => {
|
|
21
|
+
if (!isPlainObject(schema)) return undefined;
|
|
22
|
+
|
|
23
|
+
// check if the schema is an object type
|
|
24
|
+
if (schema.type === 'object' || Array.isArray(schema.type) && schema.type.includes('object')) {
|
|
25
|
+
return schema;
|
|
26
|
+
}
|
|
27
|
+
if (depth > TRAVERSE_LIMIT) return undefined;
|
|
28
|
+
if (recurse) {
|
|
29
|
+
// traverse oneOf keyword first
|
|
30
|
+
const oneOfResult = Array.isArray(schema.oneOf) ? schema.oneOf.find(subschema => findObjectSchema(subschema, {
|
|
31
|
+
recurse,
|
|
32
|
+
depth: depth + 1
|
|
33
|
+
})) : undefined;
|
|
34
|
+
if (oneOfResult) return oneOfResult;
|
|
35
|
+
|
|
36
|
+
// traverse anyOf keyword second
|
|
37
|
+
const anyOfResult = Array.isArray(schema.anyOf) ? schema.anyOf.find(subschema => findObjectSchema(subschema, {
|
|
38
|
+
recurse,
|
|
39
|
+
depth: depth + 1
|
|
40
|
+
})) : undefined;
|
|
41
|
+
if (anyOfResult) return anyOfResult;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
};
|
|
45
|
+
const parseJsonObject = ({
|
|
46
|
+
value,
|
|
47
|
+
silentFail = false
|
|
48
|
+
}) => {
|
|
49
|
+
try {
|
|
50
|
+
const parsedValue = JSON.parse(value);
|
|
51
|
+
if (typeof parsedValue === 'object') {
|
|
52
|
+
return parsedValue;
|
|
53
|
+
}
|
|
54
|
+
if (!silentFail) {
|
|
55
|
+
throw new Error('Expected JSON serialized object');
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
if (!silentFail) {
|
|
59
|
+
throw new Error('Could not parse object parameter value string as JSON Object');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return value;
|
|
63
|
+
};
|
|
17
64
|
|
|
18
65
|
/**
|
|
19
66
|
* `parseURIReference` function simulates the behavior of `node:url` parse function.
|
|
@@ -105,7 +152,6 @@ export function execute({
|
|
|
105
152
|
|
|
106
153
|
// Build a request, which can be handled by the `http.js` implementation.
|
|
107
154
|
export function buildRequest(options) {
|
|
108
|
-
var _baseURL;
|
|
109
155
|
const {
|
|
110
156
|
spec,
|
|
111
157
|
operationId,
|
|
@@ -167,7 +213,7 @@ export function buildRequest(options) {
|
|
|
167
213
|
method,
|
|
168
214
|
pathName
|
|
169
215
|
} = operationRaw;
|
|
170
|
-
baseURL =
|
|
216
|
+
baseURL = baseURL !== null && baseURL !== void 0 ? baseURL : baseUrl({
|
|
171
217
|
spec,
|
|
172
218
|
scheme,
|
|
173
219
|
contextUrl,
|
|
@@ -227,11 +273,21 @@ export function buildRequest(options) {
|
|
|
227
273
|
if (typeof value === 'undefined' && parameter.required && !parameter.allowEmptyValue) {
|
|
228
274
|
throw new Error(`Required parameter ${parameter.name} is not provided`);
|
|
229
275
|
}
|
|
230
|
-
if (specIsOAS3 &&
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
276
|
+
if (specIsOAS3 && typeof value === 'string') {
|
|
277
|
+
if (has('type', parameter.schema) && findObjectSchema(parameter.schema, {
|
|
278
|
+
recurse: false
|
|
279
|
+
})) {
|
|
280
|
+
value = parseJsonObject({
|
|
281
|
+
value,
|
|
282
|
+
silentFail: false
|
|
283
|
+
});
|
|
284
|
+
} else if (findObjectSchema(parameter.schema, {
|
|
285
|
+
recurse: true
|
|
286
|
+
})) {
|
|
287
|
+
value = parseJsonObject({
|
|
288
|
+
value,
|
|
289
|
+
silentFail: true
|
|
290
|
+
});
|
|
235
291
|
}
|
|
236
292
|
}
|
|
237
293
|
if (builder) {
|
|
@@ -260,16 +316,8 @@ export function buildRequest(options) {
|
|
|
260
316
|
|
|
261
317
|
// If the cookie convenience object exists in our request,
|
|
262
318
|
// serialize its content and then delete the cookie object.
|
|
263
|
-
if (req.cookies && Object.keys(req.cookies).length) {
|
|
264
|
-
const cookieString = serializeCookie(req.cookies
|
|
265
|
-
encoders: {
|
|
266
|
-
value: cookieValueLenientEncoder
|
|
267
|
-
},
|
|
268
|
-
validators: {
|
|
269
|
-
name: cookieNameLenientValidator,
|
|
270
|
-
value: cookieValueLenientValidator
|
|
271
|
-
}
|
|
272
|
-
});
|
|
319
|
+
if (req.cookies && Object.keys(req.cookies).length > 0) {
|
|
320
|
+
const cookieString = serializeCookie(req.cookies);
|
|
273
321
|
if (isNonEmptyString(req.headers.Cookie)) {
|
|
274
322
|
req.headers.Cookie += `; ${cookieString}`;
|
|
275
323
|
} else {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { resolve as resolvePathTemplate } from 'openapi-path-templating';
|
|
2
|
-
import { serializeCookie } from '@swaggerexpert/cookie';
|
|
3
2
|
import stylize, { encodeCharacters } from './style-serializer.js';
|
|
4
3
|
import serialize from './content-serializer.js';
|
|
5
|
-
import
|
|
4
|
+
import { serialize as serializeCookie } from '../../helpers/cookie.js';
|
|
6
5
|
export function path({
|
|
7
6
|
req,
|
|
8
7
|
value,
|
|
@@ -123,10 +122,6 @@ export function cookie({
|
|
|
123
122
|
const cookieValue = serialize(value, effectiveMediaType);
|
|
124
123
|
req.headers.Cookie = serializeCookie({
|
|
125
124
|
[cookieName]: cookieValue
|
|
126
|
-
}, {
|
|
127
|
-
encoders: {
|
|
128
|
-
value: cookieValueEncoder
|
|
129
|
-
}
|
|
130
125
|
});
|
|
131
126
|
return;
|
|
132
127
|
}
|
|
@@ -142,10 +137,6 @@ export function cookie({
|
|
|
142
137
|
const cookieValue = Array.isArray(value) && parameter.explode ? `${cookieName}=${serializedValue}` : serializedValue;
|
|
143
138
|
req.headers.Cookie = serializeCookie({
|
|
144
139
|
[cookieName]: cookieValue
|
|
145
|
-
}, {
|
|
146
|
-
encoders: {
|
|
147
|
-
value: cookieValueEncoder
|
|
148
|
-
}
|
|
149
140
|
});
|
|
150
141
|
}
|
|
151
142
|
}
|
|
@@ -32,7 +32,6 @@ export default function stylize(config) {
|
|
|
32
32
|
return encodePrimitive(config);
|
|
33
33
|
}
|
|
34
34
|
export function valueEncoder(value, escape = false) {
|
|
35
|
-
var _value;
|
|
36
35
|
if (Array.isArray(value) || value !== null && typeof value === 'object') {
|
|
37
36
|
value = JSON.stringify(value);
|
|
38
37
|
} else if (typeof value === 'number' || typeof value === 'boolean') {
|
|
@@ -41,7 +40,7 @@ export function valueEncoder(value, escape = false) {
|
|
|
41
40
|
if (escape && typeof value === 'string' && value.length > 0) {
|
|
42
41
|
return encodeCharacters(value, escape);
|
|
43
42
|
}
|
|
44
|
-
return
|
|
43
|
+
return value !== null && value !== void 0 ? value : '';
|
|
45
44
|
}
|
|
46
45
|
function encodeArray({
|
|
47
46
|
key,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { mergeDeepRight } from 'ramda';
|
|
2
|
+
import { serializeCookie, cookieValueStrictPercentEncoder, cookieNameLenientValidator, cookieValueStrictValidator, identity } from '@swaggerexpert/cookie';
|
|
3
|
+
const eqSignPE = '%3D';
|
|
4
|
+
const ampersandPE = '%26';
|
|
5
|
+
export const valuePercentEncoder = cookieValue => cookieValueStrictPercentEncoder(cookieValue).replace(/[=&]/gu, match => match === '=' ? eqSignPE : ampersandPE);
|
|
6
|
+
export const serialize = (cookiePairs, options = {}) => {
|
|
7
|
+
const defaultOptions = {
|
|
8
|
+
encoders: {
|
|
9
|
+
name: identity,
|
|
10
|
+
value: valuePercentEncoder
|
|
11
|
+
},
|
|
12
|
+
validators: {
|
|
13
|
+
name: cookieNameLenientValidator,
|
|
14
|
+
value: cookieValueStrictValidator
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return serializeCookie(cookiePairs, mergeDeepRight(defaultOptions, options));
|
|
18
|
+
};
|
|
@@ -4,8 +4,8 @@ import allOf from './lib/all-of.js';
|
|
|
4
4
|
import parameters from './lib/parameters.js';
|
|
5
5
|
import properties from './lib/properties.js';
|
|
6
6
|
import ContextTree from './lib/context-tree.js';
|
|
7
|
+
import { TRAVERSE_LIMIT } from '../../constants.js';
|
|
7
8
|
const PLUGIN_DISPATCH_LIMIT = 100;
|
|
8
|
-
const TRAVERSE_LIMIT = 3000;
|
|
9
9
|
const noop = () => {};
|
|
10
10
|
class SpecMap {
|
|
11
11
|
static getPluginName(plugin) {
|
package/lib/constants.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.DEFAULT_OPENAPI_3_SERVER = exports.DEFAULT_BASE_URL = exports.ACCEPT_HEADER_VALUE_FOR_DOCUMENTS = void 0;
|
|
4
|
+
exports.TRAVERSE_LIMIT = exports.DEFAULT_OPENAPI_3_SERVER = exports.DEFAULT_BASE_URL = exports.ACCEPT_HEADER_VALUE_FOR_DOCUMENTS = void 0;
|
|
5
5
|
const ACCEPT_HEADER_VALUE_FOR_DOCUMENTS = exports.ACCEPT_HEADER_VALUE_FOR_DOCUMENTS = 'application/json, application/yaml';
|
|
6
6
|
const DEFAULT_BASE_URL = exports.DEFAULT_BASE_URL = 'https://swagger.io';
|
|
7
7
|
const DEFAULT_OPENAPI_3_SERVER = exports.DEFAULT_OPENAPI_3_SERVER = Object.freeze({
|
|
8
8
|
url: '/'
|
|
9
|
-
});
|
|
9
|
+
});
|
|
10
|
+
const TRAVERSE_LIMIT = exports.TRAVERSE_LIMIT = 3000;
|
package/lib/execute/index.js
CHANGED
|
@@ -10,7 +10,6 @@ exports.self = void 0;
|
|
|
10
10
|
var _ramda = require("ramda");
|
|
11
11
|
var _ramdaAdjunct = require("ramda-adjunct");
|
|
12
12
|
var _openapiServerUrlTemplating = require("openapi-server-url-templating");
|
|
13
|
-
var _cookie = require("@swaggerexpert/cookie");
|
|
14
13
|
var _apidomError = require("@swagger-api/apidom-error");
|
|
15
14
|
var _empty = require("@swagger-api/apidom-reference/configuration/empty");
|
|
16
15
|
var _constants = require("../constants.js");
|
|
@@ -22,7 +21,55 @@ var _buildRequest = _interopRequireDefault(require("./oas3/build-request.js"));
|
|
|
22
21
|
var _buildRequest2 = _interopRequireDefault(require("./swagger2/build-request.js"));
|
|
23
22
|
var _index3 = require("../helpers/index.js");
|
|
24
23
|
var _openapiPredicates = require("../helpers/openapi-predicates.js");
|
|
24
|
+
var _cookie = require("../helpers/cookie.js");
|
|
25
25
|
const arrayOrEmpty = ar => Array.isArray(ar) ? ar : [];
|
|
26
|
+
const findObjectSchema = (schema, {
|
|
27
|
+
recurse = true,
|
|
28
|
+
depth = 1
|
|
29
|
+
} = {}) => {
|
|
30
|
+
if (!(0, _ramdaAdjunct.isPlainObject)(schema)) return undefined;
|
|
31
|
+
|
|
32
|
+
// check if the schema is an object type
|
|
33
|
+
if (schema.type === 'object' || Array.isArray(schema.type) && schema.type.includes('object')) {
|
|
34
|
+
return schema;
|
|
35
|
+
}
|
|
36
|
+
if (depth > _constants.TRAVERSE_LIMIT) return undefined;
|
|
37
|
+
if (recurse) {
|
|
38
|
+
// traverse oneOf keyword first
|
|
39
|
+
const oneOfResult = Array.isArray(schema.oneOf) ? schema.oneOf.find(subschema => findObjectSchema(subschema, {
|
|
40
|
+
recurse,
|
|
41
|
+
depth: depth + 1
|
|
42
|
+
})) : undefined;
|
|
43
|
+
if (oneOfResult) return oneOfResult;
|
|
44
|
+
|
|
45
|
+
// traverse anyOf keyword second
|
|
46
|
+
const anyOfResult = Array.isArray(schema.anyOf) ? schema.anyOf.find(subschema => findObjectSchema(subschema, {
|
|
47
|
+
recurse,
|
|
48
|
+
depth: depth + 1
|
|
49
|
+
})) : undefined;
|
|
50
|
+
if (anyOfResult) return anyOfResult;
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
};
|
|
54
|
+
const parseJsonObject = ({
|
|
55
|
+
value,
|
|
56
|
+
silentFail = false
|
|
57
|
+
}) => {
|
|
58
|
+
try {
|
|
59
|
+
const parsedValue = JSON.parse(value);
|
|
60
|
+
if (typeof parsedValue === 'object') {
|
|
61
|
+
return parsedValue;
|
|
62
|
+
}
|
|
63
|
+
if (!silentFail) {
|
|
64
|
+
throw new Error('Expected JSON serialized object');
|
|
65
|
+
}
|
|
66
|
+
} catch {
|
|
67
|
+
if (!silentFail) {
|
|
68
|
+
throw new Error('Could not parse object parameter value string as JSON Object');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
};
|
|
26
73
|
|
|
27
74
|
/**
|
|
28
75
|
* `parseURIReference` function simulates the behavior of `node:url` parse function.
|
|
@@ -114,7 +161,6 @@ function execute({
|
|
|
114
161
|
|
|
115
162
|
// Build a request, which can be handled by the `http.js` implementation.
|
|
116
163
|
function buildRequest(options) {
|
|
117
|
-
var _baseURL;
|
|
118
164
|
const {
|
|
119
165
|
spec,
|
|
120
166
|
operationId,
|
|
@@ -176,7 +222,7 @@ function buildRequest(options) {
|
|
|
176
222
|
method,
|
|
177
223
|
pathName
|
|
178
224
|
} = operationRaw;
|
|
179
|
-
baseURL =
|
|
225
|
+
baseURL = baseURL != null ? baseURL : baseUrl({
|
|
180
226
|
spec,
|
|
181
227
|
scheme,
|
|
182
228
|
contextUrl,
|
|
@@ -236,11 +282,21 @@ function buildRequest(options) {
|
|
|
236
282
|
if (typeof value === 'undefined' && parameter.required && !parameter.allowEmptyValue) {
|
|
237
283
|
throw new Error(`Required parameter ${parameter.name} is not provided`);
|
|
238
284
|
}
|
|
239
|
-
if (specIsOAS3 &&
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
285
|
+
if (specIsOAS3 && typeof value === 'string') {
|
|
286
|
+
if ((0, _ramda.has)('type', parameter.schema) && findObjectSchema(parameter.schema, {
|
|
287
|
+
recurse: false
|
|
288
|
+
})) {
|
|
289
|
+
value = parseJsonObject({
|
|
290
|
+
value,
|
|
291
|
+
silentFail: false
|
|
292
|
+
});
|
|
293
|
+
} else if (findObjectSchema(parameter.schema, {
|
|
294
|
+
recurse: true
|
|
295
|
+
})) {
|
|
296
|
+
value = parseJsonObject({
|
|
297
|
+
value,
|
|
298
|
+
silentFail: true
|
|
299
|
+
});
|
|
244
300
|
}
|
|
245
301
|
}
|
|
246
302
|
if (builder) {
|
|
@@ -269,16 +325,8 @@ function buildRequest(options) {
|
|
|
269
325
|
|
|
270
326
|
// If the cookie convenience object exists in our request,
|
|
271
327
|
// serialize its content and then delete the cookie object.
|
|
272
|
-
if (req.cookies && Object.keys(req.cookies).length) {
|
|
273
|
-
const cookieString = (0, _cookie.
|
|
274
|
-
encoders: {
|
|
275
|
-
value: _cookie.cookieValueLenientEncoder
|
|
276
|
-
},
|
|
277
|
-
validators: {
|
|
278
|
-
name: _cookie.cookieNameLenientValidator,
|
|
279
|
-
value: _cookie.cookieValueLenientValidator
|
|
280
|
-
}
|
|
281
|
-
});
|
|
328
|
+
if (req.cookies && Object.keys(req.cookies).length > 0) {
|
|
329
|
+
const cookieString = (0, _cookie.serialize)(req.cookies);
|
|
282
330
|
if ((0, _ramdaAdjunct.isNonEmptyString)(req.headers.Cookie)) {
|
|
283
331
|
req.headers.Cookie += `; ${cookieString}`;
|
|
284
332
|
} else {
|
|
@@ -8,10 +8,9 @@ exports.header = header;
|
|
|
8
8
|
exports.path = path;
|
|
9
9
|
exports.query = query;
|
|
10
10
|
var _openapiPathTemplating = require("openapi-path-templating");
|
|
11
|
-
var _cookie = require("@swaggerexpert/cookie");
|
|
12
11
|
var _styleSerializer = _interopRequireWildcard(require("./style-serializer.js"));
|
|
13
12
|
var _contentSerializer = _interopRequireDefault(require("./content-serializer.js"));
|
|
14
|
-
var
|
|
13
|
+
var _cookie = require("../../helpers/cookie.js");
|
|
15
14
|
function path({
|
|
16
15
|
req,
|
|
17
16
|
value,
|
|
@@ -130,12 +129,8 @@ function cookie({
|
|
|
130
129
|
if (value !== undefined && parameter.content) {
|
|
131
130
|
const effectiveMediaType = Object.keys(parameter.content)[0];
|
|
132
131
|
const cookieValue = (0, _contentSerializer.default)(value, effectiveMediaType);
|
|
133
|
-
req.headers.Cookie = (0, _cookie.
|
|
132
|
+
req.headers.Cookie = (0, _cookie.serialize)({
|
|
134
133
|
[cookieName]: cookieValue
|
|
135
|
-
}, {
|
|
136
|
-
encoders: {
|
|
137
|
-
value: _cookieValueEncoder.default
|
|
138
|
-
}
|
|
139
134
|
});
|
|
140
135
|
return;
|
|
141
136
|
}
|
|
@@ -149,12 +144,8 @@ function cookie({
|
|
|
149
144
|
explode: (_parameter$explode = parameter.explode) != null ? _parameter$explode : false
|
|
150
145
|
});
|
|
151
146
|
const cookieValue = Array.isArray(value) && parameter.explode ? `${cookieName}=${serializedValue}` : serializedValue;
|
|
152
|
-
req.headers.Cookie = (0, _cookie.
|
|
147
|
+
req.headers.Cookie = (0, _cookie.serialize)({
|
|
153
148
|
[cookieName]: cookieValue
|
|
154
|
-
}, {
|
|
155
|
-
encoders: {
|
|
156
|
-
value: _cookieValueEncoder.default
|
|
157
|
-
}
|
|
158
149
|
});
|
|
159
150
|
}
|
|
160
151
|
}
|
|
@@ -38,7 +38,6 @@ function stylize(config) {
|
|
|
38
38
|
return encodePrimitive(config);
|
|
39
39
|
}
|
|
40
40
|
function valueEncoder(value, escape = false) {
|
|
41
|
-
var _value;
|
|
42
41
|
if (Array.isArray(value) || value !== null && typeof value === 'object') {
|
|
43
42
|
value = JSON.stringify(value);
|
|
44
43
|
} else if (typeof value === 'number' || typeof value === 'boolean') {
|
|
@@ -47,7 +46,7 @@ function valueEncoder(value, escape = false) {
|
|
|
47
46
|
if (escape && typeof value === 'string' && value.length > 0) {
|
|
48
47
|
return encodeCharacters(value, escape);
|
|
49
48
|
}
|
|
50
|
-
return
|
|
49
|
+
return value != null ? value : '';
|
|
51
50
|
}
|
|
52
51
|
function encodeArray({
|
|
53
52
|
key,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.valuePercentEncoder = exports.serialize = void 0;
|
|
5
|
+
var _ramda = require("ramda");
|
|
6
|
+
var _cookie = require("@swaggerexpert/cookie");
|
|
7
|
+
const eqSignPE = '%3D';
|
|
8
|
+
const ampersandPE = '%26';
|
|
9
|
+
const valuePercentEncoder = cookieValue => (0, _cookie.cookieValueStrictPercentEncoder)(cookieValue).replace(/[=&]/gu, match => match === '=' ? eqSignPE : ampersandPE);
|
|
10
|
+
exports.valuePercentEncoder = valuePercentEncoder;
|
|
11
|
+
const serialize = (cookiePairs, options = {}) => {
|
|
12
|
+
const defaultOptions = {
|
|
13
|
+
encoders: {
|
|
14
|
+
name: _cookie.identity,
|
|
15
|
+
value: valuePercentEncoder
|
|
16
|
+
},
|
|
17
|
+
validators: {
|
|
18
|
+
name: _cookie.cookieNameLenientValidator,
|
|
19
|
+
value: _cookie.cookieValueStrictValidator
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return (0, _cookie.serializeCookie)(cookiePairs, (0, _ramda.mergeDeepRight)(defaultOptions, options));
|
|
23
|
+
};
|
|
24
|
+
exports.serialize = serialize;
|
|
@@ -11,8 +11,8 @@ var _allOf = _interopRequireDefault(require("./lib/all-of.js"));
|
|
|
11
11
|
var _parameters = _interopRequireDefault(require("./lib/parameters.js"));
|
|
12
12
|
var _properties = _interopRequireDefault(require("./lib/properties.js"));
|
|
13
13
|
var _contextTree = _interopRequireDefault(require("./lib/context-tree.js"));
|
|
14
|
+
var _constants = require("../../constants.js");
|
|
14
15
|
const PLUGIN_DISPATCH_LIMIT = 100;
|
|
15
|
-
const TRAVERSE_LIMIT = 3000;
|
|
16
16
|
const noop = () => {};
|
|
17
17
|
class SpecMap {
|
|
18
18
|
static getPluginName(plugin) {
|
|
@@ -101,7 +101,7 @@ class SpecMap {
|
|
|
101
101
|
|
|
102
102
|
// eslint-disable-next-line no-restricted-syntax
|
|
103
103
|
for (const [i, patch] of patches.filter(_index.default.isAdditiveMutation).entries()) {
|
|
104
|
-
if (i < TRAVERSE_LIMIT) {
|
|
104
|
+
if (i < _constants.TRAVERSE_LIMIT) {
|
|
105
105
|
yield* traverse(patch.value, patch.path, patch);
|
|
106
106
|
} else {
|
|
107
107
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swagger-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.34.1",
|
|
4
4
|
"description": "SwaggerJS - a collection of interfaces for OAI specs",
|
|
5
5
|
"browser": {
|
|
6
6
|
"./src/helpers/btoa.node.js": "./src/helpers/btoa.browser.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
|
|
51
51
|
"lint": "eslint src/ test/",
|
|
52
52
|
"lint:fix": "npm run lint -- --fix",
|
|
53
|
-
"link:apidom": "npm link @swagger-api/apidom-core @swagger-api/apidom-error @swagger-api/apidom-reference @swagger-api/apidom-ns-openapi-2 @swagger-api/apidom-ns-openapi-3-0 @swagger-api/apidom-ns-openapi-3-1 @swagger-api/apidom-ns-json-schema-draft-4 @swagger-api/apidom-json-pointer",
|
|
53
|
+
"link:apidom": "npm link @swagger-api/apidom-core @swagger-api/apidom-error @swagger-api/apidom-reference @swagger-api/apidom-ns-openapi-2 @swagger-api/apidom-ns-openapi-3-0 @swagger-api/apidom-ns-openapi-3-1 @swagger-api/apidom-ns-json-schema-draft-4 @swagger-api/apidom-ns-json-schema-draft-6 @swagger-api/apidom-ns-json-schema-draft-7 @swagger-api/apidom-ns-json-schema-2019-09 @swagger-api/apidom-ns-json-schema-2020-12 @swagger-api/apidom-json-pointer",
|
|
54
54
|
"test": "run-s test:unit:coverage test:artifact",
|
|
55
55
|
"test:unit": "cross-env BABEL_ENV=commonjs jest --runInBand --config ./config/jest/jest.unit.config.js",
|
|
56
56
|
"test:unit:coverage": "cross-env BABEL_ENV=commonjs jest --runInBand --config ./config/jest/jest.unit.coverage.config.js",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
76
76
|
"@scarf/scarf": "=1.4.0",
|
|
77
|
-
"@swagger-api/apidom-core": ">=1.0.0-beta.
|
|
78
|
-
"@swagger-api/apidom-error": ">=1.0.0-beta.
|
|
79
|
-
"@swagger-api/apidom-json-pointer": ">=1.0.0-beta.
|
|
80
|
-
"@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.
|
|
81
|
-
"@swagger-api/apidom-reference": ">=1.0.0-beta.
|
|
82
|
-
"@swaggerexpert/cookie": "^
|
|
77
|
+
"@swagger-api/apidom-core": ">=1.0.0-beta.12 <1.0.0-rc.0",
|
|
78
|
+
"@swagger-api/apidom-error": ">=1.0.0-beta.12 <1.0.0-rc.0",
|
|
79
|
+
"@swagger-api/apidom-json-pointer": ">=1.0.0-beta.12 <1.0.0-rc.0",
|
|
80
|
+
"@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.12 <1.0.0-rc.0",
|
|
81
|
+
"@swagger-api/apidom-reference": ">=1.0.0-beta.12 <1.0.0-rc.0",
|
|
82
|
+
"@swaggerexpert/cookie": "^2.0.2",
|
|
83
83
|
"deepmerge": "~4.3.0",
|
|
84
84
|
"fast-json-patch": "^3.0.0-1",
|
|
85
85
|
"js-yaml": "^4.1.0",
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
"cross-env": "=7.0.3",
|
|
105
105
|
"eslint": "^8.42.0",
|
|
106
106
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
107
|
-
"eslint-config-prettier": "=
|
|
107
|
+
"eslint-config-prettier": "=10.0.1",
|
|
108
108
|
"eslint-plugin-import": "=2.31.0",
|
|
109
|
-
"eslint-plugin-prettier": "=5.2.
|
|
109
|
+
"eslint-plugin-prettier": "=5.2.3",
|
|
110
110
|
"expect": "^29.0.3",
|
|
111
|
-
"glob": "=11.0.
|
|
111
|
+
"glob": "=11.0.1",
|
|
112
112
|
"husky": "^9.0.11",
|
|
113
113
|
"inspectpack": "=4.7.1",
|
|
114
114
|
"install": "=0.13.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"jest-environment-jsdom": "^29.0.3",
|
|
117
117
|
"json-loader": "=0.5.7",
|
|
118
118
|
"license-checker": "=25.0.1",
|
|
119
|
-
"lint-staged": "=15.3
|
|
119
|
+
"lint-staged": "=15.4.3",
|
|
120
120
|
"lodash": "^4.17.21",
|
|
121
121
|
"npm-run-all": "=4.1.5",
|
|
122
122
|
"prettier": "^3.1.1",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"source-map-explorer": "^2.5.3",
|
|
125
125
|
"terser-webpack-plugin": "^5.0.3",
|
|
126
126
|
"undici": "^5.28.4",
|
|
127
|
-
"webpack": "=5.
|
|
127
|
+
"webpack": "=5.98.0",
|
|
128
128
|
"webpack-bundle-size-analyzer": "=3.1.0",
|
|
129
129
|
"webpack-cli": "=6.0.1",
|
|
130
130
|
"webpack-stats-plugin": "=1.1.3"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { cookieValueStrictEncoder } from '@swaggerexpert/cookie';
|
|
2
|
-
const eqSignPE = '%3D';
|
|
3
|
-
const ampersandPE = '%26';
|
|
4
|
-
const cookieValueEncoder = cookieValue => cookieValueStrictEncoder(cookieValue).replace(/[=&]/gu, match => match === '=' ? eqSignPE : ampersandPE);
|
|
5
|
-
export default cookieValueEncoder;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
var _cookie = require("@swaggerexpert/cookie");
|
|
6
|
-
const eqSignPE = '%3D';
|
|
7
|
-
const ampersandPE = '%26';
|
|
8
|
-
const cookieValueEncoder = cookieValue => (0, _cookie.cookieValueStrictEncoder)(cookieValue).replace(/[=&]/gu, match => match === '=' ? eqSignPE : ampersandPE);
|
|
9
|
-
var _default = exports.default = cookieValueEncoder;
|