mavenagi 0.0.0-alpha.11 → 0.0.0-alpha.12
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/Client.d.ts +9 -0
- package/README.md +41 -4
- package/api/resources/actions/client/Client.d.ts +9 -0
- package/api/resources/actions/client/Client.js +18 -15
- package/api/resources/commons/types/EntityType.d.ts +2 -1
- package/api/resources/commons/types/EntityType.js +1 -0
- package/api/resources/commons/types/FeedbackBase.d.ts +10 -0
- package/api/resources/commons/types/index.d.ts +1 -1
- package/api/resources/commons/types/index.js +1 -1
- package/api/resources/conversation/client/Client.d.ts +18 -3
- package/api/resources/conversation/client/Client.js +71 -58
- package/api/resources/conversation/types/FeedbackRequest.d.ts +8 -1
- package/api/resources/knowledge/client/Client.d.ts +9 -0
- package/api/resources/knowledge/client/Client.js +44 -37
- package/api/resources/triggers/client/Client.d.ts +9 -0
- package/api/resources/triggers/client/Client.js +18 -15
- package/api/resources/users/client/Client.d.ts +9 -0
- package/api/resources/users/client/Client.js +13 -11
- package/core/fetcher/Fetcher.d.ts +4 -1
- package/core/fetcher/Fetcher.js +18 -159
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +6 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +32 -0
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +19 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +48 -0
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +38 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +28 -0
- package/core/fetcher/signals.d.ts +12 -0
- package/core/fetcher/signals.js +32 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
- package/core/runtime/runtime.d.ts +1 -0
- package/core/runtime/runtime.js +1 -0
- package/core/schemas/Schema.d.ts +7 -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 +90 -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 +18 -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 +9 -0
- package/dist/api/resources/actions/client/Client.d.ts +9 -0
- package/dist/api/resources/actions/client/Client.js +18 -15
- package/dist/api/resources/commons/types/EntityType.d.ts +2 -1
- package/dist/api/resources/commons/types/EntityType.js +1 -0
- package/dist/api/resources/commons/types/FeedbackBase.d.ts +10 -0
- package/dist/api/resources/commons/types/index.d.ts +1 -1
- package/dist/api/resources/commons/types/index.js +1 -1
- package/dist/api/resources/conversation/client/Client.d.ts +18 -3
- package/dist/api/resources/conversation/client/Client.js +71 -58
- package/dist/api/resources/conversation/types/FeedbackRequest.d.ts +8 -1
- package/dist/api/resources/knowledge/client/Client.d.ts +9 -0
- package/dist/api/resources/knowledge/client/Client.js +44 -37
- package/dist/api/resources/triggers/client/Client.d.ts +9 -0
- package/dist/api/resources/triggers/client/Client.js +18 -15
- package/dist/api/resources/users/client/Client.d.ts +9 -0
- package/dist/api/resources/users/client/Client.js +13 -11
- package/dist/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/core/fetcher/Fetcher.js +18 -159
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +6 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +32 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +19 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +48 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +38 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +28 -0
- package/dist/core/fetcher/signals.d.ts +12 -0
- package/dist/core/fetcher/signals.js +32 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
- package/dist/core/runtime/runtime.d.ts +1 -0
- package/dist/core/runtime/runtime.js +1 -0
- package/dist/core/schemas/Schema.d.ts +7 -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 +90 -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 +18 -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/commons/types/EntityType.d.ts +1 -1
- package/dist/serialization/resources/commons/types/EntityType.js +1 -0
- package/{serialization/resources/commons/types/Feedback.d.ts → dist/serialization/resources/commons/types/FeedbackBase.d.ts} +2 -5
- package/{serialization/resources/commons/types/Feedback.js → dist/serialization/resources/commons/types/FeedbackBase.js} +1 -4
- package/dist/serialization/resources/commons/types/index.d.ts +1 -1
- package/dist/serialization/resources/commons/types/index.js +1 -1
- package/dist/serialization/resources/conversation/types/FeedbackRequest.d.ts +7 -2
- package/dist/serialization/resources/conversation/types/FeedbackRequest.js +10 -2
- package/package.json +7 -2
- package/reference.md +1723 -0
- package/serialization/resources/commons/types/EntityType.d.ts +1 -1
- package/serialization/resources/commons/types/EntityType.js +1 -0
- package/{dist/serialization/resources/commons/types/Feedback.d.ts → serialization/resources/commons/types/FeedbackBase.d.ts} +2 -5
- package/{dist/serialization/resources/commons/types/Feedback.js → serialization/resources/commons/types/FeedbackBase.js} +1 -4
- package/serialization/resources/commons/types/index.d.ts +1 -1
- package/serialization/resources/commons/types/index.js +1 -1
- package/serialization/resources/conversation/types/FeedbackRequest.d.ts +7 -2
- package/serialization/resources/conversation/types/FeedbackRequest.js +10 -2
- package/api/resources/commons/types/Feedback.d.ts +0 -16
- package/dist/api/resources/commons/types/Feedback.d.ts +0 -16
- /package/api/resources/commons/types/{Feedback.js → FeedbackBase.js} +0 -0
- /package/dist/api/resources/commons/types/{Feedback.js → FeedbackBase.js} +0 -0
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { JsonError } from "./JsonError";
|
|
12
3
|
import { ParseError } from "./ParseError";
|
|
@@ -14,20 +5,20 @@ export function getSchemaUtils(schema) {
|
|
|
14
5
|
return {
|
|
15
6
|
optional: () => optional(schema),
|
|
16
7
|
transform: (transformer) => transform(schema, transformer),
|
|
17
|
-
parseOrThrow: (raw, opts) =>
|
|
18
|
-
const parsed =
|
|
8
|
+
parseOrThrow: (raw, opts) => {
|
|
9
|
+
const parsed = schema.parse(raw, opts);
|
|
19
10
|
if (parsed.ok) {
|
|
20
11
|
return parsed.value;
|
|
21
12
|
}
|
|
22
13
|
throw new ParseError(parsed.errors);
|
|
23
|
-
}
|
|
24
|
-
jsonOrThrow: (parsed, opts) =>
|
|
25
|
-
const raw =
|
|
14
|
+
},
|
|
15
|
+
jsonOrThrow: (parsed, opts) => {
|
|
16
|
+
const raw = schema.json(parsed, opts);
|
|
26
17
|
if (raw.ok) {
|
|
27
18
|
return raw.value;
|
|
28
19
|
}
|
|
29
20
|
throw new JsonError(raw.errors);
|
|
30
|
-
}
|
|
21
|
+
},
|
|
31
22
|
};
|
|
32
23
|
}
|
|
33
24
|
/**
|
|
@@ -45,6 +36,12 @@ export function optional(schema) {
|
|
|
45
36
|
return schema.parse(raw, opts);
|
|
46
37
|
},
|
|
47
38
|
json: (parsed, opts) => {
|
|
39
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.omitUndefined) && parsed === undefined) {
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
value: undefined,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
48
45
|
if (parsed == null) {
|
|
49
46
|
return {
|
|
50
47
|
ok: true,
|
|
@@ -59,8 +56,8 @@ export function optional(schema) {
|
|
|
59
56
|
}
|
|
60
57
|
export function transform(schema, transformer) {
|
|
61
58
|
const baseSchema = {
|
|
62
|
-
parse: (raw, opts) =>
|
|
63
|
-
const parsed =
|
|
59
|
+
parse: (raw, opts) => {
|
|
60
|
+
const parsed = schema.parse(raw, opts);
|
|
64
61
|
if (!parsed.ok) {
|
|
65
62
|
return parsed;
|
|
66
63
|
}
|
|
@@ -68,11 +65,11 @@ export function transform(schema, transformer) {
|
|
|
68
65
|
ok: true,
|
|
69
66
|
value: transformer.transform(parsed.value),
|
|
70
67
|
};
|
|
71
|
-
}
|
|
72
|
-
json: (transformed, opts) =>
|
|
73
|
-
const parsed =
|
|
68
|
+
},
|
|
69
|
+
json: (transformed, opts) => {
|
|
70
|
+
const parsed = transformer.untransform(transformed);
|
|
74
71
|
return schema.json(parsed, opts);
|
|
75
|
-
}
|
|
72
|
+
},
|
|
76
73
|
getType: () => schema.getType(),
|
|
77
74
|
};
|
|
78
75
|
return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
12
3
|
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
@@ -15,8 +6,8 @@ import { getSchemaUtils } from "../schema-utils";
|
|
|
15
6
|
export function set(schema) {
|
|
16
7
|
const listSchema = list(schema);
|
|
17
8
|
const baseSchema = {
|
|
18
|
-
parse: (raw, opts) =>
|
|
19
|
-
const parsedList =
|
|
9
|
+
parse: (raw, opts) => {
|
|
10
|
+
const parsedList = listSchema.parse(raw, opts);
|
|
20
11
|
if (parsedList.ok) {
|
|
21
12
|
return {
|
|
22
13
|
ok: true,
|
|
@@ -26,8 +17,8 @@ export function set(schema) {
|
|
|
26
17
|
else {
|
|
27
18
|
return parsedList;
|
|
28
19
|
}
|
|
29
|
-
}
|
|
30
|
-
json: (parsed, opts) =>
|
|
20
|
+
},
|
|
21
|
+
json: (parsed, opts) => {
|
|
31
22
|
var _a;
|
|
32
23
|
if (!(parsed instanceof Set)) {
|
|
33
24
|
return {
|
|
@@ -40,9 +31,9 @@ export function set(schema) {
|
|
|
40
31
|
],
|
|
41
32
|
};
|
|
42
33
|
}
|
|
43
|
-
const jsonList =
|
|
34
|
+
const jsonList = listSchema.json([...parsed], opts);
|
|
44
35
|
return jsonList;
|
|
45
|
-
}
|
|
36
|
+
},
|
|
46
37
|
getType: () => SchemaType.SET,
|
|
47
38
|
};
|
|
48
39
|
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
@@ -1,47 +1,36 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SchemaType } from "../../Schema";
|
|
11
2
|
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
12
3
|
import { getSchemaUtils } from "../schema-utils";
|
|
13
4
|
export function undiscriminatedUnion(schemas) {
|
|
14
5
|
const baseSchema = {
|
|
15
|
-
parse: (raw, opts) =>
|
|
6
|
+
parse: (raw, opts) => {
|
|
16
7
|
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.parse(raw, opts), schemas, opts);
|
|
17
|
-
}
|
|
18
|
-
json: (parsed, opts) =>
|
|
8
|
+
},
|
|
9
|
+
json: (parsed, opts) => {
|
|
19
10
|
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.json(parsed, opts), schemas, opts);
|
|
20
|
-
}
|
|
11
|
+
},
|
|
21
12
|
getType: () => SchemaType.UNDISCRIMINATED_UNION,
|
|
22
13
|
};
|
|
23
14
|
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
24
15
|
}
|
|
25
16
|
function validateAndTransformUndiscriminatedUnion(transform, schemas, opts) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
}
|
|
17
|
+
const errors = [];
|
|
18
|
+
for (const [index, schema] of schemas.entries()) {
|
|
19
|
+
const transformed = transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
|
|
20
|
+
if (transformed.ok) {
|
|
21
|
+
return transformed;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
for (const error of transformed.errors) {
|
|
25
|
+
errors.push({
|
|
26
|
+
path: error.path,
|
|
27
|
+
message: `[Variant ${index}] ${error.message}`,
|
|
28
|
+
});
|
|
40
29
|
}
|
|
41
30
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
ok: false,
|
|
34
|
+
errors,
|
|
35
|
+
};
|
|
47
36
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
2
|
var t = {};
|
|
12
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -33,7 +24,7 @@ export function union(discriminant, union) {
|
|
|
33
24
|
: discriminant.parsedDiscriminant;
|
|
34
25
|
const discriminantValueSchema = enum_(keys(union));
|
|
35
26
|
const baseSchema = {
|
|
36
|
-
parse: (raw, opts) =>
|
|
27
|
+
parse: (raw, opts) => {
|
|
37
28
|
return transformAndValidateUnion({
|
|
38
29
|
value: raw,
|
|
39
30
|
discriminant: rawDiscriminant,
|
|
@@ -50,8 +41,8 @@ export function union(discriminant, union) {
|
|
|
50
41
|
transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts),
|
|
51
42
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
52
43
|
});
|
|
53
|
-
}
|
|
54
|
-
json: (parsed, opts) =>
|
|
44
|
+
},
|
|
45
|
+
json: (parsed, opts) => {
|
|
55
46
|
return transformAndValidateUnion({
|
|
56
47
|
value: parsed,
|
|
57
48
|
discriminant: parsedDiscriminant,
|
|
@@ -68,70 +59,68 @@ export function union(discriminant, union) {
|
|
|
68
59
|
transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts),
|
|
69
60
|
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
70
61
|
});
|
|
71
|
-
}
|
|
62
|
+
},
|
|
72
63
|
getType: () => SchemaType.UNION,
|
|
73
64
|
};
|
|
74
65
|
return Object.assign(Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema)), getObjectLikeUtils(baseSchema));
|
|
75
66
|
}
|
|
76
67
|
function transformAndValidateUnion({ value, discriminant, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnrecognizedUnionMembers = false, transformAdditionalProperties, breadcrumbsPrefix = [], }) {
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
if (!isPlainObject(value)) {
|
|
69
|
+
return {
|
|
70
|
+
ok: false,
|
|
71
|
+
errors: [
|
|
72
|
+
{
|
|
73
|
+
path: breadcrumbsPrefix,
|
|
74
|
+
message: getErrorMessageForIncorrectType(value, "object"),
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
80
|
+
if (discriminantValue == null) {
|
|
81
|
+
return {
|
|
82
|
+
ok: false,
|
|
83
|
+
errors: [
|
|
84
|
+
{
|
|
85
|
+
path: breadcrumbsPrefix,
|
|
86
|
+
message: `Missing discriminant ("${discriminant}")`,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue);
|
|
92
|
+
if (!transformedDiscriminantValue.ok) {
|
|
93
|
+
return {
|
|
94
|
+
ok: false,
|
|
95
|
+
errors: transformedDiscriminantValue.errors,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
|
|
99
|
+
if (additionalPropertiesSchema == null) {
|
|
100
|
+
if (allowUnrecognizedUnionMembers) {
|
|
79
101
|
return {
|
|
80
|
-
ok:
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
path: breadcrumbsPrefix,
|
|
84
|
-
message: getErrorMessageForIncorrectType(value, "object"),
|
|
85
|
-
},
|
|
86
|
-
],
|
|
102
|
+
ok: true,
|
|
103
|
+
value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
|
|
87
104
|
};
|
|
88
105
|
}
|
|
89
|
-
|
|
90
|
-
if (discriminantValue == null) {
|
|
106
|
+
else {
|
|
91
107
|
return {
|
|
92
108
|
ok: false,
|
|
93
109
|
errors: [
|
|
94
110
|
{
|
|
95
|
-
path: breadcrumbsPrefix,
|
|
96
|
-
message:
|
|
111
|
+
path: [...breadcrumbsPrefix, discriminant],
|
|
112
|
+
message: "Unexpected discriminant value",
|
|
97
113
|
},
|
|
98
114
|
],
|
|
99
115
|
};
|
|
100
116
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (allowUnrecognizedUnionMembers) {
|
|
111
|
-
return {
|
|
112
|
-
ok: true,
|
|
113
|
-
value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return {
|
|
118
|
-
ok: false,
|
|
119
|
-
errors: [
|
|
120
|
-
{
|
|
121
|
-
path: [...breadcrumbsPrefix, discriminant],
|
|
122
|
-
message: "Unexpected discriminant value",
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const transformedAdditionalProperties = yield transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
|
|
129
|
-
if (!transformedAdditionalProperties.ok) {
|
|
130
|
-
return transformedAdditionalProperties;
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
ok: true,
|
|
134
|
-
value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
|
|
135
|
-
};
|
|
136
|
-
});
|
|
117
|
+
}
|
|
118
|
+
const transformedAdditionalProperties = transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
|
|
119
|
+
if (!transformedAdditionalProperties.ok) {
|
|
120
|
+
return transformedAdditionalProperties;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
ok: true,
|
|
124
|
+
value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
|
|
125
|
+
};
|
|
137
126
|
}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
export function maybeSkipValidation(schema) {
|
|
11
2
|
return Object.assign(Object.assign({}, schema), { json: transformAndMaybeSkipValidation(schema.json), parse: transformAndMaybeSkipValidation(schema.parse) });
|
|
12
3
|
}
|
|
13
4
|
function transformAndMaybeSkipValidation(transform) {
|
|
14
|
-
return (value, opts) =>
|
|
15
|
-
const transformed =
|
|
5
|
+
return (value, opts) => {
|
|
6
|
+
const transformed = transform(value, opts);
|
|
16
7
|
const { skipValidation = false } = opts !== null && opts !== void 0 ? opts : {};
|
|
17
8
|
if (!transformed.ok && skipValidation) {
|
|
18
9
|
// eslint-disable-next-line no-console
|
|
@@ -29,5 +20,5 @@ function transformAndMaybeSkipValidation(transform) {
|
|
|
29
20
|
else {
|
|
30
21
|
return transformed;
|
|
31
22
|
}
|
|
32
|
-
}
|
|
23
|
+
};
|
|
33
24
|
}
|
|
@@ -6,5 +6,5 @@ import * as MavenAGI from "../../../../api/index";
|
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
7
|
export declare const EntityType: core.serialization.Schema<serializers.EntityType.Raw, MavenAGI.EntityType>;
|
|
8
8
|
export declare namespace EntityType {
|
|
9
|
-
type Raw = "CONVERSATION" | "CONVERSATION_MESSAGE" | "KNOWLEDGE_BASE" | "KNOWLEDGE_DOCUMENT" | "ACTION" | "USER" | "USER_EVENT" | "EVENT_TRIGGER" | "USER_PROFILE";
|
|
9
|
+
type Raw = "CONVERSATION" | "CONVERSATION_MESSAGE" | "KNOWLEDGE_BASE" | "KNOWLEDGE_DOCUMENT" | "ACTION" | "USER" | "USER_EVENT" | "EVENT_TRIGGER" | "USER_PROFILE" | "FEEDBACK";
|
|
10
10
|
}
|
|
@@ -5,12 +5,9 @@ import * as serializers from "../../../index";
|
|
|
5
5
|
import * as MavenAGI from "../../../../api/index";
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
7
|
import { FeedbackType } from "./FeedbackType";
|
|
8
|
-
export declare const
|
|
9
|
-
export declare namespace
|
|
8
|
+
export declare const FeedbackBase: core.serialization.ObjectSchema<serializers.FeedbackBase.Raw, MavenAGI.FeedbackBase>;
|
|
9
|
+
export declare namespace FeedbackBase {
|
|
10
10
|
interface Raw {
|
|
11
|
-
id: string;
|
|
12
|
-
conversationId: string;
|
|
13
|
-
conversationMessageId: string;
|
|
14
11
|
type: FeedbackType.Raw;
|
|
15
12
|
text?: string | null;
|
|
16
13
|
}
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as core from "../../../../core";
|
|
5
5
|
import { FeedbackType } from "./FeedbackType";
|
|
6
|
-
export const
|
|
7
|
-
id: core.serialization.string(),
|
|
8
|
-
conversationId: core.serialization.string(),
|
|
9
|
-
conversationMessageId: core.serialization.string(),
|
|
6
|
+
export const FeedbackBase = core.serialization.object({
|
|
10
7
|
type: FeedbackType,
|
|
11
8
|
text: core.serialization.string().optional(),
|
|
12
9
|
});
|
|
@@ -3,8 +3,8 @@ export * from "./EntityType";
|
|
|
3
3
|
export * from "./EntityIdBase";
|
|
4
4
|
export * from "./EntityId";
|
|
5
5
|
export * from "./User";
|
|
6
|
+
export * from "./FeedbackBase";
|
|
6
7
|
export * from "./FeedbackType";
|
|
7
|
-
export * from "./Feedback";
|
|
8
8
|
export * from "./AppUserIdentification";
|
|
9
9
|
export * from "./AppUserIdentifier";
|
|
10
10
|
export * from "./AppUserIdentifyingPropertyType";
|
|
@@ -3,8 +3,8 @@ export * from "./EntityType";
|
|
|
3
3
|
export * from "./EntityIdBase";
|
|
4
4
|
export * from "./EntityId";
|
|
5
5
|
export * from "./User";
|
|
6
|
+
export * from "./FeedbackBase";
|
|
6
7
|
export * from "./FeedbackType";
|
|
7
|
-
export * from "./Feedback";
|
|
8
8
|
export * from "./AppUserIdentification";
|
|
9
9
|
export * from "./AppUserIdentifier";
|
|
10
10
|
export * from "./AppUserIdentifyingPropertyType";
|
|
@@ -4,8 +4,13 @@
|
|
|
4
4
|
import * as serializers from "../../../index";
|
|
5
5
|
import * as MavenAGI from "../../../../api/index";
|
|
6
6
|
import * as core from "../../../../core";
|
|
7
|
-
import {
|
|
7
|
+
import { EntityIdBase } from "../../commons/types/EntityIdBase";
|
|
8
|
+
import { FeedbackBase } from "../../commons/types/FeedbackBase";
|
|
8
9
|
export declare const FeedbackRequest: core.serialization.ObjectSchema<serializers.FeedbackRequest.Raw, MavenAGI.FeedbackRequest>;
|
|
9
10
|
export declare namespace FeedbackRequest {
|
|
10
|
-
|
|
11
|
+
interface Raw extends FeedbackBase.Raw {
|
|
12
|
+
feedbackId: EntityIdBase.Raw;
|
|
13
|
+
conversationId: EntityIdBase.Raw;
|
|
14
|
+
conversationMessageId: EntityIdBase.Raw;
|
|
15
|
+
}
|
|
11
16
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import * as core from "../../../../core";
|
|
5
|
+
import { EntityIdBase } from "../../commons/types/EntityIdBase";
|
|
6
|
+
import { FeedbackBase } from "../../commons/types/FeedbackBase";
|
|
7
|
+
export const FeedbackRequest = core.serialization
|
|
8
|
+
.object({
|
|
9
|
+
feedbackId: EntityIdBase,
|
|
10
|
+
conversationId: EntityIdBase,
|
|
11
|
+
conversationMessageId: EntityIdBase,
|
|
12
|
+
})
|
|
13
|
+
.extend(FeedbackBase);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mavenagi",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": "https://github.com/mavenagi/mavenagi-node",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"url-join": "4.0.1",
|
|
16
|
-
"form-data": "4.0.0",
|
|
16
|
+
"form-data": "^4.0.0",
|
|
17
17
|
"formdata-node": "^6.0.3",
|
|
18
18
|
"node-fetch": "2.7.0",
|
|
19
19
|
"qs": "6.11.2",
|
|
@@ -30,5 +30,10 @@
|
|
|
30
30
|
"@types/node": "17.0.33",
|
|
31
31
|
"prettier": "2.7.1",
|
|
32
32
|
"typescript": "4.6.4"
|
|
33
|
+
},
|
|
34
|
+
"browser": {
|
|
35
|
+
"fs": false,
|
|
36
|
+
"os": false,
|
|
37
|
+
"path": false
|
|
33
38
|
}
|
|
34
39
|
}
|