@comapeo/core 6.0.1 → 7.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.
- package/dist/blob-store/downloader.d.ts +4 -4
- package/dist/blob-store/downloader.d.ts.map +1 -1
- package/dist/blob-store/hyperdrive-index.d.ts +5 -3
- package/dist/blob-store/hyperdrive-index.d.ts.map +1 -1
- package/dist/blob-store/index.d.ts +6 -5
- package/dist/blob-store/index.d.ts.map +1 -1
- package/dist/core-manager/index.d.ts +6 -19
- package/dist/core-manager/index.d.ts.map +1 -1
- package/dist/datastore/index.d.ts +1 -1
- package/dist/generated/extensions.d.ts +0 -30
- package/dist/generated/extensions.d.ts.map +1 -1
- package/dist/generated/rpc.d.ts +30 -0
- package/dist/generated/rpc.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/local-peers.d.ts +12 -0
- package/dist/local-peers.d.ts.map +1 -1
- package/dist/mapeo-manager.d.ts +41 -3
- package/dist/mapeo-manager.d.ts.map +1 -1
- package/dist/mapeo-project.d.ts +5 -70
- package/dist/mapeo-project.d.ts.map +1 -1
- package/dist/schema/project.d.ts +1 -1
- package/dist/sync/namespace-sync-state.d.ts +1 -1
- package/dist/sync/peer-sync-controller.d.ts +1 -1
- package/dist/sync/sync-api.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/blob-store/downloader.js +11 -4
- package/src/blob-store/hyperdrive-index.js +20 -3
- package/src/blob-store/index.js +17 -7
- package/src/core-manager/index.js +15 -70
- package/src/generated/extensions.d.ts +0 -30
- package/src/generated/extensions.js +0 -165
- package/src/generated/extensions.ts +0 -204
- package/src/generated/rpc.d.ts +30 -0
- package/src/generated/rpc.js +191 -0
- package/src/generated/rpc.ts +236 -0
- package/src/index.js +4 -1
- package/src/local-peers.js +33 -0
- package/src/mapeo-manager.js +93 -35
- package/src/mapeo-project.js +16 -106
- package/src/utils.js +2 -2
package/dist/mapeo-project.d.ts
CHANGED
|
@@ -19,32 +19,15 @@ export const kGeoJSONFileName: unique symbol;
|
|
|
19
19
|
* @typedef RoleChangeEvent
|
|
20
20
|
* @property {Role & {reason: string | undefined}} role
|
|
21
21
|
*/
|
|
22
|
-
/**
|
|
23
|
-
* @typedef {object} AugmentedMapShareProperties
|
|
24
|
-
* @property {readonly [number, number, number, number]} bounds - Bounding box of the shared map [W, S, E, N].
|
|
25
|
-
* @property {readonly [string, ...string[]]} mapShareUrls - URLs associated with the map share.
|
|
26
|
-
* @property {number} mapShareReceivedAt - Timestamp when the map share was received.
|
|
27
|
-
* @property {string} senderDeviceId - The ID of the device that sent the map share.
|
|
28
|
-
* @property {string} [senderDeviceName] - The name of the device that sent the map share.
|
|
29
|
-
* @property {string} receiverDeviceId - The deviceId of the peer the map share was sent to
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* @typedef {Omit<MapShareExtension, 'bounds' | 'mapShareUrls' | 'receiverDeviceKey'> & AugmentedMapShareProperties} MapShare
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* @typedef {Omit<MapShare, 'mapShareReceivedAt' | 'senderDeviceId' | 'senderDeviceName'>} MapShareSend
|
|
36
|
-
*/
|
|
37
22
|
/**
|
|
38
23
|
* @typedef {object} ProjectEvents
|
|
39
24
|
* @property {() => void} close Project resources have been cleared up
|
|
40
25
|
* @property {(changeEvent: RoleChangeEvent) => void} own-role-change
|
|
41
|
-
* @property {(e: Error, mapShare: MapShareExtension) => void} map-share-error - Emitted when an incoming map share fails to be recieved due to formatting issues
|
|
42
|
-
* @property {(mapShare: MapShare) => void} map-share - Emitted when a map share is recieved from someone on the project
|
|
43
26
|
*/
|
|
44
27
|
/**
|
|
45
|
-
* @extends {
|
|
28
|
+
* @extends {ReadyResource<ProjectEvents>}
|
|
46
29
|
*/
|
|
47
|
-
export class MapeoProject extends
|
|
30
|
+
export class MapeoProject extends ReadyResource<ProjectEvents> {
|
|
48
31
|
static EMPTY_PROJECT_SETTINGS: Readonly<{
|
|
49
32
|
sendStats: false;
|
|
50
33
|
}>;
|
|
@@ -88,13 +71,12 @@ export class MapeoProject extends TypedEmitter<ProjectEvents> {
|
|
|
88
71
|
get deviceId(): string;
|
|
89
72
|
/**
|
|
90
73
|
* Resolves when hypercores have all loaded
|
|
91
|
-
*
|
|
92
74
|
* @returns {Promise<void>}
|
|
93
75
|
*/
|
|
94
|
-
|
|
76
|
+
_open(): Promise<void>;
|
|
95
77
|
/**
|
|
96
78
|
*/
|
|
97
|
-
|
|
79
|
+
_close(): Promise<void>;
|
|
98
80
|
get observation(): DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, import("./schema/types.js").JsonSchemaToDrizzleSqliteTable<{
|
|
99
81
|
schemaName: "observation";
|
|
100
82
|
lat?: number | undefined;
|
|
@@ -2524,16 +2506,6 @@ export class MapeoProject extends TypedEmitter<ProjectEvents> {
|
|
|
2524
2506
|
$importCategories({ filePath }: {
|
|
2525
2507
|
filePath: string;
|
|
2526
2508
|
}): Promise<void>;
|
|
2527
|
-
/**
|
|
2528
|
-
* Send a map share offer to the peer with device ID `mapShare.receiverDeviceId`
|
|
2529
|
-
*
|
|
2530
|
-
* @param {MapShareSend} mapShare
|
|
2531
|
-
* @param {object} [options]
|
|
2532
|
-
* @param {boolean} [options.__testOnlyBypassValidation=false] Warning: Do not use!
|
|
2533
|
-
*/
|
|
2534
|
-
$sendMapShare(mapShare: MapShareSend, { __testOnlyBypassValidation }?: {
|
|
2535
|
-
__testOnlyBypassValidation?: boolean | undefined;
|
|
2536
|
-
} | undefined): Promise<void>;
|
|
2537
2509
|
/**
|
|
2538
2510
|
* CoreManager instance, used for tests
|
|
2539
2511
|
*/
|
|
@@ -5761,50 +5733,14 @@ export type RoleChangeEvent = {
|
|
|
5761
5733
|
reason: string | undefined;
|
|
5762
5734
|
};
|
|
5763
5735
|
};
|
|
5764
|
-
export type AugmentedMapShareProperties = {
|
|
5765
|
-
/**
|
|
5766
|
-
* - Bounding box of the shared map [W, S, E, N].
|
|
5767
|
-
*/
|
|
5768
|
-
bounds: readonly [number, number, number, number];
|
|
5769
|
-
/**
|
|
5770
|
-
* - URLs associated with the map share.
|
|
5771
|
-
*/
|
|
5772
|
-
mapShareUrls: readonly [string, ...string[]];
|
|
5773
|
-
/**
|
|
5774
|
-
* - Timestamp when the map share was received.
|
|
5775
|
-
*/
|
|
5776
|
-
mapShareReceivedAt: number;
|
|
5777
|
-
/**
|
|
5778
|
-
* - The ID of the device that sent the map share.
|
|
5779
|
-
*/
|
|
5780
|
-
senderDeviceId: string;
|
|
5781
|
-
/**
|
|
5782
|
-
* - The name of the device that sent the map share.
|
|
5783
|
-
*/
|
|
5784
|
-
senderDeviceName?: string | undefined;
|
|
5785
|
-
/**
|
|
5786
|
-
* - The deviceId of the peer the map share was sent to
|
|
5787
|
-
*/
|
|
5788
|
-
receiverDeviceId: string;
|
|
5789
|
-
};
|
|
5790
|
-
export type MapShare = Omit<MapShareExtension, "bounds" | "mapShareUrls" | "receiverDeviceKey"> & AugmentedMapShareProperties;
|
|
5791
|
-
export type MapShareSend = Omit<MapShare, "mapShareReceivedAt" | "senderDeviceId" | "senderDeviceName">;
|
|
5792
5736
|
export type ProjectEvents = {
|
|
5793
5737
|
/**
|
|
5794
5738
|
* Project resources have been cleared up
|
|
5795
5739
|
*/
|
|
5796
5740
|
close: () => void;
|
|
5797
5741
|
"own-role-change": (changeEvent: RoleChangeEvent) => void;
|
|
5798
|
-
/**
|
|
5799
|
-
* - Emitted when an incoming map share fails to be recieved due to formatting issues
|
|
5800
|
-
*/
|
|
5801
|
-
"map-share-error": (e: Error, mapShare: MapShareExtension) => void;
|
|
5802
|
-
/**
|
|
5803
|
-
* - Emitted when a map share is recieved from someone on the project
|
|
5804
|
-
*/
|
|
5805
|
-
"map-share": (mapShare: MapShare) => void;
|
|
5806
5742
|
};
|
|
5807
|
-
import
|
|
5743
|
+
import ReadyResource from 'ready-resource';
|
|
5808
5744
|
import { BlobApi } from './blob-api.js';
|
|
5809
5745
|
import { DataStore } from './datastore/index.js';
|
|
5810
5746
|
import { DataType } from './datatype/index.js';
|
|
@@ -5824,5 +5760,4 @@ import { Logger } from './logger.js';
|
|
|
5824
5760
|
import type { ProjectSettingsValue } from '@comapeo/schema';
|
|
5825
5761
|
import type { Attachment } from './types.js';
|
|
5826
5762
|
import type { BlobId } from './types.js';
|
|
5827
|
-
import type { MapShareExtension } from './generated/extensions.js';
|
|
5828
5763
|
//# sourceMappingURL=mapeo-project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapeo-project.d.ts","sourceRoot":"","sources":["../src/mapeo-project.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapeo-project.d.ts","sourceRoot":"","sources":["../src/mapeo-project.js"],"names":[],"mappings":"AAq7CA;;;;GAIG;AACH,qCAJW,MAAM,mBACN,MAAM,GACJ,MAAM,CAOlB;AAv1CD,yCAAiD;AACjD,2CAAqD;AACrD,8CAA4D;AAC5D,uCAA6C;AAC7C,8CAA4D;AAC5D,uCAA6C;AAC7C,0CAAoD;AACpD,uCAAsD;AACtD,gDAAgE;AAChE,6CAA4E;AAC5E,6CAAyD;AAOzD;;;GAGG;AAEH;;;;GAIG;AAEH;;GAEG;AACH;IAsBE;;OAAsD;IAGtD;;;;;;;;;;;;;;;;;;OAkBG;IACH,mPAjBG;QAAqB,MAAM,EAAnB,MAAM;QACO,uBAAuB,EAApC,MAAM;QACmC,UAAU,EAAnD,2CAAkC;QACrB,UAAU,EAAvB,MAAM;QACQ,gBAAgB;QACqB,cAAc,EAAjE,OAAO,qBAAqB,EAAE,cAAc;QACqB,QAAQ,EAAzE,OAAO,4BAA4B,EAAE,qBAAqB;QACxC,iBAAiB,EAAnC,WAAW;QACO,WAAW,EAA7B,WAAW;QAC6C,eAAe,EAAvE,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,KAAK,OA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BAFW,IAAI,CAAC,OAAO,iBAAiB,EAAE,eAAe,EAAE,MAAM,GAAG,YAAY,GAAG,yBAAyB,CAAC,iBAsB5G;IAED,uCAAuC;IACvC,uCADY,OAAO,iBAGlB;IAED,yBAAyB;IACzB,kCAEC;IAsPD;;;;OAIG;IACH,iCAJW,OAAO,UACP,OAAO,GACL,OAAO,CAAC,MAAM,CAAC,CAY3B;IA+ND,iCAQC;IAED;;;OAGG;IACH,gBAFa,OAAO,CAAC,IAAI,CAAC,CA+BzB;;CAwCF;sCA/zCa,IAAI,CAAC,oBAAoB,EAAE,YAAY,CAAC;6BACxC,oBAAoB,CAAC,gBAAgB,CAAC;8BACtC,GAAG,CAAC,MAAM,EAAC,UAAU,CAAC;;cAE1B,MAAM,GAAC,SAAS;YAChB,MAAM;;;aAIF,MAAM,EAAE;YACR,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;oBAIvB,MAAM;kBACN,KAAK;YACL,KAAK;aACL,KAAK;;;UAwBL,IAAI,GAAG;QAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;KAAC;;;;;;WAKnC,MAAM,IAAI;uBACV,CAAC,WAAW,EAAE,eAAe,KAAK,IAAI;;0BArD1B,gBAAgB;wBAxDlB,eAAe;0BAPb,sBAAsB;yBAKzC,qBAAqB;0BAiCF,iBAAiB;wBAKpC,oBAAoB;2BAIA,sBAAsB;0BAqBzB,YAAY;wBAvBZ,eAAe;4BA9CX,yBAAyB;8BA2B9C,qBAAqB;0BApBF,uBAAuB;uCA6D8H,YAAY;4BA3D/J,yBAAyB;iCA2D0H,YAAY;0BARjK,IAAI;uBAfP,aAAa;0CAsB0B,iBAAiB;gCACgG,YAAY;4BAAZ,YAAY"}
|
package/dist/schema/project.d.ts
CHANGED
|
@@ -2896,7 +2896,7 @@ export const coresTable: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
2896
2896
|
name: string;
|
|
2897
2897
|
tableName: "cores";
|
|
2898
2898
|
dataType: "string enum";
|
|
2899
|
-
data: "auth" | "
|
|
2899
|
+
data: "auth" | "data" | "config" | "blobIndex" | "blob";
|
|
2900
2900
|
driverParam: string;
|
|
2901
2901
|
notNull: true;
|
|
2902
2902
|
hasDefault: false;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @template {Namespace} [TNamespace=Namespace]
|
|
7
7
|
*/
|
|
8
|
-
export class NamespaceSyncState<TNamespace extends Namespace = "auth" | "
|
|
8
|
+
export class NamespaceSyncState<TNamespace extends Namespace = "auth" | "data" | "config" | "blobIndex" | "blob"> {
|
|
9
9
|
/**
|
|
10
10
|
* @param {object} opts
|
|
11
11
|
* @param {TNamespace} opts.namespace
|
|
@@ -24,7 +24,7 @@ export class PeerSyncController {
|
|
|
24
24
|
});
|
|
25
25
|
get peerKey(): Buffer;
|
|
26
26
|
get peerId(): string;
|
|
27
|
-
get syncCapability(): Record<"auth" | "
|
|
27
|
+
get syncCapability(): Record<"auth" | "data" | "config" | "blobIndex" | "blob", SyncCapability>;
|
|
28
28
|
/** @param {SyncEnabledState} syncEnabledState */
|
|
29
29
|
setSyncEnabledState(syncEnabledState: SyncEnabledState): void;
|
|
30
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-api.d.ts","sourceRoot":"","sources":["../../src/sync/sync-api.js"],"names":[],"mappings":"AAeA,2EAA2E;AAC3E,yCAAyC;AACzC,4DAA4D;AAC5D,iFAAiF;AACjF,mEAAmE;AAEnE,gDAAiE;AACjE,uCAA8C;AAC9C,6CAAoD;AACpD,oDAA2D;AAC3D,wDAEC;AAED;;GAEG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;GAGG;AAEH;;GAEG;AACH;IA4BE;;;;;;;;;;;OAWG;IACH,gJAVG;QAA6D,WAAW,EAAhE,OAAO,0BAA0B,EAAE,WAAW;QAC1B,a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D,oBAAoB,EAAlD,MAAM,iBAAiB;QAC0B,SAAS,EAA1D,OAAO,wBAAwB,EAAE,SAAS;QAC5B,UAAU;QACV,MAAM;KAAC,EAkD/B;IA8BD;;;OAGG;IACH,YAFa,KAAK,CAIjB;IAqHD;;OAEG;IACH,kBAFa,IAAI,CAsDhB;IAED;;OAEG;IACH,qBAFa,IAAI,CAQhB;IAED;;;;;;;;;;OAUG;IACH;;yBAOC;IAED;;;;OAIG;IACH,aAGC;IAkBD;;;OAGG;IACH,kDAHW,IAAI,GAAG,MAAM,GACX,IAAI,CAOhB;IAED;;;;;;;;OAQG;IACH,kBARW,QAAQ;;oBAMN,OAAO,CAAC,IAAI,CAAC,CAwBzB;oFARgC,2BAA2B;IAlD5D;;OAEG;IACH,2BAGC;IAED;;OAEG;IACH,kCAGC;IA8CD;;;;OAIG;IACH,wCAJW,MAAM,eACN,WAAW,GACT,OAAO,CAAC,IAAI,CAAC,CA6BzB;IApXC,wBAME;;CA6fL;uBA5mBY,SAAS,GAAG,MAAM;+BAIlB,MAAM,GAAG,SAAS,GAAG,KAAK;;WAMzB,MAAM;YACN,MAAM;gBACN,MAAM;YACN,MAAM;;;;;;mBAMN,OAAO;;;;UACP,MAAM;;;;YACN,MAAM;;;;;;;;;aAMN,mCAAmC;;;;UACnC,mCAAmC;;;;;;aAKnC;QAAE,aAAa,EAAE,OAAO,CAAA;KAAE;;;;UAC1B;QAAE,aAAa,EAAE,OAAO,CAAA;KAAE;;;;2BAC1B,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC;;;kBAKrC,CAAC,SAAS,EAAE,KAAK,KAAK,IAAI;;6BAtEX,oBAAoB;0BAEvB,iBAAiB;mCAeR,sBAAsB;sBAhBnC,IAAI;uCAkByB,aAAa;uBAfzC,cAAc"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -130,12 +130,12 @@ export function timeoutPromise<T>(promise: Promise<T>, opts: Parameters<typeof p
|
|
|
130
130
|
* Does not validate device ID or device name
|
|
131
131
|
*
|
|
132
132
|
* @param {MapShareExtension} mapShare
|
|
133
|
-
* @returns {asserts mapShare is { [K in keyof MapShareExtension]: import('./mapeo-
|
|
133
|
+
* @returns {asserts mapShare is { [K in keyof MapShareExtension]: import('./mapeo-manager.js').MapShare[K] }} - this validates the properties that MapShareExtension and MapShare have in common - bounds tuple and mapShareUrls
|
|
134
134
|
*/
|
|
135
|
-
export function validateMapShareExtension(mapShare: MapShareExtension): asserts mapShare is { [K in keyof MapShareExtension]: import("./mapeo-
|
|
135
|
+
export function validateMapShareExtension(mapShare: MapShareExtension): asserts mapShare is { [K in keyof MapShareExtension]: import("./mapeo-manager.js").MapShare[K]; };
|
|
136
136
|
export const MAX_BOUNDS: number[];
|
|
137
137
|
import type { Attachment } from "./types.js";
|
|
138
138
|
import type { BlobId } from "./types.js";
|
|
139
139
|
import pTimeout from 'p-timeout';
|
|
140
|
-
import type { MapShareExtension } from './generated/
|
|
140
|
+
import type { MapShareExtension } from './generated/rpc.js';
|
|
141
141
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,6BAHW,MAAM,SAAO,UASvB;AAED;;GAEG;AACH,wBAFa,IAAI,CAEQ;AAEzB;;;;;;;;;;;;;GAaG;AACH,uBATa,CAAC,OACH,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAUd,OAAO,KACL,KAAK,IAAI,CAAC,CAGxB;AAED;;;;GAIG;AACH,0BAJa,CAAC,SACH,SAAS,GAAG,CAAC,GACX,KAAK,IAAI,CAAC,CAItB;AAED;;;;;;;GAOG;AACH,0BAJkB,CAAC,SAAN,EAAI,OACN,CAAC,GACC,OAAO,YAAY,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAStD;AAED;;;;;;;;GAQG;AACH,kCAJkB,CAAC,SAAN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AAY;4BAAZ,YAAY;qBAHM,WAAW;uCAE5B,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comapeo/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Offline p2p mapping library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -222,6 +222,7 @@
|
|
|
222
222
|
"protobufjs": "^7.2.3",
|
|
223
223
|
"protomux": "^3.4.1",
|
|
224
224
|
"quickbit-universal": "^2.2.0",
|
|
225
|
+
"ready-resource": "^1.0.0",
|
|
225
226
|
"sodium-universal": "^4.0.0",
|
|
226
227
|
"start-stop-state-machine": "^1.2.0",
|
|
227
228
|
"streamx": "^2.19.0",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ReadyResource from 'ready-resource'
|
|
2
2
|
import { createEntriesStream } from './entries-stream.js'
|
|
3
3
|
import { filePathMatchesFilter } from './utils.js'
|
|
4
4
|
import { DriveNotFoundError, UnexpectedEndOfStreamError } from '../errors.js'
|
|
5
|
+
import { noop } from '../utils.js'
|
|
5
6
|
|
|
6
7
|
/** @import { BlobFilter } from '../types.js' */
|
|
7
8
|
/** @import { THyperdriveIndex } from './hyperdrive-index.js' */
|
|
@@ -24,9 +25,9 @@ import { DriveNotFoundError, UnexpectedEndOfStreamError } from '../errors.js'
|
|
|
24
25
|
* of blobs, so this should not be an issue, and if we do in the future,
|
|
25
26
|
* downloading deleted and previous versions may be desirable behavior anyway
|
|
26
27
|
*
|
|
27
|
-
* @extends {
|
|
28
|
+
* @extends {ReadyResource<{ error: (error: Error) => void }>}
|
|
28
29
|
*/
|
|
29
|
-
export class Downloader extends
|
|
30
|
+
export class Downloader extends ReadyResource {
|
|
30
31
|
/** @type {THyperdriveIndex} */
|
|
31
32
|
#driveIndex
|
|
32
33
|
/** @type {Set<{ done(): Promise<void>, destroy(): void }>} */
|
|
@@ -56,6 +57,10 @@ export class Downloader extends TypedEmitter {
|
|
|
56
57
|
|
|
57
58
|
this.#processEntriesPromise = this.#processEntries()
|
|
58
59
|
this.#processEntriesPromise.catch(this.#handleError)
|
|
60
|
+
// Not necessary, because _open() is currently a no-op, but leaving this
|
|
61
|
+
// here defensively in case we add additional resources to _open() in the
|
|
62
|
+
// future
|
|
63
|
+
this.ready().catch(noop)
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
/**
|
|
@@ -109,8 +114,10 @@ export class Downloader extends TypedEmitter {
|
|
|
109
114
|
/**
|
|
110
115
|
* Cancel the downloads and clean up resources.
|
|
111
116
|
*/
|
|
112
|
-
|
|
117
|
+
async _close() {
|
|
113
118
|
this.#ac.abort()
|
|
119
|
+
// Error is handled in #handleError() attached in the constructor
|
|
120
|
+
await this.#processEntriesPromise.catch(noop)
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
/** @param {Error} err */
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import b4a from 'b4a'
|
|
2
2
|
import { discoveryKey } from 'hypercore-crypto'
|
|
3
3
|
import Hyperdrive from 'hyperdrive'
|
|
4
|
-
import
|
|
4
|
+
import ReadyResource from 'ready-resource'
|
|
5
5
|
import { MissingWriterError, UnsupportedCorestoreOptsError } from '../errors.js'
|
|
6
|
+
import { noop } from '../utils.js'
|
|
6
7
|
|
|
7
8
|
/** @typedef {HyperdriveIndexImpl} THyperdriveIndex */
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
|
-
* @extends {
|
|
11
|
+
* @extends {ReadyResource<{ 'add-drive': (drive: Hyperdrive) => void }>}
|
|
11
12
|
*/
|
|
12
|
-
export class HyperdriveIndexImpl extends
|
|
13
|
+
export class HyperdriveIndexImpl extends ReadyResource {
|
|
13
14
|
/** @type {Map<string, Hyperdrive>} */
|
|
14
15
|
#hyperdrives = new Map()
|
|
15
16
|
#writer
|
|
@@ -47,7 +48,17 @@ export class HyperdriveIndexImpl extends TypedEmitter {
|
|
|
47
48
|
this.#hyperdrives.set(driveId, drive)
|
|
48
49
|
this.emit('add-drive', drive)
|
|
49
50
|
})
|
|
51
|
+
// Not necessary, because hyperdrives "auto-open", but leaving this here
|
|
52
|
+
// defensively in case we add additional resources to _open() in the future
|
|
53
|
+
this.ready().catch(noop)
|
|
50
54
|
}
|
|
55
|
+
|
|
56
|
+
async _open() {
|
|
57
|
+
await Promise.all(
|
|
58
|
+
[...this.#hyperdrives.values()].map((drive) => drive.ready())
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
get writer() {
|
|
52
63
|
return this.#writer
|
|
53
64
|
}
|
|
@@ -61,6 +72,12 @@ export class HyperdriveIndexImpl extends TypedEmitter {
|
|
|
61
72
|
get(driveId) {
|
|
62
73
|
return this.#hyperdrives.get(driveId)
|
|
63
74
|
}
|
|
75
|
+
|
|
76
|
+
async _close() {
|
|
77
|
+
await Promise.all(
|
|
78
|
+
[...this.#hyperdrives.values()].map((drive) => drive.close())
|
|
79
|
+
)
|
|
80
|
+
}
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
/**
|
package/src/blob-store/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import { Downloader } from './downloader.js'
|
|
|
4
4
|
import { createEntriesStream } from './entries-stream.js'
|
|
5
5
|
import { FilterEntriesStream } from './utils.js'
|
|
6
6
|
import { noop } from '../utils.js'
|
|
7
|
-
import { TypedEmitter } from 'tiny-typed-emitter'
|
|
8
7
|
import { HyperdriveIndexImpl as HyperdriveIndex } from './hyperdrive-index.js'
|
|
9
8
|
import { Logger } from '../logger.js'
|
|
9
|
+
import ReadyResource from 'ready-resource'
|
|
10
10
|
import {
|
|
11
11
|
BlobNotFoundError,
|
|
12
12
|
getErrorCode,
|
|
@@ -58,8 +58,8 @@ const NON_ARCHIVE_DEVICE_DOWNLOAD_FILTER = {
|
|
|
58
58
|
// thumbnails aren't supported yet.
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
/** @extends {
|
|
62
|
-
export class BlobStore extends
|
|
61
|
+
/** @extends {ReadyResource<BlobStoreEvents>} */
|
|
62
|
+
export class BlobStore extends ReadyResource {
|
|
63
63
|
#driveIndex
|
|
64
64
|
/** @type {Downloader} */
|
|
65
65
|
#downloader
|
|
@@ -169,6 +169,10 @@ export class BlobStore extends TypedEmitter {
|
|
|
169
169
|
coreManager.on('peer-download-intent', this.#handleDownloadIntent)
|
|
170
170
|
coreManager.creatorCore.on('peer-add', this.#handlePeerAdd)
|
|
171
171
|
coreManager.creatorCore.on('peer-remove', this.#handlePeerRemove)
|
|
172
|
+
// Not necessary, because everything currently in _open() will "auto-open"
|
|
173
|
+
// anyway (call ready() in their own constructor), but leaving this here
|
|
174
|
+
// defensively in case we add additional resources to _open() in the future
|
|
175
|
+
this.ready().catch(noop)
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
/**
|
|
@@ -191,13 +195,13 @@ export class BlobStore extends TypedEmitter {
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
/** @param {boolean} isArchiveDevice */
|
|
194
|
-
|
|
198
|
+
setIsArchiveDevice(isArchiveDevice) {
|
|
195
199
|
this.#l.log('Setting isArchiveDevice to %s', isArchiveDevice)
|
|
196
200
|
if (this.#isArchiveDevice === isArchiveDevice) return
|
|
197
201
|
this.#isArchiveDevice = isArchiveDevice
|
|
198
202
|
const blobDownloadFilter = getBlobDownloadFilter(isArchiveDevice)
|
|
199
203
|
this.#downloader.removeAllListeners()
|
|
200
|
-
this.#downloader.
|
|
204
|
+
this.#downloader.close().catch(noop)
|
|
201
205
|
this.#downloader = new Downloader(this.#driveIndex, {
|
|
202
206
|
filter: blobDownloadFilter,
|
|
203
207
|
})
|
|
@@ -394,9 +398,15 @@ export class BlobStore extends TypedEmitter {
|
|
|
394
398
|
return drive.clear(path, options)
|
|
395
399
|
}
|
|
396
400
|
|
|
397
|
-
|
|
401
|
+
async _open() {
|
|
402
|
+
await this.#coreManager.ready()
|
|
403
|
+
await this.#driveIndex.ready()
|
|
404
|
+
await this.#downloader.ready()
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
async _close() {
|
|
398
408
|
this.#downloader.removeAllListeners()
|
|
399
|
-
this.#downloader.
|
|
409
|
+
await Promise.all([this.#downloader.close(), this.#driveIndex.close()])
|
|
400
410
|
this.#coreManager.off('peer-download-intent', this.#handleDownloadIntent)
|
|
401
411
|
this.#coreManager.creatorCore.off('peer-add', this.#handlePeerAdd)
|
|
402
412
|
this.#coreManager.creatorCore.off('peer-remove', this.#handlePeerRemove)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TypedEmitter } from 'tiny-typed-emitter'
|
|
2
1
|
import Corestore from 'corestore'
|
|
3
2
|
import { debounce } from 'throttle-debounce'
|
|
4
3
|
import { sql, eq } from 'drizzle-orm'
|
|
@@ -7,7 +6,6 @@ import {
|
|
|
7
6
|
HaveExtension,
|
|
8
7
|
ProjectExtension,
|
|
9
8
|
DownloadIntentExtension,
|
|
10
|
-
MapShareExtension,
|
|
11
9
|
} from '../generated/extensions.js'
|
|
12
10
|
import { Logger } from '../logger.js'
|
|
13
11
|
import { NAMESPACES } from '../constants.js'
|
|
@@ -16,10 +14,10 @@ import { coresTable } from '../schema/project.js'
|
|
|
16
14
|
import * as rle from './bitfield-rle.js'
|
|
17
15
|
import { CoreIndex } from './core-index.js'
|
|
18
16
|
import mapObject from 'map-obj'
|
|
17
|
+
import ReadyResource from 'ready-resource'
|
|
19
18
|
import {
|
|
20
19
|
InvalidProjectKeyError,
|
|
21
20
|
InvalidProjectSecretKeyError,
|
|
22
|
-
PeerNotFoundError,
|
|
23
21
|
} from '../errors.js'
|
|
24
22
|
|
|
25
23
|
/** @import Hypercore from 'hypercore' */
|
|
@@ -36,13 +34,12 @@ export const kCoreManagerReplicate = Symbol('replicate core manager')
|
|
|
36
34
|
* @property {(coreRecord: CoreRecord) => void} add-core
|
|
37
35
|
* @property {(namespace: Namespace, msg: { coreDiscoveryId: string, peerId: string, start: number, bitfield: Uint32Array }) => void} peer-have
|
|
38
36
|
* @property {(blobFilter: GenericBlobFilter | null, peerId: string) => void} peer-download-intent
|
|
39
|
-
* @property {(mapShare: MapShareExtension, deviceId: string) => void} map-share
|
|
40
37
|
*/
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
|
-
* @extends {
|
|
40
|
+
* @extends {ReadyResource<Events>}
|
|
44
41
|
*/
|
|
45
|
-
export class CoreManager extends
|
|
42
|
+
export class CoreManager extends ReadyResource {
|
|
46
43
|
#corestore
|
|
47
44
|
#coreIndex
|
|
48
45
|
/** @type {CoreRecord} */
|
|
@@ -52,13 +49,11 @@ export class CoreManager extends TypedEmitter {
|
|
|
52
49
|
#projectExtension
|
|
53
50
|
/** @type {'opened' | 'closing' | 'closed'} */
|
|
54
51
|
#state = 'opened'
|
|
55
|
-
#ready
|
|
56
52
|
#haveExtension
|
|
57
53
|
#deviceId
|
|
58
54
|
#l
|
|
59
55
|
#autoDownload
|
|
60
56
|
#downloadIntentExtension
|
|
61
|
-
#mapShareExtension
|
|
62
57
|
|
|
63
58
|
static get namespaces() {
|
|
64
59
|
return NAMESPACES
|
|
@@ -176,30 +171,24 @@ export class CoreManager extends TypedEmitter {
|
|
|
176
171
|
}
|
|
177
172
|
)
|
|
178
173
|
|
|
179
|
-
this.#mapShareExtension = this.creatorCore.registerExtension(
|
|
180
|
-
'mapeo/map-share',
|
|
181
|
-
{
|
|
182
|
-
encoding: MapShareCodec,
|
|
183
|
-
onmessage: (msg, peer) => {
|
|
184
|
-
this.#handleMapShareMessage(msg, peer)
|
|
185
|
-
},
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
|
|
189
174
|
this.creatorCore.on('peer-add', (peer) => {
|
|
190
175
|
this.#sendHaves(peer, this.#coreIndex).catch(() => {
|
|
191
176
|
this.#l.log('Failed to send pre-haves to newly-connected peer')
|
|
192
177
|
})
|
|
193
178
|
this.#sendAuthCoreKeys(peer)
|
|
194
179
|
})
|
|
180
|
+
// Not necessary, because coreStore and hypercores "auto-open", but leaving
|
|
181
|
+
// this here defensively in case we add additional resources to _open() in
|
|
182
|
+
// the future
|
|
183
|
+
this.ready().catch(noop)
|
|
184
|
+
}
|
|
195
185
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
.catch(() => {})
|
|
186
|
+
async _open() {
|
|
187
|
+
await this.#corestore.ready()
|
|
188
|
+
|
|
189
|
+
await Promise.all([...this.#coreIndex].map(({ core }) => core.ready()))
|
|
190
|
+
|
|
191
|
+
this.#l.log('ready')
|
|
203
192
|
}
|
|
204
193
|
|
|
205
194
|
get deviceId() {
|
|
@@ -214,15 +203,6 @@ export class CoreManager extends TypedEmitter {
|
|
|
214
203
|
return this.#creatorCoreRecord
|
|
215
204
|
}
|
|
216
205
|
|
|
217
|
-
/**
|
|
218
|
-
* Resolves when all cores have finished loading
|
|
219
|
-
*
|
|
220
|
-
* @returns {Promise<void>}
|
|
221
|
-
*/
|
|
222
|
-
async ready() {
|
|
223
|
-
await this.#ready
|
|
224
|
-
}
|
|
225
|
-
|
|
226
206
|
/**
|
|
227
207
|
* Get the writer core for the given namespace
|
|
228
208
|
*
|
|
@@ -269,7 +249,7 @@ export class CoreManager extends TypedEmitter {
|
|
|
269
249
|
* Close all open cores and end any replication streams
|
|
270
250
|
* TODO: gracefully close replication streams
|
|
271
251
|
*/
|
|
272
|
-
async
|
|
252
|
+
async _close() {
|
|
273
253
|
this.#state = 'closing'
|
|
274
254
|
|
|
275
255
|
// Closes all cores in the index
|
|
@@ -397,15 +377,6 @@ export class CoreManager extends TypedEmitter {
|
|
|
397
377
|
}
|
|
398
378
|
}
|
|
399
379
|
|
|
400
|
-
/**
|
|
401
|
-
* @param {MapShareExtension} mapShare
|
|
402
|
-
* @param {HypercorePeer} peer
|
|
403
|
-
*/
|
|
404
|
-
#handleMapShareMessage(mapShare, peer) {
|
|
405
|
-
// TODO: Fetch device name or device ID for peer?
|
|
406
|
-
this.emit('map-share', mapShare, peer.remotePublicKey.toString('hex'))
|
|
407
|
-
}
|
|
408
|
-
|
|
409
380
|
/**
|
|
410
381
|
* Sends auth core keys to the given peer, skipping any keys that we know the
|
|
411
382
|
* peer has already (depends on the peer having already replicated the auth
|
|
@@ -488,21 +459,6 @@ export class CoreManager extends TypedEmitter {
|
|
|
488
459
|
peer.protomux.uncork()
|
|
489
460
|
}
|
|
490
461
|
|
|
491
|
-
/**
|
|
492
|
-
* Send a map share to a peer
|
|
493
|
-
* @param {MapShareExtension} mapShare
|
|
494
|
-
*/
|
|
495
|
-
async sendMapShare(mapShare) {
|
|
496
|
-
const { receiverDeviceKey } = mapShare
|
|
497
|
-
for (const peer of this.creatorCore.peers) {
|
|
498
|
-
if (peer.remotePublicKey.equals(receiverDeviceKey)) {
|
|
499
|
-
this.#mapShareExtension.send(mapShare, peer)
|
|
500
|
-
return
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
throw new PeerNotFoundError()
|
|
504
|
-
}
|
|
505
|
-
|
|
506
462
|
/**
|
|
507
463
|
* ONLY FOR TESTING
|
|
508
464
|
* Replicate all cores in core manager
|
|
@@ -610,14 +566,3 @@ const DownloadIntentCodec = {
|
|
|
610
566
|
])
|
|
611
567
|
},
|
|
612
568
|
}
|
|
613
|
-
|
|
614
|
-
const MapShareCodec = {
|
|
615
|
-
/** @param {Parameters<typeof MapShareExtension.encode>[0]} msg */
|
|
616
|
-
encode(msg) {
|
|
617
|
-
return MapShareExtension.encode(msg).finish()
|
|
618
|
-
},
|
|
619
|
-
/** @param {Buffer | Uint8Array} buf */
|
|
620
|
-
decode(buf) {
|
|
621
|
-
return MapShareExtension.decode(buf)
|
|
622
|
-
},
|
|
623
|
-
}
|
|
@@ -39,30 +39,6 @@ export interface DownloadIntentExtension_DownloadIntentsEntry {
|
|
|
39
39
|
key: string;
|
|
40
40
|
value: DownloadIntentExtension_DownloadIntent | undefined;
|
|
41
41
|
}
|
|
42
|
-
export interface MapShareExtension {
|
|
43
|
-
/** URLs to map share */
|
|
44
|
-
mapShareUrls: string[];
|
|
45
|
-
/** ID of peer that can receive the map share (each map share is linked to a specific device ID) */
|
|
46
|
-
receiverDeviceKey: Buffer;
|
|
47
|
-
/** The ID of the map share */
|
|
48
|
-
shareId: string;
|
|
49
|
-
/** The name of the map being shared */
|
|
50
|
-
mapName: string;
|
|
51
|
-
/** The ID of the map being shared */
|
|
52
|
-
mapId: string;
|
|
53
|
-
/** When ths share was created */
|
|
54
|
-
mapShareCreatedAt: number;
|
|
55
|
-
/** When the map was created */
|
|
56
|
-
mapCreatedAt: number;
|
|
57
|
-
/** The bounding box of the map data being shared */
|
|
58
|
-
bounds: number[];
|
|
59
|
-
/** The minimum zoom level of the map data being shared */
|
|
60
|
-
minzoom: number;
|
|
61
|
-
/** The maximum zoom level of the map data being shared */
|
|
62
|
-
maxzoom: number;
|
|
63
|
-
/** Estimated size of the map data being shared in bytes */
|
|
64
|
-
estimatedSizeBytes: number;
|
|
65
|
-
}
|
|
66
42
|
export declare const ProjectExtension: {
|
|
67
43
|
encode(message: ProjectExtension, writer?: _m0.Writer): _m0.Writer;
|
|
68
44
|
decode(input: _m0.Reader | Uint8Array, length?: number): ProjectExtension;
|
|
@@ -93,12 +69,6 @@ export declare const DownloadIntentExtension_DownloadIntentsEntry: {
|
|
|
93
69
|
create<I extends Exact<DeepPartial<DownloadIntentExtension_DownloadIntentsEntry>, I>>(base?: I): DownloadIntentExtension_DownloadIntentsEntry;
|
|
94
70
|
fromPartial<I extends Exact<DeepPartial<DownloadIntentExtension_DownloadIntentsEntry>, I>>(object: I): DownloadIntentExtension_DownloadIntentsEntry;
|
|
95
71
|
};
|
|
96
|
-
export declare const MapShareExtension: {
|
|
97
|
-
encode(message: MapShareExtension, writer?: _m0.Writer): _m0.Writer;
|
|
98
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): MapShareExtension;
|
|
99
|
-
create<I extends Exact<DeepPartial<MapShareExtension>, I>>(base?: I): MapShareExtension;
|
|
100
|
-
fromPartial<I extends Exact<DeepPartial<MapShareExtension>, I>>(object: I): MapShareExtension;
|
|
101
|
-
};
|
|
102
72
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
103
73
|
type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
104
74
|
[K in keyof T]?: DeepPartial<T[K]>;
|