1- # anduril-javascript
1+ # Anduril SDK Javascript
2+
3+ The official [ Anduril] ( https://www.anduril.com/ ) client library.
4+
5+ ## Requirements
6+
7+ [ Active LTS Node.js version] ( https://nodejs.org/en/about/previous-releases )
8+ 08/24: Node.js 20 or later
9+
10+ ## Installation
11+
12+ ### Authentication
13+
14+ To authenticate with the Github package repository, you will need to generate a [ personal access token] ( https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic ) . This should have at least ` read:packages ` scope. Please keep the token safe for the next stage of the setup procedure.
215
316### .npmrc
417Create a file in the package directory
518
619```
720@anduril:registry=https://npm.pkg.github.com
8- //npm.pkg.github.com/:_authToken=<TOKEN >
21+ //npm.pkg.github.com/:_authToken=<GITHUB_PERSONAL_ACCESS_TOKEN >
922```
1023
1124### package.json
@@ -20,45 +33,45 @@ Create a file in the package directory
2033}
2134```
2235
23- ### Index.ts
36+ ## Usage
37+
38+ Index.ts
2439
25- ``` ts
26- import { EntityManagerAPI } from " @anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_connect" ;
40+ ``` javascript
41+ import { EntityManagerAPI } from " @anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_connect.js " ;
2742import { createGrpcTransport } from " @connectrpc/connect-node" ;
2843import { createPromiseClient } from " @connectrpc/connect" ;
29- import { PublishEntitiesRequest } from " @anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_pb" ;
30- import { Entity } from " @anduril/anduril-javascript/src/anduril/entitymanager/v1/entity.pub_pb" ;
31- import { createWritableIterable } from " @connectrpc/connect/protocol" ;
32- import { PartialMessage } from " @bufbuild/protobuf" ;
44+ import { Entity } from " @anduril/anduril-javascript/src/anduril/entitymanager/v1/entity.pub_pb.js" ;
3345
3446const transport = createGrpcTransport ({
35- // Requests will be made to <baseUrl>/<package>.<service>/method
36- baseUrl: " https://desert-guardian.anduril.com" ,
37-
38- // You have to tell the Node.js http API which HTTP version to use.
39- httpVersion: " 2" ,
40-
41- // Interceptors apply to all calls running through this transport.
42- interceptors: [],
43- });
47+ // Requests will be made to <baseUrl>/<package>.<service>/method
48+ baseUrl: " https://desert-guardian.anduril.com" ,
49+
50+ // You have to tell the Node.js http API which HTTP version to use.
51+ httpVersion: " 2" ,
52+
53+ // Interceptors apply to all calls running through this transport.
54+ interceptors: [],
55+ });
4456
4557async function main () {
46- const client = createPromiseClient (EntityManagerAPI , transport );
47- const headers = new Headers ();
48- headers .set (" Authorization" , " Bearer <BEARER TOKEN>" );
49-
50- const entity = new Entity ({
51- entityId: " asdasd" ,
52- isLive: true ,
53- description: " A new entity" ,
54- })
55-
56- const resPut = await client .putEntity (request ,{ headers: headers });
57- console .log (resPut );
58+ const client = createPromiseClient (EntityManagerAPI, transport);
59+ const headers = new Headers ();
60+ headers .set (" Authorization" , " Bearer <YOUR BEAERER TOKEN>" );
61+
62+ const response = await client .getEntity (
63+ { entityId: " <ENTITY ID>" },
64+ { headers: headers },
65+ );
66+ console .log (response);
5867}
5968
6069void main ();
61-
70+ ```
71+
72+ ## Support
73+
74+ For support with this library please [ file an issue] ( https://github.com/anduril/anduril-javascript/issues/new ) or reach out to your Anduril representative.
75+
6276
6377
64- ````
0 commit comments