Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test-watch: $(node_modules) build-buf
lint: $(node_modules) build-buf
npm run lint
npm run typecheck
npm run check
npm run check -- --ignore=@bufbuild/protobuf
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new major version (2) is incompatible with other packages used by connect-es


.PHONY: format
format: $(node_modules)
Expand Down
15 changes: 4 additions & 11 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
version: v1
managed:
enabled: true
plugins:
- name: js
- plugin: buf.build/connectrpc/es:v1.5.0
out: src/gen
opt:
- import_style=commonjs
- name: grpc-web
- plugin: buf.build/bufbuild/es:v1.10.0
out: src/gen
opt:
- import_style=commonjs
- mode=grpcwebtext
- name: ts
out: src/gen
opt:
- service=grpc-web
31 changes: 7 additions & 24 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,13 @@
:license_links: https://github.com/bufbuild/buf/blob/main/LICENSE
:versions: []
:when: 2023-05-01 18:09:18.081521457 Z
- - :license
- '@improbable-eng/grpc-web'
- Apache 2.0
- :who:
:why: 'TODO(RSDK-583): why is license finder unable to detect this license automatically?'
:license_links: https://www.npmjs.com/package/@improbable-eng/grpc-web
:versions: []
:when: 2023-05-01 18:11:37.804857463 Z
- - :license
- '@improbable-eng/grpc-web-fake-transport'
- Apache 2.0
- :who:
:why: 'TODO(RSDK-583): why is license finder unable to detect this license automatically?'
:license_links: https://www.npmjs.com/package/@improbable-eng/grpc-web-fake-transport
:versions: []
:when: 2023-05-01 18:11:37.804857463 Z
- - :approve
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need approval for this addition. It is apache 2 and bsd-3

- "@bufbuild/protobuf"
- :who:
:why:
:versions:
- 1.10.0
:when: 2024-09-30 14:52:13.805002459 Z
- - :license
- '@typescript-eslint/parser'
- BSD-2-Clause
Expand Down Expand Up @@ -89,14 +80,6 @@
:license_links: https://github.com/viamrobotics/js-config/blob/main/LICENSE
:versions: []
:when: 2023-12-28 23:30:28.297289000 Z
- - :license
- protoc-gen-js
- MIT
- :who:
:why: 'TODO(RSDK-583): why is license finder unable to detect this license automatically?'
:license_links: https://github.com/yinzara/protoc-gen-js/blob/master/LICENSE
:versions: []
:when: 2023-05-12 14:28:29.173104997 Z
- - :permit
- ISC
- :who:
Expand Down
12 changes: 4 additions & 8 deletions examples/connect-app-teleop-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions examples/connect-app-teleop-react/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ import {
createViamClient,
type AccessToken,
type Credential,
type Credentials,
type RobotClient,
type ViamClient,
} from '@viamrobotics/sdk';

const isAccessToken = (x: Credential | AccessToken): x is AccessToken => {
return x.type === 'access-token';
};

/**
* Given a set of credentials, get a robot client.
*
Expand All @@ -25,8 +22,7 @@ export const getRobotClient = async (
): Promise<RobotClient> => {
return createRobotClient({
host: hostname,
credential: credentials,
authEntity: isAccessToken(credentials) ? '' : credentials.authEntity,
credentials,
signalingAddress: 'https://app.viam.com:443',
iceServers: [{ urls: 'stun:global.stun.twilio.com:3478' }],
});
Expand All @@ -39,10 +35,10 @@ export const getRobotClient = async (
* @returns A viam client
*/
export const getViamClient = async (
credentials: AccessToken | Credential
credentials: Credentials
): Promise<ViamClient> => {
return createViamClient({
credential: credentials,
credentials,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { useEffect, useState } from 'react';

export interface LocationsListProps {
appClient: AppClient;
organization: appApi.Organization.AsObject
onLocationSelected: (location: appApi.Location.AsObject) => unknown;
organization: appApi.Organization
onLocationSelected: (location: appApi.Location) => unknown;
}

export const LocationsList = ({ appClient, organization, onLocationSelected }: LocationsListProps): JSX.Element => {

const [locations, setLocations] = useState<appApi.Location.AsObject[]>([]);
const [locations, setLocations] = useState<appApi.Location[]>([]);
useEffect(() => {
async function getLocations() {
const locations = await appClient.listLocations(organization.id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { appApi, type AccessToken, type Credential } from '@viamrobotics/sdk';
import { appApi, type Credentials } from '@viamrobotics/sdk';
import { useMotionControls } from '../motion';
import { useRobotClientStore, useStream } from '../state';
import { MotionArrows } from './motion-arrows';
import { VideoStream } from './video-stream';

export interface MachinePartControlProps {
credentials: Credential | AccessToken;
machinePart: appApi.RobotPart.AsObject;
credentials: Credentials;
machinePart: appApi.RobotPart;
}

export const MachinePartControl = ({ credentials, machinePart }: MachinePartControlProps): JSX.Element => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { useEffect, useState } from 'react';

export interface MachinesPartsListProps {
appClient: AppClient;
machine: appApi.Robot.AsObject;
onMachinePartSelected: (machine: appApi.RobotPart.AsObject) => unknown;
machine: appApi.Robot;
onMachinePartSelected: (machine: appApi.RobotPart) => unknown;
}

export const MachinePartsList = ({ appClient, machine, onMachinePartSelected }: MachinesPartsListProps): JSX.Element => {
const [machineParts, setMachineParts] = useState<appApi.RobotPart.AsObject[]>([]);
const [machineParts, setMachineParts] = useState<appApi.RobotPart[]>([]);
useEffect(() => {
async function getMachineParts() {
const machineParts = await appClient.getRobotParts(machine.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { useEffect, useState } from 'react';

export interface MachinesListProps {
appClient: AppClient;
location: appApi.Location.AsObject;
onMachineSelected: (machine: appApi.Robot.AsObject) => unknown;
location: appApi.Location;
onMachineSelected: (machine: appApi.Robot) => unknown;
}

export const MachinesList = ({ appClient, location, onMachineSelected }: MachinesListProps): JSX.Element => {
const [machines, setMachines] = useState<appApi.Robot.AsObject[]>([]);
const [machines, setMachines] = useState<appApi.Robot[]>([]);
useEffect(() => {
async function getMachines() {
const machines = await appClient.listRobots(location.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { useEffect, useState } from 'react';

export interface OrganizationsListProps {
appClient: AppClient;
onOrganizationSelected: (organization: appApi.Organization.AsObject) => unknown;
onOrganizationSelected: (organization: appApi.Organization) => unknown;
}

export const OrganizationsList = ({ appClient, onOrganizationSelected }: OrganizationsListProps): JSX.Element => {

const [organizations, setOrganizations] = useState<appApi.Organization.AsObject[]>([]);
const [organizations, setOrganizations] = useState<appApi.Organization[]>([]);
useEffect(() => {
async function getLocations() {
const organizations = await appClient.listOrganizations();
Expand Down
36 changes: 18 additions & 18 deletions examples/connect-app-teleop-react/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,31 +148,31 @@ interface BrowserStateOrganizations {
interface BrowserStateLocations {
key: BrowserStateKey.Locations;
appClient: AppClient;
organization: appApi.Organization.AsObject;
organization: appApi.Organization;
}

interface BrowserStateMachines {
key: BrowserStateKey.Machines;
appClient: AppClient;
organization: appApi.Organization.AsObject;
location: appApi.Location.AsObject;
organization: appApi.Organization;
location: appApi.Location;
}

interface BrowserStateMachineParts {
key: BrowserStateKey.MachineParts;
appClient: AppClient;
location: appApi.Location.AsObject;
organization: appApi.Organization.AsObject;
machine: appApi.Robot.AsObject;
location: appApi.Location;
organization: appApi.Organization;
machine: appApi.Robot;
}

interface BrowserStateControlMachinePart {
key: BrowserStateKey.ControlMachinePart;
appClient: AppClient;
organization: appApi.Organization.AsObject;
location: appApi.Location.AsObject;
machine: appApi.Robot.AsObject;
machinePart: appApi.RobotPart.AsObject;
organization: appApi.Organization;
location: appApi.Location;
machine: appApi.Robot;
machinePart: appApi.RobotPart;
}

export type BrowserState =
Expand Down Expand Up @@ -309,9 +309,9 @@ export class BrowserStateStore {
| BrowserStateMachines
| BrowserStateMachineParts
| BrowserStateControlMachinePart
): (organization: appApi.Organization.AsObject) => void {
): (organization: appApi.Organization) => void {
this.validateState(currentState);
return (organization: appApi.Organization.AsObject) => {
return (organization: appApi.Organization) => {
this.onNewState({
key: BrowserStateKey.Locations,
appClient: currentState.appClient,
Expand All @@ -326,9 +326,9 @@ export class BrowserStateStore {
| BrowserStateMachines
| BrowserStateMachineParts
| BrowserStateControlMachinePart
): (location: appApi.Location.AsObject) => void {
): (location: appApi.Location) => void {
this.validateState(currentState);
return (location: appApi.Location.AsObject) => {
return (location: appApi.Location) => {
this.onNewState({
key: BrowserStateKey.Machines,
appClient: currentState.appClient,
Expand All @@ -343,9 +343,9 @@ export class BrowserStateStore {
| BrowserStateMachines
| BrowserStateMachineParts
| BrowserStateControlMachinePart
): (machine: appApi.Robot.AsObject) => void {
): (machine: appApi.Robot) => void {
this.validateState(currentState);
return (machine: appApi.Robot.AsObject) => {
return (machine: appApi.Robot) => {
this.onNewState({
key: BrowserStateKey.MachineParts,
appClient: currentState.appClient,
Expand All @@ -358,9 +358,9 @@ export class BrowserStateStore {

public onMachinePartSelected(
currentState: BrowserStateMachineParts | BrowserStateControlMachinePart
): (part: appApi.RobotPart.AsObject) => void {
): (part: appApi.RobotPart) => void {
this.validateState(currentState);
return (part: appApi.RobotPart.AsObject) => {
return (part: appApi.RobotPart) => {
this.onNewState({
key: BrowserStateKey.ControlMachinePart,
appClient: currentState.appClient,
Expand Down
41 changes: 20 additions & 21 deletions examples/connect-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/connect-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const API_KEY_SECRET = import.meta.env.VITE_API_KEY_SECRET;

async function connect(): Promise<VIAM.ViamClient> {
const opts: VIAM.ViamClientOptions = {
credential: {
credentials: {
type: 'api-key',
authEntity: API_KEY_ID,
payload: API_KEY_SECRET,
Expand Down
Loading