@readme/oas-to-har 38.5.1 → 39.0.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,5 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/lib/configure-security.ts
2
2
  var _types = require('oas/types');
3
+ var _utils = require('oas/utils');
3
4
  function harValue(type, value) {
4
5
  if (!value.value) return void 0;
5
6
  return { type, value };
@@ -8,14 +9,19 @@ function configureSecurity(apiDefinition, values, scheme) {
8
9
  if (!scheme) return void 0;
9
10
  if (Object.keys(values || {}).length === 0) return void 0;
10
11
  if (!_optionalChain([apiDefinition, 'access', _ => _.components, 'optionalAccess', _2 => _2.securitySchemes, 'optionalAccess', _3 => _3[scheme]])) return void 0;
11
- const security = apiDefinition.components.securitySchemes[scheme];
12
+ let security = apiDefinition.components.securitySchemes[scheme];
12
13
  if (_types.isRef.call(void 0, security)) {
13
- return void 0;
14
- } else if (!values[scheme]) {
14
+ security = _utils.dereferenceRef.call(void 0, security, apiDefinition);
15
+ if (!security || _types.isRef.call(void 0, security)) {
16
+ return void 0;
17
+ }
18
+ }
19
+ if (!values[scheme]) {
15
20
  return false;
16
21
  }
17
22
  if (security.type === "http") {
18
- if (security.scheme === "basic") {
23
+ const httpScheme = _optionalChain([security, 'access', _4 => _4.scheme, 'optionalAccess', _5 => _5.toLowerCase, 'call', _6 => _6()]);
24
+ if (httpScheme === "basic") {
19
25
  const auth = values[scheme];
20
26
  if (typeof auth !== "object") return false;
21
27
  if (!auth.user && !auth.pass) return false;
@@ -31,7 +37,7 @@ function configureSecurity(apiDefinition, values, scheme) {
31
37
  name: "authorization",
32
38
  value: `Basic ${Buffer.from(`${user}:${pass}`).toString("base64")}`
33
39
  });
34
- } else if (security.scheme === "bearer") {
40
+ } else if (httpScheme === "bearer") {
35
41
  return harValue("headers", {
36
42
  name: "authorization",
37
43
  value: `Bearer ${values[scheme]}`
@@ -74,4 +80,4 @@ function configureSecurity(apiDefinition, values, scheme) {
74
80
 
75
81
 
76
82
  exports.configureSecurity = configureSecurity;
77
- //# sourceMappingURL=chunk-ZYPAVWY2.cjs.map
83
+ //# sourceMappingURL=chunk-6CVT7KVT.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/erunion/code/readme/oas/packages/oas-to-har/dist/chunk-6CVT7KVT.cjs","../src/lib/configure-security.ts"],"names":[],"mappings":"AAAA;ACGA,kCAAsB;AACtB,kCAA+B;AAE/B,SAAS,QAAA,CACP,IAAA,EACA,KAAA,EACwD;AACxD,EAAA,GAAA,CAAI,CAAC,KAAA,CAAM,KAAA,EAAO,OAAO,KAAA,CAAA;AACzB,EAAA,OAAO,EAAE,IAAA,EAAM,MAAM,CAAA;AACvB;AAEe,SAAR,iBAAA,CACL,aAAA,EACA,MAAA,EACA,MAAA,EACiD;AACjD,EAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,OAAO,KAAA,CAAA;AAEpB,EAAA,GAAA,CAAI,MAAA,CAAO,IAAA,CAAK,OAAA,GAAU,CAAC,CAAC,CAAA,CAAE,OAAA,IAAW,CAAA,EAAG,OAAO,KAAA,CAAA;AAEnD,EAAA,GAAA,CAAI,iBAAC,aAAA,mBAAc,UAAA,6BAAY,eAAA,4BAAA,CAAkB,MAAM,GAAA,EAAG,OAAO,KAAA,CAAA;AACjE,EAAA,IAAI,SAAA,EAAW,aAAA,CAAc,UAAA,CAAW,eAAA,CAAgB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S,MAAA,CAAO,IAAA,CAAK,CAAA,EAAA;AAC7B,MAAA;AACuB,IAAA;AACG,MAAA;AACnB,QAAA;AACkB,QAAA;AACzB,MAAA;AACH,IAAA;AACF,EAAA;AAEgC,EAAA;AACD,IAAA;AACI,MAAA;AACd,QAAA;AACa,QAAA;AAC7B,MAAA;AACwB,IAAA;AACV,MAAA;AACE,QAAA;AACa,QAAA;AAC9B,MAAA;AAE8B,MAAA;AAEP,QAAA;AACE,QAAA;AACL,QAAA;AACpB,MAAA;AAE2B,MAAA;AACF,IAAA;AACE,MAAA;AACV,QAAA;AACa,QAAA;AAC7B,MAAA;AACH,IAAA;AACF,EAAA;AAEgC,EAAA;AACH,IAAA;AACnB,MAAA;AACyB,MAAA;AAChC,IAAA;AACH,EAAA;AAEO,EAAA;AACT;AD5BqC;AACA;AACA;AACA","file":"/Users/erunion/code/readme/oas/packages/oas-to-har/dist/chunk-6CVT7KVT.cjs","sourcesContent":[null,"import type { AuthForHAR } from './types.js';\nimport type { OASDocument, SecuritySchemeObject } from 'oas/types';\n\nimport { isRef } from 'oas/types';\nimport { dereferenceRef } from 'oas/utils';\n\nfunction harValue(\n type: 'cookies' | 'headers' | 'queryString',\n value: { name: string; value: string },\n): { type: typeof type; value: typeof value } | undefined {\n if (!value.value) return undefined;\n return { type, value };\n}\n\nexport default function configureSecurity(\n apiDefinition: OASDocument,\n values: AuthForHAR,\n scheme: string,\n): ReturnType<typeof harValue> | false | undefined {\n if (!scheme) return undefined;\n\n if (Object.keys(values || {}).length === 0) return undefined;\n\n if (!apiDefinition.components?.securitySchemes?.[scheme]) return undefined;\n let security = apiDefinition.components.securitySchemes[scheme] as SecuritySchemeObject & {\n 'x-bearer-format'?: string;\n };\n\n if (isRef(security)) {\n security = dereferenceRef(security, apiDefinition);\n if (!security || isRef(security)) {\n return undefined;\n }\n }\n\n if (!values[scheme]) {\n // If we don't have any data for this auth scheme then we shouldn't add it.\n return false;\n }\n\n if (security.type === 'http') {\n // HTTP authentication scheme names are case-insensitive (RFC 7235).\n const httpScheme = security.scheme?.toLowerCase();\n if (httpScheme === 'basic') {\n const auth = values[scheme];\n if (typeof auth !== 'object') return false;\n if (!auth.user && !auth.pass) return false;\n\n let user = auth.user ?? null;\n if (user === null || user.length === 0) {\n user = '';\n }\n\n let pass = auth.pass ?? null;\n if (pass === null || pass.length === 0) {\n pass = '';\n }\n\n return harValue('headers', {\n name: 'authorization',\n value: `Basic ${Buffer.from(`${user}:${pass}`).toString('base64')}`,\n });\n } else if (httpScheme === 'bearer') {\n return harValue('headers', {\n name: 'authorization',\n value: `Bearer ${values[scheme]}`,\n });\n }\n }\n\n if (security.type === 'apiKey') {\n if (security.in === 'query') {\n return harValue('queryString', {\n name: security.name,\n value: String(values[scheme]),\n });\n } else if (security.in === 'header') {\n const header = {\n name: security.name,\n value: String(values[scheme]),\n };\n\n if (security['x-bearer-format']) {\n // Uppercase: token -> Token\n const bearerFormat = security['x-bearer-format'].charAt(0).toUpperCase() + security['x-bearer-format'].slice(1);\n header.name = security.name;\n header.value = `${bearerFormat} ${header.value}`;\n }\n\n return harValue('headers', header);\n } else if (security.in === 'cookie') {\n return harValue('cookies', {\n name: security.name,\n value: String(values[scheme]),\n });\n }\n }\n\n if (security.type === 'oauth2') {\n return harValue('headers', {\n name: 'authorization',\n value: `Bearer ${values[scheme]}`,\n });\n }\n\n return undefined;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  // src/lib/configure-security.ts
2
2
  import { isRef } from "oas/types";
3
+ import { dereferenceRef } from "oas/utils";
3
4
  function harValue(type, value) {
4
5
  if (!value.value) return void 0;
5
6
  return { type, value };
@@ -8,14 +9,19 @@ function configureSecurity(apiDefinition, values, scheme) {
8
9
  if (!scheme) return void 0;
9
10
  if (Object.keys(values || {}).length === 0) return void 0;
10
11
  if (!apiDefinition.components?.securitySchemes?.[scheme]) return void 0;
11
- const security = apiDefinition.components.securitySchemes[scheme];
12
+ let security = apiDefinition.components.securitySchemes[scheme];
12
13
  if (isRef(security)) {
13
- return void 0;
14
- } else if (!values[scheme]) {
14
+ security = dereferenceRef(security, apiDefinition);
15
+ if (!security || isRef(security)) {
16
+ return void 0;
17
+ }
18
+ }
19
+ if (!values[scheme]) {
15
20
  return false;
16
21
  }
17
22
  if (security.type === "http") {
18
- if (security.scheme === "basic") {
23
+ const httpScheme = security.scheme?.toLowerCase();
24
+ if (httpScheme === "basic") {
19
25
  const auth = values[scheme];
20
26
  if (typeof auth !== "object") return false;
21
27
  if (!auth.user && !auth.pass) return false;
@@ -31,7 +37,7 @@ function configureSecurity(apiDefinition, values, scheme) {
31
37
  name: "authorization",
32
38
  value: `Basic ${Buffer.from(`${user}:${pass}`).toString("base64")}`
33
39
  });
34
- } else if (security.scheme === "bearer") {
40
+ } else if (httpScheme === "bearer") {
35
41
  return harValue("headers", {
36
42
  name: "authorization",
37
43
  value: `Bearer ${values[scheme]}`
@@ -74,4 +80,4 @@ function configureSecurity(apiDefinition, values, scheme) {
74
80
  export {
75
81
  configureSecurity
76
82
  };
77
- //# sourceMappingURL=chunk-567EY73K.js.map
83
+ //# sourceMappingURL=chunk-JWXX5N4N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/configure-security.ts"],"sourcesContent":["import type { AuthForHAR } from './types.js';\nimport type { OASDocument, SecuritySchemeObject } from 'oas/types';\n\nimport { isRef } from 'oas/types';\nimport { dereferenceRef } from 'oas/utils';\n\nfunction harValue(\n type: 'cookies' | 'headers' | 'queryString',\n value: { name: string; value: string },\n): { type: typeof type; value: typeof value } | undefined {\n if (!value.value) return undefined;\n return { type, value };\n}\n\nexport default function configureSecurity(\n apiDefinition: OASDocument,\n values: AuthForHAR,\n scheme: string,\n): ReturnType<typeof harValue> | false | undefined {\n if (!scheme) return undefined;\n\n if (Object.keys(values || {}).length === 0) return undefined;\n\n if (!apiDefinition.components?.securitySchemes?.[scheme]) return undefined;\n let security = apiDefinition.components.securitySchemes[scheme] as SecuritySchemeObject & {\n 'x-bearer-format'?: string;\n };\n\n if (isRef(security)) {\n security = dereferenceRef(security, apiDefinition);\n if (!security || isRef(security)) {\n return undefined;\n }\n }\n\n if (!values[scheme]) {\n // If we don't have any data for this auth scheme then we shouldn't add it.\n return false;\n }\n\n if (security.type === 'http') {\n // HTTP authentication scheme names are case-insensitive (RFC 7235).\n const httpScheme = security.scheme?.toLowerCase();\n if (httpScheme === 'basic') {\n const auth = values[scheme];\n if (typeof auth !== 'object') return false;\n if (!auth.user && !auth.pass) return false;\n\n let user = auth.user ?? null;\n if (user === null || user.length === 0) {\n user = '';\n }\n\n let pass = auth.pass ?? null;\n if (pass === null || pass.length === 0) {\n pass = '';\n }\n\n return harValue('headers', {\n name: 'authorization',\n value: `Basic ${Buffer.from(`${user}:${pass}`).toString('base64')}`,\n });\n } else if (httpScheme === 'bearer') {\n return harValue('headers', {\n name: 'authorization',\n value: `Bearer ${values[scheme]}`,\n });\n }\n }\n\n if (security.type === 'apiKey') {\n if (security.in === 'query') {\n return harValue('queryString', {\n name: security.name,\n value: String(values[scheme]),\n });\n } else if (security.in === 'header') {\n const header = {\n name: security.name,\n value: String(values[scheme]),\n };\n\n if (security['x-bearer-format']) {\n // Uppercase: token -> Token\n const bearerFormat = security['x-bearer-format'].charAt(0).toUpperCase() + security['x-bearer-format'].slice(1);\n header.name = security.name;\n header.value = `${bearerFormat} ${header.value}`;\n }\n\n return harValue('headers', header);\n } else if (security.in === 'cookie') {\n return harValue('cookies', {\n name: security.name,\n value: String(values[scheme]),\n });\n }\n }\n\n if (security.type === 'oauth2') {\n return harValue('headers', {\n name: 'authorization',\n value: `Bearer ${values[scheme]}`,\n });\n }\n\n return undefined;\n}\n"],"mappings":";AAGA,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAE/B,SAAS,SACP,MACA,OACwD;AACxD,MAAI,CAAC,MAAM,MAAO,QAAO;AACzB,SAAO,EAAE,MAAM,MAAM;AACvB;AAEe,SAAR,kBACL,eACA,QACA,QACiD;AACjD,MAAI,CAAC,OAAQ,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AAM,CAAC;AAAA,MAC9B,CAAC;AAAA,IACH,WAAW,SAAS,OAAO,UAAU;AACnC,YAAM,SAAS;AAAA,QACb,MAAM,SAAS;AAAA,QACf,OAAO,OAAO,OAAO,MAAM,CAAC;AAAA,MAC9B;AAEA,UAAI,SAAS,iBAAiB,GAAG;AAE/B,cAAM,eAAe,SAAS,iBAAiB,EAAE,OAAO,CAAC,EAAE,YAAY,IAAI,SAAS,iBAAiB,EAAE,MAAM,CAAC;AAC9G,eAAO,OAAO,SAAS;AACvB,eAAO,QAAQ,GAAG,YAAY,IAAI,OAAO,KAAK;AAAA,MAChD;AAEA,aAAO,SAAS,WAAW,MAAM;AAAA,IACnC,WAAW,SAAS,OAAO,UAAU;AACnC,aAAO,SAAS,WAAW;AAAA,QACzB,MAAM,SAAS;AAAA,QACf,OAAO,OAAO,OAAO,MAAM,CAAC;AAAA,MAC9B,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,SAAS,SAAS,UAAU;AAC9B,WAAO,SAAS,WAAW;AAAA,MACzB,MAAM;AAAA,MACN,OAAO,UAAU,OAAO,MAAM,CAAC;AAAA,IACjC,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkZYPAVWY2cjs = require('./chunk-ZYPAVWY2.cjs');
3
+ var _chunk6CVT7KVTcjs = require('./chunk-6CVT7KVT.cjs');
4
4
 
5
5
  // src/index.ts
6
6
  var _dataurls = require('@readme/data-urls');
@@ -209,13 +209,17 @@ function getParameterContentType(param) {
209
209
  }
210
210
  return _utils.getParameterContentType.call(void 0, contentKeys) || null;
211
211
  }
212
- function getParameterContentSchema(param, contentType) {
212
+ function getParameterContentSchema(param, contentType, api) {
213
213
  if (!("content" in param) || typeof param.content !== "object" || !param.content) {
214
214
  return null;
215
215
  }
216
216
  const mediaTypeObject = param.content[contentType];
217
217
  if (typeof mediaTypeObject === "object" && mediaTypeObject && "schema" in mediaTypeObject && mediaTypeObject.schema) {
218
- return _types.isRef.call(void 0, mediaTypeObject.schema) ? null : mediaTypeObject.schema;
218
+ const schema = _types.isRef.call(void 0, mediaTypeObject.schema) ? _utils.dereferenceRef.call(void 0, mediaTypeObject.schema, api) : mediaTypeObject.schema;
219
+ if (!schema || _types.isRef.call(void 0, schema)) {
220
+ return null;
221
+ }
222
+ return schema;
219
223
  }
220
224
  return null;
221
225
  }
@@ -859,7 +863,7 @@ function getParamValue(values, param, type) {
859
863
  }
860
864
  return _optionalChain([bucket, 'optionalAccess', _9 => _9[param.name]]);
861
865
  }
862
- function formatter(values, param, type, onlyIfExists = false) {
866
+ function formatter(values, param, type, onlyIfExists = false, api) {
863
867
  if (param.style) {
864
868
  const value2 = getParamValue(values, param, type);
865
869
  return formatStyle(value2, param);
@@ -869,13 +873,21 @@ function formatter(values, param, type, onlyIfExists = false) {
869
873
  value = getParamValue(values, param, type);
870
874
  } else if (onlyIfExists && !param.required) {
871
875
  value = void 0;
872
- } else if (param.required && param.schema && !_types.isRef.call(void 0, param.schema) && param.schema.default) {
873
- value = param.schema.default;
876
+ } else if (param.required && param.schema) {
877
+ const schema = _types.isRef.call(void 0, param.schema) ? _utils.dereferenceRef.call(void 0, param.schema, api) : param.schema;
878
+ if (schema && !_types.isRef.call(void 0, schema) && schema.default) {
879
+ value = schema.default;
880
+ } else if (param.content) {
881
+ const contentType = getParameterContentType(param);
882
+ const contentSchema = contentType ? getParameterContentSchema(param, contentType, api) : null;
883
+ value = _optionalChain([contentSchema, 'optionalAccess', _10 => _10.default]);
884
+ }
874
885
  } else if (param.required && param.content) {
875
886
  const contentType = getParameterContentType(param);
876
- const schema = contentType ? getParameterContentSchema(param, contentType) : null;
877
- value = _optionalChain([schema, 'optionalAccess', _10 => _10.default]);
878
- } else if (type === "path") {
887
+ const schema = contentType ? getParameterContentSchema(param, contentType, api) : null;
888
+ value = _optionalChain([schema, 'optionalAccess', _11 => _11.default]);
889
+ }
890
+ if (value === void 0 && type === "path") {
879
891
  return param.name;
880
892
  }
881
893
  if (param.schema && !_types.isRef.call(void 0, param.schema) && param.schema.type === "array" && param.schema.items && !_types.isRef.call(void 0, param.schema.items) && param.schema.items.format === "binary") {
@@ -895,7 +907,7 @@ function multipartBodyToFormatterParams(payload, oasMediaTypeObject, schema) {
895
907
  const encoding = oasMediaTypeObject.encoding;
896
908
  if (typeof payload === "object" && payload !== null) {
897
909
  return Object.keys(payload).map((key) => {
898
- if (!_optionalChain([schema, 'access', _11 => _11.properties, 'optionalAccess', _12 => _12[key]])) {
910
+ if (!_optionalChain([schema, 'access', _12 => _12.properties, 'optionalAccess', _13 => _13[key]])) {
899
911
  return false;
900
912
  }
901
913
  const paramEncoding = encoding ? encoding[key] : void 0;
@@ -925,7 +937,7 @@ var defaultFormDataTypes = Object.keys(_utils.jsonSchemaTypes).reduce((prev, cur
925
937
  }, {});
926
938
  function getResponseContentType(content) {
927
939
  const types = Object.keys(content) || [];
928
- if (_optionalChain([types, 'optionalAccess', _13 => _13.length])) {
940
+ if (_optionalChain([types, 'optionalAccess', _14 => _14.length])) {
929
941
  const jsonType = types.find((t) => _utils.matchesMimeType.json(t));
930
942
  if (jsonType) {
931
943
  return jsonType;
@@ -992,8 +1004,8 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
992
1004
  if (!operationSchema || typeof operationSchema.getParameters !== "function") {
993
1005
  operation = new (0, _operation.Operation)(
994
1006
  oas,
995
- _optionalChain([operationSchema, 'optionalAccess', _14 => _14.path]) || "",
996
- _optionalChain([operationSchema, 'optionalAccess', _15 => _15.method]) || "",
1007
+ _optionalChain([operationSchema, 'optionalAccess', _15 => _15.path]) || "",
1008
+ _optionalChain([operationSchema, 'optionalAccess', _16 => _16.method]) || "",
997
1009
  operationSchema || { path: "", method: "" }
998
1010
  );
999
1011
  } else {
@@ -1040,21 +1052,21 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1040
1052
  if (!operation || !parameters) return key;
1041
1053
  const parameter = parameters.find((param) => param.name === key) || { name: key };
1042
1054
  if (!("style" in parameter) || !parameter.style) {
1043
- return encodeURIComponent(formatter(formData, parameter, "path"));
1055
+ return encodeURIComponent(formatter(formData, parameter, "path", false, oas.api));
1044
1056
  }
1045
- return formatter(formData, parameter, "path");
1057
+ return formatter(formData, parameter, "path", false, oas.api);
1046
1058
  });
1047
- const queryStrings = _optionalChain([parameters, 'optionalAccess', _16 => _16.filter, 'call', _17 => _17((param) => param.in === "query")]);
1048
- if (_optionalChain([queryStrings, 'optionalAccess', _18 => _18.length])) {
1059
+ const queryStrings = _optionalChain([parameters, 'optionalAccess', _17 => _17.filter, 'call', _18 => _18((param) => param.in === "query")]);
1060
+ if (_optionalChain([queryStrings, 'optionalAccess', _19 => _19.length])) {
1049
1061
  queryStrings.forEach((queryString) => {
1050
- const value = formatter(formData, queryString, "query", true);
1062
+ const value = formatter(formData, queryString, "query", true, oas.api);
1051
1063
  appendHarValue(har.queryString, queryString.name, value);
1052
1064
  });
1053
1065
  }
1054
- const cookies = _optionalChain([parameters, 'optionalAccess', _19 => _19.filter, 'call', _20 => _20((param) => param.in === "cookie")]);
1055
- if (_optionalChain([cookies, 'optionalAccess', _21 => _21.length])) {
1066
+ const cookies = _optionalChain([parameters, 'optionalAccess', _20 => _20.filter, 'call', _21 => _21((param) => param.in === "cookie")]);
1067
+ if (_optionalChain([cookies, 'optionalAccess', _22 => _22.length])) {
1056
1068
  cookies.forEach((cookie) => {
1057
- const value = formatter(formData, cookie, "cookie", true);
1069
+ const value = formatter(formData, cookie, "cookie", true, oas.api);
1058
1070
  appendHarValue(har.cookies, cookie.name, value);
1059
1071
  });
1060
1072
  }
@@ -1074,10 +1086,10 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1074
1086
  }
1075
1087
  let hasContentType = false;
1076
1088
  let contentType = operation.getContentType();
1077
- const headers = _optionalChain([parameters, 'optionalAccess', _22 => _22.filter, 'call', _23 => _23((param) => param.in === "header")]);
1078
- if (_optionalChain([headers, 'optionalAccess', _24 => _24.length])) {
1089
+ const headers = _optionalChain([parameters, 'optionalAccess', _23 => _23.filter, 'call', _24 => _24((param) => param.in === "header")]);
1090
+ if (_optionalChain([headers, 'optionalAccess', _25 => _25.length])) {
1079
1091
  headers.forEach((header) => {
1080
- const value = formatter(formData, header, "header", true);
1092
+ const value = formatter(formData, header, "header", true, oas.api);
1081
1093
  if (typeof value === "undefined") return;
1082
1094
  if (header.name.toLowerCase() === "content-type") {
1083
1095
  hasContentType = true;
@@ -1130,9 +1142,9 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1130
1142
  const matchesRequestBodyType = (payload) => {
1131
1143
  return payload.type === (isFormUrlEncoded ? "formData" : "body");
1132
1144
  };
1133
- requestBody = _optionalChain([operation, 'access', _25 => _25.getParametersAsJSONSchema, 'call', _26 => _26({ contentType }), 'optionalAccess', _27 => _27.find, 'call', _28 => _28(matchesRequestBodyType)]);
1145
+ requestBody = _optionalChain([operation, 'access', _26 => _26.getParametersAsJSONSchema, 'call', _27 => _27({ contentType }), 'optionalAccess', _28 => _28.find, 'call', _29 => _29(matchesRequestBodyType)]);
1134
1146
  }
1135
- if (_optionalChain([requestBody, 'optionalAccess', _29 => _29.schema]) && Object.keys(requestBody.schema).length) {
1147
+ if (_optionalChain([requestBody, 'optionalAccess', _30 => _30.schema]) && Object.keys(requestBody.schema).length) {
1136
1148
  const requestBodySchema = requestBody.schema;
1137
1149
  const isFormUrlEncoded = _utils.matchesMimeType.formUrlEncoded(contentType);
1138
1150
  if (isFormUrlEncoded) {
@@ -1167,7 +1179,7 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1167
1179
  har.postData = { params: [], mimeType: "multipart/form-data" };
1168
1180
  const safeBodySchema = getSafeRequestBody(requestBodySchema, formData.body, operation.api);
1169
1181
  const binaryTypes = Object.keys(_nullishCoalesce(safeBodySchema.properties, () => ( {}))).filter((key) => {
1170
- if (!_optionalChain([safeBodySchema, 'access', _30 => _30.properties, 'optionalAccess', _31 => _31[key]]) || typeof safeBodySchema.properties[key] !== "object" || safeBodySchema.properties[key] === null) {
1182
+ if (!_optionalChain([safeBodySchema, 'access', _31 => _31.properties, 'optionalAccess', _32 => _32[key]]) || typeof safeBodySchema.properties[key] !== "object" || safeBodySchema.properties[key] === null) {
1171
1183
  return false;
1172
1184
  }
1173
1185
  const propData = safeBodySchema.properties[key];
@@ -1193,7 +1205,7 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1193
1205
  const param = multipartParams.find((multipartParam) => multipartParam.name === name);
1194
1206
  if (param) {
1195
1207
  const addtlData = {};
1196
- let value = formatter(formData, param, "body", true);
1208
+ let value = formatter(formData, param, "body", true, oas.api);
1197
1209
  if (!Array.isArray(value)) {
1198
1210
  value = [value];
1199
1211
  }
@@ -1207,7 +1219,7 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1207
1219
  }
1208
1220
  }
1209
1221
  }
1210
- appendHarValue(_optionalChain([har, 'access', _32 => _32.postData, 'optionalAccess', _33 => _33.params]) || [], name, val, addtlData);
1222
+ appendHarValue(_optionalChain([har, 'access', _33 => _33.postData, 'optionalAccess', _34 => _34.params]) || [], name, val, addtlData);
1211
1223
  });
1212
1224
  }
1213
1225
  });
@@ -1239,7 +1251,7 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1239
1251
  } else {
1240
1252
  try {
1241
1253
  const parsed = parseJSONStringsInBodyWithSchema(cleanBody, requestBodySchema, operation.api);
1242
- if (typeof _optionalChain([parsed, 'optionalAccess', _34 => _34.RAW_BODY]) !== "undefined") {
1254
+ if (typeof _optionalChain([parsed, 'optionalAccess', _35 => _35.RAW_BODY]) !== "undefined") {
1243
1255
  har.postData.text = isPrimitive(parsed.RAW_BODY) ? String(parsed.RAW_BODY) : stringify(parsed.RAW_BODY);
1244
1256
  } else {
1245
1257
  har.postData.text = JSON.stringify(parsed);
@@ -1258,17 +1270,17 @@ function oasToHar(oas, operationSchema, values = {}, auth = {}, opts = { proxyUr
1258
1270
  }
1259
1271
  }
1260
1272
  }
1261
- if ((_optionalChain([har, 'access', _35 => _35.postData, 'optionalAccess', _36 => _36.text]) || _optionalChain([requestBody, 'optionalAccess', _37 => _37.schema]) && Object.keys(requestBody.schema).length) && !hasContentType) {
1273
+ if ((_optionalChain([har, 'access', _36 => _36.postData, 'optionalAccess', _37 => _37.text]) || _optionalChain([requestBody, 'optionalAccess', _38 => _38.schema]) && Object.keys(requestBody.schema).length) && !hasContentType) {
1262
1274
  har.headers.push({
1263
1275
  name: "content-type",
1264
1276
  value: contentType
1265
1277
  });
1266
1278
  }
1267
1279
  const securityRequirements = operation.getSecurity();
1268
- if (_optionalChain([securityRequirements, 'optionalAccess', _38 => _38.length])) {
1280
+ if (_optionalChain([securityRequirements, 'optionalAccess', _39 => _39.length])) {
1269
1281
  securityRequirements.forEach((schemes) => {
1270
1282
  Object.keys(schemes).forEach((security) => {
1271
- const securityValue = _chunkZYPAVWY2cjs.configureSecurity.call(void 0, apiDefinition, auth, security);
1283
+ const securityValue = _chunk6CVT7KVTcjs.configureSecurity.call(void 0, apiDefinition, auth, security);
1272
1284
  if (!securityValue) {
1273
1285
  return;
1274
1286
  }