@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 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');
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Mock } from '../mock';
2
+ import { Mock } from '../mock.js';
3
3
  import { stuntmanConfig } from '@stuntman/shared';
4
4
  const mock = new Mock(stuntmanConfig);
5
5
  mock.start();
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;
@@ -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 {
@@ -1,4 +1,4 @@
1
1
  import type * as Stuntman from '@stuntman/shared';
2
- export { DEFAULT_RULES } from './loadRules';
2
+ export { DEFAULT_RULES } from './loadRules.js';
3
3
  export declare const CUSTOM_RULES: Stuntman.DeployedRule[];
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { loadRules } from './loadRules';
2
- export { DEFAULT_RULES } from './loadRules';
1
+ import { loadRules } from './loadRules.js';
2
+ export { DEFAULT_RULES } from './loadRules.js';
3
3
  export const CUSTOM_RULES = await loadRules();
4
4
  //# sourceMappingURL=index.js.map
@@ -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.0",
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.0",
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",