@comapeo/core 4.4.0 → 5.0.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 (72) hide show
  1. package/dist/blob-store/downloader.d.ts +5 -2
  2. package/dist/blob-store/downloader.d.ts.map +1 -1
  3. package/dist/constants.d.ts +0 -1
  4. package/dist/constants.d.ts.map +1 -1
  5. package/dist/datatype/index.d.ts +1 -1
  6. package/dist/datatype/index.d.ts.map +1 -1
  7. package/dist/discovery/local-discovery.d.ts.map +1 -1
  8. package/dist/import-categories.d.ts +19 -0
  9. package/dist/import-categories.d.ts.map +1 -0
  10. package/dist/intl/iso639.d.ts +4 -0
  11. package/dist/intl/iso639.d.ts.map +1 -0
  12. package/dist/intl/parse-bcp-47.d.ts +22 -0
  13. package/dist/intl/parse-bcp-47.d.ts.map +1 -0
  14. package/dist/invite/invite-api.d.ts.map +1 -1
  15. package/dist/lib/drizzle-helpers.d.ts +19 -1
  16. package/dist/lib/drizzle-helpers.d.ts.map +1 -1
  17. package/dist/mapeo-manager.d.ts +15 -9
  18. package/dist/mapeo-manager.d.ts.map +1 -1
  19. package/dist/mapeo-project.d.ts +4968 -3017
  20. package/dist/mapeo-project.d.ts.map +1 -1
  21. package/dist/schema/client.d.ts +246 -232
  22. package/dist/schema/client.d.ts.map +1 -1
  23. package/dist/schema/comapeo-to-drizzle.d.ts +65 -0
  24. package/dist/schema/comapeo-to-drizzle.d.ts.map +1 -0
  25. package/dist/schema/json-schema-to-drizzle.d.ts +18 -0
  26. package/dist/schema/json-schema-to-drizzle.d.ts.map +1 -0
  27. package/dist/schema/project.d.ts +2711 -1835
  28. package/dist/schema/project.d.ts.map +1 -1
  29. package/dist/schema/types.d.ts +73 -66
  30. package/dist/schema/types.d.ts.map +1 -1
  31. package/dist/translation-api.d.ts +111 -189
  32. package/dist/translation-api.d.ts.map +1 -1
  33. package/dist/utils.d.ts +10 -0
  34. package/dist/utils.d.ts.map +1 -1
  35. package/drizzle/client/0004_glorious_shape.sql +1 -0
  36. package/drizzle/client/meta/0000_snapshot.json +13 -9
  37. package/drizzle/client/meta/0001_snapshot.json +13 -9
  38. package/drizzle/client/meta/0002_snapshot.json +13 -9
  39. package/drizzle/client/meta/0003_snapshot.json +13 -9
  40. package/drizzle/client/meta/0004_snapshot.json +239 -0
  41. package/drizzle/client/meta/_journal.json +7 -0
  42. package/drizzle/project/meta/0000_snapshot.json +43 -24
  43. package/drizzle/project/meta/0001_snapshot.json +47 -26
  44. package/drizzle/project/meta/0002_snapshot.json +47 -26
  45. package/package.json +16 -8
  46. package/src/constants.js +0 -3
  47. package/src/datatype/index.js +8 -5
  48. package/src/discovery/local-discovery.js +3 -2
  49. package/src/import-categories.js +364 -0
  50. package/src/index-writer/index.js +1 -1
  51. package/src/intl/iso639.js +8118 -0
  52. package/src/intl/parse-bcp-47.js +91 -0
  53. package/src/invite/invite-api.js +2 -0
  54. package/src/lib/drizzle-helpers.js +70 -18
  55. package/src/mapeo-manager.js +138 -88
  56. package/src/mapeo-project.js +56 -218
  57. package/src/roles.js +1 -1
  58. package/src/schema/client.js +22 -28
  59. package/src/schema/comapeo-to-drizzle.js +57 -0
  60. package/src/schema/{schema-to-drizzle.js → json-schema-to-drizzle.js} +25 -25
  61. package/src/schema/project.js +24 -37
  62. package/src/schema/types.ts +138 -99
  63. package/src/translation-api.js +64 -12
  64. package/src/utils.js +13 -0
  65. package/dist/config-import.d.ts +0 -74
  66. package/dist/config-import.d.ts.map +0 -1
  67. package/dist/schema/schema-to-drizzle.d.ts +0 -20
  68. package/dist/schema/schema-to-drizzle.d.ts.map +0 -1
  69. package/dist/schema/utils.d.ts +0 -55
  70. package/dist/schema/utils.d.ts.map +0 -1
  71. package/src/config-import.js +0 -603
  72. package/src/schema/utils.js +0 -51
@@ -1,8 +1,6 @@
1
1
  {
2
- "version": "5",
2
+ "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "fd9449b2-3a8e-440e-ba57-62c2db1dc39f",
5
- "prevId": "597b1fb1-5fe9-4601-abab-9cd02b6a77fe",
6
4
  "tables": {
7
5
  "coreOwnership_backlink": {
8
6
  "name": "coreOwnership_backlink",
@@ -18,7 +16,8 @@
18
16
  "indexes": {},
19
17
  "foreignKeys": {},
20
18
  "compositePrimaryKeys": {},
21
- "uniqueConstraints": {}
19
+ "uniqueConstraints": {},
20
+ "checkConstraints": {}
22
21
  },
23
22
  "coreOwnership": {
24
23
  "name": "coreOwnership",
@@ -125,7 +124,8 @@
125
124
  "indexes": {},
126
125
  "foreignKeys": {},
127
126
  "compositePrimaryKeys": {},
128
- "uniqueConstraints": {}
127
+ "uniqueConstraints": {},
128
+ "checkConstraints": {}
129
129
  },
130
130
  "cores": {
131
131
  "name": "cores",
@@ -148,7 +148,8 @@
148
148
  "indexes": {},
149
149
  "foreignKeys": {},
150
150
  "compositePrimaryKeys": {},
151
- "uniqueConstraints": {}
151
+ "uniqueConstraints": {},
152
+ "checkConstraints": {}
152
153
  },
153
154
  "deviceInfo_backlink": {
154
155
  "name": "deviceInfo_backlink",
@@ -164,7 +165,8 @@
164
165
  "indexes": {},
165
166
  "foreignKeys": {},
166
167
  "compositePrimaryKeys": {},
167
- "uniqueConstraints": {}
168
+ "uniqueConstraints": {},
169
+ "checkConstraints": {}
168
170
  },
169
171
  "deviceInfo": {
170
172
  "name": "deviceInfo",
@@ -257,7 +259,8 @@
257
259
  "indexes": {},
258
260
  "foreignKeys": {},
259
261
  "compositePrimaryKeys": {},
260
- "uniqueConstraints": {}
262
+ "uniqueConstraints": {},
263
+ "checkConstraints": {}
261
264
  },
262
265
  "field_backlink": {
263
266
  "name": "field_backlink",
@@ -273,7 +276,8 @@
273
276
  "indexes": {},
274
277
  "foreignKeys": {},
275
278
  "compositePrimaryKeys": {},
276
- "uniqueConstraints": {}
279
+ "uniqueConstraints": {},
280
+ "checkConstraints": {}
277
281
  },
278
282
  "field": {
279
283
  "name": "field",
@@ -408,7 +412,8 @@
408
412
  "indexes": {},
409
413
  "foreignKeys": {},
410
414
  "compositePrimaryKeys": {},
411
- "uniqueConstraints": {}
415
+ "uniqueConstraints": {},
416
+ "checkConstraints": {}
412
417
  },
413
418
  "icon_backlink": {
414
419
  "name": "icon_backlink",
@@ -424,7 +429,8 @@
424
429
  "indexes": {},
425
430
  "foreignKeys": {},
426
431
  "compositePrimaryKeys": {},
427
- "uniqueConstraints": {}
432
+ "uniqueConstraints": {},
433
+ "checkConstraints": {}
428
434
  },
429
435
  "icon": {
430
436
  "name": "icon",
@@ -510,7 +516,8 @@
510
516
  "indexes": {},
511
517
  "foreignKeys": {},
512
518
  "compositePrimaryKeys": {},
513
- "uniqueConstraints": {}
519
+ "uniqueConstraints": {},
520
+ "checkConstraints": {}
514
521
  },
515
522
  "observation_backlink": {
516
523
  "name": "observation_backlink",
@@ -526,7 +533,8 @@
526
533
  "indexes": {},
527
534
  "foreignKeys": {},
528
535
  "compositePrimaryKeys": {},
529
- "uniqueConstraints": {}
536
+ "uniqueConstraints": {},
537
+ "checkConstraints": {}
530
538
  },
531
539
  "observation": {
532
540
  "name": "observation",
@@ -640,7 +648,8 @@
640
648
  "indexes": {},
641
649
  "foreignKeys": {},
642
650
  "compositePrimaryKeys": {},
643
- "uniqueConstraints": {}
651
+ "uniqueConstraints": {},
652
+ "checkConstraints": {}
644
653
  },
645
654
  "preset_backlink": {
646
655
  "name": "preset_backlink",
@@ -656,7 +665,8 @@
656
665
  "indexes": {},
657
666
  "foreignKeys": {},
658
667
  "compositePrimaryKeys": {},
659
- "uniqueConstraints": {}
668
+ "uniqueConstraints": {},
669
+ "checkConstraints": {}
660
670
  },
661
671
  "preset": {
662
672
  "name": "preset",
@@ -791,7 +801,8 @@
791
801
  "indexes": {},
792
802
  "foreignKeys": {},
793
803
  "compositePrimaryKeys": {},
794
- "uniqueConstraints": {}
804
+ "uniqueConstraints": {},
805
+ "checkConstraints": {}
795
806
  },
796
807
  "remoteDetectionAlert_backlink": {
797
808
  "name": "remoteDetectionAlert_backlink",
@@ -807,7 +818,8 @@
807
818
  "indexes": {},
808
819
  "foreignKeys": {},
809
820
  "compositePrimaryKeys": {},
810
- "uniqueConstraints": {}
821
+ "uniqueConstraints": {},
822
+ "checkConstraints": {}
811
823
  },
812
824
  "remoteDetectionAlert": {
813
825
  "name": "remoteDetectionAlert",
@@ -914,7 +926,8 @@
914
926
  "indexes": {},
915
927
  "foreignKeys": {},
916
928
  "compositePrimaryKeys": {},
917
- "uniqueConstraints": {}
929
+ "uniqueConstraints": {},
930
+ "checkConstraints": {}
918
931
  },
919
932
  "role_backlink": {
920
933
  "name": "role_backlink",
@@ -930,7 +943,8 @@
930
943
  "indexes": {},
931
944
  "foreignKeys": {},
932
945
  "compositePrimaryKeys": {},
933
- "uniqueConstraints": {}
946
+ "uniqueConstraints": {},
947
+ "checkConstraints": {}
934
948
  },
935
949
  "role": {
936
950
  "name": "role",
@@ -1016,7 +1030,8 @@
1016
1030
  "indexes": {},
1017
1031
  "foreignKeys": {},
1018
1032
  "compositePrimaryKeys": {},
1019
- "uniqueConstraints": {}
1033
+ "uniqueConstraints": {},
1034
+ "checkConstraints": {}
1020
1035
  },
1021
1036
  "track_backlink": {
1022
1037
  "name": "track_backlink",
@@ -1032,7 +1047,8 @@
1032
1047
  "indexes": {},
1033
1048
  "foreignKeys": {},
1034
1049
  "compositePrimaryKeys": {},
1035
- "uniqueConstraints": {}
1050
+ "uniqueConstraints": {},
1051
+ "checkConstraints": {}
1036
1052
  },
1037
1053
  "track": {
1038
1054
  "name": "track",
@@ -1125,7 +1141,8 @@
1125
1141
  "indexes": {},
1126
1142
  "foreignKeys": {},
1127
1143
  "compositePrimaryKeys": {},
1128
- "uniqueConstraints": {}
1144
+ "uniqueConstraints": {},
1145
+ "checkConstraints": {}
1129
1146
  },
1130
1147
  "translation_backlink": {
1131
1148
  "name": "translation_backlink",
@@ -1141,7 +1158,8 @@
1141
1158
  "indexes": {},
1142
1159
  "foreignKeys": {},
1143
1160
  "compositePrimaryKeys": {},
1144
- "uniqueConstraints": {}
1161
+ "uniqueConstraints": {},
1162
+ "checkConstraints": {}
1145
1163
  },
1146
1164
  "translation": {
1147
1165
  "name": "translation",
@@ -1255,13 +1273,16 @@
1255
1273
  "indexes": {},
1256
1274
  "foreignKeys": {},
1257
1275
  "compositePrimaryKeys": {},
1258
- "uniqueConstraints": {}
1276
+ "uniqueConstraints": {},
1277
+ "checkConstraints": {}
1259
1278
  }
1260
1279
  },
1261
1280
  "enums": {},
1262
1281
  "_meta": {
1263
- "schemas": {},
1264
1282
  "tables": {},
1265
1283
  "columns": {}
1266
- }
1284
+ },
1285
+ "id": "fd9449b2-3a8e-440e-ba57-62c2db1dc39f",
1286
+ "prevId": "597b1fb1-5fe9-4601-abab-9cd02b6a77fe",
1287
+ "views": {}
1267
1288
  }
@@ -1,8 +1,6 @@
1
1
  {
2
- "version": "5",
2
+ "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "c5dd5032-e750-4541-871d-a3bd9dbb881b",
5
- "prevId": "fd9449b2-3a8e-440e-ba57-62c2db1dc39f",
6
4
  "tables": {
7
5
  "coreOwnership_backlink": {
8
6
  "name": "coreOwnership_backlink",
@@ -18,7 +16,8 @@
18
16
  "indexes": {},
19
17
  "foreignKeys": {},
20
18
  "compositePrimaryKeys": {},
21
- "uniqueConstraints": {}
19
+ "uniqueConstraints": {},
20
+ "checkConstraints": {}
22
21
  },
23
22
  "coreOwnership": {
24
23
  "name": "coreOwnership",
@@ -125,7 +124,8 @@
125
124
  "indexes": {},
126
125
  "foreignKeys": {},
127
126
  "compositePrimaryKeys": {},
128
- "uniqueConstraints": {}
127
+ "uniqueConstraints": {},
128
+ "checkConstraints": {}
129
129
  },
130
130
  "cores": {
131
131
  "name": "cores",
@@ -148,7 +148,8 @@
148
148
  "indexes": {},
149
149
  "foreignKeys": {},
150
150
  "compositePrimaryKeys": {},
151
- "uniqueConstraints": {}
151
+ "uniqueConstraints": {},
152
+ "checkConstraints": {}
152
153
  },
153
154
  "deviceInfo_backlink": {
154
155
  "name": "deviceInfo_backlink",
@@ -164,7 +165,8 @@
164
165
  "indexes": {},
165
166
  "foreignKeys": {},
166
167
  "compositePrimaryKeys": {},
167
- "uniqueConstraints": {}
168
+ "uniqueConstraints": {},
169
+ "checkConstraints": {}
168
170
  },
169
171
  "deviceInfo": {
170
172
  "name": "deviceInfo",
@@ -257,7 +259,8 @@
257
259
  "indexes": {},
258
260
  "foreignKeys": {},
259
261
  "compositePrimaryKeys": {},
260
- "uniqueConstraints": {}
262
+ "uniqueConstraints": {},
263
+ "checkConstraints": {}
261
264
  },
262
265
  "field_backlink": {
263
266
  "name": "field_backlink",
@@ -273,7 +276,8 @@
273
276
  "indexes": {},
274
277
  "foreignKeys": {},
275
278
  "compositePrimaryKeys": {},
276
- "uniqueConstraints": {}
279
+ "uniqueConstraints": {},
280
+ "checkConstraints": {}
277
281
  },
278
282
  "field": {
279
283
  "name": "field",
@@ -408,7 +412,8 @@
408
412
  "indexes": {},
409
413
  "foreignKeys": {},
410
414
  "compositePrimaryKeys": {},
411
- "uniqueConstraints": {}
415
+ "uniqueConstraints": {},
416
+ "checkConstraints": {}
412
417
  },
413
418
  "icon_backlink": {
414
419
  "name": "icon_backlink",
@@ -424,7 +429,8 @@
424
429
  "indexes": {},
425
430
  "foreignKeys": {},
426
431
  "compositePrimaryKeys": {},
427
- "uniqueConstraints": {}
432
+ "uniqueConstraints": {},
433
+ "checkConstraints": {}
428
434
  },
429
435
  "icon": {
430
436
  "name": "icon",
@@ -510,7 +516,8 @@
510
516
  "indexes": {},
511
517
  "foreignKeys": {},
512
518
  "compositePrimaryKeys": {},
513
- "uniqueConstraints": {}
519
+ "uniqueConstraints": {},
520
+ "checkConstraints": {}
514
521
  },
515
522
  "observation_backlink": {
516
523
  "name": "observation_backlink",
@@ -526,7 +533,8 @@
526
533
  "indexes": {},
527
534
  "foreignKeys": {},
528
535
  "compositePrimaryKeys": {},
529
- "uniqueConstraints": {}
536
+ "uniqueConstraints": {},
537
+ "checkConstraints": {}
530
538
  },
531
539
  "observation": {
532
540
  "name": "observation",
@@ -640,7 +648,8 @@
640
648
  "indexes": {},
641
649
  "foreignKeys": {},
642
650
  "compositePrimaryKeys": {},
643
- "uniqueConstraints": {}
651
+ "uniqueConstraints": {},
652
+ "checkConstraints": {}
644
653
  },
645
654
  "preset_backlink": {
646
655
  "name": "preset_backlink",
@@ -656,7 +665,8 @@
656
665
  "indexes": {},
657
666
  "foreignKeys": {},
658
667
  "compositePrimaryKeys": {},
659
- "uniqueConstraints": {}
668
+ "uniqueConstraints": {},
669
+ "checkConstraints": {}
660
670
  },
661
671
  "preset": {
662
672
  "name": "preset",
@@ -791,7 +801,8 @@
791
801
  "indexes": {},
792
802
  "foreignKeys": {},
793
803
  "compositePrimaryKeys": {},
794
- "uniqueConstraints": {}
804
+ "uniqueConstraints": {},
805
+ "checkConstraints": {}
795
806
  },
796
807
  "remoteDetectionAlert_backlink": {
797
808
  "name": "remoteDetectionAlert_backlink",
@@ -807,7 +818,8 @@
807
818
  "indexes": {},
808
819
  "foreignKeys": {},
809
820
  "compositePrimaryKeys": {},
810
- "uniqueConstraints": {}
821
+ "uniqueConstraints": {},
822
+ "checkConstraints": {}
811
823
  },
812
824
  "remoteDetectionAlert": {
813
825
  "name": "remoteDetectionAlert",
@@ -914,7 +926,8 @@
914
926
  "indexes": {},
915
927
  "foreignKeys": {},
916
928
  "compositePrimaryKeys": {},
917
- "uniqueConstraints": {}
929
+ "uniqueConstraints": {},
930
+ "checkConstraints": {}
918
931
  },
919
932
  "role_backlink": {
920
933
  "name": "role_backlink",
@@ -930,7 +943,8 @@
930
943
  "indexes": {},
931
944
  "foreignKeys": {},
932
945
  "compositePrimaryKeys": {},
933
- "uniqueConstraints": {}
946
+ "uniqueConstraints": {},
947
+ "checkConstraints": {}
934
948
  },
935
949
  "role": {
936
950
  "name": "role",
@@ -1016,7 +1030,8 @@
1016
1030
  "indexes": {},
1017
1031
  "foreignKeys": {},
1018
1032
  "compositePrimaryKeys": {},
1019
- "uniqueConstraints": {}
1033
+ "uniqueConstraints": {},
1034
+ "checkConstraints": {}
1020
1035
  },
1021
1036
  "track_backlink": {
1022
1037
  "name": "track_backlink",
@@ -1032,7 +1047,8 @@
1032
1047
  "indexes": {},
1033
1048
  "foreignKeys": {},
1034
1049
  "compositePrimaryKeys": {},
1035
- "uniqueConstraints": {}
1050
+ "uniqueConstraints": {},
1051
+ "checkConstraints": {}
1036
1052
  },
1037
1053
  "track": {
1038
1054
  "name": "track",
@@ -1132,7 +1148,8 @@
1132
1148
  "indexes": {},
1133
1149
  "foreignKeys": {},
1134
1150
  "compositePrimaryKeys": {},
1135
- "uniqueConstraints": {}
1151
+ "uniqueConstraints": {},
1152
+ "checkConstraints": {}
1136
1153
  },
1137
1154
  "translation_backlink": {
1138
1155
  "name": "translation_backlink",
@@ -1148,7 +1165,8 @@
1148
1165
  "indexes": {},
1149
1166
  "foreignKeys": {},
1150
1167
  "compositePrimaryKeys": {},
1151
- "uniqueConstraints": {}
1168
+ "uniqueConstraints": {},
1169
+ "checkConstraints": {}
1152
1170
  },
1153
1171
  "translation": {
1154
1172
  "name": "translation",
@@ -1262,13 +1280,16 @@
1262
1280
  "indexes": {},
1263
1281
  "foreignKeys": {},
1264
1282
  "compositePrimaryKeys": {},
1265
- "uniqueConstraints": {}
1283
+ "uniqueConstraints": {},
1284
+ "checkConstraints": {}
1266
1285
  }
1267
1286
  },
1268
1287
  "enums": {},
1269
1288
  "_meta": {
1270
- "schemas": {},
1271
1289
  "tables": {},
1272
1290
  "columns": {}
1273
- }
1291
+ },
1292
+ "id": "c5dd5032-e750-4541-871d-a3bd9dbb881b",
1293
+ "prevId": "fd9449b2-3a8e-440e-ba57-62c2db1dc39f",
1294
+ "views": {}
1274
1295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comapeo/core",
3
- "version": "4.4.0",
3
+ "version": "5.0.0",
4
4
  "description": "Offline p2p mapping library",
5
5
  "main": "src/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,9 +8,8 @@
8
8
  "scripts": {
9
9
  "lint": "eslint --cache .",
10
10
  "format": "prettier . --write",
11
- "test": "npm-run-all lint test:prettier build:types type test:buildConfigs test:unit test:e2e test:types",
11
+ "test": "npm-run-all lint test:prettier build:types type test:unit test:e2e test:types",
12
12
  "test:prettier": "prettier --check .",
13
- "test:buildConfigs": "node scripts/build-config-fixtures.js",
14
13
  "test:unit": "node --test",
15
14
  "test:e2e": "node --test test-e2e/*.js test-e2e/**/*.js",
16
15
  "test:types": "tsc -p test-types/tsconfig.json",
@@ -20,8 +19,8 @@
20
19
  "doc": "rimraf docs/api/md && typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-missing-exports --out docs/api/md",
21
20
  "doc:publish": "rimraf docs/api/html && typedoc --plugin typedoc-plugin-missing-exports --out docs/api/html",
22
21
  "protobuf": "node ./scripts/build-messages.js",
23
- "db:generate:project": "drizzle-kit generate:sqlite --schema src/schema/project.js --out drizzle/project",
24
- "db:generate:client": "drizzle-kit generate:sqlite --schema src/schema/client.js --out drizzle/client",
22
+ "db:generate:project": "drizzle-kit generate --dialect sqlite --schema src/schema/project.js --out drizzle/project",
23
+ "db:generate:client": "drizzle-kit generate --dialect sqlite --schema src/schema/client.js --out drizzle/client",
25
24
  "prepack": "npm run build:types",
26
25
  "prepare": "husky install"
27
26
  },
@@ -110,13 +109,15 @@
110
109
  "@bufbuild/buf": "^1.26.1",
111
110
  "@comapeo/cloud": "^0.2.1",
112
111
  "@comapeo/core2.0.1": "npm:@comapeo/core@2.0.1",
112
+ "@comapeo/core4.1.4": "npm:@comapeo/core@^4.1.4",
113
113
  "@comapeo/ipc": "^2.1.0",
114
- "@mapeo/default-config": "5.0.0",
114
+ "@mapeo/default-config": "^6.0.0",
115
115
  "@mapeo/mock-data": "^5.0.0",
116
116
  "@sinonjs/fake-timers": "^10.0.2",
117
117
  "@types/b4a": "^1.6.0",
118
118
  "@types/bogon": "^1.0.2",
119
119
  "@types/compact-encoding": "^2.15.0",
120
+ "@types/d3-dsv": "^3.0.7",
120
121
  "@types/debug": "^4.1.8",
121
122
  "@types/geojson": "^7946.0.16",
122
123
  "@types/json-schema": "^7.0.11",
@@ -134,7 +135,8 @@
134
135
  "bitfield": "^4.2.0",
135
136
  "cpy": "^10.1.0",
136
137
  "cpy-cli": "^5.0.0",
137
- "drizzle-kit": "^0.20.14",
138
+ "d3-dsv": "^3.0.1",
139
+ "drizzle-kit": "^1.0.0-beta.1-ac4ce44",
138
140
  "eslint": "^8.57.0",
139
141
  "execa": "^9.5.1",
140
142
  "filter-obj": "^6.1.0",
@@ -173,14 +175,17 @@
173
175
  "@sindresorhus/merge-streams": "^4.0.0",
174
176
  "b4a": "^1.6.3",
175
177
  "bcp-47": "^2.1.0",
178
+ "bcp-47-normalize": "^2.3.0",
176
179
  "better-sqlite3": "^11.10.0",
177
180
  "big-sparse-array": "^1.0.3",
178
181
  "bogon": "^1.1.0",
182
+ "comapeocat": "^1.0.0",
179
183
  "compact-encoding": "^2.12.0",
180
184
  "corestore": "6.8.4",
181
185
  "debug": "^4.3.4",
182
186
  "dot-prop": "^9.0.0",
183
- "drizzle-orm": "^0.30.8",
187
+ "dot-prop-extra": "^10.2.0",
188
+ "drizzle-orm": "^1.0.0-beta.1-ac4ce44",
184
189
  "ensure-error": "^4.0.0",
185
190
  "fastify": "^4.0.0",
186
191
  "fastify-plugin": "^4.5.1",
@@ -188,6 +193,7 @@
188
193
  "hypercore": "10.19.0",
189
194
  "hypercore-crypto": "3.4.2",
190
195
  "hyperdrive": "11.5.3",
196
+ "iso-3166": "^4.3.0",
191
197
  "json-stable-stringify": "^1.1.1",
192
198
  "magic-bytes.js": "^1.10.0",
193
199
  "map-obj": "^5.0.2",
@@ -195,6 +201,7 @@
195
201
  "multi-core-indexer": "^1.0.0",
196
202
  "p-defer": "^4.0.0",
197
203
  "p-event": "^6.0.1",
204
+ "p-queue": "^8.1.1",
198
205
  "p-timeout": "^6.1.2",
199
206
  "protobufjs": "^7.2.3",
200
207
  "protomux": "^3.4.1",
@@ -208,6 +215,7 @@
208
215
  "throttle-debounce": "^5.0.0",
209
216
  "tiny-typed-emitter": "^2.1.0",
210
217
  "type-fest": "^4.30.0",
218
+ "un-m49": "^2.2.0",
211
219
  "undici": "^6.13.0",
212
220
  "unix-path-resolve": "^1.0.2",
213
221
  "varint": "^6.0.0",
package/src/constants.js CHANGED
@@ -35,6 +35,3 @@ export const SUPPORTED_CONFIG_VERSION = 1
35
35
 
36
36
  // WARNING: This value is persisted. Be careful when changing it.
37
37
  export const DRIZZLE_MIGRATIONS_TABLE = '__drizzle_migrations'
38
-
39
- // Oldest possible time, ensure it gets overwritten with any updates
40
- export const UNIX_EPOCH_DATE = new Date(0).toISOString()
@@ -5,8 +5,8 @@ import { randomBytes } from 'node:crypto'
5
5
  import { noop, mutatingDeNullify } from '../utils.js'
6
6
  import { NotFoundError } from '../errors.js'
7
7
  import { TypedEmitter } from 'tiny-typed-emitter'
8
- import { parse as parseBCP47 } from 'bcp-47'
9
- import { setProperty, getProperty } from 'dot-prop'
8
+ import { setProperty, getProperty } from 'dot-prop-extra'
9
+ import { parseBcp47 } from '../intl/parse-bcp-47.js'
10
10
  /** @import { MapeoDoc, MapeoValue } from '@comapeo/schema' */
11
11
  /** @import { RunResult } from 'better-sqlite3' */
12
12
  /** @import { SQLiteSelectBase } from 'drizzle-orm/sqlite-core' */
@@ -285,7 +285,7 @@ export class DataType extends TypedEmitter {
285
285
  async #mutatingAddTranslations(doc, { lang }) {
286
286
  if (!this.#getTranslations) return doc
287
287
 
288
- const { language, region } = parseBCP47(lang)
288
+ const { language, region } = parseBcp47(lang)
289
289
  if (!language) return doc
290
290
 
291
291
  const translations = await this.#getTranslations({
@@ -302,8 +302,11 @@ export class DataType extends TypedEmitter {
302
302
  for (const translation of translations) {
303
303
  if (typeof getProperty(doc, translation.propertyRef) === 'string') {
304
304
  const isMatchingRegion = region
305
- ? translation.regionCode === region
306
- : false
305
+ ? // Previous versions did not normalize region codes stored in the
306
+ // translations db to uppercase, so we need to transform the case
307
+ // here (the parsed `region` is always uppercase).
308
+ translation.regionCode?.toUpperCase() === region
309
+ : !translation.regionCode // No region code means it's a match for any region
307
310
  // Prefer translations with a matching region code, but fall back to
308
311
  // translations without a region code if no matching region code has
309
312
  // been found yet for this propertyRef
@@ -75,7 +75,8 @@ export class LocalDiscovery extends TypedEmitter {
75
75
  /** @returns {Promise<{ name: string, port: number }>} */
76
76
  async start() {
77
77
  await this.#sm.start()
78
- return { name: this.#name, port: getAddress(this.#server).port }
78
+ const port = this.#port
79
+ return { name: this.#name, port }
79
80
  }
80
81
 
81
82
  /** @returns {Promise<void>} */
@@ -288,7 +289,7 @@ export class LocalDiscovery extends TypedEmitter {
288
289
  */
289
290
  async #stop({ force = false, timeout = 0 } = {}) {
290
291
  this.#log('stopping')
291
- const { port } = getAddress(this.#server)
292
+ const port = this.#port
292
293
  this.#server.close()
293
294
  const closePromise = once(this.#server, 'close')
294
295