Skip to content

Commit df56bbe

Browse files
SDK regeneration
1 parent d1c5a00 commit df56bbe

File tree

252 files changed

+3905
-5533
lines changed

Some content is hidden

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

252 files changed

+3905
-5533
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ jobs:
1111
uses: actions/checkout@v4
1212

1313
- name: Set up node
14-
uses: actions/setup-node@v3
14+
uses: actions/setup-node@v4
15+
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: Install dependencies
20+
run: pnpm install
1521

1622
- name: Compile
17-
run: yarn && yarn build
23+
run: pnpm build
1824

1925
test:
2026
runs-on: ubuntu-latest
@@ -24,10 +30,16 @@ jobs:
2430
uses: actions/checkout@v4
2531

2632
- name: Set up node
27-
uses: actions/setup-node@v3
33+
uses: actions/setup-node@v4
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,22 +48,31 @@ jobs:
3648
steps:
3749
- name: Checkout repo
3850
uses: actions/checkout@v4
51+
3952
- name: Set up node
40-
uses: actions/setup-node@v3
53+
uses: actions/setup-node@v4
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: |
4866
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
67+
publish() { # use latest npm to ensure OIDC support
68+
npx -y npm@latest publish "$@"
69+
}
4970
if [[ ${GITHUB_REF} == *alpha* ]]; then
50-
npm publish --access public --tag alpha
71+
publish --access public --tag alpha
5172
elif [[ ${GITHUB_REF} == *beta* ]]; then
52-
npm publish --access public --tag beta
73+
publish --access public --tag beta
5374
else
54-
npm publish --access public
75+
publish --access public
5576
fi
5677
env:
5778
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ tests
55
.github
66
.fernignore
77
.prettierrc.yml
8+
biome.json
89
tsconfig.json
910
yarn.lock
1011
pnpm-lock.yaml

.prettierrc.yml

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

CONTRIBUTING.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.
4+
5+
## Getting Started
6+
7+
### Prerequisites
8+
9+
- Node.js 20 or higher
10+
- pnpm package manager
11+
12+
### Installation
13+
14+
Install the project dependencies:
15+
16+
```bash
17+
pnpm install
18+
```
19+
20+
### Building
21+
22+
Build the project:
23+
24+
```bash
25+
pnpm build
26+
```
27+
28+
### Testing
29+
30+
Run the test suite:
31+
32+
```bash
33+
pnpm test
34+
```
35+
36+
Run specific test types:
37+
- `pnpm test:unit` - Run unit tests
38+
- `pnpm test:wire` - Run wire/integration tests
39+
40+
### Linting and Formatting
41+
42+
Check code style:
43+
44+
```bash
45+
pnpm run lint
46+
pnpm run format:check
47+
```
48+
49+
Fix code style issues:
50+
51+
```bash
52+
pnpm run lint:fix
53+
pnpm run format:fix
54+
```
55+
56+
Or use the combined check command:
57+
58+
```bash
59+
pnpm run check:fix
60+
```
61+
62+
## About Generated Code
63+
64+
**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.
65+
66+
### Generated Files
67+
68+
The following directories contain generated code:
69+
- `src/api/` - API client classes and types
70+
- `src/serialization/` - Serialization/deserialization logic
71+
- Most TypeScript files in `src/`
72+
73+
### How to Customize
74+
75+
If you need to customize the SDK, you have two options:
76+
77+
#### Option 1: Use `.fernignore`
78+
79+
For custom code that should persist across SDK regenerations:
80+
81+
1. Create a `.fernignore` file in the project root
82+
2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
83+
3. Add your custom code to those files
84+
85+
Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.
86+
87+
For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).
88+
89+
#### Option 2: Contribute to the Generator
90+
91+
If you want to change how code is generated for all users of this SDK:
92+
93+
1. The TypeScript SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
94+
2. Generator code is located at `generators/typescript/sdk/`
95+
3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
96+
4. Submit a pull request with your changes to the generator
97+
98+
This approach is best for:
99+
- Bug fixes in generated code
100+
- New features that would benefit all users
101+
- Improvements to code generation patterns
102+
103+
## Making Changes
104+
105+
### Workflow
106+
107+
1. Create a new branch for your changes
108+
2. Make your modifications
109+
3. Run tests to ensure nothing breaks: `pnpm test`
110+
4. Run linting and formatting: `pnpm run check:fix`
111+
5. Build the project: `pnpm build`
112+
6. Commit your changes with a clear commit message
113+
7. Push your branch and create a pull request
114+
115+
### Commit Messages
116+
117+
Write clear, descriptive commit messages that explain what changed and why.
118+
119+
### Code Style
120+
121+
This project uses automated code formatting and linting. Run `pnpm run check:fix` before committing to ensure your code meets the project's style guidelines.
122+
123+
## Questions or Issues?
124+
125+
If you have questions or run into issues:
126+
127+
1. Check the [Fern documentation](https://buildwithfern.com)
128+
2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
129+
3. Open a new issue if your question hasn't been addressed
130+
131+
## License
132+
133+
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,4 @@ of any court action, you agree to submit to the exclusive jurisdiction of the co
186186
Notwithstanding this, you agree that Anduril shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal
187187
relief) in any jurisdiction.
188188

189-
**April 14, 2025**
189+
**April 14, 2025**

README.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ For support with this library, please reach out to your Anduril representative.
2828

2929
## Reference
3030

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

3333
## Usage
3434

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

@@ -76,6 +76,21 @@ try {
7676
}
7777
```
7878

79+
## Streaming Response
80+
81+
Some endpoints return streaming responses instead of returning the full response at once.
82+
The SDK uses async iterators, so you can consume the responses using a `for await...of` loop.
83+
84+
```typescript
85+
import { LatticeClient } from "@anduril-industries/lattice-sdk";
86+
87+
const client = new LatticeClient({ token: "YOUR_TOKEN" });
88+
const response = await client.entities.streamEntities();
89+
for await (const item of response) {
90+
console.log(item);
91+
}
92+
```
93+
7994
## File Uploads
8095

8196
You can upload files using the client:
@@ -91,39 +106,36 @@ await client.objects.uploadObject(new File(['binary data'], 'file.mp3'), ...);
91106
await client.objects.uploadObject(new ArrayBuffer(8), ...);
92107
await client.objects.uploadObject(new Uint8Array([0, 1, 2]), ...);
93108
```
94-
95109
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`
110+
* Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
111+
* Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
99112

100113
### Metadata
101114

102115
You can configure metadata when uploading a file:
103-
104116
```typescript
105117
const file: Uploadable.WithMetadata = {
106118
data: createReadStream("path/to/file"),
107-
filename: "my-file", // optional
119+
filename: "my-file", // optional
108120
contentType: "audio/mpeg", // optional
109-
contentLength: 1949, // optional
121+
contentLength: 1949, // optional
110122
};
111123
```
112124

113125
Alternatively, you can upload a file directly from a file path:
114-
115126
```typescript
116-
const file: Uploadable.FromPath = {
127+
const file : Uploadable.FromPath = {
117128
path: "path/to/file",
118-
filename: "my-file", // optional
119-
contentType: "audio/mpeg", // optional
120-
contentLength: 1949, // optional
129+
filename: "my-file", // optional
130+
contentType: "audio/mpeg", // optional
131+
contentLength: 1949, // optional
121132
};
122133
```
123134

124135
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.
125136
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.
126137

138+
127139
## Binary Response
128140

129141
You can consume binary data from endpoints using the `BinaryResponse` type which lets you choose how to consume the data:
@@ -138,7 +150,6 @@ const stream: ReadableStream<Uint8Array> = response.stream();
138150
// If you want to check if the response body has been used, you can use the following property.
139151
const bodyUsed = response.bodyUsed;
140152
```
141-
142153
<details>
143154
<summary>Save binary response to a file</summary>
144155

@@ -522,13 +533,13 @@ List endpoints are paginated. The SDK provides an iterator so that you can simpl
522533
import { LatticeClient } from "@anduril-industries/lattice-sdk";
523534

524535
const client = new LatticeClient({ token: "YOUR_TOKEN" });
525-
const response = await client.objects.listObjects({
536+
const pageableResponse = await client.objects.listObjects({
526537
prefix: "prefix",
527538
sinceTimestamp: "2024-01-15T09:30:00Z",
528539
pageToken: "pageToken",
529-
allObjectsInMesh: true,
540+
allObjectsInMesh: true
530541
});
531-
for await (const item of response) {
542+
for await (const item of pageableResponse) {
532543
console.log(item);
533544
}
534545

@@ -537,11 +548,14 @@ let page = await client.objects.listObjects({
537548
prefix: "prefix",
538549
sinceTimestamp: "2024-01-15T09:30:00Z",
539550
pageToken: "pageToken",
540-
allObjectsInMesh: true,
551+
allObjectsInMesh: true
541552
});
542553
while (page.hasNextPage()) {
543554
page = page.getNextPage();
544555
}
556+
557+
// You can also access the underlying response
558+
const response = page.response;
545559
```
546560

547561
## Advanced
@@ -626,8 +640,11 @@ console.log(rawResponse.headers['X-My-Header']);
626640

627641
### Runtime Compatibility
628642

643+
629644
The SDK works in the following runtimes:
630645

646+
647+
631648
- Node.js 18+
632649
- Vercel
633650
- Cloudflare Workers

0 commit comments

Comments
 (0)