@stuntman/server 0.3.0 → 0.3.2
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/api/api.js +5 -5
- package/dist/api/utils.js +1 -1
- package/dist/bin/stuntman.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ipUtils.js +1 -1
- package/dist/mock.d.ts +2 -2
- package/dist/mock.js +5 -5
- package/dist/ruleExecutor.js +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.js +2 -2
- package/dist/rules/loadRules.js +2 -2
- package/package.json +4 -4
package/dist/api/api.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
-
import { getTrafficStore } from '../storage';
|
|
4
|
-
import { getRuleExecutor } from '../ruleExecutor';
|
|
3
|
+
import { getTrafficStore } from '../storage.js';
|
|
4
|
+
import { getRuleExecutor } from '../ruleExecutor.js';
|
|
5
5
|
import { logger, AppError, HttpCode, MAX_RULE_TTL_SECONDS, stringify, INDEX_DTS, errorToLog } from '@stuntman/shared';
|
|
6
|
-
import { RequestContext } from '../requestContext';
|
|
6
|
+
import { RequestContext } from '../requestContext.js';
|
|
7
7
|
import serializeJavascript from 'serialize-javascript';
|
|
8
|
-
import { validateDeserializedRule } from './validators';
|
|
9
|
-
import { deserializeRule, escapedSerialize, liveRuleToRule } from './utils';
|
|
8
|
+
import { validateDeserializedRule } from './validators.js';
|
|
9
|
+
import { deserializeRule, escapedSerialize, liveRuleToRule } from './utils.js';
|
|
10
10
|
import { dirname } from 'path';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
12
12
|
const __dirname = dirname(fileURLToPath(import.meta.url)).replace(/\/src$/, '/dist');
|
package/dist/api/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import serializeJavascript from 'serialize-javascript';
|
|
2
2
|
import { logger } from '@stuntman/shared';
|
|
3
|
-
import { validateSerializedRuleProperties } from './validators';
|
|
3
|
+
import { validateSerializedRuleProperties } from './validators.js';
|
|
4
4
|
// TODO
|
|
5
5
|
export const deserializeRule = (serializedRule) => {
|
|
6
6
|
logger.debug(serializedRule, 'attempt to deserialize rule');
|
package/dist/bin/stuntman.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Mock as StuntmanMock } from './mock';
|
|
1
|
+
export { Mock as StuntmanMock } from './mock.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Mock as StuntmanMock } from './mock';
|
|
1
|
+
export { Mock as StuntmanMock } from './mock.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/ipUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { networkInterfaces } from 'os';
|
|
2
2
|
import dns, { Resolver as DNSResolver } from 'node:dns';
|
|
3
|
-
import { getDnsResolutionCache } from './storage';
|
|
3
|
+
import { getDnsResolutionCache } from './storage.js';
|
|
4
4
|
import { errorToLog, logger } from '@stuntman/shared';
|
|
5
5
|
const localhostIPs = ['127.0.0.1', '::1'];
|
|
6
6
|
const IP_WITH_OPTIONAL_PORT_REGEX = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}(:[0-9]+)?$/i;
|
package/dist/mock.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import http from 'http';
|
|
|
4
4
|
import https from 'https';
|
|
5
5
|
import express from 'express';
|
|
6
6
|
import type * as Stuntman from '@stuntman/shared';
|
|
7
|
-
import { IPUtils } from './ipUtils';
|
|
7
|
+
import { IPUtils } from './ipUtils.js';
|
|
8
8
|
import { LRUCache } from 'lru-cache';
|
|
9
|
-
import { API } from './api/api';
|
|
9
|
+
import { API } from './api/api.js';
|
|
10
10
|
export declare class Mock {
|
|
11
11
|
readonly mockUuid: string;
|
|
12
12
|
protected options: Stuntman.Config;
|
package/dist/mock.js
CHANGED
|
@@ -2,12 +2,12 @@ import { request as fetchRequest } from 'undici';
|
|
|
2
2
|
import https from 'https';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
-
import { getRuleExecutor } from './ruleExecutor';
|
|
6
|
-
import { getTrafficStore } from './storage';
|
|
5
|
+
import { getRuleExecutor } from './ruleExecutor.js';
|
|
6
|
+
import { getTrafficStore } from './storage.js';
|
|
7
7
|
import { RawHeaders, logger, HttpCode, naiveGQLParser, escapeStringRegexp, errorToLog, HTTP_METHODS } from '@stuntman/shared';
|
|
8
|
-
import { RequestContext } from './requestContext';
|
|
9
|
-
import { IPUtils } from './ipUtils';
|
|
10
|
-
import { API } from './api/api';
|
|
8
|
+
import { RequestContext } from './requestContext.js';
|
|
9
|
+
import { IPUtils } from './ipUtils.js';
|
|
10
|
+
import { API } from './api/api.js';
|
|
11
11
|
// TODO add proper web proxy mode
|
|
12
12
|
export class Mock {
|
|
13
13
|
mockUuid;
|
package/dist/ruleExecutor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Lock } from 'async-await-mutex-lock';
|
|
2
2
|
import { AppError, DEFAULT_RULE_PRIORITY, HttpCode, errorToLog, logger } from '@stuntman/shared';
|
|
3
|
-
import { CUSTOM_RULES, DEFAULT_RULES } from './rules';
|
|
3
|
+
import { CUSTOM_RULES, DEFAULT_RULES } from './rules/index.js';
|
|
4
4
|
const ruleExecutors = {};
|
|
5
5
|
const transformMockRuleToLive = (rule) => {
|
|
6
6
|
return {
|
package/dist/rules/index.d.ts
CHANGED
package/dist/rules/index.js
CHANGED
package/dist/rules/loadRules.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { globSync } from 'glob';
|
|
3
3
|
import * as tsImport from 'ts-import';
|
|
4
|
-
import { catchAllRule } from './catchAll';
|
|
5
|
-
import { echoRule } from './echo';
|
|
4
|
+
import { catchAllRule } from './catchAll.js';
|
|
5
|
+
import { echoRule } from './echo.js';
|
|
6
6
|
import { stuntmanConfig, logger, errorToLog } from '@stuntman/shared';
|
|
7
7
|
export const DEFAULT_RULES = [catchAllRule, echoRule];
|
|
8
8
|
export const loadRules = async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stuntman/server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Stuntman - HTTP proxy / mock server with API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"author": "Andrzej Pasterczyk",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@stuntman/shared": "^0.3.
|
|
36
|
+
"@stuntman/shared": "^0.3.2",
|
|
37
|
+
"async-await-mutex-lock": "^1.0.11",
|
|
37
38
|
"express": "5.0.0-beta.3",
|
|
38
39
|
"glob": "10.3.12",
|
|
39
40
|
"lru-cache": "10.2.0",
|
|
@@ -54,7 +55,6 @@
|
|
|
54
55
|
"@types/jest": "^29.5.12",
|
|
55
56
|
"@types/serialize-javascript": "5.0.4",
|
|
56
57
|
"@types/uuid": "9.0.8",
|
|
57
|
-
"async-await-mutex-lock": "^1.0.11",
|
|
58
58
|
"jest": "29.7.0",
|
|
59
59
|
"prettier": "3.2.5",
|
|
60
60
|
"typescript": "5.4.3"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"scripts": {
|
|
78
78
|
"test": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test LOG_LEVEL=silent NODE_CONFIG_STRICT_MODE= SUPPRESS_NO_CONFIG_WARNING=1 jest --coverage",
|
|
79
79
|
"clean": "rm -fr dist",
|
|
80
|
-
"build": "tsc && cp -rv src/api/webgui dist/api",
|
|
80
|
+
"build": "tsc && tsc-alias && cp -rv src/api/webgui dist/api",
|
|
81
81
|
"lint": "prettier --check \"./{src,test}/**/*\" && eslint \"./{src,test}/**/*\"",
|
|
82
82
|
"lint:fix": "prettier --write \"./{src,test}/**/*\" && eslint \"./{src,test}/**/*\" --fix",
|
|
83
83
|
"start": "node ./dist/bin/stuntman.js",
|