@misar/lib (1.0.2)

Published 2026-03-16 17:47:51 +00:00 by misaradmin

Installation

@misar:registry=
npm install @misar/lib@1.0.2
"@misar/lib": "1.0.2"

About this package

@misar/lib

Shared utilities and configuration for the MisarIO monorepo.

Overview

This package contains shared utilities, types, and configurations used across all MisarIO applications and packages.

Features

  • Supabase Integration: Client and server-side Supabase utilities with proper TypeScript types
  • Sentry Configuration: Error tracking setup with consent mode support
  • SSO Utilities: Helper functions for SSO operations
  • Type Definitions: Shared TypeScript interfaces and types

Installation

pnpm add @misar/lib

Usage

Supabase Client

import { createClient } from '@misar/lib/supabase/client';

const supabase = createClient();
const { data, error } = await supabase.auth.getUser();

Supabase Server

import { createClient } from '@misar/lib/supabase/server';

export async function GET() {
  const supabase = createClient();
  const { data, error } = await supabase.auth.getUser();
  // Handle server-side authentication
}

Sentry Configuration

import { getSentryBrowserConfig, getSentryServerConfig } from '@misar/lib/sentry';

// In sentry.client.config.ts
export default getSentryBrowserConfig({ analyticsConsent: true });

// In sentry.server.config.ts
export default getSentryServerConfig();

API Reference

Supabase

  • createClient(): Creates a Supabase client for client-side operations
  • createServerClient(): Creates a Supabase client for server-side operations
  • createAdminClient(): Creates an admin client with elevated permissions

Sentry

  • getSentryBrowserConfig(): Gets browser-side Sentry configuration
  • getSentryServerConfig(): Gets server-side Sentry configuration
  • filterSensitiveData(): Filters PII from error reports
  • getSentryTags(): Gets custom tags for error categorization

SSO

  • hasCheckedSSO(): Checks if SSO has been checked this session
  • markSSOChecked(): Marks SSO as checked
  • performSilentSSOCheck(): Performs a silent SSO check

Environment Variables

  • NEXT_PUBLIC_SUPABASE_URL: Supabase project URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY: Supabase anonymous key
  • SUPABASE_SERVICE_ROLE_KEY: Supabase service role key (server-side)
  • NEXT_PUBLIC_SENTRY_DSN: Sentry DSN for error tracking
  • SENTRY_AUTH_TOKEN: Sentry auth token for source maps

Development

This package is part of the MisarIO monorepo. Changes here affect all applications.

# Build the package
pnpm build

# Run tests
pnpm test

# Type check
pnpm typecheck

Contributing

When adding new utilities:

  1. Ensure proper TypeScript types
  2. Add JSDoc documentation
  3. Include tests where appropriate
  4. Update this README if needed

License

MIT

Dependencies

Dependencies

ID Version
@supabase/ssr ^0.5.2
@supabase/supabase-js ^2.47.10
clsx ^2.1.1
tailwind-merge ^2.6.0

Development dependencies

ID Version
typescript ^5.7.3

Peer dependencies

ID Version
next >=15.0.0
Details
npm
2026-03-16 17:47:51 +00:00
437
latest
24 KiB
Assets (1)
lib-1.0.2.tgz 24 KiB
Versions (3) View all
1.0.2 2026-03-16
1.0.1 2026-03-13
1.0.0 2026-03-13