Skip to content

Commit dd657a2

Browse files
author
fern
committed
SDK Generation
1 parent d1c5a00 commit dd657a2

File tree

244 files changed

+3303
-5726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+3303
-5726
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ jobs:
1313
- name: Set up node
1414
uses: actions/setup-node@v3
1515

16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: Install dependencies
20+
run: pnpm install
21+
1622
- name: Compile
17-
run: yarn && yarn build
23+
run: pnpm build
1824

1925
test:
2026
runs-on: ubuntu-latest
@@ -25,33 +31,12 @@ jobs:
2531

2632
- name: Set up node
2733
uses: actions/setup-node@v3
34+
35+
- name: Install pnpm
36+
uses: pnpm/action-setup@v4
2837

29-
- name: Compile
30-
run: yarn && yarn test
31-
32-
publish:
33-
needs: [ compile, test ]
34-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
35-
runs-on: ubuntu-latest
36-
steps:
37-
- name: Checkout repo
38-
uses: actions/checkout@v4
39-
- name: Set up node
40-
uses: actions/setup-node@v3
4138
- name: Install dependencies
42-
run: yarn install
43-
- name: Build
44-
run: yarn build
45-
46-
- name: Publish to npm
47-
run: |
48-
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
49-
if [[ ${GITHUB_REF} == *alpha* ]]; then
50-
npm publish --access public --tag alpha
51-
elif [[ ${GITHUB_REF} == *beta* ]]; then
52-
npm publish --access public --tag beta
53-
else
54-
npm publish --access public
55-
fi
56-
env:
57-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
run: pnpm install
40+
41+
- name: Test
42+
run: pnpm test

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tests
44
.gitignore
55
.github
66
.fernignore
7-
.prettierrc.yml
7+
biome.json
88
tsconfig.json
99
yarn.lock
1010
pnpm-lock.yaml

.prettierrc.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

LICENSE

Lines changed: 0 additions & 189 deletions
This file was deleted.

README.md

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,34 @@
22

33
![](https://www.anduril.com/lattice-sdk/)
44

5-
[![npm shield](https://img.shields.io/npm/v/@anduril-industries/lattice-sdk)](https://www.npmjs.com/package/@anduril-industries/lattice-sdk)
5+
[![npm shield](https://img.shields.io/npm/v/)](https://www.npmjs.com/package/)
66

77
The Lattice SDK TypeScript library provides convenient access to the Lattice SDK APIs from TypeScript.
88

99
## Documentation
1010

1111
API reference documentation is available [here](https://developer.anduril.com/).
1212

13-
## Requirements
14-
15-
To use the SDK please ensure you have the following installed:
16-
17-
- [NodeJS](https://nodejs.org/en/download/package-manager)
18-
1913
## Installation
2014

2115
```sh
22-
npm i -s @anduril-industries/lattice-sdk
16+
npm i -s
2317
```
2418

25-
## Support
26-
27-
For support with this library, please reach out to your Anduril representative.
28-
2919
## Reference
3020

31-
A full reference for this library is available [here](https://github.com/anduril/lattice-sdk-javascript/blob/HEAD/./reference.md).
21+
A full reference for this library is available [here](./reference.md).
3222

3323
## Usage
3424

3525
Instantiate and use the client with the following:
3626

3727
```typescript
38-
import { LatticeClient } from "@anduril-industries/lattice-sdk";
28+
import { LatticeClient } from "";
3929

4030
const client = new LatticeClient({ token: "YOUR_TOKEN" });
4131
await client.entities.longPollEntityEvents({
42-
sessionToken: "sessionToken",
32+
sessionToken: "sessionToken"
4333
});
4434
```
4535

@@ -49,7 +39,7 @@ The SDK exports all request and response types as TypeScript interfaces. Simply
4939
following namespace:
5040

5141
```typescript
52-
import { Lattice } from "@anduril-industries/lattice-sdk";
42+
import { Lattice } from "Lattice";
5343

5444
const request: Lattice.EntityOverride = {
5545
...
@@ -62,7 +52,7 @@ When the API returns a non-success status code (4xx or 5xx response), a subclass
6252
will be thrown.
6353

6454
```typescript
65-
import { LatticeError } from "@anduril-industries/lattice-sdk";
55+
import { LatticeError } from "Lattice";
6656

6757
try {
6858
await client.entities.longPollEntityEvents(...);
@@ -91,39 +81,36 @@ await client.objects.uploadObject(new File(['binary data'], 'file.mp3'), ...);
9181
await client.objects.uploadObject(new ArrayBuffer(8), ...);
9282
await client.objects.uploadObject(new Uint8Array([0, 1, 2]), ...);
9383
```
94-
9584
The client accepts a variety of types for file upload parameters:
96-
97-
- Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
98-
- Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
85+
* Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
86+
* Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
9987

10088
### Metadata
10189

10290
You can configure metadata when uploading a file:
103-
10491
```typescript
10592
const file: Uploadable.WithMetadata = {
10693
data: createReadStream("path/to/file"),
107-
filename: "my-file", // optional
94+
filename: "my-file", // optional
10895
contentType: "audio/mpeg", // optional
109-
contentLength: 1949, // optional
96+
contentLength: 1949, // optional
11097
};
11198
```
11299

113100
Alternatively, you can upload a file directly from a file path:
114-
115101
```typescript
116-
const file: Uploadable.FromPath = {
102+
const file : Uploadable.FromPath = {
117103
path: "path/to/file",
118-
filename: "my-file", // optional
119-
contentType: "audio/mpeg", // optional
120-
contentLength: 1949, // optional
104+
filename: "my-file", // optional
105+
contentType: "audio/mpeg", // optional
106+
contentLength: 1949, // optional
121107
};
122108
```
123109

124110
The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
125111
For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.
126112

113+
127114
## Binary Response
128115

129116
You can consume binary data from endpoints using the `BinaryResponse` type which lets you choose how to consume the data:
@@ -138,7 +125,6 @@ const stream: ReadableStream<Uint8Array> = response.stream();
138125
// If you want to check if the response body has been used, you can use the following property.
139126
const bodyUsed = response.bodyUsed;
140127
```
141-
142128
<details>
143129
<summary>Save binary response to a file</summary>
144130

@@ -519,14 +505,14 @@ const text = new TextDecoder().decode(bytes);
519505
List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items:
520506

521507
```typescript
522-
import { LatticeClient } from "@anduril-industries/lattice-sdk";
508+
import { LatticeClient } from "";
523509

524510
const client = new LatticeClient({ token: "YOUR_TOKEN" });
525511
const response = await client.objects.listObjects({
526512
prefix: "prefix",
527513
sinceTimestamp: "2024-01-15T09:30:00Z",
528514
pageToken: "pageToken",
529-
allObjectsInMesh: true,
515+
allObjectsInMesh: true
530516
});
531517
for await (const item of response) {
532518
console.log(item);
@@ -537,7 +523,7 @@ let page = await client.objects.listObjects({
537523
prefix: "prefix",
538524
sinceTimestamp: "2024-01-15T09:30:00Z",
539525
pageToken: "pageToken",
540-
allObjectsInMesh: true,
526+
allObjectsInMesh: true
541527
});
542528
while (page.hasNextPage()) {
543529
page = page.getNextPage();
@@ -626,8 +612,11 @@ console.log(rawResponse.headers['X-My-Header']);
626612

627613
### Runtime Compatibility
628614

615+
629616
The SDK works in the following runtimes:
630617

618+
619+
631620
- Node.js 18+
632621
- Vercel
633622
- Cloudflare Workers
@@ -641,7 +630,7 @@ The SDK provides a way for you to customize the underlying HTTP client / Fetch f
641630
unsupported environment, this provides a way for you to break glass and ensure the SDK works.
642631

643632
```typescript
644-
import { LatticeClient } from "@anduril-industries/lattice-sdk";
633+
import { LatticeClient } from "Lattice";
645634

646635
const client = new LatticeClient({
647636
...

biome.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
3+
"root": true,
4+
"vcs": {
5+
"enabled": false
6+
},
7+
"files": {
8+
"ignoreUnknown": true,
9+
"includes": [
10+
"./**",
11+
"!dist",
12+
"!lib",
13+
"!*.tsbuildinfo",
14+
"!_tmp_*",
15+
"!*.tmp",
16+
"!.tmp/",
17+
"!*.log",
18+
"!.DS_Store",
19+
"!Thumbs.db"
20+
]
21+
},
22+
"formatter": {
23+
"enabled": true,
24+
"indentStyle": "space",
25+
"indentWidth": 4,
26+
"lineWidth": 120
27+
},
28+
"javascript": {
29+
"formatter": {
30+
"quoteStyle": "double"
31+
}
32+
},
33+
"assist": {
34+
"enabled": true,
35+
"actions": {
36+
"source": {
37+
"organizeImports": "on"
38+
}
39+
}
40+
},
41+
"linter": {
42+
"rules": {
43+
"style": {
44+
"useNodejsImportProtocol": "off"
45+
},
46+
"suspicious": {
47+
"noAssignInExpressions": "warn",
48+
"noUselessEscapeInString": {
49+
"level": "warn",
50+
"fix": "none",
51+
"options": {}
52+
},
53+
"noThenProperty": "warn",
54+
"useIterableCallbackReturn": "warn",
55+
"noShadowRestrictedNames": "warn",
56+
"noTsIgnore": {
57+
"level": "warn",
58+
"fix": "none",
59+
"options": {}
60+
},
61+
"noConfusingVoidType": {
62+
"level": "warn",
63+
"fix": "none",
64+
"options": {}
65+
}
66+
}
67+
}
68+
}
69+
}

jest.config.mjs

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)