@frictionless-ts/table 1.0.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 (317) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +3 -0
  3. package/build/assets/geojson.json +216 -0
  4. package/build/assets/topojson.json +259 -0
  5. package/build/data/index.d.ts +2 -0
  6. package/build/data/index.js +2 -0
  7. package/build/data/record.d.ts +4 -0
  8. package/build/data/record.js +84 -0
  9. package/build/data/record.spec.d.ts +1 -0
  10. package/build/data/record.spec.js +269 -0
  11. package/build/dialect/Options.d.ts +3 -0
  12. package/build/dialect/Options.js +3 -0
  13. package/build/dialect/index.d.ts +2 -0
  14. package/build/dialect/index.js +2 -0
  15. package/build/dialect/infer.d.ts +4 -0
  16. package/build/dialect/infer.js +2 -0
  17. package/build/field/Field.d.ts +5 -0
  18. package/build/field/Field.js +2 -0
  19. package/build/field/Mapping.d.ts +11 -0
  20. package/build/field/Mapping.js +2 -0
  21. package/build/field/checks/enum.d.ts +8 -0
  22. package/build/field/checks/enum.js +71 -0
  23. package/build/field/checks/enum.spec.d.ts +1 -0
  24. package/build/field/checks/enum.spec.js +327 -0
  25. package/build/field/checks/maxLength.d.ts +7 -0
  26. package/build/field/checks/maxLength.js +17 -0
  27. package/build/field/checks/maxLength.spec.d.ts +1 -0
  28. package/build/field/checks/maxLength.spec.js +49 -0
  29. package/build/field/checks/maximum.d.ts +11 -0
  30. package/build/field/checks/maximum.js +73 -0
  31. package/build/field/checks/maximum.spec.d.ts +1 -0
  32. package/build/field/checks/maximum.spec.js +476 -0
  33. package/build/field/checks/minLength.d.ts +7 -0
  34. package/build/field/checks/minLength.js +17 -0
  35. package/build/field/checks/minLength.spec.d.ts +1 -0
  36. package/build/field/checks/minLength.spec.js +56 -0
  37. package/build/field/checks/minimum.d.ts +11 -0
  38. package/build/field/checks/minimum.js +73 -0
  39. package/build/field/checks/minimum.spec.d.ts +1 -0
  40. package/build/field/checks/minimum.spec.js +476 -0
  41. package/build/field/checks/pattern.d.ts +7 -0
  42. package/build/field/checks/pattern.js +17 -0
  43. package/build/field/checks/pattern.spec.d.ts +1 -0
  44. package/build/field/checks/pattern.spec.js +66 -0
  45. package/build/field/checks/required.d.ts +7 -0
  46. package/build/field/checks/required.js +14 -0
  47. package/build/field/checks/required.spec.d.ts +1 -0
  48. package/build/field/checks/required.spec.js +24 -0
  49. package/build/field/checks/type.d.ts +7 -0
  50. package/build/field/checks/type.js +14 -0
  51. package/build/field/checks/type.spec.d.ts +1 -0
  52. package/build/field/checks/type.spec.js +255 -0
  53. package/build/field/checks/unique.d.ts +7 -0
  54. package/build/field/checks/unique.js +17 -0
  55. package/build/field/checks/unique.spec.d.ts +1 -0
  56. package/build/field/checks/unique.spec.js +97 -0
  57. package/build/field/denormalize.d.ts +6 -0
  58. package/build/field/denormalize.js +13 -0
  59. package/build/field/desubstitute.d.ts +3 -0
  60. package/build/field/desubstitute.js +13 -0
  61. package/build/field/index.d.ts +8 -0
  62. package/build/field/index.js +6 -0
  63. package/build/field/inspect.d.ts +6 -0
  64. package/build/field/inspect.js +131 -0
  65. package/build/field/inspect.spec.d.ts +1 -0
  66. package/build/field/inspect.spec.js +385 -0
  67. package/build/field/narrow.d.ts +3 -0
  68. package/build/field/narrow.js +14 -0
  69. package/build/field/narrow.spec.d.ts +1 -0
  70. package/build/field/narrow.spec.js +52 -0
  71. package/build/field/normalize.d.ts +5 -0
  72. package/build/field/normalize.js +14 -0
  73. package/build/field/parse.d.ts +3 -0
  74. package/build/field/parse.js +47 -0
  75. package/build/field/parse.spec.d.ts +1 -0
  76. package/build/field/parse.spec.js +33 -0
  77. package/build/field/stringify.d.ts +3 -0
  78. package/build/field/stringify.js +43 -0
  79. package/build/field/stringify.spec.d.ts +1 -0
  80. package/build/field/stringify.spec.js +41 -0
  81. package/build/field/substitute.d.ts +3 -0
  82. package/build/field/substitute.js +16 -0
  83. package/build/field/types/array.d.ts +3 -0
  84. package/build/field/types/array.js +5 -0
  85. package/build/field/types/array.spec.d.ts +1 -0
  86. package/build/field/types/array.spec.js +358 -0
  87. package/build/field/types/boolean.d.ts +4 -0
  88. package/build/field/types/boolean.js +31 -0
  89. package/build/field/types/boolean.spec.d.ts +1 -0
  90. package/build/field/types/boolean.spec.js +76 -0
  91. package/build/field/types/date.d.ts +4 -0
  92. package/build/field/types/date.js +14 -0
  93. package/build/field/types/date.spec.d.ts +1 -0
  94. package/build/field/types/date.spec.js +52 -0
  95. package/build/field/types/datetime.d.ts +4 -0
  96. package/build/field/types/datetime.js +15 -0
  97. package/build/field/types/datetime.spec.d.ts +1 -0
  98. package/build/field/types/datetime.spec.js +62 -0
  99. package/build/field/types/duration.d.ts +4 -0
  100. package/build/field/types/duration.js +9 -0
  101. package/build/field/types/duration.spec.d.ts +1 -0
  102. package/build/field/types/duration.spec.js +37 -0
  103. package/build/field/types/geojson.d.ts +3 -0
  104. package/build/field/types/geojson.js +9 -0
  105. package/build/field/types/geojson.spec.d.ts +1 -0
  106. package/build/field/types/geojson.spec.js +522 -0
  107. package/build/field/types/geopoint.d.ts +4 -0
  108. package/build/field/types/geopoint.js +59 -0
  109. package/build/field/types/geopoint.spec.d.ts +1 -0
  110. package/build/field/types/geopoint.spec.js +173 -0
  111. package/build/field/types/integer.d.ts +4 -0
  112. package/build/field/types/integer.js +41 -0
  113. package/build/field/types/integer.spec.d.ts +1 -0
  114. package/build/field/types/integer.spec.js +102 -0
  115. package/build/field/types/json.d.ts +6 -0
  116. package/build/field/types/json.js +68 -0
  117. package/build/field/types/list.d.ts +4 -0
  118. package/build/field/types/list.js +30 -0
  119. package/build/field/types/list.spec.d.ts +1 -0
  120. package/build/field/types/list.spec.js +230 -0
  121. package/build/field/types/number.d.ts +4 -0
  122. package/build/field/types/number.js +50 -0
  123. package/build/field/types/number.spec.d.ts +1 -0
  124. package/build/field/types/number.spec.js +101 -0
  125. package/build/field/types/object.d.ts +3 -0
  126. package/build/field/types/object.js +5 -0
  127. package/build/field/types/object.spec.d.ts +1 -0
  128. package/build/field/types/object.spec.js +393 -0
  129. package/build/field/types/string.d.ts +4 -0
  130. package/build/field/types/string.js +32 -0
  131. package/build/field/types/string.spec.d.ts +1 -0
  132. package/build/field/types/string.spec.js +162 -0
  133. package/build/field/types/time.d.ts +4 -0
  134. package/build/field/types/time.js +18 -0
  135. package/build/field/types/time.spec.d.ts +1 -0
  136. package/build/field/types/time.spec.js +53 -0
  137. package/build/field/types/year.d.ts +4 -0
  138. package/build/field/types/year.js +16 -0
  139. package/build/field/types/year.spec.d.ts +1 -0
  140. package/build/field/types/year.spec.js +50 -0
  141. package/build/field/types/yearmonth.d.ts +4 -0
  142. package/build/field/types/yearmonth.js +14 -0
  143. package/build/field/types/yearmonth.spec.d.ts +1 -0
  144. package/build/field/types/yearmonth.spec.js +36 -0
  145. package/build/helpers.d.ts +4 -0
  146. package/build/helpers.js +12 -0
  147. package/build/index.d.ts +40 -0
  148. package/build/index.js +27 -0
  149. package/build/plugin.d.ts +27 -0
  150. package/build/plugin.js +2 -0
  151. package/build/plugins/arrow/index.d.ts +2 -0
  152. package/build/plugins/arrow/index.js +3 -0
  153. package/build/plugins/arrow/plugin.d.ts +7 -0
  154. package/build/plugins/arrow/plugin.js +22 -0
  155. package/build/plugins/arrow/plugin.spec.d.ts +1 -0
  156. package/build/plugins/arrow/plugin.spec.js +161 -0
  157. package/build/plugins/arrow/table/index.d.ts +2 -0
  158. package/build/plugins/arrow/table/index.js +3 -0
  159. package/build/plugins/arrow/table/load.d.ts +4 -0
  160. package/build/plugins/arrow/table/load.js +23 -0
  161. package/build/plugins/arrow/table/load.spec.d.ts +1 -0
  162. package/build/plugins/arrow/table/load.spec.js +56 -0
  163. package/build/plugins/arrow/table/save.d.ts +3 -0
  164. package/build/plugins/arrow/table/save.js +31 -0
  165. package/build/plugins/arrow/table/save.spec.d.ts +1 -0
  166. package/build/plugins/arrow/table/save.spec.js +81 -0
  167. package/build/plugins/csv/dialect/index.d.ts +1 -0
  168. package/build/plugins/csv/dialect/index.js +2 -0
  169. package/build/plugins/csv/dialect/infer.d.ts +4 -0
  170. package/build/plugins/csv/dialect/infer.js +44 -0
  171. package/build/plugins/csv/dialect/infer.spec.d.ts +1 -0
  172. package/build/plugins/csv/dialect/infer.spec.js +54 -0
  173. package/build/plugins/csv/index.d.ts +2 -0
  174. package/build/plugins/csv/index.js +3 -0
  175. package/build/plugins/csv/plugin.d.ts +8 -0
  176. package/build/plugins/csv/plugin.js +22 -0
  177. package/build/plugins/csv/plugin.spec.d.ts +1 -0
  178. package/build/plugins/csv/plugin.spec.js +161 -0
  179. package/build/plugins/csv/table/index.d.ts +2 -0
  180. package/build/plugins/csv/table/index.js +3 -0
  181. package/build/plugins/csv/table/load.d.ts +6 -0
  182. package/build/plugins/csv/table/load.js +86 -0
  183. package/build/plugins/csv/table/load.spec.d.ts +1 -0
  184. package/build/plugins/csv/table/load.spec.js +293 -0
  185. package/build/plugins/csv/table/save.d.ts +5 -0
  186. package/build/plugins/csv/table/save.js +29 -0
  187. package/build/plugins/csv/table/save.spec.d.ts +1 -0
  188. package/build/plugins/csv/table/save.spec.js +137 -0
  189. package/build/plugins/inline/index.d.ts +2 -0
  190. package/build/plugins/inline/index.js +3 -0
  191. package/build/plugins/inline/plugin.d.ts +7 -0
  192. package/build/plugins/inline/plugin.js +14 -0
  193. package/build/plugins/inline/table/index.d.ts +1 -0
  194. package/build/plugins/inline/table/index.js +2 -0
  195. package/build/plugins/inline/table/load.d.ts +6 -0
  196. package/build/plugins/inline/table/load.js +24 -0
  197. package/build/plugins/inline/table/load.spec.d.ts +1 -0
  198. package/build/plugins/inline/table/load.spec.js +160 -0
  199. package/build/plugins/json/buffer/decode.d.ts +4 -0
  200. package/build/plugins/json/buffer/decode.js +10 -0
  201. package/build/plugins/json/buffer/encode.d.ts +4 -0
  202. package/build/plugins/json/buffer/encode.js +8 -0
  203. package/build/plugins/json/buffer/index.d.ts +2 -0
  204. package/build/plugins/json/buffer/index.js +3 -0
  205. package/build/plugins/json/index.d.ts +2 -0
  206. package/build/plugins/json/index.js +3 -0
  207. package/build/plugins/json/plugin.d.ts +7 -0
  208. package/build/plugins/json/plugin.js +25 -0
  209. package/build/plugins/json/plugin.spec.d.ts +1 -0
  210. package/build/plugins/json/plugin.spec.js +163 -0
  211. package/build/plugins/json/table/index.d.ts +2 -0
  212. package/build/plugins/json/table/index.js +3 -0
  213. package/build/plugins/json/table/load.d.ts +6 -0
  214. package/build/plugins/json/table/load.js +55 -0
  215. package/build/plugins/json/table/load.spec.d.ts +1 -0
  216. package/build/plugins/json/table/load.spec.js +200 -0
  217. package/build/plugins/json/table/parse.d.ts +3 -0
  218. package/build/plugins/json/table/parse.js +6 -0
  219. package/build/plugins/json/table/save.d.ts +5 -0
  220. package/build/plugins/json/table/save.js +45 -0
  221. package/build/plugins/json/table/save.spec.d.ts +1 -0
  222. package/build/plugins/json/table/save.spec.js +147 -0
  223. package/build/plugins/ods/index.d.ts +2 -0
  224. package/build/plugins/ods/index.js +3 -0
  225. package/build/plugins/ods/plugin.d.ts +7 -0
  226. package/build/plugins/ods/plugin.js +23 -0
  227. package/build/plugins/ods/plugin.spec.d.ts +1 -0
  228. package/build/plugins/ods/plugin.spec.js +142 -0
  229. package/build/plugins/ods/table/index.d.ts +2 -0
  230. package/build/plugins/ods/table/index.js +3 -0
  231. package/build/plugins/ods/table/load.d.ts +4 -0
  232. package/build/plugins/ods/table/load.js +41 -0
  233. package/build/plugins/ods/table/load.spec.d.ts +1 -0
  234. package/build/plugins/ods/table/load.spec.js +167 -0
  235. package/build/plugins/ods/table/save.d.ts +3 -0
  236. package/build/plugins/ods/table/save.js +26 -0
  237. package/build/plugins/ods/table/save.spec.d.ts +1 -0
  238. package/build/plugins/ods/table/save.spec.js +75 -0
  239. package/build/plugins/ods/table/test.d.ts +5 -0
  240. package/build/plugins/ods/table/test.js +23 -0
  241. package/build/plugins/parquet/index.d.ts +2 -0
  242. package/build/plugins/parquet/index.js +3 -0
  243. package/build/plugins/parquet/plugin.d.ts +7 -0
  244. package/build/plugins/parquet/plugin.js +23 -0
  245. package/build/plugins/parquet/plugin.spec.d.ts +1 -0
  246. package/build/plugins/parquet/plugin.spec.js +142 -0
  247. package/build/plugins/parquet/table/index.d.ts +2 -0
  248. package/build/plugins/parquet/table/index.js +3 -0
  249. package/build/plugins/parquet/table/load.d.ts +4 -0
  250. package/build/plugins/parquet/table/load.js +23 -0
  251. package/build/plugins/parquet/table/load.spec.d.ts +1 -0
  252. package/build/plugins/parquet/table/load.spec.js +56 -0
  253. package/build/plugins/parquet/table/save.d.ts +3 -0
  254. package/build/plugins/parquet/table/save.js +32 -0
  255. package/build/plugins/parquet/table/save.spec.d.ts +1 -0
  256. package/build/plugins/parquet/table/save.spec.js +81 -0
  257. package/build/plugins/xlxs/index.d.ts +2 -0
  258. package/build/plugins/xlxs/index.js +3 -0
  259. package/build/plugins/xlxs/plugin.d.ts +7 -0
  260. package/build/plugins/xlxs/plugin.js +23 -0
  261. package/build/plugins/xlxs/plugin.spec.d.ts +1 -0
  262. package/build/plugins/xlxs/plugin.spec.js +142 -0
  263. package/build/plugins/xlxs/table/index.d.ts +2 -0
  264. package/build/plugins/xlxs/table/index.js +3 -0
  265. package/build/plugins/xlxs/table/load.d.ts +4 -0
  266. package/build/plugins/xlxs/table/load.js +43 -0
  267. package/build/plugins/xlxs/table/load.spec.d.ts +1 -0
  268. package/build/plugins/xlxs/table/load.spec.js +167 -0
  269. package/build/plugins/xlxs/table/save.d.ts +3 -0
  270. package/build/plugins/xlxs/table/save.js +28 -0
  271. package/build/plugins/xlxs/table/save.spec.d.ts +1 -0
  272. package/build/plugins/xlxs/table/save.spec.js +75 -0
  273. package/build/plugins/xlxs/table/test.d.ts +5 -0
  274. package/build/plugins/xlxs/table/test.js +23 -0
  275. package/build/schema/Mapping.d.ts +6 -0
  276. package/build/schema/Mapping.js +2 -0
  277. package/build/schema/Options.d.ts +22 -0
  278. package/build/schema/Options.js +2 -0
  279. package/build/schema/Schema.d.ts +4 -0
  280. package/build/schema/Schema.js +2 -0
  281. package/build/schema/helpers.d.ts +3 -0
  282. package/build/schema/helpers.js +6 -0
  283. package/build/schema/index.d.ts +8 -0
  284. package/build/schema/index.js +5 -0
  285. package/build/schema/infer.d.ts +13 -0
  286. package/build/schema/infer.js +199 -0
  287. package/build/schema/infer.spec.d.ts +1 -0
  288. package/build/schema/infer.spec.js +304 -0
  289. package/build/schema/match.d.ts +6 -0
  290. package/build/schema/match.js +8 -0
  291. package/build/table/Frame.d.ts +2 -0
  292. package/build/table/Frame.js +2 -0
  293. package/build/table/Table.d.ts +2 -0
  294. package/build/table/Table.js +2 -0
  295. package/build/table/checks/unique.d.ts +7 -0
  296. package/build/table/checks/unique.js +23 -0
  297. package/build/table/checks/unique.spec.d.ts +1 -0
  298. package/build/table/checks/unique.spec.js +187 -0
  299. package/build/table/denormalize.d.ts +6 -0
  300. package/build/table/denormalize.js +15 -0
  301. package/build/table/helpers.d.ts +19 -0
  302. package/build/table/helpers.js +62 -0
  303. package/build/table/helpers.spec.d.ts +1 -0
  304. package/build/table/helpers.spec.js +352 -0
  305. package/build/table/index.d.ts +9 -0
  306. package/build/table/index.js +8 -0
  307. package/build/table/inspect.d.ts +8 -0
  308. package/build/table/inspect.js +165 -0
  309. package/build/table/inspect.spec.d.ts +1 -0
  310. package/build/table/inspect.spec.js +335 -0
  311. package/build/table/normalize.d.ts +6 -0
  312. package/build/table/normalize.js +27 -0
  313. package/build/table/normalize.spec.d.ts +1 -0
  314. package/build/table/normalize.spec.js +222 -0
  315. package/build/table/query.d.ts +3 -0
  316. package/build/table/query.js +6 -0
  317. package/package.json +45 -0
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright © `2025` `Evgeny Karev`
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @frictionless-ts/table
2
+
3
+ frictionless-ts is a fast TypeScript data management framework built on top of the Data Package standard and Polars DataFrames. It supports various formats like CSV, JSON, and Parquet and integrates with data platforms such as CKAN, Zenodo, and GitHub. For more information, please read the [project's documentation](https://frictionlessdata.github.io/frictionless-ts/).
@@ -0,0 +1,216 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "Geo JSON object",
4
+ "description": "Schema for a Geo JSON object",
5
+ "type": "object",
6
+ "required": ["type"],
7
+ "properties": {
8
+ "crs": { "$ref": "#/definitions/crs" },
9
+ "bbox": { "$ref": "#/definitions/bbox" }
10
+ },
11
+ "oneOf": [
12
+ { "$ref": "#/definitions/geometry" },
13
+ { "$ref": "#/definitions/geometryCollection" },
14
+ { "$ref": "#/definitions/feature" },
15
+ { "$ref": "#/definitions/featureCollection" }
16
+ ],
17
+ "definitions": {
18
+ "geometryCollection": {
19
+ "title": "GeometryCollection",
20
+ "description": "A collection of geometry objects",
21
+ "required": ["geometries"],
22
+ "properties": {
23
+ "type": { "enum": ["GeometryCollection"] },
24
+ "geometries": {
25
+ "type": "array",
26
+ "items": { "$ref": "#/definitions/geometry" }
27
+ }
28
+ }
29
+ },
30
+ "feature": {
31
+ "title": "Feature",
32
+ "description": "A Geo JSON feature object",
33
+ "required": ["geometry", "properties"],
34
+ "properties": {
35
+ "type": { "enum": ["Feature"] },
36
+ "geometry": {
37
+ "oneOf": [{ "type": "null" }, { "$ref": "#/definitions/geometry" }]
38
+ },
39
+ "properties": { "type": ["object", "null"] },
40
+ "id": { "FIXME": "may be there, type not known (string? number?)" }
41
+ }
42
+ },
43
+ "featureCollection": {
44
+ "title": "FeatureCollection",
45
+ "description": "A Geo JSON feature collection",
46
+ "required": ["features"],
47
+ "properties": {
48
+ "type": { "enum": ["FeatureCollection"] },
49
+ "features": {
50
+ "type": "array",
51
+ "items": { "$ref": "#/definitions/feature" }
52
+ }
53
+ }
54
+ },
55
+ "geometry": {
56
+ "title": "geometry",
57
+ "description": "One geometry as defined by GeoJSON",
58
+ "type": "object",
59
+ "required": ["type", "coordinates"],
60
+ "oneOf": [
61
+ {
62
+ "title": "Point",
63
+ "properties": {
64
+ "type": { "enum": ["Point"] },
65
+ "coordinates": {
66
+ "$ref": "#/definitions/geometry/definitions/position"
67
+ }
68
+ }
69
+ },
70
+ {
71
+ "title": "MultiPoint",
72
+ "properties": {
73
+ "type": { "enum": ["MultiPoint"] },
74
+ "coordinates": {
75
+ "$ref": "#/definitions/geometry/definitions/positionArray"
76
+ }
77
+ }
78
+ },
79
+ {
80
+ "title": "LineString",
81
+ "properties": {
82
+ "type": { "enum": ["LineString"] },
83
+ "coordinates": {
84
+ "$ref": "#/definitions/geometry/definitions/lineString"
85
+ }
86
+ }
87
+ },
88
+ {
89
+ "title": "MultiLineString",
90
+ "properties": {
91
+ "type": { "enum": ["MultiLineString"] },
92
+ "coordinates": {
93
+ "type": "array",
94
+ "items": {
95
+ "$ref": "#/definitions/geometry/definitions/lineString"
96
+ }
97
+ }
98
+ }
99
+ },
100
+ {
101
+ "title": "Polygon",
102
+ "properties": {
103
+ "type": { "enum": ["Polygon"] },
104
+ "coordinates": {
105
+ "$ref": "#/definitions/geometry/definitions/polygon"
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "title": "MultiPolygon",
111
+ "properties": {
112
+ "type": { "enum": ["MultiPolygon"] },
113
+ "coordinates": {
114
+ "type": "array",
115
+ "items": { "$ref": "#/definitions/geometry/definitions/polygon" }
116
+ }
117
+ }
118
+ }
119
+ ],
120
+ "definitions": {
121
+ "position": {
122
+ "description": "A single position",
123
+ "type": "array",
124
+ "minItems": 2,
125
+ "items": [{ "type": "number" }, { "type": "number" }],
126
+ "additionalItems": false
127
+ },
128
+ "positionArray": {
129
+ "description": "An array of positions",
130
+ "type": "array",
131
+ "items": { "$ref": "#/definitions/geometry/definitions/position" }
132
+ },
133
+ "lineString": {
134
+ "description": "An array of two or more positions",
135
+ "allOf": [
136
+ { "$ref": "#/definitions/geometry/definitions/positionArray" },
137
+ { "minItems": 2 }
138
+ ]
139
+ },
140
+ "linearRing": {
141
+ "description": "An array of four positions where the first equals the last",
142
+ "allOf": [
143
+ { "$ref": "#/definitions/geometry/definitions/positionArray" },
144
+ { "minItems": 4 }
145
+ ]
146
+ },
147
+ "polygon": {
148
+ "description": "An array of linear rings",
149
+ "type": "array",
150
+ "items": { "$ref": "#/definitions/geometry/definitions/linearRing" }
151
+ }
152
+ }
153
+ },
154
+ "crs": {
155
+ "title": "crs",
156
+ "description": "a Coordinate Reference System object",
157
+ "type": ["object", "null"],
158
+ "required": ["type", "properties"],
159
+ "properties": {
160
+ "type": { "type": "string" },
161
+ "properties": { "type": "object" }
162
+ },
163
+ "additionalProperties": false,
164
+ "oneOf": [
165
+ { "$ref": "#/definitions/crs/definitions/namedCrs" },
166
+ { "$ref": "#/definitions/crs/definitions/linkedCrs" }
167
+ ],
168
+ "definitions": {
169
+ "namedCrs": {
170
+ "properties": {
171
+ "type": { "enum": ["name"] },
172
+ "properties": {
173
+ "required": ["name"],
174
+ "additionalProperties": false,
175
+ "properties": {
176
+ "name": {
177
+ "type": "string",
178
+ "FIXME": "semantic validation necessary"
179
+ }
180
+ }
181
+ }
182
+ }
183
+ },
184
+ "linkedObject": {
185
+ "type": "object",
186
+ "required": ["href"],
187
+ "properties": {
188
+ "href": {
189
+ "type": "string",
190
+ "format": "uri",
191
+ "FIXME": "spec says \"dereferenceable\", cannot enforce that"
192
+ },
193
+ "type": {
194
+ "type": "string",
195
+ "description": "Suggested values: proj4, ogjwkt, esriwkt"
196
+ }
197
+ }
198
+ },
199
+ "linkedCrs": {
200
+ "properties": {
201
+ "type": { "enum": ["link"] },
202
+ "properties": {
203
+ "$ref": "#/definitions/crs/definitions/linkedObject"
204
+ }
205
+ }
206
+ }
207
+ }
208
+ },
209
+ "bbox": {
210
+ "description": "A bounding box as defined by GeoJSON",
211
+ "FIXME": "unenforceable constraint: even number of elements in array",
212
+ "type": "array",
213
+ "items": { "type": "number" }
214
+ }
215
+ }
216
+ }
@@ -0,0 +1,259 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "TopoJSON object",
4
+ "description": "Schema for a TopoJSON object",
5
+ "type": "object",
6
+ "required": ["type"],
7
+ "properties": {
8
+ "bbox": {
9
+ "$ref": "#/definitions/bbox"
10
+ }
11
+ },
12
+ "oneOf": [
13
+ {
14
+ "$ref": "#/definitions/topology"
15
+ },
16
+ {
17
+ "$ref": "#/definitions/geometry"
18
+ }
19
+ ],
20
+ "definitions": {
21
+ "bbox": {
22
+ "title": "TopoJSON bounding box",
23
+ "description": "A bounding box as defined by TopoJSON",
24
+ "type": "array",
25
+ "items": {
26
+ "$ref": "#/definitions/bbox/definitions/dimension"
27
+ },
28
+ "minItems": 2,
29
+ "maxItems": 2,
30
+ "definitions": {
31
+ "dimension": {
32
+ "type": "array",
33
+ "description": "This array should have an entry per dimension in the geometries",
34
+ "items": {
35
+ "type": "number"
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "geometry": {
41
+ "title": "Geometry objects",
42
+ "description": "A Geometry object as defined by TopoJSON",
43
+ "type": "object",
44
+ "required": ["type"],
45
+ "properties": {
46
+ "id": {
47
+ "type": ["string", "integer"]
48
+ },
49
+ "properties": {
50
+ "type": "object"
51
+ }
52
+ },
53
+ "oneOf": [
54
+ {
55
+ "title": "Point",
56
+ "description": "A Point Geometry object as defined by TopoJSON",
57
+ "required": ["type", "coordinates"],
58
+ "properties": {
59
+ "type": {
60
+ "enum": ["Point"]
61
+ },
62
+ "coordinates": {
63
+ "$ref": "#/definitions/geometry/definitions/position"
64
+ }
65
+ }
66
+ },
67
+ {
68
+ "title": "MultiPoint",
69
+ "description": "A MultiPoint Geometry object as defined by TopoJSON",
70
+ "required": ["type", "coordinates"],
71
+ "properties": {
72
+ "type": {
73
+ "enum": ["MultiPoint"]
74
+ },
75
+ "coordinates": {
76
+ "type": "array",
77
+ "items": {
78
+ "$ref": "#/definitions/geometry/definitions/position"
79
+ }
80
+ }
81
+ }
82
+ },
83
+ {
84
+ "title": "LineString",
85
+ "description": "A LineString Geometry object as defined by TopoJSON",
86
+ "required": ["type", "arcs"],
87
+ "properties": {
88
+ "type": {
89
+ "enum": ["LineString"]
90
+ },
91
+ "arcs": {
92
+ "type": "array",
93
+ "items": {
94
+ "type": "integer"
95
+ }
96
+ }
97
+ }
98
+ },
99
+ {
100
+ "title": "MultiLineString",
101
+ "description": "A MultiLineString Geometry object as defined by TopoJSON",
102
+ "required": ["type", "arcs"],
103
+ "properties": {
104
+ "type": {
105
+ "enum": ["MultiLineString"]
106
+ },
107
+ "arcs": {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "array",
111
+ "items": {
112
+ "type": "integer"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ },
118
+ {
119
+ "title": "Polygon",
120
+ "description": "A Polygon Geometry object as defined by TopoJSON",
121
+ "required": ["type", "arcs"],
122
+ "properties": {
123
+ "type": {
124
+ "enum": ["Polygon"]
125
+ },
126
+ "arcs": {
127
+ "type": "array",
128
+ "items": {
129
+ "type": "array",
130
+ "items": {
131
+ "type": "integer"
132
+ }
133
+ }
134
+ }
135
+ }
136
+ },
137
+ {
138
+ "title": "MultiPolygon",
139
+ "description": "A MultiPolygon Geometry object as defined by TopoJSON",
140
+ "required": ["type", "arcs"],
141
+ "properties": {
142
+ "type": {
143
+ "enum": ["MultiPolygon"]
144
+ },
145
+ "arcs": {
146
+ "type": "array",
147
+ "items": {
148
+ "type": "array",
149
+ "items": {
150
+ "type": "array",
151
+ "items": {
152
+ "type": "integer"
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
158
+ },
159
+ {
160
+ "title": "GeometryCollection",
161
+ "description": "A MultiPolygon Geometry object as defined by TopoJSON",
162
+ "required": ["type", "geometries"],
163
+ "properties": {
164
+ "type": {
165
+ "enum": ["GeometryCollection"]
166
+ },
167
+ "geometries": {
168
+ "type": "array",
169
+ "items": {
170
+ "$ref": "#/definitions/geometry"
171
+ }
172
+ }
173
+ }
174
+ }
175
+ ],
176
+ "definitions": {
177
+ "position": {
178
+ "type": "array",
179
+ "items": {
180
+ "type": "number"
181
+ },
182
+ "minItems": 2
183
+ }
184
+ }
185
+ },
186
+ "topology": {
187
+ "title": "Topology",
188
+ "description": "A Topology object as defined by TopoJSON",
189
+ "type": "object",
190
+ "required": ["objects", "arcs"],
191
+ "properties": {
192
+ "type": {
193
+ "enum": ["Topology"]
194
+ },
195
+ "objects": {
196
+ "type": "object",
197
+ "additionalProperties": {
198
+ "$ref": "#/definitions/geometry"
199
+ }
200
+ },
201
+ "arcs": {
202
+ "$ref": "#/definitions/topology/definitions/arcs"
203
+ },
204
+ "transform": {
205
+ "$ref": "#/definitions/topology/definitions/transform"
206
+ },
207
+ "bbox": {
208
+ "$ref": "#/definitions/bbox"
209
+ }
210
+ },
211
+ "definitions": {
212
+ "transform": {
213
+ "type": "object",
214
+ "required": ["scale", "translate"],
215
+ "properties": {
216
+ "scale": {
217
+ "type": "array",
218
+ "items": {
219
+ "type": "number"
220
+ },
221
+ "minItems": 2
222
+ },
223
+ "translate": {
224
+ "type": "array",
225
+ "items": {
226
+ "type": "number"
227
+ },
228
+ "minItems": 2
229
+ }
230
+ }
231
+ },
232
+ "arcs": {
233
+ "type": "array",
234
+ "items": {
235
+ "type": "array",
236
+ "items": {
237
+ "oneOf": [
238
+ {
239
+ "$ref": "#/definitions/topology/definitions/position"
240
+ },
241
+ {
242
+ "type": "null"
243
+ }
244
+ ]
245
+ },
246
+ "minItems": 2
247
+ }
248
+ },
249
+ "position": {
250
+ "type": "array",
251
+ "items": {
252
+ "type": "number"
253
+ },
254
+ "minItems": 2
255
+ }
256
+ }
257
+ }
258
+ }
259
+ }
@@ -0,0 +1,2 @@
1
+ export { getRecordsFromRows } from "./record.ts";
2
+ export type { DataRow, DataRecord } from "./record.ts";
@@ -0,0 +1,2 @@
1
+ export { getRecordsFromRows } from "./record.js";
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9kYXRhL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLGFBQWEsQ0FBQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IGdldFJlY29yZHNGcm9tUm93cyB9IGZyb20gXCIuL3JlY29yZC50c1wiXG5leHBvcnQgdHlwZSB7IERhdGFSb3csIERhdGFSZWNvcmQgfSBmcm9tIFwiLi9yZWNvcmQudHNcIlxuIl19
@@ -0,0 +1,4 @@
1
+ import type { Dialect } from "@frictionless-ts/metadata";
2
+ export type DataRow = unknown[];
3
+ export type DataRecord = Record<string, unknown>;
4
+ export declare function getRecordsFromRows(rows: DataRow[], dialect?: Dialect): DataRecord[];
@@ -0,0 +1,84 @@
1
+ export function getRecordsFromRows(rows, dialect) {
2
+ const records = [];
3
+ const header = getHeaderFromRows(rows, dialect);
4
+ const content = getContentFromRows(rows, dialect);
5
+ const labels = getLabelsFromHeader(header, dialect);
6
+ if (!labels) {
7
+ return records;
8
+ }
9
+ for (const row of content) {
10
+ const isCommentedRow = getIsCommentedRow(row, dialect);
11
+ if (isCommentedRow) {
12
+ continue;
13
+ }
14
+ records.push(Object.fromEntries(labels.map((label, index) => [label, row[index]])));
15
+ }
16
+ return records;
17
+ }
18
+ function getHeaderFromRows(rows, dialect) {
19
+ const hasHeader = dialect?.header !== false;
20
+ const headerRows = dialect?.headerRows ?? [1];
21
+ if (!hasHeader) {
22
+ const length = Math.max(...rows.map(row => row.length));
23
+ const labels = Array.from({ length }, (_, idx) => `field${idx + 1}`);
24
+ return [labels];
25
+ }
26
+ const header = [];
27
+ for (const number of headerRows) {
28
+ const row = rows[number - 1];
29
+ if (row) {
30
+ header.push(row);
31
+ }
32
+ }
33
+ return header;
34
+ }
35
+ function getContentFromRows(rows, dialect) {
36
+ const hasHeader = dialect?.header !== false;
37
+ const headerRows = dialect?.headerRows ?? (hasHeader ? [1] : []);
38
+ const commentRows = dialect?.commentRows ?? [];
39
+ const skipRows = headerRows[0] ? headerRows[0] - 1 : 0;
40
+ const content = [];
41
+ for (const [index, row] of rows.entries()) {
42
+ const number = index + 1;
43
+ if (number <= skipRows) {
44
+ continue;
45
+ }
46
+ if (headerRows.includes(number)) {
47
+ continue;
48
+ }
49
+ if (commentRows.includes(number)) {
50
+ continue;
51
+ }
52
+ const isCommentedRow = getIsCommentedRow(row, dialect);
53
+ if (isCommentedRow) {
54
+ continue;
55
+ }
56
+ content.push(row);
57
+ }
58
+ return content;
59
+ }
60
+ function getLabelsFromHeader(header, dialect) {
61
+ if (!header[0]) {
62
+ return undefined;
63
+ }
64
+ const labels = header[0].map(String);
65
+ const headerJoin = dialect?.headerJoin ?? " ";
66
+ for (const row of header.slice(1)) {
67
+ for (const [index, label] of row.entries()) {
68
+ const prefix = labels[index] ?? "";
69
+ labels[index] = [prefix, label].filter(Boolean).join(headerJoin);
70
+ }
71
+ }
72
+ return labels;
73
+ }
74
+ function getIsCommentedRow(row, dialect) {
75
+ const commentChar = dialect?.commentChar;
76
+ if (!commentChar) {
77
+ return false;
78
+ }
79
+ if (typeof row[0] !== "string") {
80
+ return false;
81
+ }
82
+ return row[0].startsWith(commentChar);
83
+ }
84
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVjb3JkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGF0YS9yZWNvcmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsTUFBTSxVQUFVLGtCQUFrQixDQUFDLElBQWUsRUFBRSxPQUFpQjtJQUNuRSxNQUFNLE9BQU8sR0FBaUIsRUFBRSxDQUFBO0lBRWhDLE1BQU0sTUFBTSxHQUFHLGlCQUFpQixDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQTtJQUMvQyxNQUFNLE9BQU8sR0FBRyxrQkFBa0IsQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUE7SUFFakQsTUFBTSxNQUFNLEdBQUcsbUJBQW1CLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxDQUFBO0lBQ25ELElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUNaLE9BQU8sT0FBTyxDQUFBO0lBQ2hCLENBQUM7SUFFRCxLQUFLLE1BQU0sR0FBRyxJQUFJLE9BQU8sRUFBRSxDQUFDO1FBQzFCLE1BQU0sY0FBYyxHQUFHLGlCQUFpQixDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQTtRQUN0RCxJQUFJLGNBQWMsRUFBRSxDQUFDO1lBQ25CLFNBQVE7UUFDVixDQUFDO1FBRUQsT0FBTyxDQUFDLElBQUksQ0FDVixNQUFNLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEtBQUssRUFBRSxHQUFHLEN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