@rabid/pm-payload-cms-storage
is a storage interface for the Pipeline Manager using Payload CMS.
npm install @rabid/pm-payload-cms-storage
import { PayloadStorage } from '@rabid/pm-payload-cms-storage';
import { Integration } from '@rabid/pipeline-manager';
const payloadIntegration: Integration = {
execute: async (options) => {
// Implementation of the execute method
}
};
const storage = new PayloadStorage({ payload: payloadIntegration });
// Retrieve pipeline configuration by ID
storage.getDefinition('pipelineConfigId').then(config => {
console.log(config);
});
// Retrieve pipeline configuration by name
storage.getDefinitionByName('pipelineName').then(config => {
console.log(config);
});
// Retrieve pipeline execution progress
storage.getProgress('pipelineConfigId', 'executionId').then(progress => {
console.log(progress);
});
// Save pipeline execution progress
storage.saveProgress('pipelineConfigId', 'executionId', { /* execution state */ }).then(savedProgress => {
console.log(savedProgress);
});
Creates an instance of PayloadStorage
.
-
config: The configuration object for
PayloadStorage
.- payload: The initial payload to store.
Retrieves the definition of a pipeline configuration by its ID.
- id: The unique identifier of the pipeline configuration to fetch.
Retrieves a pipeline configuration definition by its name.
- name: The name of the pipeline configuration to retrieve.
Retrieves the progress of a pipeline execution.
- pipelineConfigId: The ID of the pipeline configuration.
- executionId: The optional ID of the specific execution to retrieve.
saveProgress(pipelineConfigId: string, executionId: string, progress: ExecutionState): Promise<ExecutionState>
Saves the execution progress of a pipeline.
- pipelineConfigId: The unique identifier for the pipeline configuration.
- executionId: The unique identifier for the execution instance.
- progress: The current state of the execution to be saved.