@ax-hub/admin-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,324 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [1.0.0] — 2026-05-29
6
+
7
+ First stable major. `@ax-hub/sdk` ↔ backend `main` 정렬 (110→177 routes, 36→42 error codes) + 단일 패키지에서 npm workspaces 모노레포로 전환. 거버넌스(admin) surface 36 op 을 신규 공개 패키지 **`@ax-hub/admin-sdk`** 로 분리. SDK 1차 사용자(코딩 에이전트 + member/PAT 앱)는 admin 메서드로 항상 403 을 받았으므로 main SDK 표면에서 제거하는 것이 정상화다. 마이그레이션 매핑은 [`docs/MIGRATION-1.0.md`](docs/MIGRATION-1.0.md) 참조 (ADR-0042 / ADR-0043 / ADR-0044).
8
+
9
+ ### BREAKING
10
+
11
+ - **admin 거버넌스 36 op 이동 — `@ax-hub/sdk` 에서 제거, 신규 `@ax-hub/admin-sdk` 로 이동.** 접근은 `new AdminClient({ token, tokenType })` (from `@ax-hub/admin-sdk`) 로. 매핑:
12
+ - `sdk.audit.*` (events `list`/`get`, `integrityCheck`, `anonymize`) → `adminSdk.audit.*`
13
+ - `sdk.authz.{tags,subjects,grants}` → `adminSdk.authz.*`
14
+ - `sdk.authz.evaluator` / `decide` **제거-only** — backend 공식 route 부재. backend 노출 시 후속 admin-sdk 에서 재도입.
15
+ - `sdk.tenants.{create,list,update,delete}` + members / invitations / email-domains / icon → `adminSdk.tenants.*`. **`sdk.tenants.get` 은 main 유지.**
16
+ - `sdk.identity.idp` (`IdentityProviderClient`) → `adminSdk.identityProviders.*`
17
+ - `sdk.apps.categories.{create,update,delete}` → `adminSdk.categories.*`. **`sdk.apps.categories.list`/`get` 은 main 유지.**
18
+ - **`sdk.apps.create()` 는 이제 tenant UUID(`defaultTenantId`) 를 요구**하고 미설정 시 `TenantIdRequiredError` 를 throw. 구 `POST /api/v1/apps` 404-fallback 경로 제거. `apps.list()` 는 `defaultTenantId` 설정 시 tenant-scoped, 미설정 시 live alias 호출 (US1).
19
+
20
+ ### Added
21
+
22
+ - **신규 capability ~25 (US3, non-breaking):** apps `suspend`/`resume`, app invitations `create`/`delete`, `members.list`, `discover`(global + tenant), `me/apps` (owned + received), `check-availability` + icon pre-create, tables `check-availability`/`column-types`/`browse-rows`, deploy `logs`/`app-bootstraps`/github accounts+repos, `gateway.engines`, identity github oauth `start`/`callback`, `config.public` (tokenless), reviewer review-requests history.
23
+ - **MCP + OAuth (US4):** `registerMcpClient` (Dynamic Client Registration, unauthenticated), RFC 8707 `resource`/audience binding on authorize + token, oauth-client `allowedResources`, 9 typed OAuth errors incl. 전용 `InvalidTargetError`.
24
+ - **입력/필드 drift (US5):** `CreateAppInput`/`UpdateAppInput` 신규 필드 (`authMode`, `dataScopes`, `deployMethod`, `resourceTier`, `subdomain`, `clearSubdomain`, `iconDarkUrl`), oauth-client 신규 필드, env-var `stage`, table `description`, app-list `filter`/`sort`/`page` 파라미터.
25
+
26
+ ### Changed
27
+
28
+ - backend contract pin 을 spec-278 → backend `main` 으로 전진 (110→177 routes, 36→42 error codes). error catalog 6 코드 추가 (`codes.go.snapshot` 갱신, `extract-codes` 재생성).
29
+ - OAuth 9 코드 매핑에 `invalid_target` 전용 구분 추가 (US5).
30
+
31
+ ### Infrastructure
32
+
33
+ - 단일 패키지 `@ax-hub/sdk` → **npm workspaces 모노레포** (`packages/*`). 공유 infra(http/auth/error/pagination/retry/redaction/branded-id/resource helpers)를 private **`@ax-hub/core`** (`private:true`, **미발행**) 로 추출, tsup `noExternal` 로 `@ax-hub/sdk` + `@ax-hub/admin-sdk` dist 에 inline. publish `.d.ts` 에 private core import 0 (SC-009, `check:dts-no-private-core` gate).
34
+ - 신규 공개 패키지 **`@ax-hub/admin-sdk`** (governance surface, `AdminClient`).
35
+ - public packages(sdk/admin-sdk) semver major 1.0.0 동반, private core 버전 동기화. release CI 가 두 공개 패키지를 발행 (core 는 비발행).
36
+ - ADR 신규: ADR-0042 (monorepo workspaces), ADR-0043 (BC relocation → admin-sdk), ADR-0044 (public API whitelist 재정의).
37
+
38
+ ## [0.3.0] — 2026-05-26
39
+
40
+ gateway 거버넌스 surface(`engines`/`connectors`/`resources`, `@adminOnly`)를 SDK 에서 제거하고 member-facing surface(`query` + `catalog`)만 유지 (ADR-0041). SDK 1차 사용자(코딩 에이전트 + member-token 앱)는 거버넌스 메서드로 항상 403 을 받았고, connector/engine 관리는 콘솔 관리자 작업이다.
41
+
42
+ ### BREAKING
43
+
44
+ - `gateway.{engines,connectors,resources}` 제거. member token 은 이들에 항상 `ForbiddenError`(403)였음. connector 목록·이름→UUID 는 `gateway.catalog.listConnectors()` 사용 — `CatalogConnector.id` 는 동일 connector UUID 라 `query.run({ connectorId })` 에 그대로 사용.
45
+ - 공개 타입 `GatewayEngine`/`GatewayConnector`/`GatewayResource` 제거.
46
+ - `TenantGatewayClient` 는 `query` + `catalog` props 만 노출. `GatewayClient`/`TenantGatewayClient`/`GatewayCatalogClient`, `query`/`catalog`, 모든 `Catalog*`·`GatewayQuery*` 타입·응답 헬퍼는 유지.
47
+
48
+ ## [0.2.0] — 2026-05-26
49
+
50
+ 나머지 6개 BC(identity·tenants·audit·apps·deploy·schema)를 backend golden routes + handler shape 와 전수 대조해 발견한 drift 일괄 수정 (ADR-0040). 라이브 PAT smoke 로 fixed read + 회귀 검증 (`discover.search`/`listMine`/`integrityCheck` 동작, authz/gateway/audit 무손상).
51
+
52
+ ### BREAKING
53
+
54
+ - `tenants.members.{update,deactivate,reactivate}` 반환 `TenantMember` → `void`. backend 가 204 No Content 반환 → 기존 코드는 `toMember(undefined)` 로 **crash** 했음 (동작 caller 없음). 갱신된 row 가 필요하면 `members.list()` 재조회.
55
+ - `identity.systemOAuthClients.{create,delete}` 제거. global `POST/DELETE /oauth-clients` 라우트 없음 — app-scoped 생성은 `apps.oauthClients.create(appId, …)` 사용. `get()` 은 유지.
56
+ - `deployments.{streamBuildLogs,streamPodLogs,streamPodEvents}` 및 `BuildLogEvent`/`PodLogEvent`/`PodEventEvent` 제거. backend 에 해당 SSE 라우트 부재 (gateway query.stream ADR-0037 과 동일 phantom).
57
+ - `DeploymentResponse` shape 변경: `url`/`errorMessage`/`createdAt`/`updatedAt` 제거(wire 부재), `commitSha`/`currentStage`/`imageUri`/`failureReason` 추가. `DeploymentStatus` enum 변경 (`queued`/`rolled_back` 제거 → `pending`/`pushing` 추가).
58
+ - `CreateDeploymentInput.ref` 제거 → `commitSha?`/`forceRebuild?` (backend `commit_sha`/`force_rebuild`). 기존 `ref` 는 backend 가 무시(항상 default-branch HEAD 배포)했으므로 실동작 변화 없음.
59
+ - `IntegrityCheckResult.brokenAt?: string` → `firstBadSeq?: number` (+ `reason?`). backend 는 `first_bad_seq` 반환 — 기존 `brokenAt` 은 항상 undefined 였음.
60
+
61
+ ### Fixed
62
+
63
+ - `apps.discover.search` 경로 `GET /api/v1/apps` → `GET /api/v1/apps/search`. 기존엔 list alias 를 호출해 `q`/`category`/`sort` 필터가 무시됐음 (라이브: items=4 반환 확인).
64
+ - `apps.listMine` 경로 `/api/v1/users/me/apps` → `/api/v1/me/apps/workspace`. 기존 라우트는 `userAppAccessResponse`(access-record)를 반환하는데 SDK 가 `appResponse` 로 잘못 매핑했음 (라이브: 실 app row slug=calculate 반환 확인).
65
+ - `tenants.invitations.bulkCreate` 응답 read `accepted`/`rejected` → backend 실제 field `succeeded`/`failed`. 기존엔 항상 빈 결과를 반환했음. backend 의 `message`(한국어 사용자 문구)를 `rejected[].message` 로 추가 노출.
66
+ - `deployments.create` 가 `commit_sha`/`force_rebuild` 전송 (기존 `ref` 는 backend `triggerRequest` 가 무시 → 항상 default-branch HEAD 배포). `{ commitSha }` 로 특정 commit 배포 가능.
67
+ - `audit.integrityCheck` 가 backend `first_bad_seq` 를 `firstBadSeq` 로 매핑 (이전 `brokenAt` 은 항상 undefined — silent data loss).
68
+ - `audit.anonymize` body 에서 `anonymized_id` 가 `reason` 으로 fallback 하지 않음. `reason` 은 UUID 가 아니라 400 을 유발했음.
69
+ - `apps.tables.{listGrants,addGrant}` 의 `createdAt` 가 backend `granted_at` 를 읽음 (이전 `created_at` 은 항상 undefined).
70
+
71
+ ### Known follow-ups (ADR-0040)
72
+
73
+ - works-via-fallback (미수정, 동작): `data.discover` slug-inspect probe, `data.insertMany` `/_bulk` probe, `apps.publication.unpublish` `/unpublish` probe, signIcon field alias.
74
+ - 미확인: `deploy.create` request body(`ref` vs `commit_sha`), `deploy.list` cursor vs offset, `apps.env-vars` `secret`/`stage` drop, tenant-scoped BC 의 slug→UUID 자동 resolve 여부.
75
+ - `audit.server.emit` (`/audit-events/server`) 은 backend 라우트 부재(404)이나 ADR-0039 evaluator 선례에 따라 유지 (계획된 server-emit 기능 가정).
76
+ - missing-method 커버리지 (backend 라우트 존재, SDK 미구현)는 ADR-0040 참조 — 이번 scope 밖.
77
+
78
+ ## [0.1.2] — 2026-05-26
79
+
80
+ 전 BC 라이브 smoke (PAT, 실 백엔드 20개 호출) 로 발견한 authz 경로·응답 drift 수정 (ADR-0039). 나머지 BC(identity·tenants·apps·audit·gateway)는 라이브에서 정상 확인.
81
+
82
+ ### BREAKING
83
+
84
+ - `authz.{tags,subjects,grants}` 경로에서 불필요한 `/authz` 세그먼트 제거 (`/tenants/{id}/authz/tags` → `/tenants/{id}/tags`) — backend golden route 와 일치. 이전엔 전부 404 였음 (라이브 검증: tags 5 / subjects 1 / grants 24 반환).
85
+ - `authz.{tags,subjects,grants}.list()` 반환 `PaginatedList<T>` → `T[]` — backend 가 bare array 반환 (gateway ADR-0036 와 동일). 이전엔 404 라 동작 caller 없었음. Migration: `(await authz.tags.list()).items` → `await authz.tags.list()`.
86
+
87
+ ### Known follow-ups (ADR-0039)
88
+
89
+ - `authz.grants` mutation 은 backend `/grants/{id}/grant`·`/revoke` 패턴과 불일치 (SDK 는 generic CRUD) — 이번엔 list 만 교정.
90
+ - `authz.evaluator.decide/decideMany` 는 backend 라우트 미존재 (404) — 백엔드 구현 또는 제거 결정 필요.
91
+
92
+ ## [0.1.1] — 2026-05-26
93
+
94
+ 라이브 백엔드 smoke (0.1.0 gateway 전 기능 18개) 로 발견한 `isSqlFormatError` 오분류 수정.
95
+
96
+ ### Fixed
97
+
98
+ - `isSqlFormatError` 가 라이브 deny 형식 `"SQL 형식 오류: safesql: ...only SELECT or WITH allowed (got \"delete\")"` 를 정상 인식. 이전엔 `safesql:` prefix 만 `startsWith` 매칭해, 백엔드가 한국어 prefix 로 감싼 실제 응답을 놓치고 SQL 형식 오류를 policy deny 로 오분류했음. 이제 `startsWith('SQL 형식 오류:') || includes('safesql:')` 로 양쪽 매칭 (ADR-0038 정정 — spec 의 `"SQL 형식 오류:"` prefix 가 옳았음). 나머지 gateway 표면(catalog list/get/invoke/hasAccess/helpers·query.run·governance)은 라이브에서 정상 확인.
99
+
100
+ ## [0.1.0] — 2026-05-25
101
+
102
+ backend SPEC 307 (catalog + invoke) 를 SDK 에 반영 (ADR-0038). member-facing 데이터 카탈로그 표면 신규. 기존 governance API signature 불변 (additive minor).
103
+
104
+ ### Added
105
+
106
+ - `gateway.catalog` (`GatewayCatalogClient`) — member-facing: `listKinds()` / `listConnectors()` / `listResources(filter?)` / `getResource(connector, path)` / `invoke(connector, path, {sql, params, rowLimit})` + `hasAccess()` / `listResourcesWithDetail()`. governance (connectors/resources/engines/query) 와 분리.
107
+ - `gateway.catalog.getResource` 는 권한 없는/존재 안 하는 path 에 `NotFoundError` throw (strict zero-trust — 권한 없음과 부재 구별 안 함). boolean 확인은 `hasAccess`.
108
+ - `gateway.catalog.invoke` 의 policy deny 는 throw 아닌 `{ allowed: false, denyReason }` response (HTTP 200).
109
+ - 응답/경로 helper: `isAllowed` · `isPolicyDeny` · `isSqlFormatError` · `getAccessibleColumns` · `getMaskHint` · `tableFromPath`.
110
+ - 타입: `CatalogKind` · `CatalogKindAction` · `CatalogConnector` · `CatalogResourceView` · `CatalogResourceDetail` · `CatalogPermissionsReadList` · `CatalogPermissionsReadDetail` · `CatalogAncestor` · `CatalogTag` · `CatalogResourceFilter` · `InvokeInput` · `InvokeResult`.
111
+
112
+ ### Changed (docs only — signature 불변)
113
+
114
+ - `authz.{tags,subjects,grants}.list` + `gateway.{connectors,resources}` (governance) 에 `@adminOnly` JSDoc — v0.1 backend 에서 member → `ForbiddenError` (자동 retry 무의미). member 는 `gateway.catalog` 사용.
115
+ - `query.run` JSDoc: catalog `allowedColumns` 외 column 참조 시 외부 DB column-not-found 가 500 `InternalServerError` 로 전달 (no auto-retry); deny 의미 (generic policy vs `safesql:` SQL-format) 명시.
116
+
117
+ ### Notes
118
+
119
+ - spec 의 `isSqlFormatError` 제안 리터럴 `"SQL 형식 오류:"` 는 backend 실제 prefix `"safesql:"` 로 교정 (ADR-0038). string-prefix 매칭은 brittle — helper JSDoc 경고.
120
+ - spec §3.2 의 `query` `@deprecated` 제안은 backend `/gateway/query` 제거 계획이 없어 보류 (`@see catalog.invoke` soft note).
121
+ - PAT (`identity.pat`, spec §5.3) 는 이 SDK 에 미노출 → out of scope.
122
+
123
+ ## [0.0.6] — 2026-05-25
124
+
125
+ ADR-0036 이 남긴 gateway drift follow-up 정리 (ADR-0037). 0.0.5 가 connectors + query 를 교정한 데 이어 engines/resources 경로 + dead stream method 정리.
126
+
127
+ ### BREAKING
128
+
129
+ - `gateway.query.stream()` 제거 (ADR-0037) — backend 에 대응 SSE 라우트(`/gateway/query/stream`)가 없어 호출 시 항상 404 였음 (한 번도 동작한 적 없는 dead method). Migration: 단발 조회는 `gateway.query.run()` 사용. 스트리밍 조회는 backend 미지원.
130
+
131
+ ### Fixed
132
+
133
+ - `gateway.resources.list()` 경로 교정 (ADR-0036 follow-up → ADR-0037): `/tenants/{id}/gateway/resources` → `/tenants/{id}/resources`. 기존 경로는 backend 404. connectors 와 동일한 tenant-root 패턴 (대칭 회복). 호출 코드 변경 없음 (SDK 내부 경로).
134
+ - `gateway.engines.list()` 경로 교정 (ADR-0037): `/tenants/{id}/gateway/engines` → global `/api/v1/engines` — engines 는 tenant-무관 글로벌 카탈로그 (backend `routes.go`). 접근자(`tenant(t).gateway.engines`)는 BC 위해 유지, URL 만 global. 호출 코드 변경 없음.
135
+
136
+ ### Added
137
+
138
+ - `TenantGatewayClient` export (ADR-0037) — `sdk.tenant(id).gateway` 의 반환 타입. helper 의 반환 타입 주석에 사용 가능 (이전엔 미export 라 추론에만 의존).
139
+
140
+ ## [0.0.5] — 2026-05-25
141
+
142
+ ### BREAKING
143
+
144
+ - `gateway.connectors.list()` / `gateway.resources.list()` 반환 `PaginatedList<T>` → `T[]` — backend gateway list 엔드포인트가 pagination 봉투 없이 bare array 반환 (ADR-0036). Migration: `const { items } = await tenant.gateway.connectors.list()` → `const items = await tenant.gateway.connectors.list()` (cursor/total 처리 제거).
145
+ - `gateway.connectors` 경로가 tenant root 로 이동 (`/tenants/{id}/gateway/connectors` → `/tenants/{id}/connectors`) — 기존 경로는 backend 에서 404 였음 (ADR-0036). 호출 코드 변경 없음 (SDK 내부 경로).
146
+ - `GatewayQueryResult` 모양 변경 (ADR-0036): `{ rows, rowCount, auditEventId }` → `{ allowed, denyReason?, columns, rows, rowCount, matchedPolicies? }`. `auditEventId` 제거 (backend query 응답에 없어 항상 undefined 였음). `query.run` 이 backend 의 positional `rows: [][]any` + `columns` 를 객체 배열로 zip — 이전엔 `rows` 가 `Row[]` 로 타입됐지만 실제론 매핑 안 된 배열이었음. Migration: `res.rows[i].colName` 이 이제 실제 동작; `res.auditEventId` 사용처 제거; policy deny 는 `res.allowed === false` + `res.denyReason` 로 확인.
147
+
148
+ ### Internal
149
+
150
+ - **harness revamp (2026-05-22)** — agent-first SDK 유지보수 인프라 신규 구축. 회사 인계 + 신규 maintainer 대비.
151
+ - `AGENTS.md` rewrite: 8 BC + 16 invariants + BC-specific rules summary + verification matrix + workflow + anti-patterns. LLM-agnostic (Claude/Codex/Cursor 모두 root에서 자동 인식).
152
+ - `CLAUDE.md`에 `<!-- sdk-rules:start -->...<!-- sdk-rules:end -->` managed block 추가. GitNexus block과 분리.
153
+ - per-domain `CLAUDE.md` × 7: `src/resources/`, `src/resources/apps/`, `src/resources/data/`, `src/errors/`, `codegen/`, `tests/`, `scripts/`. Claude Code 작업 디렉토리 자동 컨텍스트.
154
+ - `docs/decisions/` ADR catalog (MADR format) × 35: `.plan/` 31+ 결정을 영구 보존. `README.md` 인덱스.
155
+ - `docs/MAINTAINING.md`: 회사 인수자 onboarding (week 1 / month 3 / month 12 milestones + first PR walkthrough + common pitfalls).
156
+ - `lefthook.yml` pre-commit: priority 1 `build:raw` 후 priority 2 `typecheck`/`test:unit`/`extract-codes`/`route-inventory-diff`/`check:size:fast`/`check:dist-wire:fast` parallel. race-free.
157
+ - `package.json` `prepare: lefthook install` — `npm install` 시 hook 자동 설치. `lefthook` devDep 추가.
158
+ - `check:size:fast` + `check:dist-wire:fast` script variants — pre-commit용 (build 호출 안 함, dist/ exists guard 추가).
159
+ - `tests/lefthook-smoke/` × 6 fixture + `run.sh` + `.github/workflows/lefthook-smoke.yml`: invariant 위반 패턴 (한국어 substring, mock parity, cursor v2 bypass, BC boundary, redaction leak, prototype pollution)이 실제 차단되는지 PR마다 검증.
160
+ - `.github/PULL_REQUEST_TEMPLATE.md`: 16 invariant checklist + ADR link field + verification checklist.
161
+ - `.plan/` 삭제 — rationale은 `docs/decisions/` ADR로 영구 이관.
162
+ - `TODOS.md` deferred to v1.1+: sdk-onboard skill, harness-fidelity eval, extract-decisions automation, AGENTS↔ADR sync script, ADR index 자동 생성.
163
+
164
+ ## [0.0.4] — 2026-05-22
165
+
166
+ PR #12 종합 리뷰 (8 ce reviewers) 결과 반영 — D36 scope freeze 명시적 override (2026-05-22). 75 finding → 25 distinct → 8 stories.
167
+
168
+ ### BREAKING
169
+
170
+ - `list()` `nextCursor` wire format — `orderBy`/`after`/`before` 또는 v2 cursor 입력 시 `v2:<base64-url>` 키셋 토큰 반환. 기존 순수 정수 cursor 는 plain page 호환을 위해 계속 수용되지만 `v1:` 접두사 토큰은 이제 `LegacyCursorError` throw.
171
+ - `list()` 진입부 `cursor` 검증 강화 — v2/v1 접두사 아닌 cursor 가 정수가 아니면 `InvalidCursorError` throw (silent NaN 폴백 차단).
172
+ - `v2:` cursor 토큰에 `contextFingerprint` (tenant+app+table SHA8) 가 SDK 측에서 주입되며 디코드 시 mismatch 면 `InvalidCursorError` throw — 다른 테이블의 cursor 재생 차단.
173
+ - `v2:` cursor 토큰 size 상한 `MAX_CURSOR_TOKEN_LENGTH=4096` — 초과 시 `InvalidCursorError` (base64 DoS 가드).
174
+ - mock `get/update/delete` 가 `NotFoundError` throw — 실 백엔드 404 동작과 일치 (이전: `get` = null cast, `delete` = silent). drop-in parity 의 핵심 누락 해소.
175
+ - mock `insert` 가 중복 id 시 `ConflictError` (code=`duplicate_key`, httpStatus=409) throw — 이전: 일반 `Error`. `instanceof AxHubError` 분기를 가진 호출자가 mock/real 일관 처리 가능.
176
+ - `defineSchema().validate` 타입이 `unknown` → `ZodSchemaLike` 로 좁혀짐 — 잘못된 입력 컴파일 단계 차단.
177
+
178
+ ### Added
179
+
180
+ - `ScanLimitExceededError` (`InternalServerError` 계열, code=`scan_limit_exceeded`) — `count({where})` 가 100K 행 스캔 한도 초과 시, `discover()` app-id fallback 이 10 페이지 한도 초과 시 throw.
181
+ - `MAX_CURSOR_TOKEN_LENGTH` 상수 export.
182
+ - `assertCursorMatchesContext` 함수 — SDK 자체에서 cursor scope 검증.
183
+ - `KeysetCursor.contextFingerprint` 옵션 필드, `CursorBuildOptions.contextFingerprint` 옵션.
184
+ - `PaginatedList.totalIsExact?: boolean` — `where` 적용 + 백엔드 미푸시다운 시 `false` 마킹, caller 가 page-당 partial count 임을 인지 가능.
185
+ - `assertSafeLikePattern()` + `MAX_LIKE_PATTERN_LENGTH`/`MAX_CONSECUTIVE_WILDCARDS`/`MAX_LIKE_ALTERNATION_SEGMENTS` 상수 — `like.raw()` 진입부에서 ReDoS 패턴 거부.
186
+
187
+ ### Changed
188
+
189
+ - `assertMockModeAllowed()` — `NODE_ENV` 대소문자/공백 정규화 (`'Production '` / `'PRODUCTION'` 인식), `AX_HUB_ALLOW_MOCK_IN_PROD` 가 `'1'/'true'/'yes'/'on'` (대소문자/공백 무시) truthy 파싱.
190
+ - `SchemaCache` 5xx 응답 시 30 초 negative TTL 로 이전 stale 엔트리 보존 (stale-while-error) → degraded backend 동안 thundering herd 방지. `negativeTtlMs` 옵션으로 조정 가능 (default `DEFAULT_SCHEMA_CACHE_NEGATIVE_TTL_MS = 30000`).
191
+ - `SchemaCache.getOrSet` 가 monotonic write token 으로 stale-write race 차단 — `fresh:true` 추월이 stale `set` 으로 overwrite 못 함.
192
+ - `SchemaCache.getOrSet` 가 loader rejection 시 즉시 inflight 키 evict (다음 콜러 retry 가능). transient 5xx 만 stale entry 복원.
193
+ - `count({where})` 가 page 크기 100 → 1000 + 최대 100 페이지 (10만 행) 스캔 상한 + 매 iteration `signal.aborted` 검사.
194
+ - `discover()` app-id 폴백 (`resolveAppId`) 가 5 초 총 budget + `signal` per-page threading + 빈 첫 페이지 즉시 `TableNotFoundError` + 페이지 한도 초과 시 `ScanLimitExceededError`.
195
+ - `inferSchemaFromRows` UUID 정규식 RFC4122 정확 (`^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`) — 이전 `[0-9a-f-]{27,}` false-positive 제거.
196
+ - `src/mock/index.ts` wildcard `export *` 제거 → `createMockStore`/`assertMockModeAllowed`/`MockClientOptions`/`MockStore`/`MockFixtures`/`MockSchemas`/`MockRow` 만 named export. DSL evaluator/CRUD 핸들러/페이지네이션/projection internal 화.
197
+ - `src/mock/projection.ts` 단일 라인 re-export 파일 삭제 (consumer 들이 `src/resources/data/projection.js` 직접 import).
198
+ - `schemaFromInspectResult` 가 `__proto__`/`constructor`/`prototype` 등 위험 컬럼명 거부 + identifier-shape regex 검증 (defense-in-depth, prototype pollution 시나리오 봉쇄).
199
+ - mock `paginateRows` 가 cursor tiebreaker row 가 삭제된 경우 page1 silent 재출력 대신 `InvalidCursorError` throw.
200
+ - mock pagination 의 plain cursor 가 정수 아니면 `InvalidCursorError` throw.
201
+
202
+ ### Fixed
203
+
204
+ - DSL 평가 single truth — `src/resources/data/index.ts` 의 `matchesWhere`/`compare`/`likeToRegExp`/`escapeRegExp` 4 함수 삭제. live + mock 양쪽이 `src/mock/dsl-evaluator.ts` 의 `evaluateWhere` 만 사용 (D32a). `eq null` 등 PG NULL trinary 가 양쪽 일관.
205
+ - mock `evaluateWhere` 의 `gt/gte/lt/lte` 가 null 측 명시적 false 분기 — 이전 `compare` NaN 의존 → 명시적 PG trinary 매핑.
206
+ - `PaginatedList.hasPrev` 가 v2 cursor 폴백 경로 (`opts.cursor && isV2Cursor`) 포함 — 이전: `after`/`before` 직접 입력 시만 true.
207
+ - `PaginatedList.total` 이 `where` 모드 시 잘못된 `items.length` (페이지 당 매치 카운트) 가 아닌 백엔드 `raw.total` (unfiltered) + `totalIsExact:false` 마킹 — caller 가 자체 inference 가능.
208
+ - mock `count` / `list` 응답에 `totalIsExact: true` 마킹 (전수 in-memory 평가).
209
+
210
+ ### Verification
211
+
212
+ - `npm run typecheck`
213
+ - `npm run test`
214
+ - `npm run build`
215
+ - `npm run check:size`
216
+ - `npm run check:dist-wire`
217
+ - `npm run readme:doctest`
218
+
219
+ ## [1.0.0-rc.1] — 2026-05-21
220
+
221
+ SDK master-plan implementation across foundation, identity/tenants, authz/audit/gateway, data DSL, codegen, webhook/idempotency, and DevEx gates.
222
+
223
+ ### Breaking
224
+
225
+ - Build output is now minified to keep the ESM main bundle under the 100KB budget.
226
+
227
+ ### Migration
228
+
229
+ ```ts
230
+ // Before (0.x aliases, kept for compatibility until RC cleanup)
231
+ await sdk.identity.issuePersonalAccessToken({ name: 'ci' })
232
+
233
+ // Preferred
234
+ await sdk.identity.pat.issue({ name: 'ci' })
235
+ ```
236
+
237
+ Run `node --experimental-strip-types codemods/0.x-to-1.0.ts <files...>` for textual alias migration.
238
+
239
+ ### Added
240
+
241
+ - `sdk.tenant(slug)` / `sdk.tenant(slug).app(appSlug)` scoped clients.
242
+ - `sdk.tenants` members, invitations, email domains, icon upload.
243
+ - `sdk.identity.pat`, `oauth`, `oidc`, `deviceCode`, `idp`, and `systemOAuthClients` sub-namespaces.
244
+ - `sdk.authz`, `sdk.audit`, `sdk.gateway`, and `sdk.data` bounded-context clients.
245
+ - Type-safe data DSL: `defineSchema`, `where`, `and/or/not`, `raw`, `escapeLike`.
246
+ - Dynamic data advanced track: `data.discover()` runtime introspection with per-client schema cache; optional Zod-compatible `defineSchema(..., { validate })`; `select` projection with `Pick<>` narrowing; v2 keyset cursor helpers (`after`/`before`, `firstCursor`, `hasNext`/`hasPrev`); and `mode: "mock"` fixture-backed data clients with 55-scenario parity coverage.
247
+ - Webhook HMAC verification with timestamp tolerance and replay cache.
248
+ - Codegen outputs under `codegen/generated/` plus route inventory drift checks.
249
+ - DevEx utilities: `bench:tthw`, `check:size`, minimal `ax-hub-sdk doctor`, opt-in E2E smoke test, README-ko, examples.
250
+
251
+ ### Verification
252
+
253
+ - `npm run typecheck`
254
+ - `npm run test`
255
+ - `npm run build`
256
+ - `npm run generate`
257
+ - `npm run extract-codes`
258
+ - `npm run route-inventory-diff`
259
+ - `npm run check:size`
260
+
261
+ ## [0.2.0] — 2026-05-15
262
+
263
+ apps SDK expansion. Phase 1 aha demo (`apps.create` + `deployments` + auth) extends to publication workflow, social loop (likes/comments/access), schema admin (tables/grants), oauth-clients, git connection, icon upload, and admin review namespace. 28 / 28 apps backend context endpoints covered.
264
+
265
+ ### Added
266
+
267
+ - **Publication workflow**: `sdk.apps.publication.submit/list/unpublish` (owner) + `sdk.publicationRequests.get/approve/reject/listPending` (reviewer/admin) — full state machine for `draft → pending_review → approved → public`.
268
+ - **Social loop**: `sdk.apps.likes.like/unlike/me` (idempotent — backend returns `inserted` / `deleted` booleans), `sdk.apps.comments.add/list/listAll/delete` (1-500 char client-side validation, paginated iterator), `sdk.apps.access.grant/revoke/me` (self-grant; `me()` returns `null` for 404).
269
+ - **Schema admin**: `sdk.apps.tables.list/create/delete/addColumn/dropColumn/listGrants/addGrant/revokeGrant`. Table name regex `^[a-z][a-z0-9_]{0,62}$` validated client-side via `validateTableName`.
270
+ - **OAuth clients**: `sdk.apps.oauthClients.create/delete`. `create` returns `clientSecret` raw — **surfaced exactly once**, store immediately (PAT pattern).
271
+ - **Git connection**: `sdk.apps.git.connect/installStart` — GitHub App install flow + repo binding.
272
+ - **App lifecycle additions**: `sdk.apps.permanent` (hard-purge soft-deleted app), `sdk.apps.signIconUploadURL`/`signIconDarkUploadURL` (presigned PUT), `sdk.apps.listMine` (apps caller has access to, distinct from tenant-scoped `list`).
273
+ - **Error subclasses** (19 new): `AlreadyRevokedError`, `AlreadySettledError`, `AlreadyActiveError`, `AlreadyInactiveError`, `AlreadyAccessedError`, `NotDeletedError`, `LastAdminError`, `PendingExistsError`, `InvalidStateTransitionError`, `SchemaNameTakenError`, `DomainTakenError`, `DuplicateError`, `NotMemberError`, `NotAllowedError`, `InvalidValueError`, `RequiredError`, `EmptyError`, `BadRequestError`, `AppUnavailableError`. All mapped from backend `codes.go` (b7d2e6a).
274
+ - **`validateTableName`** helper in `src/utils/slug.ts`.
275
+ - **`examples/social-app-demo.ts`** — end-to-end publication workflow + social loop demo.
276
+
277
+ ### Coverage
278
+
279
+ - 28 / 28 apps backend context endpoints (100%).
280
+ - 9 new integration test files: publication, access, likes, comments, tables, oauth-clients, git, publication-requests, plus apps-flow extensions.
281
+ - Test count: 73 → 130+ tests.
282
+
283
+ ### NOT in this release
284
+
285
+ - **Data API** (`/data/{tenantSlug}/{appSlug}/{table}/*`) — runtime CRUD against tables you created via `tables.*`. Backend dispatcher Phase 2 dependency. Workaround in v0.2: use `sdk.http.request` directly for raw fetch. Tracked for v0.2.2.
286
+ - **Tenants context** (`sdk.tenants.*`, `categories`) — next PR.
287
+ - **Identity OAuth admin** — Identity BC namespace, separate PR.
288
+ - MCP server bundle (v1.1), browser bundle (v1.2).
289
+
290
+ ### Backend dependencies
291
+
292
+ - Pinned against backend `main` HEAD `b7d2e6a` (apps dispatcher on spec 278 신형식). `schema` BC dispatcher legacy — `tables.*` relies on HTTP-status fallback for category dispatch; specific subclass mapping may miss until backend completes Phase 2 dispatcher migration.
293
+
294
+ ---
295
+
296
+ ## [0.1.0] — 2026-05-14
297
+
298
+ Initial Phase 1 development. v0.1.0 release.
299
+
300
+ ### Added
301
+
302
+ - `AxHubClient` with PAT and JWT auth modes (+ JWT refresh dedupe)
303
+ - Backend wrapped envelope error dispatch (spec 278 land): 9 category base classes (`ValidationError`, `UnauthenticatedError`, `PermissionDeniedError`, `NotFoundError`, `ConflictError`, `PreconditionFailedError`, `RateLimitedError`, `InternalServerError`, `UnavailableError`) + 10 specific code subclasses (`SlugTakenError`, `TokenExpiredError`, `NotAdminError`, `PermanentlyDeletedError`, …)
304
+ - OAuth RFC 6749 separate dispatch path (`OAuthError` + specific codes for Device Flow)
305
+ - SSE async iterator with client-side dedupe + gap detection (Phase 0 finding: backend hub.go ignores `Last-Event-ID`)
306
+ - Pagination `listAll` async iterator with drift event emission
307
+ - Rate limit handling — `Retry-After` honor, `'sleep' | 'throw'` strategies
308
+ - `X-Request-Id` (ULID) auto-injection per request, surfaced on every `AxHubError.requestId`
309
+ - Tenant scoping — `defaultTenantSlug`, `withTenant`, `TenantSlugRequiredError`
310
+ - Resources: `sdk.apps.*` (CRUD + env-vars, directory split), `sdk.deployments.*` (lifecycle + 3 SSE streams), `sdk.identity.*` (PAT issuance, me)
311
+ - Injectable logger interface + Authorization/X-Api-Key/Cookie redaction
312
+ - Dual ESM/CJS build via tsup, strict TypeScript, vitest test runner
313
+
314
+ ### Coverage
315
+
316
+ - 73 tests (60 unit + 13 integration)
317
+ - 18 / 77 backend endpoints (aha demo path). Phase 2 fills out remaining 59.
318
+
319
+ ### Known limitations
320
+
321
+ - Backend `Last-Event-ID` on SSE not honored; SDK dedupes + emits `GapDetectedEvent`. Backend follow-up issue tbd.
322
+ - Backend `Idempotency-Key` not supported; SDK does not auto-inject and refuses to retry POST/PATCH/DELETE.
323
+ - MCP server bundle (v1.1), browser bundle (v1.2), CLI tool, OpenTelemetry native: deferred.
324
+ - `codegen/extract-codes.ts` was still unwired — `src/errors/code-map.ts` was a hand-written stub mirroring backend `codes.go` registry.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 jocoding-ax-partners
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing permissions
201
+ and limitations under the License.