@waku/core 0.0.8 → 0.0.9
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/CHANGELOG.md +14 -1
- package/bundle/index.js +97 -95
- package/bundle/lib/message/topic_only_message.js +2 -33
- package/bundle/lib/message/version_0.js +2 -133
- package/bundle/{peer_exchange-df95c3a7.js → peer_exchange-53df2b11.js} +276 -253
- package/bundle/topic_only_message-ece0fef9.js +39 -0
- package/bundle/version_0-b1fc527d.js +143 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/message/index.d.ts +2 -0
- package/dist/lib/message/index.js +3 -0
- package/dist/lib/message/index.js.map +1 -0
- package/dist/lib/message/topic_only_message.d.ts +2 -2
- package/dist/lib/message/topic_only_message.js +2 -2
- package/dist/lib/message/topic_only_message.js.map +1 -1
- package/dist/lib/relay/constants.js +1 -4
- package/dist/lib/relay/constants.js.map +1 -1
- package/dist/lib/relay/index.d.ts +3 -3
- package/dist/lib/relay/index.js.map +1 -1
- package/dist/lib/wait_for_remote_peer.d.ts +2 -2
- package/dist/lib/wait_for_remote_peer.js +2 -5
- package/dist/lib/wait_for_remote_peer.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +3 -2
- package/src/lib/message/index.ts +2 -0
- package/src/lib/message/topic_only_message.ts +3 -3
- package/src/lib/relay/constants.ts +1 -4
- package/src/lib/relay/index.ts +4 -4
- package/src/lib/wait_for_remote_peer.ts +2 -5
@@ -746,7 +746,7 @@ var common$1 = setup;
|
|
746
746
|
|
747
747
|
var debug = browser.exports;
|
748
748
|
|
749
|
-
var aspromise = asPromise
|
749
|
+
var aspromise = asPromise;
|
750
750
|
|
751
751
|
/**
|
752
752
|
* Callback as used by {@link util.asPromise}.
|
@@ -765,7 +765,7 @@ var aspromise = asPromise$1;
|
|
765
765
|
* @param {...*} params Function arguments
|
766
766
|
* @returns {Promise<*>} Promisified function
|
767
767
|
*/
|
768
|
-
function asPromise
|
768
|
+
function asPromise(fn, ctx/*, varargs */) {
|
769
769
|
var params = new Array(arguments.length - 1),
|
770
770
|
offset = 0,
|
771
771
|
index = 2,
|
@@ -1351,7 +1351,7 @@ function readUintBE(buf, pos) {
|
|
1351
1351
|
| buf[pos + 3]) >>> 0;
|
1352
1352
|
}
|
1353
1353
|
|
1354
|
-
var inquire_1 = inquire
|
1354
|
+
var inquire_1 = inquire;
|
1355
1355
|
|
1356
1356
|
/**
|
1357
1357
|
* Requires a module only if available.
|
@@ -1359,7 +1359,7 @@ var inquire_1 = inquire$1;
|
|
1359
1359
|
* @param {string} moduleName Module to require
|
1360
1360
|
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
1361
1361
|
*/
|
1362
|
-
function inquire
|
1362
|
+
function inquire(moduleName) {
|
1363
1363
|
try {
|
1364
1364
|
var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
|
1365
1365
|
if (mod && (mod.length || Object.keys(mod).length))
|
@@ -3426,288 +3426,311 @@ var roots = {};
|
|
3426
3426
|
|
3427
3427
|
var util$2 = {exports: {}};
|
3428
3428
|
|
3429
|
-
var codegen_1
|
3429
|
+
var codegen_1;
|
3430
|
+
var hasRequiredCodegen;
|
3431
|
+
|
3432
|
+
function requireCodegen () {
|
3433
|
+
if (hasRequiredCodegen) return codegen_1;
|
3434
|
+
hasRequiredCodegen = 1;
|
3435
|
+
codegen_1 = codegen;
|
3430
3436
|
|
3431
|
-
/**
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
function codegen(functionParams, functionName) {
|
3437
|
+
/**
|
3438
|
+
* Begins generating a function.
|
3439
|
+
* @memberof util
|
3440
|
+
* @param {string[]} functionParams Function parameter names
|
3441
|
+
* @param {string} [functionName] Function name if not anonymous
|
3442
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
3443
|
+
*/
|
3444
|
+
function codegen(functionParams, functionName) {
|
3439
3445
|
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3446
|
+
/* istanbul ignore if */
|
3447
|
+
if (typeof functionParams === "string") {
|
3448
|
+
functionName = functionParams;
|
3449
|
+
functionParams = undefined;
|
3450
|
+
}
|
3445
3451
|
|
3446
|
-
|
3452
|
+
var body = [];
|
3447
3453
|
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3454
|
+
/**
|
3455
|
+
* Appends code to the function's body or finishes generation.
|
3456
|
+
* @typedef Codegen
|
3457
|
+
* @type {function}
|
3458
|
+
* @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
|
3459
|
+
* @param {...*} [formatParams] Format parameters
|
3460
|
+
* @returns {Codegen|Function} Itself or the generated function if finished
|
3461
|
+
* @throws {Error} If format parameter counts do not match
|
3462
|
+
*/
|
3457
3463
|
|
3458
|
-
|
3459
|
-
|
3464
|
+
function Codegen(formatStringOrScope) {
|
3465
|
+
// note that explicit array handling below makes this ~50% faster
|
3460
3466
|
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
|
3465
|
-
|
3466
|
-
|
3467
|
-
|
3468
|
-
|
3469
|
-
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3476
|
-
|
3477
|
-
|
3478
|
-
|
3479
|
-
|
3480
|
-
|
3467
|
+
// finish the function
|
3468
|
+
if (typeof formatStringOrScope !== "string") {
|
3469
|
+
var source = toString();
|
3470
|
+
if (codegen.verbose)
|
3471
|
+
console.log("codegen: " + source); // eslint-disable-line no-console
|
3472
|
+
source = "return " + source;
|
3473
|
+
if (formatStringOrScope) {
|
3474
|
+
var scopeKeys = Object.keys(formatStringOrScope),
|
3475
|
+
scopeParams = new Array(scopeKeys.length + 1),
|
3476
|
+
scopeValues = new Array(scopeKeys.length),
|
3477
|
+
scopeOffset = 0;
|
3478
|
+
while (scopeOffset < scopeKeys.length) {
|
3479
|
+
scopeParams[scopeOffset] = scopeKeys[scopeOffset];
|
3480
|
+
scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
|
3481
|
+
}
|
3482
|
+
scopeParams[scopeOffset] = source;
|
3483
|
+
return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
|
3484
|
+
}
|
3485
|
+
return Function(source)(); // eslint-disable-line no-new-func
|
3486
|
+
}
|
3481
3487
|
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3491
|
-
|
3492
|
-
|
3493
|
-
|
3494
|
-
|
3495
|
-
|
3496
|
-
|
3497
|
-
|
3498
|
-
|
3499
|
-
|
3500
|
-
|
3501
|
-
|
3502
|
-
|
3488
|
+
// otherwise append to body
|
3489
|
+
var formatParams = new Array(arguments.length - 1),
|
3490
|
+
formatOffset = 0;
|
3491
|
+
while (formatOffset < formatParams.length)
|
3492
|
+
formatParams[formatOffset] = arguments[++formatOffset];
|
3493
|
+
formatOffset = 0;
|
3494
|
+
formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
|
3495
|
+
var value = formatParams[formatOffset++];
|
3496
|
+
switch ($1) {
|
3497
|
+
case "d": case "f": return String(Number(value));
|
3498
|
+
case "i": return String(Math.floor(value));
|
3499
|
+
case "j": return JSON.stringify(value);
|
3500
|
+
case "s": return String(value);
|
3501
|
+
}
|
3502
|
+
return "%";
|
3503
|
+
});
|
3504
|
+
if (formatOffset !== formatParams.length)
|
3505
|
+
throw Error("parameter count mismatch");
|
3506
|
+
body.push(formatStringOrScope);
|
3507
|
+
return Codegen;
|
3508
|
+
}
|
3503
3509
|
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3510
|
+
function toString(functionNameOverride) {
|
3511
|
+
return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
|
3512
|
+
}
|
3507
3513
|
|
3508
|
-
|
3509
|
-
|
3510
|
-
}
|
3514
|
+
Codegen.toString = toString;
|
3515
|
+
return Codegen;
|
3516
|
+
}
|
3511
3517
|
|
3512
|
-
/**
|
3513
|
-
|
3514
|
-
|
3515
|
-
|
3516
|
-
|
3517
|
-
|
3518
|
-
|
3519
|
-
|
3518
|
+
/**
|
3519
|
+
* Begins generating a function.
|
3520
|
+
* @memberof util
|
3521
|
+
* @function codegen
|
3522
|
+
* @param {string} [functionName] Function name if not anonymous
|
3523
|
+
* @returns {Codegen} Appender that appends code to the function's body
|
3524
|
+
* @variation 2
|
3525
|
+
*/
|
3520
3526
|
|
3521
|
-
/**
|
3522
|
-
|
3523
|
-
|
3524
|
-
|
3525
|
-
|
3526
|
-
codegen.verbose = false;
|
3527
|
+
/**
|
3528
|
+
* When set to `true`, codegen will log generated code to console. Useful for debugging.
|
3529
|
+
* @name util.codegen.verbose
|
3530
|
+
* @type {boolean}
|
3531
|
+
*/
|
3532
|
+
codegen.verbose = false;
|
3533
|
+
return codegen_1;
|
3534
|
+
}
|
3527
3535
|
|
3528
|
-
var fetch_1
|
3536
|
+
var fetch_1;
|
3537
|
+
var hasRequiredFetch;
|
3538
|
+
|
3539
|
+
function requireFetch () {
|
3540
|
+
if (hasRequiredFetch) return fetch_1;
|
3541
|
+
hasRequiredFetch = 1;
|
3542
|
+
fetch_1 = fetch;
|
3529
3543
|
|
3530
|
-
var asPromise = aspromise,
|
3531
|
-
|
3544
|
+
var asPromise = aspromise,
|
3545
|
+
inquire = inquire_1;
|
3532
3546
|
|
3533
|
-
var fs = inquire("fs");
|
3547
|
+
var fs = inquire("fs");
|
3534
3548
|
|
3535
|
-
/**
|
3536
|
-
|
3537
|
-
|
3538
|
-
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3549
|
+
/**
|
3550
|
+
* Node-style callback as used by {@link util.fetch}.
|
3551
|
+
* @typedef FetchCallback
|
3552
|
+
* @type {function}
|
3553
|
+
* @param {?Error} error Error, if any, otherwise `null`
|
3554
|
+
* @param {string} [contents] File contents, if there hasn't been an error
|
3555
|
+
* @returns {undefined}
|
3556
|
+
*/
|
3543
3557
|
|
3544
|
-
/**
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
|
3558
|
+
/**
|
3559
|
+
* Options as used by {@link util.fetch}.
|
3560
|
+
* @typedef FetchOptions
|
3561
|
+
* @type {Object}
|
3562
|
+
* @property {boolean} [binary=false] Whether expecting a binary response
|
3563
|
+
* @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
|
3564
|
+
*/
|
3551
3565
|
|
3552
|
-
/**
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
|
3560
|
-
function fetch(filename, options, callback) {
|
3561
|
-
|
3562
|
-
|
3563
|
-
|
3564
|
-
|
3565
|
-
|
3566
|
+
/**
|
3567
|
+
* Fetches the contents of a file.
|
3568
|
+
* @memberof util
|
3569
|
+
* @param {string} filename File path or url
|
3570
|
+
* @param {FetchOptions} options Fetch options
|
3571
|
+
* @param {FetchCallback} callback Callback function
|
3572
|
+
* @returns {undefined}
|
3573
|
+
*/
|
3574
|
+
function fetch(filename, options, callback) {
|
3575
|
+
if (typeof options === "function") {
|
3576
|
+
callback = options;
|
3577
|
+
options = {};
|
3578
|
+
} else if (!options)
|
3579
|
+
options = {};
|
3566
3580
|
|
3567
|
-
|
3568
|
-
|
3581
|
+
if (!callback)
|
3582
|
+
return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
|
3569
3583
|
|
3570
|
-
|
3571
|
-
|
3572
|
-
|
3573
|
-
|
3574
|
-
|
3575
|
-
|
3576
|
-
|
3577
|
-
|
3578
|
-
|
3584
|
+
// if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
|
3585
|
+
if (!options.xhr && fs && fs.readFile)
|
3586
|
+
return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
|
3587
|
+
return err && typeof XMLHttpRequest !== "undefined"
|
3588
|
+
? fetch.xhr(filename, options, callback)
|
3589
|
+
: err
|
3590
|
+
? callback(err)
|
3591
|
+
: callback(null, options.binary ? contents : contents.toString("utf8"));
|
3592
|
+
});
|
3579
3593
|
|
3580
|
-
|
3581
|
-
|
3582
|
-
}
|
3594
|
+
// use the XHR version otherwise.
|
3595
|
+
return fetch.xhr(filename, options, callback);
|
3596
|
+
}
|
3583
3597
|
|
3584
|
-
/**
|
3585
|
-
|
3586
|
-
|
3587
|
-
|
3588
|
-
|
3589
|
-
|
3590
|
-
|
3591
|
-
|
3592
|
-
|
3598
|
+
/**
|
3599
|
+
* Fetches the contents of a file.
|
3600
|
+
* @name util.fetch
|
3601
|
+
* @function
|
3602
|
+
* @param {string} path File path or url
|
3603
|
+
* @param {FetchCallback} callback Callback function
|
3604
|
+
* @returns {undefined}
|
3605
|
+
* @variation 2
|
3606
|
+
*/
|
3593
3607
|
|
3594
|
-
/**
|
3595
|
-
|
3596
|
-
|
3597
|
-
|
3598
|
-
|
3599
|
-
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3608
|
+
/**
|
3609
|
+
* Fetches the contents of a file.
|
3610
|
+
* @name util.fetch
|
3611
|
+
* @function
|
3612
|
+
* @param {string} path File path or url
|
3613
|
+
* @param {FetchOptions} [options] Fetch options
|
3614
|
+
* @returns {Promise<string|Uint8Array>} Promise
|
3615
|
+
* @variation 3
|
3616
|
+
*/
|
3603
3617
|
|
3604
|
-
/**/
|
3605
|
-
fetch.xhr = function fetch_xhr(filename, options, callback) {
|
3606
|
-
|
3607
|
-
|
3618
|
+
/**/
|
3619
|
+
fetch.xhr = function fetch_xhr(filename, options, callback) {
|
3620
|
+
var xhr = new XMLHttpRequest();
|
3621
|
+
xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
|
3608
3622
|
|
3609
|
-
|
3610
|
-
|
3623
|
+
if (xhr.readyState !== 4)
|
3624
|
+
return undefined;
|
3611
3625
|
|
3612
|
-
|
3613
|
-
|
3614
|
-
|
3615
|
-
|
3616
|
-
|
3626
|
+
// local cors security errors return status 0 / empty string, too. afaik this cannot be
|
3627
|
+
// reliably distinguished from an actually empty file for security reasons. feel free
|
3628
|
+
// to send a pull request if you are aware of a solution.
|
3629
|
+
if (xhr.status !== 0 && xhr.status !== 200)
|
3630
|
+
return callback(Error("status " + xhr.status));
|
3617
3631
|
|
3618
|
-
|
3619
|
-
|
3620
|
-
|
3621
|
-
|
3622
|
-
|
3623
|
-
|
3624
|
-
|
3625
|
-
|
3626
|
-
|
3627
|
-
|
3628
|
-
|
3629
|
-
|
3630
|
-
|
3632
|
+
// if binary data is expected, make sure that some sort of array is returned, even if
|
3633
|
+
// ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
|
3634
|
+
if (options.binary) {
|
3635
|
+
var buffer = xhr.response;
|
3636
|
+
if (!buffer) {
|
3637
|
+
buffer = [];
|
3638
|
+
for (var i = 0; i < xhr.responseText.length; ++i)
|
3639
|
+
buffer.push(xhr.responseText.charCodeAt(i) & 255);
|
3640
|
+
}
|
3641
|
+
return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
|
3642
|
+
}
|
3643
|
+
return callback(null, xhr.responseText);
|
3644
|
+
};
|
3631
3645
|
|
3632
|
-
|
3633
|
-
|
3634
|
-
|
3635
|
-
|
3636
|
-
|
3637
|
-
|
3646
|
+
if (options.binary) {
|
3647
|
+
// ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
|
3648
|
+
if ("overrideMimeType" in xhr)
|
3649
|
+
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
3650
|
+
xhr.responseType = "arraybuffer";
|
3651
|
+
}
|
3638
3652
|
|
3639
|
-
|
3640
|
-
|
3641
|
-
};
|
3653
|
+
xhr.open("GET", filename);
|
3654
|
+
xhr.send();
|
3655
|
+
};
|
3656
|
+
return fetch_1;
|
3657
|
+
}
|
3642
3658
|
|
3643
3659
|
var path = {};
|
3644
3660
|
|
3645
|
-
|
3661
|
+
var hasRequiredPath;
|
3662
|
+
|
3663
|
+
function requirePath () {
|
3664
|
+
if (hasRequiredPath) return path;
|
3665
|
+
hasRequiredPath = 1;
|
3666
|
+
(function (exports) {
|
3646
3667
|
|
3647
|
-
|
3648
|
-
|
3649
|
-
|
3650
|
-
|
3651
|
-
|
3652
|
-
|
3668
|
+
/**
|
3669
|
+
* A minimal path module to resolve Unix, Windows and URL paths alike.
|
3670
|
+
* @memberof util
|
3671
|
+
* @namespace
|
3672
|
+
*/
|
3673
|
+
var path = exports;
|
3653
3674
|
|
3654
|
-
|
3655
|
-
|
3656
|
-
|
3657
|
-
|
3658
|
-
|
3659
|
-
|
3660
|
-
|
3661
|
-
|
3662
|
-
|
3675
|
+
var isAbsolute =
|
3676
|
+
/**
|
3677
|
+
* Tests if the specified path is absolute.
|
3678
|
+
* @param {string} path Path to test
|
3679
|
+
* @returns {boolean} `true` if path is absolute
|
3680
|
+
*/
|
3681
|
+
path.isAbsolute = function isAbsolute(path) {
|
3682
|
+
return /^(?:\/|\w+:)/.test(path);
|
3683
|
+
};
|
3663
3684
|
|
3664
|
-
|
3665
|
-
|
3666
|
-
|
3667
|
-
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3672
|
-
|
3673
|
-
|
3674
|
-
|
3675
|
-
|
3676
|
-
|
3677
|
-
|
3678
|
-
|
3679
|
-
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3683
|
-
|
3684
|
-
|
3685
|
-
|
3686
|
-
|
3687
|
-
|
3688
|
-
|
3689
|
-
|
3690
|
-
|
3691
|
-
|
3692
|
-
|
3685
|
+
var normalize =
|
3686
|
+
/**
|
3687
|
+
* Normalizes the specified path.
|
3688
|
+
* @param {string} path Path to normalize
|
3689
|
+
* @returns {string} Normalized path
|
3690
|
+
*/
|
3691
|
+
path.normalize = function normalize(path) {
|
3692
|
+
path = path.replace(/\\/g, "/")
|
3693
|
+
.replace(/\/{2,}/g, "/");
|
3694
|
+
var parts = path.split("/"),
|
3695
|
+
absolute = isAbsolute(path),
|
3696
|
+
prefix = "";
|
3697
|
+
if (absolute)
|
3698
|
+
prefix = parts.shift() + "/";
|
3699
|
+
for (var i = 0; i < parts.length;) {
|
3700
|
+
if (parts[i] === "..") {
|
3701
|
+
if (i > 0 && parts[i - 1] !== "..")
|
3702
|
+
parts.splice(--i, 2);
|
3703
|
+
else if (absolute)
|
3704
|
+
parts.splice(i, 1);
|
3705
|
+
else
|
3706
|
+
++i;
|
3707
|
+
} else if (parts[i] === ".")
|
3708
|
+
parts.splice(i, 1);
|
3709
|
+
else
|
3710
|
+
++i;
|
3711
|
+
}
|
3712
|
+
return prefix + parts.join("/");
|
3713
|
+
};
|
3693
3714
|
|
3694
|
-
|
3695
|
-
|
3696
|
-
|
3697
|
-
|
3698
|
-
|
3699
|
-
|
3700
|
-
|
3701
|
-
|
3702
|
-
|
3703
|
-
|
3704
|
-
|
3705
|
-
|
3706
|
-
|
3707
|
-
|
3708
|
-
|
3709
|
-
|
3715
|
+
/**
|
3716
|
+
* Resolves the specified include path against the specified origin path.
|
3717
|
+
* @param {string} originPath Path to the origin file
|
3718
|
+
* @param {string} includePath Include path relative to origin path
|
3719
|
+
* @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
|
3720
|
+
* @returns {string} Path to the include file
|
3721
|
+
*/
|
3722
|
+
path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
3723
|
+
if (!alreadyNormalized)
|
3724
|
+
includePath = normalize(includePath);
|
3725
|
+
if (isAbsolute(includePath))
|
3726
|
+
return includePath;
|
3727
|
+
if (!alreadyNormalized)
|
3728
|
+
originPath = normalize(originPath);
|
3729
|
+
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
3730
|
+
};
|
3710
3731
|
} (path));
|
3732
|
+
return path;
|
3733
|
+
}
|
3711
3734
|
|
3712
3735
|
var types$1 = {};
|
3713
3736
|
|
@@ -7293,9 +7316,9 @@ function requireUtil () {
|
|
7293
7316
|
var Type, // cyclic
|
7294
7317
|
Enum;
|
7295
7318
|
|
7296
|
-
util.codegen =
|
7297
|
-
util.fetch =
|
7298
|
-
util.path =
|
7319
|
+
util.codegen = requireCodegen();
|
7320
|
+
util.fetch = requireFetch();
|
7321
|
+
util.path = requirePath();
|
7299
7322
|
|
7300
7323
|
/**
|
7301
7324
|
* Node's fs module if available.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { d as debug, T as TopicOnlyMessage$1 } from './peer_exchange-53df2b11.js';
|
2
|
+
|
3
|
+
const log = debug("waku:message:topic-only");
|
4
|
+
class TopicOnlyMessage {
|
5
|
+
constructor(proto) {
|
6
|
+
this.proto = proto;
|
7
|
+
}
|
8
|
+
get contentTopic() {
|
9
|
+
return this.proto.contentTopic ?? "";
|
10
|
+
}
|
11
|
+
}
|
12
|
+
class TopicOnlyDecoder {
|
13
|
+
constructor() {
|
14
|
+
this.contentTopic = "";
|
15
|
+
}
|
16
|
+
fromWireToProtoObj(bytes) {
|
17
|
+
const protoMessage = TopicOnlyMessage$1.decode(bytes);
|
18
|
+
log("Message decoded", protoMessage);
|
19
|
+
return Promise.resolve({
|
20
|
+
contentTopic: protoMessage.contentTopic,
|
21
|
+
payload: undefined,
|
22
|
+
rateLimitProof: undefined,
|
23
|
+
timestamp: undefined,
|
24
|
+
version: undefined,
|
25
|
+
ephemeral: undefined,
|
26
|
+
});
|
27
|
+
}
|
28
|
+
async fromProtoObj(proto) {
|
29
|
+
return new TopicOnlyMessage(proto);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
var topic_only_message = /*#__PURE__*/Object.freeze({
|
34
|
+
__proto__: null,
|
35
|
+
TopicOnlyMessage: TopicOnlyMessage,
|
36
|
+
TopicOnlyDecoder: TopicOnlyDecoder
|
37
|
+
});
|
38
|
+
|
39
|
+
export { TopicOnlyDecoder as T, TopicOnlyMessage as a, topic_only_message as t };
|