Skip to content

Commit 52d6418

Browse files
committed
dump-tools
1 parent 4390b47 commit 52d6418

14 files changed

Lines changed: 386 additions & 1 deletion

src/functions/dump/getAgent.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { AgentName } from "../../interfaces/Agent.interface";
2+
import swarm from "../../lib";
3+
import { GLOBAL_CONFIG } from "../../config/params";
4+
5+
const METHOD_NAME = "function.dump.getAgent";
6+
7+
/**
8+
* Retrieves an agent schema by its name from the swarm's agent schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getAgent
12+
* @param {AgentName} agentName - The name of the agent to retrieve.
13+
* @returns The agent schema associated with the provided agent name.
14+
*/
15+
export function getAgent(agentName: AgentName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
agentName,
19+
});
20+
return swarm.agentSchemaService.get(agentName);
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { CompletionName } from "../../interfaces/Completion.interface";
4+
5+
const METHOD_NAME = "function.dump.getCompletion";
6+
7+
/**
8+
* Retrieves a completion schema by its name from the swarm's completion schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getCompletion
12+
* @param {CompletionName} completionName - The name of the completion to retrieve.
13+
* @returns The completion schema associated with the provided completion name.
14+
*/
15+
export function getCompletion(completionName: CompletionName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
completionName,
19+
});
20+
return swarm.completionSchemaService.get(completionName);
21+
}

src/functions/dump/getCompute.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { ComputeName } from "../../interfaces/Compute.interface";
4+
5+
const METHOD_NAME = "function.dump.getCompute";
6+
7+
/**
8+
* Retrieves a compute schema by its name from the swarm's compute schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getCompute
12+
* @param {ComputeName} computeName - The name of the compute to retrieve.
13+
* @returns The compute schema associated with the provided compute name.
14+
*/
15+
export function getCompute(computeName: ComputeName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
computeName,
19+
});
20+
return swarm.computeSchemaService.get(computeName);
21+
}

src/functions/dump/getEmbeding.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { EmbeddingName } from "../../interfaces/Embedding.interface";
4+
5+
const METHOD_NAME = "function.dump.getEmbeding";
6+
7+
/**
8+
* Retrieves an embedding schema by its name from the swarm's embedding schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getEmbedding
12+
* @param {EmbeddingName} embeddingName - The name of the embedding to retrieve.
13+
* @returns The embedding schema associated with the provided embedding name.
14+
*/
15+
export function getEmbeding(embeddingName: EmbeddingName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
embeddingName,
19+
});
20+
return swarm.embeddingSchemaService.get(embeddingName);
21+
}

src/functions/dump/getMCP.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { MCPName } from "../../interfaces/MCP.interface";
4+
5+
const METHOD_NAME = "function.dump.getMCP";
6+
7+
/**
8+
* Retrieves an MCP (Model Context Protocol) schema by its name from the swarm's MCP schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getMCP
12+
* @param {MCPName} mcpName - The name of the MCP to retrieve.
13+
* @returns The MCP schema associated with the provided MCP name.
14+
*/
15+
export function getMCP(mcpName: MCPName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
mcpName,
19+
});
20+
return swarm.mcpSchemaService.get(mcpName);
21+
}

src/functions/dump/getPipeline.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { PipelineName } from "../../model/Pipeline.model";
4+
5+
const METHOD_NAME = "function.dump.getPipeline";
6+
7+
/**
8+
* Retrieves a pipeline schema by its name from the swarm's pipeline schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getPipeline
12+
* @param {PipelineName} pipelineName - The name of the pipeline to retrieve.
13+
* @returns The pipeline schema associated with the provided pipeline name.
14+
*/
15+
export function getPipeline(pipelineName: PipelineName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
pipelineName,
19+
});
20+
return swarm.pipelineSchemaService.get(pipelineName);
21+
}

src/functions/dump/getPolicy.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { PolicyName } from "../../interfaces/Policy.interface";
4+
5+
const METHOD_NAME = "function.dump.getPolicy";
6+
7+
/**
8+
* Retrieves a policy schema by its name from the swarm's policy schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getPolicy
12+
* @param {PolicyName} policyName - The name of the policy to retrieve.
13+
* @returns The policy schema associated with the provided policy name.
14+
*/
15+
export function getPolicy(policyName: PolicyName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
policyName,
19+
});
20+
return swarm.policySchemaService.get(policyName);
21+
}

src/functions/dump/getState.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { StateName } from "../../interfaces/State.interface";
4+
5+
const METHOD_NAME = "function.dump.getState";
6+
7+
/**
8+
* Retrieves a state schema by its name from the swarm's state schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getState
12+
* @param {StateName} stateName - The name of the state to retrieve.
13+
* @returns The state schema associated with the provided state name.
14+
*/
15+
export function getState(stateName: StateName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
stateName,
19+
});
20+
return swarm.stateSchemaService.get(stateName);
21+
}

src/functions/dump/getStorage.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { StorageName } from "../../interfaces/Storage.interface";
4+
5+
const METHOD_NAME = "function.dump.getStorage";
6+
7+
/**
8+
* Retrieves a storage schema by its name from the swarm's storage schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getStorage
12+
* @param {StorageName} storageName - The name of the storage to retrieve.
13+
* @returns The storage schema associated with the provided storage name.
14+
*/
15+
export function getStorage(storageName: StorageName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
storageName,
19+
});
20+
return swarm.storageSchemaService.get(storageName);
21+
}

src/functions/dump/getSwarm.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import swarm from "../../lib";
2+
import { GLOBAL_CONFIG } from "../../config/params";
3+
import { SwarmName } from "../../interfaces/Swarm.interface";
4+
5+
const METHOD_NAME = "function.dump.getSwarm";
6+
7+
/**
8+
* Retrieves a swarm schema by its name from the swarm's swarm schema service.
9+
* Logs the operation if logging is enabled in the global configuration.
10+
*
11+
* @function getSwarm
12+
* @param {SwarmName} swarmName - The name of the swarm to retrieve.
13+
* @returns The swarm schema associated with the provided swarm name.
14+
*/
15+
export function getSwarm(swarmName: SwarmName) {
16+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
17+
swarm.loggerService.log(METHOD_NAME, {
18+
swarmName,
19+
});
20+
return swarm.swarmSchemaService.get(swarmName);
21+
}

0 commit comments

Comments
 (0)