@dmdata/telegram-json-types 1.1.16 → 1.1.18

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.
@@ -3,6 +3,7 @@ import { deepEqual } from 'node:assert/strict';
3
3
  import Ajv from 'ajv';
4
4
  import { getJSchema } from '../jschema/jschema-load';
5
5
 
6
+ const sampleUrl = 'https://sample.dmdata.jp';
6
7
  const checkSchemaTypes = [
7
8
  'eew-information',
8
9
  'earthquake-information',
@@ -52,12 +53,14 @@ for (const schemaType of checkSchemaTypes) {
52
53
 
53
54
 
54
55
  async function getList(schemaType: string) {
55
- const url = `https://sample.dmdata.jp/conversion/json/schema/${schemaType}/`;
56
- return await fetch(url).then(res => res.text())
57
- .then(html => html
58
- .replace(/^.+?<pre>.+?<hr>(.+?)<\/pre>.+?$/s, '$1')
59
- .match(/<a\shref="(.+?)">/g)
60
- ?.map(a => url + a.replace(/^<a\shref="(.+?)">$/, '$1'))
61
- .filter(href => /\.json$/.test(href)) ?? []
56
+ const query = new URLSearchParams({ prefix: `conversion/json/schema/${schemaType}`, delimiter: '' });
57
+ const url = `${sampleUrl}/?` + query.toString();
58
+
59
+ return await fetch(url, { headers: { accept: 'application/xml' } })
60
+ .then(res => res.text())
61
+ .then(xml => xml
62
+ .match(/<Key>.+?\.json<\/Key>/g)
63
+ ?.map(element => element.replace(/^<Key>(.+?\.json)<\/Key>$/, '$1'))
64
+ .map(href => `${sampleUrl}/${encodeURIComponent(href)}`) ?? []
62
65
  );
63
66
  }
@@ -17,12 +17,12 @@ export namespace EarthquakeInformation {
17
17
 
18
18
  export interface IntensityMaxIntOnRevise extends Components.CodeName {
19
19
  maxInt?: IntensityClass;
20
- revise?: '上方修正' | '追加';
20
+ revise?: '上方修正' | '下方修正' | '追加';
21
21
  }
22
22
 
23
23
  export interface IntensityCity extends Components.CodeName {
24
24
  maxInt?: IntensityClass;
25
- revise?: '上方修正' | '追加';
25
+ revise?: '上方修正' | '下方修正' | '追加';
26
26
  condition?: '震度5弱以上未入電';
27
27
  }
28
28
 
@@ -246,7 +246,7 @@ export namespace TsunamiInformation {
246
246
 
247
247
 
248
248
  export interface Cancel extends TelegramJSONMain {
249
- type: '津波警報・注意報・予報a' | '津波情報a' | '各地の満潮時刻・津波到達予想時刻に関する情報' | '津波観測に関する情報';
249
+ type: '津波警報・注意報・予報a' | '津波情報a' | '沖合の津波観測に関する情報';
250
250
  infoType: '取消';
251
251
  targetDateTimeDubious?: never;
252
252
  targetDuration?: never;
@@ -256,6 +256,6 @@ export namespace TsunamiInformation {
256
256
  body: CancelBody;
257
257
  }
258
258
 
259
- export type Main = (PublicVTSE41 | PublicVTSE51 | PublicVTSE52) | Cancel;
259
+ export type Main = PublicVTSE41 | PublicVTSE51 | PublicVTSE52 | Cancel;
260
260
 
261
261
  }
@@ -164,8 +164,8 @@ export namespace TsunamiInformation {
164
164
  }
165
165
 
166
166
  export interface TsunamiEstimationFirstHeight {
167
- arrivalTime: string;
168
- condition?: '早いところでは既に津波到達と推定';
167
+ arrivalTime?: string;
168
+ condition: '早いところでは既に津波到達と推定';
169
169
  revise?: '追加' | '更新';
170
170
  }
171
171
 
@@ -283,7 +283,7 @@ export namespace TsunamiInformation {
283
283
 
284
284
 
285
285
  export interface Cancel extends TelegramJSONMain {
286
- type: '津波警報・注意報・予報a' | '津波情報a' | '各地の満潮時刻・津波到達予想時刻に関する情報' | '津波観測に関する情報';
286
+ type: '津波警報・注意報・予報a' | '津波情報a' | '沖合の津波観測に関する情報';
287
287
  infoType: '取消';
288
288
  targetDateTimeDubious?: never;
289
289
  targetDuration?: never;
@@ -293,6 +293,6 @@ export namespace TsunamiInformation {
293
293
  body: CancelBody;
294
294
  }
295
295
 
296
- export type Main = (PublicVTSE41 | PublicVTSE51 | PublicVTSE52) | Cancel;
296
+ export type Main = PublicVTSE41 | PublicVTSE51 | PublicVTSE52 | Cancel;
297
297
 
298
298
  }