@devrev/ts-adaas 1.11.1-beta.2 → 1.11.1-beta.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/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
- package/dist/attachments-streaming/attachments-streaming-pool.js +2 -1
- package/dist/common/helpers.js +1 -1
- package/dist/logger/logger.d.ts +4 -19
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.interfaces.d.ts +22 -1
- package/dist/logger/logger.interfaces.d.ts.map +1 -1
- package/dist/logger/logger.js +9 -31
- package/dist/logger/logger.test.js +21 -9
- package/dist/tests/backwards-compatibility/backwards-compatibility.test.d.ts.map +1 -1
- package/dist/tests/backwards-compatibility/backwards-compatibility.test.js +4 -2
- package/dist/workers/spawn.d.ts.map +1 -1
- package/dist/workers/spawn.js +4 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments-streaming-pool.d.ts","sourceRoot":"","sources":["../../src/attachments-streaming/attachments-streaming-pool.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,qBAAa,wBAAwB,CAAC,cAAc;IAClD,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,MAAM,CAA4C;IAE1D,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAM;gBAEnC,EACV,OAAO,EACP,WAAW,EACX,SAAc,EACd,MAAM,GACP,EAAE,8BAA8B,CAAC,cAAc,CAAC;YAQnC,cAAc;
|
|
1
|
+
{"version":3,"file":"attachments-streaming-pool.d.ts","sourceRoot":"","sources":["../../src/attachments-streaming/attachments-streaming-pool.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,qBAAa,wBAAwB,CAAC,cAAc;IAClD,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,MAAM,CAA4C;IAE1D,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAM;gBAEnC,EACV,OAAO,EACP,WAAW,EACX,SAAc,EACd,MAAM,GACP,EAAE,8BAA8B,CAAC,cAAc,CAAC;YAQnC,cAAc;IAStB,SAAS,IAAI,OAAO,CAAC,2BAA2B,CAAC;IAuCjD,kBAAkB;CA0EzB"}
|
|
@@ -16,7 +16,8 @@ class AttachmentsStreamingPool {
|
|
|
16
16
|
this.totalProcessedCount++;
|
|
17
17
|
if (this.totalProcessedCount % this.PROGRESS_REPORT_INTERVAL === 0) {
|
|
18
18
|
console.info(`Processed ${this.totalProcessedCount} attachments so far.`);
|
|
19
|
-
|
|
19
|
+
// Sleep for 100ms to avoid blocking the event loop
|
|
20
|
+
await (0, helpers_1.sleep)(100);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
async streamAll() {
|
package/dist/common/helpers.js
CHANGED
|
@@ -167,7 +167,7 @@ function getLibraryVersion() {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
async function sleep(ms) {
|
|
170
|
-
console.log(`Sleeping for ${ms
|
|
170
|
+
console.log(`Sleeping for ${ms}ms.`);
|
|
171
171
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
172
172
|
}
|
|
173
173
|
function truncateFilename(filename) {
|
package/dist/logger/logger.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Console } from 'node:console';
|
|
2
|
-
import { AxiosError
|
|
3
|
-
import { LoggerFactoryInterface, LogLevel, PrintableState } from './logger.interfaces';
|
|
2
|
+
import { AxiosError } from 'axios';
|
|
3
|
+
import { AxiosErrorResponse, LoggerFactoryInterface, LogLevel, PrintableState } from './logger.interfaces';
|
|
4
4
|
export declare class Logger extends Console {
|
|
5
|
+
private originalConsole;
|
|
5
6
|
private options?;
|
|
6
7
|
private tags;
|
|
8
|
+
private sdkVersion;
|
|
7
9
|
constructor({ event, options }: LoggerFactoryInterface);
|
|
8
10
|
private valueToString;
|
|
9
11
|
logFn(args: unknown[], level: LogLevel): void;
|
|
@@ -18,22 +20,5 @@ export declare function getPrintableState(state: Record<string, any>): Printable
|
|
|
18
20
|
*/
|
|
19
21
|
export declare function formatAxiosError(error: AxiosError): object;
|
|
20
22
|
export declare const serializeError: (error: unknown) => unknown;
|
|
21
|
-
export interface AxiosErrorResponse {
|
|
22
|
-
config: {
|
|
23
|
-
method: string | undefined;
|
|
24
|
-
params: any;
|
|
25
|
-
url: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
isAxiosError: boolean;
|
|
28
|
-
isCorsOrNoNetworkError: boolean;
|
|
29
|
-
response?: {
|
|
30
|
-
data: unknown;
|
|
31
|
-
headers: RawAxiosResponseHeaders;
|
|
32
|
-
status: number;
|
|
33
|
-
statusText: string;
|
|
34
|
-
};
|
|
35
|
-
code?: string;
|
|
36
|
-
message?: string;
|
|
37
|
-
}
|
|
38
23
|
export declare function serializeAxiosError(error: AxiosError): AxiosErrorResponse;
|
|
39
24
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAyC,MAAM,OAAO,CAAC;AAG1E,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EAGR,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,qBAAa,MAAO,SAAQ,OAAO;IACjC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,OAAO,CAAC,CAAuB;IACvC,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,UAAU,CAAS;gBAEf,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,sBAAsB;IAWtD,OAAO,CAAC,aAAa;IAYrB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAepC,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI7B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI9B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI9B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAGzC;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,cAAc,CAyB5E;AACD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE1D;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,YAK5C,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,CAwBzE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RawAxiosResponseHeaders } from 'axios';
|
|
2
|
+
import { AirdropEvent, EventContext } from '../types/extraction';
|
|
2
3
|
import { WorkerAdapterOptions } from '../types/workers';
|
|
3
4
|
export interface LoggerFactoryInterface {
|
|
4
5
|
event: AirdropEvent;
|
|
@@ -18,4 +19,24 @@ export interface PrintableArray {
|
|
|
18
19
|
export interface PrintableState {
|
|
19
20
|
[key: string]: any | PrintableArray | PrintableState;
|
|
20
21
|
}
|
|
22
|
+
export interface AxiosErrorResponse {
|
|
23
|
+
config: {
|
|
24
|
+
method: string | undefined;
|
|
25
|
+
params: any;
|
|
26
|
+
url: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
isAxiosError: boolean;
|
|
29
|
+
isCorsOrNoNetworkError: boolean;
|
|
30
|
+
response?: {
|
|
31
|
+
data: unknown;
|
|
32
|
+
headers: RawAxiosResponseHeaders;
|
|
33
|
+
status: number;
|
|
34
|
+
statusText: string;
|
|
35
|
+
};
|
|
36
|
+
code?: string;
|
|
37
|
+
message?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface LogTags extends EventContext {
|
|
40
|
+
sdk_version: string;
|
|
41
|
+
}
|
|
21
42
|
//# sourceMappingURL=logger.interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.interfaces.d.ts","sourceRoot":"","sources":["../../src/logger/logger.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.interfaces.d.ts","sourceRoot":"","sources":["../../src/logger/logger.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,CAAC,EAAE,GAAG,CAAC;IAEhB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAE7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,cAAc,GAAG,cAAc,CAAC;CACtD;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAE3B,MAAM,EAAE,GAAG,CAAC;QACZ,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;KACzB,CAAC;IACF,YAAY,EAAE,OAAO,CAAC;IACtB,sBAAsB,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,OAAO,CAAC;QACd,OAAO,EAAE,uBAAuB,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAQ,SAAQ,YAAY;IAC3C,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/logger/logger.js
CHANGED
|
@@ -7,14 +7,15 @@ exports.serializeAxiosError = serializeAxiosError;
|
|
|
7
7
|
const node_console_1 = require("node:console");
|
|
8
8
|
const node_util_1 = require("node:util");
|
|
9
9
|
const axios_1 = require("axios");
|
|
10
|
-
const
|
|
11
|
-
const workers_1 = require("../types/workers");
|
|
10
|
+
const helpers_1 = require("../common/helpers");
|
|
12
11
|
const logger_interfaces_1 = require("./logger.interfaces");
|
|
13
12
|
class Logger extends node_console_1.Console {
|
|
14
13
|
constructor({ event, options }) {
|
|
15
14
|
super(process.stdout, process.stderr);
|
|
15
|
+
this.originalConsole = console;
|
|
16
16
|
this.options = options;
|
|
17
|
-
this.
|
|
17
|
+
this.sdkVersion = (0, helpers_1.getLibraryVersion)();
|
|
18
|
+
this.tags = Object.assign(Object.assign({}, event.payload.event_context), { sdk_version: this.sdkVersion });
|
|
18
19
|
}
|
|
19
20
|
valueToString(value) {
|
|
20
21
|
if (typeof value === 'string') {
|
|
@@ -28,36 +29,13 @@ class Logger extends node_console_1.Console {
|
|
|
28
29
|
}
|
|
29
30
|
logFn(args, level) {
|
|
30
31
|
var _a;
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
console[level](...args);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
let message;
|
|
37
|
-
if (args.length === 1 && typeof args[0] === 'string') {
|
|
38
|
-
// Single string argument - use directly
|
|
39
|
-
message = args[0];
|
|
40
|
-
}
|
|
41
|
-
else if (args.length === 1) {
|
|
42
|
-
// Single non-string argument - convert to string properly
|
|
43
|
-
message = this.valueToString(args[0]);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// Multiple arguments - create a readable format
|
|
47
|
-
message = args.map((arg) => this.valueToString(arg)).join(' ');
|
|
48
|
-
}
|
|
49
|
-
const logObject = Object.assign({ message }, this.tags);
|
|
50
|
-
console[level](JSON.stringify(logObject));
|
|
51
|
-
}
|
|
32
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.isLocalDevelopment) {
|
|
33
|
+
this.originalConsole[level](...args);
|
|
52
34
|
}
|
|
53
35
|
else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
args: args.map((arg) => this.valueToString(arg)),
|
|
58
|
-
level,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
36
|
+
const message = args.map((arg) => this.valueToString(arg)).join(' ');
|
|
37
|
+
const logObject = Object.assign({ message }, this.tags);
|
|
38
|
+
this.originalConsole[level](logObject);
|
|
61
39
|
}
|
|
62
40
|
}
|
|
63
41
|
log(...args) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_util_1 = require("node:util");
|
|
4
|
+
const helpers_1 = require("../common/helpers");
|
|
4
5
|
const test_helpers_1 = require("../tests/test-helpers");
|
|
5
6
|
const extraction_1 = require("../types/extraction");
|
|
6
7
|
const logger_1 = require("./logger");
|
|
@@ -46,12 +47,12 @@ describe(logger_1.Logger.name, () => {
|
|
|
46
47
|
jest.restoreAllMocks();
|
|
47
48
|
});
|
|
48
49
|
describe('constructor', () => {
|
|
49
|
-
it('should initialize logger with event context and
|
|
50
|
+
it('should initialize logger with event context and sdk_version', () => {
|
|
50
51
|
const logger = new logger_1.Logger({ event: mockEvent, options: mockOptions });
|
|
51
52
|
// Access private property for testing
|
|
52
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
54
|
const tags = logger.tags;
|
|
54
|
-
expect(tags).toEqual(Object.assign(Object.assign({}, mockEvent.payload.event_context), {
|
|
55
|
+
expect(tags).toEqual(Object.assign(Object.assign({}, mockEvent.payload.event_context), { sdk_version: (0, helpers_1.getLibraryVersion)() }));
|
|
55
56
|
});
|
|
56
57
|
});
|
|
57
58
|
describe('production logging', () => {
|
|
@@ -63,7 +64,9 @@ describe(logger_1.Logger.name, () => {
|
|
|
63
64
|
it('should log single string message without backslashes', () => {
|
|
64
65
|
const message = 'Worker is online. Started processing the task.';
|
|
65
66
|
logger.info(message);
|
|
66
|
-
|
|
67
|
+
const callArgs = mockConsoleInfo.mock.calls[0][0];
|
|
68
|
+
const logObject = typeof callArgs === 'string' ? JSON.parse(callArgs) : callArgs;
|
|
69
|
+
expect(logObject).toEqual(Object.assign(Object.assign({ message }, mockEvent.payload.event_context), { sdk_version: (0, helpers_1.getLibraryVersion)() }));
|
|
67
70
|
});
|
|
68
71
|
it('should log single object message with JSON stringify', () => {
|
|
69
72
|
const data = { id: 123, name: 'test' };
|
|
@@ -72,7 +75,9 @@ describe(logger_1.Logger.name, () => {
|
|
|
72
75
|
compact: false,
|
|
73
76
|
depth: Infinity,
|
|
74
77
|
});
|
|
75
|
-
|
|
78
|
+
const callArgs = mockConsoleInfo.mock.calls[0][0];
|
|
79
|
+
const logObject = typeof callArgs === 'string' ? JSON.parse(callArgs) : callArgs;
|
|
80
|
+
expect(logObject).toEqual(Object.assign(Object.assign({ message: expectedMessage }, mockEvent.payload.event_context), { sdk_version: (0, helpers_1.getLibraryVersion)() }));
|
|
76
81
|
});
|
|
77
82
|
it('should log multiple arguments joined with space', () => {
|
|
78
83
|
const text = 'Successfully fetched';
|
|
@@ -82,7 +87,9 @@ describe(logger_1.Logger.name, () => {
|
|
|
82
87
|
compact: false,
|
|
83
88
|
depth: Infinity,
|
|
84
89
|
});
|
|
85
|
-
|
|
90
|
+
const callArgs = mockConsoleInfo.mock.calls[0][0];
|
|
91
|
+
const logObject = typeof callArgs === 'string' ? JSON.parse(callArgs) : callArgs;
|
|
92
|
+
expect(logObject).toEqual(Object.assign(Object.assign({ message: `${text} ${expectedDataMessage}` }, mockEvent.payload.event_context), { sdk_version: (0, helpers_1.getLibraryVersion)() }));
|
|
86
93
|
});
|
|
87
94
|
it('should handle mixed string and object arguments', () => {
|
|
88
95
|
const text1 = 'Processing';
|
|
@@ -93,7 +100,9 @@ describe(logger_1.Logger.name, () => {
|
|
|
93
100
|
compact: false,
|
|
94
101
|
depth: Infinity,
|
|
95
102
|
});
|
|
96
|
-
|
|
103
|
+
const callArgs = mockConsoleInfo.mock.calls[0][0];
|
|
104
|
+
const logObject = typeof callArgs === 'string' ? JSON.parse(callArgs) : callArgs;
|
|
105
|
+
expect(logObject).toEqual(Object.assign(Object.assign({ message: `${text1} ${expectedDataMessage} ${text2}` }, mockEvent.payload.event_context), { sdk_version: (0, helpers_1.getLibraryVersion)() }));
|
|
97
106
|
});
|
|
98
107
|
});
|
|
99
108
|
describe('local development logging', () => {
|
|
@@ -142,19 +151,21 @@ describe(logger_1.Logger.name, () => {
|
|
|
142
151
|
logger.info('');
|
|
143
152
|
expect(mockConsoleInfo).toHaveBeenCalledTimes(1);
|
|
144
153
|
const callArgs = mockConsoleInfo.mock.calls[0][0];
|
|
145
|
-
const logObject = JSON.parse(callArgs);
|
|
154
|
+
const logObject = typeof callArgs === 'string' ? JSON.parse(callArgs) : callArgs;
|
|
146
155
|
expect(logObject.message).toBe('');
|
|
147
156
|
expect(logObject.dev_oid).toBe(mockEvent.payload.event_context.dev_oid);
|
|
148
157
|
expect(logObject.request_id).toBe(mockEvent.payload.event_context.request_id);
|
|
158
|
+
expect(logObject.sdk_version).toBe((0, helpers_1.getLibraryVersion)());
|
|
149
159
|
});
|
|
150
160
|
it('[edge] should handle null and undefined values', () => {
|
|
151
161
|
logger.info('test', null, undefined);
|
|
152
162
|
expect(mockConsoleInfo).toHaveBeenCalledTimes(1);
|
|
153
163
|
const callArgs = mockConsoleInfo.mock.calls[0][0];
|
|
154
|
-
const logObject = JSON.parse(callArgs);
|
|
164
|
+
const logObject = typeof callArgs === 'string' ? JSON.parse(callArgs) : callArgs;
|
|
155
165
|
// inspect shows 'null' and 'undefined' as strings
|
|
156
166
|
expect(logObject.message).toBe('test null undefined');
|
|
157
167
|
expect(logObject.dev_oid).toBe(mockEvent.payload.event_context.dev_oid);
|
|
168
|
+
expect(logObject.sdk_version).toBe((0, helpers_1.getLibraryVersion)());
|
|
158
169
|
});
|
|
159
170
|
it('[edge] should handle complex nested objects', () => {
|
|
160
171
|
const complexObject = {
|
|
@@ -168,7 +179,7 @@ describe(logger_1.Logger.name, () => {
|
|
|
168
179
|
logger.info(complexObject);
|
|
169
180
|
expect(mockConsoleInfo).toHaveBeenCalledTimes(1);
|
|
170
181
|
const callArgs = mockConsoleInfo.mock.calls[0][0];
|
|
171
|
-
const logObject = JSON.parse(callArgs);
|
|
182
|
+
const logObject = typeof callArgs === 'string' ? JSON.parse(callArgs) : callArgs;
|
|
172
183
|
// The logger uses inspect() with formatting, not JSON.stringify()
|
|
173
184
|
const expectedMessage = require('util').inspect(complexObject, {
|
|
174
185
|
compact: false,
|
|
@@ -177,6 +188,7 @@ describe(logger_1.Logger.name, () => {
|
|
|
177
188
|
expect(logObject.message).toBe(expectedMessage);
|
|
178
189
|
expect(logObject.dev_oid).toBe(mockEvent.payload.event_context.dev_oid);
|
|
179
190
|
expect(typeof logObject.callback_url).toBe('string');
|
|
191
|
+
expect(logObject.sdk_version).toBe((0, helpers_1.getLibraryVersion)());
|
|
180
192
|
});
|
|
181
193
|
});
|
|
182
194
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backwards-compatibility.test.d.ts","sourceRoot":"","sources":["../../../src/tests/backwards-compatibility/backwards-compatibility.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGd,WAAW,EAGX,kBAAkB,EAKnB,MAAM,gCAAgC,CAAC;AAgBxC,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,WAAW,GAAG,cAAc,GAAG,kBAAkB,EAC9D,eAAe,EAAE,WAAW,GAAG,cAAc,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"backwards-compatibility.test.d.ts","sourceRoot":"","sources":["../../../src/tests/backwards-compatibility/backwards-compatibility.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGd,WAAW,EAGX,kBAAkB,EAKnB,MAAM,gCAAgC,CAAC;AAgBxC,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,WAAW,GAAG,cAAc,GAAG,kBAAkB,EAC9D,eAAe,EAAE,WAAW,GAAG,cAAc,GAAG,kBAAkB,QAkFnE"}
|
|
@@ -28,9 +28,11 @@ function checkFunctionCompatibility(newFunction, currentFunction) {
|
|
|
28
28
|
if (currentFunction instanceof api_extractor_model_1.ApiFunction &&
|
|
29
29
|
newFunction instanceof api_extractor_model_1.ApiFunction) {
|
|
30
30
|
if (!((_a = currentFunction.returnTypeExcerpt) === null || _a === void 0 ? void 0 : _a.isEmpty)) {
|
|
31
|
-
if (newFunction.returnTypeExcerpt.text !=
|
|
31
|
+
if (newFunction.returnTypeExcerpt.text !=
|
|
32
|
+
currentFunction.returnTypeExcerpt.text) {
|
|
32
33
|
// This will pass, if the new implementation is an object and the current one is not specified or a hard-coded type.
|
|
33
|
-
if (!(currentFunction.returnTypeExcerpt.text.split(
|
|
34
|
+
if (!(currentFunction.returnTypeExcerpt.text.split(' ').length != 1 &&
|
|
35
|
+
newFunction.returnTypeExcerpt.text.split(' ').length == 1)) {
|
|
34
36
|
it(`Function ${newFunction.displayName} should have the same return type as the current function`, () => {
|
|
35
37
|
expect(newFunction.returnTypeExcerpt.text).toEqual(currentFunction.returnTypeExcerpt.text);
|
|
36
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/workers/spawn.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,kBAAkB,CAAC;AA4D1B;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,GACR,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAmEvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAA4C;gBAE/C,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/workers/spawn.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,kBAAkB,CAAC;AA4D1B;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,GACR,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAmEvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAA4C;gBAE/C,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,cAAc;IA8F/D,OAAO,CAAC,aAAa;YAYP,kBAAkB;CA8BjC"}
|
package/dist/workers/spawn.js
CHANGED
|
@@ -163,8 +163,9 @@ class Spawn {
|
|
|
163
163
|
await this.exitFromMainThread();
|
|
164
164
|
}
|
|
165
165
|
})(), this.lambdaTimeout * constants_1.HARD_TIMEOUT_MULTIPLIER);
|
|
166
|
-
// If worker exits with process.exit(code), clear the timeouts and exit from
|
|
167
|
-
|
|
166
|
+
// If worker exits with process.exit(code), clear the timeouts and exit from
|
|
167
|
+
// main thread.
|
|
168
|
+
worker.on(workers_1.WorkerEvent.WorkerExit, (code) => void (async () => {
|
|
168
169
|
this.logger.info('Worker exited with exit code: ' + code + '.');
|
|
169
170
|
this.clearTimeouts();
|
|
170
171
|
await this.exitFromMainThread();
|
|
@@ -227,7 +228,7 @@ class Spawn {
|
|
|
227
228
|
event: this.event,
|
|
228
229
|
data: {
|
|
229
230
|
error: {
|
|
230
|
-
message: 'Worker
|
|
231
|
+
message: 'Worker exited the process without emitting an event. Check other logs for more information.',
|
|
231
232
|
},
|
|
232
233
|
},
|
|
233
234
|
});
|
package/package.json
CHANGED