ddex-json-codec 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +38 -38
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # ddex-json-codec
2
2
 
3
- DDEX ERN規格のXML/JSON相互変換ライブラリ(TypeScript
3
+ Bidirectional XML/JSON codec for the DDEX ERN (Electronic Release Notification) standard, written in TypeScript.
4
4
 
5
- ## 特徴
5
+ ## Features
6
6
 
7
- - ERN XMLからTypeScript型付きオブジェクトへの変換、およびその逆変換
8
- - ERN 3.8 / 4系に対応(4系は未実装)
9
- - バージョン自動検出
10
- - [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) ベース
7
+ - Convert ERN XML to typed TypeScript objects and back
8
+ - Supports ERN 3.8.x (3.8 - 3.8.3) and ERN 4.x (4.1 - 4.3.2)
9
+ - Automatic version detection from namespace URI
10
+ - Built on [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser)
11
11
  - Node.js >= 20
12
12
 
13
- ## インストール
13
+ ## Install
14
14
 
15
15
  ```bash
16
16
  npm install ddex-json-codec
@@ -18,66 +18,66 @@ npm install ddex-json-codec
18
18
  pnpm add ddex-json-codec
19
19
  ```
20
20
 
21
- ## 使い方
21
+ ## Usage
22
22
 
23
- ### XML JSON
23
+ ### XML to JSON
24
24
 
25
25
  ```typescript
26
26
  import { xmlToJson } from 'ddex-json-codec';
27
27
 
28
28
  const message = xmlToJson(xmlString);
29
- console.log(message.ernVersion); // "3.8.1"
29
+ console.log(message.ernVersion); // "3.8.2"
30
30
  console.log(message.resourceList); // SoundRecording[]
31
31
  ```
32
32
 
33
- ### JSON XML
33
+ ### JSON to XML
34
34
 
35
35
  ```typescript
36
36
  import { jsonToXml } from 'ddex-json-codec';
37
37
 
38
38
  const xml = jsonToXml(message);
39
- // バージョン指定も可
39
+ // Optionally specify a target version
40
40
  const xml382 = jsonToXml(message, '3.8.2');
41
41
  ```
42
42
 
43
- ### バージョン検出
43
+ ### Version Detection
44
44
 
45
45
  ```typescript
46
46
  import { detectVersion } from 'ddex-json-codec';
47
47
 
48
- const version = detectVersion(xmlString); // "3.8.1"
48
+ const version = detectVersion(xmlString); // "4.3"
49
49
  ```
50
50
 
51
- ## 対応バージョン
51
+ ## Supported Versions
52
52
 
53
- | ERN バージョン | 状態 |
53
+ | ERN Version | Status |
54
54
  |---|---|
55
- | 3.8 | 実装済み |
56
- | 3.8.1 | 実装済み |
57
- | 3.8.2 | 実装済み |
58
- | 3.8.3 | 実装済み |
59
- | 4.1 | 未実装 |
60
- | 4.1.1 | 未実装 |
61
- | 4.2 | 未実装 |
62
- | 4.3 | 未実装 |
63
- | 4.3.1 | 未実装 |
64
- | 4.3.2 | 未実装 |
65
-
66
- ## API リファレンス
55
+ | 3.8 | Supported |
56
+ | 3.8.1 | Supported |
57
+ | 3.8.2 | Supported |
58
+ | 3.8.3 | Supported |
59
+ | 4.1 | Supported |
60
+ | 4.1.1 | Supported |
61
+ | 4.2 | Supported |
62
+ | 4.3 | Supported |
63
+ | 4.3.1 | Supported |
64
+ | 4.3.2 | Supported |
65
+
66
+ ## API
67
67
 
68
68
  ### `xmlToJson(xml: string): DdexMessage`
69
69
 
70
- ERN XMLを解析し、型付きオブジェクトを返す。バージョンは自動検出される。
70
+ Parse an ERN XML string into a typed object. Version is auto-detected.
71
71
 
72
72
  ### `jsonToXml(message: DdexMessage, version?: ErnVersion): string`
73
73
 
74
- `DdexMessage` ERN XMLに変換する。`version` 省略時は `message.ernVersion` を使用。
74
+ Convert a `DdexMessage` back to an ERN XML string. Falls back to `message.ernVersion` when `version` is omitted.
75
75
 
76
76
  ### `detectVersion(xml: string): ErnVersion`
77
77
 
78
- ERN XMLのnamespace URIからバージョンを検出して返す。
78
+ Detect the ERN version from namespace URI or `MessageSchemaVersionId` attribute.
79
79
 
80
- ###
80
+ ### Types
81
81
 
82
82
  ```typescript
83
83
  interface DdexMessage {
@@ -87,19 +87,19 @@ interface DdexMessage {
87
87
  resourceList: SoundRecording[];
88
88
  releaseList: Release[];
89
89
  dealList: ReleaseDeal[];
90
- partyList?: Party[]; // 4系のみ
91
- trackReleaseList?: TrackRelease[]; // 4系のみ
90
+ partyList?: Party[]; // ERN 4.x only
91
+ trackReleaseList?: TrackRelease[]; // ERN 4.x only
92
92
  }
93
93
  ```
94
94
 
95
- エクスポートされる型一覧:
95
+ Exported types:
96
96
 
97
97
  `DdexMessage`, `ErnVersion`, `ErnMajorVersion`, `MessageHeader`, `MessageParty`,
98
98
  `SoundRecording`, `Release`, `TrackRelease`, `ResourceGroup`, `ReleaseResourceReference`,
99
99
  `ReleaseDeal`, `Deal`, `DealTerms`, `Usage`,
100
- `Party`, `Artist`, `DisplayArtist`, `ResourceContributor`, `IndirectResourceContributor`,
101
- `TextWithAttribute`, `Genre`, `PLine`, `CLine`, `Title`
100
+ `Party`, `Artist`, `DisplayArtist`, `ResourceContributor`, `IndirectResourceContributor`, `Contributor`,
101
+ `TextWithAttribute`, `Genre`, `PLine`, `CLine`, `Title`, `DisplayTitle`
102
102
 
103
- ## ライセンス
103
+ ## License
104
104
 
105
105
  [MIT](./LICENSE.md)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ddex-json-codec",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "description": "DDEX ERN XML ↔ JSON converter for TypeScript",
6
6
  "license": "MIT",
7
7
  "author": "kazhs",