@readme/httpsnippet 10.0.5 → 10.1.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.
@@ -14,5 +14,5 @@ var reducer = (accumulator, pair) => {
14
14
  };
15
15
 
16
16
  export { reducer };
17
- //# sourceMappingURL=out.js.map
17
+ //# sourceMappingURL=chunk-KT7MO6Z4.js.map
18
18
  //# sourceMappingURL=chunk-KT7MO6Z4.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/helpers/reducer.ts"],"names":[],"mappings":";AAEO,IAAM,UAAU,CAA4C,aAAkC,SAAY;AAC/G,QAAM,eAAe,YAAY,KAAK,IAAI;AAC1C,MAAI,iBAAiB,QAAW;AAC9B,gBAAY,KAAK,IAAI,IAAI,KAAK;AAC9B,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,YAAY,GAAG;AAC/B,iBAAa,KAAK,KAAK,KAAK;AAC5B,WAAO;AAAA,EACT;AAGA,cAAY,KAAK,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;AAClD,SAAO;AACT","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
1
+ {"version":3,"sources":["../src/helpers/reducer.ts"],"names":[],"mappings":";AAEa,IAAA,OAAA,GAAU,CAA4C,WAAA,EAAkC,IAAY,KAAA;AAC/G,EAAM,MAAA,YAAA,GAAe,WAAY,CAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAC1C,EAAA,IAAI,iBAAiB,KAAW,CAAA,EAAA;AAC9B,IAAY,WAAA,CAAA,IAAA,CAAK,IAAI,CAAA,GAAI,IAAK,CAAA,KAAA,CAAA;AAC9B,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AAGA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,YAAY,CAAG,EAAA;AAC/B,IAAa,YAAA,CAAA,IAAA,CAAK,KAAK,KAAK,CAAA,CAAA;AAC5B,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AAGA,EAAA,WAAA,CAAY,KAAK,IAAI,CAAA,GAAI,CAAC,YAAA,EAAc,KAAK,KAAK,CAAA,CAAA;AAClD,EAAO,OAAA,WAAA,CAAA;AACT","file":"chunk-KT7MO6Z4.js","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
@@ -59,5 +59,5 @@ var CodeBuilder = class {
59
59
  };
60
60
 
61
61
  export { CodeBuilder };
62
- //# sourceMappingURL=out.js.map
62
+ //# sourceMappingURL=chunk-Y7NI4MMY.js.map
63
63
  //# sourceMappingURL=chunk-Y7NI4MMY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/helpers/code-builder.ts"],"names":[],"mappings":";AAAA,IAAM,gCAAgC;AACtC,IAAM,oBAAoB;AAkBnB,IAAM,cAAN,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAavB,YAAY,EAAE,QAAQ,KAAK,IAAwB,CAAC,GAAG;AAZvD,0BAAkC,CAAC;AAEnC,gBAAiB,CAAC;AAElB,gCAA+B;AAE/B,oBAAW;AAcX;AAAA;AAAA;AAAA,sBAAa,CAAC,MAAc,mBAAmB,MAAM;AACnD,YAAM,SAAS,KAAK,qBAAqB,OAAO,gBAAgB;AAChE,aAAO,GAAG,MAAM,GAAG,IAAI;AAAA,IACzB;AAKA;AAAA;AAAA;AAAA,mBAAU,CAAC,MAAc,qBAA8B;AACrD,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,QAAQ,OAAO;AAAA,IAC3B;AAKA;AAAA;AAAA;AAAA,gBAAO,CAAC,MAAc,qBAA8B;AAClD,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,KAAK,OAAO;AAAA,IACxB;AAKA;AAAA;AAAA;AAAA,iBAAQ,MAAM;AACZ,WAAK,KAAK,KAAK,EAAE;AAAA,IACnB;AAKA;AAAA;AAAA;AAAA,gBAAO,MAAM;AACX,YAAM,iBAAiB,KAAK,KAAK,KAAK,KAAK,QAAQ;AACnD,YAAM,iBAAiB,KAAK,eAAe,OAAO,CAAC,aAAa,aAAa,SAAS,WAAW,GAAG,cAAc;AAClH,aAAO;AAAA,IACT;AAMA;AAAA;AAAA;AAAA;AAAA,4BAAmB,CAAC,kBAAiC;AACnD,WAAK,iBAAiB,CAAC,GAAG,KAAK,gBAAgB,aAAa;AAAA,IAC9D;AAlDE,SAAK,uBAAuB,UAAU;AACtC,SAAK,WAAW,QAAQ;AAAA,EAC1B;AAiDF","sourcesContent":["const DEFAULT_INDENTATION_CHARACTER = '';\nconst DEFAULT_LINE_JOIN = '\\n';\n\nexport type PostProcessor = (unreplacedCode: string) => string;\n\nexport interface CodeBuilderOptions {\n /**\n * Desired indentation character for aggregated lines of code\n * @default ''\n */\n indent?: string;\n\n /**\n * Desired character to join each line of code\n * @default \\n\n */\n join?: string;\n}\n\nexport class CodeBuilder {\n postProcessors: PostProcessor[] = [];\n\n code: string[] = [];\n\n indentationCharacter: string = DEFAULT_INDENTATION_CHARACTER;\n\n lineJoin = DEFAULT_LINE_JOIN;\n\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join }: CodeBuilderOptions = {}) {\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;\n this.lineJoin = join ?? DEFAULT_LINE_JOIN;\n }\n\n /**\n * Add given indentation level to given line of code\n */\n indentLine = (line: string, indentationLevel = 0) => {\n const indent = this.indentationCharacter.repeat(indentationLevel);\n return `${indent}${line}`;\n };\n\n /**\n * Add the line at the beginning of the current lines\n */\n unshift = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.unshift(newLine);\n };\n\n /**\n * Add the line at the end of the current lines\n */\n push = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.push(newLine);\n };\n\n /**\n * Add an empty line at the end of current lines\n */\n blank = () => {\n this.code.push('');\n };\n\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n join = () => {\n const unreplacedCode = this.code.join(this.lineJoin);\n const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);\n return replacedOutput;\n };\n\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n addPostProcessor = (postProcessor: PostProcessor) => {\n this.postProcessors = [...this.postProcessors, postProcessor];\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/helpers/code-builder.ts"],"names":[],"mappings":";AAAA,IAAM,6BAAgC,GAAA,EAAA,CAAA;AACtC,IAAM,iBAAoB,GAAA,IAAA,CAAA;AAkBnB,IAAM,cAAN,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAavB,YAAY,EAAE,MAAA,EAAQ,IAAK,EAAA,GAAwB,EAAI,EAAA;AAZvD,IAAA,IAAA,CAAA,cAAA,GAAkC,EAAC,CAAA;AAEnC,IAAA,IAAA,CAAA,IAAA,GAAiB,E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AAO,CAAA,CAAC,aAAa,QAAa,KAAA,QAAA,CAAS,WAAW,CAAA,EAAG,cAAc,CAAA,CAAA;AAClH,MAAO,OAAA,cAAA,CAAA;AAAA,KACT,CAAA;AAMA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,gBAAA,GAAmB,CAAC,aAAiC,KAAA;AACnD,MAAA,IAAA,CAAK,cAAiB,GAAA,CAAC,GAAG,IAAA,CAAK,gBAAgB,aAAa,CAAA,CAAA;AAAA,KAC9D,CAAA;AAlDE,IAAA,IAAA,CAAK,uBAAuB,MAAU,IAAA,6BAAA,CAAA;AACtC,IAAA,IAAA,CAAK,WAAW,IAAQ,IAAA,iBAAA,CAAA;AAAA,GAC1B;AAiDF","file":"chunk-Y7NI4MMY.js","sourcesContent":["const DEFAULT_INDENTATION_CHARACTER = '';\nconst DEFAULT_LINE_JOIN = '\\n';\n\nexport type PostProcessor = (unreplacedCode: string) => string;\n\nexport interface CodeBuilderOptions {\n /**\n * Desired indentation character for aggregated lines of code\n * @default ''\n */\n indent?: string;\n\n /**\n * Desired character to join each line of code\n * @default \\n\n */\n join?: string;\n}\n\nexport class CodeBuilder {\n postProcessors: PostProcessor[] = [];\n\n code: string[] = [];\n\n indentationCharacter: string = DEFAULT_INDENTATION_CHARACTER;\n\n lineJoin = DEFAULT_LINE_JOIN;\n\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join }: CodeBuilderOptions = {}) {\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;\n this.lineJoin = join ?? DEFAULT_LINE_JOIN;\n }\n\n /**\n * Add given indentation level to given line of code\n */\n indentLine = (line: string, indentationLevel = 0) => {\n const indent = this.indentationCharacter.repeat(indentationLevel);\n return `${indent}${line}`;\n };\n\n /**\n * Add the line at the beginning of the current lines\n */\n unshift = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.unshift(newLine);\n };\n\n /**\n * Add the line at the end of the current lines\n */\n push = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.push(newLine);\n };\n\n /**\n * Add an empty line at the end of current lines\n */\n blank = () => {\n this.code.push('');\n };\n\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n join = () => {\n const unreplacedCode = this.code.join(this.lineJoin);\n const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);\n return replacedOutput;\n };\n\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n addPostProcessor = (postProcessor: PostProcessor) => {\n this.postProcessors = [...this.postProcessors, postProcessor];\n };\n}\n"]}
@@ -61,5 +61,5 @@ var CodeBuilder = class {
61
61
  };
62
62
 
63
63
  exports.CodeBuilder = CodeBuilder;
64
- //# sourceMappingURL=out.js.map
64
+ //# sourceMappingURL=code-builder.cjs.map
65
65
  //# sourceMappingURL=code-builder.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/code-builder.ts"],"names":[],"mappings":";AAAA,IAAM,gCAAgC;AACtC,IAAM,oBAAoB;AAkBnB,IAAM,cAAN,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAavB,YAAY,EAAE,QAAQ,KAAK,IAAwB,CAAC,GAAG;AAZvD,0BAAkC,CAAC;AAEnC,gBAAiB,CAAC;AAElB,gCAA+B;AAE/B,oBAAW;AAcX;AAAA;AAAA;AAAA,sBAAa,CAAC,MAAc,mBAAmB,MAAM;AACnD,YAAM,SAAS,KAAK,qBAAqB,OAAO,gBAAgB;AAChE,aAAO,GAAG,MAAM,GAAG,IAAI;AAAA,IACzB;AAKA;AAAA;AAAA;AAAA,mBAAU,CAAC,MAAc,qBAA8B;AACrD,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,QAAQ,OAAO;AAAA,IAC3B;AAKA;AAAA;AAAA;AAAA,gBAAO,CAAC,MAAc,qBAA8B;AAClD,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,KAAK,OAAO;AAAA,IACxB;AAKA;AAAA;AAAA;AAAA,iBAAQ,MAAM;AACZ,WAAK,KAAK,KAAK,EAAE;AAAA,IACnB;AAKA;AAAA;AAAA;AAAA,gBAAO,MAAM;AACX,YAAM,iBAAiB,KAAK,KAAK,KAAK,KAAK,QAAQ;AACnD,YAAM,iBAAiB,KAAK,eAAe,OAAO,CAAC,aAAa,aAAa,SAAS,WAAW,GAAG,cAAc;AAClH,aAAO;AAAA,IACT;AAMA;AAAA;AAAA;AAAA;AAAA,4BAAmB,CAAC,kBAAiC;AACnD,WAAK,iBAAiB,CAAC,GAAG,KAAK,gBAAgB,aAAa;AAAA,IAC9D;AAlDE,SAAK,uBAAuB,UAAU;AACtC,SAAK,WAAW,QAAQ;AAAA,EAC1B;AAiDF","sourcesContent":["const DEFAULT_INDENTATION_CHARACTER = '';\nconst DEFAULT_LINE_JOIN = '\\n';\n\nexport type PostProcessor = (unreplacedCode: string) => string;\n\nexport interface CodeBuilderOptions {\n /**\n * Desired indentation character for aggregated lines of code\n * @default ''\n */\n indent?: string;\n\n /**\n * Desired character to join each line of code\n * @default \\n\n */\n join?: string;\n}\n\nexport class CodeBuilder {\n postProcessors: PostProcessor[] = [];\n\n code: string[] = [];\n\n indentationCharacter: string = DEFAULT_INDENTATION_CHARACTER;\n\n lineJoin = DEFAULT_LINE_JOIN;\n\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join }: CodeBuilderOptions = {}) {\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;\n this.lineJoin = join ?? DEFAULT_LINE_JOIN;\n }\n\n /**\n * Add given indentation level to given line of code\n */\n indentLine = (line: string, indentationLevel = 0) => {\n const indent = this.indentationCharacter.repeat(indentationLevel);\n return `${indent}${line}`;\n };\n\n /**\n * Add the line at the beginning of the current lines\n */\n unshift = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.unshift(newLine);\n };\n\n /**\n * Add the line at the end of the current lines\n */\n push = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.push(newLine);\n };\n\n /**\n * Add an empty line at the end of current lines\n */\n blank = () => {\n this.code.push('');\n };\n\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n join = () => {\n const unreplacedCode = this.code.join(this.lineJoin);\n const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);\n return replacedOutput;\n };\n\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n addPostProcessor = (postProcessor: PostProcessor) => {\n this.postProcessors = [...this.postProcessors, postProcessor];\n };\n}\n"]}
1
+ {"version":3,"sources":["../../src/helpers/code-builder.ts"],"names":[],"mappings":";;;AAAA,IAAM,6BAAgC,GAAA,EAAA,CAAA;AACtC,IAAM,iBAAoB,GAAA,IAAA,CAAA;AAkBnB,IAAM,cAAN,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAavB,YAAY,EAAE,MAAA,EAAQ,IAAK,EAAA,GAAwB,EAAI,EAAA;AAZvD,IAAA,IAAA,CAAA,cAAA,GAAkC,EAAC,CAAA;AAEnC,IAAA,IAAA,CAAA,IAAA,GAAiB,EAAC,CAAA;AAElB,IAA+B,IAAA,CAAA,oBAAA,GAAA,6BAAA,CAAA;AAE/B,IAAW,IAAA,CAAA,QAAA,GAAA,iBAAA,CAAA;AAcX;AAAA;AAAA;AAAA,IAAa,IAAA,CAAA,UAAA,GAAA,CAAC,IAAc,EAAA,gBAAA,GAAmB,CAAM,KAAA;AACnD,MAAA,M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AAA,CAAK,cAAiB,GAAA,CAAC,GAAG,IAAA,CAAK,gBAAgB,aAAa,CAAA,CAAA;AAAA,KAC9D,CAAA;AAlDE,IAAA,IAAA,CAAK,uBAAuB,MAAU,IAAA,6BAAA,CAAA;AACtC,IAAA,IAAA,CAAK,WAAW,IAAQ,IAAA,iBAAA,CAAA;AAAA,GAC1B;AAiDF","file":"code-builder.cjs","sourcesContent":["const DEFAULT_INDENTATION_CHARACTER = '';\nconst DEFAULT_LINE_JOIN = '\\n';\n\nexport type PostProcessor = (unreplacedCode: string) => string;\n\nexport interface CodeBuilderOptions {\n /**\n * Desired indentation character for aggregated lines of code\n * @default ''\n */\n indent?: string;\n\n /**\n * Desired character to join each line of code\n * @default \\n\n */\n join?: string;\n}\n\nexport class CodeBuilder {\n postProcessors: PostProcessor[] = [];\n\n code: string[] = [];\n\n indentationCharacter: string = DEFAULT_INDENTATION_CHARACTER;\n\n lineJoin = DEFAULT_LINE_JOIN;\n\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join }: CodeBuilderOptions = {}) {\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;\n this.lineJoin = join ?? DEFAULT_LINE_JOIN;\n }\n\n /**\n * Add given indentation level to given line of code\n */\n indentLine = (line: string, indentationLevel = 0) => {\n const indent = this.indentationCharacter.repeat(indentationLevel);\n return `${indent}${line}`;\n };\n\n /**\n * Add the line at the beginning of the current lines\n */\n unshift = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.unshift(newLine);\n };\n\n /**\n * Add the line at the end of the current lines\n */\n push = (line: string, indentationLevel?: number) => {\n const newLine = this.indentLine(line, indentationLevel);\n this.code.push(newLine);\n };\n\n /**\n * Add an empty line at the end of current lines\n */\n blank = () => {\n this.code.push('');\n };\n\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n join = () => {\n const unreplacedCode = this.code.join(this.lineJoin);\n const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);\n return replacedOutput;\n };\n\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n addPostProcessor = (postProcessor: PostProcessor) => {\n this.postProcessors = [...this.postProcessors, postProcessor];\n };\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  export { CodeBuilder } from '../chunk-Y7NI4MMY.js';
2
- //# sourceMappingURL=out.js.map
2
+ //# sourceMappingURL=code-builder.js.map
3
3
  //# sourceMappingURL=code-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"code-builder.js"}
@@ -16,5 +16,5 @@ var reducer = (accumulator, pair) => {
16
16
  };
17
17
 
18
18
  exports.reducer = reducer;
19
- //# sourceMappingURL=out.js.map
19
+ //# sourceMappingURL=reducer.cjs.map
20
20
  //# sourceMappingURL=reducer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/helpers/reducer.ts"],"names":[],"mappings":";AAEO,IAAM,UAAU,CAA4C,aAAkC,SAAY;AAC/G,QAAM,eAAe,YAAY,KAAK,IAAI;AAC1C,MAAI,iBAAiB,QAAW;AAC9B,gBAAY,KAAK,IAAI,IAAI,KAAK;AAC9B,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,YAAY,GAAG;AAC/B,iBAAa,KAAK,KAAK,KAAK;AAC5B,WAAO;AAAA,EACT;AAGA,cAAY,KAAK,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;AAClD,SAAO;AACT","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
1
+ {"version":3,"sources":["../../src/helpers/reducer.ts"],"names":[],"mappings":";;;AAEa,IAAA,OAAA,GAAU,CAA4C,WAAA,EAAkC,IAAY,KAAA;AAC/G,EAAM,MAAA,YAAA,GAAe,WAAY,CAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAC1C,EAAA,IAAI,iBAAiB,KAAW,CAAA,EAAA;AAC9B,IAAY,WAAA,CAAA,IAAA,CAAK,IAAI,CAAA,GAAI,IAAK,CAAA,KAAA,CAAA;AAC9B,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AAGA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,YAAY,CAAG,EAAA;AAC/B,IAAa,YAAA,CAAA,IAAA,CAAK,KAAK,KAAK,CAAA,CAAA;AAC5B,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AAGA,EAAA,WAAA,CAAY,KAAK,IAAI,CAAA,GAAI,CAAC,YAAA,EAAc,KAAK,KAAK,CAAA,CAAA;AAClD,EAAO,OAAA,WAAA,CAAA;AACT","file":"reducer.cjs","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  export { reducer } from '../chunk-KT7MO6Z4.js';
2
- //# sourceMappingURL=out.js.map
2
+ //# sourceMappingURL=reducer.js.map
3
3
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"reducer.js"}
@@ -58,7 +58,7 @@ declare const targets: {
58
58
  };
59
59
  declare const isTarget: (target: Target) => target is Target;
60
60
  declare const addTarget: (target: Target) => void;
61
- declare const isClient: (client: Client) => client is Client<Record<string, any>>;
61
+ declare const isClient: (client: Client) => client is Client;
62
62
  declare const addClientPlugin: (plugin: ClientPlugin) => void;
63
63
  declare const addTargetClient: (targetId: TargetId, client: Client) => void;
64
64
 
@@ -147,12 +147,12 @@ declare class HTTPSnippet {
147
147
  bodySize: number;
148
148
  comment?: string | undefined;
149
149
  postData: PostDataCommon & {
150
- params?: Param[] | undefined;
151
- text?: string | undefined;
150
+ params?: Param[];
151
+ text?: string;
152
152
  } & {
153
- boundary?: string | undefined;
154
- jsonObj?: ReducedHelperObject | undefined;
155
- paramsObj?: ReducedHelperObject | undefined;
153
+ boundary?: string;
154
+ jsonObj?: ReducedHelperObject;
155
+ paramsObj?: ReducedHelperObject;
156
156
  };
157
157
  cookiesObj: ReducedHelperObject;
158
158
  headersObj: ReducedHelperObject;
@@ -58,7 +58,7 @@ declare const targets: {
58
58
  };
59
59
  declare const isTarget: (target: Target) => target is Target;
60
60
  declare const addTarget: (target: Target) => void;
61
- declare const isClient: (client: Client) => client is Client<Record<string, any>>;
61
+ declare const isClient: (client: Client) => client is Client;
62
62
  declare const addClientPlugin: (plugin: ClientPlugin) => void;
63
63
  declare const addTargetClient: (targetId: TargetId, client: Client) => void;
64
64
 
@@ -147,12 +147,12 @@ declare class HTTPSnippet {
147
147
  bodySize: number;
148
148
  comment?: string | undefined;
149
149
  postData: PostDataCommon & {
150
- params?: Param[] | undefined;
151
- text?: string | undefined;
150
+ params?: Param[];
151
+ text?: string;
152
152
  } & {
153
- boundary?: string | undefined;
154
- jsonObj?: ReducedHelperObject | undefined;
155
- paramsObj?: ReducedHelperObject | undefined;
153
+ boundary?: string;
154
+ jsonObj?: ReducedHelperObject;
155
+ paramsObj?: ReducedHelperObject;
156
156
  };
157
157
  cookiesObj: ReducedHelperObject;
158
158
  headersObj: ReducedHelperObject;
package/dist/index.cjs CHANGED
@@ -548,8 +548,7 @@ var restsharp = {
548
548
  });
549
549
  switch (postData.mimeType) {
550
550
  case "multipart/form-data":
551
- if (!postData.params)
552
- break;
551
+ if (!postData.params) break;
553
552
  postData.params.forEach((param) => {
554
553
  if (param.fileName) {
555
554
  push(`request.AddFile("${param.name}", "${param.fileName}");`);
@@ -559,22 +558,19 @@ var restsharp = {
559
558
  });
560
559
  break;
561
560
  case "application/x-www-form-urlencoded":
562
- if (!postData.params)
563
- break;
561
+ if (!postData.params) break;
564
562
  postData.params.forEach((param) => {
565
563
  push(`request.AddParameter("${param.name}", "${param.value}");`);
566
564
  });
567
565
  break;
568
566
  case "application/json": {
569
- if (!postData.text)
570
- break;
567
+ if (!postData.text) break;
571
568
  const text = JSON.stringify(postData.text);
572
569
  push(`request.AddJsonBody(${text}, false);`);
573
570
  break;
574
571
  }
575
572
  default:
576
- if (!postData.text)
577
- break;
573
+ if (!postData.text) break;
578
574
  push(`request.AddStringBody("${postData.text}", "${postData.mimeType}");`);
579
575
  }
580
576
  push(`var response = await client.${title(method)}Async(request);
@@ -3768,5 +3764,5 @@ exports.addTarget = addTarget;
3768
3764
  exports.addTargetClient = addTargetClient;
3769
3765
  exports.availableTargets = availableTargets;
3770
3766
  exports.extname = extname;
3771
- //# sourceMappingURL=out.js.map
3767
+ //# sourceMappingURL=index.cjs.map
3772
3768
  //# sourceMappingURL=index.cjs.map