npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@org-quicko/strapi-plugin-converter

v1.0.1

Published

A Strapi plugin that converts API responses into a standardized response format. This plugin automatically transforms Strapi's default API response structure to create a flattened data format.

Downloads

36

Readme

@org-quicko/strapi-plugin-converter

A Strapi plugin that converts API responses into a standardized response format. This plugin automatically transforms Strapi's default API response structure to create a flattened data format.

Features

  • Automatic Response Transformation: Converts Strapi's nested response structure to a flattened format
  • Media Field Handling: Automatically extracts URLs from media fields for direct access
  • Pagination Support: Handles paginated responses and can optionally fetch all data across pages
  • Selective API Filtering: Configure which content types and methods should be transformed
  • Request ID Tracking: Adds unique request IDs for better logging and debugging
  • Configurable Middleware: Easy to configure and disable for specific requests

Installation

npm install @org-quicko/strapi-plugin-converter

How It Works

Response Transformation

The plugin intercepts Strapi API responses and transforms them from this format:

{
  "data": [
    {
      "id": 1,
      "attributes": {
        "title": "My Article",
        "content": "Article content...",
        "cover": {
          "data": {
            "attributes": {
              "url": "/uploads/image.jpg"
            }
          }
        }
      }
    }
  ],
  "meta": {
    "pagination": {
      "page": 1,
      "pageSize": 25,
      "pageCount": 1,
      "total": 1
    }
  }
}

To this format:

{
  "code": 200,
  "data": [
    {
      "id": 1,
      "title": "My Article",
      "content": "Article content...",
      "cover": "/uploads/image.jpg"
    }
  ],
  "transaction_id": "uuid-v4-string",
  "timestamp": 1640995200000
}

Key Transformations

  1. Flattens nested attributes: Moves all attributes to the root level of each data object
  2. Simplifies media fields: Extracts URLs directly from media field structures
  3. Adds metadata: Includes timestamp and transaction ID for tracking
  4. Standardizes response format: Consistent structure across all endpoints

Pagination Handling

The plugin can automatically fetch all pages of data when:

  • A paginated response has multiple pages
  • No explicit pagination parameters were provided in the request
  • The response indicates more pages are available

This ensures complete data retrieval when needed while respecting explicit pagination requests.

Usage

Basic Usage

Once installed and configured, the plugin works automatically. All API responses will be transformed according to the configuration.

Skipping Transformation

To skip transformation for specific requests, include the header:

org-quicko-strapi-converter-ignore: true

Example API Call

// Before transformation (Strapi default)
fetch('/api/articles')
  .then(response => {
    const articles = response.data.map(item => ({
      id: item.id,
      title: item.attributes.title,
      image: item.attributes.image?.data?.attributes?.url
    }));
  });

// After transformation (with plugin)
fetch('/api/articles')
  .then(response => {
    const articles = response.data.map(item => ({
      id: item.id,
      title: item.title,
      image: item.image // Direct URL access
    }));
  });

Components

Middleware

  • Transform Middleware: Main middleware that handles request/response transformation
  • Final Middleware: Additional processing if needed

Services

  • Settings Service: Manages plugin configuration
  • Transform Service: Handles the actual data transformation logic
  • Response Transformer: Core transformation logic for API responses

Utilities

  • Media Field Detection: Automatically identifies media fields in content types
  • Schema Processing: Handles component and nested field transformations

Development

Building

npm run build

Watching for Changes

npm run watch

TypeScript Validation

npm run test:ts:back

Dependencies

Peer Dependencies

  • @strapi/strapi: ^5.4.0
  • @strapi/sdk-plugin: ^5.2.7
  • @org-quicko/core: ^1.1.0

Development Dependencies

  • TypeScript support
  • Prettier for code formatting
  • Strapi development tools

API Reference

Response Format

All transformed responses follow this structure:

interface TransformedResponse {
  code: number;           // HTTP status code
  data: any;             // Transformed data
  transaction_id: string; // Unique request identifier
  timestamp: number;     // Unix timestamp in milliseconds
}

Configuration Types

interface PluginConfig {
  contentTypeFilter?: {
    mode: 'allow' | 'deny' | 'none';
    uids: Record<string, boolean | Record<string, boolean>>;
  };
  plugins?: {
    mode: 'allow' | 'deny';
    ids: Record<string, boolean>;
  };
}

Troubleshooting

Common Issues

  1. Plugin not transforming responses

    • Check if the content type is included in the filter configuration
    • Verify the plugin is enabled in config/plugins.js
    • Ensure the request doesn't have the ignore header
  2. Media URLs not working

    • Verify media fields are properly configured in your content types
    • Check that the media field contains the expected structure
  3. Performance issues with large datasets

    • Consider using explicit pagination instead of auto-fetching all pages
    • Review content type filters to exclude unnecessary transformations

Logging

The plugin logs transformation activities with request IDs for debugging:

Converter | [uuid] GET /api/articles - 200

License

ISC

Author

Quicko [email protected]

Version

1.0.0