@kulupu-linku/sona 2.0.2 → 2.1.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.
Files changed (79) hide show
  1. package/dist/{index-1jX6YIBj.d.ts → index-7uKIarVW.d.mts} +6 -8
  2. package/dist/{client-BSyS8F5a.d.ts → lib/v1/client.d.mts} +55 -57
  3. package/dist/{client-BitJ28pJ.js → lib/v1/client.mjs} +1 -3
  4. package/dist/lib/v1/{client.test.d.ts → client.test.d.mts} +2 -3
  5. package/dist/lib/v1/client.test.mjs +2 -0
  6. package/dist/lib/v1/{index.d.ts → index.d.mts} +1 -1
  7. package/dist/{v1-DkHVwPCI.js → lib/v1/index.mjs} +2 -4
  8. package/dist/lib/v1/{types.d.ts → types.d.mts} +1 -1
  9. package/dist/lib/v1/types.mjs +1 -0
  10. package/dist/lib/v1/{utils.d.ts → utils.d.mts} +1 -1
  11. package/dist/{utils-QiKwNnnL.js → lib/v1/utils.mjs} +1 -3
  12. package/dist/{client-CUMo53JZ.d.ts → lib/v2/client.d.mts} +55 -57
  13. package/dist/{client-DNWH1gFt.js → lib/v2/client.mjs} +1 -3
  14. package/dist/lib/v2/{client.test.d.ts → client.test.d.mts} +2 -3
  15. package/dist/lib/v2/client.test.mjs +2 -0
  16. package/dist/lib/v2/{index.d.ts → index.d.mts} +1 -1
  17. package/dist/{v2-CDtbJFxV.js → lib/v2/index.mjs} +3 -5
  18. package/dist/lib/v2/{types.d.ts → types.d.mts} +1 -1
  19. package/dist/lib/v2/types.mjs +1 -0
  20. package/dist/lib/v2/{utils.d.ts → utils.d.mts} +1 -1
  21. package/dist/{utils-Z1o5sWsW.js → lib/v2/utils.mjs} +1 -3
  22. package/dist/server/index.d.mts +2 -0
  23. package/dist/server/{index.js → index.mjs} +4 -12
  24. package/dist/server/{utils.d.ts → utils.d.mts} +5 -5
  25. package/dist/{utils-DkAaVBMs.js → server/utils.mjs} +2 -4
  26. package/dist/server/v1/{index.d.ts → index.d.mts} +4 -4
  27. package/dist/server/v1/index.mjs +2 -0
  28. package/dist/server/v2/{index.d.ts → index.d.mts} +4 -4
  29. package/dist/server/v2/index.mjs +2 -0
  30. package/dist/server/{versioning.d.ts → versioning.d.mts} +6 -6
  31. package/dist/server/versioning.mjs +2 -0
  32. package/dist/{v1-obRCoWWK.js → v1-Da4_o5R1.mjs} +9 -15
  33. package/generated/v1/commentary_translation.json +1 -1
  34. package/generated/v1/definition_translation.json +1 -1
  35. package/generated/v1/etymology_translation.json +2 -4
  36. package/generated/v1/fingerspelling.json +5 -20
  37. package/generated/v1/fingerspelling_sign.json +4 -16
  38. package/generated/v1/font.json +1 -1
  39. package/generated/v1/fonts.json +1 -1
  40. package/generated/v1/icon_translation.json +1 -1
  41. package/generated/v1/languages.json +4 -14
  42. package/generated/v1/parameters_translation.json +1 -1
  43. package/generated/v1/sign.json +3 -8
  44. package/generated/v1/signs.json +4 -12
  45. package/generated/v1/sitelen_pona_translation.json +1 -1
  46. package/generated/v1/word.json +6 -29
  47. package/generated/v2/fingerspelling.json +124 -64
  48. package/generated/v2/fingerspellings.json +178 -115
  49. package/generated/v2/font.json +109 -64
  50. package/generated/v2/fonts.json +160 -112
  51. package/generated/v2/glyph.json +72 -46
  52. package/generated/v2/glyphs.json +171 -142
  53. package/generated/v2/language.json +34 -16
  54. package/generated/v2/languages.json +75 -56
  55. package/generated/v2/sign.json +149 -77
  56. package/generated/v2/signs.json +212 -137
  57. package/generated/v2/word.json +298 -155
  58. package/generated/v2/words.json +416 -270
  59. package/package.json +44 -32
  60. package/dist/.assetsignore +0 -0
  61. package/dist/lib/v1/client.d.ts +0 -3
  62. package/dist/lib/v1/client.js +0 -3
  63. package/dist/lib/v1/client.test.js +0 -3
  64. package/dist/lib/v1/index.js +0 -4
  65. package/dist/lib/v1/types.js +0 -1
  66. package/dist/lib/v1/utils.js +0 -3
  67. package/dist/lib/v2/client.d.ts +0 -3
  68. package/dist/lib/v2/client.js +0 -3
  69. package/dist/lib/v2/client.test.js +0 -3
  70. package/dist/lib/v2/index.js +0 -4
  71. package/dist/lib/v2/types.js +0 -1
  72. package/dist/lib/v2/utils.js +0 -3
  73. package/dist/server/index.d.ts +0 -2
  74. package/dist/server/utils.js +0 -3
  75. package/dist/server/v1/index.js +0 -8
  76. package/dist/server/v2/index.js +0 -8
  77. package/dist/server/versioning.js +0 -8
  78. /package/dist/{index-DObG_APy.d.ts → index-N8h8E1s6.d.mts} +0 -0
  79. /package/dist/{index-DsVEVr6r.d.ts → index-nmyNJa57.d.mts} +0 -0
@@ -1,12 +1,11 @@
1
- import { f as Signs, h as Words, i as Fingerspelling, l as Languages, s as Fonts } from "./v1-DkHVwPCI.js";
2
- import { a as langIdCoalesce, i as keys, n as filterObject, o as langValidator, r as joinPath, s as mergeToKey } from "./utils-DkAaVBMs.js";
3
- import { c as Languages$1, f as Words$1, i as Fonts$1, n as Fingerspellings, o as Glyphs, u as Signs$1 } from "./v2-CDtbJFxV.js";
1
+ import { Fingerspelling, Fonts, Languages, Signs, Words } from "./lib/v1/index.mjs";
2
+ import { filterObject, joinPath, keys, langIdCoalesce, langValidator, mergeToKey } from "./server/utils.mjs";
3
+ import { Fingerspellings, Fonts as Fonts$1, Glyphs, Languages as Languages$1, Signs as Signs$1, Words as Words$1 } from "./lib/v2/index.mjs";
4
4
  import { Hono } from "hono";
5
5
  import { z } from "zod/v4";
6
6
  import { zValidator } from "@hono/zod-validator";
7
7
  import { HTTPException } from "hono/http-exception";
8
8
  import PLazy from "p-lazy";
9
-
10
9
  //#region src/server/v2/index.ts
11
10
  const API_VERSION$1 = "v2";
12
11
  const config$1 = {
@@ -93,8 +92,6 @@ const singleItemEndpoint = (key, param, descriptor) => {
93
92
  };
94
93
  };
95
94
  const app$1 = new Hono().get("/", (c) => c.redirect("/v2/words")).get("/words", langValidator, datasetEndpoint("words")).get("/words/:word", langValidator, zValidator("param", z.object({ word: z.string() })), singleItemEndpoint("words", "word", "word")).get("/glyphs", langValidator, datasetEndpoint("glyphs")).get("/glyphs/:glyph", langValidator, zValidator("param", z.object({ glyph: z.string() })), singleItemEndpoint("glyphs", "glyph", "glyph")).get("/sandbox", (c) => c.redirect("/v2/sandbox/words")).get("/sandbox/words", langValidator, datasetEndpoint("sandbox_words")).get("/sandbox/words/:word", langValidator, zValidator("param", z.object({ word: z.string() })), singleItemEndpoint("sandbox_words", "word", "sandbox word")).get("/sandbox/glyphs", langValidator, datasetEndpoint("sandbox_glyphs")).get("/sandbox/glyphs/:glyph", langValidator, zValidator("param", z.object({ glyph: z.string() })), singleItemEndpoint("sandbox_glyphs", "glyph", "sandbox glyph")).get("/luka_pona/signs", langValidator, datasetEndpoint("signs")).get("/luka_pona/signs/:sign", langValidator, zValidator("param", z.object({ sign: z.string() })), singleItemEndpoint("signs", "sign", "sign")).get("/luka_pona/fingerspellings", langValidator, datasetEndpoint("fingerspellings")).get("/luka_pona/fingerspellings/:fingerspelling", langValidator, zValidator("param", z.object({ sign: z.string() })), singleItemEndpoint("fingerspellings", "fingerspelling", "fingerspelling")).get("/fonts", datasetEndpoint("fonts")).get("/fonts/:font", zValidator("param", z.object({ font: z.string() })), singleItemEndpoint("fonts", "font", "font")).get("/languages", datasetEndpoint("languages")).get("/languages/:language", zValidator("param", z.object({ language: z.string() })), singleItemEndpoint("languages", "language", "language"));
96
- var v2_default = app$1;
97
-
98
95
  //#endregion
99
96
  //#region src/server/versioning.ts
100
97
  const IMPORT_ROOT = "/src/raw/";
@@ -107,15 +104,15 @@ const versions = {
107
104
  v2: config$1
108
105
  };
109
106
  const apps = {
110
- v1: v1_default,
111
- v2: v2_default
107
+ v1: app,
108
+ v2: app$1
112
109
  };
113
110
  const assertImport = async (imports, file, path) => {
114
111
  if (!file) throw new Error(`Missing file: ${path}. Available: [${Object.keys(imports).slice(0, 10)}]`);
115
112
  if (typeof file !== "object") console.error(`Unexpected file type for ${path}:`, typeof file, file);
116
113
  };
117
- const fetchFile = async (version, config$2, langcode = "en") => {
118
- const { root = "/", filename, schema, translations = false } = config$2;
114
+ const fetchFile = async (version, config, langcode = "en") => {
115
+ const { root = "/", filename, schema, translations = false } = config;
119
116
  let path = "/" + joinPath(IMPORT_ROOT, version, root, filename);
120
117
  let file = DATA[path];
121
118
  await assertImport(DATA, file, path);
@@ -129,7 +126,6 @@ const fetchFile = async (version, config$2, langcode = "en") => {
129
126
  if (!parsed.success) throw new Error(`Invalid input in ${filename}: ${parsed.error.message}`);
130
127
  return parsed;
131
128
  };
132
-
133
129
  //#endregion
134
130
  //#region src/server/v1/index.ts
135
131
  const API_VERSION = "v1";
@@ -180,7 +176,7 @@ const languagesFilter = (nested) => async (c, next) => {
180
176
  if (nested) c.res = new Response(JSON.stringify(Object.fromEntries(Object.entries(body).filter((e) => typeof e[1] === "object" && !!e[1] && "translations" in e[1] && typeof e[1]["translations"] === "object").map(([k, v]) => {
181
177
  return [k, {
182
178
  ...v,
183
- translations: filterObject(v["translations"], ([k$1]) => mappedLangs.includes(k$1))
179
+ translations: filterObject(v["translations"], ([k]) => mappedLangs.includes(k))
184
180
  }];
185
181
  }))), c.res);
186
182
  else c.res = new Response(JSON.stringify({
@@ -261,7 +257,5 @@ const app = new Hono().get("/", (c) => c.redirect("/v1/words")).get("/words", la
261
257
  message: `Could not find a language named ${language}`
262
258
  }, 400);
263
259
  });
264
- var v1_default = app;
265
-
266
260
  //#endregion
267
- export { fetchFile as a, fetchData as c, apps as i, v2_default as l, languagesFilter as n, versions as o, v1_default as r, config$1 as s, config as t };
261
+ export { fetchFile as a, config$1 as c, apps as i, fetchData as l, config as n, versions as o, languagesFilter as r, app$1 as s, app as t };
@@ -13,4 +13,4 @@
13
13
  }
14
14
  },
15
15
  "$schema": "http://json-schema.org/draft-07/schema#"
16
- }
16
+ }
@@ -14,4 +14,4 @@
14
14
  }
15
15
  },
16
16
  "$schema": "http://json-schema.org/draft-07/schema#"
17
- }
17
+ }
@@ -17,9 +17,7 @@
17
17
  "description": "The localized name of the language this word originated from"
18
18
  }
19
19
  },
20
- "required": [
21
- "language"
22
- ],
20
+ "required": ["language"],
23
21
  "additionalProperties": false
24
22
  }
25
23
  },
@@ -30,4 +28,4 @@
30
28
  }
31
29
  },
32
30
  "$schema": "http://json-schema.org/draft-07/schema#"
33
- }
31
+ }
@@ -28,10 +28,7 @@
28
28
  "description": "The name of the sign such that it could be found in a sign language dictionary."
29
29
  }
30
30
  },
31
- "required": [
32
- "language",
33
- "sign"
34
- ],
31
+ "required": ["language", "sign"],
35
32
  "additionalProperties": false
36
33
  },
37
34
  "description": "Unlocalized etymological values regarding this sign's origin"
@@ -48,10 +45,7 @@
48
45
  "description": "The Sign Writing with Unicode representation of hte sign."
49
46
  }
50
47
  },
51
- "required": [
52
- "fsw",
53
- "swu"
54
- ],
48
+ "required": ["fsw", "swu"],
55
49
  "additionalProperties": false,
56
50
  "description": "Scripts for representing a sign as characters."
57
51
  },
@@ -98,21 +92,12 @@
98
92
  "additionalProperties": false
99
93
  }
100
94
  },
101
- "required": [
102
- "parameters"
103
- ],
95
+ "required": ["parameters"],
104
96
  "additionalProperties": false
105
97
  }
106
98
  }
107
99
  },
108
- "required": [
109
- "id",
110
- "is_two_handed",
111
- "etymology",
112
- "signwriting",
113
- "video",
114
- "translations"
115
- ],
100
+ "required": ["id", "is_two_handed", "etymology", "signwriting", "video", "translations"],
116
101
  "additionalProperties": false,
117
102
  "description": "Unlocalized info on a fingerspelling sign."
118
103
  },
@@ -123,4 +108,4 @@
123
108
  }
124
109
  },
125
110
  "$schema": "http://json-schema.org/draft-07/schema#"
126
- }
111
+ }
@@ -26,10 +26,7 @@
26
26
  "description": "The name of the sign such that it could be found in a sign language dictionary."
27
27
  }
28
28
  },
29
- "required": [
30
- "language",
31
- "sign"
32
- ],
29
+ "required": ["language", "sign"],
33
30
  "additionalProperties": false
34
31
  },
35
32
  "description": "Unlocalized etymological values regarding this sign's origin"
@@ -46,10 +43,7 @@
46
43
  "description": "The Sign Writing with Unicode representation of hte sign."
47
44
  }
48
45
  },
49
- "required": [
50
- "fsw",
51
- "swu"
52
- ],
46
+ "required": ["fsw", "swu"],
53
47
  "additionalProperties": false,
54
48
  "description": "Scripts for representing a sign as characters."
55
49
  },
@@ -69,16 +63,10 @@
69
63
  "description": "Videos of the sign being performed, by format."
70
64
  }
71
65
  },
72
- "required": [
73
- "id",
74
- "is_two_handed",
75
- "etymology",
76
- "signwriting",
77
- "video"
78
- ],
66
+ "required": ["id", "is_two_handed", "etymology", "signwriting", "video"],
79
67
  "additionalProperties": false,
80
68
  "description": "Unlocalized info on a fingerspelling sign."
81
69
  }
82
70
  },
83
71
  "$schema": "http://json-schema.org/draft-07/schema#"
84
- }
72
+ }
@@ -114,4 +114,4 @@
114
114
  }
115
115
  },
116
116
  "$schema": "http://json-schema.org/draft-07/schema#"
117
- }
117
+ }
@@ -118,4 +118,4 @@
118
118
  }
119
119
  },
120
120
  "$schema": "http://json-schema.org/draft-07/schema#"
121
- }
121
+ }
@@ -13,4 +13,4 @@
13
13
  }
14
14
  },
15
15
  "$schema": "http://json-schema.org/draft-07/schema#"
16
- }
16
+ }
@@ -17,10 +17,7 @@
17
17
  },
18
18
  "direction": {
19
19
  "type": "string",
20
- "enum": [
21
- "ltr",
22
- "rtl"
23
- ],
20
+ "enum": ["ltr", "rtl"],
24
21
  "description": "The direction of the language's script."
25
22
  },
26
23
  "name": {
@@ -39,18 +36,11 @@
39
36
  "description": "The name of the language in that language."
40
37
  }
41
38
  },
42
- "required": [
43
- "en"
44
- ],
39
+ "required": ["en"],
45
40
  "additionalProperties": false
46
41
  }
47
42
  },
48
- "required": [
49
- "id",
50
- "locale",
51
- "direction",
52
- "name"
53
- ],
43
+ "required": ["id", "locale", "direction", "name"],
54
44
  "additionalProperties": false,
55
45
  "description": "The languages offered by sona Linku."
56
46
  },
@@ -60,4 +50,4 @@
60
50
  }
61
51
  },
62
52
  "$schema": "http://json-schema.org/draft-07/schema#"
63
- }
53
+ }
@@ -32,4 +32,4 @@
32
32
  }
33
33
  },
34
34
  "$schema": "http://json-schema.org/draft-07/schema#"
35
- }
35
+ }
@@ -38,9 +38,7 @@
38
38
  "description": "The name of the sign such that it could be found in a sign language dictionary."
39
39
  }
40
40
  },
41
- "required": [
42
- "language"
43
- ],
41
+ "required": ["language"],
44
42
  "additionalProperties": false
45
43
  },
46
44
  "description": "Unlocalized etymological values regarding this sign's origin"
@@ -57,10 +55,7 @@
57
55
  "description": "The [SignWriting with Unicode](https://en.wikipedia.org/wiki/SignWriting) representation of the sign."
58
56
  }
59
57
  },
60
- "required": [
61
- "fsw",
62
- "swu"
63
- ],
58
+ "required": ["fsw", "swu"],
64
59
  "additionalProperties": false,
65
60
  "description": "Scripts for representing a sign as characters."
66
61
  },
@@ -95,4 +90,4 @@
95
90
  }
96
91
  },
97
92
  "$schema": "http://json-schema.org/draft-07/schema#"
98
- }
93
+ }
@@ -40,9 +40,7 @@
40
40
  "description": "The name of the sign such that it could be found in a sign language dictionary."
41
41
  }
42
42
  },
43
- "required": [
44
- "language"
45
- ],
43
+ "required": ["language"],
46
44
  "additionalProperties": false
47
45
  },
48
46
  "description": "Unlocalized etymological values regarding this sign's origin"
@@ -59,10 +57,7 @@
59
57
  "description": "The [SignWriting with Unicode](https://en.wikipedia.org/wiki/SignWriting) representation of the sign."
60
58
  }
61
59
  },
62
- "required": [
63
- "fsw",
64
- "swu"
65
- ],
60
+ "required": ["fsw", "swu"],
66
61
  "additionalProperties": false,
67
62
  "description": "Scripts for representing a sign as characters."
68
63
  },
@@ -112,10 +107,7 @@
112
107
  "type": "string"
113
108
  }
114
109
  },
115
- "required": [
116
- "parameters",
117
- "icons"
118
- ],
110
+ "required": ["parameters", "icons"],
119
111
  "additionalProperties": false
120
112
  }
121
113
  }
@@ -141,4 +133,4 @@
141
133
  }
142
134
  },
143
135
  "$schema": "http://json-schema.org/draft-07/schema#"
144
- }
136
+ }
@@ -13,4 +13,4 @@
13
13
  }
14
14
  },
15
15
  "$schema": "http://json-schema.org/draft-07/schema#"
16
- }
16
+ }
@@ -19,23 +19,14 @@
19
19
  },
20
20
  "book": {
21
21
  "type": "string",
22
- "enum": [
23
- "pu",
24
- "ku suli",
25
- "ku lili",
26
- "none"
27
- ],
22
+ "enum": ["pu", "ku suli", "ku lili", "none"],
28
23
  "description": "Which official Toki Pona book was this word featured in, if any."
29
24
  },
30
25
  "coined_era": {
31
26
  "anyOf": [
32
27
  {
33
28
  "type": "string",
34
- "enum": [
35
- "pre-pu",
36
- "post-pu",
37
- "post-ku"
38
- ]
29
+ "enum": ["pre-pu", "post-pu", "post-ku"]
39
30
  },
40
31
  {
41
32
  "type": "string",
@@ -137,13 +128,7 @@
137
128
  },
138
129
  "usage_category": {
139
130
  "type": "string",
140
- "enum": [
141
- "core",
142
- "common",
143
- "uncommon",
144
- "obscure",
145
- "sandbox"
146
- ],
131
+ "enum": ["core", "common", "uncommon", "obscure", "sandbox"],
147
132
  "description": "The word's usage category, according to a survey performed by the Linku Project"
148
133
  },
149
134
  "word": {
@@ -187,10 +172,7 @@
187
172
  "description": "A link to the audio file for the word, pronounced by `author`."
188
173
  }
189
174
  },
190
- "required": [
191
- "author",
192
- "link"
193
- ],
175
+ "required": ["author", "link"],
194
176
  "additionalProperties": false,
195
177
  "description": "Audio files of the words pronounced out loud"
196
178
  }
@@ -215,12 +197,7 @@
215
197
  "description": "The original definition in the Esperanto version of pu"
216
198
  }
217
199
  },
218
- "required": [
219
- "en",
220
- "fr",
221
- "de",
222
- "eo"
223
- ],
200
+ "required": ["en", "fr", "de", "eo"],
224
201
  "additionalProperties": false,
225
202
  "description": "The original definition of the word in pu, the first official Toki Pona book"
226
203
  },
@@ -259,4 +236,4 @@
259
236
  }
260
237
  },
261
238
  "$schema": "http://json-schema.org/draft-07/schema#"
262
- }
239
+ }