@rabid/pm-payload-cms-storage
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@rabid/pm-payload-cms-storage

@rabid/pm-payload-cms-storage is a storage interface for the Pipeline Manager using Payload CMS.

Installation

npm install @rabid/pm-payload-cms-storage

Usage

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);
});

API

PayloadStorage

constructor(config: PayloadStorageConfig)

Creates an instance of PayloadStorage.

  • config: The configuration object for PayloadStorage.
    • payload: The initial payload to store.

getDefinition(id: string): Promise<PipelineConfig>

Retrieves the definition of a pipeline configuration by its ID.

  • id: The unique identifier of the pipeline configuration to fetch.

getDefinitionByName(name: string): Promise<PipelineConfig>

Retrieves a pipeline configuration definition by its name.

  • name: The name of the pipeline configuration to retrieve.

getProgress(pipelineConfigId: string, executionId?: string): Promise<ExecutionState>

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @rabid/pm-payload-cms-storage

Weekly Downloads

5

Version

2.0.0

License

Affero GPL-3.0

Unpacked Size

10.3 kB

Total Files

5

Last publish

Collaborators

  • jmdiego