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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ui5-middleware-odata-recorder

v0.0.13

Published

UI5 custom server middleware to record OData traffic for mockserver replay

Readme

ui5-middleware-odata-recorder

🎬 Record OData traffic from your UI5 app and generate FE-mockserver-compatible datasets

Perfect for offline development, testing, and creating mock data without backend dependencies.

✨ Key Features

  • 🔄 Multi-service & Multi-tenant: Record from multiple OData services with tenant isolation
  • 📊 Complete Data Capture: Gets full entities by default (removes $select parameters)
  • Smart & Fast: Deduplication, compression handling, real-time streaming
  • 🚫 304 Prevention: Automatically removes caching headers to ensure fresh metadata (v0.0.7+)
  • 🔧 Easy Control: REST API endpoints or URL parameters to start/stop recording
  • 📦 Ready-to-Use: Generates files compatible with SAP FE Mockserver

📦 Installation

npm install --save-dev ui5-middleware-odata-recorder

⚙️ Quick Setup

Add to your ui5.yaml:

server:
  customMiddleware:
    - name: fiori-tools-proxy
      afterMiddleware: compression
      configuration:
        backend:
          - path: /odata
            url: https://your-backend.com
    
    - name: ui5-middleware-odata-recorder
      afterMiddleware: fiori-tools-proxy
      configuration:
        services:
          - alias: mainService
            version: v4
            basePath: /odata/v4/main/
            targetDir: webapp/localService/mainService/data

💡 Tip: Disable fiori-tools-appreload during recording to prevent reload loops

🚀 Quick Start

1. Start Recording with recordingId

Using URL parameters (recommended):

# Start UI5 server
ui5 serve

# Open browser with recording enabled and recordingId
http://localhost:8080/index.html?__record=1&recordingId=demo

# Or for multi-tenant scenarios
http://localhost:8080/index.html?__record=1&recordingId=100  # SAP client 100
http://localhost:8080/index.html?__record=1&recordingId=200  # SAP client 200

Using REST API:

# Start recording with specific recordingId
curl "http://localhost:8080/__recorder/start?recordingId=demo&mode=stream"

# Check recording status
curl "http://localhost:8080/__recorder/status"

# Stop recording and save files
curl "http://localhost:8080/__recorder/stop"

2. What Gets Recorded

Files are created with recordingId suffix:

webapp/localService/mainService/data/
├── Books-demo.json      ← recordingId: "demo"
├── Orders-demo.json
├── Books-100.json       ← recordingId: "100"  
├── Orders-100.json
└── metadata.xml

3. Replay with Mockserver

# Switch to mockserver configuration
ui5 serve --config ui5.mock.yaml

# Open with specific dataset
http://localhost:8080/index.html?recordingId=demo

4. No recordingId (Simple Mode)

# Record without recordingId suffix
http://localhost:8080/index.html?__record=1

# Creates clean filenames
webapp/localService/mainService/data/
├── Books.json           ← No suffix
├── Orders.json
└── metadata.xml

5. Auto-start Configuration

configuration:
  autoStart: true
  defaultTenant: "demo"  # Default recordingId if not in URL

📂 Output

Creates mockserver-compatible files:

webapp/localService/mainService/
  metadata.xml          # Service metadata
  data/
    Books.json         # Entity data  
    Orders-100.json    # With tenant suffix (if configured)

🔧 Configuration Options

| Option | Default | Description | |--------|---------|-------------| | autoStart | false | Start recording when middleware loads | | autoSave | "stream" | Write mode: "stream" or "onStop" | | removeSelectParams | true | Remove $select to capture full entities | | defaultTenant | undefined | Tenant mode: "100" or "getTenantFromSAPClient" | | controlEndpoints | true | Enable /__recorder/* REST API | | redact | [] | Field names to remove from recorded data |

📖 Full Documentation

For detailed guides, advanced features, and troubleshooting:

📚 Getting Started Guide →

Covers installation, configuration, workflows, and troubleshooting.

🎯 recordingId Usage Guide →

Complete guide for multi-dataset recording:

  • Multi-tenant SAP client recording
  • Test scenario management
  • Environment-specific datasets
  • REST API control
  • Best practices and troubleshooting

📄 License

Apache-2.0 © Marian Zeis