|
1 | 1 | # Lattice SDK Javascript |
2 | 2 |
|
| 3 | +[][https://www.npmjs.com/package/@anduril-industries/lattice-sdk] |
| 4 | + |
3 | 5 | The official [Anduril](https://www.anduril.com/) Lattice SDK for Javascript. |
4 | 6 |
|
5 | | -## Requirements |
| 7 | +## Documentation |
6 | 8 |
|
7 | | -[Active LTS Node.js version](https://nodejs.org/en/about/previous-releases) |
8 | | -08/24: Node.js 20 or later |
| 9 | +See the [Anduril Lattice SDK for Javascript documentation](https://docs.anduril.com/sdks/javascript). |
9 | 10 |
|
10 | | -## Installation |
| 11 | +## Requirements |
11 | 12 |
|
12 | | -### Authentication |
| 13 | +This repository is tested against the latest [Active LTS Node.js version](https://nodejs.org/en/about/previous-releases). |
13 | 14 |
|
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. |
| 15 | +## Installation |
15 | 16 |
|
16 | | -### .npmrc |
17 | | -Create a file in the package directory |
| 17 | +1. Create a new NPM repository `npm init` |
| 18 | +2. Install the Lattice SDK package with |
18 | 19 |
|
19 | 20 | ``` |
20 | | -@anduril:registry=https://npm.pkg.github.com |
21 | | -//npm.pkg.github.com/:_authToken=<GITHUB_PERSONAL_ACCESS_TOKEN> |
22 | | -``` |
23 | | - |
24 | | -### package.json |
25 | | -Create a file in the package directory |
26 | | - |
27 | | -```json |
28 | | -{ |
29 | | - "dependencies": { |
30 | | - "@anduril/lattice-sdk-javascript": "1.0.6", |
31 | | - "@connectrpc/connect-node": "1.4.0" |
32 | | - } |
33 | | -} |
34 | | -``` |
35 | | - |
36 | | -## Usage |
37 | | - |
38 | | -Index.ts |
39 | | - |
40 | | -```javascript |
41 | | -import { EntityManagerAPI } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_connect.js"; |
42 | | -import { createGrpcTransport } from "@connectrpc/connect-node"; |
43 | | -import { createPromiseClient } from "@connectrpc/connect"; |
44 | | -import { Entity } from "@anduril/lattice-sdk-javascript/src/anduril/entitymanager/v1/entity.pub_pb.js"; |
45 | | - |
46 | | -const transport = createGrpcTransport({ |
47 | | - // Requests will be made to <baseUrl>/<package>.<service>/method |
48 | | - baseUrl: "https://${YOUR_BASE_URL}", |
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 | | -}); |
56 | | - |
57 | | -async function main() { |
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); |
67 | | -} |
68 | | - |
69 | | -void main(); |
| 21 | +npm i @anduril-industries/lattice-sdk |
| 22 | +# or |
| 23 | +yarn add @anduril-industries/lattice-sdk |
70 | 24 | ``` |
71 | 25 |
|
72 | 26 | ## Support |
73 | 27 |
|
74 | 28 | For support with this library please [file an issue](https://github.com/anduril/lattice-sdk-javascript/issues/new) or reach out to your Anduril representative. |
75 | | - |
76 | | - |
77 | | - |
0 commit comments