@orrery/core 0.3.0 → 0.4.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/README.en.md +241 -0
- package/README.ja.md +241 -0
- package/README.md +2 -0
- package/README.zh.md +241 -0
- package/dist/{chunk-ETDERV6C.js → chunk-6PLRETU5.js} +27 -6
- package/dist/{chunk-CISACDIA.js → chunk-APL4STY7.js} +1 -1
- package/dist/{chunk-VJDUZB5T.js → chunk-EXYPMSUR.js} +119 -0
- package/dist/{chunk-DGSIRAXF.js → chunk-JLKMDX3R.js} +138 -11
- package/dist/{chunk-6BKZDAMP.js → chunk-NSFWX6RO.js} +60 -27
- package/dist/{chunk-OCPJGMZC.js → chunk-WOQT7EBV.js} +71 -51
- package/dist/cities.d.ts +4 -2
- package/dist/cities.js +1 -1
- package/dist/constants.d.ts +12 -1
- package/dist/constants.js +21 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -6
- package/dist/natal.js +1 -1
- package/dist/pillars.d.ts +14 -6
- package/dist/pillars.js +10 -2
- package/dist/saju.js +3 -3
- package/dist/types.d.ts +44 -4
- package/dist/ziwei.js +2 -2
- package/package.json +1 -1
package/README.en.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
[한국어](./README.md) | **English** | [中文](./README.zh.md) | [日本語](./README.ja.md)
|
|
2
|
+
|
|
3
|
+
# @orrery/core
|
|
4
|
+
|
|
5
|
+
A calculation engine for Eastern and Western divination that runs in browser and Node.js environments.
|
|
6
|
+
|
|
7
|
+
- **四柱八字 (Four Pillars of Destiny)** — 60 干支 cycle, 十神, 12운성, 12신살, 大運, stem-branch interaction analysis
|
|
8
|
+
- **紫微斗數 (Purple Star Astrology)** — 命盤 generation, 大限, 流年/流月 analysis
|
|
9
|
+
- **Western Astrology Natal Chart** — Planet positions, houses, angles, aspects (pure TypeScript)
|
|
10
|
+
|
|
11
|
+
No backend required. All calculations are performed on the client.
|
|
12
|
+
|
|
13
|
+
**[Live Demo →](https://rath.github.io/orrery/)**
|
|
14
|
+
|
|
15
|
+
## Credits
|
|
16
|
+
|
|
17
|
+
- **Saju Perpetual Calendar** — Originally a Perl [perpetual calendar](http://afnmp3.homeip.net/~kohyc/calendar/cal20000.html) by Ko Young-chang, [ported to PHP](https://github.com/OOPS-ORG-PHP/Lunar) by Kim Jeong-gyun. In November 2018, Hwang Jang-ho ported it to Java and Python for personal use, then ported it to TypeScript in February 2026 using Claude Code (Opus 4.6).
|
|
18
|
+
- **紫微斗數 Chart** — Built on the [lunar-javascript](https://www.npmjs.com/package/lunar-javascript) library; Claude (Opus 4.5) implemented it while researching Chinese-language references.
|
|
19
|
+
- **Astrology Natal Chart** — The Moshier ephemeris from [Swiss Ephemeris](https://www.astro.com/swisseph/) ported to pure TypeScript.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @orrery/core
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### 四柱八字 (Four Pillars of Destiny)
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { calculateSaju } from '@orrery/core/saju'
|
|
33
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
34
|
+
|
|
35
|
+
const input: BirthInput = {
|
|
36
|
+
year: 1993, month: 3, day: 12,
|
|
37
|
+
hour: 9, minute: 45,
|
|
38
|
+
gender: 'M',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const result = calculateSaju(input)
|
|
42
|
+
|
|
43
|
+
// Four Pillars (hour, day, month, year order)
|
|
44
|
+
for (const p of result.pillars) {
|
|
45
|
+
console.log(p.pillar.ganzi) // '乙巳', '壬辰', '乙卯', '癸酉'
|
|
46
|
+
console.log(p.stemSipsin) // Heavenly Stem 十神
|
|
47
|
+
console.log(p.branchSipsin) // Earthly Branch 十神
|
|
48
|
+
console.log(p.unseong) // 12운성
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 大運 (Major Life Periods)
|
|
52
|
+
for (const dw of result.daewoon) {
|
|
53
|
+
console.log(`${dw.ganzi} (age ${dw.age}~)`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Stem-Branch Interactions (合, 沖, 刑, 破, 害)
|
|
57
|
+
for (const [key, pair] of result.relations.pairs) {
|
|
58
|
+
console.log(key, pair.stem, pair.branch)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 紫微斗數 (Purple Star Astrology)
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { createChart, calculateLiunian, getDaxianList } from '@orrery/core/ziwei'
|
|
66
|
+
|
|
67
|
+
// Generate 命盤
|
|
68
|
+
const chart = createChart(1993, 3, 12, 9, 45, true)
|
|
69
|
+
|
|
70
|
+
console.log(chart.mingGongZhi) // 命宮 Earthly Branch
|
|
71
|
+
console.log(chart.shenGongZhi) // 身宮 Earthly Branch
|
|
72
|
+
console.log(chart.wuXingJu.name) // Five Elements Bureau (e.g., '水二局')
|
|
73
|
+
|
|
74
|
+
// Stars in each palace
|
|
75
|
+
for (const [name, palace] of Object.entries(chart.palaces)) {
|
|
76
|
+
const stars = palace.stars.map(s => {
|
|
77
|
+
const sihua = s.siHua ? `(${s.siHua})` : ''
|
|
78
|
+
return `${s.name}${s.brightness}${sihua}`
|
|
79
|
+
})
|
|
80
|
+
console.log(`${name} [${palace.ganZhi}]: ${stars.join(', ')}`)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 大限 (Major Life Periods)
|
|
84
|
+
const daxianList = getDaxianList(chart)
|
|
85
|
+
for (const dx of daxianList) {
|
|
86
|
+
console.log(`${dx.ageStart}~${dx.ageEnd}세: ${dx.palaceName} ${dx.ganZhi}`)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 流年 (Annual Fortune) — Fortune for a specific year
|
|
90
|
+
const liunian = calculateLiunian(chart, 2026)
|
|
91
|
+
console.log(liunian.natalPalaceAtMing) // Natal palace where 流年命宮 falls
|
|
92
|
+
console.log(liunian.siHua) // 流年 四化
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Western Astrology (Natal Chart)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { calculateNatal } from '@orrery/core/natal'
|
|
99
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
100
|
+
|
|
101
|
+
const input: BirthInput = {
|
|
102
|
+
year: 1993, month: 3, day: 12,
|
|
103
|
+
hour: 9, minute: 45,
|
|
104
|
+
gender: 'M',
|
|
105
|
+
latitude: 37.5665, // Seoul (optional, default: Seoul)
|
|
106
|
+
longitude: 126.9780,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const chart = await calculateNatal(input)
|
|
110
|
+
|
|
111
|
+
// Planet positions
|
|
112
|
+
for (const planet of chart.planets) {
|
|
113
|
+
console.log(`${planet.id}: ${planet.sign} ${planet.degreeInSign.toFixed(1)}°`)
|
|
114
|
+
// 'Sun: Pisces 21.6°'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ASC / MC
|
|
118
|
+
console.log(`ASC: ${chart.angles.asc.sign}`)
|
|
119
|
+
console.log(`MC: ${chart.angles.mc.sign}`)
|
|
120
|
+
|
|
121
|
+
// Houses (default: Placidus)
|
|
122
|
+
for (const house of chart.houses) {
|
|
123
|
+
console.log(`House ${house.number}: ${house.sign} ${house.degreeInSign.toFixed(1)}°`)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Aspects
|
|
127
|
+
for (const aspect of chart.aspects) {
|
|
128
|
+
console.log(`${aspect.planet1} ${aspect.type} ${aspect.planet2} (orb: ${aspect.orb.toFixed(1)}°)`)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Change house system (Koch)
|
|
132
|
+
const kochChart = await calculateNatal(input, 'K')
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Low-Level API
|
|
136
|
+
|
|
137
|
+
You can also use individual functions directly:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { getFourPillars, getDaewoon, getRelation } from '@orrery/core/pillars'
|
|
141
|
+
import { STEM_INFO, ELEMENT_HANJA } from '@orrery/core/constants'
|
|
142
|
+
|
|
143
|
+
// Calculate only the four pillars
|
|
144
|
+
const [년주, 월주, 일주, 시주] = getFourPillars(1993, 3, 12, 9, 45)
|
|
145
|
+
console.log(년주, 월주, 일주, 시주) // '癸酉', '乙卯', '壬辰', '乙巳'
|
|
146
|
+
|
|
147
|
+
// 十神 relationship
|
|
148
|
+
const relation = getRelation('壬', '乙')
|
|
149
|
+
console.log(relation?.hanja) // '傷官'
|
|
150
|
+
|
|
151
|
+
// Heavenly Stem Five Elements info
|
|
152
|
+
console.log(STEM_INFO['壬']) // { yinyang: '+', element: 'water' }
|
|
153
|
+
console.log(ELEMENT_HANJA['water']) // '水'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### City Data
|
|
157
|
+
|
|
158
|
+
Provides Korean and world major city data for birth location input:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import { SEOUL, filterCities, formatCityName } from '@orrery/core/cities'
|
|
162
|
+
|
|
163
|
+
console.log(SEOUL) // { name: '서울', lat: 37.5665, lon: 126.9780 }
|
|
164
|
+
|
|
165
|
+
// Supports Korean initial consonant search
|
|
166
|
+
const results = filterCities('ㅂㅅ') // Matches '부산'
|
|
167
|
+
console.log(formatCityName(results[0])) // '부산'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Running Examples
|
|
171
|
+
|
|
172
|
+
After cloning the repository, you can run the example scripts directly:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
git clone https://github.com/rath/orrery.git
|
|
176
|
+
cd orrery
|
|
177
|
+
bun install
|
|
178
|
+
|
|
179
|
+
# 사주팔자
|
|
180
|
+
bun packages/core/examples/saju.ts
|
|
181
|
+
|
|
182
|
+
# 자미두수
|
|
183
|
+
bun packages/core/examples/ziwei.ts
|
|
184
|
+
|
|
185
|
+
# 서양 점성술 출생차트
|
|
186
|
+
bun packages/core/examples/natal.ts
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Subpath Exports
|
|
190
|
+
|
|
191
|
+
You can selectively import only the modules you need:
|
|
192
|
+
|
|
193
|
+
| Path | Description |
|
|
194
|
+
|------|-------------|
|
|
195
|
+
| `@orrery/core` | Full barrel export |
|
|
196
|
+
| `@orrery/core/saju` | `calculateSaju()` |
|
|
197
|
+
| `@orrery/core/ziwei` | `createChart()`, `calculateLiunian()`, `getDaxianList()` |
|
|
198
|
+
| `@orrery/core/natal` | `calculateNatal()`, zodiac/planet symbols, format functions |
|
|
199
|
+
| `@orrery/core/pillars` | `getFourPillars()`, `getDaewoon()`, and other low-level APIs |
|
|
200
|
+
| `@orrery/core/types` | All TypeScript types/interfaces |
|
|
201
|
+
| `@orrery/core/constants` | Stems/branches, 十神, palace names, and other constant tables |
|
|
202
|
+
| `@orrery/core/cities` | City data, search functions |
|
|
203
|
+
|
|
204
|
+
## Dependencies
|
|
205
|
+
|
|
206
|
+
| Package | Type | Purpose |
|
|
207
|
+
|---------|------|---------|
|
|
208
|
+
| `lunar-javascript` | dependency | Lunar calendar conversion (紫微斗數) |
|
|
209
|
+
|
|
210
|
+
All features run as pure TypeScript with no external WASM or data file dependencies.
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
[AGPL-3.0](../../LICENSE)
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary>What is AGPL-3.0? (Plain English)</summary>
|
|
218
|
+
|
|
219
|
+
### What you CAN do
|
|
220
|
+
|
|
221
|
+
- **Use it personally** — Run and modify it freely on your own machine.
|
|
222
|
+
- **Read and study the source code** — You are always welcome to learn from the code.
|
|
223
|
+
- **Modify, improve, and redistribute** — You can fork and redistribute the code, provided you follow the conditions below.
|
|
224
|
+
|
|
225
|
+
### What you MUST do
|
|
226
|
+
|
|
227
|
+
- **Keep the same license (AGPL-3.0)** — Any derivative work that includes or modifies this code must also be released under AGPL-3.0.
|
|
228
|
+
- **Disclose source code** — Unlike the standard GPL, the AGPL requires source disclosure **even when the software is offered as a web service**. If you modify this code and run it as a website, you must provide the modified source code to users upon request.
|
|
229
|
+
- **State changes** — You must clearly indicate what you changed from the original.
|
|
230
|
+
- **Preserve copyright notices** — Do not remove the original copyright and license notices.
|
|
231
|
+
|
|
232
|
+
### What you CANNOT do
|
|
233
|
+
|
|
234
|
+
- **Run a service with closed source** — Using a modified version of this code to operate a web service without disclosing the source is a license violation.
|
|
235
|
+
- **Relicense** — You cannot redistribute AGPL code under a more permissive license such as MIT or Apache.
|
|
236
|
+
|
|
237
|
+
### TL;DR
|
|
238
|
+
|
|
239
|
+
> Use it freely, but if you modify it or offer it as a service, you must release the source code under AGPL-3.0.
|
|
240
|
+
|
|
241
|
+
</details>
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
[한국어](./README.md) | [English](./README.en.md) | [中文](./README.zh.md) | **日本語**
|
|
2
|
+
|
|
3
|
+
# @orrery/core
|
|
4
|
+
|
|
5
|
+
ブラウザおよびNode.js環境で動作する東洋・西洋占術計算エンジンです。
|
|
6
|
+
|
|
7
|
+
- **四柱八字** — 六十干支、十神、十二運星、十二神殺、大運、干支関係分析
|
|
8
|
+
- **紫微斗數** — 命盤生成、大限、流年/流月分析
|
|
9
|
+
- **西洋占星術出生チャート(Natal Chart)** — 惑星位置、ハウス、アングル、アスペクト(純粋TypeScript)
|
|
10
|
+
|
|
11
|
+
バックエンド不要。すべての計算がクライアント上で実行されます。
|
|
12
|
+
|
|
13
|
+
**[ライブデモ →](https://rath.github.io/orrery/)**
|
|
14
|
+
|
|
15
|
+
## クレジット
|
|
16
|
+
|
|
17
|
+
- **四柱万年暦** — 고영창(Ko Young-chang)氏のPerl [真万年暦](http://afnmp3.homeip.net/~kohyc/calendar/cal20000.html)を김정균(Kim Jeong-gyun)氏が[PHPに移植](https://github.com/OOPS-ORG-PHP/Lunar)したものを、2018年11月に황장호(Hwang Jang-ho)がJavaとPythonに移植して使用、2026年2月にClaude Code(Opus 4.6)でTypeScriptに移植
|
|
18
|
+
- **紫微斗數命盤** — [lunar-javascript](https://www.npmjs.com/package/lunar-javascript)ライブラリをベースに、Claude(Opus 4.5)が中国語文献を調査しながら実装
|
|
19
|
+
- **占星術出生チャート** — [Swiss Ephemeris](https://www.astro.com/swisseph/)のMoshier理論を純粋なTypeScriptに移植
|
|
20
|
+
|
|
21
|
+
## インストール
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @orrery/core
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 使い方
|
|
28
|
+
|
|
29
|
+
### 四柱八字
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { calculateSaju } from '@orrery/core/saju'
|
|
33
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
34
|
+
|
|
35
|
+
const input: BirthInput = {
|
|
36
|
+
year: 1993, month: 3, day: 12,
|
|
37
|
+
hour: 9, minute: 45,
|
|
38
|
+
gender: 'M',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const result = calculateSaju(input)
|
|
42
|
+
|
|
43
|
+
// 四柱(時、日、月、年の順)
|
|
44
|
+
for (const p of result.pillars) {
|
|
45
|
+
console.log(p.pillar.ganzi) // '乙巳', '壬辰', '乙卯', '癸酉'
|
|
46
|
+
console.log(p.stemSipsin) // 天干十神
|
|
47
|
+
console.log(p.branchSipsin) // 地支十神
|
|
48
|
+
console.log(p.unseong) // 十二運星
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 大運
|
|
52
|
+
for (const dw of result.daewoon) {
|
|
53
|
+
console.log(`${dw.ganzi} (${dw.age}세~)`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 干支関係(合、沖、刑、破、害)
|
|
57
|
+
for (const [key, pair] of result.relations.pairs) {
|
|
58
|
+
console.log(key, pair.stem, pair.branch)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 紫微斗數
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { createChart, calculateLiunian, getDaxianList } from '@orrery/core/ziwei'
|
|
66
|
+
|
|
67
|
+
// 命盤を生成
|
|
68
|
+
const chart = createChart(1993, 3, 12, 9, 45, true)
|
|
69
|
+
|
|
70
|
+
console.log(chart.mingGongZhi) // 命宮の地支
|
|
71
|
+
console.log(chart.shenGongZhi) // 身宮の地支
|
|
72
|
+
console.log(chart.wuXingJu.name) // 五行局(例:'水二局')
|
|
73
|
+
|
|
74
|
+
// 各宮位の星曜を確認
|
|
75
|
+
for (const [name, palace] of Object.entries(chart.palaces)) {
|
|
76
|
+
const stars = palace.stars.map(s => {
|
|
77
|
+
const sihua = s.siHua ? `(${s.siHua})` : ''
|
|
78
|
+
return `${s.name}${s.brightness}${sihua}`
|
|
79
|
+
})
|
|
80
|
+
console.log(`${name} [${palace.ganZhi}]: ${stars.join(', ')}`)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 大限
|
|
84
|
+
const daxianList = getDaxianList(chart)
|
|
85
|
+
for (const dx of daxianList) {
|
|
86
|
+
console.log(`${dx.ageStart}~${dx.ageEnd}세: ${dx.palaceName} ${dx.ganZhi}`)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 流年 — 特定の年の運勢
|
|
90
|
+
const liunian = calculateLiunian(chart, 2026)
|
|
91
|
+
console.log(liunian.natalPalaceAtMing) // 流年命宮が位置する本命盤の宮位
|
|
92
|
+
console.log(liunian.siHua) // 流年四化
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 西洋占星術(Natal Chart)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { calculateNatal } from '@orrery/core/natal'
|
|
99
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
100
|
+
|
|
101
|
+
const input: BirthInput = {
|
|
102
|
+
year: 1993, month: 3, day: 12,
|
|
103
|
+
hour: 9, minute: 45,
|
|
104
|
+
gender: 'M',
|
|
105
|
+
latitude: 37.5665, // ソウル(任意、デフォルト:ソウル)
|
|
106
|
+
longitude: 126.9780,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const chart = await calculateNatal(input)
|
|
110
|
+
|
|
111
|
+
// 惑星位置
|
|
112
|
+
for (const planet of chart.planets) {
|
|
113
|
+
console.log(`${planet.id}: ${planet.sign} ${planet.degreeInSign.toFixed(1)}°`)
|
|
114
|
+
// 'Sun: Pisces 21.6°'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ASC / MC
|
|
118
|
+
console.log(`ASC: ${chart.angles.asc.sign}`)
|
|
119
|
+
console.log(`MC: ${chart.angles.mc.sign}`)
|
|
120
|
+
|
|
121
|
+
// ハウス(デフォルト:Placidus)
|
|
122
|
+
for (const house of chart.houses) {
|
|
123
|
+
console.log(`House ${house.number}: ${house.sign} ${house.degreeInSign.toFixed(1)}°`)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// アスペクト
|
|
127
|
+
for (const aspect of chart.aspects) {
|
|
128
|
+
console.log(`${aspect.planet1} ${aspect.type} ${aspect.planet2} (orb: ${aspect.orb.toFixed(1)}°)`)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ハウスシステムの変更(Koch)
|
|
132
|
+
const kochChart = await calculateNatal(input, 'K')
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 低レベルAPI
|
|
136
|
+
|
|
137
|
+
個別の関数を直接使用することもできます:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { getFourPillars, getDaewoon, getRelation } from '@orrery/core/pillars'
|
|
141
|
+
import { STEM_INFO, ELEMENT_HANJA } from '@orrery/core/constants'
|
|
142
|
+
|
|
143
|
+
// 四柱のみ計算
|
|
144
|
+
const [년주, 월주, 일주, 시주] = getFourPillars(1993, 3, 12, 9, 45)
|
|
145
|
+
console.log(년주, 월주, 일주, 시주) // '癸酉', '乙卯', '壬辰', '乙巳'
|
|
146
|
+
|
|
147
|
+
// 十神関係
|
|
148
|
+
const relation = getRelation('壬', '乙')
|
|
149
|
+
console.log(relation?.hanja) // '傷官'
|
|
150
|
+
|
|
151
|
+
// 天干五行情報
|
|
152
|
+
console.log(STEM_INFO['壬']) // { yinyang: '+', element: 'water' }
|
|
153
|
+
console.log(ELEMENT_HANJA['water']) // '水'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 都市データ
|
|
157
|
+
|
|
158
|
+
出生地入力に活用できる韓国・世界の主要都市データを提供しています:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import { SEOUL, filterCities, formatCityName } from '@orrery/core/cities'
|
|
162
|
+
|
|
163
|
+
console.log(SEOUL) // { name: '서울', lat: 37.5665, lon: 126.9780 }
|
|
164
|
+
|
|
165
|
+
// 韓国語の初声検索対応
|
|
166
|
+
const results = filterCities('ㅂㅅ') // '부산'にマッチ
|
|
167
|
+
console.log(formatCityName(results[0])) // '부산'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## サンプルの実行
|
|
171
|
+
|
|
172
|
+
リポジトリをクローンした後、すぐに実行できるサンプルスクリプトがあります:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
git clone https://github.com/rath/orrery.git
|
|
176
|
+
cd orrery
|
|
177
|
+
bun install
|
|
178
|
+
|
|
179
|
+
# 사주팔자
|
|
180
|
+
bun packages/core/examples/saju.ts
|
|
181
|
+
|
|
182
|
+
# 자미두수
|
|
183
|
+
bun packages/core/examples/ziwei.ts
|
|
184
|
+
|
|
185
|
+
# 서양 점성술 출생차트
|
|
186
|
+
bun packages/core/examples/natal.ts
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Subpath Exports
|
|
190
|
+
|
|
191
|
+
必要なモジュールのみを選択的にインポートできます:
|
|
192
|
+
|
|
193
|
+
| パス | 説明 |
|
|
194
|
+
|------|------|
|
|
195
|
+
| `@orrery/core` | 全体のbarrel export |
|
|
196
|
+
| `@orrery/core/saju` | `calculateSaju()` |
|
|
197
|
+
| `@orrery/core/ziwei` | `createChart()`, `calculateLiunian()`, `getDaxianList()` |
|
|
198
|
+
| `@orrery/core/natal` | `calculateNatal()`、星座/惑星シンボル、フォーマット関数 |
|
|
199
|
+
| `@orrery/core/pillars` | `getFourPillars()`, `getDaewoon()` 等の低レベルAPI |
|
|
200
|
+
| `@orrery/core/types` | すべてのTypeScript型/インターフェース |
|
|
201
|
+
| `@orrery/core/constants` | 天干/地支、十神、宮位名などの定数テーブル |
|
|
202
|
+
| `@orrery/core/cities` | 都市データ、検索関数 |
|
|
203
|
+
|
|
204
|
+
## 依存関係
|
|
205
|
+
|
|
206
|
+
| パッケージ | タイプ | 用途 |
|
|
207
|
+
|------------|--------|------|
|
|
208
|
+
| `lunar-javascript` | dependency | 旧暦変換(紫微斗數) |
|
|
209
|
+
|
|
210
|
+
外部のWASMやデータファイルへの依存なく、すべての機能が純粋なTypeScriptで動作します。
|
|
211
|
+
|
|
212
|
+
## ライセンス
|
|
213
|
+
|
|
214
|
+
[AGPL-3.0](../../LICENSE)
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary>AGPL-3.0とは?(わかりやすい説明)</summary>
|
|
218
|
+
|
|
219
|
+
### 自由にできること
|
|
220
|
+
|
|
221
|
+
- **個人的に使用** — 自分のコンピュータで自由に実行・修正できます。
|
|
222
|
+
- **ソースコードを読んで学ぶ** — コードを見て学ぶことはいつでも歓迎です。
|
|
223
|
+
- **修正・改善して再配布** — コードを修正して再配布できます。ただし、以下の条件を守る必要があります。
|
|
224
|
+
|
|
225
|
+
### 必ず守ること
|
|
226
|
+
|
|
227
|
+
- **同じライセンス(AGPL-3.0)を維持** — このコードを修正または含めて配布する場合、その成果物も必ずAGPL-3.0で公開しなければなりません。
|
|
228
|
+
- **ソースコードの公開義務** — 通常のGPLと異なり、AGPLは**Webサービスとして提供する場合にも**ソースコードを公開する必要があります。例えば、このコードを修正してウェブサイトとして運営する場合、ユーザーの要求に応じて修正されたソースコードを提供しなければなりません。
|
|
229
|
+
- **変更内容の明示** — 元のコードから何を変更したかわかるように表示する必要があります。
|
|
230
|
+
- **著作権表示の維持** — 元の著作権表示とライセンス文言を削除してはいけません。
|
|
231
|
+
|
|
232
|
+
### できないこと
|
|
233
|
+
|
|
234
|
+
- **ソース非公開でサービス運営** — このコードを修正してWebサービスを運営しながらソースを公開しないことはライセンス違反です。
|
|
235
|
+
- **ライセンスの変更** — AGPLコードをMIT、Apacheなどのより寛容なライセンスに変更して配布することはできません。
|
|
236
|
+
|
|
237
|
+
### 一言まとめ
|
|
238
|
+
|
|
239
|
+
> 自由に使えますが、修正したりサービスとして提供する場合は、ソースコードをAGPL-3.0で公開してください。
|
|
240
|
+
|
|
241
|
+
</details>
|