@session.js/types 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/namespaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// CREDIT: OXEN, Session-Desktop
|
|
2
2
|
// github.com/oxen-io/session-desktop
|
|
3
|
-
import
|
|
3
|
+
import { orderBy, last } from 'lodash';
|
|
4
4
|
export var SnodeNamespaces;
|
|
5
5
|
(function (SnodeNamespaces) {
|
|
6
6
|
/**
|
|
@@ -83,8 +83,8 @@ function maxSizeMap(namespaces) {
|
|
|
83
83
|
}
|
|
84
84
|
groupedByPriorities.find(p => p.priority === item.priority)?.namespaces.push(item.namespace);
|
|
85
85
|
});
|
|
86
|
-
const sortedDescPriorities =
|
|
87
|
-
const lowestPriority =
|
|
86
|
+
const sortedDescPriorities = orderBy(groupedByPriorities, ['priority'], ['desc']);
|
|
87
|
+
const lowestPriority = last(sortedDescPriorities)?.priority || 1;
|
|
88
88
|
const sizeMap = sortedDescPriorities.flatMap(m => {
|
|
89
89
|
const paddingForLowerPriority = m.priority === lowestPriority ? 0 : 1;
|
|
90
90
|
const splitsForPriority = paddingForLowerPriority + m.namespaces.length;
|
|
@@ -28,7 +28,7 @@ export type RequestPollBody = {
|
|
|
28
28
|
namespaces: RequestNamespace[];
|
|
29
29
|
};
|
|
30
30
|
export type RequestUploadAttachment = {
|
|
31
|
-
data:
|
|
31
|
+
data: Uint8Array;
|
|
32
32
|
};
|
|
33
33
|
export type RequestDownloadAttachment = {
|
|
34
34
|
id: string;
|
|
@@ -44,6 +44,6 @@ export type RequestSogs = {
|
|
|
44
44
|
host: string;
|
|
45
45
|
endpoint: string;
|
|
46
46
|
method: string;
|
|
47
|
-
body: string |
|
|
47
|
+
body: string | Uint8Array | null;
|
|
48
48
|
headers: Record<string, string>;
|
|
49
49
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isNil } from 'lodash';
|
|
2
2
|
/**
|
|
3
3
|
* This function is used to check that an optional property on a Protobuf object is not undefined or using a type-specific default value.
|
|
4
4
|
* https://protobuf.dev/programming-guides/proto/#optional
|
|
@@ -8,7 +8,7 @@ import _ from 'lodash';
|
|
|
8
8
|
* @returns true if the property is defined or false if undefined or using a type-specific default value
|
|
9
9
|
*/
|
|
10
10
|
function hasDefinedProperty(object, property) {
|
|
11
|
-
return !
|
|
11
|
+
return !isNil(object) && Object.prototype.hasOwnProperty.call(object, property) !== false;
|
|
12
12
|
}
|
|
13
13
|
export const ProtobufUtils = {
|
|
14
14
|
hasDefinedProperty,
|