@letta-ai/letta-client 0.1.170 → 0.1.172
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 +16 -3
- package/api/errors/BadRequestError.d.ts +2 -1
- package/api/errors/BadRequestError.js +2 -1
- package/api/errors/ConflictError.d.ts +2 -1
- package/api/errors/ConflictError.js +2 -1
- package/api/errors/InternalServerError.d.ts +2 -1
- package/api/errors/InternalServerError.js +2 -1
- package/api/errors/NotFoundError.d.ts +2 -1
- package/api/errors/NotFoundError.js +2 -1
- package/api/errors/PaymentRequiredError.d.ts +2 -1
- package/api/errors/PaymentRequiredError.js +2 -1
- package/api/errors/UnprocessableEntityError.d.ts +2 -1
- package/api/errors/UnprocessableEntityError.js +2 -1
- package/api/resources/agents/client/Client.d.ts +20 -10
- package/api/resources/agents/client/Client.js +166 -82
- package/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
- package/api/resources/agents/resources/blocks/client/Client.js +90 -45
- package/api/resources/agents/resources/context/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/context/client/Client.js +18 -9
- package/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
- package/api/resources/agents/resources/files/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/files/client/Client.js +45 -21
- package/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/folders/client/Client.js +54 -27
- package/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/groups/client/Client.js +19 -10
- package/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
- package/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
- package/api/resources/agents/resources/messages/client/Client.js +155 -83
- package/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
- package/api/resources/agents/resources/passages/client/Client.js +64 -31
- package/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/sources/client/Client.js +54 -27
- package/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/templates/client/Client.js +54 -27
- package/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/tools/client/Client.js +54 -27
- package/api/resources/batches/client/Client.d.ts +8 -4
- package/api/resources/batches/client/Client.js +63 -30
- package/api/resources/blocks/client/Client.d.ts +12 -6
- package/api/resources/blocks/client/Client.js +100 -49
- package/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
- package/api/resources/blocks/resources/agents/client/Client.js +19 -10
- package/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
- package/api/resources/clientSideAccessTokens/client/Client.js +46 -22
- package/api/resources/embeddingModels/client/Client.d.ts +2 -1
- package/api/resources/embeddingModels/client/Client.js +18 -9
- package/api/resources/folders/client/Client.d.ts +18 -9
- package/api/resources/folders/client/Client.js +154 -76
- package/api/resources/folders/resources/files/client/Client.d.ts +6 -3
- package/api/resources/folders/resources/files/client/Client.js +48 -24
- package/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
- package/api/resources/folders/resources/passages/client/Client.js +19 -10
- package/api/resources/groups/client/Client.d.ts +12 -6
- package/api/resources/groups/client/Client.js +105 -52
- package/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
- package/api/resources/groups/resources/messages/client/Client.js +91 -49
- package/api/resources/health/client/Client.d.ts +2 -1
- package/api/resources/health/client/Client.js +17 -8
- package/api/resources/identities/client/Client.d.ts +14 -7
- package/api/resources/identities/client/Client.js +123 -61
- package/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
- package/api/resources/identities/resources/properties/client/Client.js +9 -3
- package/api/resources/jobs/client/Client.d.ts +10 -5
- package/api/resources/jobs/client/Client.js +92 -47
- package/api/resources/messages/client/Client.d.ts +2 -1
- package/api/resources/messages/client/Client.js +19 -10
- package/api/resources/models/client/Client.d.ts +2 -1
- package/api/resources/models/client/Client.js +27 -14
- package/api/resources/projects/client/Client.d.ts +2 -1
- package/api/resources/projects/client/Client.js +18 -9
- package/api/resources/providers/client/Client.d.ts +10 -5
- package/api/resources/providers/client/Client.js +77 -36
- package/api/resources/runs/client/Client.d.ts +8 -4
- package/api/resources/runs/client/Client.js +74 -38
- package/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/messages/client/Client.js +21 -12
- package/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/steps/client/Client.js +19 -10
- package/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/usage/client/Client.js +18 -9
- package/api/resources/sources/client/Client.d.ts +20 -10
- package/api/resources/sources/client/Client.js +173 -86
- package/api/resources/sources/resources/files/client/Client.d.ts +6 -3
- package/api/resources/sources/resources/files/client/Client.js +48 -24
- package/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
- package/api/resources/sources/resources/passages/client/Client.js +19 -10
- package/api/resources/steps/client/Client.d.ts +4 -2
- package/api/resources/steps/client/Client.js +41 -21
- package/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
- package/api/resources/steps/resources/feedback/client/Client.js +23 -12
- package/api/resources/tags/client/Client.d.ts +2 -1
- package/api/resources/tags/client/Client.js +19 -10
- package/api/resources/telemetry/client/Client.d.ts +2 -1
- package/api/resources/telemetry/client/Client.js +18 -9
- package/api/resources/templates/client/Client.d.ts +2 -1
- package/api/resources/templates/client/Client.js +18 -9
- package/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
- package/api/resources/templates/resources/agents/client/Client.js +19 -10
- package/api/resources/tools/client/Client.d.ts +40 -20
- package/api/resources/tools/client/Client.js +356 -182
- package/api/resources/voice/client/Client.d.ts +2 -1
- package/api/resources/voice/client/Client.js +9 -3
- package/api/types/LettaStreamingRequest.d.ts +2 -0
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/Fetcher.d.ts +1 -1
- package/core/fetcher/Fetcher.js +11 -3
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -1
- package/core/fetcher/getRequestBody.js +2 -1
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/fetcher/requestWithRetries.js +1 -1
- package/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/core/form-data-utils/FormDataWrapper.js +53 -10
- package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/core/form-data-utils/index.d.ts +1 -0
- package/core/form-data-utils/index.js +3 -0
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/schemas/Schema.d.ts +2 -0
- package/core/schemas/Schema.js +2 -0
- package/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/core/schemas/builders/bigint/bigint.js +21 -17
- package/core/schemas/builders/object/object.js +1 -0
- package/core/schemas/builders/record/record.js +1 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
- package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
- package/dist/api/errors/BadRequestError.d.ts +2 -1
- package/dist/api/errors/BadRequestError.js +2 -1
- package/dist/api/errors/ConflictError.d.ts +2 -1
- package/dist/api/errors/ConflictError.js +2 -1
- package/dist/api/errors/InternalServerError.d.ts +2 -1
- package/dist/api/errors/InternalServerError.js +2 -1
- package/dist/api/errors/NotFoundError.d.ts +2 -1
- package/dist/api/errors/NotFoundError.js +2 -1
- package/dist/api/errors/PaymentRequiredError.d.ts +2 -1
- package/dist/api/errors/PaymentRequiredError.js +2 -1
- package/dist/api/errors/UnprocessableEntityError.d.ts +2 -1
- package/dist/api/errors/UnprocessableEntityError.js +2 -1
- package/dist/api/resources/agents/client/Client.d.ts +20 -10
- package/dist/api/resources/agents/client/Client.js +166 -82
- package/dist/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
- package/dist/api/resources/agents/resources/blocks/client/Client.js +90 -45
- package/dist/api/resources/agents/resources/context/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/context/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/files/client/Client.js +45 -21
- package/dist/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/folders/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/groups/client/Client.js +19 -10
- package/dist/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
- package/dist/api/resources/agents/resources/messages/client/Client.js +155 -83
- package/dist/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
- package/dist/api/resources/agents/resources/passages/client/Client.js +64 -31
- package/dist/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/sources/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/templates/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/tools/client/Client.js +54 -27
- package/dist/api/resources/batches/client/Client.d.ts +8 -4
- package/dist/api/resources/batches/client/Client.js +63 -30
- package/dist/api/resources/blocks/client/Client.d.ts +12 -6
- package/dist/api/resources/blocks/client/Client.js +100 -49
- package/dist/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
- package/dist/api/resources/blocks/resources/agents/client/Client.js +19 -10
- package/dist/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
- package/dist/api/resources/clientSideAccessTokens/client/Client.js +46 -22
- package/dist/api/resources/embeddingModels/client/Client.d.ts +2 -1
- package/dist/api/resources/embeddingModels/client/Client.js +18 -9
- package/dist/api/resources/folders/client/Client.d.ts +18 -9
- package/dist/api/resources/folders/client/Client.js +154 -76
- package/dist/api/resources/folders/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/folders/resources/files/client/Client.js +48 -24
- package/dist/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
- package/dist/api/resources/folders/resources/passages/client/Client.js +19 -10
- package/dist/api/resources/groups/client/Client.d.ts +12 -6
- package/dist/api/resources/groups/client/Client.js +105 -52
- package/dist/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
- package/dist/api/resources/groups/resources/messages/client/Client.js +91 -49
- package/dist/api/resources/health/client/Client.d.ts +2 -1
- package/dist/api/resources/health/client/Client.js +17 -8
- package/dist/api/resources/identities/client/Client.d.ts +14 -7
- package/dist/api/resources/identities/client/Client.js +123 -61
- package/dist/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
- package/dist/api/resources/identities/resources/properties/client/Client.js +9 -3
- package/dist/api/resources/jobs/client/Client.d.ts +10 -5
- package/dist/api/resources/jobs/client/Client.js +92 -47
- package/dist/api/resources/messages/client/Client.d.ts +2 -1
- package/dist/api/resources/messages/client/Client.js +19 -10
- package/dist/api/resources/models/client/Client.d.ts +2 -1
- package/dist/api/resources/models/client/Client.js +27 -14
- package/dist/api/resources/projects/client/Client.d.ts +2 -1
- package/dist/api/resources/projects/client/Client.js +18 -9
- package/dist/api/resources/providers/client/Client.d.ts +10 -5
- package/dist/api/resources/providers/client/Client.js +77 -36
- package/dist/api/resources/runs/client/Client.d.ts +8 -4
- package/dist/api/resources/runs/client/Client.js +74 -38
- package/dist/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/messages/client/Client.js +21 -12
- package/dist/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/steps/client/Client.js +19 -10
- package/dist/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/usage/client/Client.js +18 -9
- package/dist/api/resources/sources/client/Client.d.ts +20 -10
- package/dist/api/resources/sources/client/Client.js +173 -86
- package/dist/api/resources/sources/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/sources/resources/files/client/Client.js +48 -24
- package/dist/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
- package/dist/api/resources/sources/resources/passages/client/Client.js +19 -10
- package/dist/api/resources/steps/client/Client.d.ts +4 -2
- package/dist/api/resources/steps/client/Client.js +41 -21
- package/dist/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
- package/dist/api/resources/steps/resources/feedback/client/Client.js +23 -12
- package/dist/api/resources/tags/client/Client.d.ts +2 -1
- package/dist/api/resources/tags/client/Client.js +19 -10
- package/dist/api/resources/telemetry/client/Client.d.ts +2 -1
- package/dist/api/resources/telemetry/client/Client.js +18 -9
- package/dist/api/resources/templates/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/client/Client.js +18 -9
- package/dist/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/resources/agents/client/Client.js +19 -10
- package/dist/api/resources/tools/client/Client.d.ts +40 -20
- package/dist/api/resources/tools/client/Client.js +356 -182
- package/dist/api/resources/voice/client/Client.d.ts +2 -1
- package/dist/api/resources/voice/client/Client.js +9 -3
- package/dist/api/types/LettaStreamingRequest.d.ts +2 -0
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/Fetcher.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.js +11 -3
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/core/fetcher/getRequestBody.js +2 -1
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/fetcher/requestWithRetries.js +1 -1
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +53 -10
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/dist/core/form-data-utils/index.d.ts +1 -0
- package/dist/core/form-data-utils/index.js +3 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/schemas/Schema.d.ts +2 -0
- package/dist/core/schemas/Schema.js +2 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/dist/core/schemas/builders/bigint/bigint.js +21 -17
- package/dist/core/schemas/builders/object/object.js +1 -0
- package/dist/core/schemas/builders/record/record.js +1 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
- package/dist/errors/LettaError.d.ts +4 -1
- package/dist/errors/LettaError.js +6 -8
- package/dist/serialization/types/LettaStreamingRequest.d.ts +1 -0
- package/dist/serialization/types/LettaStreamingRequest.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/errors/LettaError.d.ts +4 -1
- package/errors/LettaError.js +6 -8
- package/package.json +4 -4
- package/serialization/types/LettaStreamingRequest.d.ts +1 -0
- package/serialization/types/LettaStreamingRequest.js +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -48,6 +48,15 @@ const runtime_1 = require("../runtime");
|
|
|
48
48
|
function isNamedValue(value) {
|
|
49
49
|
return typeof value === "object" && value != null && "name" in value;
|
|
50
50
|
}
|
|
51
|
+
function isPathedValue(value) {
|
|
52
|
+
return typeof value === "object" && value != null && "path" in value;
|
|
53
|
+
}
|
|
54
|
+
function getLastPathSegment(pathStr) {
|
|
55
|
+
const lastForwardSlash = pathStr.lastIndexOf("/");
|
|
56
|
+
const lastBackSlash = pathStr.lastIndexOf("\\");
|
|
57
|
+
const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
|
|
58
|
+
return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr;
|
|
59
|
+
}
|
|
51
60
|
function newFormData() {
|
|
52
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
62
|
let formdata;
|
|
@@ -77,12 +86,22 @@ class Node18FormData {
|
|
|
77
86
|
var _a;
|
|
78
87
|
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
79
88
|
}
|
|
89
|
+
getFileName(value, filename) {
|
|
90
|
+
if (filename != null) {
|
|
91
|
+
return filename;
|
|
92
|
+
}
|
|
93
|
+
if (isNamedValue(value)) {
|
|
94
|
+
return value.name;
|
|
95
|
+
}
|
|
96
|
+
if (isPathedValue(value) && value.path) {
|
|
97
|
+
return getLastPathSegment(value.path.toString());
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
80
101
|
appendFile(key, value, fileName) {
|
|
81
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
103
|
var _a, _b;
|
|
83
|
-
|
|
84
|
-
fileName = value.name;
|
|
85
|
-
}
|
|
104
|
+
fileName = this.getFileName(value, fileName);
|
|
86
105
|
if (value instanceof Blob) {
|
|
87
106
|
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value, fileName);
|
|
88
107
|
}
|
|
@@ -123,12 +142,22 @@ class Node16FormData {
|
|
|
123
142
|
var _a;
|
|
124
143
|
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
125
144
|
}
|
|
145
|
+
getFileName(value, filename) {
|
|
146
|
+
if (filename != null) {
|
|
147
|
+
return filename;
|
|
148
|
+
}
|
|
149
|
+
if (isNamedValue(value)) {
|
|
150
|
+
return value.name;
|
|
151
|
+
}
|
|
152
|
+
if (isPathedValue(value) && value.path) {
|
|
153
|
+
return getLastPathSegment(value.path.toString());
|
|
154
|
+
}
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
126
157
|
appendFile(key, value, fileName) {
|
|
127
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
159
|
var _a, _b;
|
|
129
|
-
|
|
130
|
-
fileName = value.name;
|
|
131
|
-
}
|
|
160
|
+
fileName = this.getFileName(value, fileName);
|
|
132
161
|
let bufferedValue;
|
|
133
162
|
if (value instanceof Blob) {
|
|
134
163
|
bufferedValue = Buffer.from(yield value.arrayBuffer());
|
|
@@ -165,13 +194,27 @@ class WebFormData {
|
|
|
165
194
|
var _a;
|
|
166
195
|
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
|
|
167
196
|
}
|
|
197
|
+
getFileName(value, filename) {
|
|
198
|
+
if (filename != null) {
|
|
199
|
+
return filename;
|
|
200
|
+
}
|
|
201
|
+
if (isNamedValue(value)) {
|
|
202
|
+
return value.name;
|
|
203
|
+
}
|
|
204
|
+
if (isPathedValue(value) && value.path) {
|
|
205
|
+
return getLastPathSegment(value.path.toString());
|
|
206
|
+
}
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
168
209
|
appendFile(key, value, fileName) {
|
|
169
210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
var _a;
|
|
171
|
-
|
|
172
|
-
|
|
211
|
+
var _a, _b;
|
|
212
|
+
fileName = this.getFileName(value, fileName);
|
|
213
|
+
if (value instanceof Blob) {
|
|
214
|
+
(_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value, fileName);
|
|
215
|
+
return;
|
|
173
216
|
}
|
|
174
|
-
(
|
|
217
|
+
(_b = this.fd) === null || _b === void 0 ? void 0 : _b.append(key, new Blob([value]), fileName);
|
|
175
218
|
});
|
|
176
219
|
}
|
|
177
220
|
getRequest() {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.encodeAsFormParameter = encodeAsFormParameter;
|
|
7
|
+
const qs_1 = __importDefault(require("qs"));
|
|
8
|
+
/**
|
|
9
|
+
* Takes an unknown value, stringifies it using qs, and parses it into a key-value record
|
|
10
|
+
*/
|
|
11
|
+
function encodeAsFormParameter(value) {
|
|
12
|
+
const stringified = qs_1.default.stringify(value, { encode: false });
|
|
13
|
+
const keyValuePairs = stringified.split("&").map((pair) => {
|
|
14
|
+
const [key, value] = pair.split("=");
|
|
15
|
+
return [key, value];
|
|
16
|
+
});
|
|
17
|
+
return Object.fromEntries(keyValuePairs);
|
|
18
|
+
}
|
|
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.encodeAsFormParameter = void 0;
|
|
18
|
+
var encodeAsFormParameter_1 = require("./encodeAsFormParameter");
|
|
19
|
+
Object.defineProperty(exports, "encodeAsFormParameter", { enumerable: true, get: function () { return encodeAsFormParameter_1.encodeAsFormParameter; } });
|
|
17
20
|
__exportStar(require("./FormDataWrapper"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a value to JSON
|
|
3
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
4
|
+
* @param replacer A function that transforms the results.
|
|
5
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
6
|
+
* @returns JSON string
|
|
7
|
+
*/
|
|
8
|
+
export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse JSON string to object, array, or other type
|
|
11
|
+
* @param text A valid JSON string.
|
|
12
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
13
|
+
* @returns Parsed object, array, or other type
|
|
14
|
+
*/
|
|
15
|
+
export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJson = void 0;
|
|
4
|
+
exports.fromJson = fromJson;
|
|
5
|
+
/**
|
|
6
|
+
* Serialize a value to JSON
|
|
7
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
8
|
+
* @param replacer A function that transforms the results.
|
|
9
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
10
|
+
* @returns JSON string
|
|
11
|
+
*/
|
|
12
|
+
const toJson = (value, replacer, space) => {
|
|
13
|
+
return JSON.stringify(value, replacer, space);
|
|
14
|
+
};
|
|
15
|
+
exports.toJson = toJson;
|
|
16
|
+
/**
|
|
17
|
+
* Parse JSON string to object, array, or other type
|
|
18
|
+
* @param text A valid JSON string.
|
|
19
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
20
|
+
* @returns Parsed object, array, or other type
|
|
21
|
+
*/
|
|
22
|
+
function fromJson(text, reviver) {
|
|
23
|
+
return JSON.parse(text, reviver);
|
|
24
|
+
}
|
|
@@ -24,7 +24,9 @@ export declare const SchemaType: {
|
|
|
24
24
|
readonly SET: "set";
|
|
25
25
|
readonly UNION: "union";
|
|
26
26
|
readonly UNDISCRIMINATED_UNION: "undiscriminatedUnion";
|
|
27
|
+
readonly NULLABLE: "nullable";
|
|
27
28
|
readonly OPTIONAL: "optional";
|
|
29
|
+
readonly OPTIONAL_NULLABLE: "optionalNullable";
|
|
28
30
|
};
|
|
29
31
|
export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
|
|
30
32
|
export type MaybeValid<T> = Valid<T> | Invalid;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Schema } from "../../Schema";
|
|
2
|
-
export declare function bigint(): Schema<
|
|
2
|
+
export declare function bigint(): Schema<bigint | number, bigint>;
|
|
@@ -8,30 +8,30 @@ const schema_utils_1 = require("../schema-utils");
|
|
|
8
8
|
function bigint() {
|
|
9
9
|
const baseSchema = {
|
|
10
10
|
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
11
|
-
if (typeof raw
|
|
11
|
+
if (typeof raw === "bigint") {
|
|
12
12
|
return {
|
|
13
|
-
ok:
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
path: breadcrumbsPrefix,
|
|
17
|
-
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "string"),
|
|
18
|
-
},
|
|
19
|
-
],
|
|
13
|
+
ok: true,
|
|
14
|
+
value: raw,
|
|
20
15
|
};
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
ok: true,
|
|
24
|
-
value: BigInt(raw),
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
json: (bigint, { breadcrumbsPrefix = [] } = {}) => {
|
|
28
|
-
if (typeof bigint === "bigint") {
|
|
17
|
+
if (typeof raw === "number") {
|
|
29
18
|
return {
|
|
30
19
|
ok: true,
|
|
31
|
-
value:
|
|
20
|
+
value: BigInt(raw),
|
|
32
21
|
};
|
|
33
22
|
}
|
|
34
|
-
|
|
23
|
+
return {
|
|
24
|
+
ok: false,
|
|
25
|
+
errors: [
|
|
26
|
+
{
|
|
27
|
+
path: breadcrumbsPrefix,
|
|
28
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "bigint | number"),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
json: (bigint, { breadcrumbsPrefix = [] } = {}) => {
|
|
34
|
+
if (typeof bigint !== "bigint") {
|
|
35
35
|
return {
|
|
36
36
|
ok: false,
|
|
37
37
|
errors: [
|
|
@@ -42,6 +42,10 @@ function bigint() {
|
|
|
42
42
|
],
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
return {
|
|
46
|
+
ok: true,
|
|
47
|
+
value: bigint,
|
|
48
|
+
};
|
|
45
49
|
},
|
|
46
50
|
getType: () => Schema_1.SchemaType.BIGINT,
|
|
47
51
|
};
|
|
@@ -56,8 +56,7 @@ function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transfo
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
return (0, entries_1.entries)(value).reduce((accPromise, [stringKey, value]) => {
|
|
59
|
-
|
|
60
|
-
if (value == null) {
|
|
59
|
+
if (value === undefined) {
|
|
61
60
|
return accPromise;
|
|
62
61
|
}
|
|
63
62
|
const acc = accPromise;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BaseSchema, Schema, SchemaOptions } from "../../Schema";
|
|
2
2
|
export interface SchemaUtils<Raw, Parsed> {
|
|
3
|
+
nullable: () => Schema<Raw | null, Parsed | null>;
|
|
3
4
|
optional: () => Schema<Raw | null | undefined, Parsed | undefined>;
|
|
5
|
+
optionalNullable: () => Schema<Raw | null | undefined, Parsed | null | undefined>;
|
|
4
6
|
transform: <Transformed>(transformer: SchemaTransformer<Parsed, Transformed>) => Schema<Raw, Transformed>;
|
|
5
7
|
parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed;
|
|
6
8
|
jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw;
|
|
@@ -13,5 +15,7 @@ export declare function getSchemaUtils<Raw, Parsed>(schema: BaseSchema<Raw, Pars
|
|
|
13
15
|
/**
|
|
14
16
|
* schema utils are defined in one file to resolve issues with circular imports
|
|
15
17
|
*/
|
|
18
|
+
export declare function nullable<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null, Parsed | null>;
|
|
16
19
|
export declare function optional<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null | undefined, Parsed | undefined>;
|
|
20
|
+
export declare function optionalNullable<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null | undefined, Parsed | null | undefined>;
|
|
17
21
|
export declare function transform<Raw, Parsed, Transformed>(schema: BaseSchema<Raw, Parsed>, transformer: SchemaTransformer<Parsed, Transformed>): Schema<Raw, Transformed>;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSchemaUtils = getSchemaUtils;
|
|
4
|
+
exports.nullable = nullable;
|
|
4
5
|
exports.optional = optional;
|
|
6
|
+
exports.optionalNullable = optionalNullable;
|
|
5
7
|
exports.transform = transform;
|
|
6
8
|
const Schema_1 = require("../../Schema");
|
|
7
9
|
const JsonError_1 = require("./JsonError");
|
|
8
10
|
const ParseError_1 = require("./ParseError");
|
|
9
11
|
function getSchemaUtils(schema) {
|
|
10
12
|
return {
|
|
13
|
+
nullable: () => nullable(schema),
|
|
11
14
|
optional: () => optional(schema),
|
|
15
|
+
optionalNullable: () => optionalNullable(schema),
|
|
12
16
|
transform: (transformer) => transform(schema, transformer),
|
|
13
17
|
parseOrThrow: (raw, opts) => {
|
|
14
18
|
const parsed = schema.parse(raw, opts);
|
|
@@ -29,6 +33,30 @@ function getSchemaUtils(schema) {
|
|
|
29
33
|
/**
|
|
30
34
|
* schema utils are defined in one file to resolve issues with circular imports
|
|
31
35
|
*/
|
|
36
|
+
function nullable(schema) {
|
|
37
|
+
const baseSchema = {
|
|
38
|
+
parse: (raw, opts) => {
|
|
39
|
+
if (raw == null) {
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
value: null,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return schema.parse(raw, opts);
|
|
46
|
+
},
|
|
47
|
+
json: (parsed, opts) => {
|
|
48
|
+
if (parsed == null) {
|
|
49
|
+
return {
|
|
50
|
+
ok: true,
|
|
51
|
+
value: null,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return schema.json(parsed, opts);
|
|
55
|
+
},
|
|
56
|
+
getType: () => Schema_1.SchemaType.NULLABLE,
|
|
57
|
+
};
|
|
58
|
+
return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
|
|
59
|
+
}
|
|
32
60
|
function optional(schema) {
|
|
33
61
|
const baseSchema = {
|
|
34
62
|
parse: (raw, opts) => {
|
|
@@ -59,6 +87,42 @@ function optional(schema) {
|
|
|
59
87
|
};
|
|
60
88
|
return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
|
|
61
89
|
}
|
|
90
|
+
function optionalNullable(schema) {
|
|
91
|
+
const baseSchema = {
|
|
92
|
+
parse: (raw, opts) => {
|
|
93
|
+
if (raw === undefined) {
|
|
94
|
+
return {
|
|
95
|
+
ok: true,
|
|
96
|
+
value: undefined,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (raw === null) {
|
|
100
|
+
return {
|
|
101
|
+
ok: true,
|
|
102
|
+
value: null,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return schema.parse(raw, opts);
|
|
106
|
+
},
|
|
107
|
+
json: (parsed, opts) => {
|
|
108
|
+
if (parsed === undefined) {
|
|
109
|
+
return {
|
|
110
|
+
ok: true,
|
|
111
|
+
value: undefined,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (parsed === null) {
|
|
115
|
+
return {
|
|
116
|
+
ok: true,
|
|
117
|
+
value: null,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return schema.json(parsed, opts);
|
|
121
|
+
},
|
|
122
|
+
getType: () => Schema_1.SchemaType.OPTIONAL_NULLABLE,
|
|
123
|
+
};
|
|
124
|
+
return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
|
|
125
|
+
}
|
|
62
126
|
function transform(schema, transformer) {
|
|
63
127
|
const baseSchema = {
|
|
64
128
|
parse: (raw, opts) => {
|
|
@@ -2,6 +2,6 @@ export type addQuestionMarksToNullableProperties<T> = {
|
|
|
2
2
|
[K in OptionalKeys<T>]?: T[K];
|
|
3
3
|
} & Pick<T, RequiredKeys<T>>;
|
|
4
4
|
export type OptionalKeys<T> = {
|
|
5
|
-
[K in keyof T]-?: undefined extends T[K] ? K :
|
|
5
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
6
6
|
}[keyof T];
|
|
7
7
|
export type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T>>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as core from "../core";
|
|
4
5
|
export declare class LettaError extends Error {
|
|
5
6
|
readonly statusCode?: number;
|
|
6
7
|
readonly body?: unknown;
|
|
7
|
-
|
|
8
|
+
readonly rawResponse?: core.RawResponse;
|
|
9
|
+
constructor({ message, statusCode, body, rawResponse, }: {
|
|
8
10
|
message?: string;
|
|
9
11
|
statusCode?: number;
|
|
10
12
|
body?: unknown;
|
|
13
|
+
rawResponse?: core.RawResponse;
|
|
11
14
|
});
|
|
12
15
|
}
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LettaError = void 0;
|
|
7
|
+
const json_1 = require("../core/json");
|
|
7
8
|
class LettaError extends Error {
|
|
8
|
-
constructor({ message, statusCode, body }) {
|
|
9
|
+
constructor({ message, statusCode, body, rawResponse, }) {
|
|
9
10
|
super(buildMessage({ message, statusCode, body }));
|
|
10
11
|
Object.setPrototypeOf(this, LettaError.prototype);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (body !== undefined) {
|
|
15
|
-
this.body = body;
|
|
16
|
-
}
|
|
12
|
+
this.statusCode = statusCode;
|
|
13
|
+
this.body = body;
|
|
14
|
+
this.rawResponse = rawResponse;
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
exports.LettaError = LettaError;
|
|
@@ -26,7 +24,7 @@ function buildMessage({ message, statusCode, body, }) {
|
|
|
26
24
|
lines.push(`Status code: ${statusCode.toString()}`);
|
|
27
25
|
}
|
|
28
26
|
if (body != null) {
|
|
29
|
-
lines.push(`Body: ${
|
|
27
|
+
lines.push(`Body: ${(0, json_1.toJson)(body, undefined, 2)}`);
|
|
30
28
|
}
|
|
31
29
|
return lines.join("\n");
|
|
32
30
|
}
|
|
@@ -49,4 +49,5 @@ exports.LettaStreamingRequest = core.serialization.object({
|
|
|
49
49
|
includeReturnMessageTypes: core.serialization.property("include_return_message_types", core.serialization.list(MessageType_1.MessageType).optional()),
|
|
50
50
|
enableThinking: core.serialization.property("enable_thinking", core.serialization.string().optional()),
|
|
51
51
|
streamTokens: core.serialization.property("stream_tokens", core.serialization.boolean().optional()),
|
|
52
|
+
includePings: core.serialization.property("include_pings", core.serialization.boolean().optional()),
|
|
52
53
|
});
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.172";
|
package/dist/version.js
CHANGED
package/errors/LettaError.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as core from "../core";
|
|
4
5
|
export declare class LettaError extends Error {
|
|
5
6
|
readonly statusCode?: number;
|
|
6
7
|
readonly body?: unknown;
|
|
7
|
-
|
|
8
|
+
readonly rawResponse?: core.RawResponse;
|
|
9
|
+
constructor({ message, statusCode, body, rawResponse, }: {
|
|
8
10
|
message?: string;
|
|
9
11
|
statusCode?: number;
|
|
10
12
|
body?: unknown;
|
|
13
|
+
rawResponse?: core.RawResponse;
|
|
11
14
|
});
|
|
12
15
|
}
|
package/errors/LettaError.js
CHANGED
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LettaError = void 0;
|
|
7
|
+
const json_1 = require("../core/json");
|
|
7
8
|
class LettaError extends Error {
|
|
8
|
-
constructor({ message, statusCode, body }) {
|
|
9
|
+
constructor({ message, statusCode, body, rawResponse, }) {
|
|
9
10
|
super(buildMessage({ message, statusCode, body }));
|
|
10
11
|
Object.setPrototypeOf(this, LettaError.prototype);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (body !== undefined) {
|
|
15
|
-
this.body = body;
|
|
16
|
-
}
|
|
12
|
+
this.statusCode = statusCode;
|
|
13
|
+
this.body = body;
|
|
14
|
+
this.rawResponse = rawResponse;
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
exports.LettaError = LettaError;
|
|
@@ -26,7 +24,7 @@ function buildMessage({ message, statusCode, body, }) {
|
|
|
26
24
|
lines.push(`Status code: ${statusCode.toString()}`);
|
|
27
25
|
}
|
|
28
26
|
if (body != null) {
|
|
29
|
-
lines.push(`Body: ${
|
|
27
|
+
lines.push(`Body: ${(0, json_1.toJson)(body, undefined, 2)}`);
|
|
30
28
|
}
|
|
31
29
|
return lines.join("\n");
|
|
32
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letta-ai/letta-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.172",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": "https://github.com/letta-ai/letta-node",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"node-fetch": "^2.7.0",
|
|
19
19
|
"qs": "^6.13.1",
|
|
20
20
|
"readable-stream": "^4.5.2",
|
|
21
|
-
"form-data-encoder": "^4.0.2"
|
|
22
|
-
"dedent": "^1.0.0"
|
|
21
|
+
"form-data-encoder": "^4.0.2"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
24
|
"@types/url-join": "4.0.1",
|
|
@@ -40,5 +39,6 @@
|
|
|
40
39
|
"fs": false,
|
|
41
40
|
"os": false,
|
|
42
41
|
"path": false
|
|
43
|
-
}
|
|
42
|
+
},
|
|
43
|
+
"packageManager": "yarn@1.22.22"
|
|
44
44
|
}
|
|
@@ -49,4 +49,5 @@ exports.LettaStreamingRequest = core.serialization.object({
|
|
|
49
49
|
includeReturnMessageTypes: core.serialization.property("include_return_message_types", core.serialization.list(MessageType_1.MessageType).optional()),
|
|
50
50
|
enableThinking: core.serialization.property("enable_thinking", core.serialization.string().optional()),
|
|
51
51
|
streamTokens: core.serialization.property("stream_tokens", core.serialization.boolean().optional()),
|
|
52
|
+
includePings: core.serialization.property("include_pings", core.serialization.boolean().optional()),
|
|
52
53
|
});
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.172";
|
package/version.js
CHANGED