Browse Source

Remove deprecated meshtastic/js dependency (#638)

* Remove deprecated meshtastic/js dependency

* Bump dependency version

* Fix linting

---------

Co-authored-by: philon- <[email protected]>
pull/644/head
Jeremy Gallant 1 year ago
committed by Dan Ditomaso
parent
commit
50c28706fe
  1. 40
      deno.lock
  2. 11
      package.json
  3. 13
      src/components/PageComponents/Connect/BLE.tsx
  4. 2
      src/components/PageComponents/Messages/MessageItem.tsx
  5. 7
      src/core/dto/PacketToMessageDTO.ts
  6. 17
      src/pages/Messages.tsx

40
deno.lock

@ -2,12 +2,11 @@
"version": "5",
"specifiers": {
"jsr:@std/path@^1.1.0": "1.1.0",
"npm:@bufbuild/protobuf@^2.5.2": "2.5.2",
"npm:@jsr/[email protected]": "2.6.4",
"npm:@jsr/[email protected]": "2.6.0-0",
"npm:@jsr/meshtastic__transport-http@*": "0.2.1",
"npm:@jsr/meshtastic__transport-web-bluetooth@*": "0.1.2",
"npm:@jsr/meshtastic__transport-web-serial@*": "0.2.1",
"npm:@bufbuild/protobuf@^2.2.5": "2.5.2",
"npm:@jsr/[email protected]": "2.6.2",
"npm:@jsr/[email protected]": "0.2.1",
"npm:@jsr/[email protected]": "0.1.2",
"npm:@jsr/[email protected]": "0.2.1",
"npm:@noble/curves@^1.9.2": "1.9.2",
"npm:@radix-ui/react-accordion@^1.2.11": "1.2.11_@[email protected]_@[email protected]__@[email protected][email protected][email protected][email protected]",
"npm:@radix-ui/react-checkbox@^1.3.2": "1.3.2_@[email protected]_@[email protected]__@[email protected][email protected][email protected][email protected]",
@ -1119,8 +1118,8 @@
"@jridgewell/sourcemap-codec"
]
},
"@jsr/[email protected].4": {
"integrity": "sha512-1Kz5DK6peFxluHOJR38vFwfgeJzMXTz+3p6TvibjILVhSQC2U1nu8aJbn6w5zhRqS+j79OmtrRvdzL6VNsTkkQ==",
"@jsr/[email protected].2": {
"integrity": "sha512-mzsxs9hQeVimQd/tj15Ojw5FYY8Iko3EbDviFZoEw3bmXgiySG53GvQsNA9wV13lFbDu96SM3uK/LI3EHMFY9w==",
"dependencies": [
"@bufbuild/protobuf",
"@jsr/meshtastic__protobufs",
@ -1128,10 +1127,10 @@
"ste-simple-events",
"tslog"
],
"tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__core/2.6.4.tgz"
"tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__core/2.6.2.tgz"
},
"@jsr/meshtastic__[email protected]": {
"integrity": "sha512-+xpZpxK6oUIVOuEs7C+LyxRr2druvc7UNNNTK9Rl8ioXj63Jz1uQXlYe2Gj0xjnRAiSQLR7QVaPef21BR/YTxA==",
"@jsr/meshtastic__[email protected]": {
"integrity": "sha512-1Kz5DK6peFxluHOJR38vFwfgeJzMXTz+3p6TvibjILVhSQC2U1nu8aJbn6w5zhRqS+j79OmtrRvdzL6VNsTkkQ==",
"dependencies": [
"@bufbuild/protobuf",
"@jsr/meshtastic__protobufs",
@ -1139,7 +1138,7 @@
"ste-simple-events",
"tslog"
],
"tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__js/2.6.0-0.tgz"
"tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__core/2.6.4.tgz"
},
"@jsr/[email protected]": {
"integrity": "sha512-bIENtFnUEru28GrAeSdiBS9skp0hN/3HZunMbF/IjvUrXOlx2fptKVj3b+pzjOWnLBZxllrByV/W+XDmrxqJ6g==",
@ -1151,21 +1150,21 @@
"@jsr/[email protected]": {
"integrity": "sha512-lmQKr3aIINKvtGROU4HchmSVqbZSbkIHqajowRRC8IAjsnR0zNTyxz210QyY4pFUF9hpcW3GRjwq5h/VO2JuGg==",
"dependencies": [
"@jsr/meshtastic__core"
"@jsr/meshtastic__core@2.6.2"
],
"tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__transport-http/0.2.1.tgz"
},
"@jsr/[email protected]": {
"integrity": "sha512-Z+5pv9RXNgY0/crKExOH3pZ6LT0HIXFmnBL7NX5AO2knOFRn+4lmxQEhhmiTTlkUfqyEfAvbjuY5u4mq9TPTdQ==",
"dependencies": [
"@jsr/meshtastic__core"
"@jsr/meshtastic__core@2.6.4"
],
"tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__transport-web-bluetooth/0.1.2.tgz"
},
"@jsr/[email protected]": {
"integrity": "sha512-yumjEGLkAuJYOC3aWKvZzbQqi/LnqaKfNpVCY7Ki7oLtAshNiZrBLiwiFhN7+ZR9FfMdJThyBMqREBDRRWTO1Q==",
"dependencies": [
"@jsr/meshtastic__core"
"@jsr/meshtastic__core@2.6.4"
],
"tarball": "https://npm.jsr.io/~/11/@jsr/meshtastic__transport-web-serial/0.2.1.tgz"
},
@ -7557,12 +7556,11 @@
],
"packageJson": {
"dependencies": [
"npm:@bufbuild/protobuf@^2.5.2",
"npm:@jsr/[email protected]",
"npm:@jsr/[email protected]",
"npm:@jsr/meshtastic__transport-http@*",
"npm:@jsr/meshtastic__transport-web-bluetooth@*",
"npm:@jsr/meshtastic__transport-web-serial@*",
"npm:@bufbuild/protobuf@^2.2.5",
"npm:@jsr/[email protected]",
"npm:@jsr/[email protected]",
"npm:@jsr/[email protected]",
"npm:@jsr/[email protected]",
"npm:@noble/curves@^1.9.2",
"npm:@radix-ui/react-accordion@^1.2.11",
"npm:@radix-ui/react-checkbox@^1.3.2",

11
package.json

@ -34,12 +34,11 @@
},
"homepage": "https://meshtastic.org",
"dependencies": {
"@bufbuild/protobuf": "^2.5.2",
"@meshtastic/core": "npm:@jsr/[email protected]",
"@meshtastic/js": "npm:@jsr/[email protected]",
"@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http",
"@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth",
"@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial",
"@bufbuild/protobuf": "^2.2.5",
"@meshtastic/core": "npm:@jsr/[email protected]",
"@meshtastic/transport-http": "npm:@jsr/[email protected]",
"@meshtastic/transport-web-bluetooth": "npm:@jsr/[email protected]",
"@meshtastic/transport-web-serial": "npm:@jsr/[email protected]",
"@noble/curves": "^1.9.2",
"@radix-ui/react-accordion": "^1.2.11",
"@radix-ui/react-checkbox": "^1.3.2",

13
src/components/PageComponents/Connect/BLE.tsx

@ -5,7 +5,8 @@ import { useAppStore } from "@core/stores/appStore.ts";
import { useDeviceStore } from "@core/stores/deviceStore.ts";
import { subscribeAll } from "@core/subscriptions.ts";
import { randId } from "@core/utils/randId.ts";
import { BleConnection, ServiceUuid } from "@meshtastic/js";
import { TransportWebBluetooth } from "@meshtastic/transport-web-bluetooth";
import { MeshDevice } from "@meshtastic/core";
import { BluetoothDevice } from "web-bluetooth";
import { useCallback, useEffect, useState } from "react";
import { useMessageStore } from "@core/stores/messageStore/index.ts";
@ -31,15 +32,13 @@ export const BLE = (
const onConnect = async (bleDevice: BluetoothDevice) => {
const id = randId();
const transport = await TransportWebBluetooth.createFromDevice(bleDevice);
const device = addDevice(id);
const connection = new MeshDevice(transport, id);
connection.configure();
setSelectedDevice(id);
const connection = new BleConnection(id);
await connection.connect({
device: bleDevice,
});
device.addConnection(connection);
subscribeAll(device, connection, messageStore);
closeDialog();
};
@ -72,7 +71,7 @@ export const BLE = (
onClick={async () => {
await navigator.bluetooth
.requestDevice({
filters: [{ services: [ServiceUuid] }],
filters: [{ services: [TransportWebBluetooth.ServiceUuid] }],
})
.then((device) => {
const exists = bleDevices.findIndex((d) => d.id === device.id);

2
src/components/PageComponents/Messages/MessageItem.tsx

@ -15,7 +15,7 @@ import {
MessageState,
useMessageStore,
} from "@core/stores/messageStore/index.ts";
import { Protobuf, Types } from "@meshtastic/js";
import { Protobuf, Types } from "@meshtastic/core";
import { Message } from "@core/stores/messageStore/types.ts";
import { useTranslation } from "react-i18next";
// import { MessageActionsMenu } from "@components/PageComponents/Messages/MessageActionsMenu.tsx"; // TODO: Uncomment when actions menu is implemented

7
src/core/dto/PacketToMessageDTO.ts

@ -1,7 +1,6 @@
import type { Types } from "@meshtastic/js";
import { MessageState, MessageType } from "../stores/messageStore/index.ts";
import type { Message } from "../stores/messageStore/types.ts";
import type { Types } from "@meshtastic/core";
import { MessageState, MessageType } from "@core/stores/messageStore/index.ts";
import { Message } from "@core/stores/messageStore/types.ts";
class PacketToMessageDTO {
channel: Types.ChannelNumber;
to: number;

17
src/pages/Messages.tsx

@ -120,21 +120,6 @@ export const MessagesPage = () => {
let messageId: number | undefined;
// type SetMessageStateParams =
// | {
// type: MessageType.Direct;
// nodeA: NodeNum;
// nodeB: NodeNum;
// messageId: MessageId; // ID of the message within that chat
// newState?: MessageState; // Optional new state, defaults to Ack
// }
// | {
// type: MessageType.Broadcast;
// channelId: ChannelId;
// messageId: MessageId;
// newState?: MessageState; // Optional new state, defaults to Ack
// };
try {
messageId = await connection?.sendText(
message,
@ -162,7 +147,7 @@ export const MessagesPage = () => {
} else {
console.warn("sendText completed but messageId is undefined");
}
} catch (e) {
} catch (e: unknown) {
console.error("Failed to send message:", e);
const failedId = messageId ?? randId();
if (chatType === MessageType.Broadcast) {

Loading…
Cancel
Save