@dmdata/telegram-json-types 1.0.3

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/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types';
package/package.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@dmdata/telegram-json-types",
3
+ "version": "1.0.3",
4
+ "scripts": {},
5
+ "types": "index.d.ts",
6
+ "keywords": [],
7
+ "author": "",
8
+ "license": "ISC"
9
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "es2020",
5
+ "sourceMap": false,
6
+ "alwaysStrict": true,
7
+ "noImplicitThis": true,
8
+ "noImplicitReturns": true,
9
+ "noFallthroughCasesInSwitch": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "baseUrl": "./",
14
+ },
15
+ }
@@ -0,0 +1,2 @@
1
+ export * from './schema/earthquake-information';
2
+ export * from './schema/weather-typhoon';
@@ -0,0 +1,25 @@
1
+ export interface TelegramJSONMain {
2
+ _originalId: string;
3
+ _schema: {
4
+ type: string;
5
+ version: string;
6
+ };
7
+ type: string;
8
+ title: string;
9
+ status: '通常' | '訓練' | '試験';
10
+ infoType: '発表' | '訂正' | '遅延' | '取消';
11
+ editorialOffice: string;
12
+ publishingOffice: string[];
13
+ pressDateTime: string;
14
+ reportDateTime: string;
15
+ targetDateTime: string;
16
+ targetDateTimeDubious?: string;
17
+ targetDuration?: string;
18
+ validDateTime?: string;
19
+ eventId: string | null;
20
+ serialNo: string | null;
21
+ infoKind: string;
22
+ infoKindVersion: string;
23
+ headline: string | null;
24
+ body: object;
25
+ }
@@ -0,0 +1,15 @@
1
+ import { UnitValue } from './unit-value';
2
+
3
+ export type Coordinate<Geo = never> = {
4
+ latitude: { text: string, value: string };
5
+ longitude: { text: string, value: string };
6
+ height?: UnitValue<'深さ', 'km'>;
7
+ condition: undefined;
8
+ geodeticSystem: Geo;
9
+ } | {
10
+ latitude: undefined;
11
+ longitude: undefined;
12
+ height: undefined;
13
+ geodeticSystem: never;
14
+ condition: '不明';
15
+ }
@@ -0,0 +1,56 @@
1
+ import { Coordinate } from './coordinate';
2
+ import { UnitValueNotNull } from './unit-value';
3
+
4
+ type Depth = {
5
+ type: '深さ';
6
+ unit: 'km';
7
+ } & ({
8
+ value: null;
9
+ condition: '不明';
10
+ } | {
11
+ value: '0';
12
+ condition: 'ごく浅い';
13
+ } | {
14
+ value: '700';
15
+ condition: '700km以上';
16
+ } | {
17
+ value: string;
18
+ condition: undefined;
19
+ });
20
+ type Magnitude = {
21
+ type: 'マグニチュード';
22
+ unit: 'Mj' | 'M';
23
+ } & ({
24
+ value: null;
25
+ condition: 'M不明' | 'M8を超える巨大地震';
26
+ } | {
27
+ value: string;
28
+ condition: undefined;
29
+ });
30
+
31
+ export interface Earthquake {
32
+ originTime: string;
33
+ arrivalTime: string;
34
+ hypocenter: {
35
+ name: string;
36
+ code: string;
37
+ coordinate: Coordinate<'日本測地系' | undefined>;
38
+ depth: Depth;
39
+ detailed?: {
40
+ code: string;
41
+ name: string;
42
+ };
43
+ auxiliary?: {
44
+ text: string;
45
+ code: string;
46
+ name: string;
47
+ direction: string;
48
+ distance: Omit<UnitValueNotNull<never, 'km'>, 'type' | 'condition'>;
49
+ };
50
+ source?: 'PTWC' | 'USGS' | 'WCATWC';
51
+ };
52
+ magnitude: Magnitude;
53
+ }
54
+
55
+
56
+
@@ -0,0 +1,13 @@
1
+ export type UnitValue<Type = string, Unit = string, Condition = never> = {
2
+ type: Type;
3
+ unit: Unit;
4
+ value: string | null;
5
+ condition: Condition
6
+ };
7
+
8
+ export type UnitValueNotNull<Type = string, Unit = string, Condition = never> = {
9
+ type: Type;
10
+ unit: Unit;
11
+ value: string;
12
+ condition: Condition
13
+ };
@@ -0,0 +1,139 @@
1
+ import { Earthquake } from './component/earthquake';
2
+ import { TelegramJSONMain } from '../main';
3
+
4
+ type Intensity = '1' | '2' | '3' | '4' | '5-' | '5+' | '6-' | '6+' | '7';
5
+
6
+ export namespace EarthquakeInformation {
7
+ export interface Schema {
8
+ type: 'earthquake-information';
9
+ version: '1.0.0';
10
+ }
11
+
12
+
13
+
14
+ export interface PublicBodyVXSE51 {
15
+ intensity: {
16
+ maxInt: string;
17
+ prefectures: {
18
+ name: string;
19
+ code: string;
20
+ maxInt: Intensity;
21
+ }[];
22
+ regions: {
23
+ name: string;
24
+ code: string;
25
+ maxInt: Intensity;
26
+ }[];
27
+ };
28
+ text?: string;
29
+ comments: {
30
+ free?: string;
31
+ forecast?: {
32
+ text: string;
33
+ codes: string[];
34
+ };
35
+ };
36
+ }
37
+
38
+ export interface PublicBodyVXSE52 {
39
+ earthquake: Earthquake;
40
+ text?: string;
41
+ comments: {
42
+ free?: string;
43
+ forecast?: {
44
+ text: string;
45
+ codes: string[];
46
+ };
47
+ };
48
+ }
49
+
50
+ export interface PublicBodyVXSE53 {
51
+ earthquake: Earthquake;
52
+ intensity?: {
53
+ maxInt: string;
54
+ prefectures: {
55
+ name: string;
56
+ code: string;
57
+ maxInt?: Intensity;
58
+ revise?: '上方修正' | '追加';
59
+ }[];
60
+ regions: {
61
+ name: string;
62
+ code: string;
63
+ maxInt?: Intensity;
64
+ revise?: '上方修正' | '追加';
65
+ }[];
66
+ cities: {
67
+ name: string;
68
+ code: string;
69
+ maxInt?: Intensity;
70
+ revise?: '上方修正' | '追加';
71
+ condition?: '震度5弱以上未入電';
72
+ }[];
73
+ stations: {
74
+ name: string;
75
+ code: string;
76
+ int: Intensity | '!5-';
77
+ revise?: '上方修正' | '追加';
78
+ condition?: '震度5弱以上未入電';
79
+ }[];
80
+ };
81
+ text?: string;
82
+ comments: {
83
+ free?: string;
84
+ forecast?: {
85
+ text: string;
86
+ codes: string[];
87
+ };
88
+ var?: {
89
+ text: string;
90
+ codes: string[];
91
+ };
92
+ };
93
+ }
94
+
95
+ export interface ChancelBody {
96
+ text: string;
97
+ }
98
+
99
+ export interface PublicVXSE51 extends TelegramJSONMain {
100
+ _schema: Schema;
101
+ type: '震度速報';
102
+ title: '震度速報';
103
+ infoKind: '震度速報';
104
+ eventId: string;
105
+ serialNo: null;
106
+ infoType: '発表' | '訂正';
107
+ body: PublicBodyVXSE51;
108
+ }
109
+
110
+ export interface PublicVXSE52 extends TelegramJSONMain {
111
+ _schema: Schema;
112
+ type: '震源に関する情報';
113
+ title: '震源に関する情報';
114
+ infoKind: '震源速報';
115
+ eventId: string;
116
+ serialNo: null;
117
+ infoType: '発表' | '訂正';
118
+ body: PublicBodyVXSE52;
119
+ }
120
+
121
+ export interface PublicVXSE53 extends TelegramJSONMain {
122
+ _schema: Schema;
123
+ type: '震源・震度に関する情報';
124
+ title: '震源・震度情報' | '遠地地震に関する情報';
125
+ infoKind: '地震情報';
126
+ eventId: string;
127
+ serialNo: string;
128
+ infoType: '発表' | '訂正';
129
+ body: PublicBodyVXSE53;
130
+ }
131
+
132
+ export interface Channel extends TelegramJSONMain {
133
+ infoType: '取消';
134
+ body: ChancelBody;
135
+ }
136
+
137
+ export type Main = (PublicVXSE51 | PublicVXSE52 | PublicVXSE53) | Channel;
138
+
139
+ }
@@ -0,0 +1,115 @@
1
+ import { TelegramJSONMain } from '../main';
2
+ import { Coordinate } from './component/coordinate';
3
+ import { UnitValue } from './component/unit-value';
4
+
5
+ export namespace WeatherTyphoon {
6
+ export interface Schema {
7
+ type: 'weather-typhoon';
8
+ version: '1.0.0';
9
+ }
10
+
11
+ type Direction = {
12
+ type: string;
13
+ unit: string;
14
+ value: string;
15
+ azimuth: string;
16
+ } | {
17
+ type: string;
18
+ unit: string;
19
+ value: null;
20
+ azimuth: null;
21
+ condition: string;
22
+ }
23
+
24
+ interface Axis {
25
+ direction: Direction;
26
+ radius: UnitValue;
27
+ }
28
+
29
+
30
+ interface A {
31
+ type: '実況' | '推定';
32
+ elapsedTime: 'PT0H' | 'PT1H';
33
+ dateTime: string;
34
+ classification: {
35
+ category: 'TD' | 'TY' | 'STS' | 'Hurricane' | 'Tropical Storm' | 'LOW' | null;
36
+ name: '熱帯低気圧' | '台風' | 'ハリケーン' | '発達した熱帯低気圧' | '温帯低気圧' | null;
37
+ area: '大型' | '超大型' | null;
38
+ intensity: '強い' | '非常に強い' | '猛烈な' | null;
39
+ };
40
+ center: {
41
+ location: Coordinate;
42
+ direction: Direction;
43
+ speed: UnitValue;
44
+ pressure: UnitValue;
45
+ };
46
+ wind?: {
47
+ average: UnitValue;
48
+ instantaneous: UnitValue;
49
+ area: {
50
+ strong: Axis[];
51
+ storm: Axis[];
52
+ };
53
+ };
54
+ }
55
+
56
+ interface B {
57
+ type: '予報' | '延長予報';
58
+ elapsedTime: string;
59
+ dateTime: string;
60
+ classification: {
61
+ category: 'TD' | 'TY' | 'STS' | 'Hurricane' | 'Tropical Storm' | 'LOW' | null;
62
+ name: '熱帯低気圧' | '台風' | 'ハリケーン' | '発達した熱帯低気圧' | '温帯低気圧' | null;
63
+ intensity?: '強い' | '非常に強い' | '猛烈な' | null;
64
+ };
65
+ center: {
66
+ probabilityCircle: {
67
+ basePoint: Coordinate;
68
+ axes: Axis[];
69
+ };
70
+ direction: Direction;
71
+ speed: UnitValue;
72
+ pressure: UnitValue
73
+ };
74
+ wind: {
75
+ average: UnitValue;
76
+ instantaneous: UnitValue;
77
+ area?: {
78
+ strong?: Axis[];
79
+ storm?: Axis[];
80
+ stormWarning?: Axis[];
81
+ };
82
+ };
83
+ }
84
+
85
+ export interface PublicBody {
86
+ typhoon: {
87
+ tcNumber: string;
88
+ name: {
89
+ text: string | null;
90
+ kana: string | null;
91
+ number: string | null;
92
+ };
93
+ remark: '台風発生' | '台風発生(域外から入る)' | '台風消滅(域外へ出る)' | '台風消滅(温帯低気圧化)' | '台風消滅(熱帯低気圧化)' |
94
+ '台風発生の可能性が小さくなった' | '発表間隔変更(毎時から3時間毎)' | '発表間隔変更(3時間毎から毎時)' | '台風発生予想' | '温帯低気圧化しつつある' | null;
95
+ };
96
+ forecasts: [A] | [A, ...B[]] | [A, A] | [A, A, ...B[]];
97
+ }
98
+
99
+ export interface Public extends TelegramJSONMain {
100
+ _schema: Schema;
101
+ type: '台風解析・予報情報(5日予報)(H30)' | '台風解析・予報情報(5日予報)' | '台風解析・予報情報(3日予報)';
102
+ title: '台風解析・予報情報';
103
+ targetDuration: string;
104
+ infoKind: '台風解析・予報情報(5日予報)' | '台風解析・予報情報(3日予報)';
105
+ eventId: string;
106
+ serialNo: string;
107
+ infoType: '発表' | '訂正' | '取消';
108
+ headline: null;
109
+ body: PublicBody;
110
+ }
111
+
112
+
113
+ export type Main = Public;
114
+
115
+ }