agentmail 0.2.19 → 0.2.21
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/README.md +658 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/core/fetcher/Fetcher.js +1 -7
- package/dist/cjs/core/schemas/builders/list/list.js +17 -12
- package/dist/cjs/core/schemas/builders/object/object.js +40 -102
- package/dist/cjs/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -10
- package/dist/cjs/core/schemas/builders/record/record.js +25 -26
- package/dist/cjs/core/schemas/builders/union/union.js +12 -9
- package/dist/cjs/core/schemas/utils/isPlainObject.js +6 -4
- package/dist/cjs/environments.d.ts +5 -1
- package/dist/cjs/environments.js +4 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +1 -7
- package/dist/esm/core/schemas/builders/list/list.mjs +17 -12
- package/dist/esm/core/schemas/builders/object/object.mjs +40 -102
- package/dist/esm/core/schemas/builders/object-like/getObjectLikeUtils.mjs +3 -10
- package/dist/esm/core/schemas/builders/record/record.mjs +25 -26
- package/dist/esm/core/schemas/builders/union/union.mjs +12 -9
- package/dist/esm/core/schemas/utils/isPlainObject.mjs +6 -4
- package/dist/esm/environments.d.mts +5 -1
- package/dist/esm/environments.mjs +4 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms-full.txt +0 -512
- package/dist/llms.txt +0 -7
- package/package.json +2 -2
|
@@ -13,113 +13,63 @@ const partition_js_1 = require("../../utils/partition.js");
|
|
|
13
13
|
const index_js_1 = require("../object-like/index.js");
|
|
14
14
|
const index_js_2 = require("../schema-utils/index.js");
|
|
15
15
|
const property_js_1 = require("./property.js");
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
17
|
-
const _hasOwn = Object.prototype.hasOwnProperty;
|
|
18
16
|
function object(schemas) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function getRawKeyToProperty() {
|
|
26
|
-
if (_rawKeyToProperty == null) {
|
|
27
|
-
_rawKeyToProperty = {};
|
|
17
|
+
const baseSchema = {
|
|
18
|
+
_getRawProperties: () => Object.entries(schemas).map(([parsedKey, propertySchema]) => (0, property_js_1.isProperty)(propertySchema) ? propertySchema.rawKey : parsedKey),
|
|
19
|
+
_getParsedProperties: () => (0, keys_js_1.keys)(schemas),
|
|
20
|
+
parse: (raw, opts) => {
|
|
21
|
+
const rawKeyToProperty = {};
|
|
22
|
+
const requiredKeys = [];
|
|
28
23
|
for (const [parsedKey, schemaOrObjectProperty] of (0, entries_js_1.entries)(schemas)) {
|
|
29
|
-
const rawKey = (0, property_js_1.isProperty)(schemaOrObjectProperty)
|
|
30
|
-
? schemaOrObjectProperty.rawKey
|
|
31
|
-
: parsedKey;
|
|
24
|
+
const rawKey = (0, property_js_1.isProperty)(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey;
|
|
32
25
|
const valueSchema = (0, property_js_1.isProperty)(schemaOrObjectProperty)
|
|
33
26
|
? schemaOrObjectProperty.valueSchema
|
|
34
27
|
: schemaOrObjectProperty;
|
|
35
|
-
|
|
28
|
+
const property = {
|
|
36
29
|
rawKey,
|
|
37
30
|
parsedKey: parsedKey,
|
|
38
31
|
valueSchema,
|
|
39
32
|
};
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
return _rawKeyToProperty;
|
|
43
|
-
}
|
|
44
|
-
let _parseRequiredKeys;
|
|
45
|
-
let _jsonRequiredKeys;
|
|
46
|
-
let _parseRequiredKeysSet;
|
|
47
|
-
let _jsonRequiredKeysSet;
|
|
48
|
-
function getParseRequiredKeys() {
|
|
49
|
-
if (_parseRequiredKeys == null) {
|
|
50
|
-
_parseRequiredKeys = [];
|
|
51
|
-
_jsonRequiredKeys = [];
|
|
52
|
-
for (const [parsedKey, schemaOrObjectProperty] of (0, entries_js_1.entries)(schemas)) {
|
|
53
|
-
const rawKey = (0, property_js_1.isProperty)(schemaOrObjectProperty)
|
|
54
|
-
? schemaOrObjectProperty.rawKey
|
|
55
|
-
: parsedKey;
|
|
56
|
-
const valueSchema = (0, property_js_1.isProperty)(schemaOrObjectProperty)
|
|
57
|
-
? schemaOrObjectProperty.valueSchema
|
|
58
|
-
: schemaOrObjectProperty;
|
|
33
|
+
rawKeyToProperty[rawKey] = property;
|
|
59
34
|
if (isSchemaRequired(valueSchema)) {
|
|
60
|
-
|
|
61
|
-
_jsonRequiredKeys.push(parsedKey);
|
|
35
|
+
requiredKeys.push(rawKey);
|
|
62
36
|
}
|
|
63
37
|
}
|
|
64
|
-
_parseRequiredKeysSet = new Set(_parseRequiredKeys);
|
|
65
|
-
_jsonRequiredKeysSet = new Set(_jsonRequiredKeys);
|
|
66
|
-
}
|
|
67
|
-
return _parseRequiredKeys;
|
|
68
|
-
}
|
|
69
|
-
function getJsonRequiredKeys() {
|
|
70
|
-
if (_jsonRequiredKeys == null) {
|
|
71
|
-
getParseRequiredKeys();
|
|
72
|
-
}
|
|
73
|
-
return _jsonRequiredKeys;
|
|
74
|
-
}
|
|
75
|
-
function getParseRequiredKeysSet() {
|
|
76
|
-
if (_parseRequiredKeysSet == null) {
|
|
77
|
-
getParseRequiredKeys();
|
|
78
|
-
}
|
|
79
|
-
return _parseRequiredKeysSet;
|
|
80
|
-
}
|
|
81
|
-
function getJsonRequiredKeysSet() {
|
|
82
|
-
if (_jsonRequiredKeysSet == null) {
|
|
83
|
-
getParseRequiredKeys();
|
|
84
|
-
}
|
|
85
|
-
return _jsonRequiredKeysSet;
|
|
86
|
-
}
|
|
87
|
-
const baseSchema = {
|
|
88
|
-
_getRawProperties: () => Object.entries(schemas).map(([parsedKey, propertySchema]) => (0, property_js_1.isProperty)(propertySchema) ? propertySchema.rawKey : parsedKey),
|
|
89
|
-
_getParsedProperties: () => (0, keys_js_1.keys)(schemas),
|
|
90
|
-
parse: (raw, opts) => {
|
|
91
|
-
var _a;
|
|
92
|
-
const breadcrumbsPrefix = (_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : [];
|
|
93
38
|
return validateAndTransformObject({
|
|
94
39
|
value: raw,
|
|
95
|
-
requiredKeys
|
|
96
|
-
requiredKeysSet: getParseRequiredKeysSet(),
|
|
40
|
+
requiredKeys,
|
|
97
41
|
getProperty: (rawKey) => {
|
|
98
|
-
const property =
|
|
42
|
+
const property = rawKeyToProperty[rawKey];
|
|
99
43
|
if (property == null) {
|
|
100
44
|
return undefined;
|
|
101
45
|
}
|
|
102
46
|
return {
|
|
103
47
|
transformedKey: property.parsedKey,
|
|
104
48
|
transform: (propertyValue) => {
|
|
105
|
-
|
|
106
|
-
return property.valueSchema.parse(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix:
|
|
49
|
+
var _a;
|
|
50
|
+
return property.valueSchema.parse(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), rawKey] }));
|
|
107
51
|
},
|
|
108
52
|
};
|
|
109
53
|
},
|
|
110
54
|
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
111
55
|
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
112
|
-
breadcrumbsPrefix,
|
|
56
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
113
57
|
omitUndefined: opts === null || opts === void 0 ? void 0 : opts.omitUndefined,
|
|
114
58
|
});
|
|
115
59
|
},
|
|
116
60
|
json: (parsed, opts) => {
|
|
117
|
-
|
|
118
|
-
|
|
61
|
+
const requiredKeys = [];
|
|
62
|
+
for (const [parsedKey, schemaOrObjectProperty] of (0, entries_js_1.entries)(schemas)) {
|
|
63
|
+
const valueSchema = (0, property_js_1.isProperty)(schemaOrObjectProperty)
|
|
64
|
+
? schemaOrObjectProperty.valueSchema
|
|
65
|
+
: schemaOrObjectProperty;
|
|
66
|
+
if (isSchemaRequired(valueSchema)) {
|
|
67
|
+
requiredKeys.push(parsedKey);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
119
70
|
return validateAndTransformObject({
|
|
120
71
|
value: parsed,
|
|
121
|
-
requiredKeys
|
|
122
|
-
requiredKeysSet: getJsonRequiredKeysSet(),
|
|
72
|
+
requiredKeys,
|
|
123
73
|
getProperty: (parsedKey) => {
|
|
124
74
|
const property = schemas[parsedKey];
|
|
125
75
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
@@ -130,8 +80,8 @@ function object(schemas) {
|
|
|
130
80
|
return {
|
|
131
81
|
transformedKey: property.rawKey,
|
|
132
82
|
transform: (propertyValue) => {
|
|
133
|
-
|
|
134
|
-
return property.valueSchema.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix:
|
|
83
|
+
var _a;
|
|
84
|
+
return property.valueSchema.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), parsedKey] }));
|
|
135
85
|
},
|
|
136
86
|
};
|
|
137
87
|
}
|
|
@@ -139,15 +89,15 @@ function object(schemas) {
|
|
|
139
89
|
return {
|
|
140
90
|
transformedKey: parsedKey,
|
|
141
91
|
transform: (propertyValue) => {
|
|
142
|
-
|
|
143
|
-
return property.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix:
|
|
92
|
+
var _a;
|
|
93
|
+
return property.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), parsedKey] }));
|
|
144
94
|
},
|
|
145
95
|
};
|
|
146
96
|
}
|
|
147
97
|
},
|
|
148
98
|
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
149
99
|
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
150
|
-
breadcrumbsPrefix,
|
|
100
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
151
101
|
omitUndefined: opts === null || opts === void 0 ? void 0 : opts.omitUndefined,
|
|
152
102
|
});
|
|
153
103
|
},
|
|
@@ -155,7 +105,7 @@ function object(schemas) {
|
|
|
155
105
|
};
|
|
156
106
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, (0, maybeSkipValidation_js_1.maybeSkipValidation)(baseSchema)), (0, index_js_2.getSchemaUtils)(baseSchema)), (0, index_js_1.getObjectLikeUtils)(baseSchema)), getObjectUtils(baseSchema));
|
|
157
107
|
}
|
|
158
|
-
function validateAndTransformObject({ value, requiredKeys,
|
|
108
|
+
function validateAndTransformObject({ value, requiredKeys, getProperty, unrecognizedObjectKeys = "fail", skipValidation = false, breadcrumbsPrefix = [], }) {
|
|
159
109
|
if (!(0, isPlainObject_js_1.isPlainObject)(value)) {
|
|
160
110
|
return {
|
|
161
111
|
ok: false,
|
|
@@ -167,21 +117,13 @@ function validateAndTransformObject({ value, requiredKeys, requiredKeysSet, getP
|
|
|
167
117
|
],
|
|
168
118
|
};
|
|
169
119
|
}
|
|
170
|
-
|
|
171
|
-
// Use a counter instead of copying the Set to avoid per-call allocation.
|
|
172
|
-
let missingRequiredCount = requiredKeys.length;
|
|
120
|
+
const missingRequiredKeys = new Set(requiredKeys);
|
|
173
121
|
const errors = [];
|
|
174
122
|
const transformed = {};
|
|
175
|
-
for (const preTransformedKey
|
|
176
|
-
if (!_hasOwn.call(value, preTransformedKey)) {
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
const preTransformedItemValue = value[preTransformedKey];
|
|
123
|
+
for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
|
|
180
124
|
const property = getProperty(preTransformedKey);
|
|
181
125
|
if (property != null) {
|
|
182
|
-
|
|
183
|
-
missingRequiredCount--;
|
|
184
|
-
}
|
|
126
|
+
missingRequiredKeys.delete(preTransformedKey);
|
|
185
127
|
const value = property.transform(preTransformedItemValue);
|
|
186
128
|
if (value.ok) {
|
|
187
129
|
transformed[property.transformedKey] = value.value;
|
|
@@ -207,16 +149,12 @@ function validateAndTransformObject({ value, requiredKeys, requiredKeysSet, getP
|
|
|
207
149
|
}
|
|
208
150
|
}
|
|
209
151
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
152
|
+
errors.push(...requiredKeys
|
|
153
|
+
.filter((key) => missingRequiredKeys.has(key))
|
|
154
|
+
.map((key) => ({
|
|
155
|
+
path: breadcrumbsPrefix,
|
|
156
|
+
message: `Missing required key "${key}"`,
|
|
157
|
+
})));
|
|
220
158
|
if (errors.length === 0 || skipValidation) {
|
|
221
159
|
return {
|
|
222
160
|
ok: true,
|
|
@@ -6,8 +6,6 @@ const filterObject_js_1 = require("../../utils/filterObject.js");
|
|
|
6
6
|
const getErrorMessageForIncorrectType_js_1 = require("../../utils/getErrorMessageForIncorrectType.js");
|
|
7
7
|
const isPlainObject_js_1 = require("../../utils/isPlainObject.js");
|
|
8
8
|
const index_js_1 = require("../schema-utils/index.js");
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
10
|
-
const _hasOwn = Object.prototype.hasOwnProperty;
|
|
11
9
|
function getObjectLikeUtils(schema) {
|
|
12
10
|
return {
|
|
13
11
|
withParsedProperties: (properties) => withParsedProperties(schema, properties),
|
|
@@ -23,14 +21,9 @@ function withParsedProperties(objectLike, properties) {
|
|
|
23
21
|
if (!parsedObject.ok) {
|
|
24
22
|
return parsedObject;
|
|
25
23
|
}
|
|
26
|
-
const additionalProperties = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const value = properties[key];
|
|
30
|
-
additionalProperties[key] =
|
|
31
|
-
typeof value === "function" ? value(parsedObject.value) : value;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
24
|
+
const additionalProperties = Object.entries(properties).reduce((processed, [key, value]) => {
|
|
25
|
+
return Object.assign(Object.assign({}, processed), { [key]: typeof value === "function" ? value(parsedObject.value) : value });
|
|
26
|
+
}, {});
|
|
34
27
|
return {
|
|
35
28
|
ok: true,
|
|
36
29
|
value: Object.assign(Object.assign({}, parsedObject.value), additionalProperties),
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.record = record;
|
|
4
4
|
const Schema_js_1 = require("../../Schema.js");
|
|
5
|
+
const entries_js_1 = require("../../utils/entries.js");
|
|
5
6
|
const getErrorMessageForIncorrectType_js_1 = require("../../utils/getErrorMessageForIncorrectType.js");
|
|
6
7
|
const isPlainObject_js_1 = require("../../utils/isPlainObject.js");
|
|
7
8
|
const maybeSkipValidation_js_1 = require("../../utils/maybeSkipValidation.js");
|
|
8
9
|
const index_js_1 = require("../schema-utils/index.js");
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
10
|
-
const _hasOwn = Object.prototype.hasOwnProperty;
|
|
11
10
|
function record(keySchema, valueSchema) {
|
|
12
11
|
const baseSchema = {
|
|
13
12
|
parse: (raw, opts) => {
|
|
@@ -56,16 +55,11 @@ function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transfo
|
|
|
56
55
|
],
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!_hasOwn.call(value, stringKey)) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const entryValue = value[stringKey];
|
|
66
|
-
if (entryValue === undefined) {
|
|
67
|
-
continue;
|
|
58
|
+
return (0, entries_js_1.entries)(value).reduce((accPromise, [stringKey, value]) => {
|
|
59
|
+
if (value === undefined) {
|
|
60
|
+
return accPromise;
|
|
68
61
|
}
|
|
62
|
+
const acc = accPromise;
|
|
69
63
|
let key = stringKey;
|
|
70
64
|
if (isKeyNumeric) {
|
|
71
65
|
const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
|
|
@@ -74,21 +68,26 @@ function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transfo
|
|
|
74
68
|
}
|
|
75
69
|
}
|
|
76
70
|
const transformedKey = transformKey(key);
|
|
77
|
-
const transformedValue = transformValue(
|
|
78
|
-
if (transformedKey.ok && transformedValue.ok) {
|
|
79
|
-
|
|
71
|
+
const transformedValue = transformValue(value, key);
|
|
72
|
+
if (acc.ok && transformedKey.ok && transformedValue.ok) {
|
|
73
|
+
return {
|
|
74
|
+
ok: true,
|
|
75
|
+
value: Object.assign(Object.assign({}, acc.value), { [transformedKey.value]: transformedValue.value }),
|
|
76
|
+
};
|
|
80
77
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
if (!transformedValue.ok) {
|
|
86
|
-
errors.push(...transformedValue.errors);
|
|
87
|
-
}
|
|
78
|
+
const errors = [];
|
|
79
|
+
if (!acc.ok) {
|
|
80
|
+
errors.push(...acc.errors);
|
|
88
81
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
if (!transformedKey.ok) {
|
|
83
|
+
errors.push(...transformedKey.errors);
|
|
84
|
+
}
|
|
85
|
+
if (!transformedValue.ok) {
|
|
86
|
+
errors.push(...transformedValue.errors);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
errors,
|
|
91
|
+
};
|
|
92
|
+
}, { ok: true, value: {} });
|
|
94
93
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.union = union;
|
|
4
15
|
const Schema_js_1 = require("../../Schema.js");
|
|
@@ -9,8 +20,6 @@ const maybeSkipValidation_js_1 = require("../../utils/maybeSkipValidation.js");
|
|
|
9
20
|
const index_js_1 = require("../enum/index.js");
|
|
10
21
|
const index_js_2 = require("../object-like/index.js");
|
|
11
22
|
const index_js_3 = require("../schema-utils/index.js");
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
13
|
-
const _hasOwn = Object.prototype.hasOwnProperty;
|
|
14
23
|
function union(discriminant, union) {
|
|
15
24
|
const rawDiscriminant = typeof discriminant === "string" ? discriminant : discriminant.rawDiscriminant;
|
|
16
25
|
const parsedDiscriminant = typeof discriminant === "string"
|
|
@@ -70,13 +79,7 @@ function transformAndValidateUnion({ value, discriminant, transformedDiscriminan
|
|
|
70
79
|
],
|
|
71
80
|
};
|
|
72
81
|
}
|
|
73
|
-
const discriminantValue =
|
|
74
|
-
const additionalProperties = {};
|
|
75
|
-
for (const key in value) {
|
|
76
|
-
if (_hasOwn.call(value, key) && key !== discriminant) {
|
|
77
|
-
additionalProperties[key] = value[key];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
82
|
+
const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
80
83
|
if (discriminantValue == null) {
|
|
81
84
|
return {
|
|
82
85
|
ok: false,
|
|
@@ -6,10 +6,12 @@ function isPlainObject(value) {
|
|
|
6
6
|
if (typeof value !== "object" || value === null) {
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
if (proto === null) {
|
|
9
|
+
if (Object.getPrototypeOf(value) === null) {
|
|
11
10
|
return true;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let proto = value;
|
|
13
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
14
|
+
proto = Object.getPrototypeOf(proto);
|
|
15
|
+
}
|
|
16
|
+
return Object.getPrototypeOf(value) === proto;
|
|
15
17
|
}
|
|
@@ -11,9 +11,13 @@ export declare const AgentMailEnvironment: {
|
|
|
11
11
|
readonly http: "https://x402.api.agentmail.to";
|
|
12
12
|
readonly websockets: "wss://x402.ws.agentmail.to";
|
|
13
13
|
};
|
|
14
|
+
readonly ProdMpp: {
|
|
15
|
+
readonly http: "https://mpp.api.agentmail.to";
|
|
16
|
+
readonly websockets: "wss://mpp.ws.agentmail.to";
|
|
17
|
+
};
|
|
14
18
|
readonly EuProd: {
|
|
15
19
|
readonly http: "https://api.agentmail.eu";
|
|
16
20
|
readonly websockets: "wss://ws.agentmail.eu";
|
|
17
21
|
};
|
|
18
22
|
};
|
|
19
|
-
export type AgentMailEnvironment = typeof AgentMailEnvironment.Prod | typeof AgentMailEnvironment.ProdX402 | typeof AgentMailEnvironment.EuProd;
|
|
23
|
+
export type AgentMailEnvironment = typeof AgentMailEnvironment.Prod | typeof AgentMailEnvironment.ProdX402 | typeof AgentMailEnvironment.ProdMpp | typeof AgentMailEnvironment.EuProd;
|
package/dist/cjs/environments.js
CHANGED
|
@@ -11,6 +11,10 @@ exports.AgentMailEnvironment = {
|
|
|
11
11
|
http: "https://x402.api.agentmail.to",
|
|
12
12
|
websockets: "wss://x402.ws.agentmail.to",
|
|
13
13
|
},
|
|
14
|
+
ProdMpp: {
|
|
15
|
+
http: "https://mpp.api.agentmail.to",
|
|
16
|
+
websockets: "wss://mpp.ws.agentmail.to",
|
|
17
|
+
},
|
|
14
18
|
EuProd: {
|
|
15
19
|
http: "https://api.agentmail.eu",
|
|
16
20
|
websockets: "wss://ws.agentmail.eu",
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.21";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "agentmail",
|
|
9
|
-
"X-Fern-SDK-Version": "0.2.
|
|
10
|
-
"User-Agent": "agentmail/0.2.
|
|
9
|
+
"X-Fern-SDK-Version": "0.2.21",
|
|
10
|
+
"User-Agent": "agentmail/0.2.21",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -152,13 +152,7 @@ function getHeaders(args) {
|
|
|
152
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
153
|
var _a;
|
|
154
154
|
const newHeaders = new Headers();
|
|
155
|
-
newHeaders.set("Accept", args.responseType === "json"
|
|
156
|
-
? "application/json"
|
|
157
|
-
: args.responseType === "text"
|
|
158
|
-
? "text/plain"
|
|
159
|
-
: args.responseType === "sse"
|
|
160
|
-
? "text/event-stream"
|
|
161
|
-
: "*/*");
|
|
155
|
+
newHeaders.set("Accept", args.responseType === "json" ? "application/json" : args.responseType === "text" ? "text/plain" : "*/*");
|
|
162
156
|
if (args.body !== undefined && args.contentType != null) {
|
|
163
157
|
newHeaders.set("Content-Type", args.contentType);
|
|
164
158
|
}
|
|
@@ -28,19 +28,24 @@ function validateAndTransformArray(value, transformItem) {
|
|
|
28
28
|
],
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const maybeValidItems = value.map((item, index) => transformItem(item, index));
|
|
32
|
+
return maybeValidItems.reduce((acc, item) => {
|
|
33
|
+
if (acc.ok && item.ok) {
|
|
34
|
+
return {
|
|
35
|
+
ok: true,
|
|
36
|
+
value: [...acc.value, item.value],
|
|
37
|
+
};
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
const errors = [];
|
|
40
|
+
if (!acc.ok) {
|
|
41
|
+
errors.push(...acc.errors);
|
|
42
|
+
}
|
|
43
|
+
if (!item.ok) {
|
|
39
44
|
errors.push(...item.errors);
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
errors,
|
|
49
|
+
};
|
|
50
|
+
}, { ok: true, value: [] });
|
|
46
51
|
}
|