lemma-sdk 0.2.22 → 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.
Files changed (55) hide show
  1. package/README.md +3 -3
  2. package/dist/auth.d.ts +1 -0
  3. package/dist/auth.js +12 -12
  4. package/dist/browser/lemma-client.js +179 -115
  5. package/dist/namespaces/assistants.d.ts +21 -3
  6. package/dist/namespaces/assistants.js +13 -7
  7. package/dist/namespaces/files.d.ts +9 -4
  8. package/dist/namespaces/files.js +52 -14
  9. package/dist/namespaces/records.d.ts +10 -2
  10. package/dist/namespaces/records.js +15 -9
  11. package/dist/openapi_client/index.d.ts +6 -5
  12. package/dist/openapi_client/index.js +2 -2
  13. package/dist/openapi_client/models/CreateConversationRequest.d.ts +1 -1
  14. package/dist/openapi_client/models/CreateFolderRequest.d.ts +1 -2
  15. package/dist/openapi_client/models/CreateTriggerRequest.d.ts +0 -1
  16. package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +1 -1
  17. package/dist/openapi_client/models/DatastoreQueryRequest.d.ts +9 -0
  18. package/dist/openapi_client/models/DatastoreQueryResponse.d.ts +7 -0
  19. package/dist/openapi_client/models/DirectoryTreeNode.d.ts +7 -0
  20. package/dist/openapi_client/models/DirectoryTreeResponse.d.ts +6 -0
  21. package/dist/openapi_client/models/DirectoryTreeResponse.js +1 -0
  22. package/dist/openapi_client/models/FileResponse.d.ts +4 -6
  23. package/dist/openapi_client/models/FileSearchRequest.d.ts +5 -3
  24. package/dist/openapi_client/models/FileSearchResultSchema.d.ts +1 -0
  25. package/dist/openapi_client/models/FileSearchScopeMode.d.ts +4 -0
  26. package/dist/openapi_client/models/FileSearchScopeMode.js +9 -0
  27. package/dist/openapi_client/models/TableResponse.d.ts +1 -1
  28. package/dist/openapi_client/models/TriggerResponse.d.ts +0 -1
  29. package/dist/openapi_client/models/update.d.ts +2 -2
  30. package/dist/openapi_client/services/ConversationsService.d.ts +3 -2
  31. package/dist/openapi_client/services/ConversationsService.js +5 -3
  32. package/dist/openapi_client/services/FilesService.d.ts +34 -25
  33. package/dist/openapi_client/services/FilesService.js +75 -47
  34. package/dist/openapi_client/services/QueryService.d.ts +14 -0
  35. package/dist/openapi_client/services/QueryService.js +26 -0
  36. package/dist/openapi_client/services/RecordsService.d.ts +7 -13
  37. package/dist/openapi_client/services/RecordsService.js +12 -26
  38. package/dist/react/components/AssistantEmbedded.d.ts +1 -1
  39. package/dist/react/components/AssistantEmbedded.js +2 -1
  40. package/dist/react/useAssistantController.d.ts +5 -1
  41. package/dist/react/useAssistantController.js +7 -3
  42. package/dist/react/useAssistantSession.d.ts +12 -0
  43. package/dist/react/useAssistantSession.js +24 -5
  44. package/dist/types.d.ts +10 -4
  45. package/package.json +1 -1
  46. package/dist/openapi_client/models/RecordFilter.d.ts +0 -15
  47. package/dist/openapi_client/models/RecordFilterOperator.d.ts +0 -10
  48. package/dist/openapi_client/models/RecordFilterOperator.js +0 -15
  49. package/dist/openapi_client/models/RecordQueryRequest.d.ts +0 -20
  50. package/dist/openapi_client/models/RecordSort.d.ts +0 -11
  51. package/dist/openapi_client/models/RecordSortDirection.d.ts +0 -4
  52. package/dist/openapi_client/models/RecordSortDirection.js +0 -9
  53. /package/dist/openapi_client/models/{RecordFilter.js → DatastoreQueryRequest.js} +0 -0
  54. /package/dist/openapi_client/models/{RecordQueryRequest.js → DatastoreQueryResponse.js} +0 -0
  55. /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
- assistantId="uuid"
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
- assistantId: "uuid",
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
- assistantId: "uuid",
368
+ assistantName: "support_assistant",
369
369
  });
370
370
 
371
371
  const rows = buildDisplayMessageRows(assistant.messages);
package/dist/auth.d.ts CHANGED
@@ -109,6 +109,7 @@ export declare class AuthManager {
109
109
  * This helps recover when signout/session-expiry paths leave local markers behind.
110
110
  */
111
111
  private clearFrontendSessionMarkers;
112
+ private applyUnauthenticatedState;
112
113
  private clearInjectedToken;
113
114
  private rawSignOutViaBackend;
114
115
  /**
package/dist/auth.js CHANGED
@@ -278,6 +278,11 @@ export class AuthManager {
278
278
  }
279
279
  }
280
280
  }
281
+ applyUnauthenticatedState() {
282
+ const next = { status: "unauthenticated", user: null };
283
+ this.setState(next);
284
+ return next;
285
+ }
281
286
  clearInjectedToken() {
282
287
  this.injectedToken = null;
283
288
  clearTestingToken();
@@ -386,16 +391,11 @@ export class AuthManager {
386
391
  const response = await fetch(`${this.apiUrl}/users/me`, this.getRequestInit({ method: "GET" }));
387
392
  // Only 401 means not authenticated — 403 means authenticated but forbidden
388
393
  if (response.status === 401) {
389
- this.clearFrontendSessionMarkers();
390
- const next = { status: "unauthenticated", user: null };
391
- this.setState(next);
392
- return next;
394
+ return this.applyUnauthenticatedState();
393
395
  }
394
396
  if (!response.ok) {
395
397
  // For non-401 errors on /users/me, treat as unauthenticated (conservative)
396
- const next = { status: "unauthenticated", user: null };
397
- this.setState(next);
398
- return next;
398
+ return this.applyUnauthenticatedState();
399
399
  }
400
400
  const user = (await response.json());
401
401
  const next = { status: "authenticated", user };
@@ -403,9 +403,7 @@ export class AuthManager {
403
403
  return next;
404
404
  }
405
405
  catch {
406
- const next = { status: "unauthenticated", user: null };
407
- this.setState(next);
408
- return next;
406
+ return this.applyUnauthenticatedState();
409
407
  }
410
408
  }
411
409
  /**
@@ -413,8 +411,7 @@ export class AuthManager {
413
411
  * Does NOT redirect — call redirectToAuth() explicitly if desired.
414
412
  */
415
413
  markUnauthenticated() {
416
- this.clearFrontendSessionMarkers();
417
- this.setState({ status: "unauthenticated", user: null });
414
+ this.applyUnauthenticatedState();
418
415
  }
419
416
  /**
420
417
  * Sign out the current user session.
@@ -442,6 +439,9 @@ export class AuthManager {
442
439
  // best effort fallback only
443
440
  }
444
441
  }
442
+ // Always clear frontend markers on logout attempt, even if backend session
443
+ // cleanup is partial. This avoids stale local "EXISTS" signals.
444
+ this.clearFrontendSessionMarkers();
445
445
  const isAuthenticated = await this.isAuthenticatedViaCookie();
446
446
  if (!isAuthenticated) {
447
447
  this.markUnauthenticated();
@@ -461,6 +461,11 @@ class AuthManager {
461
461
  }
462
462
  }
463
463
  }
464
+ applyUnauthenticatedState() {
465
+ const next = { status: "unauthenticated", user: null };
466
+ this.setState(next);
467
+ return next;
468
+ }
464
469
  clearInjectedToken() {
465
470
  this.injectedToken = null;
466
471
  clearTestingToken();
@@ -569,16 +574,11 @@ class AuthManager {
569
574
  const response = await fetch(`${this.apiUrl}/users/me`, this.getRequestInit({ method: "GET" }));
570
575
  // Only 401 means not authenticated — 403 means authenticated but forbidden
571
576
  if (response.status === 401) {
572
- this.clearFrontendSessionMarkers();
573
- const next = { status: "unauthenticated", user: null };
574
- this.setState(next);
575
- return next;
577
+ return this.applyUnauthenticatedState();
576
578
  }
577
579
  if (!response.ok) {
578
580
  // For non-401 errors on /users/me, treat as unauthenticated (conservative)
579
- const next = { status: "unauthenticated", user: null };
580
- this.setState(next);
581
- return next;
581
+ return this.applyUnauthenticatedState();
582
582
  }
583
583
  const user = (await response.json());
584
584
  const next = { status: "authenticated", user };
@@ -586,9 +586,7 @@ class AuthManager {
586
586
  return next;
587
587
  }
588
588
  catch {
589
- const next = { status: "unauthenticated", user: null };
590
- this.setState(next);
591
- return next;
589
+ return this.applyUnauthenticatedState();
592
590
  }
593
591
  }
594
592
  /**
@@ -596,8 +594,7 @@ class AuthManager {
596
594
  * Does NOT redirect — call redirectToAuth() explicitly if desired.
597
595
  */
598
596
  markUnauthenticated() {
599
- this.clearFrontendSessionMarkers();
600
- this.setState({ status: "unauthenticated", user: null });
597
+ this.applyUnauthenticatedState();
601
598
  }
602
599
  /**
603
600
  * Sign out the current user session.
@@ -625,6 +622,9 @@ class AuthManager {
625
622
  // best effort fallback only
626
623
  }
627
624
  }
625
+ // Always clear frontend markers on logout attempt, even if backend session
626
+ // cleanup is partial. This avoids stale local "EXISTS" signals.
627
+ this.clearFrontendSessionMarkers();
628
628
  const isAuthenticated = await this.isAuthenticatedViaCookie();
629
629
  if (!isAuthenticated) {
630
630
  this.markUnauthenticated();
@@ -1638,32 +1638,38 @@ class ConversationsNamespace {
1638
1638
  list(options = {}) {
1639
1639
  return this.http.request("GET", "/conversations", {
1640
1640
  params: {
1641
- assistant_id: options.assistant_id,
1641
+ assistant_name: options.assistant_name ?? options.assistant_id,
1642
1642
  pod_id: this.resolvePodId(options.pod_id),
1643
1643
  organization_id: options.organization_id,
1644
+ global_only: options.global_only ?? false,
1644
1645
  limit: options.limit ?? 20,
1645
1646
  page_token: options.page_token,
1646
1647
  },
1647
1648
  });
1648
1649
  }
1649
- listByAssistant(assistantId, options = {}) {
1650
- return this.list({ ...options, assistant_id: assistantId });
1650
+ listByAssistant(assistantName, options = {}) {
1651
+ return this.list({ ...options, assistant_name: assistantName });
1652
+ }
1653
+ listByAssistantName(assistantName, options = {}) {
1654
+ return this.listByAssistant(assistantName, options);
1651
1655
  }
1652
1656
  listModels() {
1653
1657
  return this.http.request("GET", "/models");
1654
1658
  }
1655
1659
  create(payload) {
1660
+ const { assistant_id, ...requestBody } = payload;
1656
1661
  return this.http.request("POST", "/conversations", {
1657
1662
  body: {
1658
- ...payload,
1659
- pod_id: this.resolvePodId(payload.pod_id),
1663
+ ...requestBody,
1664
+ pod_id: this.resolvePodId(requestBody.pod_id),
1665
+ assistant_name: requestBody.assistant_name ?? assistant_id,
1660
1666
  },
1661
1667
  });
1662
1668
  }
1663
- createForAssistant(assistantId, payload = {}) {
1669
+ createForAssistant(assistantName, payload = {}) {
1664
1670
  return this.create({
1665
1671
  ...payload,
1666
- assistant_id: assistantId,
1672
+ assistant_name: assistantName,
1667
1673
  });
1668
1674
  }
1669
1675
  get(conversationId, options = {}) {
@@ -1949,6 +1955,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
1949
1955
  exports.FilesNamespace = void 0;
1950
1956
  const SearchMethod_js_1 = require("./openapi_client/models/SearchMethod.js");
1951
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
+ }
1952
1987
  class FilesNamespace {
1953
1988
  constructor(client, http, podId) {
1954
1989
  this.client = client;
@@ -1957,22 +1992,22 @@ class FilesNamespace {
1957
1992
  this.folder = {
1958
1993
  create: (name, options = {}) => {
1959
1994
  const payload = {
1960
- name,
1995
+ path: joinDatastorePath(options.directoryPath ?? options.parentId, name),
1961
1996
  description: options.description,
1962
- parent_id: options.parentId,
1963
1997
  };
1964
1998
  return this.client.request(() => FilesService_js_1.FilesService.fileFolderCreate(this.podId(), payload));
1965
1999
  },
1966
2000
  };
1967
2001
  }
1968
2002
  list(options = {}) {
1969
- return this.client.request(() => FilesService_js_1.FilesService.fileList(this.podId(), options.parentId, options.limit ?? 100, options.pageToken));
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));
1970
2005
  }
1971
- get(fileId) {
1972
- return this.client.request(() => FilesService_js_1.FilesService.fileGet(this.podId(), fileId));
2006
+ get(path) {
2007
+ return this.client.request(() => FilesService_js_1.FilesService.fileGet(this.podId(), path));
1973
2008
  }
1974
- delete(fileId) {
1975
- return this.client.request(() => FilesService_js_1.FilesService.fileDelete(this.podId(), fileId));
2009
+ delete(path) {
2010
+ return this.client.request(() => FilesService_js_1.FilesService.fileDelete(this.podId(), path));
1976
2011
  }
1977
2012
  search(query, options = {}) {
1978
2013
  return this.client.request(() => FilesService_js_1.FilesService.fileSearch(this.podId(), {
@@ -1981,28 +2016,37 @@ class FilesNamespace {
1981
2016
  search_method: options.searchMethod ?? SearchMethod_js_1.SearchMethod.HYBRID,
1982
2017
  }));
1983
2018
  }
1984
- download(fileId) {
1985
- return this.http.requestBytes("GET", `/pods/${this.podId()}/datastore/files/${fileId}/download`);
2019
+ download(path) {
2020
+ const encodedPath = encodeURIComponent(path);
2021
+ return this.http.requestBytes("GET", `/pods/${this.podId()}/datastore/files/download?path=${encodedPath}`);
1986
2022
  }
1987
2023
  upload(file, options = {}) {
1988
2024
  const payload = {
1989
2025
  data: file,
1990
2026
  name: options.name ?? (file instanceof File ? file.name : undefined),
1991
2027
  description: options.description,
1992
- parent_id: options.parentId,
2028
+ directory_path: options.directoryPath ?? options.parentId ?? "/",
1993
2029
  search_enabled: options.searchEnabled ?? true,
1994
2030
  };
1995
2031
  return this.client.request(() => FilesService_js_1.FilesService.fileUpload(this.podId(), payload));
1996
2032
  }
1997
- update(fileId, options = {}) {
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);
1998
2042
  const payload = {
2043
+ path,
1999
2044
  data: options.file,
2000
- name: options.name,
2001
2045
  description: options.description,
2002
- parent_id: options.parentId,
2046
+ new_path: resolvedNewPath,
2003
2047
  search_enabled: options.searchEnabled,
2004
2048
  };
2005
- return this.client.request(() => FilesService_js_1.FilesService.fileUpdate(this.podId(), fileId, payload));
2049
+ return this.client.request(() => FilesService_js_1.FilesService.fileUpdate(this.podId(), payload));
2006
2050
  }
2007
2051
  }
2008
2052
  exports.FilesNamespace = FilesNamespace;
@@ -2034,13 +2078,13 @@ class FilesService {
2034
2078
  /**
2035
2079
  * List Files
2036
2080
  * @param podId
2037
- * @param parentId
2081
+ * @param directoryPath
2038
2082
  * @param limit
2039
2083
  * @param pageToken
2040
2084
  * @returns FileListResponse Successful Response
2041
2085
  * @throws ApiError
2042
2086
  */
2043
- static fileList(podId, parentId, limit = 100, pageToken) {
2087
+ static fileList(podId, directoryPath = '/', limit = 100, pageToken) {
2044
2088
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2045
2089
  method: 'GET',
2046
2090
  url: '/pods/{pod_id}/datastore/files',
@@ -2048,7 +2092,7 @@ class FilesService {
2048
2092
  'pod_id': podId,
2049
2093
  },
2050
2094
  query: {
2051
- 'parent_id': parentId,
2095
+ 'directory_path': directoryPath,
2052
2096
  'limit': limit,
2053
2097
  'page_token': pageToken,
2054
2098
  },
@@ -2079,81 +2123,86 @@ class FilesService {
2079
2123
  });
2080
2124
  }
2081
2125
  /**
2082
- * Create Folder
2126
+ * Delete File
2083
2127
  * @param podId
2084
- * @param requestBody
2085
- * @returns FileResponse Successful Response
2128
+ * @param path
2129
+ * @returns DatastoreMessageResponse Successful Response
2086
2130
  * @throws ApiError
2087
2131
  */
2088
- static fileFolderCreate(podId, requestBody) {
2132
+ static fileDelete(podId, path) {
2089
2133
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2090
- method: 'POST',
2091
- url: '/pods/{pod_id}/datastore/files/folders',
2134
+ method: 'DELETE',
2135
+ url: '/pods/{pod_id}/datastore/files/by-path',
2092
2136
  path: {
2093
2137
  'pod_id': podId,
2094
2138
  },
2095
- body: requestBody,
2096
- mediaType: 'application/json',
2139
+ query: {
2140
+ 'path': path,
2141
+ },
2097
2142
  errors: {
2098
2143
  422: `Validation Error`,
2099
2144
  },
2100
2145
  });
2101
2146
  }
2102
2147
  /**
2103
- * Search Files
2148
+ * Get File
2104
2149
  * @param podId
2105
- * @param requestBody
2106
- * @returns FileSearchResponse Successful Response
2150
+ * @param path
2151
+ * @returns FileResponse Successful Response
2107
2152
  * @throws ApiError
2108
2153
  */
2109
- static fileSearch(podId, requestBody) {
2154
+ static fileGet(podId, path) {
2110
2155
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2111
- method: 'POST',
2112
- url: '/pods/{pod_id}/datastore/files/search',
2156
+ method: 'GET',
2157
+ url: '/pods/{pod_id}/datastore/files/by-path',
2113
2158
  path: {
2114
2159
  'pod_id': podId,
2115
2160
  },
2116
- body: requestBody,
2117
- mediaType: 'application/json',
2161
+ query: {
2162
+ 'path': path,
2163
+ },
2118
2164
  errors: {
2119
2165
  422: `Validation Error`,
2120
2166
  },
2121
2167
  });
2122
2168
  }
2123
2169
  /**
2124
- * Delete File
2170
+ * Update File
2125
2171
  * @param podId
2126
- * @param fileId
2127
- * @returns DatastoreMessageResponse Successful Response
2172
+ * @param formData
2173
+ * @returns FileResponse Successful Response
2128
2174
  * @throws ApiError
2129
2175
  */
2130
- static fileDelete(podId, fileId) {
2176
+ static fileUpdate(podId, formData) {
2131
2177
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2132
- method: 'DELETE',
2133
- url: '/pods/{pod_id}/datastore/files/{file_id}',
2178
+ method: 'PATCH',
2179
+ url: '/pods/{pod_id}/datastore/files/by-path',
2134
2180
  path: {
2135
2181
  'pod_id': podId,
2136
- 'file_id': fileId,
2137
2182
  },
2183
+ formData: formData,
2184
+ mediaType: 'multipart/form-data',
2138
2185
  errors: {
2139
2186
  422: `Validation Error`,
2140
2187
  },
2141
2188
  });
2142
2189
  }
2143
2190
  /**
2144
- * Get File
2191
+ * Download File
2145
2192
  * @param podId
2146
- * @param fileId
2147
- * @returns FileResponse Successful Response
2193
+ * @param path
2194
+ * @returns any Successful Response
2148
2195
  * @throws ApiError
2149
2196
  */
2150
- static fileGet(podId, fileId) {
2197
+ static fileDownload(podId, path) {
2151
2198
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2152
2199
  method: 'GET',
2153
- url: '/pods/{pod_id}/datastore/files/{file_id}',
2200
+ url: '/pods/{pod_id}/datastore/files/download',
2154
2201
  path: {
2155
2202
  'pod_id': podId,
2156
- 'file_id': fileId,
2203
+ },
2204
+ query: {
2205
+ 'path': path,
2157
2206
  },
2158
2207
  errors: {
2159
2208
  422: `Validation Error`,
@@ -2161,42 +2210,65 @@ class FilesService {
2161
2210
  });
2162
2211
  }
2163
2212
  /**
2164
- * Update File
2213
+ * Create Folder
2165
2214
  * @param podId
2166
- * @param fileId
2167
- * @param formData
2215
+ * @param requestBody
2168
2216
  * @returns FileResponse Successful Response
2169
2217
  * @throws ApiError
2170
2218
  */
2171
- static fileUpdate(podId, fileId, formData) {
2219
+ static fileFolderCreate(podId, requestBody) {
2172
2220
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2173
- method: 'PATCH',
2174
- url: '/pods/{pod_id}/datastore/files/{file_id}',
2221
+ method: 'POST',
2222
+ url: '/pods/{pod_id}/datastore/files/folders',
2175
2223
  path: {
2176
2224
  'pod_id': podId,
2177
- 'file_id': fileId,
2178
2225
  },
2179
- formData: formData,
2180
- mediaType: 'multipart/form-data',
2226
+ body: requestBody,
2227
+ mediaType: 'application/json',
2181
2228
  errors: {
2182
2229
  422: `Validation Error`,
2183
2230
  },
2184
2231
  });
2185
2232
  }
2186
2233
  /**
2187
- * Download File
2234
+ * Search Files
2188
2235
  * @param podId
2189
- * @param fileId
2190
- * @returns any Successful Response
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
2191
2260
  * @throws ApiError
2192
2261
  */
2193
- static fileDownload(podId, fileId) {
2262
+ static fileTree(podId, rootPath = '/', filesPerDirectory = 3) {
2194
2263
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2195
2264
  method: 'GET',
2196
- url: '/pods/{pod_id}/datastore/files/{file_id}/download',
2265
+ url: '/pods/{pod_id}/datastore/files/tree',
2197
2266
  path: {
2198
2267
  'pod_id': podId,
2199
- 'file_id': fileId,
2268
+ },
2269
+ query: {
2270
+ 'root_path': rootPath,
2271
+ 'files_per_directory': filesPerDirectory,
2200
2272
  },
2201
2273
  errors: {
2202
2274
  422: `Validation Error`,
@@ -3680,6 +3752,18 @@ const RecordsService_js_1 = require("./openapi_client/services/RecordsService.js
3680
3752
  function getRecordsPath(podId, table) {
3681
3753
  return `/pods/${encodeURIComponent(podId)}/datastore/tables/${encodeURIComponent(table)}/records`;
3682
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
+ }
3683
3767
  class RecordsNamespace {
3684
3768
  constructor(client, http, podId) {
3685
3769
  this.client = client;
@@ -3703,13 +3787,7 @@ class RecordsNamespace {
3703
3787
  list(table, options = {}) {
3704
3788
  const { filters, sort, limit, pageToken, offset, sortBy, order, params } = options;
3705
3789
  if (filters || sort) {
3706
- const payload = {
3707
- filters,
3708
- sort,
3709
- limit,
3710
- page_token: pageToken,
3711
- };
3712
- 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));
3713
3791
  }
3714
3792
  const hasCustomParams = typeof offset === "number" ||
3715
3793
  typeof sortBy === "string" ||
@@ -3727,7 +3805,7 @@ class RecordsNamespace {
3727
3805
  },
3728
3806
  });
3729
3807
  }
3730
- 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));
3731
3809
  }
3732
3810
  listWithParams(table, params) {
3733
3811
  return this.http.request("GET", getRecordsPath(this.podId(), table), {
@@ -3747,7 +3825,7 @@ class RecordsNamespace {
3747
3825
  return this.client.request(() => RecordsService_js_1.RecordsService.recordDelete(this.podId(), table, recordId));
3748
3826
  }
3749
3827
  query(table, payload) {
3750
- return this.client.request(() => RecordsService_js_1.RecordsService.recordQuery(this.podId(), table, payload));
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));
3751
3829
  }
3752
3830
  }
3753
3831
  exports.RecordsNamespace = RecordsNamespace;
@@ -3762,15 +3840,20 @@ const request_js_1 = require("./openapi_client/core/request.js");
3762
3840
  class RecordsService {
3763
3841
  /**
3764
3842
  * List Records
3765
- * List table records with token pagination only. Use `record.query` when you need structured filters or explicit sort clauses.
3843
+ * List table records with token pagination only. Use the datastore query endpoint for joins, aggregates, or custom read-only SQL.
3766
3844
  * @param podId
3767
3845
  * @param tableName
3768
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"}`
3769
3852
  * @param pageToken Opaque token from a previous response page.
3770
3853
  * @returns RecordListResponse Successful Response
3771
3854
  * @throws ApiError
3772
3855
  */
3773
- static recordList(podId, tableName, limit = 20, pageToken) {
3856
+ static recordList(podId, tableName, limit = 20, offset, sortBy, order = 'asc', filter, sort, pageToken) {
3774
3857
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
3775
3858
  method: 'GET',
3776
3859
  url: '/pods/{pod_id}/datastore/tables/{table_name}/records',
@@ -3780,6 +3863,11 @@ class RecordsService {
3780
3863
  },
3781
3864
  query: {
3782
3865
  'limit': limit,
3866
+ 'offset': offset,
3867
+ 'sort_by': sortBy,
3868
+ 'order': order,
3869
+ 'filter': filter,
3870
+ 'sort': sort,
3783
3871
  'page_token': pageToken,
3784
3872
  },
3785
3873
  errors: {
@@ -3883,30 +3971,6 @@ class RecordsService {
3883
3971
  },
3884
3972
  });
3885
3973
  }
3886
- /**
3887
- * Query Records
3888
- * 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"}]`.
3889
- * @param podId
3890
- * @param tableName
3891
- * @param requestBody
3892
- * @returns RecordListResponse Successful Response
3893
- * @throws ApiError
3894
- */
3895
- static recordQuery(podId, tableName, requestBody) {
3896
- return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
3897
- method: 'POST',
3898
- url: '/pods/{pod_id}/datastore/tables/{table_name}/records/query',
3899
- path: {
3900
- 'pod_id': podId,
3901
- 'table_name': tableName,
3902
- },
3903
- body: requestBody,
3904
- mediaType: 'application/json',
3905
- errors: {
3906
- 422: `Validation Error`,
3907
- },
3908
- });
3909
- }
3910
3974
  /**
3911
3975
  * Delete Record
3912
3976
  * Delete a record by primary key.