@comapeo/core 6.0.2 → 7.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.
- package/dist/blob-store/downloader.d.ts +4 -9
- package/dist/blob-store/downloader.d.ts.map +1 -1
- package/dist/blob-store/hyperdrive-index.d.ts +4 -5
- package/dist/blob-store/hyperdrive-index.d.ts.map +1 -1
- package/dist/blob-store/index.d.ts +4 -5
- package/dist/blob-store/index.d.ts.map +1 -1
- package/dist/core-manager/index.d.ts +4 -23
- 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 +2 -2
- 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 +3 -76
- 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 +12 -4
- package/src/blob-store/hyperdrive-index.js +22 -3
- package/src/blob-store/index.js +18 -7
- package/src/core-manager/index.js +16 -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 +2 -2
- package/src/local-peers.js +33 -0
- package/src/mapeo-manager.js +93 -35
- package/src/mapeo-project.js +18 -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
|
-
* @
|
|
28
|
+
* @type {ReadyResource & TypedEmitter<ProjectEvents>}
|
|
46
29
|
*/
|
|
47
|
-
export class MapeoProject extends
|
|
30
|
+
export class MapeoProject extends ReadyResource {
|
|
48
31
|
static EMPTY_PROJECT_SETTINGS: Readonly<{
|
|
49
32
|
sendStats: false;
|
|
50
33
|
}>;
|
|
@@ -86,15 +69,6 @@ export class MapeoProject extends TypedEmitter<ProjectEvents> {
|
|
|
86
69
|
});
|
|
87
70
|
$blobs: BlobApi;
|
|
88
71
|
get deviceId(): string;
|
|
89
|
-
/**
|
|
90
|
-
* Resolves when hypercores have all loaded
|
|
91
|
-
*
|
|
92
|
-
* @returns {Promise<void>}
|
|
93
|
-
*/
|
|
94
|
-
ready(): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
*/
|
|
97
|
-
close(): Promise<void>;
|
|
98
72
|
get observation(): DataType<DataStore<"data", "observation" | "track" | "remoteDetectionAlert">, import("./schema/types.js").JsonSchemaToDrizzleSqliteTable<{
|
|
99
73
|
schemaName: "observation";
|
|
100
74
|
lat?: number | undefined;
|
|
@@ -2524,16 +2498,6 @@ export class MapeoProject extends TypedEmitter<ProjectEvents> {
|
|
|
2524
2498
|
$importCategories({ filePath }: {
|
|
2525
2499
|
filePath: string;
|
|
2526
2500
|
}): 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
2501
|
/**
|
|
2538
2502
|
* CoreManager instance, used for tests
|
|
2539
2503
|
*/
|
|
@@ -5761,50 +5725,14 @@ export type RoleChangeEvent = {
|
|
|
5761
5725
|
reason: string | undefined;
|
|
5762
5726
|
};
|
|
5763
5727
|
};
|
|
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
5728
|
export type ProjectEvents = {
|
|
5793
5729
|
/**
|
|
5794
5730
|
* Project resources have been cleared up
|
|
5795
5731
|
*/
|
|
5796
5732
|
close: () => void;
|
|
5797
5733
|
"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
5734
|
};
|
|
5807
|
-
import
|
|
5735
|
+
import ReadyResource from 'ready-resource';
|
|
5808
5736
|
import { BlobApi } from './blob-api.js';
|
|
5809
5737
|
import { DataStore } from './datastore/index.js';
|
|
5810
5738
|
import { DataType } from './datatype/index.js';
|
|
@@ -5824,5 +5752,4 @@ import { Logger } from './logger.js';
|
|
|
5824
5752
|
import type { ProjectSettingsValue } from '@comapeo/schema';
|
|
5825
5753
|
import type { Attachment } from './types.js';
|
|
5826
5754
|
import type { BlobId } from './types.js';
|
|
5827
|
-
import type { MapShareExtension } from './generated/extensions.js';
|
|
5828
5755
|
//# 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":"AAu7CA;;;;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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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;;0BAvD1B,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,aAAa,EAAjC,aAAa;QACqB,KAAK,EAAvC,OAAO,aAAa,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1D,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,EAAI,OACN,CAAC,GACC,OAAO,YAAY,EAAE,kBAAkB,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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comapeo/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
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.2.0",
|
|
225
226
|
"sodium-universal": "^4.0.0",
|
|
226
227
|
"start-stop-state-machine": "^1.2.0",
|
|
227
228
|
"streamx": "^2.19.0",
|
|
@@ -1,10 +1,12 @@
|
|
|
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' */
|
|
9
|
+
/** @import { TypedEmitter } from 'tiny-typed-emitter' */
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Like hyperdrive.download() but 'live', and for multiple drives.
|
|
@@ -24,9 +26,9 @@ import { DriveNotFoundError, UnexpectedEndOfStreamError } from '../errors.js'
|
|
|
24
26
|
* of blobs, so this should not be an issue, and if we do in the future,
|
|
25
27
|
* downloading deleted and previous versions may be desirable behavior anyway
|
|
26
28
|
*
|
|
27
|
-
* @
|
|
29
|
+
* @type {ReadyResource & TypedEmitter<{ error: (error: Error) => void }>}
|
|
28
30
|
*/
|
|
29
|
-
export class Downloader extends
|
|
31
|
+
export class Downloader extends ReadyResource {
|
|
30
32
|
/** @type {THyperdriveIndex} */
|
|
31
33
|
#driveIndex
|
|
32
34
|
/** @type {Set<{ done(): Promise<void>, destroy(): void }>} */
|
|
@@ -56,6 +58,10 @@ export class Downloader extends TypedEmitter {
|
|
|
56
58
|
|
|
57
59
|
this.#processEntriesPromise = this.#processEntries()
|
|
58
60
|
this.#processEntriesPromise.catch(this.#handleError)
|
|
61
|
+
// Not necessary, because _open() is currently a no-op, but leaving this
|
|
62
|
+
// here defensively in case we add additional resources to _open() in the
|
|
63
|
+
// future
|
|
64
|
+
this.ready().catch(noop)
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
/**
|
|
@@ -109,8 +115,10 @@ export class Downloader extends TypedEmitter {
|
|
|
109
115
|
/**
|
|
110
116
|
* Cancel the downloads and clean up resources.
|
|
111
117
|
*/
|
|
112
|
-
|
|
118
|
+
async _close() {
|
|
113
119
|
this.#ac.abort()
|
|
120
|
+
// Error is handled in #handleError() attached in the constructor
|
|
121
|
+
await this.#processEntriesPromise.catch(noop)
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
/** @param {Error} err */
|
|
@@ -1,15 +1,18 @@
|
|
|
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'
|
|
7
|
+
|
|
8
|
+
/** @import { TypedEmitter } from 'tiny-typed-emitter' */
|
|
6
9
|
|
|
7
10
|
/** @typedef {HyperdriveIndexImpl} THyperdriveIndex */
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
|
-
* @
|
|
13
|
+
* @type {ReadyResource & TypedEmitter<{ 'add-drive': (drive: Hyperdrive) => void }>}
|
|
11
14
|
*/
|
|
12
|
-
export class HyperdriveIndexImpl extends
|
|
15
|
+
export class HyperdriveIndexImpl extends ReadyResource {
|
|
13
16
|
/** @type {Map<string, Hyperdrive>} */
|
|
14
17
|
#hyperdrives = new Map()
|
|
15
18
|
#writer
|
|
@@ -47,7 +50,17 @@ export class HyperdriveIndexImpl extends TypedEmitter {
|
|
|
47
50
|
this.#hyperdrives.set(driveId, drive)
|
|
48
51
|
this.emit('add-drive', drive)
|
|
49
52
|
})
|
|
53
|
+
// Not necessary, because hyperdrives "auto-open", but leaving this here
|
|
54
|
+
// defensively in case we add additional resources to _open() in the future
|
|
55
|
+
this.ready().catch(noop)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async _open() {
|
|
59
|
+
await Promise.all(
|
|
60
|
+
[...this.#hyperdrives.values()].map((drive) => drive.ready())
|
|
61
|
+
)
|
|
50
62
|
}
|
|
63
|
+
|
|
51
64
|
get writer() {
|
|
52
65
|
return this.#writer
|
|
53
66
|
}
|
|
@@ -61,6 +74,12 @@ export class HyperdriveIndexImpl extends TypedEmitter {
|
|
|
61
74
|
get(driveId) {
|
|
62
75
|
return this.#hyperdrives.get(driveId)
|
|
63
76
|
}
|
|
77
|
+
|
|
78
|
+
async _close() {
|
|
79
|
+
await Promise.all(
|
|
80
|
+
[...this.#hyperdrives.values()].map((drive) => drive.close())
|
|
81
|
+
)
|
|
82
|
+
}
|
|
64
83
|
}
|
|
65
84
|
|
|
66
85
|
/**
|
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,
|
|
@@ -20,6 +20,7 @@ import ensureError from 'ensure-error'
|
|
|
20
20
|
/** @import { Readable as NodeReadable } from 'node:stream' */
|
|
21
21
|
/** @import { Readable as StreamxReadable, Writable } from 'streamx' */
|
|
22
22
|
/** @import { GenericBlobFilter, BlobFilter, BlobId, BlobStoreEntriesStream } from '../types.js' */
|
|
23
|
+
/** @import { TypedEmitter } from 'tiny-typed-emitter' */
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* @typedef {object} BlobStoreEvents
|
|
@@ -58,8 +59,8 @@ const NON_ARCHIVE_DEVICE_DOWNLOAD_FILTER = {
|
|
|
58
59
|
// thumbnails aren't supported yet.
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
/** @
|
|
62
|
-
export class BlobStore extends
|
|
62
|
+
/** @type {ReadyResource & TypedEmitter<BlobStoreEvents>} */
|
|
63
|
+
export class BlobStore extends ReadyResource {
|
|
63
64
|
#driveIndex
|
|
64
65
|
/** @type {Downloader} */
|
|
65
66
|
#downloader
|
|
@@ -169,6 +170,10 @@ export class BlobStore extends TypedEmitter {
|
|
|
169
170
|
coreManager.on('peer-download-intent', this.#handleDownloadIntent)
|
|
170
171
|
coreManager.creatorCore.on('peer-add', this.#handlePeerAdd)
|
|
171
172
|
coreManager.creatorCore.on('peer-remove', this.#handlePeerRemove)
|
|
173
|
+
// Not necessary, because everything currently in _open() will "auto-open"
|
|
174
|
+
// anyway (call ready() in their own constructor), but leaving this here
|
|
175
|
+
// defensively in case we add additional resources to _open() in the future
|
|
176
|
+
this.ready().catch(noop)
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
/**
|
|
@@ -191,13 +196,13 @@ export class BlobStore extends TypedEmitter {
|
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
/** @param {boolean} isArchiveDevice */
|
|
194
|
-
|
|
199
|
+
setIsArchiveDevice(isArchiveDevice) {
|
|
195
200
|
this.#l.log('Setting isArchiveDevice to %s', isArchiveDevice)
|
|
196
201
|
if (this.#isArchiveDevice === isArchiveDevice) return
|
|
197
202
|
this.#isArchiveDevice = isArchiveDevice
|
|
198
203
|
const blobDownloadFilter = getBlobDownloadFilter(isArchiveDevice)
|
|
199
204
|
this.#downloader.removeAllListeners()
|
|
200
|
-
this.#downloader.
|
|
205
|
+
this.#downloader.close().catch(noop)
|
|
201
206
|
this.#downloader = new Downloader(this.#driveIndex, {
|
|
202
207
|
filter: blobDownloadFilter,
|
|
203
208
|
})
|
|
@@ -394,9 +399,15 @@ export class BlobStore extends TypedEmitter {
|
|
|
394
399
|
return drive.clear(path, options)
|
|
395
400
|
}
|
|
396
401
|
|
|
397
|
-
|
|
402
|
+
async _open() {
|
|
403
|
+
await this.#coreManager.ready()
|
|
404
|
+
await this.#driveIndex.ready()
|
|
405
|
+
await this.#downloader.ready()
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async _close() {
|
|
398
409
|
this.#downloader.removeAllListeners()
|
|
399
|
-
this.#downloader.
|
|
410
|
+
await Promise.all([this.#downloader.close(), this.#driveIndex.close()])
|
|
400
411
|
this.#coreManager.off('peer-download-intent', this.#handleDownloadIntent)
|
|
401
412
|
this.#coreManager.creatorCore.off('peer-add', this.#handlePeerAdd)
|
|
402
413
|
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,14 +14,15 @@ 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' */
|
|
26
24
|
/** @import { BlobFilter, GenericBlobFilter, HypercorePeer, Namespace } from '../types.js' */
|
|
25
|
+
/** @import { TypedEmitter } from 'tiny-typed-emitter' */
|
|
27
26
|
|
|
28
27
|
const WRITER_CORE_PREHAVES_DEBOUNCE_DELAY = 1000
|
|
29
28
|
|
|
@@ -36,13 +35,12 @@ export const kCoreManagerReplicate = Symbol('replicate core manager')
|
|
|
36
35
|
* @property {(coreRecord: CoreRecord) => void} add-core
|
|
37
36
|
* @property {(namespace: Namespace, msg: { coreDiscoveryId: string, peerId: string, start: number, bitfield: Uint32Array }) => void} peer-have
|
|
38
37
|
* @property {(blobFilter: GenericBlobFilter | null, peerId: string) => void} peer-download-intent
|
|
39
|
-
* @property {(mapShare: MapShareExtension, deviceId: string) => void} map-share
|
|
40
38
|
*/
|
|
41
39
|
|
|
42
40
|
/**
|
|
43
|
-
* @
|
|
41
|
+
* @type {ReadyResource & TypedEmitter<Events>}
|
|
44
42
|
*/
|
|
45
|
-
export class CoreManager extends
|
|
43
|
+
export class CoreManager extends ReadyResource {
|
|
46
44
|
#corestore
|
|
47
45
|
#coreIndex
|
|
48
46
|
/** @type {CoreRecord} */
|
|
@@ -52,13 +50,11 @@ export class CoreManager extends TypedEmitter {
|
|
|
52
50
|
#projectExtension
|
|
53
51
|
/** @type {'opened' | 'closing' | 'closed'} */
|
|
54
52
|
#state = 'opened'
|
|
55
|
-
#ready
|
|
56
53
|
#haveExtension
|
|
57
54
|
#deviceId
|
|
58
55
|
#l
|
|
59
56
|
#autoDownload
|
|
60
57
|
#downloadIntentExtension
|
|
61
|
-
#mapShareExtension
|
|
62
58
|
|
|
63
59
|
static get namespaces() {
|
|
64
60
|
return NAMESPACES
|
|
@@ -176,30 +172,24 @@ export class CoreManager extends TypedEmitter {
|
|
|
176
172
|
}
|
|
177
173
|
)
|
|
178
174
|
|
|
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
175
|
this.creatorCore.on('peer-add', (peer) => {
|
|
190
176
|
this.#sendHaves(peer, this.#coreIndex).catch(() => {
|
|
191
177
|
this.#l.log('Failed to send pre-haves to newly-connected peer')
|
|
192
178
|
})
|
|
193
179
|
this.#sendAuthCoreKeys(peer)
|
|
194
180
|
})
|
|
181
|
+
// Not necessary, because coreStore and hypercores "auto-open", but leaving
|
|
182
|
+
// this here defensively in case we add additional resources to _open() in
|
|
183
|
+
// the future
|
|
184
|
+
this.ready().catch(noop)
|
|
185
|
+
}
|
|
195
186
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
.catch(() => {})
|
|
187
|
+
async _open() {
|
|
188
|
+
await this.#corestore.ready()
|
|
189
|
+
|
|
190
|
+
await Promise.all([...this.#coreIndex].map(({ core }) => core.ready()))
|
|
191
|
+
|
|
192
|
+
this.#l.log('ready')
|
|
203
193
|
}
|
|
204
194
|
|
|
205
195
|
get deviceId() {
|
|
@@ -214,15 +204,6 @@ export class CoreManager extends TypedEmitter {
|
|
|
214
204
|
return this.#creatorCoreRecord
|
|
215
205
|
}
|
|
216
206
|
|
|
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
207
|
/**
|
|
227
208
|
* Get the writer core for the given namespace
|
|
228
209
|
*
|
|
@@ -269,7 +250,7 @@ export class CoreManager extends TypedEmitter {
|
|
|
269
250
|
* Close all open cores and end any replication streams
|
|
270
251
|
* TODO: gracefully close replication streams
|
|
271
252
|
*/
|
|
272
|
-
async
|
|
253
|
+
async _close() {
|
|
273
254
|
this.#state = 'closing'
|
|
274
255
|
|
|
275
256
|
// Closes all cores in the index
|
|
@@ -397,15 +378,6 @@ export class CoreManager extends TypedEmitter {
|
|
|
397
378
|
}
|
|
398
379
|
}
|
|
399
380
|
|
|
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
381
|
/**
|
|
410
382
|
* Sends auth core keys to the given peer, skipping any keys that we know the
|
|
411
383
|
* peer has already (depends on the peer having already replicated the auth
|
|
@@ -488,21 +460,6 @@ export class CoreManager extends TypedEmitter {
|
|
|
488
460
|
peer.protomux.uncork()
|
|
489
461
|
}
|
|
490
462
|
|
|
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
463
|
/**
|
|
507
464
|
* ONLY FOR TESTING
|
|
508
465
|
* Replicate all cores in core manager
|
|
@@ -610,14 +567,3 @@ const DownloadIntentCodec = {
|
|
|
610
567
|
])
|
|
611
568
|
},
|
|
612
569
|
}
|
|
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]>;
|