lemma-sdk 0.2.23 → 0.2.24
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 +3 -3
- package/dist/auth.js +0 -1
- package/dist/browser/lemma-client.js +167 -104
- package/dist/namespaces/assistants.d.ts +21 -3
- package/dist/namespaces/assistants.js +13 -7
- package/dist/namespaces/files.d.ts +9 -4
- package/dist/namespaces/files.js +52 -14
- package/dist/namespaces/records.d.ts +10 -2
- package/dist/namespaces/records.js +15 -9
- package/dist/openapi_client/index.d.ts +6 -5
- package/dist/openapi_client/index.js +2 -2
- package/dist/openapi_client/models/CreateConversationRequest.d.ts +1 -1
- package/dist/openapi_client/models/CreateFolderRequest.d.ts +1 -2
- package/dist/openapi_client/models/CreateTriggerRequest.d.ts +0 -1
- package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +1 -1
- package/dist/openapi_client/models/DatastoreQueryRequest.d.ts +9 -0
- package/dist/openapi_client/models/DatastoreQueryResponse.d.ts +7 -0
- package/dist/openapi_client/models/DirectoryTreeNode.d.ts +7 -0
- package/dist/openapi_client/models/DirectoryTreeResponse.d.ts +6 -0
- package/dist/openapi_client/models/DirectoryTreeResponse.js +1 -0
- package/dist/openapi_client/models/FileResponse.d.ts +4 -6
- package/dist/openapi_client/models/FileSearchRequest.d.ts +5 -3
- package/dist/openapi_client/models/FileSearchResultSchema.d.ts +1 -0
- package/dist/openapi_client/models/FileSearchScopeMode.d.ts +4 -0
- package/dist/openapi_client/models/FileSearchScopeMode.js +9 -0
- package/dist/openapi_client/models/TableResponse.d.ts +1 -1
- package/dist/openapi_client/models/TriggerResponse.d.ts +0 -1
- package/dist/openapi_client/models/update.d.ts +2 -2
- package/dist/openapi_client/services/ConversationsService.d.ts +3 -2
- package/dist/openapi_client/services/ConversationsService.js +5 -3
- package/dist/openapi_client/services/FilesService.d.ts +34 -25
- package/dist/openapi_client/services/FilesService.js +75 -47
- package/dist/openapi_client/services/QueryService.d.ts +14 -0
- package/dist/openapi_client/services/QueryService.js +26 -0
- package/dist/openapi_client/services/RecordsService.d.ts +7 -13
- package/dist/openapi_client/services/RecordsService.js +12 -26
- package/dist/react/components/AssistantEmbedded.d.ts +1 -1
- package/dist/react/components/AssistantEmbedded.js +2 -1
- package/dist/react/useAssistantController.d.ts +5 -1
- package/dist/react/useAssistantController.js +7 -3
- package/dist/react/useAssistantSession.d.ts +12 -0
- package/dist/react/useAssistantSession.js +24 -5
- package/dist/types.d.ts +10 -4
- package/package.json +1 -1
- package/dist/openapi_client/models/RecordFilter.d.ts +0 -15
- package/dist/openapi_client/models/RecordFilterOperator.d.ts +0 -10
- package/dist/openapi_client/models/RecordFilterOperator.js +0 -15
- package/dist/openapi_client/models/RecordQueryRequest.d.ts +0 -20
- package/dist/openapi_client/models/RecordSort.d.ts +0 -11
- package/dist/openapi_client/models/RecordSortDirection.d.ts +0 -4
- package/dist/openapi_client/models/RecordSortDirection.js +0 -9
- /package/dist/openapi_client/models/{RecordFilter.js → DatastoreQueryRequest.js} +0 -0
- /package/dist/openapi_client/models/{RecordQueryRequest.js → DatastoreQueryResponse.js} +0 -0
- /package/dist/openapi_client/models/{RecordSort.js → DirectoryTreeNode.js} +0 -0
package/README.md
CHANGED
|
@@ -253,7 +253,7 @@ function SupportAssistant() {
|
|
|
253
253
|
<AssistantEmbedded
|
|
254
254
|
client={client}
|
|
255
255
|
podId="pod_123"
|
|
256
|
-
|
|
256
|
+
assistantName="support_assistant"
|
|
257
257
|
title="Support Assistant"
|
|
258
258
|
subtitle="Ask questions about this pod."
|
|
259
259
|
placeholder="Message Support Assistant"
|
|
@@ -300,7 +300,7 @@ function ControlledAssistant() {
|
|
|
300
300
|
const assistant = useAssistantController({
|
|
301
301
|
client,
|
|
302
302
|
podId: "pod_123",
|
|
303
|
-
|
|
303
|
+
assistantName: "support_assistant",
|
|
304
304
|
});
|
|
305
305
|
|
|
306
306
|
return (
|
|
@@ -365,7 +365,7 @@ function CustomAssistantShell() {
|
|
|
365
365
|
const assistant = useAssistantController({
|
|
366
366
|
client,
|
|
367
367
|
podId: "pod_123",
|
|
368
|
-
|
|
368
|
+
assistantName: "support_assistant",
|
|
369
369
|
});
|
|
370
370
|
|
|
371
371
|
const rows = buildDisplayMessageRows(assistant.messages);
|
package/dist/auth.js
CHANGED
|
@@ -462,7 +462,6 @@ class AuthManager {
|
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
applyUnauthenticatedState() {
|
|
465
|
-
this.clearFrontendSessionMarkers();
|
|
466
465
|
const next = { status: "unauthenticated", user: null };
|
|
467
466
|
this.setState(next);
|
|
468
467
|
return next;
|
|
@@ -1639,32 +1638,38 @@ class ConversationsNamespace {
|
|
|
1639
1638
|
list(options = {}) {
|
|
1640
1639
|
return this.http.request("GET", "/conversations", {
|
|
1641
1640
|
params: {
|
|
1642
|
-
|
|
1641
|
+
assistant_name: options.assistant_name ?? options.assistant_id,
|
|
1643
1642
|
pod_id: this.resolvePodId(options.pod_id),
|
|
1644
1643
|
organization_id: options.organization_id,
|
|
1644
|
+
global_only: options.global_only ?? false,
|
|
1645
1645
|
limit: options.limit ?? 20,
|
|
1646
1646
|
page_token: options.page_token,
|
|
1647
1647
|
},
|
|
1648
1648
|
});
|
|
1649
1649
|
}
|
|
1650
|
-
listByAssistant(
|
|
1651
|
-
return this.list({ ...options,
|
|
1650
|
+
listByAssistant(assistantName, options = {}) {
|
|
1651
|
+
return this.list({ ...options, assistant_name: assistantName });
|
|
1652
|
+
}
|
|
1653
|
+
listByAssistantName(assistantName, options = {}) {
|
|
1654
|
+
return this.listByAssistant(assistantName, options);
|
|
1652
1655
|
}
|
|
1653
1656
|
listModels() {
|
|
1654
1657
|
return this.http.request("GET", "/models");
|
|
1655
1658
|
}
|
|
1656
1659
|
create(payload) {
|
|
1660
|
+
const { assistant_id, ...requestBody } = payload;
|
|
1657
1661
|
return this.http.request("POST", "/conversations", {
|
|
1658
1662
|
body: {
|
|
1659
|
-
...
|
|
1660
|
-
pod_id: this.resolvePodId(
|
|
1663
|
+
...requestBody,
|
|
1664
|
+
pod_id: this.resolvePodId(requestBody.pod_id),
|
|
1665
|
+
assistant_name: requestBody.assistant_name ?? assistant_id,
|
|
1661
1666
|
},
|
|
1662
1667
|
});
|
|
1663
1668
|
}
|
|
1664
|
-
createForAssistant(
|
|
1669
|
+
createForAssistant(assistantName, payload = {}) {
|
|
1665
1670
|
return this.create({
|
|
1666
1671
|
...payload,
|
|
1667
|
-
|
|
1672
|
+
assistant_name: assistantName,
|
|
1668
1673
|
});
|
|
1669
1674
|
}
|
|
1670
1675
|
get(conversationId, options = {}) {
|
|
@@ -1950,6 +1955,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
1950
1955
|
exports.FilesNamespace = void 0;
|
|
1951
1956
|
const SearchMethod_js_1 = require("./openapi_client/models/SearchMethod.js");
|
|
1952
1957
|
const FilesService_js_1 = require("./openapi_client/services/FilesService.js");
|
|
1958
|
+
function joinDatastorePath(basePath, leaf) {
|
|
1959
|
+
const normalizedLeaf = leaf.replace(/^\/+/, "");
|
|
1960
|
+
const trimmedBase = (basePath ?? "/").trim();
|
|
1961
|
+
const normalizedBase = trimmedBase.length > 0 ? trimmedBase : "/";
|
|
1962
|
+
if (normalizedBase === "/") {
|
|
1963
|
+
return `/${normalizedLeaf}`;
|
|
1964
|
+
}
|
|
1965
|
+
return `${normalizedBase.replace(/\/+$/, "")}/${normalizedLeaf}`;
|
|
1966
|
+
}
|
|
1967
|
+
function getDirectoryPath(path) {
|
|
1968
|
+
const normalized = path.trim();
|
|
1969
|
+
if (!normalized || normalized === "/") {
|
|
1970
|
+
return "/";
|
|
1971
|
+
}
|
|
1972
|
+
const withoutTrailing = normalized.replace(/\/+$/, "");
|
|
1973
|
+
const index = withoutTrailing.lastIndexOf("/");
|
|
1974
|
+
if (index <= 0) {
|
|
1975
|
+
return "/";
|
|
1976
|
+
}
|
|
1977
|
+
return withoutTrailing.slice(0, index);
|
|
1978
|
+
}
|
|
1979
|
+
function getBaseName(path) {
|
|
1980
|
+
const normalized = path.trim().replace(/\/+$/, "");
|
|
1981
|
+
const index = normalized.lastIndexOf("/");
|
|
1982
|
+
if (index === -1) {
|
|
1983
|
+
return normalized;
|
|
1984
|
+
}
|
|
1985
|
+
return normalized.slice(index + 1);
|
|
1986
|
+
}
|
|
1953
1987
|
class FilesNamespace {
|
|
1954
1988
|
constructor(client, http, podId) {
|
|
1955
1989
|
this.client = client;
|
|
@@ -1958,22 +1992,22 @@ class FilesNamespace {
|
|
|
1958
1992
|
this.folder = {
|
|
1959
1993
|
create: (name, options = {}) => {
|
|
1960
1994
|
const payload = {
|
|
1961
|
-
name,
|
|
1995
|
+
path: joinDatastorePath(options.directoryPath ?? options.parentId, name),
|
|
1962
1996
|
description: options.description,
|
|
1963
|
-
parent_id: options.parentId,
|
|
1964
1997
|
};
|
|
1965
1998
|
return this.client.request(() => FilesService_js_1.FilesService.fileFolderCreate(this.podId(), payload));
|
|
1966
1999
|
},
|
|
1967
2000
|
};
|
|
1968
2001
|
}
|
|
1969
2002
|
list(options = {}) {
|
|
1970
|
-
|
|
2003
|
+
const directoryPath = options.directoryPath ?? options.parentId ?? "/";
|
|
2004
|
+
return this.client.request(() => FilesService_js_1.FilesService.fileList(this.podId(), directoryPath, options.limit ?? 100, options.pageToken));
|
|
1971
2005
|
}
|
|
1972
|
-
get(
|
|
1973
|
-
return this.client.request(() => FilesService_js_1.FilesService.fileGet(this.podId(),
|
|
2006
|
+
get(path) {
|
|
2007
|
+
return this.client.request(() => FilesService_js_1.FilesService.fileGet(this.podId(), path));
|
|
1974
2008
|
}
|
|
1975
|
-
delete(
|
|
1976
|
-
return this.client.request(() => FilesService_js_1.FilesService.fileDelete(this.podId(),
|
|
2009
|
+
delete(path) {
|
|
2010
|
+
return this.client.request(() => FilesService_js_1.FilesService.fileDelete(this.podId(), path));
|
|
1977
2011
|
}
|
|
1978
2012
|
search(query, options = {}) {
|
|
1979
2013
|
return this.client.request(() => FilesService_js_1.FilesService.fileSearch(this.podId(), {
|
|
@@ -1982,28 +2016,37 @@ class FilesNamespace {
|
|
|
1982
2016
|
search_method: options.searchMethod ?? SearchMethod_js_1.SearchMethod.HYBRID,
|
|
1983
2017
|
}));
|
|
1984
2018
|
}
|
|
1985
|
-
download(
|
|
1986
|
-
|
|
2019
|
+
download(path) {
|
|
2020
|
+
const encodedPath = encodeURIComponent(path);
|
|
2021
|
+
return this.http.requestBytes("GET", `/pods/${this.podId()}/datastore/files/download?path=${encodedPath}`);
|
|
1987
2022
|
}
|
|
1988
2023
|
upload(file, options = {}) {
|
|
1989
2024
|
const payload = {
|
|
1990
2025
|
data: file,
|
|
1991
2026
|
name: options.name ?? (file instanceof File ? file.name : undefined),
|
|
1992
2027
|
description: options.description,
|
|
1993
|
-
|
|
2028
|
+
directory_path: options.directoryPath ?? options.parentId ?? "/",
|
|
1994
2029
|
search_enabled: options.searchEnabled ?? true,
|
|
1995
2030
|
};
|
|
1996
2031
|
return this.client.request(() => FilesService_js_1.FilesService.fileUpload(this.podId(), payload));
|
|
1997
2032
|
}
|
|
1998
|
-
update(
|
|
2033
|
+
update(path, options = {}) {
|
|
2034
|
+
const targetDirectory = options.directoryPath ?? options.parentId;
|
|
2035
|
+
const resolvedNewPath = options.newPath
|
|
2036
|
+
?? (options.name
|
|
2037
|
+
? joinDatastorePath(targetDirectory ?? getDirectoryPath(path), options.name)
|
|
2038
|
+
: undefined)
|
|
2039
|
+
?? (targetDirectory
|
|
2040
|
+
? joinDatastorePath(targetDirectory, getBaseName(path))
|
|
2041
|
+
: undefined);
|
|
1999
2042
|
const payload = {
|
|
2043
|
+
path,
|
|
2000
2044
|
data: options.file,
|
|
2001
|
-
name: options.name,
|
|
2002
2045
|
description: options.description,
|
|
2003
|
-
|
|
2046
|
+
new_path: resolvedNewPath,
|
|
2004
2047
|
search_enabled: options.searchEnabled,
|
|
2005
2048
|
};
|
|
2006
|
-
return this.client.request(() => FilesService_js_1.FilesService.fileUpdate(this.podId(),
|
|
2049
|
+
return this.client.request(() => FilesService_js_1.FilesService.fileUpdate(this.podId(), payload));
|
|
2007
2050
|
}
|
|
2008
2051
|
}
|
|
2009
2052
|
exports.FilesNamespace = FilesNamespace;
|
|
@@ -2035,13 +2078,13 @@ class FilesService {
|
|
|
2035
2078
|
/**
|
|
2036
2079
|
* List Files
|
|
2037
2080
|
* @param podId
|
|
2038
|
-
* @param
|
|
2081
|
+
* @param directoryPath
|
|
2039
2082
|
* @param limit
|
|
2040
2083
|
* @param pageToken
|
|
2041
2084
|
* @returns FileListResponse Successful Response
|
|
2042
2085
|
* @throws ApiError
|
|
2043
2086
|
*/
|
|
2044
|
-
static fileList(podId,
|
|
2087
|
+
static fileList(podId, directoryPath = '/', limit = 100, pageToken) {
|
|
2045
2088
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2046
2089
|
method: 'GET',
|
|
2047
2090
|
url: '/pods/{pod_id}/datastore/files',
|
|
@@ -2049,7 +2092,7 @@ class FilesService {
|
|
|
2049
2092
|
'pod_id': podId,
|
|
2050
2093
|
},
|
|
2051
2094
|
query: {
|
|
2052
|
-
'
|
|
2095
|
+
'directory_path': directoryPath,
|
|
2053
2096
|
'limit': limit,
|
|
2054
2097
|
'page_token': pageToken,
|
|
2055
2098
|
},
|
|
@@ -2080,81 +2123,86 @@ class FilesService {
|
|
|
2080
2123
|
});
|
|
2081
2124
|
}
|
|
2082
2125
|
/**
|
|
2083
|
-
*
|
|
2126
|
+
* Delete File
|
|
2084
2127
|
* @param podId
|
|
2085
|
-
* @param
|
|
2086
|
-
* @returns
|
|
2128
|
+
* @param path
|
|
2129
|
+
* @returns DatastoreMessageResponse Successful Response
|
|
2087
2130
|
* @throws ApiError
|
|
2088
2131
|
*/
|
|
2089
|
-
static
|
|
2132
|
+
static fileDelete(podId, path) {
|
|
2090
2133
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2091
|
-
method: '
|
|
2092
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
2134
|
+
method: 'DELETE',
|
|
2135
|
+
url: '/pods/{pod_id}/datastore/files/by-path',
|
|
2093
2136
|
path: {
|
|
2094
2137
|
'pod_id': podId,
|
|
2095
2138
|
},
|
|
2096
|
-
|
|
2097
|
-
|
|
2139
|
+
query: {
|
|
2140
|
+
'path': path,
|
|
2141
|
+
},
|
|
2098
2142
|
errors: {
|
|
2099
2143
|
422: `Validation Error`,
|
|
2100
2144
|
},
|
|
2101
2145
|
});
|
|
2102
2146
|
}
|
|
2103
2147
|
/**
|
|
2104
|
-
*
|
|
2148
|
+
* Get File
|
|
2105
2149
|
* @param podId
|
|
2106
|
-
* @param
|
|
2107
|
-
* @returns
|
|
2150
|
+
* @param path
|
|
2151
|
+
* @returns FileResponse Successful Response
|
|
2108
2152
|
* @throws ApiError
|
|
2109
2153
|
*/
|
|
2110
|
-
static
|
|
2154
|
+
static fileGet(podId, path) {
|
|
2111
2155
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2112
|
-
method: '
|
|
2113
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
2156
|
+
method: 'GET',
|
|
2157
|
+
url: '/pods/{pod_id}/datastore/files/by-path',
|
|
2114
2158
|
path: {
|
|
2115
2159
|
'pod_id': podId,
|
|
2116
2160
|
},
|
|
2117
|
-
|
|
2118
|
-
|
|
2161
|
+
query: {
|
|
2162
|
+
'path': path,
|
|
2163
|
+
},
|
|
2119
2164
|
errors: {
|
|
2120
2165
|
422: `Validation Error`,
|
|
2121
2166
|
},
|
|
2122
2167
|
});
|
|
2123
2168
|
}
|
|
2124
2169
|
/**
|
|
2125
|
-
*
|
|
2170
|
+
* Update File
|
|
2126
2171
|
* @param podId
|
|
2127
|
-
* @param
|
|
2128
|
-
* @returns
|
|
2172
|
+
* @param formData
|
|
2173
|
+
* @returns FileResponse Successful Response
|
|
2129
2174
|
* @throws ApiError
|
|
2130
2175
|
*/
|
|
2131
|
-
static
|
|
2176
|
+
static fileUpdate(podId, formData) {
|
|
2132
2177
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2133
|
-
method: '
|
|
2134
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
2178
|
+
method: 'PATCH',
|
|
2179
|
+
url: '/pods/{pod_id}/datastore/files/by-path',
|
|
2135
2180
|
path: {
|
|
2136
2181
|
'pod_id': podId,
|
|
2137
|
-
'file_id': fileId,
|
|
2138
2182
|
},
|
|
2183
|
+
formData: formData,
|
|
2184
|
+
mediaType: 'multipart/form-data',
|
|
2139
2185
|
errors: {
|
|
2140
2186
|
422: `Validation Error`,
|
|
2141
2187
|
},
|
|
2142
2188
|
});
|
|
2143
2189
|
}
|
|
2144
2190
|
/**
|
|
2145
|
-
*
|
|
2191
|
+
* Download File
|
|
2146
2192
|
* @param podId
|
|
2147
|
-
* @param
|
|
2148
|
-
* @returns
|
|
2193
|
+
* @param path
|
|
2194
|
+
* @returns any Successful Response
|
|
2149
2195
|
* @throws ApiError
|
|
2150
2196
|
*/
|
|
2151
|
-
static
|
|
2197
|
+
static fileDownload(podId, path) {
|
|
2152
2198
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2153
2199
|
method: 'GET',
|
|
2154
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
2200
|
+
url: '/pods/{pod_id}/datastore/files/download',
|
|
2155
2201
|
path: {
|
|
2156
2202
|
'pod_id': podId,
|
|
2157
|
-
|
|
2203
|
+
},
|
|
2204
|
+
query: {
|
|
2205
|
+
'path': path,
|
|
2158
2206
|
},
|
|
2159
2207
|
errors: {
|
|
2160
2208
|
422: `Validation Error`,
|
|
@@ -2162,42 +2210,65 @@ class FilesService {
|
|
|
2162
2210
|
});
|
|
2163
2211
|
}
|
|
2164
2212
|
/**
|
|
2165
|
-
*
|
|
2213
|
+
* Create Folder
|
|
2166
2214
|
* @param podId
|
|
2167
|
-
* @param
|
|
2168
|
-
* @param formData
|
|
2215
|
+
* @param requestBody
|
|
2169
2216
|
* @returns FileResponse Successful Response
|
|
2170
2217
|
* @throws ApiError
|
|
2171
2218
|
*/
|
|
2172
|
-
static
|
|
2219
|
+
static fileFolderCreate(podId, requestBody) {
|
|
2173
2220
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2174
|
-
method: '
|
|
2175
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
2221
|
+
method: 'POST',
|
|
2222
|
+
url: '/pods/{pod_id}/datastore/files/folders',
|
|
2176
2223
|
path: {
|
|
2177
2224
|
'pod_id': podId,
|
|
2178
|
-
'file_id': fileId,
|
|
2179
2225
|
},
|
|
2180
|
-
|
|
2181
|
-
mediaType: '
|
|
2226
|
+
body: requestBody,
|
|
2227
|
+
mediaType: 'application/json',
|
|
2182
2228
|
errors: {
|
|
2183
2229
|
422: `Validation Error`,
|
|
2184
2230
|
},
|
|
2185
2231
|
});
|
|
2186
2232
|
}
|
|
2187
2233
|
/**
|
|
2188
|
-
*
|
|
2234
|
+
* Search Files
|
|
2189
2235
|
* @param podId
|
|
2190
|
-
* @param
|
|
2191
|
-
* @returns
|
|
2236
|
+
* @param requestBody
|
|
2237
|
+
* @returns FileSearchResponse Successful Response
|
|
2238
|
+
* @throws ApiError
|
|
2239
|
+
*/
|
|
2240
|
+
static fileSearch(podId, requestBody) {
|
|
2241
|
+
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2242
|
+
method: 'POST',
|
|
2243
|
+
url: '/pods/{pod_id}/datastore/files/search',
|
|
2244
|
+
path: {
|
|
2245
|
+
'pod_id': podId,
|
|
2246
|
+
},
|
|
2247
|
+
body: requestBody,
|
|
2248
|
+
mediaType: 'application/json',
|
|
2249
|
+
errors: {
|
|
2250
|
+
422: `Validation Error`,
|
|
2251
|
+
},
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Get Directory Tree
|
|
2256
|
+
* @param podId
|
|
2257
|
+
* @param rootPath
|
|
2258
|
+
* @param filesPerDirectory
|
|
2259
|
+
* @returns DirectoryTreeResponse Successful Response
|
|
2192
2260
|
* @throws ApiError
|
|
2193
2261
|
*/
|
|
2194
|
-
static
|
|
2262
|
+
static fileTree(podId, rootPath = '/', filesPerDirectory = 3) {
|
|
2195
2263
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
2196
2264
|
method: 'GET',
|
|
2197
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
2265
|
+
url: '/pods/{pod_id}/datastore/files/tree',
|
|
2198
2266
|
path: {
|
|
2199
2267
|
'pod_id': podId,
|
|
2200
|
-
|
|
2268
|
+
},
|
|
2269
|
+
query: {
|
|
2270
|
+
'root_path': rootPath,
|
|
2271
|
+
'files_per_directory': filesPerDirectory,
|
|
2201
2272
|
},
|
|
2202
2273
|
errors: {
|
|
2203
2274
|
422: `Validation Error`,
|
|
@@ -3681,6 +3752,18 @@ const RecordsService_js_1 = require("./openapi_client/services/RecordsService.js
|
|
|
3681
3752
|
function getRecordsPath(podId, table) {
|
|
3682
3753
|
return `/pods/${encodeURIComponent(podId)}/datastore/tables/${encodeURIComponent(table)}/records`;
|
|
3683
3754
|
}
|
|
3755
|
+
function serializeFilters(filters) {
|
|
3756
|
+
if (!filters || filters.length === 0) {
|
|
3757
|
+
return undefined;
|
|
3758
|
+
}
|
|
3759
|
+
return filters.map((filter) => JSON.stringify(filter));
|
|
3760
|
+
}
|
|
3761
|
+
function serializeSort(sort) {
|
|
3762
|
+
if (!sort || sort.length === 0) {
|
|
3763
|
+
return undefined;
|
|
3764
|
+
}
|
|
3765
|
+
return sort.map((entry) => JSON.stringify(entry));
|
|
3766
|
+
}
|
|
3684
3767
|
class RecordsNamespace {
|
|
3685
3768
|
constructor(client, http, podId) {
|
|
3686
3769
|
this.client = client;
|
|
@@ -3704,13 +3787,7 @@ class RecordsNamespace {
|
|
|
3704
3787
|
list(table, options = {}) {
|
|
3705
3788
|
const { filters, sort, limit, pageToken, offset, sortBy, order, params } = options;
|
|
3706
3789
|
if (filters || sort) {
|
|
3707
|
-
|
|
3708
|
-
filters,
|
|
3709
|
-
sort,
|
|
3710
|
-
limit,
|
|
3711
|
-
page_token: pageToken,
|
|
3712
|
-
};
|
|
3713
|
-
return this.client.request(() => RecordsService_js_1.RecordsService.recordQuery(this.podId(), table, payload));
|
|
3790
|
+
return this.client.request(() => RecordsService_js_1.RecordsService.recordList(this.podId(), table, limit ?? 20, offset, sortBy ?? undefined, order ?? "asc", serializeFilters(filters), serializeSort(sort), pageToken));
|
|
3714
3791
|
}
|
|
3715
3792
|
const hasCustomParams = typeof offset === "number" ||
|
|
3716
3793
|
typeof sortBy === "string" ||
|
|
@@ -3728,7 +3805,7 @@ class RecordsNamespace {
|
|
|
3728
3805
|
},
|
|
3729
3806
|
});
|
|
3730
3807
|
}
|
|
3731
|
-
return this.client.request(() => RecordsService_js_1.RecordsService.recordList(this.podId(), table, limit ?? 20, pageToken));
|
|
3808
|
+
return this.client.request(() => RecordsService_js_1.RecordsService.recordList(this.podId(), table, limit ?? 20, offset, sortBy ?? undefined, order ?? "asc", undefined, undefined, pageToken));
|
|
3732
3809
|
}
|
|
3733
3810
|
listWithParams(table, params) {
|
|
3734
3811
|
return this.http.request("GET", getRecordsPath(this.podId(), table), {
|
|
@@ -3748,7 +3825,7 @@ class RecordsNamespace {
|
|
|
3748
3825
|
return this.client.request(() => RecordsService_js_1.RecordsService.recordDelete(this.podId(), table, recordId));
|
|
3749
3826
|
}
|
|
3750
3827
|
query(table, payload) {
|
|
3751
|
-
return this.client.request(() => RecordsService_js_1.RecordsService.
|
|
3828
|
+
return this.client.request(() => RecordsService_js_1.RecordsService.recordList(this.podId(), table, payload.limit ?? 20, payload.offset, payload.sort_by ?? undefined, payload.order ?? "asc", serializeFilters(payload.filters), serializeSort(payload.sort), payload.page_token));
|
|
3752
3829
|
}
|
|
3753
3830
|
}
|
|
3754
3831
|
exports.RecordsNamespace = RecordsNamespace;
|
|
@@ -3763,15 +3840,20 @@ const request_js_1 = require("./openapi_client/core/request.js");
|
|
|
3763
3840
|
class RecordsService {
|
|
3764
3841
|
/**
|
|
3765
3842
|
* List Records
|
|
3766
|
-
* List table records with token pagination only. Use
|
|
3843
|
+
* List table records with token pagination only. Use the datastore query endpoint for joins, aggregates, or custom read-only SQL.
|
|
3767
3844
|
* @param podId
|
|
3768
3845
|
* @param tableName
|
|
3769
3846
|
* @param limit Max number of rows to return.
|
|
3847
|
+
* @param offset Row offset for direct pagination.
|
|
3848
|
+
* @param sortBy Optional column name to sort by.
|
|
3849
|
+
* @param order Sort direction for `sort_by`: `asc` or `desc`.
|
|
3850
|
+
* @param filter Optional repeated JSON filters for advanced comparisons. Example: `filter={"field":"amount","op":"gt","value":100}`
|
|
3851
|
+
* @param sort Optional repeated JSON sort clauses. Example: `sort={"field":"created_at","direction":"desc"}`
|
|
3770
3852
|
* @param pageToken Opaque token from a previous response page.
|
|
3771
3853
|
* @returns RecordListResponse Successful Response
|
|
3772
3854
|
* @throws ApiError
|
|
3773
3855
|
*/
|
|
3774
|
-
static recordList(podId, tableName, limit = 20, pageToken) {
|
|
3856
|
+
static recordList(podId, tableName, limit = 20, offset, sortBy, order = 'asc', filter, sort, pageToken) {
|
|
3775
3857
|
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
3776
3858
|
method: 'GET',
|
|
3777
3859
|
url: '/pods/{pod_id}/datastore/tables/{table_name}/records',
|
|
@@ -3781,6 +3863,11 @@ class RecordsService {
|
|
|
3781
3863
|
},
|
|
3782
3864
|
query: {
|
|
3783
3865
|
'limit': limit,
|
|
3866
|
+
'offset': offset,
|
|
3867
|
+
'sort_by': sortBy,
|
|
3868
|
+
'order': order,
|
|
3869
|
+
'filter': filter,
|
|
3870
|
+
'sort': sort,
|
|
3784
3871
|
'page_token': pageToken,
|
|
3785
3872
|
},
|
|
3786
3873
|
errors: {
|
|
@@ -3884,30 +3971,6 @@ class RecordsService {
|
|
|
3884
3971
|
},
|
|
3885
3972
|
});
|
|
3886
3973
|
}
|
|
3887
|
-
/**
|
|
3888
|
-
* Query Records
|
|
3889
|
-
* Query one table with structured filters and sorting. Use this instead of dynamic query parameters when you need filtering. Example filters: `[{"field": "status", "op": "eq", "value": "OPEN"}]`.
|
|
3890
|
-
* @param podId
|
|
3891
|
-
* @param tableName
|
|
3892
|
-
* @param requestBody
|
|
3893
|
-
* @returns RecordListResponse Successful Response
|
|
3894
|
-
* @throws ApiError
|
|
3895
|
-
*/
|
|
3896
|
-
static recordQuery(podId, tableName, requestBody) {
|
|
3897
|
-
return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
|
|
3898
|
-
method: 'POST',
|
|
3899
|
-
url: '/pods/{pod_id}/datastore/tables/{table_name}/records/query',
|
|
3900
|
-
path: {
|
|
3901
|
-
'pod_id': podId,
|
|
3902
|
-
'table_name': tableName,
|
|
3903
|
-
},
|
|
3904
|
-
body: requestBody,
|
|
3905
|
-
mediaType: 'application/json',
|
|
3906
|
-
errors: {
|
|
3907
|
-
422: `Validation Error`,
|
|
3908
|
-
},
|
|
3909
|
-
});
|
|
3910
|
-
}
|
|
3911
3974
|
/**
|
|
3912
3975
|
* Delete Record
|
|
3913
3976
|
* Delete a record by primary key.
|
|
@@ -30,21 +30,39 @@ export declare class ConversationsNamespace {
|
|
|
30
30
|
private resolvePodId;
|
|
31
31
|
private requirePodId;
|
|
32
32
|
list(options?: {
|
|
33
|
+
assistant_name?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use assistant_name instead.
|
|
36
|
+
*/
|
|
33
37
|
assistant_id?: string;
|
|
34
38
|
pod_id?: string;
|
|
35
39
|
organization_id?: string;
|
|
40
|
+
global_only?: boolean;
|
|
36
41
|
limit?: number;
|
|
37
42
|
page_token?: string;
|
|
38
43
|
}): Promise<ConversationListResponse>;
|
|
39
|
-
listByAssistant(
|
|
44
|
+
listByAssistant(assistantName: string, options?: {
|
|
40
45
|
pod_id?: string;
|
|
41
46
|
organization_id?: string;
|
|
47
|
+
global_only?: boolean;
|
|
48
|
+
limit?: number;
|
|
49
|
+
page_token?: string;
|
|
50
|
+
}): Promise<ConversationListResponse>;
|
|
51
|
+
listByAssistantName(assistantName: string, options?: {
|
|
52
|
+
pod_id?: string;
|
|
53
|
+
organization_id?: string;
|
|
54
|
+
global_only?: boolean;
|
|
42
55
|
limit?: number;
|
|
43
56
|
page_token?: string;
|
|
44
57
|
}): Promise<ConversationListResponse>;
|
|
45
58
|
listModels(): Promise<AvailableModelsListResponse>;
|
|
46
|
-
create(payload: CreateConversationRequest
|
|
47
|
-
|
|
59
|
+
create(payload: CreateConversationRequest & {
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use assistant_name instead.
|
|
62
|
+
*/
|
|
63
|
+
assistant_id?: string | null;
|
|
64
|
+
}): Promise<ConversationResponse>;
|
|
65
|
+
createForAssistant(assistantName: string, payload?: Omit<CreateConversationRequest, "assistant_name">): Promise<ConversationResponse>;
|
|
48
66
|
get(conversationId: string, options?: {
|
|
49
67
|
pod_id?: string;
|
|
50
68
|
}): Promise<ConversationResponse>;
|
|
@@ -56,32 +56,38 @@ export class ConversationsNamespace {
|
|
|
56
56
|
list(options = {}) {
|
|
57
57
|
return this.http.request("GET", "/conversations", {
|
|
58
58
|
params: {
|
|
59
|
-
|
|
59
|
+
assistant_name: options.assistant_name ?? options.assistant_id,
|
|
60
60
|
pod_id: this.resolvePodId(options.pod_id),
|
|
61
61
|
organization_id: options.organization_id,
|
|
62
|
+
global_only: options.global_only ?? false,
|
|
62
63
|
limit: options.limit ?? 20,
|
|
63
64
|
page_token: options.page_token,
|
|
64
65
|
},
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
|
-
listByAssistant(
|
|
68
|
-
return this.list({ ...options,
|
|
68
|
+
listByAssistant(assistantName, options = {}) {
|
|
69
|
+
return this.list({ ...options, assistant_name: assistantName });
|
|
70
|
+
}
|
|
71
|
+
listByAssistantName(assistantName, options = {}) {
|
|
72
|
+
return this.listByAssistant(assistantName, options);
|
|
69
73
|
}
|
|
70
74
|
listModels() {
|
|
71
75
|
return this.http.request("GET", "/models");
|
|
72
76
|
}
|
|
73
77
|
create(payload) {
|
|
78
|
+
const { assistant_id, ...requestBody } = payload;
|
|
74
79
|
return this.http.request("POST", "/conversations", {
|
|
75
80
|
body: {
|
|
76
|
-
...
|
|
77
|
-
pod_id: this.resolvePodId(
|
|
81
|
+
...requestBody,
|
|
82
|
+
pod_id: this.resolvePodId(requestBody.pod_id),
|
|
83
|
+
assistant_name: requestBody.assistant_name ?? assistant_id,
|
|
78
84
|
},
|
|
79
85
|
});
|
|
80
86
|
}
|
|
81
|
-
createForAssistant(
|
|
87
|
+
createForAssistant(assistantName, payload = {}) {
|
|
82
88
|
return this.create({
|
|
83
89
|
...payload,
|
|
84
|
-
|
|
90
|
+
assistant_name: assistantName,
|
|
85
91
|
});
|
|
86
92
|
}
|
|
87
93
|
get(conversationId, options = {}) {
|
|
@@ -9,30 +9,35 @@ export declare class FilesNamespace {
|
|
|
9
9
|
list(options?: {
|
|
10
10
|
limit?: number;
|
|
11
11
|
pageToken?: string;
|
|
12
|
+
directoryPath?: string;
|
|
12
13
|
parentId?: string;
|
|
13
14
|
}): Promise<import("../types.js").FileListResponse>;
|
|
14
|
-
get(
|
|
15
|
-
delete(
|
|
15
|
+
get(path: string): Promise<import("../types.js").FileResponse>;
|
|
16
|
+
delete(path: string): Promise<import("../types.js").DatastoreMessageResponse>;
|
|
16
17
|
search(query: string, options?: {
|
|
17
18
|
limit?: number;
|
|
18
19
|
searchMethod?: SearchMethod;
|
|
19
20
|
}): Promise<import("../types.js").FileSearchResponse>;
|
|
20
|
-
download(
|
|
21
|
+
download(path: string): Promise<Blob>;
|
|
21
22
|
upload(file: Blob, options?: {
|
|
22
23
|
name?: string;
|
|
24
|
+
directoryPath?: string;
|
|
23
25
|
parentId?: string;
|
|
24
26
|
searchEnabled?: boolean;
|
|
25
27
|
description?: string;
|
|
26
28
|
}): Promise<import("../types.js").FileResponse>;
|
|
27
|
-
update(
|
|
29
|
+
update(path: string, options?: {
|
|
28
30
|
file?: Blob;
|
|
29
31
|
name?: string;
|
|
30
32
|
description?: string;
|
|
33
|
+
directoryPath?: string;
|
|
31
34
|
parentId?: string;
|
|
35
|
+
newPath?: string;
|
|
32
36
|
searchEnabled?: boolean;
|
|
33
37
|
}): Promise<import("../types.js").FileResponse>;
|
|
34
38
|
readonly folder: {
|
|
35
39
|
create: (name: string, options?: {
|
|
40
|
+
directoryPath?: string;
|
|
36
41
|
parentId?: string;
|
|
37
42
|
description?: string;
|
|
38
43
|
}) => Promise<import("../types.js").FileResponse>;
|