@devrev/ts-adaas 1.17.1-beta.5 → 1.17.1-beta.6

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.
@@ -5,7 +5,6 @@ import { RequestInfo, RouteConfig } from './mock-server.interfaces';
5
5
  * Supports per-test route configuration to simulate different response scenarios.
6
6
  */
7
7
  export declare class MockServer {
8
- private app;
9
8
  private server;
10
9
  private internalPort;
11
10
  port: number;
@@ -16,40 +15,15 @@ export declare class MockServer {
16
15
  constructor(port?: number);
17
16
  start(): Promise<void>;
18
17
  stop(): Promise<void>;
19
- /**
20
- * Sets up routes for the mock server.
21
- */
22
- private setupRoutes;
23
- /**
24
- * Creates a route handler that checks for custom handlers before using the default.
25
- * @param method - The HTTP method
26
- * @param path - The route path
27
- * @returns A route handler function
28
- */
29
- private routeHandler;
18
+ private handleRequest;
30
19
  /**
31
20
  * Default route handler for the mock server. Returns { success: true } for
32
21
  * routes that are not explicitly set.
33
- * @param req - The request object
34
- * @param res - The response object
35
- * @returns void
36
22
  */
37
23
  private defaultRouteHandler;
38
- /**
39
- * Gets the route key for a given method and path.
40
- * @param method - The HTTP method
41
- * @param path - The route path
42
- * @returns The route key in the format 'METHOD:path'
43
- */
44
24
  private getRouteKey;
45
25
  /**
46
26
  * Configures a route to return a specific status code and optional response body.
47
- * @param config - The route configuration object
48
- * @param config.path - The path of the route (e.g., '/callback_url')
49
- * @param config.method - The HTTP method (e.g., 'GET', 'POST')
50
- * @param config.status - The HTTP status code to return (e.g., 200, 401, 500)
51
- * @param config.body - Optional response body to send as JSON
52
- * @param config.retry - Optional retry configuration for simulating failures before success
53
27
  */
54
28
  setRoute(config: RouteConfig): void;
55
29
  /**
@@ -59,21 +33,14 @@ export declare class MockServer {
59
33
  resetRoutes(): void;
60
34
  /**
61
35
  * Returns the most recent request or undefined if no requests exist.
62
- * @returns The last RequestInfo object or undefined
63
36
  */
64
37
  getLastRequest(): RequestInfo | undefined;
65
38
  /**
66
39
  * Gets the number of requests made to a specific endpoint.
67
- * @param method - The HTTP method (e.g., 'GET', 'POST')
68
- * @param path - The route path (e.g., '/test-endpoint', '/callback_url')
69
- * @returns The number of requests made to the endpoint
70
40
  */
71
41
  getRequestCount(method: string, path: string): number;
72
42
  /**
73
43
  * Gets all requests made to a specific endpoint.
74
- * @param method - The HTTP method (e.g., 'GET', 'POST')
75
- * @param path - The route path (e.g., '/test-endpoint', '/callback_url')
76
- * @returns An array of RequestInfo objects for the endpoint
77
44
  */
78
45
  getRequests(method: string, path: string): RequestInfo[];
79
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mock-server.d.ts","sourceRoot":"","sources":["../../src/mock-server/mock-server.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,WAAW,EACX,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAElC;;;;GAIG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAU;IACrB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,YAAY,CAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,aAAa,CAA4B;gBAErC,IAAI,GAAE,MAAiC;IAWtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBlC;;OAEG;IACH,OAAO,CAAC,WAAW;IAsDnB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAsBpB;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IA8B3B;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;;;;OAQG;IACI,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IA2E1C;;;OAGG;IACI,WAAW,IAAI,IAAI;IAM1B;;;OAGG;IACI,cAAc,IAAI,WAAW,GAAG,SAAS;IAOhD;;;;;OAKG;IACI,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAI5D;;;;;OAKG;IACI,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE;CAShE"}
1
+ {"version":3,"file":"mock-server.d.ts","sourceRoot":"","sources":["../../src/mock-server/mock-server.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,WAAW,EACX,WAAW,EAEZ,MAAM,0BAA0B,CAAC;AAuElC;;;;GAIG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,YAAY,CAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,aAAa,CAA4B;gBAErC,IAAI,GAAE,MAAiC;IAMtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAkBpB,aAAa;IA+B3B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA6B3B,OAAO,CAAC,WAAW;IAInB;;OAEG;IACI,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAyE1C;;;OAGG;IACI,WAAW,IAAI,IAAI;IAM1B;;OAEG;IACI,cAAc,IAAI,WAAW,GAAG,SAAS;IAOhD;;OAEG;IACI,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAI5D;;OAEG;IACI,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE;CAQhE"}
@@ -1,5 +1,21 @@
1
- import { Request, Response } from 'express';
1
+ import { IncomingMessage, ServerResponse } from 'http';
2
2
  export declare const DEFAULT_MOCK_SERVER_PORT = 3001;
3
+ export interface ParsedRequest extends IncomingMessage {
4
+ /** Parsed URL path (without query string) */
5
+ path: string;
6
+ /** Parsed JSON body (if any) */
7
+ body?: unknown;
8
+ }
9
+ export interface MockResponse extends ServerResponse {
10
+ /** Set response headers from a record */
11
+ set(headers: Record<string, string>): MockResponse;
12
+ /** Set the HTTP status code */
13
+ status(code: number): MockResponse;
14
+ /** Send a JSON response */
15
+ json(data: unknown): void;
16
+ /** Send an empty response */
17
+ send(): void;
18
+ }
3
19
  /**
4
20
  * Configuration for retry simulation behavior.
5
21
  */
@@ -37,7 +53,7 @@ export interface RouteConfig {
37
53
  /**
38
54
  * Type for custom route handler functions.
39
55
  */
40
- export type RouteHandler = (req: Request, res: Response) => unknown;
56
+ export type RouteHandler = (req: ParsedRequest, res: MockResponse) => unknown;
41
57
  /**
42
58
  * Information about a request received by the mock server.
43
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mock-server.interfaces.d.ts","sourceRoot":"","sources":["../../src/mock-server/mock-server.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,MAAM,EAAE,MA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AEG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -1,11 +1,67 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.MockServer = void 0;
7
- const express_1 = __importDefault(require("express"));
4
+ const http_1 = require("http");
8
5
  const mock_server_interfaces_1 = require("./mock-server.interfaces");
6
+ const MAX_BODY_SIZE = 10 * 1024 * 1024; // 10mb
7
+ /**
8
+ * Parses the JSON body from an incoming request.
9
+ */
10
+ function parseJsonBody(req) {
11
+ return new Promise((resolve, reject) => {
12
+ const chunks = [];
13
+ let size = 0;
14
+ req.on('data', (chunk) => {
15
+ size += chunk.length;
16
+ if (size > MAX_BODY_SIZE) {
17
+ reject(new Error('Request body too large'));
18
+ req.destroy();
19
+ return;
20
+ }
21
+ chunks.push(chunk);
22
+ });
23
+ req.on('end', () => {
24
+ if (chunks.length === 0) {
25
+ resolve(undefined);
26
+ return;
27
+ }
28
+ try {
29
+ const raw = Buffer.concat(chunks).toString('utf-8');
30
+ resolve(JSON.parse(raw));
31
+ }
32
+ catch (_a) {
33
+ resolve(undefined);
34
+ }
35
+ });
36
+ req.on('error', reject);
37
+ });
38
+ }
39
+ /**
40
+ * Wraps a ServerResponse with helper methods (status, json, set, send).
41
+ */
42
+ function wrapResponse(res) {
43
+ const mock = res;
44
+ let statusCode = 200;
45
+ mock.set = (headers) => {
46
+ for (const [key, value] of Object.entries(headers)) {
47
+ res.setHeader(key, value);
48
+ }
49
+ return mock;
50
+ };
51
+ mock.status = (code) => {
52
+ statusCode = code;
53
+ return mock;
54
+ };
55
+ mock.json = (data) => {
56
+ res.writeHead(statusCode, { 'Content-Type': 'application/json' });
57
+ res.end(JSON.stringify(data));
58
+ };
59
+ mock.send = () => {
60
+ res.writeHead(statusCode);
61
+ res.end();
62
+ };
63
+ return mock;
64
+ }
9
65
  /**
10
66
  * MockServer used in tests to mock internal AirSync endpoints.
11
67
  * This is a simple mock server that listens on a port and responds to requests.
@@ -20,16 +76,17 @@ class MockServer {
20
76
  this.internalPort = port;
21
77
  this.port = port;
22
78
  this.baseUrl = `http://localhost:${this.port}`;
23
- this.app = (0, express_1.default)();
24
- // Increase limit to handle size limit tests that send large artifact arrays
25
- this.app.use(express_1.default.json({ limit: '10mb' }));
26
- this.setupRoutes();
27
79
  }
28
80
  async start() {
29
81
  return new Promise((resolve) => {
30
- this.server = this.app.listen(this.internalPort, () => {
82
+ this.server = (0, http_1.createServer)((req, res) => {
83
+ this.handleRequest(req, res).catch(() => {
84
+ res.writeHead(500);
85
+ res.end();
86
+ });
87
+ });
88
+ this.server.listen(this.internalPort, () => {
31
89
  var _a, _b;
32
- // Get the actual port assigned by the OS (important for port 0 = dynamic allocation)
33
90
  const actualPort = (_b = (_a = this.server) === null || _a === void 0 ? void 0 : _a.address()) === null || _b === void 0 ? void 0 : _b.port;
34
91
  if (actualPort) {
35
92
  this.port = actualPort;
@@ -57,56 +114,29 @@ class MockServer {
57
114
  });
58
115
  });
59
116
  }
60
- /**
61
- * Sets up routes for the mock server.
62
- */
63
- setupRoutes() {
64
- // TEST ENDPOINT
65
- this.app.get('/test-endpoint', this.routeHandler('GET', '/test-endpoint'));
66
- // CALLBACK URL
67
- this.app.post('/callback_url', this.routeHandler('POST', '/callback_url'));
68
- // WORKER DATA URL
69
- this.app.post('/worker_data_url', this.routeHandler('POST', '/worker_data_url'));
70
- this.app.get('/worker_data_url.get', this.routeHandler('GET', '/worker_data_url.get'));
71
- this.app.post('/worker_data_url.update', this.routeHandler('POST', '/worker_data_url.update'));
72
- // SNAP-INS URL
73
- this.app.get('/internal/snap-ins.get', this.routeHandler('GET', '/internal/snap-ins.get'));
74
- // AIRDROP RECIPE INITIAL DOMAIN MAPPINGS INSTALL URL
75
- this.app.post('/internal/airdrop.recipe.initial-domain-mappings.install', this.routeHandler('POST', '/internal/airdrop.recipe.initial-domain-mappings.install'));
76
- // ARTIFACTS URL
77
- this.app.get('/internal/airdrop.artifacts.upload-url', this.routeHandler('GET', '/internal/airdrop.artifacts.upload-url'));
78
- this.app.post('/internal/airdrop.artifacts.confirm-upload', this.routeHandler('POST', '/internal/airdrop.artifacts.confirm-upload'));
79
- // FILE UPLOAD URL
80
- this.app.post('/file-upload-url', this.routeHandler('POST', '/file-upload-url'));
81
- }
82
- /**
83
- * Creates a route handler that checks for custom handlers before using the default.
84
- * @param method - The HTTP method
85
- * @param path - The route path
86
- * @returns A route handler function
87
- */
88
- routeHandler(method, path) {
89
- return (req, res) => {
90
- const requestInfo = Object.assign({ method: req.method, url: req.url || req.path }, (req.body !== undefined && req.body !== null
91
- ? { body: req.body }
92
- : {}));
93
- this.requests.push(requestInfo);
94
- const key = `${method}:${path}`;
95
- const customHandler = this.routeHandlers.get(key);
96
- if (customHandler) {
97
- customHandler(req, res);
98
- }
99
- else {
100
- this.defaultRouteHandler(req, res);
101
- }
102
- };
117
+ async handleRequest(raw, rawRes) {
118
+ const req = raw;
119
+ const res = wrapResponse(rawRes);
120
+ const urlPath = (req.url || '/').split('?')[0];
121
+ req.path = urlPath;
122
+ req.body = await parseJsonBody(req);
123
+ const requestInfo = Object.assign({ method: req.method || 'GET', url: req.url || urlPath }, (req.body !== undefined && req.body !== null
124
+ ? { body: req.body }
125
+ : {}));
126
+ this.requests.push(requestInfo);
127
+ const method = (req.method || 'GET').toUpperCase();
128
+ const key = `${method}:${urlPath}`;
129
+ const customHandler = this.routeHandlers.get(key);
130
+ if (customHandler) {
131
+ customHandler(req, res);
132
+ }
133
+ else {
134
+ this.defaultRouteHandler(req, res);
135
+ }
103
136
  }
104
137
  /**
105
138
  * Default route handler for the mock server. Returns { success: true } for
106
139
  * routes that are not explicitly set.
107
- * @param req - The request object
108
- * @param res - The response object
109
- * @returns void
110
140
  */
111
141
  defaultRouteHandler(req, res) {
112
142
  if (req.method === 'GET' && req.path === '/worker_data_url.get') {
@@ -124,43 +154,28 @@ class MockServer {
124
154
  }
125
155
  else if (req.method === 'GET' &&
126
156
  req.path === '/internal/airdrop.artifacts.upload-url') {
127
- // Generate a unique artifact ID for each request
128
157
  const artifactId = `artifact-${Date.now()}-${Math.random()
129
158
  .toString(36)
130
159
  .substr(2, 9)}`;
131
160
  res.status(200).json({
132
161
  upload_url: `${this.baseUrl}/file-upload-url`,
133
162
  artifact_id: artifactId,
134
- form_data: [], // Empty form_data for local development
163
+ form_data: [],
135
164
  });
136
165
  }
137
166
  else {
138
167
  res.status(200).json({ success: true });
139
168
  }
140
169
  }
141
- /**
142
- * Gets the route key for a given method and path.
143
- * @param method - The HTTP method
144
- * @param path - The route path
145
- * @returns The route key in the format 'METHOD:path'
146
- */
147
170
  getRouteKey(method, path) {
148
171
  return `${method.toUpperCase()}:${path}`;
149
172
  }
150
173
  /**
151
174
  * Configures a route to return a specific status code and optional response body.
152
- * @param config - The route configuration object
153
- * @param config.path - The path of the route (e.g., '/callback_url')
154
- * @param config.method - The HTTP method (e.g., 'GET', 'POST')
155
- * @param config.status - The HTTP status code to return (e.g., 200, 401, 500)
156
- * @param config.body - Optional response body to send as JSON
157
- * @param config.retry - Optional retry configuration for simulating failures before success
158
175
  */
159
176
  setRoute(config) {
160
177
  const { path, method, status, body, retry, headers, delay } = config;
161
178
  const key = this.getRouteKey(method, path);
162
- // Reset request count for this route if retry is configured
163
- // This ensures a clean state each time setRoute is called
164
179
  if (retry) {
165
180
  this.requestCounts.set(key, 0);
166
181
  }
@@ -238,7 +253,6 @@ class MockServer {
238
253
  }
239
254
  /**
240
255
  * Returns the most recent request or undefined if no requests exist.
241
- * @returns The last RequestInfo object or undefined
242
256
  */
243
257
  getLastRequest() {
244
258
  if (this.requests.length === 0) {
@@ -248,21 +262,14 @@ class MockServer {
248
262
  }
249
263
  /**
250
264
  * Gets the number of requests made to a specific endpoint.
251
- * @param method - The HTTP method (e.g., 'GET', 'POST')
252
- * @param path - The route path (e.g., '/test-endpoint', '/callback_url')
253
- * @returns The number of requests made to the endpoint
254
265
  */
255
266
  getRequestCount(method, path) {
256
267
  return this.getRequests(method, path).length;
257
268
  }
258
269
  /**
259
270
  * Gets all requests made to a specific endpoint.
260
- * @param method - The HTTP method (e.g., 'GET', 'POST')
261
- * @param path - The route path (e.g., '/test-endpoint', '/callback_url')
262
- * @returns An array of RequestInfo objects for the endpoint
263
271
  */
264
272
  getRequests(method, path) {
265
- // Remove query parameters for comparison
266
273
  const pathWithoutQuery = path.split('?')[0];
267
274
  return this.requests.filter((req) => req.method.toUpperCase() === method.toUpperCase() &&
268
275
  req.url.split('?')[0] === pathWithoutQuery);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/ts-adaas",
3
- "version": "1.17.1-beta.5",
3
+ "version": "1.17.1-beta.6",
4
4
  "description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -30,7 +30,6 @@
30
30
  "devDependencies": {
31
31
  "@microsoft/api-extractor": "^7.57.6",
32
32
  "@microsoft/api-extractor-model": "^7.30.7",
33
- "@types/express": "^5.0.3",
34
33
  "@types/jest": "^29.5.14",
35
34
  "@types/node": "^22.18.0",
36
35
  "@types/yargs": "^17.0.33",
@@ -38,7 +37,6 @@
38
37
  "eslint": "9.32.0",
39
38
  "eslint-config-prettier": "^9.1.2",
40
39
  "eslint-plugin-prettier": "4.0.0",
41
- "express": "^5.2.1",
42
40
  "jest": "^29.7.0",
43
41
  "jiti": "^2.6.1",
44
42
  "prettier": "^2.8.3",
@@ -46,18 +44,6 @@
46
44
  "typescript": "^5.3.3",
47
45
  "typescript-eslint": "^8.46.1"
48
46
  },
49
- "peerDependencies": {
50
- "@types/express": "^5.0.0",
51
- "express": "^5.0.0"
52
- },
53
- "peerDependenciesMeta": {
54
- "@types/express": {
55
- "optional": true
56
- },
57
- "express": {
58
- "optional": true
59
- }
60
- },
61
47
  "dependencies": {
62
48
  "@devrev/typescript-sdk": "^1.1.59",
63
49
  "axios": "^1.13.5",