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.
Files changed (96) hide show
  1. package/.mock/definition/empathic-voice/__package__.yml +3 -65
  2. package/Client.d.ts +3 -0
  3. package/api/resources/empathicVoice/client/Client.d.ts +3 -0
  4. package/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +8 -8
  5. package/api/resources/empathicVoice/resources/chat/client/Socket.js +13 -40
  6. package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -0
  7. package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +4 -4
  8. package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -0
  9. package/api/resources/empathicVoice/resources/chats/client/Client.js +4 -4
  10. package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -0
  11. package/api/resources/empathicVoice/resources/configs/client/Client.js +19 -23
  12. package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -0
  13. package/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -23
  14. package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -0
  15. package/api/resources/empathicVoice/resources/tools/client/Client.js +19 -19
  16. package/api/resources/empathicVoice/types/SessionSettings.d.ts +2 -0
  17. package/api/resources/empathicVoice/types/VoiceArgs.d.ts +0 -2
  18. package/api/resources/empathicVoice/types/index.d.ts +0 -1
  19. package/api/resources/empathicVoice/types/index.js +0 -1
  20. package/api/resources/expressionMeasurement/client/Client.d.ts +3 -0
  21. package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -0
  22. package/api/resources/expressionMeasurement/resources/batch/client/Client.js +12 -12
  23. package/core/form-data-utils/FormDataWrapper.js +1 -3
  24. package/core/schemas/Schema.d.ts +3 -4
  25. package/core/schemas/builders/lazy/lazy.d.ts +2 -2
  26. package/core/schemas/builders/lazy/lazy.js +8 -19
  27. package/core/schemas/builders/lazy/lazyObject.js +1 -10
  28. package/core/schemas/builders/list/list.js +31 -44
  29. package/core/schemas/builders/object/object.js +88 -111
  30. package/core/schemas/builders/object/types.d.ts +2 -2
  31. package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  32. package/core/schemas/builders/record/record.js +49 -60
  33. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  34. package/core/schemas/builders/schema-utils/getSchemaUtils.js +12 -21
  35. package/core/schemas/builders/set/set.js +6 -15
  36. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  37. package/core/schemas/builders/union/union.js +51 -62
  38. package/core/schemas/utils/maybeSkipValidation.js +3 -12
  39. package/dist/Client.d.ts +3 -0
  40. package/dist/api/resources/empathicVoice/client/Client.d.ts +3 -0
  41. package/dist/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +8 -8
  42. package/dist/api/resources/empathicVoice/resources/chat/client/Socket.js +13 -40
  43. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -0
  44. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +4 -4
  45. package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -0
  46. package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +4 -4
  47. package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -0
  48. package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +19 -23
  49. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -0
  50. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -23
  51. package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -0
  52. package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +19 -19
  53. package/dist/api/resources/empathicVoice/types/SessionSettings.d.ts +2 -0
  54. package/dist/api/resources/empathicVoice/types/VoiceArgs.d.ts +0 -2
  55. package/dist/api/resources/empathicVoice/types/index.d.ts +0 -1
  56. package/dist/api/resources/empathicVoice/types/index.js +0 -1
  57. package/dist/api/resources/expressionMeasurement/client/Client.d.ts +3 -0
  58. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -0
  59. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +12 -12
  60. package/dist/core/form-data-utils/FormDataWrapper.js +1 -3
  61. package/dist/core/schemas/Schema.d.ts +3 -4
  62. package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
  63. package/dist/core/schemas/builders/lazy/lazy.js +8 -19
  64. package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
  65. package/dist/core/schemas/builders/list/list.js +31 -44
  66. package/dist/core/schemas/builders/object/object.js +88 -111
  67. package/dist/core/schemas/builders/object/types.d.ts +2 -2
  68. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
  69. package/dist/core/schemas/builders/record/record.js +49 -60
  70. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
  71. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +12 -21
  72. package/dist/core/schemas/builders/set/set.js +6 -15
  73. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
  74. package/dist/core/schemas/builders/union/union.js +51 -62
  75. package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
  76. package/dist/serialization/resources/empathicVoice/types/SessionSettings.d.ts +1 -0
  77. package/dist/serialization/resources/empathicVoice/types/SessionSettings.js +1 -0
  78. package/dist/serialization/resources/empathicVoice/types/VoiceArgs.d.ts +0 -3
  79. package/dist/serialization/resources/empathicVoice/types/VoiceArgs.js +0 -3
  80. package/dist/serialization/resources/empathicVoice/types/index.d.ts +0 -1
  81. package/dist/serialization/resources/empathicVoice/types/index.js +0 -1
  82. package/package.json +1 -1
  83. package/serialization/resources/empathicVoice/types/SessionSettings.d.ts +1 -0
  84. package/serialization/resources/empathicVoice/types/SessionSettings.js +1 -0
  85. package/serialization/resources/empathicVoice/types/VoiceArgs.d.ts +0 -3
  86. package/serialization/resources/empathicVoice/types/VoiceArgs.js +0 -3
  87. package/serialization/resources/empathicVoice/types/index.d.ts +0 -1
  88. package/serialization/resources/empathicVoice/types/index.js +0 -1
  89. package/api/resources/empathicVoice/types/Features.d.ts +0 -21
  90. package/api/resources/empathicVoice/types/Features.js +0 -5
  91. package/dist/api/resources/empathicVoice/types/Features.d.ts +0 -21
  92. package/dist/api/resources/empathicVoice/types/Features.js +0 -5
  93. package/dist/serialization/resources/empathicVoice/types/Features.d.ts +0 -19
  94. package/dist/serialization/resources/empathicVoice/types/Features.js +0 -40
  95. package/serialization/resources/empathicVoice/types/Features.d.ts +0 -19
  96. 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.record = void 0;
13
4
  const Schema_1 = require("../../Schema");
@@ -18,10 +9,10 @@ const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
18
9
  const schema_utils_1 = require("../schema-utils");
19
10
  function record(keySchema, valueSchema) {
20
11
  const baseSchema = {
21
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
12
+ parse: (raw, opts) => {
22
13
  return validateAndTransformRecord({
23
14
  value: raw,
24
- isKeyNumeric: (yield keySchema.getType()) === Schema_1.SchemaType.NUMBER,
15
+ isKeyNumeric: keySchema.getType() === Schema_1.SchemaType.NUMBER,
25
16
  transformKey: (key) => {
26
17
  var _a;
27
18
  return keySchema.parse(key, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `${key} (key)`] }));
@@ -32,11 +23,11 @@ function record(keySchema, valueSchema) {
32
23
  },
33
24
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
34
25
  });
35
- }),
36
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
26
+ },
27
+ json: (parsed, opts) => {
37
28
  return validateAndTransformRecord({
38
29
  value: parsed,
39
- isKeyNumeric: (yield keySchema.getType()) === Schema_1.SchemaType.NUMBER,
30
+ isKeyNumeric: keySchema.getType() === Schema_1.SchemaType.NUMBER,
40
31
  transformKey: (key) => {
41
32
  var _a;
42
33
  return keySchema.json(key, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `${key} (key)`] }));
@@ -47,60 +38,58 @@ function record(keySchema, valueSchema) {
47
38
  },
48
39
  breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
49
40
  });
50
- }),
41
+ },
51
42
  getType: () => Schema_1.SchemaType.RECORD,
52
43
  };
53
44
  return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
54
45
  }
55
46
  exports.record = record;
56
47
  function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transformValue, breadcrumbsPrefix = [], }) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- if (!(0, isPlainObject_1.isPlainObject)(value)) {
59
- return {
60
- ok: false,
61
- errors: [
62
- {
63
- path: breadcrumbsPrefix,
64
- message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
65
- },
66
- ],
67
- };
48
+ if (!(0, isPlainObject_1.isPlainObject)(value)) {
49
+ return {
50
+ ok: false,
51
+ errors: [
52
+ {
53
+ path: breadcrumbsPrefix,
54
+ message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
55
+ },
56
+ ],
57
+ };
58
+ }
59
+ return (0, entries_1.entries)(value).reduce((accPromise, [stringKey, value]) => {
60
+ // skip nullish keys
61
+ if (value == null) {
62
+ return accPromise;
68
63
  }
69
- return (0, entries_1.entries)(value).reduce((accPromise, [stringKey, value]) => __awaiter(this, void 0, void 0, function* () {
70
- // skip nullish keys
71
- if (value == null) {
72
- return accPromise;
73
- }
74
- const acc = yield accPromise;
75
- let key = stringKey;
76
- if (isKeyNumeric) {
77
- const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
78
- if (!isNaN(numberKey)) {
79
- key = numberKey;
80
- }
81
- }
82
- const transformedKey = yield transformKey(key);
83
- const transformedValue = yield transformValue(value, key);
84
- if (acc.ok && transformedKey.ok && transformedValue.ok) {
85
- return {
86
- ok: true,
87
- value: Object.assign(Object.assign({}, acc.value), { [transformedKey.value]: transformedValue.value }),
88
- };
89
- }
90
- const errors = [];
91
- if (!acc.ok) {
92
- errors.push(...acc.errors);
93
- }
94
- if (!transformedKey.ok) {
95
- errors.push(...transformedKey.errors);
96
- }
97
- if (!transformedValue.ok) {
98
- errors.push(...transformedValue.errors);
64
+ const acc = accPromise;
65
+ let key = stringKey;
66
+ if (isKeyNumeric) {
67
+ const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
68
+ if (!isNaN(numberKey)) {
69
+ key = numberKey;
99
70
  }
71
+ }
72
+ const transformedKey = transformKey(key);
73
+ const transformedValue = transformValue(value, key);
74
+ if (acc.ok && transformedKey.ok && transformedValue.ok) {
100
75
  return {
101
- ok: false,
102
- errors,
76
+ ok: true,
77
+ value: Object.assign(Object.assign({}, acc.value), { [transformedKey.value]: transformedValue.value }),
103
78
  };
104
- }), Promise.resolve({ ok: true, value: {} }));
105
- });
79
+ }
80
+ const errors = [];
81
+ if (!acc.ok) {
82
+ errors.push(...acc.errors);
83
+ }
84
+ if (!transformedKey.ok) {
85
+ errors.push(...transformedKey.errors);
86
+ }
87
+ if (!transformedValue.ok) {
88
+ errors.push(...transformedValue.errors);
89
+ }
90
+ return {
91
+ ok: false,
92
+ errors,
93
+ };
94
+ }, { ok: true, value: {} });
106
95
  }
@@ -2,8 +2,8 @@ import { BaseSchema, Schema, SchemaOptions } from "../../Schema";
2
2
  export interface SchemaUtils<Raw, Parsed> {
3
3
  optional: () => Schema<Raw | null | undefined, Parsed | undefined>;
4
4
  transform: <Transformed>(transformer: SchemaTransformer<Parsed, Transformed>) => Schema<Raw, Transformed>;
5
- parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise<Parsed>;
6
- jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise<Raw>;
5
+ parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed;
6
+ jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw;
7
7
  }
8
8
  export interface SchemaTransformer<Parsed, Transformed> {
9
9
  transform: (parsed: Parsed) => Transformed;
@@ -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.transform = exports.optional = exports.getSchemaUtils = void 0;
13
4
  const Schema_1 = require("../../Schema");
@@ -17,20 +8,20 @@ function getSchemaUtils(schema) {
17
8
  return {
18
9
  optional: () => optional(schema),
19
10
  transform: (transformer) => transform(schema, transformer),
20
- parseOrThrow: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
21
- const parsed = yield schema.parse(raw, opts);
11
+ parseOrThrow: (raw, opts) => {
12
+ const parsed = schema.parse(raw, opts);
22
13
  if (parsed.ok) {
23
14
  return parsed.value;
24
15
  }
25
16
  throw new ParseError_1.ParseError(parsed.errors);
26
- }),
27
- jsonOrThrow: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
28
- const raw = yield schema.json(parsed, opts);
17
+ },
18
+ jsonOrThrow: (parsed, opts) => {
19
+ const raw = schema.json(parsed, opts);
29
20
  if (raw.ok) {
30
21
  return raw.value;
31
22
  }
32
23
  throw new JsonError_1.JsonError(raw.errors);
33
- }),
24
+ },
34
25
  };
35
26
  }
36
27
  exports.getSchemaUtils = getSchemaUtils;
@@ -64,8 +55,8 @@ function optional(schema) {
64
55
  exports.optional = optional;
65
56
  function transform(schema, transformer) {
66
57
  const baseSchema = {
67
- parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
68
- const parsed = yield schema.parse(raw, opts);
58
+ parse: (raw, opts) => {
59
+ const parsed = schema.parse(raw, opts);
69
60
  if (!parsed.ok) {
70
61
  return parsed;
71
62
  }
@@ -73,11 +64,11 @@ function transform(schema, transformer) {
73
64
  ok: true,
74
65
  value: transformer.transform(parsed.value),
75
66
  };
76
- }),
77
- json: (transformed, opts) => __awaiter(this, void 0, void 0, function* () {
78
- const parsed = yield transformer.untransform(transformed);
67
+ },
68
+ json: (transformed, opts) => {
69
+ const parsed = transformer.untransform(transformed);
79
70
  return schema.json(parsed, opts);
80
- }),
71
+ },
81
72
  getType: () => schema.getType(),
82
73
  };
83
74
  return Object.assign(Object.assign({}, baseSchema), 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.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) => __awaiter(this, void 0, void 0, function* () {
22
- const parsedList = yield listSchema.parse(raw, opts);
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) => __awaiter(this, void 0, void 0, function* () {
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 = yield listSchema.json([...parsed], opts);
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) => __awaiter(this, void 0, void 0, function* () {
9
+ parse: (raw, opts) => {
19
10
  return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.parse(raw, opts), schemas, opts);
20
- }),
21
- json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
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
- return __awaiter(this, void 0, void 0, function* () {
31
- const errors = [];
32
- for (const [index, schema] of schemas.entries()) {
33
- const transformed = yield transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
34
- if (transformed.ok) {
35
- return transformed;
36
- }
37
- else {
38
- for (const error of transformed.errors) {
39
- errors.push({
40
- path: error.path,
41
- message: `[Variant ${index}] ${error.message}`,
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
- return {
47
- ok: false,
48
- errors,
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) => __awaiter(this, void 0, void 0, function* () {
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) => __awaiter(this, void 0, void 0, function* () {
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
- return __awaiter(this, void 0, void 0, function* () {
82
- if (!(0, isPlainObject_1.isPlainObject)(value)) {
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: false,
85
- errors: [
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
- const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
94
- if (discriminantValue == null) {
110
+ else {
95
111
  return {
96
112
  ok: false,
97
113
  errors: [
98
114
  {
99
- path: breadcrumbsPrefix,
100
- message: `Missing discriminant ("${discriminant}")`,
115
+ path: [...breadcrumbsPrefix, discriminant],
116
+ message: "Unexpected discriminant value",
101
117
  },
102
118
  ],
103
119
  };
104
120
  }
105
- const transformedDiscriminantValue = yield transformDiscriminantValue(discriminantValue);
106
- if (!transformedDiscriminantValue.ok) {
107
- return {
108
- ok: false,
109
- errors: transformedDiscriminantValue.errors,
110
- };
111
- }
112
- const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
113
- if (additionalPropertiesSchema == null) {
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) => __awaiter(this, void 0, void 0, function* () {
19
- const transformed = yield transform(value, opts);
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
  }
@@ -20,5 +20,6 @@ export declare namespace SessionSettings {
20
20
  tools?: Tool.Raw[] | null;
21
21
  builtin_tools?: BuiltinToolConfig.Raw[] | null;
22
22
  metadata?: Record<string, unknown> | null;
23
+ variables?: Record<string, string> | null;
23
24
  }
24
25
  }
@@ -42,4 +42,5 @@ exports.SessionSettings = core.serialization.object({
42
42
  tools: core.serialization.list(Tool_1.Tool).optional(),
43
43
  builtinTools: core.serialization.property("builtin_tools", core.serialization.list(BuiltinToolConfig_1.BuiltinToolConfig).optional()),
44
44
  metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
45
+ variables: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(),
45
46
  });
@@ -5,13 +5,10 @@ import * as serializers from "../../../index";
5
5
  import * as Hume from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
7
  import { VoiceNameEnum } from "./VoiceNameEnum";
8
- import { Features } from "./Features";
9
8
  export declare const VoiceArgs: core.serialization.ObjectSchema<serializers.empathicVoice.VoiceArgs.Raw, Hume.empathicVoice.VoiceArgs>;
10
9
  export declare namespace VoiceArgs {
11
10
  interface Raw {
12
11
  voice?: VoiceNameEnum.Raw | null;
13
- features?: Features.Raw | null;
14
- characters_per_second_ratio?: number | null;
15
12
  baseline?: boolean | null;
16
13
  reconstruct?: boolean | null;
17
14
  }
@@ -29,11 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.VoiceArgs = void 0;
30
30
  const core = __importStar(require("../../../../core"));
31
31
  const VoiceNameEnum_1 = require("./VoiceNameEnum");
32
- const Features_1 = require("./Features");
33
32
  exports.VoiceArgs = core.serialization.object({
34
33
  voice: VoiceNameEnum_1.VoiceNameEnum.optional(),
35
- features: Features_1.Features.optional(),
36
- charactersPerSecondRatio: core.serialization.property("characters_per_second_ratio", core.serialization.number().optional()),
37
34
  baseline: core.serialization.boolean().optional(),
38
35
  reconstruct: core.serialization.boolean().optional(),
39
36
  });
@@ -77,7 +77,6 @@ export * from "./TtsInput";
77
77
  export * from "./TextInput";
78
78
  export * from "./FunctionCallResponseInput";
79
79
  export * from "./ExtendedVoiceArgs";
80
- export * from "./Features";
81
80
  export * from "./HttpValidationError";
82
81
  export * from "./ValidationErrorLocItem";
83
82
  export * from "./ValidationError";
@@ -93,7 +93,6 @@ __exportStar(require("./TtsInput"), exports);
93
93
  __exportStar(require("./TextInput"), exports);
94
94
  __exportStar(require("./FunctionCallResponseInput"), exports);
95
95
  __exportStar(require("./ExtendedVoiceArgs"), exports);
96
- __exportStar(require("./Features"), exports);
97
96
  __exportStar(require("./HttpValidationError"), exports);
98
97
  __exportStar(require("./ValidationErrorLocItem"), exports);
99
98
  __exportStar(require("./ValidationError"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hume",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-beta0",
4
4
  "private": false,
5
5
  "repository": "https://github.com/HumeAI/hume-typescript-sdk",
6
6
  "main": "./index.js",
@@ -20,5 +20,6 @@ export declare namespace SessionSettings {
20
20
  tools?: Tool.Raw[] | null;
21
21
  builtin_tools?: BuiltinToolConfig.Raw[] | null;
22
22
  metadata?: Record<string, unknown> | null;
23
+ variables?: Record<string, string> | null;
23
24
  }
24
25
  }
@@ -42,4 +42,5 @@ exports.SessionSettings = core.serialization.object({
42
42
  tools: core.serialization.list(Tool_1.Tool).optional(),
43
43
  builtinTools: core.serialization.property("builtin_tools", core.serialization.list(BuiltinToolConfig_1.BuiltinToolConfig).optional()),
44
44
  metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
45
+ variables: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(),
45
46
  });
@@ -5,13 +5,10 @@ import * as serializers from "../../../index";
5
5
  import * as Hume from "../../../../api/index";
6
6
  import * as core from "../../../../core";
7
7
  import { VoiceNameEnum } from "./VoiceNameEnum";
8
- import { Features } from "./Features";
9
8
  export declare const VoiceArgs: core.serialization.ObjectSchema<serializers.empathicVoice.VoiceArgs.Raw, Hume.empathicVoice.VoiceArgs>;
10
9
  export declare namespace VoiceArgs {
11
10
  interface Raw {
12
11
  voice?: VoiceNameEnum.Raw | null;
13
- features?: Features.Raw | null;
14
- characters_per_second_ratio?: number | null;
15
12
  baseline?: boolean | null;
16
13
  reconstruct?: boolean | null;
17
14
  }
@@ -29,11 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.VoiceArgs = void 0;
30
30
  const core = __importStar(require("../../../../core"));
31
31
  const VoiceNameEnum_1 = require("./VoiceNameEnum");
32
- const Features_1 = require("./Features");
33
32
  exports.VoiceArgs = core.serialization.object({
34
33
  voice: VoiceNameEnum_1.VoiceNameEnum.optional(),
35
- features: Features_1.Features.optional(),
36
- charactersPerSecondRatio: core.serialization.property("characters_per_second_ratio", core.serialization.number().optional()),
37
34
  baseline: core.serialization.boolean().optional(),
38
35
  reconstruct: core.serialization.boolean().optional(),
39
36
  });