@comapeo/core 1.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/LICENSE.md +9 -0
- package/README.md +31 -0
- package/dist/blob-api.d.ts +92 -0
- package/dist/blob-api.d.ts.map +1 -0
- package/dist/blob-store/index.d.ts +163 -0
- package/dist/blob-store/index.d.ts.map +1 -0
- package/dist/blob-store/live-download.d.ts +107 -0
- package/dist/blob-store/live-download.d.ts.map +1 -0
- package/dist/config-import.d.ts +74 -0
- package/dist/config-import.d.ts.map +1 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core-manager/bitfield-rle.d.ts +25 -0
- package/dist/core-manager/bitfield-rle.d.ts.map +1 -0
- package/dist/core-manager/core-index.d.ts +56 -0
- package/dist/core-manager/core-index.d.ts.map +1 -0
- package/dist/core-manager/index.d.ts +125 -0
- package/dist/core-manager/index.d.ts.map +1 -0
- package/dist/core-manager/random-access-file-pool.d.ts +17 -0
- package/dist/core-manager/random-access-file-pool.d.ts.map +1 -0
- package/dist/core-manager/remote-bitfield.d.ts +146 -0
- package/dist/core-manager/remote-bitfield.d.ts.map +1 -0
- package/dist/core-ownership.d.ts +112 -0
- package/dist/core-ownership.d.ts.map +1 -0
- package/dist/datastore/index.d.ts +91 -0
- package/dist/datastore/index.d.ts.map +1 -0
- package/dist/datatype/index.d.ts +108 -0
- package/dist/discovery/local-discovery.d.ts +64 -0
- package/dist/discovery/local-discovery.d.ts.map +1 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/fastify-controller.d.ts +27 -0
- package/dist/fastify-controller.d.ts.map +1 -0
- package/dist/fastify-plugins/blobs.d.ts +6 -0
- package/dist/fastify-plugins/blobs.d.ts.map +1 -0
- package/dist/fastify-plugins/constants.d.ts +3 -0
- package/dist/fastify-plugins/constants.d.ts.map +1 -0
- package/dist/fastify-plugins/icons.d.ts +6 -0
- package/dist/fastify-plugins/icons.d.ts.map +1 -0
- package/dist/fastify-plugins/maps/index.d.ts +11 -0
- package/dist/fastify-plugins/maps/index.d.ts.map +1 -0
- package/dist/fastify-plugins/maps/offline-fallback-map.d.ts +12 -0
- package/dist/fastify-plugins/maps/offline-fallback-map.d.ts.map +1 -0
- package/dist/fastify-plugins/maps/static-maps.d.ts +11 -0
- package/dist/fastify-plugins/maps/static-maps.d.ts.map +1 -0
- package/dist/fastify-plugins/utils.d.ts +23 -0
- package/dist/fastify-plugins/utils.d.ts.map +1 -0
- package/dist/generated/extensions.d.ts +44 -0
- package/dist/generated/extensions.d.ts.map +1 -0
- package/dist/generated/keys.d.ts +36 -0
- package/dist/generated/keys.d.ts.map +1 -0
- package/dist/generated/rpc.d.ts +87 -0
- package/dist/generated/rpc.d.ts.map +1 -0
- package/dist/icon-api.d.ts +109 -0
- package/dist/icon-api.d.ts.map +1 -0
- package/dist/index-writer/index.d.ts +51 -0
- package/dist/index-writer/index.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/invite-api.d.ts +70 -0
- package/dist/invite-api.d.ts.map +1 -0
- package/dist/lib/hashmap.d.ts +62 -0
- package/dist/lib/hashmap.d.ts.map +1 -0
- package/dist/lib/hypercore-helpers.d.ts +6 -0
- package/dist/lib/hypercore-helpers.d.ts.map +1 -0
- package/dist/lib/noise-secret-stream-helpers.d.ts +45 -0
- package/dist/lib/noise-secret-stream-helpers.d.ts.map +1 -0
- package/dist/lib/ponyfills.d.ts +10 -0
- package/dist/lib/ponyfills.d.ts.map +1 -0
- package/dist/lib/string.d.ts +2 -0
- package/dist/lib/string.d.ts.map +1 -0
- package/dist/lib/timing-safe-equal.d.ts +15 -0
- package/dist/lib/timing-safe-equal.d.ts.map +1 -0
- package/dist/local-peers.d.ts +151 -0
- package/dist/local-peers.d.ts.map +1 -0
- package/dist/logger.d.ts +32 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/mapeo-manager.d.ts +178 -0
- package/dist/mapeo-manager.d.ts.map +1 -0
- package/dist/mapeo-project.d.ts +3233 -0
- package/dist/mapeo-project.d.ts.map +1 -0
- package/dist/member-api.d.ts +114 -0
- package/dist/member-api.d.ts.map +1 -0
- package/dist/roles.d.ts +157 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/schema/client.d.ts +284 -0
- package/dist/schema/client.d.ts.map +1 -0
- package/dist/schema/project.d.ts +1812 -0
- package/dist/schema/project.d.ts.map +1 -0
- package/dist/schema/schema-to-drizzle.d.ts +20 -0
- package/dist/schema/schema-to-drizzle.d.ts.map +1 -0
- package/dist/schema/types.d.ts +98 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/utils.d.ts +55 -0
- package/dist/schema/utils.d.ts.map +1 -0
- package/dist/sync/core-sync-state.d.ts +252 -0
- package/dist/sync/core-sync-state.d.ts.map +1 -0
- package/dist/sync/namespace-sync-state.d.ts +47 -0
- package/dist/sync/namespace-sync-state.d.ts.map +1 -0
- package/dist/sync/peer-sync-controller.d.ts +44 -0
- package/dist/sync/peer-sync-controller.d.ts.map +1 -0
- package/dist/sync/sync-api.d.ts +158 -0
- package/dist/sync/sync-api.d.ts.map +1 -0
- package/dist/sync/sync-state.d.ts +40 -0
- package/dist/sync/sync-state.d.ts.map +1 -0
- package/dist/translation-api.d.ts +288 -0
- package/dist/translation-api.d.ts.map +1 -0
- package/dist/types.d.ts +115 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +115 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils_types.d.ts +14 -0
- package/drizzle/client/0000_bumpy_carnage.sql +33 -0
- package/drizzle/client/meta/0000_snapshot.json +199 -0
- package/drizzle/client/meta/_journal.json +13 -0
- package/drizzle/project/0000_spooky_lady_ursula.sql +192 -0
- package/drizzle/project/meta/0000_snapshot.json +1137 -0
- package/drizzle/project/meta/_journal.json +13 -0
- package/package.json +202 -0
- package/src/blob-api.js +139 -0
- package/src/blob-store/index.js +325 -0
- package/src/blob-store/live-download.js +373 -0
- package/src/config-import.js +604 -0
- package/src/constants.js +34 -0
- package/src/core-manager/bitfield-rle.js +235 -0
- package/src/core-manager/core-index.js +87 -0
- package/src/core-manager/index.js +504 -0
- package/src/core-manager/random-access-file-pool.js +30 -0
- package/src/core-manager/remote-bitfield.js +416 -0
- package/src/core-ownership.js +235 -0
- package/src/datastore/README.md +46 -0
- package/src/datastore/index.js +234 -0
- package/src/datatype/README.md +33 -0
- package/src/datatype/index.d.ts +108 -0
- package/src/datatype/index.js +358 -0
- package/src/discovery/local-discovery.js +303 -0
- package/src/errors.js +5 -0
- package/src/fastify-controller.js +84 -0
- package/src/fastify-plugins/blobs.js +139 -0
- package/src/fastify-plugins/constants.js +5 -0
- package/src/fastify-plugins/icons.js +158 -0
- package/src/fastify-plugins/maps/index.js +173 -0
- package/src/fastify-plugins/maps/offline-fallback-map.js +114 -0
- package/src/fastify-plugins/maps/static-maps.js +271 -0
- package/src/fastify-plugins/utils.js +52 -0
- package/src/generated/README.md +3 -0
- package/src/generated/extensions.d.ts +44 -0
- package/src/generated/extensions.js +196 -0
- package/src/generated/extensions.ts +237 -0
- package/src/generated/keys.d.ts +36 -0
- package/src/generated/keys.js +148 -0
- package/src/generated/keys.ts +185 -0
- package/src/generated/rpc.d.ts +87 -0
- package/src/generated/rpc.js +389 -0
- package/src/generated/rpc.ts +463 -0
- package/src/icon-api.js +282 -0
- package/src/index-writer/README.md +38 -0
- package/src/index-writer/index.js +124 -0
- package/src/index.js +16 -0
- package/src/invite-api.js +450 -0
- package/src/lib/hashmap.js +91 -0
- package/src/lib/hypercore-helpers.js +18 -0
- package/src/lib/noise-secret-stream-helpers.js +37 -0
- package/src/lib/ponyfills.js +25 -0
- package/src/lib/string.js +7 -0
- package/src/lib/timing-safe-equal.js +34 -0
- package/src/local-peers.js +737 -0
- package/src/logger.js +99 -0
- package/src/mapeo-manager.js +914 -0
- package/src/mapeo-project.js +980 -0
- package/src/member-api.js +319 -0
- package/src/roles.js +412 -0
- package/src/schema/client.js +55 -0
- package/src/schema/project.js +44 -0
- package/src/schema/schema-to-drizzle.js +118 -0
- package/src/schema/types.ts +153 -0
- package/src/schema/utils.js +51 -0
- package/src/sync/core-sync-state.js +440 -0
- package/src/sync/namespace-sync-state.js +193 -0
- package/src/sync/peer-sync-controller.js +332 -0
- package/src/sync/sync-api.js +588 -0
- package/src/sync/sync-state.js +63 -0
- package/src/translation-api.js +141 -0
- package/src/types.ts +149 -0
- package/src/utils.js +210 -0
- package/src/utils_types.d.ts +14 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# [MIT License](https://spdx.org/licenses/MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2022, Digital Democracy
|
|
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,31 @@
|
|
|
1
|
+
# CoMapeo Core
|
|
2
|
+
|
|
3
|
+
> A local-first library for collaborating on mapping projects.
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
CoMapeo Core is a library used by the [mobile](https://github.com/digidem/comapeo-mobile) and [desktop](https://github.com/digidem/comapeo-desktop) CoMapeo apps that provides the core features needed for offline-first peer to peer collaboration on mapping projects.
|
|
8
|
+
|
|
9
|
+
## Docs
|
|
10
|
+
|
|
11
|
+
To learn more about CoMapeo Core see the [docs](docs/) section of this repo.
|
|
12
|
+
|
|
13
|
+
## Change log
|
|
14
|
+
|
|
15
|
+
The changes in each version are described in the [change log](CHANGELOG.md).
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
> **⚠️ Warning:** this package is not ready for use!
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
npm install @comapeo/core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
Read the [code of conduct](CODE_OF_CONDUCT.md) and the [contributing guide](CONTRIBUTING.md)
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** @import { BlobId, BlobType } from './types.js' */
|
|
2
|
+
/**
|
|
3
|
+
* Location coordinate data. Based on [Expo's `LocationObjectCoords`][0].
|
|
4
|
+
* [0]: https://docs.expo.dev/versions/latest/sdk/location/#locationobjectcoords
|
|
5
|
+
*
|
|
6
|
+
* @typedef {object} LocationObjectCoords
|
|
7
|
+
* @prop {number | null} accuracy
|
|
8
|
+
* @prop {number | null} altitude
|
|
9
|
+
* @prop {number | null} altitudeAccuracy
|
|
10
|
+
* @prop {number | null} heading
|
|
11
|
+
* @prop {number} latitude
|
|
12
|
+
* @prop {number} longitude
|
|
13
|
+
* @prop {number | null} speed
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Location metadata for a blob. Based on [Expo's `LocationObject`][0].
|
|
17
|
+
* [0]: https://docs.expo.dev/versions/latest/sdk/location/#locationobject
|
|
18
|
+
*
|
|
19
|
+
* @typedef {object} LocationObject
|
|
20
|
+
* @prop {LocationObjectCoords} coords
|
|
21
|
+
* @prop {boolean} [mocked]
|
|
22
|
+
* @prop {number} timestamp
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {object} Metadata
|
|
26
|
+
* @prop {string} mimeType
|
|
27
|
+
* @prop {number} timestamp
|
|
28
|
+
* @prop {LocationObject} [location]
|
|
29
|
+
*/
|
|
30
|
+
export class BlobApi {
|
|
31
|
+
/**
|
|
32
|
+
* @param {object} options
|
|
33
|
+
* @param {import('./blob-store/index.js').BlobStore} options.blobStore
|
|
34
|
+
* @param {() => Promise<string>} options.getMediaBaseUrl
|
|
35
|
+
*/
|
|
36
|
+
constructor({ blobStore, getMediaBaseUrl }: {
|
|
37
|
+
blobStore: import("./blob-store/index.js").BlobStore;
|
|
38
|
+
getMediaBaseUrl: () => Promise<string>;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Get a url for a blob based on its BlobId
|
|
42
|
+
* @param {BlobId} blobId
|
|
43
|
+
* @returns {Promise<string>}
|
|
44
|
+
*/
|
|
45
|
+
getUrl(blobId: BlobId): Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Write blobs for provided variants of a file
|
|
48
|
+
* @param {{ original: string, preview?: string, thumbnail?: string }} filepaths
|
|
49
|
+
* @param {Metadata} metadata
|
|
50
|
+
* @returns {Promise<{ driveId: string, name: string, type: 'photo' | 'video' | 'audio', hash: string }>}
|
|
51
|
+
*/
|
|
52
|
+
create(filepaths: {
|
|
53
|
+
original: string;
|
|
54
|
+
preview?: string;
|
|
55
|
+
thumbnail?: string;
|
|
56
|
+
}, metadata: Metadata): Promise<{
|
|
57
|
+
driveId: string;
|
|
58
|
+
name: string;
|
|
59
|
+
type: "photo" | "video" | "audio";
|
|
60
|
+
hash: string;
|
|
61
|
+
}>;
|
|
62
|
+
#private;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Location coordinate data. Based on [Expo's `LocationObjectCoords`][0].
|
|
66
|
+
* [0]: https://docs.expo.dev/versions/latest/sdk/location/#locationobjectcoords
|
|
67
|
+
*/
|
|
68
|
+
export type LocationObjectCoords = {
|
|
69
|
+
accuracy: number | null;
|
|
70
|
+
altitude: number | null;
|
|
71
|
+
altitudeAccuracy: number | null;
|
|
72
|
+
heading: number | null;
|
|
73
|
+
latitude: number;
|
|
74
|
+
longitude: number;
|
|
75
|
+
speed: number | null;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Location metadata for a blob. Based on [Expo's `LocationObject`][0].
|
|
79
|
+
* [0]: https://docs.expo.dev/versions/latest/sdk/location/#locationobject
|
|
80
|
+
*/
|
|
81
|
+
export type LocationObject = {
|
|
82
|
+
coords: LocationObjectCoords;
|
|
83
|
+
mocked?: boolean | undefined;
|
|
84
|
+
timestamp: number;
|
|
85
|
+
};
|
|
86
|
+
export type Metadata = {
|
|
87
|
+
mimeType: string;
|
|
88
|
+
timestamp: number;
|
|
89
|
+
location?: LocationObject | undefined;
|
|
90
|
+
};
|
|
91
|
+
import type { BlobId } from './types.js';
|
|
92
|
+
//# sourceMappingURL=blob-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob-api.d.ts","sourceRoot":"","sources":["../src/blob-api.js"],"names":[],"mappings":"AAIA,qDAAqD;AAErD;;;;;;;;;;;;GAYG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH;IAIE;;;;OAIG;IACH,4CAHG;QAA2D,SAAS,EAA5D,OAAO,uBAAuB,EAAE,SAAS;QACV,eAAe,EAA9C,MAAM,OAAO,CAAC,MAAM,CAAC;KAC/B,EAIA;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAY3B;IAED;;;;;OAKG;IACH,kBAJW;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,YAC1D,QAAQ,GACN,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAyCvG;;CACF;;;;;;cAvGS,MAAM,GAAG,IAAI;cACb,MAAM,GAAG,IAAI;sBACb,MAAM,GAAG,IAAI;aACb,MAAM,GAAG,IAAI;cACb,MAAM;eACN,MAAM;WACN,MAAM,GAAG,IAAI;;;;;;;YAQb,oBAAoB;;eAEpB,MAAM;;;cAKN,MAAM;eACN,MAAM;;;4BA7BsB,YAAY"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export class BlobStore {
|
|
2
|
+
/**
|
|
3
|
+
* @param {object} options
|
|
4
|
+
* @param {import('../core-manager/index.js').CoreManager} options.coreManager
|
|
5
|
+
*/
|
|
6
|
+
constructor({ coreManager }: {
|
|
7
|
+
coreManager: import("../core-manager/index.js").CoreManager;
|
|
8
|
+
});
|
|
9
|
+
get writerDriveId(): string;
|
|
10
|
+
/**
|
|
11
|
+
* @param {BlobId} blobId
|
|
12
|
+
* @param {object} opts
|
|
13
|
+
* @param {false} [opts.wait=false] Set to `true` to wait for a blob to download, otherwise will throw if blob is not available locally
|
|
14
|
+
* @param {never} [opts.timeout] Optional timeout to wait for a blob to download
|
|
15
|
+
*/
|
|
16
|
+
get({ type, variant, name, driveId }: BlobId, { wait, timeout }?: {
|
|
17
|
+
wait?: false | undefined;
|
|
18
|
+
timeout?: undefined;
|
|
19
|
+
}): Promise<Buffer>;
|
|
20
|
+
/**
|
|
21
|
+
* Download blobs from all drives, optionally filtering particular blob types
|
|
22
|
+
* or blob variants. Download will be 'live' and will continue downloading new
|
|
23
|
+
* data as it becomes available from any replicating drive.
|
|
24
|
+
*
|
|
25
|
+
* If no filter is specified, all blobs will be downloaded. If a filter is
|
|
26
|
+
* specified, then _only_ blobs that match the filter will be downloaded.
|
|
27
|
+
*
|
|
28
|
+
* @param {import('../types.js').BlobFilter} [filter] Filter blob types and/or variants to download. Filter is { [BlobType]: BlobVariants[] }. At least one blob variant must be specified for each blob type.
|
|
29
|
+
* @param {object} options
|
|
30
|
+
* @param {AbortSignal} [options.signal] Optional AbortSignal to cancel in-progress download
|
|
31
|
+
* @returns EventEmitter with `.state` propery, emits `state` with new state when it updates
|
|
32
|
+
*/
|
|
33
|
+
download(filter?: import("../types.js").BlobFilter | undefined, { signal }?: {
|
|
34
|
+
signal?: AbortSignal | undefined;
|
|
35
|
+
}): LiveDownload;
|
|
36
|
+
/**
|
|
37
|
+
* @param {BlobId} blobId
|
|
38
|
+
* @param {object} [options]
|
|
39
|
+
* @param {boolean} [options.wait=false] Set to `true` to wait for a blob to download, otherwise will throw if blob is not available locally
|
|
40
|
+
* @param {number} [options.timeout] Optional timeout to wait for a blob to download
|
|
41
|
+
*/
|
|
42
|
+
createReadStream({ type, variant, name, driveId }: BlobId, options?: {
|
|
43
|
+
wait?: boolean | undefined;
|
|
44
|
+
timeout?: number | undefined;
|
|
45
|
+
} | undefined): import("streamx").Readable<any, any, any, true, false, import("streamx").ReadableEvents<any>>;
|
|
46
|
+
/**
|
|
47
|
+
* Optimization for creating the blobs read stream when you have
|
|
48
|
+
* previously read the entry from Hyperdrive using `drive.entry`
|
|
49
|
+
* @param {BlobId['driveId']} driveId Hyperdrive drive discovery id
|
|
50
|
+
* @param {import('hyperdrive').HyperdriveEntry} entry Hyperdrive entry
|
|
51
|
+
* @param {object} [options]
|
|
52
|
+
* @param {boolean} [options.wait=false] Set to `true` to wait for a blob to download, otherwise will throw if blob is not available locally
|
|
53
|
+
*/
|
|
54
|
+
createEntryReadStream(driveId: BlobId["driveId"], entry: import("hyperdrive").HyperdriveEntry, options?: {
|
|
55
|
+
wait?: boolean | undefined;
|
|
56
|
+
} | undefined): Promise<{
|
|
57
|
+
_read(cb: import("streamx").ResultCallback<any>): void;
|
|
58
|
+
pipe<TTarget extends import("streamx").AnyWritable<any, any, any> = import("streamx").AnyWritable<any, any, any>>(dest: TTarget, cb?: import("streamx").Callback): TTarget;
|
|
59
|
+
read(): any;
|
|
60
|
+
push(data: any): boolean;
|
|
61
|
+
unshift(data: any): void;
|
|
62
|
+
resume(): any;
|
|
63
|
+
pause(): any;
|
|
64
|
+
[Symbol.asyncIterator]: () => AsyncIterator<any, any, undefined>;
|
|
65
|
+
_open(cb: import("streamx").Callback): void;
|
|
66
|
+
_destroy(cb: import("streamx").Callback): void;
|
|
67
|
+
_predestroy(cb: import("streamx").Callback): void;
|
|
68
|
+
readonly readable: true;
|
|
69
|
+
readonly writable: false;
|
|
70
|
+
readonly destroyed: boolean;
|
|
71
|
+
readonly destroying: boolean;
|
|
72
|
+
destroy(error?: Error | null): void;
|
|
73
|
+
addListener<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, listener: TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void): any;
|
|
74
|
+
on<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, listener: TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void): any;
|
|
75
|
+
once<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, listener: TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void): any;
|
|
76
|
+
removeListener<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, listener: TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void): any;
|
|
77
|
+
off<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, listener: TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void): any;
|
|
78
|
+
removeAllListeners(event?: "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" | undefined): any;
|
|
79
|
+
setMaxListeners(n: number): any;
|
|
80
|
+
getMaxListeners(): number;
|
|
81
|
+
listeners<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent): (TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void)[];
|
|
82
|
+
rawListeners<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent): (TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void)[];
|
|
83
|
+
emit<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, ...rest: Parameters<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void>): boolean;
|
|
84
|
+
listenerCount(event: "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping"): number;
|
|
85
|
+
prependListener<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, listener: TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void): any;
|
|
86
|
+
prependOnceListener<TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping">(event: TEvent, listener: TEvent extends "end" | "data" | "readable" | keyof import("streamx").StreamEvents | "piping" ? import("streamx").ReadableEvents<any>[TEvent] : (...args: any[]) => void): any;
|
|
87
|
+
eventNames(): Array<string | symbol>;
|
|
88
|
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* @param {BlobId['driveId']} driveId Hyperdrive drive id
|
|
92
|
+
* @param {import('hyperdrive').HyperdriveEntry} entry Hyperdrive entry
|
|
93
|
+
* @param {object} [opts]
|
|
94
|
+
* @param {number} [opts.length]
|
|
95
|
+
*
|
|
96
|
+
* @returns {Promise<Buffer | null>}
|
|
97
|
+
*/
|
|
98
|
+
getEntryBlob(driveId: BlobId["driveId"], entry: import("hyperdrive").HyperdriveEntry, { length }?: {
|
|
99
|
+
length?: number | undefined;
|
|
100
|
+
} | undefined): Promise<Buffer | null>;
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* @param {Omit<BlobId, 'driveId'>} blobId
|
|
104
|
+
* @param {Buffer} blob
|
|
105
|
+
* @param {object} [options]
|
|
106
|
+
* @param {{mimeType: string}} [options.metadata] Metadata to store with the blob
|
|
107
|
+
* @returns {Promise<string>} discovery key as hex string of hyperdrive where blob is stored
|
|
108
|
+
*/
|
|
109
|
+
put({ type, variant, name }: Omit<BlobId, "driveId">, blob: Buffer, options?: {
|
|
110
|
+
metadata?: {
|
|
111
|
+
mimeType: string;
|
|
112
|
+
} | undefined;
|
|
113
|
+
} | undefined): Promise<string>;
|
|
114
|
+
/**
|
|
115
|
+
* @param {Omit<BlobId, 'driveId'>} blobId
|
|
116
|
+
* @param {object} [options]
|
|
117
|
+
* @param {{mimeType: string}} [options.metadata] Metadata to store with the blob
|
|
118
|
+
*/
|
|
119
|
+
createWriteStream({ type, variant, name }: Omit<BlobId, "driveId">, options?: {
|
|
120
|
+
metadata?: {
|
|
121
|
+
mimeType: string;
|
|
122
|
+
} | undefined;
|
|
123
|
+
} | undefined): import("streamx").Writable<any, any, any, false, true, import("streamx").WritableEvents<any>> & {
|
|
124
|
+
driveId: string;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* @param {BlobId} blobId
|
|
128
|
+
* @param {object} [options]
|
|
129
|
+
* @param {boolean} [options.follow=false] Set to `true` to follow symlinks (16 max or throws an error)
|
|
130
|
+
* @param {false} [options.wait=false] Set to `true` to wait for a blob to download, otherwise will throw if blob is not available locally
|
|
131
|
+
* @param {never} [options.timeout] Optional timeout to wait for a blob to download
|
|
132
|
+
* @returns {Promise<import('hyperdrive').HyperdriveEntry | null>}
|
|
133
|
+
*/
|
|
134
|
+
entry({ type, variant, name, driveId }: BlobId, options?: {
|
|
135
|
+
follow?: boolean | undefined;
|
|
136
|
+
wait?: false | undefined;
|
|
137
|
+
timeout?: undefined;
|
|
138
|
+
} | undefined): Promise<import("hyperdrive").HyperdriveEntry | null>;
|
|
139
|
+
/**
|
|
140
|
+
* @param {BlobId} blobId
|
|
141
|
+
* @param {object} [options]
|
|
142
|
+
* @param {boolean} [options.diff=false] Enable to return an object with a `block` property with number of bytes removed
|
|
143
|
+
* @return {Promise<{ blocks: number } | null>}
|
|
144
|
+
*/
|
|
145
|
+
clear({ type, variant, name, driveId }: BlobId, options?: {
|
|
146
|
+
diff?: boolean | undefined;
|
|
147
|
+
} | undefined): Promise<{
|
|
148
|
+
blocks: number;
|
|
149
|
+
} | null>;
|
|
150
|
+
#private;
|
|
151
|
+
}
|
|
152
|
+
export type InternalDriveEmitter = TypedEmitter<{
|
|
153
|
+
"add-drive": (drive: import("hyperdrive")) => void;
|
|
154
|
+
}>;
|
|
155
|
+
export namespace SUPPORTED_BLOB_VARIANTS {
|
|
156
|
+
let photo: readonly ["original", "preview", "thumbnail"];
|
|
157
|
+
let audio: readonly ["original"];
|
|
158
|
+
let video: readonly ["original"];
|
|
159
|
+
}
|
|
160
|
+
import type { BlobId } from '../types.js';
|
|
161
|
+
import { LiveDownload } from './live-download.js';
|
|
162
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
163
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blob-store/index.js"],"names":[],"mappings":"AA8BA;IAUE;;;OAGG;IACH,6BAFG;QAAgE,WAAW,EAAnE,OAAO,0BAA0B,EAAE,WAAW;KACxD,EA+BA;IAED,4BAEC;IAWD;;;;;OAKG;IACH,sCALW,MAAM,sBAEd;QAAqB,IAAI;QACJ,OAAO;KAC9B,mBAOA;IAED;;;;;;;;;;;;OAYG;IACH,6EAHG;QAA8B,MAAM;KACpC,gBAOF;IAED;;;;;OAKG;IACH,mDALW,MAAM;;;kHAehB;IAED;;;;;;;OAOG;IACH,+BALW,MAAM,CAAC,SAAS,CAAC,SACjB,OAAO,YAAY,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAe9C;IAED;;;;;;;OAOG;IACH,sBAPW,MAAM,CAAC,SAAS,CAAC,SACjB,OAAO,YAAY,EAAE,eAAe;;oBAIlC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAalC;IAED;;;;;;;OAOG;IACH,6BANW,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,QACvB,MAAM;;sBAEK,MAAM;;oBACf,OAAO,CAAC,MAAM,CAAC,CAM3B;IAED;;;;OAIG;IACH,2CAJW,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC;;sBAEZ,MAAM;;;;MAQ3B;IAED;;;;;;;OAOG;IACH,wCAPW,MAAM;;;;oBAKJ,OAAO,CAAC,OAAO,YAAY,EAAE,eAAe,GAAG,IAAI,CAAC,CAWhE;IAED;;;;;OAKG;IACH,wCALW,MAAM;;oBAGL,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAO7C;;CACF;mCAzOa,YAAY,CAAC;IAAE,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,YAAY,CAAC,KAAK,IAAI,CAAA;CAAE,CAAC;;;;;;4BAFtD,aAAa;6BADZ,oBAAoB;6BADpB,oBAAoB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reduce multiple states into one. Factored out for unit testing because I
|
|
3
|
+
* don't trust my coding. Probably a smarter way to do this, but this works.
|
|
4
|
+
*
|
|
5
|
+
* @param {Iterable<{ state: BlobDownloadState | BlobDownloadStateError }>} liveDownloads
|
|
6
|
+
* @param {{ signal?: AbortSignal }} options
|
|
7
|
+
* @returns {BlobDownloadState | BlobDownloadStateError}
|
|
8
|
+
*/
|
|
9
|
+
export function combineStates(liveDownloads: Iterable<{
|
|
10
|
+
state: BlobDownloadState | BlobDownloadStateError;
|
|
11
|
+
}>, { signal }?: {
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
}): BlobDownloadState | BlobDownloadStateError;
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {object} BlobDownloadState
|
|
16
|
+
* @property {number} haveCount The number of files already downloaded
|
|
17
|
+
* @property {number} haveBytes The bytes already downloaded
|
|
18
|
+
* @property {number} wantCount The number of files pending download
|
|
19
|
+
* @property {number} wantBytes The bytes pending download
|
|
20
|
+
* @property {null} error If status = 'error' then this will be an Error object
|
|
21
|
+
* @property {'checking' | 'downloading' | 'downloaded' | 'aborted'} status
|
|
22
|
+
*/
|
|
23
|
+
/** @typedef {Omit<BlobDownloadState, 'error' | 'status'> & { status: 'error', error: Error }} BlobDownloadStateError */
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {object} BlobDownloadEvents
|
|
26
|
+
* @property {(state: BlobDownloadState | BlobDownloadStateError ) => void} state Emitted with the current download state whenever it changes (not emitted during initial 'checking' status)
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* LiveDownload class
|
|
30
|
+
* @extends {TypedEmitter<BlobDownloadEvents>}
|
|
31
|
+
*/
|
|
32
|
+
export class LiveDownload extends TypedEmitter<BlobDownloadEvents> {
|
|
33
|
+
/**
|
|
34
|
+
* Like drive.download() but 'live', and for multiple drives
|
|
35
|
+
* @param {Iterable<import('hyperdrive')>} drives
|
|
36
|
+
* @param {import('./index.js').InternalDriveEmitter} emitter
|
|
37
|
+
* @param {object} options
|
|
38
|
+
* @param {import('../types.js').BlobFilter} [options.filter] Filter blobs of specific types and/or sizes to download
|
|
39
|
+
* @param {AbortSignal} [options.signal]
|
|
40
|
+
*/
|
|
41
|
+
constructor(drives: Iterable<import("hyperdrive")>, emitter: import("./index.js").InternalDriveEmitter, { filter, signal }: {
|
|
42
|
+
filter?: import("../types.js").BlobFilter | undefined;
|
|
43
|
+
signal?: AbortSignal | undefined;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* @returns {BlobDownloadState | BlobDownloadStateError}
|
|
47
|
+
*/
|
|
48
|
+
get state(): BlobDownloadState | BlobDownloadStateError;
|
|
49
|
+
#private;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* LiveDownload class
|
|
53
|
+
* @extends {TypedEmitter<BlobDownloadEvents>}
|
|
54
|
+
*/
|
|
55
|
+
export class DriveLiveDownload extends TypedEmitter<BlobDownloadEvents> {
|
|
56
|
+
/**
|
|
57
|
+
* Like drive.download() but 'live',
|
|
58
|
+
* @param {import('hyperdrive')} drive
|
|
59
|
+
* @param {object} options
|
|
60
|
+
* @param {import('../types.js').BlobFilter} [options.filter] Filter blobs of specific types and/or sizes to download
|
|
61
|
+
* @param {AbortSignal} [options.signal]
|
|
62
|
+
*/
|
|
63
|
+
constructor(drive: import("hyperdrive"), { filter, signal }?: {
|
|
64
|
+
filter?: import("../types.js").BlobFilter | undefined;
|
|
65
|
+
signal?: AbortSignal | undefined;
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* @returns {BlobDownloadState | BlobDownloadStateError}
|
|
69
|
+
*/
|
|
70
|
+
get state(): BlobDownloadState | BlobDownloadStateError;
|
|
71
|
+
#private;
|
|
72
|
+
}
|
|
73
|
+
export type BlobDownloadState = {
|
|
74
|
+
/**
|
|
75
|
+
* The number of files already downloaded
|
|
76
|
+
*/
|
|
77
|
+
haveCount: number;
|
|
78
|
+
/**
|
|
79
|
+
* The bytes already downloaded
|
|
80
|
+
*/
|
|
81
|
+
haveBytes: number;
|
|
82
|
+
/**
|
|
83
|
+
* The number of files pending download
|
|
84
|
+
*/
|
|
85
|
+
wantCount: number;
|
|
86
|
+
/**
|
|
87
|
+
* The bytes pending download
|
|
88
|
+
*/
|
|
89
|
+
wantBytes: number;
|
|
90
|
+
/**
|
|
91
|
+
* If status = 'error' then this will be an Error object
|
|
92
|
+
*/
|
|
93
|
+
error: null;
|
|
94
|
+
status: "checking" | "downloading" | "downloaded" | "aborted";
|
|
95
|
+
};
|
|
96
|
+
export type BlobDownloadStateError = Omit<BlobDownloadState, "error" | "status"> & {
|
|
97
|
+
status: "error";
|
|
98
|
+
error: Error;
|
|
99
|
+
};
|
|
100
|
+
export type BlobDownloadEvents = {
|
|
101
|
+
/**
|
|
102
|
+
* Emitted with the current download state whenever it changes (not emitted during initial 'checking' status)
|
|
103
|
+
*/
|
|
104
|
+
state: (state: BlobDownloadState | BlobDownloadStateError) => void;
|
|
105
|
+
};
|
|
106
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
107
|
+
//# sourceMappingURL=live-download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-download.d.ts","sourceRoot":"","sources":["../../src/blob-store/live-download.js"],"names":[],"mappings":"AA+RA;;;;;;;GAOG;AACH,6CAJW,QAAQ,CAAC;IAAE,KAAK,EAAE,iBAAiB,GAAG,sBAAsB,CAAA;CAAE,CAAC,eAC/D;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,GACtB,iBAAiB,GAAG,sBAAsB,CAqCtD;AApUD;;;;;;;;GAQG;AAEH,wHAAwH;AAExH;;;GAGG;AAEH;;;GAGG;AACH;IAKE;;;;;;;OAOG;IACH,oBANW,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC,WAC9B,OAAO,YAAY,EAAE,oBAAoB,sBAEjD;QAAmD,MAAM;QAC3B,MAAM;KAAC,EAiCvC;IAED;;OAEG;IACH,wDAEC;;CACF;AAED;;;GAGG;AACH;IAaE;;;;;;OAMG;IACH,mBALW,OAAO,YAAY,CAAC,uBAE5B;QAAmD,MAAM;QAC3B,MAAM;KAAC,EAmBvC;IAED;;OAEG;IACH,wDAyBC;;CAqIF;;;;;eArRa,MAAM;;;;eACN,MAAM;;;;eACN,MAAM;;;;eACN,MAAM;;;;WACN,IAAI;YACJ,UAAU,GAAG,aAAa,GAAG,YAAY,GAAG,SAAS;;qCAGrD,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE;;;;;WAI/E,CAAC,KAAK,EAAE,iBAAiB,GAAG,sBAAsB,KAAM,IAAI;;6BApB7C,oBAAoB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {yauzl.Entry} Entry
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {{
|
|
6
|
+
* presets: { [id: string]: unknown }
|
|
7
|
+
* fields: { [id: string]: unknown }
|
|
8
|
+
* }} PresetsFile
|
|
9
|
+
*/
|
|
10
|
+
/** @typedef {('presets' | 'fields')} ValidDocTypes */
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {{
|
|
13
|
+
* [lang: string]: unknown
|
|
14
|
+
* }} TranslationsFile
|
|
15
|
+
*/
|
|
16
|
+
/** @typedef {NonNullable<import('@comapeo/schema').ProjectSettingsValue['configMetadata']>} MetadataFile */
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {Parameters<import('./icon-api.js').IconApi['create']>[0]} IconData
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} configPath
|
|
22
|
+
*/
|
|
23
|
+
export function readConfig(configPath: string): Promise<{
|
|
24
|
+
readonly warnings: Error[];
|
|
25
|
+
readonly metadata: {
|
|
26
|
+
importDate: string;
|
|
27
|
+
name: string;
|
|
28
|
+
buildDate: string;
|
|
29
|
+
fileVersion: string;
|
|
30
|
+
};
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* @returns {AsyncIterable<IconData>}
|
|
34
|
+
*/
|
|
35
|
+
icons(): AsyncIterable<IconData>;
|
|
36
|
+
/**
|
|
37
|
+
* @returns {Iterable<{ name: string, value: import('@comapeo/schema').FieldValue }>}
|
|
38
|
+
*/
|
|
39
|
+
fields(): Iterable<{
|
|
40
|
+
name: string;
|
|
41
|
+
value: import("@comapeo/schema").FieldValue;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* @returns {Iterable<{ fieldNames: string[], iconName: string | undefined, value: import('@comapeo/schema').PresetValue, name: string}>}
|
|
45
|
+
*/
|
|
46
|
+
presets(): Iterable<{
|
|
47
|
+
fieldNames: string[];
|
|
48
|
+
iconName: string | undefined;
|
|
49
|
+
value: import("@comapeo/schema").PresetValue;
|
|
50
|
+
name: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** @returns {Iterable<{ name: string, value:Omit<import('@comapeo/schema').TranslationValue, 'docRef'>}>} */
|
|
53
|
+
translations(): Iterable<{
|
|
54
|
+
name: string;
|
|
55
|
+
value: Omit<import("@comapeo/schema").TranslationValue, "docRef">;
|
|
56
|
+
}>;
|
|
57
|
+
}>;
|
|
58
|
+
export type Entry = yauzl.Entry;
|
|
59
|
+
export type PresetsFile = {
|
|
60
|
+
presets: {
|
|
61
|
+
[id: string]: unknown;
|
|
62
|
+
};
|
|
63
|
+
fields: {
|
|
64
|
+
[id: string]: unknown;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type ValidDocTypes = ("presets" | "fields");
|
|
68
|
+
export type TranslationsFile = {
|
|
69
|
+
[lang: string]: unknown;
|
|
70
|
+
};
|
|
71
|
+
export type MetadataFile = NonNullable<import("@comapeo/schema").ProjectSettingsValue["configMetadata"]>;
|
|
72
|
+
export type IconData = Parameters<import("./icon-api.js").IconApi["create"]>[0];
|
|
73
|
+
import yauzl from 'yauzl-promise';
|
|
74
|
+
//# sourceMappingURL=config-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-import.d.ts","sourceRoot":"","sources":["../src/config-import.js"],"names":[],"mappings":"AAaA;;GAEG;AACH;;;;;GAKG;AAEH,sDAAsD;AACtD;;;;GAIG;AAEH,4GAA4G;AAE5G;;GAEG;AAEH;;GAEG;AACH,uCAFW,MAAM;;;;;;;;;IAmCb;;OAEG;aADU,aAAa,CAAC,QAAQ,CAAC;IAiDpC;;OAEG;cADU,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,iBAAiB,EAAE,UAAU,CAAA;KAAE,CAAC;IA6BpF;;OAEG;eADU,QAAQ,CAAC;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,iBAAiB,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC;IAiFxI,6GAA6G;oBAA/F,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAC,IAAI,CAAC,OAAO,iBAAiB,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAA;KAAC,CAAC;GAkB5G;oBA9OY,KAAK,CAAC,KAAK;0BAGX;IACZ,OAAW,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;IACtC,MAAU,EAAG;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CACnC;4BAGU,CAAC,SAAS,GAAG,QAAQ,CAAC;+BAEvB;IACZ,CAAI,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;2BAGU,WAAW,CAAC,OAAO,iBAAiB,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;uBAG9E,UAAU,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;kBAjCnD,eAAe"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @import { Namespace } from './types.js' */
|
|
2
|
+
export const NAMESPACES: readonly ["auth", "config", "data", "blobIndex", "blob"];
|
|
3
|
+
/** @type {ReadonlyArray<Namespace>} */
|
|
4
|
+
export const PRESYNC_NAMESPACES: ReadonlyArray<Namespace>;
|
|
5
|
+
/** @type {ReadonlyArray<Namespace>} */
|
|
6
|
+
export const DATA_NAMESPACES: ReadonlyArray<Namespace>;
|
|
7
|
+
export namespace NAMESPACE_SCHEMAS {
|
|
8
|
+
let data: readonly ["observation", "track"];
|
|
9
|
+
let config: readonly ["translation", "preset", "field", "projectSettings", "deviceInfo", "icon"];
|
|
10
|
+
let auth: readonly ["coreOwnership", "role"];
|
|
11
|
+
}
|
|
12
|
+
export const SUPPORTED_CONFIG_VERSION: 1;
|
|
13
|
+
import type { Namespace } from './types.js';
|
|
14
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.js"],"names":[],"mappings":"AAAA,8CAA8C;AAI9C,kFAME;AAEF,uCAAuC;AACvC,iCADW,aAAa,CAAC,SAAS,CAAC,CAC8B;AAEjE,uCAAuC;AACvC,8BADW,aAAa,CAAC,SAAS,CAAC,CAGlC;;;;;;AAeD,yCAAyC;+BAjCV,YAAY"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Uint32Array} bitfield
|
|
3
|
+
* @param {Buffer} [buffer]
|
|
4
|
+
* @param {number} [offset]
|
|
5
|
+
*/
|
|
6
|
+
export function encode(bitfield: Uint32Array, buffer?: Buffer | undefined, offset?: number | undefined): Buffer;
|
|
7
|
+
export namespace encode {
|
|
8
|
+
let bytes: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @param {Buffer} buffer
|
|
12
|
+
* @param {number} [offset]
|
|
13
|
+
* @returns {Uint32Array}
|
|
14
|
+
*/
|
|
15
|
+
export function decode(buffer: Buffer, offset?: number | undefined): Uint32Array;
|
|
16
|
+
export namespace decode {
|
|
17
|
+
let bytes_1: number;
|
|
18
|
+
export { bytes_1 as bytes };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @param {Buffer} buffer
|
|
22
|
+
* @param {number} offset
|
|
23
|
+
*/
|
|
24
|
+
export function decodingLength(buffer: Buffer, offset: number): number;
|
|
25
|
+
//# sourceMappingURL=bitfield-rle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitfield-rle.d.ts","sourceRoot":"","sources":["../../src/core-manager/bitfield-rle.js"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,iCAJW,WAAW,oEAqBrB;;;;AAYD;;;;GAIG;AACH,+BAJW,MAAM,gCAEJ,WAAW,CAmCvB;;;;;AAED;;;GAGG;AACH,uCAHW,MAAM,UACN,MAAM,UAuBhB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** @import { Namespace } from '../types.js' */
|
|
2
|
+
/** @import { CoreRecord } from './index.js' */
|
|
3
|
+
/**
|
|
4
|
+
* An in-memory index of open cores.
|
|
5
|
+
*/
|
|
6
|
+
export class CoreIndex {
|
|
7
|
+
/**
|
|
8
|
+
* NB. Need to pass key here because `core.key` is not populated until the
|
|
9
|
+
* core is ready, but we know it beforehand.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} options
|
|
12
|
+
* @param {import('hypercore')<"binary", Buffer>} options.core Hypercore instance
|
|
13
|
+
* @param {Buffer} options.key Buffer containing public key of this core
|
|
14
|
+
* @param {Namespace} options.namespace
|
|
15
|
+
* @param {boolean} [options.writer] Is this a writer core?
|
|
16
|
+
*/
|
|
17
|
+
add({ core, key, namespace, writer }: {
|
|
18
|
+
core: import("hypercore")<"binary", Buffer>;
|
|
19
|
+
key: Buffer;
|
|
20
|
+
namespace: Namespace;
|
|
21
|
+
writer?: boolean | undefined;
|
|
22
|
+
}): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get all known cores in a namespace
|
|
25
|
+
*
|
|
26
|
+
* @param {Namespace} namespace
|
|
27
|
+
* @returns {CoreRecord[]}
|
|
28
|
+
*/
|
|
29
|
+
getByNamespace(namespace: Namespace): CoreRecord[];
|
|
30
|
+
/**
|
|
31
|
+
* Get the write core for the given namespace
|
|
32
|
+
*
|
|
33
|
+
* @param {Namespace} namespace
|
|
34
|
+
* @returns {CoreRecord}
|
|
35
|
+
*/
|
|
36
|
+
getWriter(namespace: Namespace): CoreRecord;
|
|
37
|
+
/**
|
|
38
|
+
* Get a core by its discoveryId (discover key as hex string)
|
|
39
|
+
*
|
|
40
|
+
* @param {string} discoveryId
|
|
41
|
+
* @returns {CoreRecord | undefined}
|
|
42
|
+
*/
|
|
43
|
+
getByDiscoveryId(discoveryId: string): CoreRecord | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Get a core by its public key
|
|
46
|
+
*
|
|
47
|
+
* @param {Buffer} coreKey
|
|
48
|
+
* @returns {CoreRecord | undefined}
|
|
49
|
+
*/
|
|
50
|
+
getByCoreKey(coreKey: Buffer): CoreRecord | undefined;
|
|
51
|
+
[Symbol.iterator](): IterableIterator<CoreRecord>;
|
|
52
|
+
#private;
|
|
53
|
+
}
|
|
54
|
+
import type { Namespace } from '../types.js';
|
|
55
|
+
import type { CoreRecord } from './index.js';
|
|
56
|
+
//# sourceMappingURL=core-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-index.d.ts","sourceRoot":"","sources":["../../src/core-manager/core-index.js"],"names":[],"mappings":"AACA,+CAA+C;AAC/C,+CAA+C;AAE/C;;GAEG;AACH;IAUE;;;;;;;;;OASG;IACH,sCALG;QAAuD,IAAI,EAAnD,OAAO,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;QACrB,GAAG,EAAnB,MAAM;QACa,SAAS,EAA5B,SAAS;QACS,MAAM;KAClC,QASA;IAED;;;;;OAKG;IACH,0BAHW,SAAS,GACP,UAAU,EAAE,CAQxB;IAED;;;;;OAKG;IACH,qBAHW,SAAS,GACP,UAAU,CAStB;IAED;;;;;OAKG;IACH,8BAHW,MAAM,GACJ,UAAU,GAAG,SAAS,CAIlC;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,UAAU,GAAG,SAAS,CAKlC;IAxED,kDAEC;;CAuEF;+BArF8B,aAAa;gCACZ,YAAY"}
|