@stuntman/shared 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stuntman/shared",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Stuntman - HTTP proxy / mock shared types and utils",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -33,18 +33,16 @@
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
35
  "config": "3.3.9",
36
- "defaults": "1.0.4",
37
36
  "pino": "8.10.0"
38
37
  },
39
38
  "devDependencies": {
40
- "@types/config": "3.3.0",
41
- "@types/defaults": "1.0.3"
39
+ "@types/config": "3.3.0"
42
40
  },
43
41
  "scripts": {
44
42
  "test": "echo \"Error: no test specified\" && exit 1",
45
43
  "clean": "rm -fr dist",
46
44
  "build": "tsc",
47
45
  "lint": "prettier --check . && eslint . --ext ts",
48
- "lint:fix": "prettier --write ./src && eslint ./src --ext ts --fix"
46
+ "lint:fix": "prettier --write ./{src,test} && eslint ./{src,test} --ext ts --fix"
49
47
  }
50
48
  }
package/src/config.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import {
2
- RecursivePartial,
3
2
  ServerConfig,
4
3
  DEFAULT_API_PORT,
5
4
  DEFAULT_MOCK_DOMAIN,
@@ -11,7 +10,7 @@ import {
11
10
  DEFAULT_CACHE_TTL,
12
11
  } from '.';
13
12
  import config from 'config';
14
- import defaults from 'defaults';
13
+ import path from 'path';
15
14
 
16
15
  // TODO safeguards & defaults
17
16
 
@@ -19,12 +18,15 @@ const defaultConfig: ServerConfig = {
19
18
  api: {
20
19
  disabled: false,
21
20
  port: DEFAULT_API_PORT,
21
+ apiKeyReadOnly: null,
22
+ apiKeyReadWrite: null,
22
23
  },
23
24
  mock: {
24
25
  domain: DEFAULT_MOCK_DOMAIN,
25
26
  externalDns: EXTERNAL_DNS,
26
27
  port: DEFAULT_MOCK_PORT,
27
28
  timeout: DEFAULT_PROXY_TIMEOUT,
29
+ rulesPath: path.join(process.cwd(), 'rules'),
28
30
  },
29
31
  storage: {
30
32
  traffic: {
@@ -38,12 +40,14 @@ const defaultConfig: ServerConfig = {
38
40
  },
39
41
  };
40
42
 
41
- let configFromFile: RecursivePartial<ServerConfig> = {};
43
+ config.util.setModuleDefaults('stuntman', defaultConfig);
44
+
45
+ let configFromFile = {} as ServerConfig;
42
46
  try {
43
- configFromFile = config.get<RecursivePartial<ServerConfig>>('stuntman');
47
+ configFromFile = config.get<ServerConfig>('stuntman');
44
48
  } catch (error) {
45
49
  // eslint-disable-next-line no-console
46
50
  console.warn('unable to find correct config - starting with defaults');
47
51
  }
48
52
 
49
- export const serverConfig = defaults(configFromFile, defaultConfig) as ServerConfig;
53
+ export const serverConfig = configFromFile;
package/src/index.ts CHANGED
@@ -166,6 +166,8 @@ export type WebGuiConfig = {
166
166
  export type ApiConfig = {
167
167
  port: number;
168
168
  disabled: boolean;
169
+ apiKeyReadWrite: string | null;
170
+ apiKeyReadOnly: string | null;
169
171
  };
170
172
 
171
173
  export type ClientConfig = {
@@ -183,6 +185,7 @@ export type MockConfig = {
183
185
  httpsCert?: string;
184
186
  timeout: number;
185
187
  externalDns: string[];
188
+ rulesPath: string;
186
189
  };
187
190
 
188
191
  export type StorageConfig = {
@@ -0,0 +1 @@
1
+ // TODO
package/tsconfig.json CHANGED
@@ -11,6 +11,12 @@
11
11
  "skipLibCheck": true,
12
12
  "typeRoots": ["node_modules/@types"],
13
13
  "allowJs": true,
14
- "moduleResolution": "node16"
15
- }
14
+ "moduleResolution": "node16",
15
+ "types": ["node", "jest"]
16
+ },
17
+ "exclude": [
18
+ "jest.config.js",
19
+ "./dist/**",
20
+ "./test/**"
21
+ ]
16
22
  }
@@ -1,14 +0,0 @@
1
- import type * as Stuntman from '.';
2
- export interface AppErrorInterface {
3
- name?: string;
4
- httpCode: Stuntman.HttpCode;
5
- message: string;
6
- isOperational?: boolean;
7
- }
8
- export declare class AppError extends Error {
9
- readonly name: string;
10
- readonly httpCode: Stuntman.HttpCode;
11
- readonly uuid?: string;
12
- readonly isOperational: boolean;
13
- constructor(args: AppErrorInterface);
14
- }
package/dist/appError.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppError = void 0;
4
- class AppError extends Error {
5
- constructor(args) {
6
- super(args.message);
7
- this.isOperational = true;
8
- Object.setPrototypeOf(this, new.target.prototype);
9
- this.name = args.name || 'Error';
10
- this.httpCode = args.httpCode;
11
- if (args.isOperational !== undefined) {
12
- this.isOperational = args.isOperational;
13
- }
14
- Error.captureStackTrace(this);
15
- }
16
- }
17
- exports.AppError = AppError;
package/dist/config.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { ServerConfig } from '.';
2
- export declare const serverConfig: ServerConfig;
package/dist/config.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.serverConfig = void 0;
7
- const _1 = require(".");
8
- const config_1 = __importDefault(require("config"));
9
- const defaults_1 = __importDefault(require("defaults"));
10
- // TODO safeguards & defaults
11
- const defaultConfig = {
12
- api: {
13
- disabled: false,
14
- port: _1.DEFAULT_API_PORT,
15
- },
16
- mock: {
17
- domain: _1.DEFAULT_MOCK_DOMAIN,
18
- externalDns: _1.EXTERNAL_DNS,
19
- port: _1.DEFAULT_MOCK_PORT,
20
- timeout: _1.DEFAULT_PROXY_TIMEOUT,
21
- },
22
- storage: {
23
- traffic: {
24
- limitCount: _1.DEFAULT_CACHE_MAX_ENTRIES,
25
- limitSize: _1.DEFAULT_CACHE_MAX_SIZE,
26
- ttl: _1.DEFAULT_CACHE_TTL,
27
- },
28
- },
29
- webgui: {
30
- disabled: false,
31
- },
32
- };
33
- let configFromFile = {};
34
- try {
35
- configFromFile = config_1.default.get('stuntman');
36
- }
37
- catch (error) {
38
- // eslint-disable-next-line no-console
39
- console.warn('unable to find correct config - starting with defaults');
40
- }
41
- exports.serverConfig = (0, defaults_1.default)(configFromFile, defaultConfig);
@@ -1,14 +0,0 @@
1
- export declare const DEFAULT_PROXY_TIMEOUT = 60000;
2
- export declare const DEFAULT_RULE_PRIORITY = 100;
3
- export declare const DEFAULT_MOCK_PORT = 2015;
4
- export declare const DEFAULT_API_PORT = 1985;
5
- export declare const DEFAULT_CACHE_MAX_ENTRIES = 500;
6
- export declare const DEFAULT_CACHE_MAX_SIZE: number;
7
- export declare const DEFAULT_CACHE_TTL: number;
8
- export declare const DEFAULT_MOCK_DOMAIN = "stuntman";
9
- export declare const DEFAULT_RULE_TTL_SECONDS: number;
10
- export declare const MIN_RULE_TTL_SECONDS = 10;
11
- export declare const MAX_RULE_TTL_SECONDS: number;
12
- export declare const CATCH_ALL_RULE_PRIORITY: number;
13
- export declare const CATCH_RULE_NAME = "internal/catch-all";
14
- export declare const EXTERNAL_DNS: string[];
package/dist/constants.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EXTERNAL_DNS = exports.CATCH_RULE_NAME = exports.CATCH_ALL_RULE_PRIORITY = exports.MAX_RULE_TTL_SECONDS = exports.MIN_RULE_TTL_SECONDS = exports.DEFAULT_RULE_TTL_SECONDS = exports.DEFAULT_MOCK_DOMAIN = exports.DEFAULT_CACHE_TTL = exports.DEFAULT_CACHE_MAX_SIZE = exports.DEFAULT_CACHE_MAX_ENTRIES = exports.DEFAULT_API_PORT = exports.DEFAULT_MOCK_PORT = exports.DEFAULT_RULE_PRIORITY = exports.DEFAULT_PROXY_TIMEOUT = void 0;
4
- exports.DEFAULT_PROXY_TIMEOUT = 60000;
5
- exports.DEFAULT_RULE_PRIORITY = 100;
6
- exports.DEFAULT_MOCK_PORT = 2015;
7
- exports.DEFAULT_API_PORT = 1985;
8
- exports.DEFAULT_CACHE_MAX_ENTRIES = 500;
9
- exports.DEFAULT_CACHE_MAX_SIZE = 500 * 1024 * 1024;
10
- exports.DEFAULT_CACHE_TTL = 1000 * 60 * 60;
11
- exports.DEFAULT_MOCK_DOMAIN = 'stuntman';
12
- exports.DEFAULT_RULE_TTL_SECONDS = 60 * 10;
13
- exports.MIN_RULE_TTL_SECONDS = 10;
14
- exports.MAX_RULE_TTL_SECONDS = 60 * 60;
15
- exports.CATCH_ALL_RULE_PRIORITY = Infinity;
16
- exports.CATCH_RULE_NAME = 'internal/catch-all';
17
- exports.EXTERNAL_DNS = ['8.8.8.8', '1.1.1.1'];
package/dist/index.d.ts DELETED
@@ -1,163 +0,0 @@
1
- export * from './constants';
2
- export * from './appError';
3
- export * from './logger';
4
- export * from './stringify';
5
- export * from './rawHeaders';
6
- export * from './config';
7
- export declare const INDEX_DTS: string;
8
- type NonObject = string | number | boolean | symbol | undefined | null | any[];
9
- interface SerializableTypesRecord<T> {
10
- [k: string | number]: T;
11
- }
12
- export type RecursivePartial<T> = {
13
- [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
14
- };
15
- type SerializableTypes = string | number | boolean | undefined | null | RegExp | SerializableTypes[] | SerializableTypesRecord<SerializableTypes>;
16
- export declare enum HttpCode {
17
- OK = 200,
18
- NO_CONTENT = 204,
19
- BAD_REQUEST = 400,
20
- UNAUTHORIZED = 401,
21
- NOT_FOUND = 404,
22
- CONFLICT = 409,
23
- UNPROCESSABLE_ENTITY = 422,
24
- INTERNAL_SERVER_ERROR = 500
25
- }
26
- export type LocalVariables = Record<string, SerializableTypes>;
27
- export type RuleMatchResult = boolean | {
28
- result: boolean;
29
- enableRuleIds?: string[];
30
- disableRuleIds?: string[];
31
- description?: string;
32
- };
33
- export type RemotableFunction<T extends Function> = {
34
- localFn: T;
35
- localVariables?: LocalVariables;
36
- };
37
- export type SerializedRemotableFunction = {
38
- localFn: string;
39
- variable?: string;
40
- remoteFn: string;
41
- };
42
- type WithRemotableFunctions<Type> = {
43
- [PropertyKey in keyof Type]: Extract<Type[PropertyKey], Function> extends never ? Exclude<Type[PropertyKey], NonObject> extends never ? Type[PropertyKey] : WithRemotableFunctions<Exclude<Type[PropertyKey], NonObject>> : Exclude<Type[PropertyKey], Function> | RemotableFunction<Extract<Type[PropertyKey], Function>>;
44
- };
45
- export type WithSerializedFunctions<Type> = {
46
- [PropertyKey in keyof Type]: Extract<Type[PropertyKey], RemotableFunction<Function>> extends never ? Exclude<Type[PropertyKey], NonObject> extends never ? Type[PropertyKey] : WithSerializedFunctions<Exclude<Type[PropertyKey], NonObject>> : Exclude<Type[PropertyKey], RemotableFunction<Function>> | SerializedRemotableFunction;
47
- };
48
- export interface RawHeadersInterface extends Array<string> {
49
- get: (name: string) => string | undefined;
50
- set: (name: string, value: string) => void;
51
- has: (name: string, value?: string) => boolean;
52
- add: (name: string, value: string) => void;
53
- remove: (name: string) => void;
54
- toHeaderPairs: () => readonly [string, string][];
55
- }
56
- export type BaseRequest = {
57
- rawHeaders: RawHeadersInterface;
58
- url: string;
59
- body?: any;
60
- method: string;
61
- };
62
- export type Request = BaseRequest & {
63
- id: string;
64
- timestamp: number;
65
- gqlBody?: GQLRequestBody;
66
- };
67
- export type Response = {
68
- rawHeaders?: RawHeadersInterface;
69
- status?: number;
70
- body?: any;
71
- timestamp?: number;
72
- };
73
- export type LogEntry = {
74
- originalRequest: Request;
75
- labels?: string[];
76
- mockRuleId?: string;
77
- originalResponse?: Response;
78
- modifiedRequest?: Request;
79
- modifiedResponse?: Response;
80
- };
81
- export type RuleMatchFunction = (request: Request) => RuleMatchResult;
82
- export type RequestManipulationFn = (request: Request) => Request;
83
- export type ResponseManipulationFn = (request: Request, response: Response) => Response;
84
- export type ResponseGenerationFn = (request: Request) => Response;
85
- export type Actions = {
86
- mockResponse: Response | ResponseGenerationFn;
87
- modifyRequest?: undefined;
88
- modifyResponse?: undefined;
89
- } | {
90
- mockResponse?: undefined;
91
- modifyRequest?: RequestManipulationFn;
92
- modifyResponse?: ResponseManipulationFn;
93
- };
94
- export type Rule = {
95
- id: string;
96
- priority?: number;
97
- matches: RuleMatchFunction;
98
- labels?: string[];
99
- actions?: Actions;
100
- disableAfterUse?: boolean | number;
101
- removeAfterUse?: boolean | number;
102
- ttlSeconds: number;
103
- storeTraffic?: boolean;
104
- isEnabled?: boolean;
105
- };
106
- export type DeployedRule = Omit<Rule, 'disableAfterUse' | 'removeAfterUse' | 'ttlSeconds'>;
107
- export type SerializableRule = WithRemotableFunctions<Rule>;
108
- export type SerializedRule = WithSerializedFunctions<SerializableRule>;
109
- export type LiveRule = Rule & {
110
- counter: number;
111
- createdTimestamp: number;
112
- };
113
- export type GQLRequestBody = {
114
- operationName: string;
115
- variables?: any;
116
- query: string;
117
- type: 'query' | 'mutation';
118
- methodName?: string;
119
- };
120
- export type WebGuiConfig = {
121
- disabled: boolean;
122
- };
123
- export type ApiConfig = {
124
- port: number;
125
- disabled: boolean;
126
- };
127
- export type ClientConfig = {
128
- protocol?: 'http' | 'https';
129
- host?: string;
130
- port?: number;
131
- timeout?: number;
132
- };
133
- export type MockConfig = {
134
- domain: string;
135
- port: number;
136
- httpsPort?: number;
137
- httpsKey?: string;
138
- httpsCert?: string;
139
- timeout: number;
140
- externalDns: string[];
141
- };
142
- export type StorageConfig = {
143
- limitCount: number;
144
- limitSize: number;
145
- ttl: number;
146
- };
147
- export type ServerConfig = {
148
- webgui: WebGuiConfig;
149
- api: ApiConfig;
150
- mock: MockConfig;
151
- storage: {
152
- traffic: StorageConfig;
153
- };
154
- };
155
- export interface RuleExecutorInterface {
156
- addRule: (rule: Rule, overwrite?: boolean) => Promise<LiveRule>;
157
- removeRule: (id: string) => Promise<void>;
158
- enableRule: (id: string) => void;
159
- disableRule: (id: string) => void;
160
- findMatchingRule: (request: Request) => Promise<LiveRule | null>;
161
- getRules: () => Promise<readonly LiveRule[]>;
162
- getRule: (id: string) => Promise<LiveRule | undefined>;
163
- }
package/dist/index.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.HttpCode = exports.INDEX_DTS = void 0;
21
- /* eslint-disable @typescript-eslint/ban-types */
22
- __exportStar(require("./constants"), exports);
23
- __exportStar(require("./appError"), exports);
24
- __exportStar(require("./logger"), exports);
25
- __exportStar(require("./stringify"), exports);
26
- __exportStar(require("./rawHeaders"), exports);
27
- __exportStar(require("./config"), exports);
28
- const fs_1 = __importDefault(require("fs"));
29
- exports.INDEX_DTS = fs_1.default.readFileSync(`${__dirname}/index.d.ts`, 'utf-8');
30
- var HttpCode;
31
- (function (HttpCode) {
32
- HttpCode[HttpCode["OK"] = 200] = "OK";
33
- HttpCode[HttpCode["NO_CONTENT"] = 204] = "NO_CONTENT";
34
- HttpCode[HttpCode["BAD_REQUEST"] = 400] = "BAD_REQUEST";
35
- HttpCode[HttpCode["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
36
- HttpCode[HttpCode["NOT_FOUND"] = 404] = "NOT_FOUND";
37
- HttpCode[HttpCode["CONFLICT"] = 409] = "CONFLICT";
38
- HttpCode[HttpCode["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
39
- HttpCode[HttpCode["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
40
- })(HttpCode = exports.HttpCode || (exports.HttpCode = {}));
package/dist/logger.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare const logger: import("pino").Logger<{
2
- level: string;
3
- messageKey: string;
4
- formatters: {
5
- level(label: string): {
6
- level: string;
7
- };
8
- };
9
- }>;
package/dist/logger.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- var _a;
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.logger = void 0;
8
- const pino_1 = __importDefault(require("pino"));
9
- exports.logger = (0, pino_1.default)({
10
- level: (_a = process.env.LOG_LEVEL) !== null && _a !== void 0 ? _a : 'info',
11
- messageKey: 'message',
12
- formatters: {
13
- level(label) {
14
- return { level: label };
15
- },
16
- },
17
- });
@@ -1,12 +0,0 @@
1
- import type * as Stuntman from '.';
2
- export declare class RawHeaders extends Array<string> implements Stuntman.RawHeadersInterface {
3
- get(name: string): string | undefined;
4
- has(name: string, value?: string): boolean;
5
- set(name: string, value: string): void;
6
- add(name: string, value: string): void;
7
- remove(name: string): void;
8
- toHeaderPairs(): readonly [string, string][];
9
- static fromHeaderPairs(headerPairs: [string, string][]): RawHeaders;
10
- static fromHeadersRecord(headersRecord: Record<string, string | string[] | undefined>): RawHeaders;
11
- static toHeaderPairs(rawHeaders: string[]): readonly [string, string][];
12
- }
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RawHeaders = void 0;
4
- class RawHeaders extends Array {
5
- get(name) {
6
- const headers = this.toHeaderPairs();
7
- const matchingHeaders = headers.filter((h) => h[0].toLowerCase() === name.toLowerCase());
8
- if (matchingHeaders.length === 0) {
9
- return;
10
- }
11
- if (matchingHeaders.length === 1) {
12
- return matchingHeaders[0][1];
13
- }
14
- throw new Error('Multiple headers with same name. Manipulate rawHeaders instead');
15
- }
16
- has(name, value) {
17
- const foundValue = this.get(name);
18
- if (value === undefined) {
19
- return foundValue !== undefined;
20
- }
21
- return foundValue === value;
22
- }
23
- set(name, value) {
24
- let foundHeaders = 0;
25
- for (let headerIndex = 0; headerIndex < this.length; headerIndex += 2) {
26
- if (this[headerIndex].toLowerCase() === name.toLowerCase()) {
27
- this[headerIndex + 1] = value;
28
- ++foundHeaders;
29
- }
30
- }
31
- if (foundHeaders === 0) {
32
- return this.add(name, value);
33
- }
34
- if (foundHeaders > 1) {
35
- throw new Error('Multiple headers with same name. Manipulate rawHeaders instead');
36
- }
37
- }
38
- add(name, value) {
39
- this.push(name);
40
- this.push(value);
41
- }
42
- remove(name) {
43
- const headersCopy = [...this];
44
- let foundHeaders = 0;
45
- for (let headerIndex = 0; headerIndex < headersCopy.length; headerIndex += 2) {
46
- if (this[headerIndex - foundHeaders * 2].toLowerCase() === name.toLowerCase()) {
47
- delete this[headerIndex];
48
- delete this[headerIndex];
49
- ++foundHeaders;
50
- }
51
- }
52
- if (foundHeaders > 1) {
53
- throw new Error('Multiple headers with same name. Manipulate rawHeaders instead');
54
- }
55
- }
56
- toHeaderPairs() {
57
- return RawHeaders.toHeaderPairs(this);
58
- }
59
- static fromHeaderPairs(headerPairs) {
60
- return new RawHeaders(...headerPairs.flatMap((x) => x));
61
- }
62
- static fromHeadersRecord(headersRecord) {
63
- const output = new RawHeaders();
64
- for (const [key, value] of Object.entries(headersRecord)) {
65
- if (typeof value === 'string' || value === undefined) {
66
- output.add(key, value !== null && value !== void 0 ? value : '');
67
- continue;
68
- }
69
- for (const subValue of value) {
70
- output.add(key, subValue);
71
- }
72
- }
73
- return output;
74
- }
75
- static toHeaderPairs(rawHeaders) {
76
- const headers = new Array();
77
- for (let headerIndex = 0; headerIndex < rawHeaders.length; headerIndex += 2) {
78
- headers.push([rawHeaders[headerIndex], rawHeaders[headerIndex + 1]]);
79
- }
80
- return headers;
81
- }
82
- }
83
- exports.RawHeaders = RawHeaders;
@@ -1 +0,0 @@
1
- export declare const stringify: (obj: any) => string;
package/dist/stringify.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringify = void 0;
4
- const stringify = (obj) => JSON.stringify(obj, (key, value) => {
5
- if (typeof value === 'function' || value instanceof RegExp) {
6
- return value.toString();
7
- }
8
- return value;
9
- });
10
- exports.stringify = stringify;