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

@ph-cms/api-contract

v0.1.23

Published

Shared Zod schemas and types for PH-CMS

Downloads

1,316

Readme

@ph-cms/api-contract

Shared Zod schemas and TypeScript types for PH-CMS.

This package is intended to be published to npm and consumed by servers, clients, and tooling that need a single source of truth for request and response contracts.

Installation

npm install @ph-cms/api-contract zod

Usage

import { CreateContentSchema, type CreateContentRequest } from '@ph-cms/api-contract';
import { RegisterSchema, type RegisterRequest } from '@ph-cms/api-contract';

// Create Content
const contentPayload: CreateContentRequest = {
  title: 'Hello',
  channelUid: 'news',
  type: 'post',
  status: 'published',
};

const parsedContent = CreateContentSchema.parse(contentPayload);

// Register
const registerPayload: RegisterRequest = {
  email: '[email protected]',
  password: 'password123',
  display_name: '홍길동',
  phone_number: '010-1234-5678', // 선택 사항
  channelUid: 'my-channel',
  termCodes: ['SERVICE_TERM', 'PRIVACY_TERM'],
};

const parsedRegister = RegisterSchema.parse(registerPayload);

Content Status

콘텐츠의 status 필드는 다음 세 가지 값을 가집니다:

| status | 가시성 | |---|---| | 'published' | 모든 사용자(비로그인 포함)에게 공개 | | 'draft' | 작성자 본인 및 admin/manager만 조회 가능 | | 'private' | 작성자 본인 및 admin/manager만 조회 가능 |

ListContentQuerySchemastatus 필드는 'published' | 'draft' | 'private'로 타입이 고정되어 있습니다.

Content Response Types

ContentDto

콘텐츠 목록/상세 조회 응답 타입입니다. stat.child 필드를 통해 자식 콘텐츠의 타입별 갯수를 확인할 수 있습니다.

import type { ContentDto, ContentStatDto } from '@ph-cms/api-contract';

const content: ContentDto = response.data.content[0];

// 자식 갯수 접근
const replyCount: number = content.stat.child['reply'] ?? 0;

ContentStatDto

interface ContentStatDto {
  view_count: number;
  like_count: number;
  share_count: number;
  dislike_count: number;
  child: Record<string, number>; // { [childType]: count }
}
  • child는 항상 객체로 반환됩니다 (자식이 없으면 {}).
  • 키는 자식 콘텐츠의 type, 값은 해당 타입의 자식 수입니다.

Place Search Contracts

장소 검색 계약이 추가되었습니다.

  • PlaceSearchQuerySchema
  • IntegratedPlaceSchema
  • PlaceSearchResponseSchema

IntegratedPlace는 공급자 차이와 무관하게 고정된 응답 shape를 가집니다.

type IntegratedPlace = {
  id: string;
  name: string;
  address: string;
  location: { lat: number; lng: number };
  category: string;
  provider: 'google' | 'naver';
  phoneNumber: string | null;
  link: string | null;
  photos: Array<{
    url: string;
    width: number | null;
    height: number | null;
    attribution: string | null;
  }>;
  reviews: Array<{
    title: string;
    link: string;
    snippet: string;
    author: string | null;
    date: string | null;
  }>;
};

빈 값도 키가 생략되지 않고 항상 null 또는 []로 반환되도록 설계되어 있습니다.

User Contracts

사용자 프로필과 팔로우 관련 계약이 포함되어 있습니다.

UserProfileDto

공개 프로필 응답은 팔로워 수를 포함합니다.

type UserProfileDto = {
  uid: string;
  username: string | null;
  display_name: string;
  avatar_url: string | null;
  follower_count: number;
  profile_data: Record<string, any>;
};

UserDto

인증된 사용자 상세 응답도 동일하게 follower_count를 포함합니다.

Follow Contracts

아래 스키마와 타입이 추가되었습니다.

  • FollowStatusResponseSchema
  • FollowUserResponseSchema
  • FollowStatusResponse
  • FollowUserResponse
type FollowStatusResponse = {
  is_following: boolean;
};

type FollowUserResponse = {
  success: boolean;
  message: string;
  is_following: boolean;
};

Exports

  • Auth, content, channel, user, hierarchy, policy, terms, geo, and common schemas
  • Inferred TypeScript types derived from the shared Zod schemas

Auth Schemas

| Schema | 설명 | |---|---| | RegisterSchema | 이메일 회원가입 요청. channelUid 또는 channelSlug 중 하나 필수. phone_number 지원 | | FirebaseRegisterSchema | Firebase 서버 사이드 회원가입 요청. phone_number 지원 | | LoginSchema | 이메일/비밀번호 로그인 | | FirebaseExchangeSchema | Firebase ID 토큰 교환 | | AnonymousLoginSchema | 익명 로그인 |

License

MIT