@famgia/omnify-japan 0.0.1 → 0.0.2
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.md +82 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# @famgia/omnify-japan
|
|
2
|
+
|
|
3
|
+
Japan-specific types plugin for Omnify schemas. Adds support for Japanese address, phone, and date formats.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @famgia/omnify-japan
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { japanPlugin } from '@famgia/omnify-japan';
|
|
15
|
+
import { createOmnify } from '@famgia/omnify-core';
|
|
16
|
+
|
|
17
|
+
const omnify = createOmnify({
|
|
18
|
+
schemaDir: './schemas',
|
|
19
|
+
plugins: [japanPlugin],
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Schema Usage
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
# schemas/customer.yaml
|
|
27
|
+
name: Customer
|
|
28
|
+
properties:
|
|
29
|
+
postal_code:
|
|
30
|
+
type: JapanPostalCode
|
|
31
|
+
phone:
|
|
32
|
+
type: JapanPhone
|
|
33
|
+
prefecture:
|
|
34
|
+
type: JapanPrefecture
|
|
35
|
+
address:
|
|
36
|
+
type: JapanAddress
|
|
37
|
+
date:
|
|
38
|
+
type: JapanDate
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Provided Types
|
|
42
|
+
|
|
43
|
+
| Type | Description | Example |
|
|
44
|
+
|------|-------------|---------|
|
|
45
|
+
| `JapanPostalCode` | 7-digit postal code | `123-4567` |
|
|
46
|
+
| `JapanPhone` | Japanese phone number | `03-1234-5678` |
|
|
47
|
+
| `JapanPrefecture` | Prefecture enum (47) | `Tokyo`, `Osaka` |
|
|
48
|
+
| `JapanAddress` | Full address format | Structured address |
|
|
49
|
+
| `JapanDate` | Japanese date format | `2024-01-01` |
|
|
50
|
+
|
|
51
|
+
## Generated Output
|
|
52
|
+
|
|
53
|
+
### Laravel Migration
|
|
54
|
+
|
|
55
|
+
```php
|
|
56
|
+
$table->string('postal_code', 8); // 123-4567
|
|
57
|
+
$table->string('phone', 15);
|
|
58
|
+
$table->string('prefecture', 10);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### TypeScript
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
interface Customer {
|
|
65
|
+
postal_code: string;
|
|
66
|
+
phone: string;
|
|
67
|
+
prefecture: JapanPrefecture;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
type JapanPrefecture =
|
|
71
|
+
| 'Hokkaido' | 'Aomori' | 'Tokyo'
|
|
72
|
+
| /* ... 44 more */ ;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Related Packages
|
|
76
|
+
|
|
77
|
+
- [@famgia/omnify-core](https://www.npmjs.com/package/@famgia/omnify-core) - Core engine
|
|
78
|
+
- [@famgia/omnify-cli](https://www.npmjs.com/package/@famgia/omnify-cli) - CLI tool
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@famgia/omnify-japan",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Japan-specific types plugin for omnify-schema",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
18
19
|
],
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@famgia/omnify-types": "0.0.
|
|
21
|
+
"@famgia/omnify-types": "0.0.2"
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "tsup",
|