refactor(agent): move the connector credential helpers out of VaultStore (P1.2)
getConnectorCredential, setConnectorCredential and setConnectorCredentialBundle are now plain functions over a SecretStore in packages/agent/src/connectors/connector-credentials.ts. The secret names, metadata layout and the rule that tokens never go into plaintext metadata are unchanged, so existing vault files keep working. A bundle still lands as one update: SecretStore gains writeBatch, which VaultStore applies with a single vault-file replacement. Connector tests seed a Map-backed SecretStore instead of mocking VaultStore methods; the helper tests from core and server moved to the agent package.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import { BaseConnector, type ConnectorAction, type ConnectorResult } from '../connector-sdk.js';
|
||||
import { getConnectorCredential } from './connector-credentials.js';
|
||||
import { safeFetch } from '../url-egress-guard.js';
|
||||
import type { VaultStore } from '@waggle/core';
|
||||
import type { ConnectorDefinition, ConnectorHealth, ConnectorStatus } from '@waggle/shared';
|
||||
@@ -214,7 +215,7 @@ export class SalesforceConnector extends BaseConnector {
|
||||
}
|
||||
|
||||
async connect(vault: VaultStore): Promise<void> {
|
||||
const cred = vault.getConnectorCredential(this.id);
|
||||
const cred = getConnectorCredential(vault, this.id);
|
||||
this.token = cred?.value ?? null;
|
||||
|
||||
// Instance URL from vault metadata (e.g., "https://mycompany.salesforce.com")
|
||||
|
||||
Reference in New Issue
Block a user