Skip to content

Commit 603c459

Browse files
authored
Merge pull request #71 from fern-api/jsklan/merge-from-upstream
Jsklan/merge from upstream
2 parents d1c5a00 + 2394016 commit 603c459

File tree

245 files changed

+3354
-5485
lines changed

Some content is hidden

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

245 files changed

+3354
-5485
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 5 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,9 +31,15 @@ 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
38+
- name: Install dependencies
39+
run: pnpm install
40+
41+
- name: Test
42+
run: pnpm test
3143

3244
publish:
3345
needs: [ compile, test ]
@@ -36,12 +48,18 @@ jobs:
3648
steps:
3749
- name: Checkout repo
3850
uses: actions/checkout@v4
51+
3952
- name: Set up node
4053
uses: actions/setup-node@v3
54+
55+
- name: Install pnpm
56+
uses: pnpm/action-setup@v4
57+
4158
- name: Install dependencies
42-
run: yarn install
59+
run: pnpm install
60+
4361
- name: Build
44-
run: yarn build
62+
run: pnpm build
4563

4664
- name: Publish to npm
4765
run: |

.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.

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

jest.config.mjs

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

package.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@anduril-industries/lattice-sdk",
3-
"version": "2.3.0",
3+
"version": "3.0.0",
44
"private": false,
55
"repository": "github:anduril/lattice-sdk-javascript",
66
"license": "See LICENSE",
@@ -30,26 +30,23 @@
3030
"LICENSE"
3131
],
3232
"scripts": {
33-
"format": "prettier . --write --ignore-unknown",
34-
"build": "yarn build:cjs && yarn build:esm",
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",
36+
"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",
37-
"test": "jest --config jest.config.mjs",
38-
"test:unit": "jest --selectProjects unit",
39-
"test:browser": "jest --selectProjects browser",
40-
"test:wire": "jest --selectProjects wire"
39+
"test": "vitest",
40+
"test:unit": "vitest --project unit",
41+
"test:wire": "vitest --project wire"
4142
},
4243
"devDependencies": {
4344
"webpack": "^5.97.1",
4445
"ts-loader": "^9.5.1",
45-
"jest": "^29.7.0",
46-
"@jest/globals": "^29.7.0",
47-
"@types/jest": "^29.5.14",
48-
"ts-jest": "^29.3.4",
49-
"jest-environment-jsdom": "^29.7.0",
50-
"msw": "^2.8.4",
46+
"vitest": "^3.2.4",
47+
"msw": "2.11.2",
5148
"@types/node": "^18.19.70",
52-
"prettier": "^3.4.2",
49+
"@biomejs/biome": "2.2.5",
5350
"typescript": "~5.7.2"
5451
},
5552
"browser": {
@@ -58,7 +55,7 @@
5855
"path": false,
5956
"stream": false
6057
},
61-
"packageManager": "[email protected]",
58+
"packageManager": "[email protected]",
6259
"engines": {
6360
"node": ">=18.0.0"
6461
},

0 commit comments

Comments
 (0)