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

@catalisa/calendar-outlook-sdk

v1.3.0

Published

SDK client for Outlook Calendar Integration API - Microsoft Graph

Readme

@catalisa/calendar-outlook-sdk

TypeScript SDK for Microsoft Outlook Calendar Integration API.

npm version License: MIT

Documentation / Documentação

Installation

npm install @catalisa/calendar-outlook-sdk

Setup

import { MSCalendarClient } from '@catalisa/calendar-outlook-sdk';

const client = new MSCalendarClient({
  baseURL: 'https://your-api.com',
  token: 'your-jwt-token',
  onUnauthorized: () => console.log('Token expired'),
});

// Update token dynamically
client.setToken('new-token');

// Get login URL
const loginUrl = client.getLoginUrl();

API Reference

Authentication

auth.me() - Get current user

const user = await client.auth.me();
// { id, email, displayName, accountType: 'personal' | 'business' }

auth.logout() - End session

await client.auth.logout();

auth.exchangeToken(appToken) - Exchange App Token for Access Token

// For external integrations using App Tokens
const client = new MSCalendarClient({ baseURL: 'https://your-api.com' });

const result = await client.auth.exchangeToken('cat_your-app-token');
// { accessToken, expiresIn: 3600, tokenType: 'Bearer' }
// Client is automatically authenticated after exchange

App Token Management

Manage long-lived tokens for external integrations.

tokens.create(data) - Create new App Token

const token = await client.tokens.create({
  name: 'My Integration',
  scopes: ['calendar:read', 'calendar:write', 'slots:read'], // optional
  expiresIn: '30d',  // '30d' | '90d' | '1y' | 'never'
});
// { id, name, scopes, expiresAt, token: 'cat_xxx...' }
// ⚠️ The plain token is only returned once!

tokens.list() - List all App Tokens

const { tokens } = await client.tokens.list();
// tokens: [{ id, name, scopes, expiresAt, lastUsedAt, createdAt, isRevoked }]

tokens.get(id) - Get single App Token

const token = await client.tokens.get('token-id');
// { id, name, scopes, expiresAt, lastUsedAt, createdAt, isRevoked }

tokens.revoke(id) - Revoke App Token

await client.tokens.revoke('token-id');

Calendar Events

calendar.list(query?) - List events

const { events, total, hasMore } = await client.calendar.list({
  startDate: '2024-01-01',  // optional
  endDate: '2024-01-31',    // optional
  limit: 50,                // default: 50
  skip: 0,                  // default: 0
});

calendar.get(id) - Get single event

const event = await client.calendar.get('event-id');
// { id, subject, body, start, end, location, attendees, isOnlineMeeting, onlineMeetingUrl }

calendar.create(data) - Create event

const event = await client.calendar.create({
  subject: 'Meeting',
  body: 'Description',                                              // optional
  start: { dateTime: '2024-01-20T14:00:00', timeZone: 'UTC' },
  end: { dateTime: '2024-01-20T15:00:00', timeZone: 'UTC' },
  location: 'Room 101',                                             // optional
  attendees: [{ email: '[email protected]', name: 'Name', type: 'required' }], // optional
  isOnlineMeeting: true,                                            // optional - creates Teams link
});

calendar.update(id, data) - Update event

const event = await client.calendar.update('event-id', {
  subject: 'Updated Title',
  location: 'Room 202',
});

calendar.delete(id) - Delete event

await client.calendar.delete('event-id');

Finding Available Slots

calendar.findSlots(query) - Find free time slots

const { slots, meta } = await client.calendar.findSlots({
  startDate: '2024-01-15',        // required
  endDate: '2024-01-22',          // required
  duration: 30,                   // required (minutes)
  quantity: 5,                    // default: 5
  algorithm: 'nextAvailable',     // 'nextAvailable' | 'spread' | 'randomize' | 'consecutive'
  weekdaysOnly: false,            // default: false
  periodStart: '09:00',           // optional (HH:mm)
  periodEnd: '17:00',             // optional (HH:mm)
  timeZone: 'UTC',                // default: 'UTC'
});

// slots: [{ start, end, timeZone }]
// meta: { totalAvailable, returned, searchedCalendars }

Algorithms:

  • nextAvailable - Earliest slots first
  • spread - Distributed across days
  • randomize - Random selection
  • consecutive - Back-to-back slots

Types

import type {
  // User
  UserDto,
  // Events
  EventDto,
  CreateEventDto,
  UpdateEventDto,
  ListEventsQueryDto,
  ListEventsResponseDto,
  // Slots
  SlotDto,
  FindSlotsQueryDto,
  FindSlotsResponseDto,
  DateTimeDto,
  AttendeeDto,
  SlotAlgorithm,
  // App Tokens
  CreateAppTokenDto,
  AppTokenDto,
  AppTokenWithSecretDto,
  ListAppTokensResponseDto,
  ExchangeTokenResponseDto,
  AppTokenScope,
} from '@catalisa/calendar-outlook-sdk';

Error Handling

try {
  await client.calendar.get('invalid-id');
} catch (error) {
  if (error.response?.status === 404) {
    console.log('Not found');
  }
}

Testing

Unit Tests

pnpm test

E2E Tests (CLI)

Requires a running API and valid JWT token.

# Set your token
export TOKEN="your-jwt-token"

# Run all tests
pnpm test:e2e

# Run specific suite
pnpm test:e2e -- auth
pnpm test:e2e -- calendar
pnpm test:e2e -- slots
pnpm test:e2e -- tokens
pnpm test:e2e -- logout

Browser Tests (Playwright)

Interactive tests requiring Microsoft OAuth login.

# Install browsers (first time)
npx playwright install chromium

# Popup authentication
pnpm test:browser:popup

# Redirect authentication
pnpm test:browser:redirect

# Token authentication (headless)
pnpm test:browser:token

License

MIT