mirror of https://github.com/waku-org/js-waku.git
Update other deps
This commit is contained in:
parent
cd7a8784d3
commit
6a372cd27f
File diff suppressed because it is too large
Load Diff
|
@ -15,17 +15,17 @@
|
|||
"stream-browserify": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^5.11.10",
|
||||
"@testing-library/react": "^11.2.6",
|
||||
"@testing-library/user-event": "^12.8.3",
|
||||
"@types/jest": "^26.0.22",
|
||||
"@types/node": "^12.20.7",
|
||||
"@types/react": "^17.0.3",
|
||||
"@types/react-dom": "^17.0.3",
|
||||
"cspell": "^5.3.12",
|
||||
"gh-pages": "^3.1.0",
|
||||
"@testing-library/jest-dom": "^5.16.1",
|
||||
"@testing-library/react": "^12.1.2",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/node": "^17.0.8",
|
||||
"@types/react": "^17.0.38",
|
||||
"@types/react-dom": "^17.0.11",
|
||||
"cspell": "^5.14.0",
|
||||
"gh-pages": "^3.2.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.2.1",
|
||||
"prettier": "^2.5.1",
|
||||
"react-app-rewired": "^2.1.11",
|
||||
"react-scripts": "5.0.0",
|
||||
"typescript": "^4.5.4"
|
||||
|
|
|
@ -86,10 +86,8 @@ export default function App() {
|
|||
const persistedNick = window.localStorage.getItem('nick');
|
||||
return persistedNick !== null ? persistedNick : generate();
|
||||
});
|
||||
const [
|
||||
historicalMessagesRetrieved,
|
||||
setHistoricalMessagesRetrieved,
|
||||
] = useState(false);
|
||||
const [historicalMessagesRetrieved, setHistoricalMessagesRetrieved] =
|
||||
useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('nick', nick);
|
||||
|
|
|
@ -10,7 +10,9 @@ export interface ChatMessage {
|
|||
payload: Uint8Array;
|
||||
}
|
||||
|
||||
const baseChatMessage: object = { timestamp: 0, nick: '' };
|
||||
function createBaseChatMessage(): ChatMessage {
|
||||
return { timestamp: 0, nick: '', payload: new Uint8Array() };
|
||||
}
|
||||
|
||||
export const ChatMessage = {
|
||||
encode(
|
||||
|
@ -32,8 +34,7 @@ export const ChatMessage = {
|
|||
decode(input: _m0.Reader | Uint8Array, length?: number): ChatMessage {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseChatMessage } as ChatMessage;
|
||||
message.payload = new Uint8Array();
|
||||
const message = createBaseChatMessage();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
|
@ -55,27 +56,26 @@ export const ChatMessage = {
|
|||
},
|
||||
|
||||
fromJSON(object: any): ChatMessage {
|
||||
const message = { ...baseChatMessage } as ChatMessage;
|
||||
message.payload = new Uint8Array();
|
||||
if (object.timestamp !== undefined && object.timestamp !== null) {
|
||||
message.timestamp = Number(object.timestamp);
|
||||
} else {
|
||||
message.timestamp = 0;
|
||||
}
|
||||
if (object.nick !== undefined && object.nick !== null) {
|
||||
message.nick = String(object.nick);
|
||||
} else {
|
||||
message.nick = '';
|
||||
}
|
||||
if (object.payload !== undefined && object.payload !== null) {
|
||||
message.payload = bytesFromBase64(object.payload);
|
||||
}
|
||||
const message = createBaseChatMessage();
|
||||
message.timestamp =
|
||||
object.timestamp !== undefined && object.timestamp !== null
|
||||
? Number(object.timestamp)
|
||||
: 0;
|
||||
message.nick =
|
||||
object.nick !== undefined && object.nick !== null
|
||||
? String(object.nick)
|
||||
: '';
|
||||
message.payload =
|
||||
object.payload !== undefined && object.payload !== null
|
||||
? bytesFromBase64(object.payload)
|
||||
: new Uint8Array();
|
||||
return message;
|
||||
},
|
||||
|
||||
toJSON(message: ChatMessage): unknown {
|
||||
const obj: any = {};
|
||||
message.timestamp !== undefined && (obj.timestamp = message.timestamp);
|
||||
message.timestamp !== undefined &&
|
||||
(obj.timestamp = Math.round(message.timestamp));
|
||||
message.nick !== undefined && (obj.nick = message.nick);
|
||||
message.payload !== undefined &&
|
||||
(obj.payload = base64FromBytes(
|
||||
|
@ -84,29 +84,20 @@ export const ChatMessage = {
|
|||
return obj;
|
||||
},
|
||||
|
||||
fromPartial(object: DeepPartial<ChatMessage>): ChatMessage {
|
||||
const message = { ...baseChatMessage } as ChatMessage;
|
||||
if (object.timestamp !== undefined && object.timestamp !== null) {
|
||||
message.timestamp = object.timestamp;
|
||||
} else {
|
||||
message.timestamp = 0;
|
||||
}
|
||||
if (object.nick !== undefined && object.nick !== null) {
|
||||
message.nick = object.nick;
|
||||
} else {
|
||||
message.nick = '';
|
||||
}
|
||||
if (object.payload !== undefined && object.payload !== null) {
|
||||
message.payload = object.payload;
|
||||
} else {
|
||||
message.payload = new Uint8Array();
|
||||
}
|
||||
fromPartial<I extends Exact<DeepPartial<ChatMessage>, I>>(
|
||||
object: I
|
||||
): ChatMessage {
|
||||
const message = createBaseChatMessage();
|
||||
message.timestamp = object.timestamp ?? 0;
|
||||
message.nick = object.nick ?? '';
|
||||
message.payload = object.payload ?? new Uint8Array();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
declare var self: any | undefined;
|
||||
declare var window: any | undefined;
|
||||
declare var global: any | undefined;
|
||||
var globalThis: any = (() => {
|
||||
if (typeof globalThis !== 'undefined') return globalThis;
|
||||
if (typeof self !== 'undefined') return self;
|
||||
|
@ -146,6 +137,7 @@ type Builtin =
|
|||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
|
@ -156,6 +148,14 @@ export type DeepPartial<T> = T extends Builtin
|
|||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
|
||||
Exclude<keyof I, KeysOfUnion<P>>,
|
||||
never
|
||||
>;
|
||||
|
||||
function longToNumber(long: Long): number {
|
||||
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
||||
throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
|
||||
|
|
Loading…
Reference in New Issue