Skip to content

Commit 062161d

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(oci-secrets): normalize native block optional parameters
1 parent cfd5ed9 commit 062161d

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

apps/sim/blocks/blocks/oci_secrets.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,10 @@ export const OciSecretsBlock: BlockConfig = {
896896
compartmentId: params.compartmentId,
897897
secretId: params.secretId,
898898
secretName: params.secretName,
899-
vaultId: params.vaultId,
899+
vaultId:
900+
params.operation === 'list_secrets' && (params.vaultId === null || params.vaultId === '')
901+
? undefined
902+
: params.vaultId,
900903
keyId: params.keyId,
901904
name: params.name || undefined,
902905
lifecycleState: params.lifecycleState || undefined,

apps/sim/lib/internal/oci-secrets/execute-tool.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ vi.mock('@/lib/internal/oci-secrets/operations', () => ({
2121
import { OciClientError } from '@/lib/internal/oci/errors'
2222
import { executeOciSecretsTool } from '@/lib/internal/oci-secrets/execute-tool'
2323
import type { InternalToolOperationCall } from '@/lib/internal/tool-operations/types'
24+
import { OciSecretsBlock } from '@/blocks/blocks/oci_secrets'
25+
import { ociSecretsListSecretsTool } from '@/tools/oci_secrets/list_secrets'
2426

2527
const client = { request: vi.fn() }
2628
const access = {
@@ -91,6 +93,35 @@ describe('executeOciSecretsTool', () => {
9193
})
9294
})
9395

96+
it.each([null, '', undefined, 'vault-1'])(
97+
'normalizes the optional native vault filter (%s)',
98+
async (vaultId) => {
99+
const raw = {
100+
operation: 'list_secrets',
101+
oauthCredential: 'selected-credential',
102+
compartmentId: 'compartment-1',
103+
vaultId,
104+
}
105+
const params = { ...raw, ...OciSecretsBlock.tools.config?.params?.(raw) }
106+
const response = await executeOciSecretsTool(
107+
request({
108+
toolId: ociSecretsListSecretsTool.id,
109+
input: ociSecretsListSecretsTool.operation.input(params),
110+
})
111+
)
112+
expect(response.status).toBe(200)
113+
expect(mocks.execute).toHaveBeenCalledWith(
114+
expect.anything(),
115+
expect.objectContaining({
116+
operation: 'list_secrets',
117+
vaultId: vaultId || undefined,
118+
compartmentId: 'compartment-1',
119+
}),
120+
undefined
121+
)
122+
}
123+
)
124+
94125
it.each(operations)(
95126
'dispatches %s using the registered ID and trusted authority',
96127
async (operation) => {

0 commit comments

Comments
 (0)