@comapeo/core 4.1.3-prerelease.0 → 4.1.4
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/package.json +1 -1
- package/src/invite/invite-state-machine.js +1 -1
- package/src/mapeo-manager.js +2 -2
- package/dist/blob-store/live-download.d.ts +0 -107
- package/dist/blob-store/live-download.d.ts.map +0 -1
- package/dist/capabilities.d.ts +0 -121
- package/dist/capabilities.d.ts.map +0 -1
- package/dist/core-manager/compat.d.ts +0 -4
- package/dist/core-manager/compat.d.ts.map +0 -1
- package/dist/discovery/dns-sd.d.ts +0 -54
- package/dist/discovery/dns-sd.d.ts.map +0 -1
- package/dist/fastify-plugins/maps/index.d.ts +0 -11
- package/dist/fastify-plugins/maps/index.d.ts.map +0 -1
- package/dist/fastify-plugins/maps/offline-fallback-map.d.ts +0 -12
- package/dist/fastify-plugins/maps/offline-fallback-map.d.ts.map +0 -1
- package/dist/fastify-plugins/maps/static-maps.d.ts +0 -11
- package/dist/fastify-plugins/maps/static-maps.d.ts.map +0 -1
- package/dist/invite-api.d.ts +0 -70
- package/dist/invite-api.d.ts.map +0 -1
- package/dist/lib/timing-safe-equal.d.ts +0 -15
- package/dist/lib/timing-safe-equal.d.ts.map +0 -1
- package/dist/media-server.d.ts +0 -36
- package/dist/media-server.d.ts.map +0 -1
- package/dist/server/ws-core-replicator.d.ts +0 -6
- package/dist/server/ws-core-replicator.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import ensureError from 'ensure-error'
|
|
|
5
5
|
import { TimeoutError } from '../errors.js'
|
|
6
6
|
|
|
7
7
|
const RECEIVE_PROJECT_DETAILS_TIMEOUT_MS = 45_000
|
|
8
|
-
const ADD_PROJECT_TIMEOUT_MS =
|
|
8
|
+
const ADD_PROJECT_TIMEOUT_MS = 300_000
|
|
9
9
|
|
|
10
10
|
/** @import { StringToTaggedUnion } from '../types.js' */
|
|
11
11
|
/** @import { ProjectJoinDetails } from '../generated/rpc.js' */
|
package/src/mapeo-manager.js
CHANGED
|
@@ -708,14 +708,14 @@ export class MapeoManager extends TypedEmitter {
|
|
|
708
708
|
*
|
|
709
709
|
* @param {MapeoProject} project
|
|
710
710
|
* @param {object} [opts]
|
|
711
|
-
* @param {number} [opts.timeoutMs=
|
|
711
|
+
* @param {number} [opts.timeoutMs=45_000] Timeout in milliseconds for max time
|
|
712
712
|
* to wait between sync status updates before giving up. As long as syncing is
|
|
713
713
|
* happening, this will never timeout, but if more than timeoutMs passes
|
|
714
714
|
* without any sync activity, then this will resolve `false` e.g. data has not
|
|
715
715
|
* synced
|
|
716
716
|
* @returns {Promise<boolean>}
|
|
717
717
|
*/
|
|
718
|
-
async #waitForInitialSync(project, { timeoutMs =
|
|
718
|
+
async #waitForInitialSync(project, { timeoutMs = 45_000 } = {}) {
|
|
719
719
|
const [ownRole, isProjectSettingsSynced] = await Promise.all([
|
|
720
720
|
project.$getOwnRole(),
|
|
721
721
|
project.$hasSyncedProjectSettings(),
|
|
@@ -1,107 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/capabilities.d.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
export const COORDINATOR_ROLE_ID: "f7c150f5a3a9a855";
|
|
2
|
-
export const MEMBER_ROLE_ID: "012fd2d431c0bf60";
|
|
3
|
-
export const BLOCKED_ROLE_ID: "9e6d29263cba36c9";
|
|
4
|
-
export const LEFT_ROLE_ID: "8ced989b1904606b";
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {object} DocCapability
|
|
7
|
-
* @property {boolean} readOwn - can read own data
|
|
8
|
-
* @property {boolean} writeOwn - can write own data
|
|
9
|
-
* @property {boolean} readOthers - can read other's data
|
|
10
|
-
* @property {boolean} writeOthers - can edit or delete other's data
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {object} Capability
|
|
14
|
-
* @property {string} name
|
|
15
|
-
* @property {Record<import('@mapeo/schema').MapeoDoc['schemaName'], DocCapability>} docs
|
|
16
|
-
* @property {RoleId[]} roleAssignment
|
|
17
|
-
* @property {Record<import('./core-manager/core-index.js').Namespace, 'allowed' | 'blocked'>} sync
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {typeof COORDINATOR_ROLE_ID | typeof MEMBER_ROLE_ID | typeof BLOCKED_ROLE_ID | typeof LEFT_ROLE_ID} RoleId
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* This is currently the same as 'Coordinator' capabilities, but defined
|
|
24
|
-
* separately because the creator should always have ALL capabilities, but we
|
|
25
|
-
* could edit 'Coordinator' capabilities in the future
|
|
26
|
-
*
|
|
27
|
-
* @type {Capability}
|
|
28
|
-
*/
|
|
29
|
-
export const CREATOR_CAPABILITIES: Capability;
|
|
30
|
-
/**
|
|
31
|
-
* These are the capabilities assumed for a device when no capability record can
|
|
32
|
-
* be found. This can happen when an invited device did not manage to sync with
|
|
33
|
-
* the device that invited them, and they then try to sync with someone else. We
|
|
34
|
-
* want them to be able to sync the auth and config store, because that way they
|
|
35
|
-
* may be able to receive their role record, and they can get the project config
|
|
36
|
-
* so that they can start collecting data.
|
|
37
|
-
*
|
|
38
|
-
* @type {Capability}
|
|
39
|
-
*/
|
|
40
|
-
export const NO_ROLE_CAPABILITIES: Capability;
|
|
41
|
-
/** @type {Record<RoleId, Capability>} */
|
|
42
|
-
export const DEFAULT_CAPABILITIES: Record<RoleId, Capability>;
|
|
43
|
-
export class Capabilities {
|
|
44
|
-
static NO_ROLE_CAPABILITIES: Capability;
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {object} opts
|
|
48
|
-
* @param {import('./datatype/index.js').DataType<
|
|
49
|
-
* import('./datastore/index.js').DataStore<'auth'>,
|
|
50
|
-
* typeof import('./schema/project.js').roleTable,
|
|
51
|
-
* 'role',
|
|
52
|
-
* import('@mapeo/schema').Role,
|
|
53
|
-
* import('@mapeo/schema').RoleValue
|
|
54
|
-
* >} opts.dataType
|
|
55
|
-
* @param {import('./core-ownership.js').CoreOwnership} opts.coreOwnership
|
|
56
|
-
* @param {import('./core-manager/index.js').CoreManager} opts.coreManager
|
|
57
|
-
* @param {Buffer} opts.projectKey
|
|
58
|
-
* @param {Buffer} opts.deviceKey public key of this device
|
|
59
|
-
*/
|
|
60
|
-
constructor({ dataType, coreOwnership, coreManager, projectKey, deviceKey }: {
|
|
61
|
-
dataType: import('./datatype/index.js').DataType<import('./datastore/index.js').DataStore<'auth'>, typeof import('./schema/project.js').roleTable, 'role', import('@mapeo/schema').Role, import('@mapeo/schema').RoleValue>;
|
|
62
|
-
coreOwnership: import('./core-ownership.js').CoreOwnership;
|
|
63
|
-
coreManager: import('./core-manager/index.js').CoreManager;
|
|
64
|
-
projectKey: Buffer;
|
|
65
|
-
deviceKey: Buffer;
|
|
66
|
-
});
|
|
67
|
-
/**
|
|
68
|
-
* Get the capabilities for device `deviceId`.
|
|
69
|
-
*
|
|
70
|
-
* @param {string} deviceId
|
|
71
|
-
* @returns {Promise<Capability>}
|
|
72
|
-
*/
|
|
73
|
-
getCapabilities(deviceId: string): Promise<Capability>;
|
|
74
|
-
/**
|
|
75
|
-
* Get capabilities of all devices in the project. For your own device, if you
|
|
76
|
-
* have not yet synced your own role record, the "no role" capabilties is
|
|
77
|
-
* returned. The project creator will have `CREATOR_CAPABILITIES` unless a
|
|
78
|
-
* different role has been assigned.
|
|
79
|
-
*
|
|
80
|
-
* @returns {Promise<Record<string, Capability>>} Map of deviceId to Capability
|
|
81
|
-
*/
|
|
82
|
-
getAll(): Promise<Record<string, Capability>>;
|
|
83
|
-
/**
|
|
84
|
-
* Assign a role to the specified `deviceId`. Devices without an assigned role
|
|
85
|
-
* are unable to sync, except the project creator that defaults to having all
|
|
86
|
-
* capabilities. Only the project creator can assign their own role. Will
|
|
87
|
-
* throw if the device trying to assign the role lacks the `roleAssignment`
|
|
88
|
-
* capability for the given roleId
|
|
89
|
-
*
|
|
90
|
-
* @param {string} deviceId
|
|
91
|
-
* @param {keyof typeof DEFAULT_CAPABILITIES} roleId
|
|
92
|
-
*/
|
|
93
|
-
assignRole(deviceId: string, roleId: keyof typeof DEFAULT_CAPABILITIES): Promise<void>;
|
|
94
|
-
#private;
|
|
95
|
-
}
|
|
96
|
-
export type DocCapability = {
|
|
97
|
-
/**
|
|
98
|
-
* - can read own data
|
|
99
|
-
*/
|
|
100
|
-
readOwn: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* - can write own data
|
|
103
|
-
*/
|
|
104
|
-
writeOwn: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* - can read other's data
|
|
107
|
-
*/
|
|
108
|
-
readOthers: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* - can edit or delete other's data
|
|
111
|
-
*/
|
|
112
|
-
writeOthers: boolean;
|
|
113
|
-
};
|
|
114
|
-
export type Capability = {
|
|
115
|
-
name: string;
|
|
116
|
-
docs: Record<import('@mapeo/schema').MapeoDoc['schemaName'], DocCapability>;
|
|
117
|
-
roleAssignment: RoleId[];
|
|
118
|
-
sync: Record<import('./core-manager/core-index.js').Namespace, 'allowed' | 'blocked'>;
|
|
119
|
-
};
|
|
120
|
-
export type RoleId = typeof COORDINATOR_ROLE_ID | typeof MEMBER_ROLE_ID | typeof BLOCKED_ROLE_ID | typeof LEFT_ROLE_ID;
|
|
121
|
-
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.js"],"names":[],"mappings":"AAKA,qDAAqD;AACrD,gDAAgD;AAChD,iDAAiD;AACjD,8CAA8C;AAE9C;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;GAEG;AAEH;;;;;;GAMG;AACH,mCAFU,UAAU,CAkBnB;AAED;;;;;;;;;GASG;AACH,mCAFU,UAAU,CAkBnB;AAED,yCAAyC;AACzC,mCADW,OAAO,MAAM,EAAE,UAAU,CAAC,CAgFpC;AAED;IAOE,wCAAkD;IAElD;;;;;;;;;;;;;;OAcG;IACH;QANW,QAAQ,EANR,OAAO,qBAAqB,EAAE,QAAQ,CAChD,OAAW,sBAAsB,EAAE,SAAS,CAAC,MAAM,CAAC,EACpD,cAAkB,qBAAqB,EAAE,SAAS,EAClD,MAAU,EACV,OAAW,eAAe,EAAE,IAAI,EAChC,OAAW,eAAe,EAAE,SAAS,CAClC;QACyD,aAAa,EAA/D,OAAO,qBAAqB,EAAE,aAAa;QACS,WAAW,EAA/D,OAAO,yBAAyB,EAAE,WAAW;QAChC,UAAU,EAAvB,MAAM;QACO,SAAS,EAAtB,MAAM;OAQhB;IAED;;;;;OAKG;IACH,0BAHW,MAAM,GACJ,QAAQ,UAAU,CAAC,CAuB/B;IAED;;;;;;;OAOG;IACH,UAFa,QAAQ,OAAO,MAAM,EAAE,UAAU,CAAC,CAAC,CAkC/C;IAED;;;;;;;;;OASG;IACH,qBAHW,MAAM,UACN,MAAM,2BAA2B,iBAyD3C;;CAQF;;;;;aAzUa,OAAO;;;;cACP,OAAO;;;;gBACP,OAAO;;;;iBACP,OAAO;;;UAKP,MAAM;UACN,OAAO,OAAO,eAAe,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;oBACrE,MAAM,EAAE;UACR,OAAO,OAAO,8BAA8B,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;;qBAIhF,0BAA0B,GAAG,qBAAqB,GAAG,sBAAsB,GAAG,mBAAmB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../src/core-manager/compat.js"],"names":[],"mappings":";AAOA,sCAAwB"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {object} MapeoService
|
|
3
|
-
* @property {string} address IPv4 address of service
|
|
4
|
-
* @property {number} port
|
|
5
|
-
* @property {string} name Instance name
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {object} DnsSdEvents
|
|
9
|
-
* @property {(service: MapeoService) => void} up
|
|
10
|
-
* @property {(service: MapeoService) => void} down
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @extends {TypedEmitter<DnsSdEvents>}
|
|
14
|
-
*/
|
|
15
|
-
export class DnsSd extends TypedEmitter<DnsSdEvents> {
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {object} [opts]
|
|
19
|
-
* @param {string} [opts.name]
|
|
20
|
-
* @param {boolean} [opts.disableIpv6]
|
|
21
|
-
* @param {Logger} [opts.logger]
|
|
22
|
-
*/
|
|
23
|
-
constructor({ name, disableIpv6, logger }?: {
|
|
24
|
-
name?: string | undefined;
|
|
25
|
-
disableIpv6?: boolean | undefined;
|
|
26
|
-
logger?: Logger | undefined;
|
|
27
|
-
} | undefined);
|
|
28
|
-
get name(): string;
|
|
29
|
-
/** @param {number} port */
|
|
30
|
-
advertise(port: number): Promise<void>;
|
|
31
|
-
browse(): void;
|
|
32
|
-
stopAdvertising(): Promise<void>;
|
|
33
|
-
stopBrowsing(): void;
|
|
34
|
-
destroy(): Promise<void>;
|
|
35
|
-
#private;
|
|
36
|
-
}
|
|
37
|
-
export type MapeoService = {
|
|
38
|
-
/**
|
|
39
|
-
* IPv4 address of service
|
|
40
|
-
*/
|
|
41
|
-
address: string;
|
|
42
|
-
port: number;
|
|
43
|
-
/**
|
|
44
|
-
* Instance name
|
|
45
|
-
*/
|
|
46
|
-
name: string;
|
|
47
|
-
};
|
|
48
|
-
export type DnsSdEvents = {
|
|
49
|
-
up: (service: MapeoService) => void;
|
|
50
|
-
down: (service: MapeoService) => void;
|
|
51
|
-
};
|
|
52
|
-
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
53
|
-
import { Logger } from '../logger.js';
|
|
54
|
-
//# sourceMappingURL=dns-sd.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dns-sd.d.ts","sourceRoot":"","sources":["../../src/discovery/dns-sd.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AAEH;;;;GAIG;AAEH;;GAEG;AACH;IAoDE;;;;;;OAMG;IACH;;;;mBAMC;IAED,mBAEC;IAED,2BAA2B;IAC3B,gBADY,MAAM,iBA+BjB;IAED,eAiBC;IAED,iCAeC;IAED,qBAKC;IAED,yBA0BC;;CA+BF;;;;;aA1Na,MAAM;UACN,MAAM;;;;UACN,MAAM;;;kBAKI,YAAY,KAAK,IAAI;oBACrB,YAAY,KAAK,IAAI;;6BApBhB,oBAAoB;uBAM1B,cAAc"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const PLUGIN_NAME: "mapeo-maps";
|
|
2
|
-
export const DEFAULT_MAPBOX_STYLE_URL: "https://api.mapbox.com/styles/v1/mapbox/outdoors-v12";
|
|
3
|
-
export function plugin(instance: import("fastify").FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>, opts: MapsPluginOpts): Promise<void>;
|
|
4
|
-
export type MapsPluginOpts = {
|
|
5
|
-
prefix?: string | undefined;
|
|
6
|
-
defaultOnlineStyleUrl?: string | undefined;
|
|
7
|
-
};
|
|
8
|
-
export type MapsPluginContext = {
|
|
9
|
-
getStyleJsonUrl: () => Promise<string>;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fastify-plugins/maps/index.js"],"names":[],"mappings":"AAYA,uCAAuC;AACvC,8FACwD;;;;;;;qBA8B1C,MAAM,OAAO,CAAC,MAAM,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const PLUGIN_NAME: "mapeo-static-maps";
|
|
2
|
-
export function plugin(instance: import("fastify").FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>, opts: OfflineFallbackMapPluginOpts): Promise<void>;
|
|
3
|
-
export type OfflineFallbackMapPluginOpts = {
|
|
4
|
-
prefix?: string | undefined;
|
|
5
|
-
styleJsonPath: string;
|
|
6
|
-
sourcesDir: string;
|
|
7
|
-
};
|
|
8
|
-
export type FallbackMapPluginDecorator = {
|
|
9
|
-
getResolvedStyleJson: (serverAddress: string) => Promise<any>;
|
|
10
|
-
getStyleJsonStats: () => Promise<import("node:fs").Stats>;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=offline-fallback-map.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"offline-fallback-map.d.ts","sourceRoot":"","sources":["../../../src/fastify-plugins/maps/offline-fallback-map.js"],"names":[],"mappings":"AAWA,8CAA8C;;;;mBAUhC,MAAM;gBACN,MAAM;;;0BAKN,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC;uBACvC,MAAM,OAAO,CAAC,OAAO,SAAS,EAAE,KAAK,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const PLUGIN_NAME: "mapeo-static-maps";
|
|
2
|
-
export function plugin(instance: import("fastify").FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>, opts: StaticMapsPluginOpts): Promise<void>;
|
|
3
|
-
export type StaticMapsPluginOpts = {
|
|
4
|
-
prefix?: string | undefined;
|
|
5
|
-
staticRootDir: string;
|
|
6
|
-
};
|
|
7
|
-
export type StaticMapsPluginDecorator = {
|
|
8
|
-
getResolvedStyleJson: (styleId: string, serverAddress: string) => Promise<string>;
|
|
9
|
-
getStyleJsonStats: (styleId: string) => Promise<import("node:fs").Stats>;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=static-maps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static-maps.d.ts","sourceRoot":"","sources":["../../../src/fastify-plugins/maps/static-maps.js"],"names":[],"mappings":"AAeA,8CAA8C;;;;mBAUhC,MAAM;;;0BAKN,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;uBAC3D,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,SAAS,EAAE,KAAK,CAAC"}
|
package/dist/invite-api.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} InviteApiEvents
|
|
3
|
-
* @property {(invite: Invite) => void} invite-received
|
|
4
|
-
* @property {(invite: Invite, removalReason: InviteRemovalReason) => void} invite-removed
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @extends {TypedEmitter<InviteApiEvents>}
|
|
8
|
-
*/
|
|
9
|
-
export class InviteApi extends TypedEmitter<InviteApiEvents> {
|
|
10
|
-
/**
|
|
11
|
-
* @param {Object} options
|
|
12
|
-
* @param {import('./local-peers.js').LocalPeers} options.rpc
|
|
13
|
-
* @param {object} options.queries
|
|
14
|
-
* @param {(projectInviteId: Readonly<Buffer>) => undefined | { projectPublicId: string }} options.queries.getProjectByInviteId
|
|
15
|
-
* @param {(projectDetails: Pick<ProjectJoinDetails, 'projectKey' | 'encryptionKeys'> & { projectName: string }) => Promise<string>} options.queries.addProject
|
|
16
|
-
* @param {Logger} [options.logger]
|
|
17
|
-
*/
|
|
18
|
-
constructor({ rpc, queries, logger }: {
|
|
19
|
-
rpc: import("./local-peers.js").LocalPeers;
|
|
20
|
-
queries: {
|
|
21
|
-
getProjectByInviteId: (projectInviteId: Readonly<Buffer>) => undefined | {
|
|
22
|
-
projectPublicId: string;
|
|
23
|
-
};
|
|
24
|
-
addProject: (projectDetails: Pick<ProjectJoinDetails, "projectKey" | "encryptionKeys"> & {
|
|
25
|
-
projectName: string;
|
|
26
|
-
}) => Promise<string>;
|
|
27
|
-
};
|
|
28
|
-
logger?: Logger | undefined;
|
|
29
|
-
});
|
|
30
|
-
rpc: import("./local-peers.js").LocalPeers;
|
|
31
|
-
/**
|
|
32
|
-
* @returns {Array<Invite>}
|
|
33
|
-
*/
|
|
34
|
-
getPending(): Array<Invite>;
|
|
35
|
-
/**
|
|
36
|
-
* Attempt to accept the invite.
|
|
37
|
-
*
|
|
38
|
-
* This can fail if the invitor has canceled the invite or if you cannot
|
|
39
|
-
* connect to the invitor's device.
|
|
40
|
-
*
|
|
41
|
-
* If the invite is accepted and you had other invites to the same project,
|
|
42
|
-
* those invites are removed, and the invitors are told that you're already
|
|
43
|
-
* part of this project.
|
|
44
|
-
*
|
|
45
|
-
* @param {Pick<Invite, 'inviteId'>} invite
|
|
46
|
-
* @returns {Promise<string>}
|
|
47
|
-
*/
|
|
48
|
-
accept({ inviteId: inviteIdString }: Pick<Invite, "inviteId">): Promise<string>;
|
|
49
|
-
/**
|
|
50
|
-
* @param {Pick<Invite, 'inviteId'>} invite
|
|
51
|
-
* @returns {void}
|
|
52
|
-
*/
|
|
53
|
-
reject({ inviteId: inviteIdString }: Pick<Invite, "inviteId">): void;
|
|
54
|
-
#private;
|
|
55
|
-
}
|
|
56
|
-
export type InviteInternal = InviteRpcMessage & {
|
|
57
|
-
receivedAt: number;
|
|
58
|
-
};
|
|
59
|
-
export type Invite = MapBuffers<InviteInternal>;
|
|
60
|
-
export type InviteRemovalReason = ("accepted" | "rejected" | "canceled" | "accepted other" | "connection error" | "internal error");
|
|
61
|
-
export type InviteApiEvents = {
|
|
62
|
-
"invite-received": (invite: Invite) => void;
|
|
63
|
-
"invite-removed": (invite: Invite, removalReason: InviteRemovalReason) => void;
|
|
64
|
-
};
|
|
65
|
-
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
66
|
-
import type { ProjectJoinDetails } from './generated/rpc.js';
|
|
67
|
-
import { Logger } from './logger.js';
|
|
68
|
-
import type { Invite as InviteRpcMessage } from './generated/rpc.js';
|
|
69
|
-
import type { MapBuffers } from './types.js';
|
|
70
|
-
//# sourceMappingURL=invite-api.d.ts.map
|
package/dist/invite-api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invite-api.d.ts","sourceRoot":"","sources":["../src/invite-api.js"],"names":[],"mappings":"AAiJA;;;;GAIG;AAEH;;GAEG;AACH;IAME;;;;;;;OAOG;IACH,sCANG;QAAuD,GAAG,EAAlD,OAAO,kBAAkB,EAAE,UAAU;QACrB,OAAO,EAC/B;YAAwG,oBAAoB,EAApH,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,SAAS,GAAG;gBAAE,eAAe,EAAE,MAAM,CAAA;aAAE;YAC4D,UAAU,EAApJ,CAAC,cAAc,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,gBAAgB,CAAC,GAAG;gBAAE,WAAW,EAAE,MAAM,CAAA;aAAE,KAAK,OAAO,CAAC,MAAM,CAAC;SAChI;QAAyB,MAAM;KAAC,EA0BlC;IAnBC,2CAAc;IAsFhB;;OAEG;IACH,cAFa,KAAK,CAAC,MAAM,CAAC,CAMzB;IAED;;;;;;;;;;;;OAYG;IACH,qCAHW,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,GACtB,OAAO,CAAC,MAAM,CAAC,CAkI3B;IAED;;;OAGG;IACH,qCAHW,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,GACtB,IAAI,CAuBhB;;CACF;6BA7ZY,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE;qBAGxC,WAAW,cAAc,CAAC;kCAG3B,CACZ,UAAa,GACb,UAAa,GACb,UAAa,GACb,gBAAmB,GACnB,kBAAqB,GACrB,gBAAmB,CAChB;;uBA8GU,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI;sBACxB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,mBAAmB,KAAK,IAAI;;6BApJ7C,oBAAoB;wCAavC,oBAAoB;uBAPP,aAAa;gDAO1B,oBAAoB;gCANE,YAAY"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compare two values in constant time.
|
|
3
|
-
*
|
|
4
|
-
* Useful when you want to avoid leaking data.
|
|
5
|
-
*
|
|
6
|
-
* Like `crypto.timingSafeEqual`, but works with strings and doesn't throw if
|
|
7
|
-
* lengths differ.
|
|
8
|
-
*
|
|
9
|
-
* @template {string | Uint8Array} T
|
|
10
|
-
* @param {T} a
|
|
11
|
-
* @param {T} b
|
|
12
|
-
* @returns {boolean}
|
|
13
|
-
*/
|
|
14
|
-
export default function timingSafeEqual<T extends string | Uint8Array>(a: T, b: T): boolean;
|
|
15
|
-
//# sourceMappingURL=timing-safe-equal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timing-safe-equal.d.ts","sourceRoot":"","sources":["../../src/lib/timing-safe-equal.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;GAYG;AACH,wCALmC,CAAC,SAAtB,MAAM,GAAG,UAAW,KACvB,CAAC,KACD,CAAC,GACC,OAAO,CASnB"}
|
package/dist/media-server.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export const BLOBS_PREFIX: "blobs";
|
|
2
|
-
export const ICONS_PREFIX: "icons";
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {Object} StartOpts
|
|
5
|
-
*
|
|
6
|
-
* @property {string} [host]
|
|
7
|
-
* @property {number} [port]
|
|
8
|
-
*/
|
|
9
|
-
export class MediaServer {
|
|
10
|
-
/**
|
|
11
|
-
* @param {object} params
|
|
12
|
-
* @param {(projectPublicId: string) => Promise<import('./mapeo-project.js').MapeoProject>} params.getProject
|
|
13
|
-
* @param {import('fastify').FastifyServerOptions['logger']} [params.logger]
|
|
14
|
-
*/
|
|
15
|
-
constructor({ getProject, logger }: {
|
|
16
|
-
getProject: (projectPublicId: string) => Promise<import('./mapeo-project.js').MapeoProject>;
|
|
17
|
-
logger?: import('fastify').FastifyServerOptions['logger'];
|
|
18
|
-
});
|
|
19
|
-
/**
|
|
20
|
-
* @param {StartOpts} [opts]
|
|
21
|
-
*/
|
|
22
|
-
start(opts?: StartOpts | undefined): Promise<void>;
|
|
23
|
-
started(): Promise<void>;
|
|
24
|
-
stop(): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* @param {'blobs' | 'icons'} mediaType
|
|
27
|
-
* @returns {Promise<string>}
|
|
28
|
-
*/
|
|
29
|
-
getMediaAddress(mediaType: 'blobs' | 'icons'): Promise<string>;
|
|
30
|
-
#private;
|
|
31
|
-
}
|
|
32
|
-
export type StartOpts = {
|
|
33
|
-
host?: string | undefined;
|
|
34
|
-
port?: number | undefined;
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=media-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"media-server.d.ts","sourceRoot":"","sources":["../src/media-server.js"],"names":[],"mappings":"AAWA,mCAAmC;AACnC,mCAAmC;AAEnC;;;;;GAKG;AAEH;IAOE;;;;OAIG;IACH;sCAH6B,MAAM,KAAK,QAAQ,OAAO,oBAAoB,EAAE,YAAY,CAAC;iBAC/E,OAAO,SAAS,EAAE,oBAAoB,CAAC,QAAQ,CAAC;OA0B1D;IAoDD;;OAEG;IACH,mDAEC;IAED,yBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,2BAHW,OAAO,GAAG,OAAO,GACf,QAAQ,MAAM,CAAC,CAuB3B;;CACF"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {import('ws').WebSocket} ws
|
|
3
|
-
* @param {import('../types.js').ReplicationStream} replicationStream
|
|
4
|
-
*/
|
|
5
|
-
export function wsCoreReplicator(ws: import("ws").WebSocket, replicationStream: import("../types.js").ReplicationStream): Promise<void>;
|
|
6
|
-
//# sourceMappingURL=ws-core-replicator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ws-core-replicator.d.ts","sourceRoot":"","sources":["../../src/server/ws-core-replicator.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qCAHW,OAAO,IAAI,EAAE,SAAS,qBACtB,OAAO,aAAa,EAAE,iBAAiB,iBAmBjD"}
|