Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0e25241
feat: Integrate IBM COS connector with HMAC as default connection method
edwinjosechittilappilly Mar 9, 2026
7e05cad
Merge branch 'main' into IBM_COS_S3_SPIKE
edwinjosechittilappilly Mar 9, 2026
671f294
Add Amazon S3 connector and UI
edwinjosechittilappilly Mar 9, 2026
aacebb9
Merge pull request #1080 from langflow-ai/feat-s3
edwinjosechittilappilly Mar 9, 2026
7658d53
S3: env fallback & show bucket errors
edwinjosechittilappilly Mar 9, 2026
8676f15
Improve connector UI, sync S3, fix AWS logo
edwinjosechittilappilly Mar 9, 2026
153463e
Update connector-card.tsx
edwinjosechittilappilly Mar 9, 2026
627881d
Merge pull request #1082 from langflow-ai/feat-s3
edwinjosechittilappilly Mar 9, 2026
f2b7c70
Merge branch 'main' into IBM_COS_S3_SPIKE
edwinjosechittilappilly Mar 9, 2026
ad77804
Potential fix for code scanning alert no. 94: Information exposure th…
edwinjosechittilappilly Mar 10, 2026
a322b44
Potential fix for code scanning alert no. 89: Information exposure th…
edwinjosechittilappilly Mar 10, 2026
547e6a9
Potential fix for code scanning alert no. 90: Information exposure th…
edwinjosechittilappilly Mar 10, 2026
62697d0
Potential fix for code scanning alert no. 91: Information exposure th…
edwinjosechittilappilly Mar 10, 2026
b4a8462
Merge branch 'main' into IBM_COS_S3_SPIKE
edwinjosechittilappilly Mar 10, 2026
8b9adf5
Fix IBM COS bucket handling; update .gitignore
edwinjosechittilappilly Mar 10, 2026
0d3d074
Add COS env vars and improve connector logging
edwinjosechittilappilly Mar 10, 2026
28694ab
Refactor S3 and IBM COS connector APIs
edwinjosechittilappilly Mar 10, 2026
54b10f0
Improve S3/IBM COS error handling and logging
edwinjosechittilappilly Mar 10, 2026
44ec1cf
Add IBM COS auth endpoint and AWS S3/region envs
edwinjosechittilappilly Mar 10, 2026
37227cc
aws logo
mfortman11 Mar 11, 2026
57c4546
update ingest page
mfortman11 Mar 11, 2026
55961a3
Merge branch 'main' of github.com:langflow-ai/openrag into IBM_COS_S3…
mfortman11 Mar 11, 2026
d820160
merge fix
mfortman11 Mar 11, 2026
091cfd1
Merge branch 'main' of github.com:langflow-ai/openrag into IBM_COS_S3…
mfortman11 Mar 13, 2026
14c39a4
icons and connector design updates
mfortman11 Mar 13, 2026
985bb73
select buttons
mfortman11 Mar 13, 2026
f05568c
fix: Enhance connector availability checks to be user-scoped by addin…
ricofurtado Mar 13, 2026
f283a4a
Merge branch 'main' into IBM_COS_S3_SPIKE
edwinjosechittilappilly Mar 13, 2026
9fee2e8
Add logout support
mfortman11 Mar 16, 2026
b28467a
Merge branch 'IBM_COS_S3_SPIKE' of github.com:langflow-ai/openrag int…
mfortman11 Mar 16, 2026
2513cdc
Revert "Add logout support"
mfortman11 Mar 16, 2026
18446dd
make bucket connectors avaliable by default
mfortman11 Mar 16, 2026
db83df1
Move and run Python SDK integration tests
edwinjosechittilappilly Mar 16, 2026
7801acb
support adding via the add knowlegde on the knowledge page
mfortman11 Mar 16, 2026
6d42b54
feature flag for new connectors
mfortman11 Mar 16, 2026
7e92f0b
Merge branch 'main' of github.com:langflow-ai/openrag into IBM_COS_S3…
mfortman11 Mar 16, 2026
9f7c93e
Merge branch 'main' into integration-tests-sdk
edwinjosechittilappilly Mar 17, 2026
0e9c2bd
Move local SDK out of dev deps and add uv source
edwinjosechittilappilly Mar 17, 2026
c04fe45
Merge branch 'integration-tests-sdk' of https://github.com/langflow-a…
edwinjosechittilappilly Mar 17, 2026
7b3b684
chore: update uv.lock files after version bump
github-actions[bot] Mar 17, 2026
8f04b4a
Install local Python SDK in test targets
edwinjosechittilappilly Mar 17, 2026
2c57c38
Update Makefile
edwinjosechittilappilly Mar 17, 2026
17b1a34
Organize integration tests and update Makefile
edwinjosechittilappilly Mar 17, 2026
84f3455
Update Makefile
edwinjosechittilappilly Mar 17, 2026
b2ec72d
Merge pull request #1077 from langflow-ai/IBM_COS_S3_SPIKE
edwinjosechittilappilly Mar 17, 2026
34ed56e
Add SDK integration test suite
edwinjosechittilappilly Mar 17, 2026
9534196
Merge branch 'main' into integration-tests-sdk
edwinjosechittilappilly Mar 17, 2026
854970b
Adjust tests for chat.delete and search API
edwinjosechittilappilly Mar 18, 2026
b1b0586
Create README.md
edwinjosechittilappilly Mar 18, 2026
2440b73
Handle missing chat deletion and 404 response
edwinjosechittilappilly Mar 18, 2026
1fe9d74
Update agent.py
edwinjosechittilappilly Mar 18, 2026
6b732fe
Update conftest.py
edwinjosechittilappilly Mar 18, 2026
e199dd4
Remove Asyncio sleep
edwinjosechittilappilly Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ documents/warmup_ocr.pdf
documents/openrag-documentation.pdf
documents/ibm_anthropic.pdf
documents/docling.pdf
/opensearch-data-new-lf
83 changes: 57 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,11 @@ test-unit: ## Run unit tests only
@echo "$(PURPLE)Unit tests complete.$(NC)"

test-integration: ## Run integration tests (requires infrastructure)
@echo "$(YELLOW)Running integration tests (requires infrastructure)...$(NC)"
@echo "$(CYAN)Make sure to run 'make dev-local' first!$(NC)"
uv run pytest tests/integration/ -v
@echo "$(CYAN)════════════════════════════════════════$(NC)"
@echo "$(PURPLE) Core Integration Tests$(NC)"
@echo "$(CYAN)════════════════════════════════════════$(NC)"
@echo "$(YELLOW)Make sure to run 'make dev-local' first!$(NC)"
uv run pytest tests/integration/core/ -v

test-ci: ## Start infra, run integration + SDK tests, tear down (uses DockerHub images)
@set -e; \
Expand All @@ -681,12 +683,15 @@ test-ci: ## Start infra, run integration + SDK tests, tear down (uses DockerHub
chmod 600 keys/private_key.pem 2>/dev/null || true; \
chmod 644 keys/public_key.pem 2>/dev/null || true; \
fi; \
echo "::group::Cleanup, Pull & Build Images"; \
echo "$(YELLOW)Cleaning up old containers and volumes...$(NC)"; \
$(COMPOSE_CMD) down -v 2>/dev/null || true; \
echo "$(YELLOW)Pulling latest images...$(NC)"; \
$(COMPOSE_CMD) pull; \
echo "$(YELLOW)Building OpenSearch image override...$(NC)"; \
$(CONTAINER_RUNTIME) build --no-cache -t langflowai/openrag-opensearch:latest -f Dockerfile .; \
echo "::endgroup::"; \
echo "::group::Start Infrastructure"; \
echo "$(YELLOW)Starting infra (OpenSearch + Dashboards + Langflow + Backend + Frontend) with CPU containers$(NC)"; \
OPENSEARCH_HOST=opensearch $(COMPOSE_CMD) up -d opensearch dashboards langflow openrag-backend openrag-frontend; \
echo "$(CYAN)Architecture: $$(uname -m), Platform: $$(uname -s)$(NC)"; \
Expand Down Expand Up @@ -752,31 +757,42 @@ test-ci: ## Start infra, run integration + SDK tests, tear down (uses DockerHub
$(COMPOSE_CMD) down -v 2>/dev/null || true; \
exit 1; \
fi; \
echo "$(PURPLE)Running integration tests$(NC)"; \
echo "::endgroup::"; \
echo "::group::Core Integration Tests"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo "$(PURPLE) Core Integration Tests$(NC)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
LOG_LEVEL=$${LOG_LEVEL:-DEBUG} \
GOOGLE_OAUTH_CLIENT_ID="" \
GOOGLE_OAUTH_CLIENT_SECRET="" \
OPENSEARCH_HOST=localhost OPENSEARCH_PORT=9200 \
OPENSEARCH_USERNAME=admin OPENSEARCH_PASSWORD=$${OPENSEARCH_PASSWORD} \
DISABLE_STARTUP_INGEST=$${DISABLE_STARTUP_INGEST:-true} \
uv run pytest tests/integration -vv -s -o log_cli=true --log-cli-level=DEBUG; \
uv run pytest tests/integration/core -vv -s -o log_cli=true --log-cli-level=DEBUG; \
TEST_RESULT=$$?; \
echo "::endgroup::"; \
echo ""; \
echo "$(YELLOW)Waiting for frontend at http://localhost:3000...$(NC)"; \
for i in $$(seq 1 60); do \
curl -s http://localhost:3000/ >/dev/null 2>&1 && break || sleep 2; \
done; \
echo "$(PURPLE)Running Python SDK integration tests$(NC)"; \
cd sdks/python && \
uv sync --extra dev && \
OPENRAG_URL=http://localhost:3000 uv run pytest tests/test_integration.py -vv -s || TEST_RESULT=1; \
cd ../..; \
echo "$(PURPLE)Running TypeScript SDK integration tests$(NC)"; \
echo "::group::SDK Integration Tests (Python)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo "$(PURPLE) SDK Integration Tests (Python)$(NC)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
uv pip install -e sdks/python; \
SDK_TESTS_ONLY=true OPENRAG_URL=http://localhost:3000 uv run pytest tests/integration/sdk/ -vv -s || TEST_RESULT=1; \
echo "::endgroup::"; \
Comment on lines +783 to +785
echo "::group::SDK Integration Tests (TypeScript)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo "$(PURPLE) SDK Integration Tests (TypeScript)$(NC)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
cd sdks/typescript && \
npm install && npm run build && \
OPENRAG_URL=http://localhost:3000 npm test || TEST_RESULT=1; \
cd ../..; \
echo "$(CYAN)=================================$(NC)"; \
echo "::endgroup::"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo ""; \
($(call test_jwt_opensearch)) || TEST_RESULT=1; \
echo "$(YELLOW)Tearing down infra$(NC)"; \
Expand All @@ -796,13 +812,16 @@ test-ci-local: ## Same as test-ci but builds all images locally
chmod 600 keys/private_key.pem 2>/dev/null || true; \
chmod 644 keys/public_key.pem 2>/dev/null || true; \
fi; \
echo "::group::Cleanup & Build Images"; \
echo "$(YELLOW)Cleaning up old containers and volumes...$(NC)"; \
$(COMPOSE_CMD) down -v 2>/dev/null || true; \
echo "$(YELLOW)Building all images locally...$(NC)"; \
$(CONTAINER_RUNTIME) build -t langflowai/openrag-opensearch:latest -f Dockerfile .; \
$(CONTAINER_RUNTIME) build -t langflowai/openrag-backend:latest -f Dockerfile.backend .; \
$(CONTAINER_RUNTIME) build -t langflowai/openrag-frontend:latest -f Dockerfile.frontend .; \
$(CONTAINER_RUNTIME) build -t langflowai/openrag-langflow:latest -f Dockerfile.langflow .; \
echo "::endgroup::"; \
echo "::group::Start Infrastructure"; \
echo "$(YELLOW)Starting infra (OpenSearch + Dashboards + Langflow + Backend + Frontend) with CPU containers$(NC)"; \
echo "$(CYAN)Architecture: $$(uname -m), Platform: $$(uname -s)$(NC)"; \
OPENSEARCH_HOST=opensearch $(COMPOSE_CMD) up -d opensearch dashboards langflow openrag-backend openrag-frontend; \
Expand Down Expand Up @@ -868,31 +887,42 @@ test-ci-local: ## Same as test-ci but builds all images locally
$(COMPOSE_CMD) down -v 2>/dev/null || true; \
exit 1; \
fi; \
echo "$(PURPLE)Running integration tests$(NC)"; \
echo "::endgroup::"; \
echo "::group::Core Integration Tests"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo "$(PURPLE) Core Integration Tests$(NC)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
LOG_LEVEL=$${LOG_LEVEL:-DEBUG} \
GOOGLE_OAUTH_CLIENT_ID="" \
GOOGLE_OAUTH_CLIENT_SECRET="" \
OPENSEARCH_HOST=localhost OPENSEARCH_PORT=9200 \
OPENSEARCH_USERNAME=admin OPENSEARCH_PASSWORD=$${OPENSEARCH_PASSWORD} \
DISABLE_STARTUP_INGEST=$${DISABLE_STARTUP_INGEST:-true} \
uv run pytest tests/integration -vv -s -o log_cli=true --log-cli-level=DEBUG; \
uv run pytest tests/integration/core -vv -s -o log_cli=true --log-cli-level=DEBUG; \
TEST_RESULT=$$?; \
echo "::endgroup::"; \
echo ""; \
echo "$(YELLOW)Waiting for frontend at http://localhost:3000...$(NC)"; \
for i in $$(seq 1 60); do \
curl -s http://localhost:3000/ >/dev/null 2>&1 && break || sleep 2; \
done; \
echo "$(PURPLE)Running Python SDK integration tests$(NC)"; \
cd sdks/python && \
uv sync --extra dev && \
OPENRAG_URL=http://localhost:3000 uv run pytest tests/test_integration.py -vv -s || TEST_RESULT=1; \
cd ../..; \
echo "$(PURPLE)Running TypeScript SDK integration tests$(NC)"; \
echo "::group::SDK Integration Tests (Python)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo "$(PURPLE) SDK Integration Tests (Python)$(NC)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
uv pip install -e sdks/python; \
SDK_TESTS_ONLY=true OPENRAG_URL=http://localhost:3000 uv run pytest tests/integration/sdk/ -vv -s || TEST_RESULT=1; \
echo "::endgroup::"; \
echo "::group::SDK Integration Tests (TypeScript)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo "$(PURPLE) SDK Integration Tests (TypeScript)$(NC)"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
cd sdks/typescript && \
npm install && npm run build && \
OPENRAG_URL=http://localhost:3000 npm test || TEST_RESULT=1; \
cd ../..; \
echo "$(CYAN)=================================$(NC)"; \
echo "::endgroup::"; \
echo "$(CYAN)════════════════════════════════════════$(NC)"; \
echo ""; \
if [ $$TEST_RESULT -ne 0 ]; then \
echo "$(RED)=== Tests failed, dumping container logs ===$(NC)"; \
Expand All @@ -914,11 +944,12 @@ test-os-jwt: ## Test JWT authentication against OpenSearch
@$(call test_jwt_opensearch)

test-sdk: ## Run SDK integration tests (requires running OpenRAG at localhost:3000)
@echo "$(YELLOW)Running SDK integration tests...$(NC)"
@echo "$(CYAN)Make sure OpenRAG is running at localhost:3000 (make dev)$(NC)"
@echo ""
@echo "$(PURPLE)Running Python SDK tests...$(NC)"
cd sdks/python && uv sync --extra dev && OPENRAG_URL=http://localhost:3000 uv run pytest tests/test_integration.py -vv -s
@echo "$(CYAN)════════════════════════════════════════$(NC)"
@echo "$(PURPLE) SDK Integration Tests (Python)$(NC)"
@echo "$(CYAN)════════════════════════════════════════$(NC)"
@echo "$(YELLOW)Make sure OpenRAG is running at localhost:3000 (make dev)$(NC)"
uv pip install -e sdks/python
SDK_TESTS_ONLY=true OPENRAG_URL=http://localhost:3000 uv run pytest tests/integration/sdk/ -vv -s
@echo ""
@echo "$(PURPLE)Running TypeScript SDK tests...$(NC)"
cd sdks/typescript && npm install && npm run build && OPENRAG_URL=http://localhost:3000 npm test
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ services:
- WEBHOOK_BASE_URL=${WEBHOOK_BASE_URL}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_S3_ENDPOINT=${AWS_S3_ENDPOINT}
- AWS_REGION=${AWS_REGION}
- IBM_COS_API_KEY=${IBM_COS_API_KEY}
- IBM_COS_SERVICE_INSTANCE_ID=${IBM_COS_SERVICE_INSTANCE_ID}
- IBM_COS_ENDPOINT=${IBM_COS_ENDPOINT}
- IBM_COS_HMAC_ACCESS_KEY_ID=${IBM_COS_HMAC_ACCESS_KEY_ID}
- IBM_COS_HMAC_SECRET_ACCESS_KEY=${IBM_COS_HMAC_SECRET_ACCESS_KEY}
- IBM_COS_AUTH_ENDPOINT=${IBM_COS_AUTH_ENDPOINT}
- OPENSEARCH_INDEX_NAME=${OPENSEARCH_INDEX_NAME:-documents}
- LANGFLOW_KEY=${LANGFLOW_KEY}
- LANGFLOW_KEY_RETRIES=${LANGFLOW_KEY_RETRIES:-15}
Expand Down
5 changes: 5 additions & 0 deletions frontend/app/api/mutations/useConnectConnectorMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ export const useConnectConnectorMutation = () => {
`state=${result.connection_id}`;

window.location.href = authUrl;
} else {
// Direct-auth connector (e.g. IBM COS) — credentials already verified,
// no OAuth redirect needed. Refresh connector status.
queryClient.invalidateQueries({ queryKey: ["connectors"] });
toast.success(`${connector.name} connected successfully`);
}
},
});
Expand Down
40 changes: 40 additions & 0 deletions frontend/app/api/mutations/useIBMCOSConfigureMutation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";

export interface IBMCOSConfigurePayload {
auth_mode: "iam" | "hmac";
endpoint: string;
// IAM
api_key?: string;
service_instance_id?: string;
auth_endpoint?: string;
// HMAC
hmac_access_key?: string;
hmac_secret_key?: string;
// Bucket selection
bucket_names?: string[];
// Updating an existing connection
connection_id?: string;
}

async function configureIBMCOS(payload: IBMCOSConfigurePayload) {
const res = await fetch("/api/connectors/ibm_cos/configure", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error || "Failed to configure IBM COS");
return data as { connection_id: string; status: string };
}

export function useIBMCOSConfigureMutation() {
const queryClient = useQueryClient();

return useMutation({
mutationFn: configureIBMCOS,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["connectors"] });
queryClient.invalidateQueries({ queryKey: ["ibm-cos-defaults"] });
},
});
}
33 changes: 33 additions & 0 deletions frontend/app/api/mutations/useS3ConfigureMutation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";

export interface S3ConfigurePayload {
access_key?: string;
secret_key?: string;
endpoint_url?: string;
region?: string;
bucket_names?: string[];
connection_id?: string;
}

async function configureS3(payload: S3ConfigurePayload) {
const res = await fetch("/api/connectors/aws_s3/configure", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error || "Failed to configure S3");
return data as { connection_id: string; status: string };
}

export function useS3ConfigureMutation() {
const queryClient = useQueryClient();

return useMutation({
mutationFn: configureS3,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["connectors"] });
queryClient.invalidateQueries({ queryKey: ["s3-defaults"] });
},
});
}
4 changes: 4 additions & 0 deletions frontend/app/api/mutations/useSyncConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ const syncConnector = async ({
size?: number;
}>;
settings?: any;
/** When true, ingest all files from the connector (bypasses the re-sync gate). */
sync_all?: boolean;
/** Restrict ingest to these bucket names (IBM COS). */
bucket_filter?: string[];
};
}): Promise<SyncResponse> => {
const response = await fetch(`/api/connectors/${connectorType}/sync`, {
Expand Down
34 changes: 34 additions & 0 deletions frontend/app/api/queries/useIBMCOSBucketStatusQuery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useQuery } from "@tanstack/react-query";

export interface IBMCOSBucketStatus {
name: string;
ingested_count: number;
is_synced: boolean;
}

async function fetchIBMCOSBucketStatus(
connectionId: string,
): Promise<IBMCOSBucketStatus[]> {
const res = await fetch(
`/api/connectors/ibm_cos/${connectionId}/bucket-status`,
);
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.error || "Failed to fetch bucket status");
}
const data = await res.json();
return data.buckets as IBMCOSBucketStatus[];
}

export function useIBMCOSBucketStatusQuery(
connectionId: string | null | undefined,
options?: { enabled?: boolean },
) {
return useQuery<IBMCOSBucketStatus[]>({
queryKey: ["ibm-cos-bucket-status", connectionId],
queryFn: () => fetchIBMCOSBucketStatus(connectionId!),
enabled: (options?.enabled ?? true) && !!connectionId,
staleTime: 0,
refetchOnMount: "always",
});
}
23 changes: 23 additions & 0 deletions frontend/app/api/queries/useIBMCOSBucketsQuery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useQuery } from "@tanstack/react-query";

async function fetchIBMCOSBuckets(connectionId: string): Promise<string[]> {
const res = await fetch(`/api/connectors/ibm_cos/${connectionId}/buckets`);
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.error || "Failed to list buckets");
}
const data = await res.json();
return data.buckets as string[];
}

export function useIBMCOSBucketsQuery(
connectionId: string | null | undefined,
options?: { enabled?: boolean },
) {
return useQuery<string[]>({
queryKey: ["ibm-cos-buckets", connectionId],
queryFn: () => fetchIBMCOSBuckets(connectionId!),
enabled: (options?.enabled ?? true) && !!connectionId,
staleTime: 30_000,
});
}
28 changes: 28 additions & 0 deletions frontend/app/api/queries/useIBMCOSDefaultsQuery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useQuery } from "@tanstack/react-query";

export interface IBMCOSDefaults {
api_key_set: boolean;
service_instance_id: string;
endpoint: string;
hmac_access_key_set: boolean;
hmac_secret_key_set: boolean;
auth_mode: "iam" | "hmac";
bucket_names: string[];
connection_id: string | null;
disable_iam: boolean;
}

async function fetchIBMCOSDefaults(): Promise<IBMCOSDefaults> {
const res = await fetch("/api/connectors/ibm_cos/defaults");
if (!res.ok) throw new Error("Failed to fetch IBM COS defaults");
return res.json();
}

export function useIBMCOSDefaultsQuery(options?: { enabled?: boolean }) {
return useQuery<IBMCOSDefaults>({
queryKey: ["ibm-cos-defaults"],
queryFn: fetchIBMCOSDefaults,
enabled: options?.enabled ?? true,
staleTime: 0,
});
}
Loading
Loading