@cp949/japanpost-react 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.
@@ -0,0 +1,7 @@
1
+ import { JapanAddressError } from '../core/types';
2
+ /**
3
+ * 알 수 없는 에러를 JapanAddressError로 변환한다.
4
+ * 이미 JapanAddressError(code 필드를 가진 객체)이면 그대로 반환한다.
5
+ */
6
+ export declare function toJapanAddressError(error: unknown): JapanAddressError;
7
+ //# sourceMappingURL=toJapanAddressError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toJapanAddressError.d.ts","sourceRoot":"","sources":["../../src/react/toJapanAddressError.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAiBrE"}
@@ -0,0 +1,7 @@
1
+ import { UseJapanAddressOptions, UseJapanAddressResult } from '../core/types';
2
+ /**
3
+ * 우편번호 조회와 키워드 주소 검색을 하나의 인터페이스로 제공하는 통합 훅.
4
+ * 두 검색 모드가 공유하는 data source를 내부에서 재사용한다.
5
+ */
6
+ export declare function useJapanAddress(options: UseJapanAddressOptions): UseJapanAddressResult;
7
+ //# sourceMappingURL=useJapanAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useJapanAddress.d.ts","sourceRoot":"","sources":["../../src/react/useJapanAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAIvB;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CA6EvB"}
@@ -0,0 +1,7 @@
1
+ import { UseJapanAddressSearchOptions, UseJapanAddressSearchResult } from '../core/types';
2
+ /**
3
+ * 자유 형식 키워드로 일본 주소를 검색하는 훅.
4
+ * 디바운스를 지원하며 loading / data / error 상태와 search / reset 함수를 제공한다.
5
+ */
6
+ export declare function useJapanAddressSearch(options: UseJapanAddressSearchOptions): UseJapanAddressSearchResult;
7
+ //# sourceMappingURL=useJapanAddressSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useJapanAddressSearch.d.ts","sourceRoot":"","sources":["../../src/react/useJapanAddressSearch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AAYvB;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CAwI7B"}
@@ -0,0 +1,7 @@
1
+ import { UseJapanPostalCodeOptions, UseJapanPostalCodeResult } from '../core/types';
2
+ /**
3
+ * 일본 우편번호로 주소를 조회하는 훅.
4
+ * loading / data / error 상태와 search / reset 함수를 제공한다.
5
+ */
6
+ export declare function useJapanPostalCode(options: UseJapanPostalCodeOptions): UseJapanPostalCodeResult;
7
+ //# sourceMappingURL=useJapanPostalCode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useJapanPostalCode.d.ts","sourceRoot":"","sources":["../../src/react/useJapanPostalCode.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAIV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAYvB;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,wBAAwB,CA2D1B"}
@@ -0,0 +1,17 @@
1
+ import { JapanAddressError } from '../core/types';
2
+ type BeginRequestResult = {
3
+ requestId: number;
4
+ signal: AbortSignal;
5
+ };
6
+ export declare function useLatestRequestState<TResult>(): {
7
+ loading: boolean;
8
+ data: TResult | null;
9
+ error: JapanAddressError | null;
10
+ beginRequest: () => BeginRequestResult;
11
+ setSuccess: (requestId: number, result: TResult) => void;
12
+ setFailure: (requestId: number, nextError: JapanAddressError) => null;
13
+ finishRequest: (requestId: number) => void;
14
+ reset: () => void;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=useLatestRequestState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLatestRequestState.d.ts","sourceRoot":"","sources":["../../src/react/useLatestRequestState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO;;;;wBA4BN,kBAAkB;4BAiBZ,MAAM,UAAU,OAAO;4BAOpD,MAAM,aAAa,iBAAiB;+BAWJ,MAAM;;EAwBrD"}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@cp949/japanpost-react",
3
+ "version": "1.0.0",
4
+ "description": "Headless React hooks and optional components for Japan Post postcode and address search",
5
+ "type": "module",
6
+ "author": "cp949",
7
+ "license": "ISC",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/cp949/japanpost-react.git"
11
+ },
12
+ "homepage": "https://github.com/cp949/japanpost-react",
13
+ "bugs": {
14
+ "url": "https://github.com/cp949/japanpost-react/issues"
15
+ },
16
+ "main": "dist/index.umd.cjs",
17
+ "module": "dist/index.es.js",
18
+ "types": "dist/index.d.ts",
19
+ "sideEffects": false,
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "engines": {
29
+ "node": ">=20"
30
+ },
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.es.js",
35
+ "require": "./dist/index.umd.cjs"
36
+ }
37
+ },
38
+ "keywords": [
39
+ "japan",
40
+ "postcode",
41
+ "postal-code",
42
+ "address",
43
+ "react"
44
+ ],
45
+ "peerDependencies": {
46
+ "react": "^18.0.0 || ^19.0.0",
47
+ "react-dom": "^18.0.0 || ^19.0.0"
48
+ },
49
+ "devDependencies": {
50
+ "@testing-library/jest-dom": "^6.9.1",
51
+ "@testing-library/react": "^16.3.2",
52
+ "@types/node": "^25.5.0",
53
+ "@types/react": "^19.2.14",
54
+ "@types/react-dom": "^19.2.3",
55
+ "@vitejs/plugin-react": "^6.0.1",
56
+ "jsdom": "^29.0.1",
57
+ "react": "^19.2.4",
58
+ "react-dom": "^19.2.4",
59
+ "typescript": "5.9.3",
60
+ "vite": "^8.0.1",
61
+ "vite-plugin-dts": "^4.5.4",
62
+ "vitest": "^4.1.0",
63
+ "@repo/typescript-config": "0.0.0"
64
+ },
65
+ "scripts": {
66
+ "dev": "vite build --watch",
67
+ "build": "tsc && vite build",
68
+ "release": "pnpm --dir ../.. readme:package && pnpm --dir ../.. test && pnpm build && pnpm publish --access public --no-git-checks",
69
+ "preview": "vite preview",
70
+ "lint": "biome lint .",
71
+ "check-types": "tsc --noEmit",
72
+ "test": "pnpm test:unit",
73
+ "test:artifacts": "pnpm build && vitest run tests/packageArtifacts.test.ts",
74
+ "test:unit": "vitest run",
75
+ "test:watch": "vitest"
76
+ }
77
+ }