codemie-sdk 0.1.417 → 0.1.418

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/dist/index.cjs CHANGED
@@ -744,6 +744,16 @@ var DatasourceMapper = class _DatasourceMapper {
744
744
  });
745
745
  }
746
746
  static mapDataSourceResponseCommonFields(response) {
747
+ let status;
748
+ if (response.error) {
749
+ status = DataSourceStatus.FAILED;
750
+ } else if (response.completed) {
751
+ status = DataSourceStatus.COMPLETED;
752
+ } else if (response.is_fetching) {
753
+ status = DataSourceStatus.FETCHING;
754
+ } else {
755
+ status = DataSourceStatus.IN_PROGRESS;
756
+ }
747
757
  return {
748
758
  id: response.id,
749
759
  created_by: response.created_by,
@@ -757,7 +767,7 @@ var DatasourceMapper = class _DatasourceMapper {
757
767
  project_name: response.project_name,
758
768
  setting_id: response.setting_id,
759
769
  shared_with_project: response.project_space_visible,
760
- status: response.status,
770
+ status,
761
771
  tokens_usage: response.tokens_usage,
762
772
  type: response.index_type,
763
773
  update_date: response.update_date,
@@ -955,12 +965,13 @@ var DatasourceService = class {
955
965
  sort_key: params.sort_key || "update_date",
956
966
  sort_order: params.sort_order || "desc"
957
967
  };
958
- if (params.datasource_types || params.projects || params.status || params.owner) {
968
+ if (params.datasource_types || params.projects || params.status || params.owner || params.search) {
959
969
  const filters = {};
960
970
  if (params.datasource_types) filters.index_type = params.datasource_types;
961
971
  if (params.projects) filters.project = params.projects;
962
972
  if (params.status) filters.status = params.status;
963
973
  if (params.owner) filters.created_by = params.owner;
974
+ if (params.search) filters.name = params.search;
964
975
  queryParams.filters = JSON.stringify(filters);
965
976
  }
966
977
  const response = await this.api.get(
@@ -1420,7 +1431,8 @@ var ExecutionStatus = {
1420
1431
  var WorkflowListParamsSchema = import_zod6.z.object({
1421
1432
  page: import_zod6.z.number().prefault(0),
1422
1433
  per_page: import_zod6.z.number().prefault(10),
1423
- projects: import_zod6.z.array(import_zod6.z.string()).optional()
1434
+ projects: import_zod6.z.array(import_zod6.z.string()).optional(),
1435
+ search: import_zod6.z.string().optional()
1424
1436
  }).readonly();
1425
1437
  var WorkflowCreateParamsSchema = import_zod6.z.object({
1426
1438
  project: import_zod6.z.string(),
@@ -1601,15 +1613,18 @@ var WorkflowService = class {
1601
1613
  async list(_params = {}) {
1602
1614
  const params = WorkflowListParamsSchema.parse(_params);
1603
1615
  const queryParams = {
1604
- filters: JSON.stringify({
1605
- page: params.page,
1606
- per_page: params.per_page,
1607
- ...params.projects?.length ? { projects: params.projects } : {}
1608
- })
1616
+ page: params.page,
1617
+ per_page: params.per_page
1609
1618
  };
1610
- const workflows = await this.api.get("/v1/workflows", {
1611
- params: queryParams
1612
- });
1619
+ const filters = {};
1620
+ if (params.projects?.length) filters.project = params.projects;
1621
+ if (params.search) filters.name = params.search;
1622
+ if (Object.keys(filters).length)
1623
+ queryParams.filters = JSON.stringify(filters);
1624
+ const workflows = await this.api.get(
1625
+ "/v1/workflows",
1626
+ queryParams
1627
+ );
1613
1628
  return workflows.data.map(WorkflowMapper.mapWorkflowResponse);
1614
1629
  }
1615
1630
  /**