Skip to content

Commit 46360db

Browse files
fix!: Correctly model the status field (#181)
1 parent acd7680 commit 46360db

File tree

230 files changed

+1470
-2259
lines changed

Some content is hidden

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

230 files changed

+1470
-2259
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,73 @@ name: ci
33
on: [push]
44

55
jobs:
6-
compile:
7-
runs-on: ubuntu-latest
8-
9-
steps:
10-
- name: Checkout repo
11-
uses: actions/checkout@v4
12-
13-
- name: Set up node
14-
uses: actions/setup-node@v3
15-
16-
- name: Install pnpm
17-
uses: pnpm/action-setup@v4
18-
19-
- name: Install dependencies
20-
run: pnpm install
21-
22-
- name: Compile
23-
run: pnpm build
24-
25-
test:
26-
runs-on: ubuntu-latest
27-
28-
steps:
29-
- name: Checkout repo
30-
uses: actions/checkout@v4
31-
32-
- name: Set up node
33-
uses: actions/setup-node@v3
34-
35-
- name: Install pnpm
36-
uses: pnpm/action-setup@v4
37-
38-
- name: Install dependencies
39-
run: pnpm install
40-
41-
- name: Test
42-
run: pnpm test
43-
44-
publish:
45-
needs: [compile, test]
46-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: Checkout repo
50-
uses: actions/checkout@v4
51-
52-
- name: Set up node
53-
uses: actions/setup-node@v3
54-
55-
- name: Install pnpm
56-
uses: pnpm/action-setup@v4
57-
58-
- name: Install dependencies
59-
run: pnpm install
60-
61-
- name: Build
62-
run: pnpm build
63-
64-
- name: Publish to npm
65-
run: |
66-
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
67-
if [[ ${GITHUB_REF} == *alpha* ]]; then
68-
npm publish --access public --tag alpha
69-
elif [[ ${GITHUB_REF} == *beta* ]]; then
70-
npm publish --access public --tag beta
71-
else
72-
npm publish --access public
73-
fi
74-
env:
75-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6+
compile:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout repo
11+
uses: actions/checkout@v4
12+
13+
- name: Set up node
14+
uses: actions/setup-node@v3
15+
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: Install dependencies
20+
run: pnpm install
21+
22+
- name: Compile
23+
run: pnpm build
24+
25+
test:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout repo
30+
uses: actions/checkout@v4
31+
32+
- name: Set up node
33+
uses: actions/setup-node@v3
34+
35+
- name: Install pnpm
36+
uses: pnpm/action-setup@v4
37+
38+
- name: Install dependencies
39+
run: pnpm install
40+
41+
- name: Test
42+
run: pnpm test
43+
44+
publish:
45+
needs: [ compile, test ]
46+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout repo
50+
uses: actions/checkout@v4
51+
52+
- name: Set up node
53+
uses: actions/setup-node@v3
54+
55+
- name: Install pnpm
56+
uses: pnpm/action-setup@v4
57+
58+
- name: Install dependencies
59+
run: pnpm install
60+
61+
- name: Build
62+
run: pnpm build
63+
64+
- name: Publish to npm
65+
run: |
66+
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
67+
if [[ ${GITHUB_REF} == *alpha* ]]; then
68+
npm publish --access public --tag alpha
69+
elif [[ ${GITHUB_REF} == *beta* ]]; then
70+
npm publish --access public --tag beta
71+
else
72+
npm publish --access public
73+
fi
74+
env:
75+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.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

.prettierignore

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

.prettierrc.yml

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

README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { LatticeClient } from "@anduril-industries/lattice-sdk";
3939

4040
const client = new LatticeClient({ token: "YOUR_TOKEN" });
4141
await client.entities.longPollEntityEvents({
42-
sessionToken: "sessionToken",
42+
sessionToken: "sessionToken"
4343
});
4444
```
4545

@@ -91,39 +91,36 @@ await client.objects.uploadObject(new File(['binary data'], 'file.mp3'), ...);
9191
await client.objects.uploadObject(new ArrayBuffer(8), ...);
9292
await client.objects.uploadObject(new Uint8Array([0, 1, 2]), ...);
9393
```
94-
9594
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`
95+
* Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
96+
* Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
9997

10098
### Metadata
10199

102100
You can configure metadata when uploading a file:
103-
104101
```typescript
105102
const file: Uploadable.WithMetadata = {
106103
data: createReadStream("path/to/file"),
107-
filename: "my-file", // optional
104+
filename: "my-file", // optional
108105
contentType: "audio/mpeg", // optional
109-
contentLength: 1949, // optional
106+
contentLength: 1949, // optional
110107
};
111108
```
112109

113110
Alternatively, you can upload a file directly from a file path:
114-
115111
```typescript
116-
const file: Uploadable.FromPath = {
112+
const file : Uploadable.FromPath = {
117113
path: "path/to/file",
118-
filename: "my-file", // optional
119-
contentType: "audio/mpeg", // optional
120-
contentLength: 1949, // optional
114+
filename: "my-file", // optional
115+
contentType: "audio/mpeg", // optional
116+
contentLength: 1949, // optional
121117
};
122118
```
123119

124120
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.
125121
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.
126122

123+
127124
## Binary Response
128125

129126
You can consume binary data from endpoints using the `BinaryResponse` type which lets you choose how to consume the data:
@@ -138,7 +135,6 @@ const stream: ReadableStream<Uint8Array> = response.stream();
138135
// If you want to check if the response body has been used, you can use the following property.
139136
const bodyUsed = response.bodyUsed;
140137
```
141-
142138
<details>
143139
<summary>Save binary response to a file</summary>
144140

@@ -526,7 +522,7 @@ const response = await client.objects.listObjects({
526522
prefix: "prefix",
527523
sinceTimestamp: "2024-01-15T09:30:00Z",
528524
pageToken: "pageToken",
529-
allObjectsInMesh: true,
525+
allObjectsInMesh: true
530526
});
531527
for await (const item of response) {
532528
console.log(item);
@@ -537,7 +533,7 @@ let page = await client.objects.listObjects({
537533
prefix: "prefix",
538534
sinceTimestamp: "2024-01-15T09:30:00Z",
539535
pageToken: "pageToken",
540-
allObjectsInMesh: true,
536+
allObjectsInMesh: true
541537
});
542538
while (page.hasNextPage()) {
543539
page = page.getNextPage();
@@ -626,8 +622,11 @@ console.log(rawResponse.headers['X-My-Header']);
626622

627623
### Runtime Compatibility
628624

625+
629626
The SDK works in the following runtimes:
630627

628+
629+
631630
- Node.js 18+
632631
- Vercel
633632
- Cloudflare Workers

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+
}

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@anduril-industries/lattice-sdk",
3-
"version": "2.4.0",
3+
"version": "2.5.0",
44
"private": false,
55
"repository": "github:anduril/lattice-sdk-javascript",
66
"license": "See LICENSE",
@@ -30,7 +30,9 @@
3030
"LICENSE"
3131
],
3232
"scripts": {
33-
"format": "prettier . --write --ignore-unknown",
33+
"format": "biome format --write --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
34+
"check": "biome check --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
35+
"check:fix": "biome check --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
3436
"build": "pnpm build:cjs && pnpm build:esm",
3537
"build:cjs": "tsc --project ./tsconfig.cjs.json",
3638
"build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm",
@@ -44,7 +46,7 @@
4446
"vitest": "^3.2.4",
4547
"msw": "2.11.2",
4648
"@types/node": "^18.19.70",
47-
"prettier": "^3.4.2",
49+
"@biomejs/biome": "2.2.5",
4850
"typescript": "~5.7.2"
4951
},
5052
"browser": {

0 commit comments

Comments
 (0)