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

dadp-schema-collector

v1.1.0

Published

DADP DB 스키마 사전 수집, Hub 등록 및 매핑 Export/Import CLI 도구

Readme

DADP Schema Collector

DB 스키마를 사전 수집하여 DADP Hub에 등록하는 CLI 도구입니다. Wrapper 앱 기동 전에 미리 스키마를 등록하여, Hub 관리자가 암호화 정책을 사전에 매핑할 수 있습니다.

A CLI tool for pre-collecting DB schemas and registering them with DADP Hub. Register schemas before starting the Wrapper app so that Hub administrators can pre-map encryption policies.


설치 / Installation

# npx로 즉시 실행 (설치 불필요)
npx dadp-schema-collector --db-type mysql ...

# 전역 설치
npm install -g dadp-schema-collector
dadp-schema-collector --db-type mysql ...

# 로컬 설치
npm install dadp-schema-collector
npx dadp-schema-collector --db-type mysql ...

요구 사항 / Requirements

  • Node.js >= 14.0.0
  • 지원 DB: MySQL, PostgreSQL, Oracle (Oracle은 oracledb 패키지 별도 설치 필요)

사용법 / Usage

옵션 / Options

| 옵션 | 설명 | 필수 | |---|---|---| | --db-type <type> | DB 종류 (mysql, postgresql, oracle) | 필수 | | --db-host <host> | DB 호스트 | 필수 | | --db-port <port> | DB 포트 (기본: 벤더별 기본 포트) | 선택 | | --db-name <name> | 데이터베이스명 | 필수 | | --db-user <user> | DB 사용자 | 필수 | | --db-password <pass> | DB 비밀번호 | 필수 | | --hub-url <url> | Hub URL (예: http://localhost:9004/hub) | Hub 등록 시 필수 | | --instance-id <id> | 인스턴스 ID / 별칭 (Wrapper와 동일하게 설정) | Hub 등록 시 필수 | | --dry-run | Hub 전송 없이 수집 결과만 출력 | 선택 | | --schema-filter <s> | 특정 스키마만 수집 (쉼표 구분) | 선택 | | --verbose | 상세 로그 | 선택 | | -v, --version | 버전 출력 | - | | -h, --help | 도움말 출력 | - |

예시 / Examples

# dry-run (수집만, Hub 전송 안함)
dadp-schema-collector \
  --db-type mysql \
  --db-host localhost --db-port 3306 \
  --db-name mydb \
  --db-user root --db-password 1234 \
  --dry-run

# Hub 등록
dadp-schema-collector \
  --db-type mysql \
  --db-host localhost --db-port 3306 \
  --db-name mydb \
  --db-user root --db-password 1234 \
  --hub-url http://localhost:9004/hub \
  --instance-id my-app-prod

# PostgreSQL
dadp-schema-collector \
  --db-type postgresql \
  --db-host localhost --db-port 5432 \
  --db-name mydb \
  --db-user postgres --db-password secret \
  --hub-url http://localhost:9004/hub \
  --instance-id my-pg-app

# 상세 로그
dadp-schema-collector \
  --db-type mysql \
  --db-host localhost \
  --db-name mydb \
  --db-user root --db-password 1234 \
  --dry-run --verbose

# 특정 스키마만 수집
dadp-schema-collector \
  --db-type postgresql \
  --db-host localhost \
  --db-name mydb \
  --db-user postgres --db-password secret \
  --schema-filter "public,app_schema" \
  --dry-run

핵심 개념 / Key Concepts

instanceId

instanceId는 별칭(alias)입니다. 동일한 instanceId를 사용하면 동일한 정책 매핑 그룹에 속합니다. Schema Collector가 등록한 instanceId와 실제 Wrapper가 사용하는 instanceId가 같으면 정책 매핑이 공유됩니다.

The instanceId is an alias. Instances sharing the same instanceId belong to the same policy mapping group. When the Schema Collector and the actual Wrapper use the same instanceId, they share policy mappings.

hubId

hubId는 Hub가 발급하는 인스턴스별 고유 ID입니다. 개별 인스턴스를 독립적으로 관리하기 위한 용도로 사용됩니다.

The hubId is a unique ID issued by Hub for each instance, used for independent instance management.

컬럼 제외 규칙 / Column Exclusion Rules

암호화 대상이 아닌 컬럼은 자동으로 제외됩니다 (Wrapper의 SchemaRecognizer와 동일한 로직):

Columns that are not encryption targets are automatically excluded (same logic as Wrapper's SchemaRecognizer):

  1. Auto-increment - AUTO_INCREMENT, serial, identity 컬럼
  2. 날짜/시간 타입 - date, time, timestamp, datetime, year
  3. UUID/GUID 타입 - uuid, guid, uniqueidentifier
  4. ID 패턴 컬럼 - id, uid, uuid, guid 또는 _id, _uid, _uuid로 끝나는 컬럼
  5. 자동 생성 타임스탬프 - created_at, updated_at 등 (날짜 타입 + 자동 기본값)
  6. 자동 생성 기본값 - CURRENT_TIMESTAMP, NOW(), gen_random_uuid() 등

출력 예시 / Output Example

DADP Schema Collector v1.0.0

[1/4] DB 연결 중... mysql://localhost:3306/mydb
      연결 성공 (MySQL 8.0.33)

[2/4] 스키마 수집 중...
      테이블 12개, 컬럼 87개 수집 (제외: 23개)

[3/4] Hub 등록 중... http://localhost:9004/hub
      datasource 등록 완료 (datasourceId: ds_7a8b9c0d1e2f)

[4/4] 스키마 동기화 중...
      87개 컬럼 Hub 전송 완료

=== 완료 ===
hubId:        pi_a1b2c3d4e5f6
datasourceId: ds_7a8b9c0d1e2f
instanceId:   my-app-prod
테이블:       12개
컬럼:         87개

Hub UI에서 암호화 정책을 매핑하세요.
Wrapper 기동 시 instanceId=my-app-prod 를 동일하게 사용하세요.

Oracle 지원 / Oracle Support

Oracle 사용 시 oracledb 패키지를 별도로 설치해야 합니다:

npm install oracledb

Node-oracledb 6.x는 Thin 모드를 지원하여 Oracle Instant Client 없이도 동작합니다.

# Oracle 사용 예시
dadp-schema-collector \
  --db-type oracle \
  --db-host localhost --db-port 1521 \
  --db-name XEPDB1 \
  --db-user app_user --db-password app_pass \
  --hub-url http://localhost:9004/hub \
  --instance-id my-oracle-app
  • --db-name서비스명 입력 (예: ORCL, XEPDB1)
  • USER_TAB_COLUMNS + USER_OBJECTS 딕셔너리 뷰를 사용하여 현재 사용자의 테이블/뷰 수집
  • Oracle Identity Column, .nextval, ISEQ$$ 패턴도 자동 증가로 감지하여 제외

검증 상태 / Verified

  • MySQL 8.0 ✅ (dry-run + Hub 등록)
  • PostgreSQL 15 ✅ (dry-run)
  • Oracle 18c XE ✅ (dry-run + Hub 등록)

상세 가이드 / Detailed Guide

상세 사용 가이드: docs/guides/schema-collector-guide.md

라이선스 / License

UNLICENSED - DADP 내부 도구