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

@progress-chef/platform-tenant-preference-service

v1.0.0

Published

Angular service for managing tenant system preferences from the Chef Platform.

Downloads

395

Readme

Platform Tenant Preference Service

Angular service for managing tenant system preferences from the Chef Platform.

Overview

This library provides the TenantPreferencesService which manages tenant system preferences data from the shared NgRx store (ChefPlatformSystemTenantSharedFacadeService). It offers a clean API for accessing tenant preferences like AI enablement, Opsmith enablement, and other feature flags.

Installation

npm install @progress-chef/platform-tenant-preference-service
# or
yarn add @progress-chef/platform-tenant-preference-service

Dependencies

This library has peer dependencies on:

  • @progress-chef/platform-shared-store - NgRx store facades for Chef Platform APIs
  • @progress-chef/platform-storage-service - Browser storage utilities
  • jwt-decode - JWT token decoding
  • rxjs - Reactive programming

Usage

Import the Service

import { TenantPreferencesService } from '@progress-chef/platform-tenant-preference-service';

@Component({
  selector: 'app-my-component',
  templateUrl: './my-component.component.html'
})
export class MyComponent {
  constructor(private tenantPreferencesService: TenantPreferencesService) {}
}

Fetch Tenant Preferences

ngOnInit() {
  const tenantId = this.tenantPreferencesService.getTenantIdFromToken();
  const baseUrl = 'https://api.chef.io';
  
  if (tenantId) {
    this.tenantPreferencesService.fetchTenantPreferences(tenantId, baseUrl);
  }
}

Check AI Enablement

this.tenantPreferencesService.isAiEnabled$().subscribe(isEnabled => {
  if (isEnabled) {
    // AI features are enabled
  }
});

Check Opsmith Enablement

this.tenantPreferencesService.isOpsmithEnabled$().subscribe(isEnabled => {
  if (isEnabled) {
    // Opsmith features are enabled
  }
});

Get Complete Preferences State

this.tenantPreferencesService.getPreferencesState$().subscribe(state => {
  console.log('Preferences:', state.preferences);
  console.log('Loading:', state.loading);
  console.log('Error:', state.error);
});

Reset Preferences (e.g., on logout)

onLogout() {
  this.tenantPreferencesService.resetPreferences();
}

API

Methods

  • fetchTenantPreferences(tenantId: string, baseUrl: string): void - Fetch tenant preferences from API
  • isAiEnabled$(): Observable<boolean | null> - Observable for AI-enabled flag
  • isOpsmithEnabled$(): Observable<boolean | null> - Observable for Opsmith-enabled flag
  • getPreferencesState$(): Observable<TenantPreferencesState> - Observable for complete state
  • isLoading$(): Observable<boolean> - Observable for loading status
  • getTenantIdFromToken(): string | null - Extract tenant ID from JWT token
  • resetPreferences(): void - Reset preferences state

Interfaces

export interface TenantSystemPreferences {
  'ai-enabled'?: boolean;
  [key: string]: any;
}

export interface TenantPreferencesState {
  preferences: TenantSystemPreferences | null;
  loading: boolean;
  error: string | null;
}

Build

yarn build:platform-tenant-preference-service

Test

yarn test

Publishing

After building the library:

cd dist/platform-tenant-preference-service
yarn publish

Architecture

This service acts as a facade over the ChefPlatformSystemTenantSharedFacadeService from @progress-chef/platform-shared-store, providing a simplified API specifically for tenant preferences. It:

  1. Dispatches actions to fetch tenant preferences
  2. Subscribes to store updates
  3. Transforms API data format (array to object)
  4. Provides reactive streams for specific preference flags
  5. Handles loading and error states

License

Apache-2.0