hume 0.8.0 → 0.8.1-beta0
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/.mock/definition/empathic-voice/__package__.yml +3 -65
- package/Client.d.ts +3 -0
- package/api/resources/empathicVoice/client/Client.d.ts +3 -0
- package/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +8 -8
- package/api/resources/empathicVoice/resources/chat/client/Socket.js +13 -40
- package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -0
- package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +4 -4
- package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -0
- package/api/resources/empathicVoice/resources/chats/client/Client.js +4 -4
- package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -0
- package/api/resources/empathicVoice/resources/configs/client/Client.js +19 -23
- package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -0
- package/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -23
- package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -0
- package/api/resources/empathicVoice/resources/tools/client/Client.js +19 -19
- package/api/resources/empathicVoice/types/SessionSettings.d.ts +2 -0
- package/api/resources/empathicVoice/types/VoiceArgs.d.ts +0 -2
- package/api/resources/empathicVoice/types/index.d.ts +0 -1
- package/api/resources/empathicVoice/types/index.js +0 -1
- package/api/resources/expressionMeasurement/client/Client.d.ts +3 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.js +12 -12
- package/core/form-data-utils/FormDataWrapper.js +1 -3
- package/core/schemas/Schema.d.ts +3 -4
- package/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/core/schemas/builders/lazy/lazy.js +8 -19
- package/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/core/schemas/builders/list/list.js +31 -44
- package/core/schemas/builders/object/object.js +88 -111
- package/core/schemas/builders/object/types.d.ts +2 -2
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/core/schemas/builders/record/record.js +49 -60
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +12 -21
- package/core/schemas/builders/set/set.js +6 -15
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/core/schemas/builders/union/union.js +51 -62
- package/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/dist/Client.d.ts +3 -0
- package/dist/api/resources/empathicVoice/client/Client.d.ts +3 -0
- package/dist/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +8 -8
- package/dist/api/resources/empathicVoice/resources/chat/client/Socket.js +13 -40
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -0
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +4 -4
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -0
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +4 -4
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +19 -23
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -0
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -23
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -0
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +19 -19
- package/dist/api/resources/empathicVoice/types/SessionSettings.d.ts +2 -0
- package/dist/api/resources/empathicVoice/types/VoiceArgs.d.ts +0 -2
- package/dist/api/resources/empathicVoice/types/index.d.ts +0 -1
- package/dist/api/resources/empathicVoice/types/index.js +0 -1
- package/dist/api/resources/expressionMeasurement/client/Client.d.ts +3 -0
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -0
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +12 -12
- package/dist/core/form-data-utils/FormDataWrapper.js +1 -3
- package/dist/core/schemas/Schema.d.ts +3 -4
- package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/dist/core/schemas/builders/lazy/lazy.js +8 -19
- package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/dist/core/schemas/builders/list/list.js +31 -44
- package/dist/core/schemas/builders/object/object.js +88 -111
- package/dist/core/schemas/builders/object/types.d.ts +2 -2
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/dist/core/schemas/builders/record/record.js +49 -60
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +12 -21
- package/dist/core/schemas/builders/set/set.js +6 -15
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/dist/core/schemas/builders/union/union.js +51 -62
- package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/dist/serialization/resources/empathicVoice/types/SessionSettings.d.ts +1 -0
- package/dist/serialization/resources/empathicVoice/types/SessionSettings.js +1 -0
- package/dist/serialization/resources/empathicVoice/types/VoiceArgs.d.ts +0 -3
- package/dist/serialization/resources/empathicVoice/types/VoiceArgs.js +0 -3
- package/dist/serialization/resources/empathicVoice/types/index.d.ts +0 -1
- package/dist/serialization/resources/empathicVoice/types/index.js +0 -1
- package/package.json +1 -1
- package/serialization/resources/empathicVoice/types/SessionSettings.d.ts +1 -0
- package/serialization/resources/empathicVoice/types/SessionSettings.js +1 -0
- package/serialization/resources/empathicVoice/types/VoiceArgs.d.ts +0 -3
- package/serialization/resources/empathicVoice/types/VoiceArgs.js +0 -3
- package/serialization/resources/empathicVoice/types/index.d.ts +0 -1
- package/serialization/resources/empathicVoice/types/index.js +0 -1
- package/api/resources/empathicVoice/types/Features.d.ts +0 -21
- package/api/resources/empathicVoice/types/Features.js +0 -5
- package/dist/api/resources/empathicVoice/types/Features.d.ts +0 -21
- package/dist/api/resources/empathicVoice/types/Features.js +0 -5
- package/dist/serialization/resources/empathicVoice/types/Features.d.ts +0 -19
- package/dist/serialization/resources/empathicVoice/types/Features.js +0 -40
- package/serialization/resources/empathicVoice/types/Features.d.ts +0 -19
- package/serialization/resources/empathicVoice/types/Features.js +0 -40
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.set = void 0;
|
|
13
4
|
const Schema_1 = require("../../Schema");
|
|
@@ -18,8 +9,8 @@ const schema_utils_1 = require("../schema-utils");
|
|
|
18
9
|
function set(schema) {
|
|
19
10
|
const listSchema = (0, list_1.list)(schema);
|
|
20
11
|
const baseSchema = {
|
|
21
|
-
parse: (raw, opts) =>
|
|
22
|
-
const parsedList =
|
|
12
|
+
parse: (raw, opts) => {
|
|
13
|
+
const parsedList = listSchema.parse(raw, opts);
|
|
23
14
|
if (parsedList.ok) {
|
|
24
15
|
return {
|
|
25
16
|
ok: true,
|
|
@@ -29,8 +20,8 @@ function set(schema) {
|
|
|
29
20
|
else {
|
|
30
21
|
return parsedList;
|
|
31
22
|
}
|
|
32
|
-
}
|
|
33
|
-
json: (parsed, opts) =>
|
|
23
|
+
},
|
|
24
|
+
json: (parsed, opts) => {
|
|
34
25
|
var _a;
|
|
35
26
|
if (!(parsed instanceof Set)) {
|
|
36
27
|
return {
|
|
@@ -43,9 +34,9 @@ function set(schema) {
|
|
|
43
34
|
],
|
|
44
35
|
};
|
|
45
36
|
}
|
|
46
|
-
const jsonList =
|
|
37
|
+
const jsonList = listSchema.json([...parsed], opts);
|
|
47
38
|
return jsonList;
|
|
48
|
-
}
|
|
39
|
+
},
|
|
49
40
|
getType: () => Schema_1.SchemaType.SET,
|
|
50
41
|
};
|
|
51
42
|
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.undiscriminatedUnion = void 0;
|
|
13
4
|
const Schema_1 = require("../../Schema");
|
|
@@ -15,37 +6,35 @@ const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
|
15
6
|
const schema_utils_1 = require("../schema-utils");
|
|
16
7
|
function undiscriminatedUnion(schemas) {
|
|
17
8
|
const baseSchema = {
|
|
18
|
-
parse: (raw, opts) =>
|
|
9
|
+
parse: (raw, opts) => {
|
|
19
10
|
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.parse(raw, opts), schemas, opts);
|
|
20
|
-
}
|
|
21
|
-
json: (parsed, opts) =>
|
|
11
|
+
},
|
|
12
|
+
json: (parsed, opts) => {
|
|
22
13
|
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.json(parsed, opts), schemas, opts);
|
|
23
|
-
}
|
|
14
|
+
},
|
|
24
15
|
getType: () => Schema_1.SchemaType.UNDISCRIMINATED_UNION,
|
|
25
16
|
};
|
|
26
17
|
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
27
18
|
}
|
|
28
19
|
exports.undiscriminatedUnion = undiscriminatedUnion;
|
|
29
20
|
function validateAndTransformUndiscriminatedUnion(transform, schemas, opts) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
}
|
|
21
|
+
const errors = [];
|
|
22
|
+
for (const [index, schema] of schemas.entries()) {
|
|
23
|
+
const transformed = transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
|
|
24
|
+
if (transformed.ok) {
|
|
25
|
+
return transformed;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
for (const error of transformed.errors) {
|
|
29
|
+
errors.push({
|
|
30
|
+
path: error.path,
|
|
31
|
+
message: `[Variant ${index}] ${error.message}`,
|
|
32
|
+
});
|
|
44
33
|
}
|
|
45
34
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
ok: false,
|
|
38
|
+
errors,
|
|
39
|
+
};
|
|
51
40
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
3
|
var t = {};
|
|
13
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -36,7 +27,7 @@ function union(discriminant, union) {
|
|
|
36
27
|
: discriminant.parsedDiscriminant;
|
|
37
28
|
const discriminantValueSchema = (0, enum_1.enum_)((0, keys_1.keys)(union));
|
|
38
29
|
const baseSchema = {
|
|
39
|
-
parse: (raw, opts) =>
|
|
30
|
+
parse: (raw, opts) => {
|
|
40
31
|
return transformAndValidateUnion({
|
|
41
32
|
value: raw,
|
|
42
33
|
discriminant: rawDiscriminant,
|
|
@@ -53,8 +44,8 @@ function union(discriminant, union) {
|
|
|
53
44
|
transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts),
|
|
54
45
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
55
46
|
});
|
|
56
|
-
}
|
|
57
|
-
json: (parsed, opts) =>
|
|
47
|
+
},
|
|
48
|
+
json: (parsed, opts) => {
|
|
58
49
|
return transformAndValidateUnion({
|
|
59
50
|
value: parsed,
|
|
60
51
|
discriminant: parsedDiscriminant,
|
|
@@ -71,71 +62,69 @@ function union(discriminant, union) {
|
|
|
71
62
|
transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts),
|
|
72
63
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
73
64
|
});
|
|
74
|
-
}
|
|
65
|
+
},
|
|
75
66
|
getType: () => Schema_1.SchemaType.UNION,
|
|
76
67
|
};
|
|
77
68
|
return Object.assign(Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema));
|
|
78
69
|
}
|
|
79
70
|
exports.union = union;
|
|
80
71
|
function transformAndValidateUnion({ value, discriminant, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnrecognizedUnionMembers = false, transformAdditionalProperties, breadcrumbsPrefix = [], }) {
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
if (!(0, isPlainObject_1.isPlainObject)(value)) {
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
errors: [
|
|
76
|
+
{
|
|
77
|
+
path: breadcrumbsPrefix,
|
|
78
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
84
|
+
if (discriminantValue == null) {
|
|
85
|
+
return {
|
|
86
|
+
ok: false,
|
|
87
|
+
errors: [
|
|
88
|
+
{
|
|
89
|
+
path: breadcrumbsPrefix,
|
|
90
|
+
message: `Missing discriminant ("${discriminant}")`,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue);
|
|
96
|
+
if (!transformedDiscriminantValue.ok) {
|
|
97
|
+
return {
|
|
98
|
+
ok: false,
|
|
99
|
+
errors: transformedDiscriminantValue.errors,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
|
|
103
|
+
if (additionalPropertiesSchema == null) {
|
|
104
|
+
if (allowUnrecognizedUnionMembers) {
|
|
83
105
|
return {
|
|
84
|
-
ok:
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
path: breadcrumbsPrefix,
|
|
88
|
-
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
|
|
89
|
-
},
|
|
90
|
-
],
|
|
106
|
+
ok: true,
|
|
107
|
+
value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
|
|
91
108
|
};
|
|
92
109
|
}
|
|
93
|
-
|
|
94
|
-
if (discriminantValue == null) {
|
|
110
|
+
else {
|
|
95
111
|
return {
|
|
96
112
|
ok: false,
|
|
97
113
|
errors: [
|
|
98
114
|
{
|
|
99
|
-
path: breadcrumbsPrefix,
|
|
100
|
-
message:
|
|
115
|
+
path: [...breadcrumbsPrefix, discriminant],
|
|
116
|
+
message: "Unexpected discriminant value",
|
|
101
117
|
},
|
|
102
118
|
],
|
|
103
119
|
};
|
|
104
120
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (allowUnrecognizedUnionMembers) {
|
|
115
|
-
return {
|
|
116
|
-
ok: true,
|
|
117
|
-
value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
return {
|
|
122
|
-
ok: false,
|
|
123
|
-
errors: [
|
|
124
|
-
{
|
|
125
|
-
path: [...breadcrumbsPrefix, discriminant],
|
|
126
|
-
message: "Unexpected discriminant value",
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const transformedAdditionalProperties = yield transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
|
|
133
|
-
if (!transformedAdditionalProperties.ok) {
|
|
134
|
-
return transformedAdditionalProperties;
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
ok: true,
|
|
138
|
-
value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
|
|
139
|
-
};
|
|
140
|
-
});
|
|
121
|
+
}
|
|
122
|
+
const transformedAdditionalProperties = transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
|
|
123
|
+
if (!transformedAdditionalProperties.ok) {
|
|
124
|
+
return transformedAdditionalProperties;
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
ok: true,
|
|
128
|
+
value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
|
|
129
|
+
};
|
|
141
130
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.maybeSkipValidation = void 0;
|
|
13
4
|
function maybeSkipValidation(schema) {
|
|
@@ -15,8 +6,8 @@ function maybeSkipValidation(schema) {
|
|
|
15
6
|
}
|
|
16
7
|
exports.maybeSkipValidation = maybeSkipValidation;
|
|
17
8
|
function transformAndMaybeSkipValidation(transform) {
|
|
18
|
-
return (value, opts) =>
|
|
19
|
-
const transformed =
|
|
9
|
+
return (value, opts) => {
|
|
10
|
+
const transformed = transform(value, opts);
|
|
20
11
|
const { skipValidation = false } = opts !== null && opts !== void 0 ? opts : {};
|
|
21
12
|
if (!transformed.ok && skipValidation) {
|
|
22
13
|
// eslint-disable-next-line no-console
|
|
@@ -33,5 +24,5 @@ function transformAndMaybeSkipValidation(transform) {
|
|
|
33
24
|
else {
|
|
34
25
|
return transformed;
|
|
35
26
|
}
|
|
36
|
-
}
|
|
27
|
+
};
|
|
37
28
|
}
|
package/dist/Client.d.ts
CHANGED
|
@@ -12,8 +12,11 @@ export declare namespace HumeClient {
|
|
|
12
12
|
fetcher?: core.FetchFunction;
|
|
13
13
|
}
|
|
14
14
|
interface RequestOptions {
|
|
15
|
+
/** The maximum time to wait for a response in seconds. */
|
|
15
16
|
timeoutInSeconds?: number;
|
|
17
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
16
18
|
maxRetries?: number;
|
|
19
|
+
/** A hook to abort the request. */
|
|
17
20
|
abortSignal?: AbortSignal;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
@@ -16,8 +16,11 @@ export declare namespace EmpathicVoice {
|
|
|
16
16
|
fetcher?: core.FetchFunction;
|
|
17
17
|
}
|
|
18
18
|
interface RequestOptions {
|
|
19
|
+
/** The maximum time to wait for a response in seconds. */
|
|
19
20
|
timeoutInSeconds?: number;
|
|
21
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
20
22
|
maxRetries?: number;
|
|
23
|
+
/** A hook to abort the request. */
|
|
21
24
|
abortSignal?: AbortSignal;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -35,35 +35,35 @@ export declare class ChatSocket {
|
|
|
35
35
|
/**
|
|
36
36
|
* Send audio input
|
|
37
37
|
*/
|
|
38
|
-
sendAudioInput(message: Omit<Hume.empathicVoice.AudioInput, "type">):
|
|
38
|
+
sendAudioInput(message: Omit<Hume.empathicVoice.AudioInput, "type">): void;
|
|
39
39
|
/**
|
|
40
40
|
* Send session settings
|
|
41
41
|
*/
|
|
42
|
-
sendSessionSettings(message: Omit<Hume.empathicVoice.SessionSettings, "type">):
|
|
42
|
+
sendSessionSettings(message: Omit<Hume.empathicVoice.SessionSettings, "type">): void;
|
|
43
43
|
/**
|
|
44
44
|
* Send assistant input
|
|
45
45
|
*/
|
|
46
|
-
sendAssistantInput(message: Omit<Hume.empathicVoice.AssistantInput, "type">):
|
|
46
|
+
sendAssistantInput(message: Omit<Hume.empathicVoice.AssistantInput, "type">): void;
|
|
47
47
|
/**
|
|
48
48
|
* Send pause assistant message
|
|
49
49
|
*/
|
|
50
|
-
pauseAssistant(message: Omit<Hume.empathicVoice.PauseAssistantMessage, "type">):
|
|
50
|
+
pauseAssistant(message: Omit<Hume.empathicVoice.PauseAssistantMessage, "type">): void;
|
|
51
51
|
/**
|
|
52
52
|
* Send resume assistant message
|
|
53
53
|
*/
|
|
54
|
-
resumeAssistant(message: Omit<Hume.empathicVoice.ResumeAssistantMessage, "type">):
|
|
54
|
+
resumeAssistant(message: Omit<Hume.empathicVoice.ResumeAssistantMessage, "type">): void;
|
|
55
55
|
/**
|
|
56
56
|
* Send tool response message
|
|
57
57
|
*/
|
|
58
|
-
sendToolResponseMessage(message: Omit<Hume.empathicVoice.ToolResponseMessage, "type">):
|
|
58
|
+
sendToolResponseMessage(message: Omit<Hume.empathicVoice.ToolResponseMessage, "type">): void;
|
|
59
59
|
/**
|
|
60
60
|
* Send tool error message
|
|
61
61
|
*/
|
|
62
|
-
sendToolErrorMessage(message: Omit<Hume.empathicVoice.ToolErrorMessage, "type">):
|
|
62
|
+
sendToolErrorMessage(message: Omit<Hume.empathicVoice.ToolErrorMessage, "type">): void;
|
|
63
63
|
/**
|
|
64
64
|
* Send text input
|
|
65
65
|
*/
|
|
66
|
-
sendUserInput(text: string):
|
|
66
|
+
sendUserInput(text: string): void;
|
|
67
67
|
/**
|
|
68
68
|
* Closes the underlying socket.
|
|
69
69
|
*/
|
|
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
26
|
exports.ChatSocket = void 0;
|
|
36
27
|
const serializers = __importStar(require("../../../../../../serialization/index"));
|
|
@@ -92,67 +83,51 @@ class ChatSocket {
|
|
|
92
83
|
* Send audio input
|
|
93
84
|
*/
|
|
94
85
|
sendAudioInput(message) {
|
|
95
|
-
|
|
96
|
-
yield this.sendJson(Object.assign({ type: "audio_input" }, message));
|
|
97
|
-
});
|
|
86
|
+
this.sendJson(Object.assign({ type: "audio_input" }, message));
|
|
98
87
|
}
|
|
99
88
|
/**
|
|
100
89
|
* Send session settings
|
|
101
90
|
*/
|
|
102
91
|
sendSessionSettings(message) {
|
|
103
|
-
|
|
104
|
-
yield this.sendJson(Object.assign({ type: "session_settings" }, message));
|
|
105
|
-
});
|
|
92
|
+
this.sendJson(Object.assign({ type: "session_settings" }, message));
|
|
106
93
|
}
|
|
107
94
|
/**
|
|
108
95
|
* Send assistant input
|
|
109
96
|
*/
|
|
110
97
|
sendAssistantInput(message) {
|
|
111
|
-
|
|
112
|
-
yield this.sendJson(Object.assign({ type: "assistant_input" }, message));
|
|
113
|
-
});
|
|
98
|
+
this.sendJson(Object.assign({ type: "assistant_input" }, message));
|
|
114
99
|
}
|
|
115
100
|
/**
|
|
116
101
|
* Send pause assistant message
|
|
117
102
|
*/
|
|
118
103
|
pauseAssistant(message) {
|
|
119
|
-
|
|
120
|
-
yield this.sendJson(Object.assign({ type: "pause_assistant_message" }, message));
|
|
121
|
-
});
|
|
104
|
+
this.sendJson(Object.assign({ type: "pause_assistant_message" }, message));
|
|
122
105
|
}
|
|
123
106
|
/**
|
|
124
107
|
* Send resume assistant message
|
|
125
108
|
*/
|
|
126
109
|
resumeAssistant(message) {
|
|
127
|
-
|
|
128
|
-
yield this.sendJson(Object.assign({ type: "resume_assistant_message" }, message));
|
|
129
|
-
});
|
|
110
|
+
this.sendJson(Object.assign({ type: "resume_assistant_message" }, message));
|
|
130
111
|
}
|
|
131
112
|
/**
|
|
132
113
|
* Send tool response message
|
|
133
114
|
*/
|
|
134
115
|
sendToolResponseMessage(message) {
|
|
135
|
-
|
|
136
|
-
yield this.sendJson(Object.assign({ type: "tool_response" }, message));
|
|
137
|
-
});
|
|
116
|
+
this.sendJson(Object.assign({ type: "tool_response" }, message));
|
|
138
117
|
}
|
|
139
118
|
/**
|
|
140
119
|
* Send tool error message
|
|
141
120
|
*/
|
|
142
121
|
sendToolErrorMessage(message) {
|
|
143
|
-
|
|
144
|
-
yield this.sendJson(Object.assign({ type: "tool_error" }, message));
|
|
145
|
-
});
|
|
122
|
+
this.sendJson(Object.assign({ type: "tool_error" }, message));
|
|
146
123
|
}
|
|
147
124
|
/**
|
|
148
125
|
* Send text input
|
|
149
126
|
*/
|
|
150
127
|
sendUserInput(text) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
text,
|
|
155
|
-
});
|
|
128
|
+
this.sendJson({
|
|
129
|
+
type: "user_input",
|
|
130
|
+
text,
|
|
156
131
|
});
|
|
157
132
|
}
|
|
158
133
|
/**
|
|
@@ -166,12 +141,10 @@ class ChatSocket {
|
|
|
166
141
|
this.socket.removeEventListener('error', this.handleError);
|
|
167
142
|
}
|
|
168
143
|
sendJson(payload) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
unrecognizedObjectKeys: "strip",
|
|
172
|
-
});
|
|
173
|
-
this.socket.send(JSON.stringify(jsonPayload));
|
|
144
|
+
const jsonPayload = serializers.empathicVoice.PublishEvent.jsonOrThrow(payload, {
|
|
145
|
+
unrecognizedObjectKeys: "strip",
|
|
174
146
|
});
|
|
147
|
+
this.socket.send(JSON.stringify(jsonPayload));
|
|
175
148
|
}
|
|
176
149
|
}
|
|
177
150
|
exports.ChatSocket = ChatSocket;
|
|
@@ -11,8 +11,11 @@ export declare namespace ChatGroups {
|
|
|
11
11
|
fetcher?: core.FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
interface RequestOptions {
|
|
14
|
+
/** The maximum time to wait for a response in seconds. */
|
|
14
15
|
timeoutInSeconds?: number;
|
|
16
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
17
|
maxRetries?: number;
|
|
18
|
+
/** A hook to abort the request. */
|
|
16
19
|
abortSignal?: AbortSignal;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -72,7 +72,7 @@ class ChatGroups {
|
|
|
72
72
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
73
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/chat_groups"),
|
|
74
74
|
method: "GET",
|
|
75
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
75
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.7.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
76
76
|
contentType: "application/json",
|
|
77
77
|
queryParameters: _queryParams,
|
|
78
78
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -80,7 +80,7 @@ class ChatGroups {
|
|
|
80
80
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
81
81
|
});
|
|
82
82
|
if (_response.ok) {
|
|
83
|
-
return
|
|
83
|
+
return serializers.empathicVoice.ReturnPagedChatGroups.parseOrThrow(_response.body, {
|
|
84
84
|
unrecognizedObjectKeys: "passthrough",
|
|
85
85
|
allowUnrecognizedUnionMembers: true,
|
|
86
86
|
allowUnrecognizedEnumValues: true,
|
|
@@ -133,7 +133,7 @@ class ChatGroups {
|
|
|
133
133
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
134
134
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, `v0/evi/chat_groups/${encodeURIComponent(id)}/events`),
|
|
135
135
|
method: "GET",
|
|
136
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
136
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.7.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
137
137
|
contentType: "application/json",
|
|
138
138
|
queryParameters: _queryParams,
|
|
139
139
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -141,7 +141,7 @@ class ChatGroups {
|
|
|
141
141
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
142
142
|
});
|
|
143
143
|
if (_response.ok) {
|
|
144
|
-
return
|
|
144
|
+
return serializers.empathicVoice.ReturnChatGroupPagedEvents.parseOrThrow(_response.body, {
|
|
145
145
|
unrecognizedObjectKeys: "passthrough",
|
|
146
146
|
allowUnrecognizedUnionMembers: true,
|
|
147
147
|
allowUnrecognizedEnumValues: true,
|
|
@@ -11,8 +11,11 @@ export declare namespace Chats {
|
|
|
11
11
|
fetcher?: core.FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
interface RequestOptions {
|
|
14
|
+
/** The maximum time to wait for a response in seconds. */
|
|
14
15
|
timeoutInSeconds?: number;
|
|
16
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
17
|
maxRetries?: number;
|
|
18
|
+
/** A hook to abort the request. */
|
|
16
19
|
abortSignal?: AbortSignal;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -72,7 +72,7 @@ class Chats {
|
|
|
72
72
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
73
73
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/evi/chats"),
|
|
74
74
|
method: "GET",
|
|
75
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
75
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.7.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
76
76
|
contentType: "application/json",
|
|
77
77
|
queryParameters: _queryParams,
|
|
78
78
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -80,7 +80,7 @@ class Chats {
|
|
|
80
80
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
81
81
|
});
|
|
82
82
|
if (_response.ok) {
|
|
83
|
-
return
|
|
83
|
+
return serializers.empathicVoice.ReturnPagedChats.parseOrThrow(_response.body, {
|
|
84
84
|
unrecognizedObjectKeys: "passthrough",
|
|
85
85
|
allowUnrecognizedUnionMembers: true,
|
|
86
86
|
allowUnrecognizedEnumValues: true,
|
|
@@ -133,7 +133,7 @@ class Chats {
|
|
|
133
133
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
134
134
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, `v0/evi/chats/${encodeURIComponent(id)}`),
|
|
135
135
|
method: "GET",
|
|
136
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
136
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.7.3", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
137
137
|
contentType: "application/json",
|
|
138
138
|
queryParameters: _queryParams,
|
|
139
139
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -141,7 +141,7 @@ class Chats {
|
|
|
141
141
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
142
142
|
});
|
|
143
143
|
if (_response.ok) {
|
|
144
|
-
return
|
|
144
|
+
return serializers.empathicVoice.ReturnChatPagedEvents.parseOrThrow(_response.body, {
|
|
145
145
|
unrecognizedObjectKeys: "passthrough",
|
|
146
146
|
allowUnrecognizedUnionMembers: true,
|
|
147
147
|
allowUnrecognizedEnumValues: true,
|
|
@@ -11,8 +11,11 @@ export declare namespace Configs {
|
|
|
11
11
|
fetcher?: core.FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
interface RequestOptions {
|
|
14
|
+
/** The maximum time to wait for a response in seconds. */
|
|
14
15
|
timeoutInSeconds?: number;
|
|
16
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
17
|
maxRetries?: number;
|
|
18
|
+
/** A hook to abort the request. */
|
|
16
19
|
abortSignal?: AbortSignal;
|
|
17
20
|
}
|
|
18
21
|
}
|