Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v3
uses: actions/setup-node@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
Expand All @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v3
uses: actions/setup-node@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
Expand All @@ -50,7 +50,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up node
uses: actions/setup-node@v3
uses: actions/setup-node@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
Expand All @@ -64,12 +64,15 @@ jobs:
- name: Publish to npm
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
publish() { # use latest npm to ensure OIDC support
npx -y npm@latest publish "$@"
}
if [[ ${GITHUB_REF} == *alpha* ]]; then
npm publish --access public --tag alpha
publish --access public --tag alpha
elif [[ ${GITHUB_REF} == *beta* ]]; then
npm publish --access public --tag beta
publish --access public --tag beta
else
npm publish --access public
publish --access public
fi
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tests
.gitignore
.github
.fernignore
.prettierrc.yml
biome.json
tsconfig.json
yarn.lock
Expand Down
133 changes: 133 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Contributing

Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.

## Getting Started

### Prerequisites

- Node.js 20 or higher
- pnpm package manager

### Installation

Install the project dependencies:

```bash
pnpm install
```

### Building

Build the project:

```bash
pnpm build
```

### Testing

Run the test suite:

```bash
pnpm test
```

Run specific test types:
- `pnpm test:unit` - Run unit tests
- `pnpm test:wire` - Run wire/integration tests

### Linting and Formatting

Check code style:

```bash
pnpm run lint
pnpm run format:check
```

Fix code style issues:

```bash
pnpm run lint:fix
pnpm run format:fix
```

Or use the combined check command:

```bash
pnpm run check:fix
```

## About Generated Code

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

### Generated Files

The following directories contain generated code:
- `src/api/` - API client classes and types
- `src/serialization/` - Serialization/deserialization logic
- Most TypeScript files in `src/`

### How to Customize

If you need to customize the SDK, you have two options:

#### Option 1: Use `.fernignore`

For custom code that should persist across SDK regenerations:

1. Create a `.fernignore` file in the project root
2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
3. Add your custom code to those files

Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.

For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).

#### Option 2: Contribute to the Generator

If you want to change how code is generated for all users of this SDK:

1. The TypeScript SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
2. Generator code is located at `generators/typescript/sdk/`
3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
4. Submit a pull request with your changes to the generator

This approach is best for:
- Bug fixes in generated code
- New features that would benefit all users
- Improvements to code generation patterns

## Making Changes

### Workflow

1. Create a new branch for your changes
2. Make your modifications
3. Run tests to ensure nothing breaks: `pnpm test`
4. Run linting and formatting: `pnpm run check:fix`
5. Build the project: `pnpm build`
6. Commit your changes with a clear commit message
7. Push your branch and create a pull request

### Commit Messages

Write clear, descriptive commit messages that explain what changed and why.

### Code Style

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.

## Questions or Issues?

If you have questions or run into issues:

1. Check the [Fern documentation](https://buildwithfern.com)
2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
3. Open a new issue if your question hasn't been addressed

## License

By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ of any court action, you agree to submit to the exclusive jurisdiction of the co
Notwithstanding this, you agree that Anduril shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal
relief) in any jurisdiction.

**April 14, 2025**
**April 14, 2025**
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For support with this library, please reach out to your Anduril representative.

## Reference

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

## Usage

Expand Down Expand Up @@ -76,6 +76,21 @@ try {
}
```

## Streaming Response

Some endpoints return streaming responses instead of returning the full response at once.
The SDK uses async iterators, so you can consume the responses using a `for await...of` loop.

```typescript
import { LatticeClient } from "@anduril-industries/lattice-sdk";

const client = new LatticeClient({ token: "YOUR_TOKEN" });
const response = await client.entities.streamEntities();
for await (const item of response) {
console.log(item);
}
```

## File Uploads

You can upload files using the client:
Expand Down Expand Up @@ -518,13 +533,13 @@ List endpoints are paginated. The SDK provides an iterator so that you can simpl
import { LatticeClient } from "@anduril-industries/lattice-sdk";

const client = new LatticeClient({ token: "YOUR_TOKEN" });
const response = await client.objects.listObjects({
const pageableResponse = await client.objects.listObjects({
prefix: "prefix",
sinceTimestamp: "2024-01-15T09:30:00Z",
pageToken: "pageToken",
allObjectsInMesh: true
});
for await (const item of response) {
for await (const item of pageableResponse) {
console.log(item);
}

Expand All @@ -538,6 +553,9 @@ let page = await client.objects.listObjects({
while (page.hasNextPage()) {
page = page.getNextPage();
}

// You can also access the underlying response
const response = page.response;
```

## Advanced
Expand Down
27 changes: 16 additions & 11 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.1/schema.json",
"root": true,
"vcs": {
"enabled": false
},
"files": {
"ignoreUnknown": true,
"includes": [
"./**",
"!dist",
"!lib",
"!*.tsbuildinfo",
"!_tmp_*",
"!*.tmp",
"!.tmp/",
"!*.log",
"!.DS_Store",
"!Thumbs.db"
"**",
"!!dist",
"!!**/dist",
"!!lib",
"!!**/lib",
"!!_tmp_*",
"!!**/_tmp_*",
"!!*.tmp",
"!!**/*.tmp",
"!!.tmp/",
"!!**/.tmp/",
"!!*.log",
"!!**/*.log",
"!!**/.DS_Store",
"!!**/Thumbs.db"
]
},
"formatter": {
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@anduril-industries/lattice-sdk",
"version": "3.0.0",
"version": "3.0.1",
"private": false,
"repository": "github:anduril/lattice-sdk-javascript",
"repository": "github:fern-api/lattice-sdk-javascript",
"license": "See LICENSE",
"type": "commonjs",
"main": "./dist/cjs/index.js",
Expand Down Expand Up @@ -31,6 +31,9 @@
],
"scripts": {
"format": "biome format --write --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
"format:check": "biome format --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
"lint": "biome lint --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
"lint:fix": "biome lint --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
"check": "biome check --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
"check:fix": "biome check --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
"build": "pnpm build:cjs && pnpm build:esm",
Expand All @@ -46,16 +49,16 @@
"vitest": "^3.2.4",
"msw": "2.11.2",
"@types/node": "^18.19.70",
"@biomejs/biome": "2.2.5",
"typescript": "~5.7.2"
"typescript": "~5.7.2",
"@biomejs/biome": "2.3.1"
},
"browser": {
"fs": false,
"os": false,
"path": false,
"stream": false
},
"packageManager": "pnpm@10.14.0",
"packageManager": "pnpm@10.20.0",
"engines": {
"node": ">=18.0.0"
},
Expand Down
Loading