@voiceflow/base-types 2.36.1 → 2.37.0
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/build/common/runtimeLogs/index.d.ts +1 -1
- package/build/common/runtimeLogs/index.js +1 -3
- package/build/common/runtimeLogs/logs/kinds.d.ts +32 -0
- package/build/common/runtimeLogs/logs/kinds.js +32 -1
- package/build/common/runtimeLogs/logs/levels.d.ts +2 -0
- package/build/common/runtimeLogs/logs/levels.js +2 -0
- package/build/common/runtimeLogs/logs/steps/api.d.ts +38 -25
- package/build/common/runtimeLogs/logs/steps/code.d.ts +7 -2
- package/build/common/runtimeLogs/runtime/logBuffer.d.ts +1 -1
- package/build/common/runtimeLogs/utils/logs.d.ts +2 -1
- package/build/common/runtimeLogs/utils/logs.js +8 -2
- package/build/esm/runtimeLogs/index.d.ts +1 -1
- package/build/esm/runtimeLogs/index.js +1 -1
- package/build/esm/runtimeLogs/logs/kinds.d.ts +32 -0
- package/build/esm/runtimeLogs/logs/kinds.js +30 -0
- package/build/esm/runtimeLogs/logs/levels.d.ts +2 -0
- package/build/esm/runtimeLogs/logs/levels.js +2 -0
- package/build/esm/runtimeLogs/logs/steps/api.d.ts +38 -25
- package/build/esm/runtimeLogs/logs/steps/code.d.ts +7 -2
- package/build/esm/runtimeLogs/runtime/logBuffer.d.ts +1 -1
- package/build/esm/runtimeLogs/utils/logs.d.ts +2 -1
- package/build/esm/runtimeLogs/utils/logs.js +6 -1
- package/package.json +2 -2
|
@@ -10,8 +10,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.getValueForLogLevel = void 0;
|
|
14
13
|
__exportStar(require("./logs"), exports);
|
|
15
14
|
__exportStar(require("./runtime"), exports);
|
|
16
|
-
|
|
17
|
-
Object.defineProperty(exports, "getValueForLogLevel", { enumerable: true, get: function () { return utils_1.getValueForLogLevel; } });
|
|
15
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { NodeType } from "../../node";
|
|
1
2
|
/** Similar to {@link NodeType}, but for runtime logging */
|
|
2
3
|
export declare enum StepLogKind {
|
|
3
4
|
TEXT = "text",
|
|
4
5
|
SPEAK = "speak",
|
|
5
6
|
AUDIO = "audio",
|
|
6
7
|
VISUALS = "visuals",
|
|
8
|
+
CARD = "card",
|
|
9
|
+
CAROUSEL = "carousel",
|
|
7
10
|
BUTTONS = "buttons",
|
|
8
11
|
CHOICE = "choice",
|
|
9
12
|
CAPTURE = "capture",
|
|
@@ -24,3 +27,32 @@ export declare enum StepLogKind {
|
|
|
24
27
|
export declare enum GlobalLogKind {
|
|
25
28
|
CONVERSATION_START = "conversation_start"
|
|
26
29
|
}
|
|
30
|
+
declare const NODE_TYPE_TO_STEP_LOG_KIND: {
|
|
31
|
+
readonly text: StepLogKind.TEXT;
|
|
32
|
+
readonly speak: StepLogKind.SPEAK;
|
|
33
|
+
readonly start: StepLogKind.START;
|
|
34
|
+
readonly card: StepLogKind.CARD;
|
|
35
|
+
readonly carousel: StepLogKind.CAROUSEL;
|
|
36
|
+
readonly buttons: StepLogKind.BUTTONS;
|
|
37
|
+
readonly set: StepLogKind.SET;
|
|
38
|
+
readonly setV2: StepLogKind.SET;
|
|
39
|
+
readonly if: StepLogKind.CONDITION;
|
|
40
|
+
readonly ifV2: StepLogKind.CONDITION;
|
|
41
|
+
readonly random: StepLogKind.RANDOM;
|
|
42
|
+
readonly capture: StepLogKind.CAPTURE;
|
|
43
|
+
readonly captureV2: StepLogKind.CAPTURE;
|
|
44
|
+
readonly api: StepLogKind.API;
|
|
45
|
+
/** @deprecated */
|
|
46
|
+
readonly google_sheets: StepLogKind.GOOGLE_SHEETS;
|
|
47
|
+
readonly intent: StepLogKind.INTENT;
|
|
48
|
+
readonly code: StepLogKind.CUSTOM_CODE;
|
|
49
|
+
readonly exit: StepLogKind.EXIT;
|
|
50
|
+
readonly prompt: StepLogKind.PROMPT;
|
|
51
|
+
readonly visual: StepLogKind.VISUALS;
|
|
52
|
+
};
|
|
53
|
+
declare type MappableNodeType = keyof typeof NODE_TYPE_TO_STEP_LOG_KIND;
|
|
54
|
+
declare type NonMappableNodeType = Exclude<NodeType, MappableNodeType>;
|
|
55
|
+
export declare function nodeTypeToStepLogKind(nodeType: MappableNodeType): StepLogKind;
|
|
56
|
+
export declare function nodeTypeToStepLogKind(nodeType: NonMappableNodeType): undefined;
|
|
57
|
+
export declare function nodeTypeToStepLogKind(nodeType: NodeType): StepLogKind | undefined;
|
|
58
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GlobalLogKind = exports.StepLogKind = void 0;
|
|
3
|
+
exports.nodeTypeToStepLogKind = exports.GlobalLogKind = exports.StepLogKind = void 0;
|
|
4
|
+
const node_1 = require("../../node");
|
|
4
5
|
/** Similar to {@link NodeType}, but for runtime logging */
|
|
5
6
|
var StepLogKind;
|
|
6
7
|
(function (StepLogKind) {
|
|
@@ -9,6 +10,8 @@ var StepLogKind;
|
|
|
9
10
|
StepLogKind["SPEAK"] = "speak";
|
|
10
11
|
StepLogKind["AUDIO"] = "audio";
|
|
11
12
|
StepLogKind["VISUALS"] = "visuals";
|
|
13
|
+
StepLogKind["CARD"] = "card";
|
|
14
|
+
StepLogKind["CAROUSEL"] = "carousel";
|
|
12
15
|
// User input
|
|
13
16
|
StepLogKind["BUTTONS"] = "buttons";
|
|
14
17
|
StepLogKind["CHOICE"] = "choice";
|
|
@@ -34,3 +37,31 @@ var GlobalLogKind;
|
|
|
34
37
|
(function (GlobalLogKind) {
|
|
35
38
|
GlobalLogKind["CONVERSATION_START"] = "conversation_start";
|
|
36
39
|
})(GlobalLogKind = exports.GlobalLogKind || (exports.GlobalLogKind = {}));
|
|
40
|
+
const NODE_TYPE_TO_STEP_LOG_KIND = {
|
|
41
|
+
[node_1.NodeType.TEXT]: StepLogKind.TEXT,
|
|
42
|
+
[node_1.NodeType.SPEAK]: StepLogKind.SPEAK,
|
|
43
|
+
[node_1.NodeType.START]: StepLogKind.START,
|
|
44
|
+
[node_1.NodeType.CARD]: StepLogKind.CARD,
|
|
45
|
+
[node_1.NodeType.CAROUSEL]: StepLogKind.CAROUSEL,
|
|
46
|
+
[node_1.NodeType.BUTTONS]: StepLogKind.BUTTONS,
|
|
47
|
+
[node_1.NodeType.SET]: StepLogKind.SET,
|
|
48
|
+
[node_1.NodeType.SET_V2]: StepLogKind.SET,
|
|
49
|
+
[node_1.NodeType.IF]: StepLogKind.CONDITION,
|
|
50
|
+
[node_1.NodeType.IF_V2]: StepLogKind.CONDITION,
|
|
51
|
+
[node_1.NodeType.RANDOM]: StepLogKind.RANDOM,
|
|
52
|
+
[node_1.NodeType.CAPTURE]: StepLogKind.CAPTURE,
|
|
53
|
+
[node_1.NodeType.CAPTURE_V2]: StepLogKind.CAPTURE,
|
|
54
|
+
[node_1.NodeType.API]: StepLogKind.API,
|
|
55
|
+
/** @deprecated */
|
|
56
|
+
[node_1.NodeType.GOOGLE_SHEETS]: StepLogKind.GOOGLE_SHEETS,
|
|
57
|
+
[node_1.NodeType.INTENT]: StepLogKind.INTENT,
|
|
58
|
+
[node_1.NodeType.CODE]: StepLogKind.CUSTOM_CODE,
|
|
59
|
+
[node_1.NodeType.EXIT]: StepLogKind.EXIT,
|
|
60
|
+
[node_1.NodeType.PROMPT]: StepLogKind.PROMPT,
|
|
61
|
+
[node_1.NodeType.VISUAL]: StepLogKind.VISUALS,
|
|
62
|
+
};
|
|
63
|
+
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
|
64
|
+
function nodeTypeToStepLogKind(nodeType) {
|
|
65
|
+
return nodeType in NODE_TYPE_TO_STEP_LOG_KIND ? NODE_TYPE_TO_STEP_LOG_KIND[nodeType] : undefined;
|
|
66
|
+
}
|
|
67
|
+
exports.nodeTypeToStepLogKind = nodeTypeToStepLogKind;
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LogLevel = void 0;
|
|
4
4
|
var LogLevel;
|
|
5
5
|
(function (LogLevel) {
|
|
6
|
+
/** This is a special log level. No logs should ever use this, its only use is denoting when logging should be disabled. */
|
|
7
|
+
LogLevel["OFF"] = "off";
|
|
6
8
|
LogLevel["ERROR"] = "error";
|
|
7
9
|
LogLevel["WARN"] = "warn";
|
|
8
10
|
LogLevel["INFO"] = "info";
|
|
@@ -2,33 +2,46 @@ import { APIBodyType, APIMethod } from "../../../node/api";
|
|
|
2
2
|
import { BaseStepLog } from '../base';
|
|
3
3
|
import { StepLogKind } from '../kinds';
|
|
4
4
|
import { LogLevel } from '../levels';
|
|
5
|
+
interface ApiLogMessageRequest {
|
|
6
|
+
method: APIMethod;
|
|
7
|
+
url: string;
|
|
8
|
+
headers: null;
|
|
9
|
+
query: null;
|
|
10
|
+
bodyType: null;
|
|
11
|
+
body: null;
|
|
12
|
+
}
|
|
13
|
+
interface ApiLogMessageResponse {
|
|
14
|
+
statusCode: number;
|
|
15
|
+
statusMessage: string;
|
|
16
|
+
headers: null;
|
|
17
|
+
body: null;
|
|
18
|
+
}
|
|
5
19
|
interface ApiLogMessage {
|
|
6
|
-
request:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
request: ApiLogMessageRequest;
|
|
21
|
+
response: ApiLogMessageResponse;
|
|
22
|
+
}
|
|
23
|
+
declare type VerboseApiLogMessageRequest = {
|
|
24
|
+
url: string;
|
|
25
|
+
headers: Record<string, string>;
|
|
26
|
+
query: Record<string, string>;
|
|
27
|
+
} & ({
|
|
28
|
+
method: Exclude<APIMethod, APIMethod.GET>;
|
|
29
|
+
bodyType: APIBodyType;
|
|
30
|
+
body: string;
|
|
31
|
+
} | {
|
|
32
|
+
method: APIMethod.GET;
|
|
33
|
+
bodyType: null;
|
|
34
|
+
body: null;
|
|
35
|
+
});
|
|
36
|
+
interface VerboseApiLogMessageResponse {
|
|
37
|
+
statusCode: number;
|
|
38
|
+
statusMessage: string;
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
body: string;
|
|
14
41
|
}
|
|
15
42
|
interface VerboseApiLogMessage {
|
|
16
|
-
request:
|
|
17
|
-
|
|
18
|
-
query: Record<string, string>;
|
|
19
|
-
} & ({
|
|
20
|
-
method: Exclude<APIMethod, APIMethod.GET>;
|
|
21
|
-
bodyType: APIBodyType;
|
|
22
|
-
body: string;
|
|
23
|
-
} | {
|
|
24
|
-
method: APIMethod.GET;
|
|
25
|
-
bodyType: null;
|
|
26
|
-
body: null;
|
|
27
|
-
});
|
|
28
|
-
response: {
|
|
29
|
-
headers: Record<string, string>;
|
|
30
|
-
body: string;
|
|
31
|
-
};
|
|
43
|
+
request: VerboseApiLogMessageRequest;
|
|
44
|
+
response: VerboseApiLogMessageResponse;
|
|
32
45
|
}
|
|
33
|
-
export declare type ApiStepLog = BaseStepLog<StepLogKind.API, ApiLogMessage, LogLevel.INFO | LogLevel.
|
|
46
|
+
export declare type ApiStepLog = BaseStepLog<StepLogKind.API, ApiLogMessage, LogLevel.INFO> | BaseStepLog<StepLogKind.API, VerboseApiLogMessage, LogLevel.VERBOSE> | BaseStepLog<StepLogKind.API, ApiLogMessage | VerboseApiLogMessage, LogLevel.ERROR>;
|
|
34
47
|
export {};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { BaseStepLog } from '../base';
|
|
2
2
|
import { StepLogKind } from '../kinds';
|
|
3
3
|
import { LogLevel } from '../levels';
|
|
4
|
+
interface ChangedVariable<T> {
|
|
5
|
+
before: T;
|
|
6
|
+
after: T;
|
|
7
|
+
}
|
|
4
8
|
export declare type CodeStepLog = BaseStepLog<StepLogKind.CUSTOM_CODE, {
|
|
5
|
-
data: any;
|
|
6
9
|
error: null;
|
|
10
|
+
changedVariables: Record<string, ChangedVariable<any>>;
|
|
7
11
|
}, LogLevel.INFO> | BaseStepLog<StepLogKind.CUSTOM_CODE, {
|
|
8
|
-
data: null;
|
|
9
12
|
error: any;
|
|
13
|
+
changedVariables: null;
|
|
10
14
|
}, LogLevel.ERROR>;
|
|
15
|
+
export {};
|
|
@@ -7,7 +7,7 @@ export interface LogBuffer {
|
|
|
7
7
|
/** The number of {@link Log} in this {@link LogBuffer}'s buffer. */
|
|
8
8
|
readonly bufferSize: number;
|
|
9
9
|
/** Add {@link Log} to this {@link LogBuffer}'s buffer. */
|
|
10
|
-
push(...logs: Log[]): void;
|
|
10
|
+
push(...logs: readonly Log[]): void;
|
|
11
11
|
/** Dispatch all {@link Log} from this {@link LogBuffer}'s buffer and then remove them. */
|
|
12
12
|
flush(): void;
|
|
13
13
|
/** Remove all {@link Log} from this {@link LogBuffer}'s buffer. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { LogLevel } from '../logs/levels';
|
|
2
|
-
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". */
|
|
2
|
+
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". The value `-1` is used to disable logging. */
|
|
3
3
|
export declare const getValueForLogLevel: (level: LogLevel) => number;
|
|
4
|
+
export declare const isLogLevel: (level: string) => level is LogLevel;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getValueForLogLevel = void 0;
|
|
3
|
+
exports.isLogLevel = exports.getValueForLogLevel = void 0;
|
|
4
4
|
const levels_1 = require("../logs/levels");
|
|
5
5
|
const logLevelValues = {
|
|
6
|
+
[levels_1.LogLevel.OFF]: -1,
|
|
6
7
|
[levels_1.LogLevel.ERROR]: 0,
|
|
7
8
|
[levels_1.LogLevel.WARN]: 1,
|
|
8
9
|
[levels_1.LogLevel.INFO]: 2,
|
|
9
10
|
[levels_1.LogLevel.VERBOSE]: 3,
|
|
10
11
|
};
|
|
11
|
-
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". */
|
|
12
|
+
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". The value `-1` is used to disable logging. */
|
|
12
13
|
const getValueForLogLevel = (level) => logLevelValues[level];
|
|
13
14
|
exports.getValueForLogLevel = getValueForLogLevel;
|
|
15
|
+
const ALL_LOG_LEVELS = new Set(Object.values(levels_1.LogLevel));
|
|
16
|
+
const isLogLevel = (level) => {
|
|
17
|
+
return ALL_LOG_LEVELS.has(level);
|
|
18
|
+
};
|
|
19
|
+
exports.isLogLevel = isLogLevel;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { NodeType } from "../../node";
|
|
1
2
|
/** Similar to {@link NodeType}, but for runtime logging */
|
|
2
3
|
export declare enum StepLogKind {
|
|
3
4
|
TEXT = "text",
|
|
4
5
|
SPEAK = "speak",
|
|
5
6
|
AUDIO = "audio",
|
|
6
7
|
VISUALS = "visuals",
|
|
8
|
+
CARD = "card",
|
|
9
|
+
CAROUSEL = "carousel",
|
|
7
10
|
BUTTONS = "buttons",
|
|
8
11
|
CHOICE = "choice",
|
|
9
12
|
CAPTURE = "capture",
|
|
@@ -24,3 +27,32 @@ export declare enum StepLogKind {
|
|
|
24
27
|
export declare enum GlobalLogKind {
|
|
25
28
|
CONVERSATION_START = "conversation_start"
|
|
26
29
|
}
|
|
30
|
+
declare const NODE_TYPE_TO_STEP_LOG_KIND: {
|
|
31
|
+
readonly text: StepLogKind.TEXT;
|
|
32
|
+
readonly speak: StepLogKind.SPEAK;
|
|
33
|
+
readonly start: StepLogKind.START;
|
|
34
|
+
readonly card: StepLogKind.CARD;
|
|
35
|
+
readonly carousel: StepLogKind.CAROUSEL;
|
|
36
|
+
readonly buttons: StepLogKind.BUTTONS;
|
|
37
|
+
readonly set: StepLogKind.SET;
|
|
38
|
+
readonly setV2: StepLogKind.SET;
|
|
39
|
+
readonly if: StepLogKind.CONDITION;
|
|
40
|
+
readonly ifV2: StepLogKind.CONDITION;
|
|
41
|
+
readonly random: StepLogKind.RANDOM;
|
|
42
|
+
readonly capture: StepLogKind.CAPTURE;
|
|
43
|
+
readonly captureV2: StepLogKind.CAPTURE;
|
|
44
|
+
readonly api: StepLogKind.API;
|
|
45
|
+
/** @deprecated */
|
|
46
|
+
readonly google_sheets: StepLogKind.GOOGLE_SHEETS;
|
|
47
|
+
readonly intent: StepLogKind.INTENT;
|
|
48
|
+
readonly code: StepLogKind.CUSTOM_CODE;
|
|
49
|
+
readonly exit: StepLogKind.EXIT;
|
|
50
|
+
readonly prompt: StepLogKind.PROMPT;
|
|
51
|
+
readonly visual: StepLogKind.VISUALS;
|
|
52
|
+
};
|
|
53
|
+
declare type MappableNodeType = keyof typeof NODE_TYPE_TO_STEP_LOG_KIND;
|
|
54
|
+
declare type NonMappableNodeType = Exclude<NodeType, MappableNodeType>;
|
|
55
|
+
export declare function nodeTypeToStepLogKind(nodeType: MappableNodeType): StepLogKind;
|
|
56
|
+
export declare function nodeTypeToStepLogKind(nodeType: NonMappableNodeType): undefined;
|
|
57
|
+
export declare function nodeTypeToStepLogKind(nodeType: NodeType): StepLogKind | undefined;
|
|
58
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NodeType } from "../../node";
|
|
1
2
|
/** Similar to {@link NodeType}, but for runtime logging */
|
|
2
3
|
export var StepLogKind;
|
|
3
4
|
(function (StepLogKind) {
|
|
@@ -6,6 +7,8 @@ export var StepLogKind;
|
|
|
6
7
|
StepLogKind["SPEAK"] = "speak";
|
|
7
8
|
StepLogKind["AUDIO"] = "audio";
|
|
8
9
|
StepLogKind["VISUALS"] = "visuals";
|
|
10
|
+
StepLogKind["CARD"] = "card";
|
|
11
|
+
StepLogKind["CAROUSEL"] = "carousel";
|
|
9
12
|
// User input
|
|
10
13
|
StepLogKind["BUTTONS"] = "buttons";
|
|
11
14
|
StepLogKind["CHOICE"] = "choice";
|
|
@@ -31,3 +34,30 @@ export var GlobalLogKind;
|
|
|
31
34
|
(function (GlobalLogKind) {
|
|
32
35
|
GlobalLogKind["CONVERSATION_START"] = "conversation_start";
|
|
33
36
|
})(GlobalLogKind || (GlobalLogKind = {}));
|
|
37
|
+
const NODE_TYPE_TO_STEP_LOG_KIND = {
|
|
38
|
+
[NodeType.TEXT]: StepLogKind.TEXT,
|
|
39
|
+
[NodeType.SPEAK]: StepLogKind.SPEAK,
|
|
40
|
+
[NodeType.START]: StepLogKind.START,
|
|
41
|
+
[NodeType.CARD]: StepLogKind.CARD,
|
|
42
|
+
[NodeType.CAROUSEL]: StepLogKind.CAROUSEL,
|
|
43
|
+
[NodeType.BUTTONS]: StepLogKind.BUTTONS,
|
|
44
|
+
[NodeType.SET]: StepLogKind.SET,
|
|
45
|
+
[NodeType.SET_V2]: StepLogKind.SET,
|
|
46
|
+
[NodeType.IF]: StepLogKind.CONDITION,
|
|
47
|
+
[NodeType.IF_V2]: StepLogKind.CONDITION,
|
|
48
|
+
[NodeType.RANDOM]: StepLogKind.RANDOM,
|
|
49
|
+
[NodeType.CAPTURE]: StepLogKind.CAPTURE,
|
|
50
|
+
[NodeType.CAPTURE_V2]: StepLogKind.CAPTURE,
|
|
51
|
+
[NodeType.API]: StepLogKind.API,
|
|
52
|
+
/** @deprecated */
|
|
53
|
+
[NodeType.GOOGLE_SHEETS]: StepLogKind.GOOGLE_SHEETS,
|
|
54
|
+
[NodeType.INTENT]: StepLogKind.INTENT,
|
|
55
|
+
[NodeType.CODE]: StepLogKind.CUSTOM_CODE,
|
|
56
|
+
[NodeType.EXIT]: StepLogKind.EXIT,
|
|
57
|
+
[NodeType.PROMPT]: StepLogKind.PROMPT,
|
|
58
|
+
[NodeType.VISUAL]: StepLogKind.VISUALS,
|
|
59
|
+
};
|
|
60
|
+
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
|
61
|
+
export function nodeTypeToStepLogKind(nodeType) {
|
|
62
|
+
return nodeType in NODE_TYPE_TO_STEP_LOG_KIND ? NODE_TYPE_TO_STEP_LOG_KIND[nodeType] : undefined;
|
|
63
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export var LogLevel;
|
|
2
2
|
(function (LogLevel) {
|
|
3
|
+
/** This is a special log level. No logs should ever use this, its only use is denoting when logging should be disabled. */
|
|
4
|
+
LogLevel["OFF"] = "off";
|
|
3
5
|
LogLevel["ERROR"] = "error";
|
|
4
6
|
LogLevel["WARN"] = "warn";
|
|
5
7
|
LogLevel["INFO"] = "info";
|
|
@@ -2,33 +2,46 @@ import { APIBodyType, APIMethod } from "../../../node/api";
|
|
|
2
2
|
import { BaseStepLog } from '../base';
|
|
3
3
|
import { StepLogKind } from '../kinds';
|
|
4
4
|
import { LogLevel } from '../levels';
|
|
5
|
+
interface ApiLogMessageRequest {
|
|
6
|
+
method: APIMethod;
|
|
7
|
+
url: string;
|
|
8
|
+
headers: null;
|
|
9
|
+
query: null;
|
|
10
|
+
bodyType: null;
|
|
11
|
+
body: null;
|
|
12
|
+
}
|
|
13
|
+
interface ApiLogMessageResponse {
|
|
14
|
+
statusCode: number;
|
|
15
|
+
statusMessage: string;
|
|
16
|
+
headers: null;
|
|
17
|
+
body: null;
|
|
18
|
+
}
|
|
5
19
|
interface ApiLogMessage {
|
|
6
|
-
request:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
request: ApiLogMessageRequest;
|
|
21
|
+
response: ApiLogMessageResponse;
|
|
22
|
+
}
|
|
23
|
+
declare type VerboseApiLogMessageRequest = {
|
|
24
|
+
url: string;
|
|
25
|
+
headers: Record<string, string>;
|
|
26
|
+
query: Record<string, string>;
|
|
27
|
+
} & ({
|
|
28
|
+
method: Exclude<APIMethod, APIMethod.GET>;
|
|
29
|
+
bodyType: APIBodyType;
|
|
30
|
+
body: string;
|
|
31
|
+
} | {
|
|
32
|
+
method: APIMethod.GET;
|
|
33
|
+
bodyType: null;
|
|
34
|
+
body: null;
|
|
35
|
+
});
|
|
36
|
+
interface VerboseApiLogMessageResponse {
|
|
37
|
+
statusCode: number;
|
|
38
|
+
statusMessage: string;
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
body: string;
|
|
14
41
|
}
|
|
15
42
|
interface VerboseApiLogMessage {
|
|
16
|
-
request:
|
|
17
|
-
|
|
18
|
-
query: Record<string, string>;
|
|
19
|
-
} & ({
|
|
20
|
-
method: Exclude<APIMethod, APIMethod.GET>;
|
|
21
|
-
bodyType: APIBodyType;
|
|
22
|
-
body: string;
|
|
23
|
-
} | {
|
|
24
|
-
method: APIMethod.GET;
|
|
25
|
-
bodyType: null;
|
|
26
|
-
body: null;
|
|
27
|
-
});
|
|
28
|
-
response: {
|
|
29
|
-
headers: Record<string, string>;
|
|
30
|
-
body: string;
|
|
31
|
-
};
|
|
43
|
+
request: VerboseApiLogMessageRequest;
|
|
44
|
+
response: VerboseApiLogMessageResponse;
|
|
32
45
|
}
|
|
33
|
-
export declare type ApiStepLog = BaseStepLog<StepLogKind.API, ApiLogMessage, LogLevel.INFO | LogLevel.
|
|
46
|
+
export declare type ApiStepLog = BaseStepLog<StepLogKind.API, ApiLogMessage, LogLevel.INFO> | BaseStepLog<StepLogKind.API, VerboseApiLogMessage, LogLevel.VERBOSE> | BaseStepLog<StepLogKind.API, ApiLogMessage | VerboseApiLogMessage, LogLevel.ERROR>;
|
|
34
47
|
export {};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { BaseStepLog } from '../base';
|
|
2
2
|
import { StepLogKind } from '../kinds';
|
|
3
3
|
import { LogLevel } from '../levels';
|
|
4
|
+
interface ChangedVariable<T> {
|
|
5
|
+
before: T;
|
|
6
|
+
after: T;
|
|
7
|
+
}
|
|
4
8
|
export declare type CodeStepLog = BaseStepLog<StepLogKind.CUSTOM_CODE, {
|
|
5
|
-
data: any;
|
|
6
9
|
error: null;
|
|
10
|
+
changedVariables: Record<string, ChangedVariable<any>>;
|
|
7
11
|
}, LogLevel.INFO> | BaseStepLog<StepLogKind.CUSTOM_CODE, {
|
|
8
|
-
data: null;
|
|
9
12
|
error: any;
|
|
13
|
+
changedVariables: null;
|
|
10
14
|
}, LogLevel.ERROR>;
|
|
15
|
+
export {};
|
|
@@ -7,7 +7,7 @@ export interface LogBuffer {
|
|
|
7
7
|
/** The number of {@link Log} in this {@link LogBuffer}'s buffer. */
|
|
8
8
|
readonly bufferSize: number;
|
|
9
9
|
/** Add {@link Log} to this {@link LogBuffer}'s buffer. */
|
|
10
|
-
push(...logs: Log[]): void;
|
|
10
|
+
push(...logs: readonly Log[]): void;
|
|
11
11
|
/** Dispatch all {@link Log} from this {@link LogBuffer}'s buffer and then remove them. */
|
|
12
12
|
flush(): void;
|
|
13
13
|
/** Remove all {@link Log} from this {@link LogBuffer}'s buffer. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { LogLevel } from '../logs/levels';
|
|
2
|
-
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". */
|
|
2
|
+
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". The value `-1` is used to disable logging. */
|
|
3
3
|
export declare const getValueForLogLevel: (level: LogLevel) => number;
|
|
4
|
+
export declare const isLogLevel: (level: string) => level is LogLevel;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { LogLevel } from '../logs/levels';
|
|
2
2
|
const logLevelValues = {
|
|
3
|
+
[LogLevel.OFF]: -1,
|
|
3
4
|
[LogLevel.ERROR]: 0,
|
|
4
5
|
[LogLevel.WARN]: 1,
|
|
5
6
|
[LogLevel.INFO]: 2,
|
|
6
7
|
[LogLevel.VERBOSE]: 3,
|
|
7
8
|
};
|
|
8
|
-
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". */
|
|
9
|
+
/** Returns the number (non-negative integer) value of `level`. A higher number is more verbose. `0` is the least verbose and most "important". The value `-1` is used to disable logging. */
|
|
9
10
|
export const getValueForLogLevel = (level) => logLevelValues[level];
|
|
11
|
+
const ALL_LOG_LEVELS = new Set(Object.values(LogLevel));
|
|
12
|
+
export const isLogLevel = (level) => {
|
|
13
|
+
return ALL_LOG_LEVELS.has(level);
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voiceflow/base-types",
|
|
3
3
|
"description": "Voiceflow base project types",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.37.0",
|
|
5
5
|
"author": "Voiceflow",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/voiceflow/libs/issues"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"test:smoke": "exit 0",
|
|
44
44
|
"test:unit": "exit 0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "1a3db4ce0d0b8185ab11d3856ab118f65f432a74"
|
|
47
47
|
}
|