Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cliVersion": "0.0.0",
"generatorName": "fernapi/fern-typescript-sdk",
"generatorVersion": "3.31.1",
"generatorConfig": {
"namespaceExport": "Lattice"
}
}
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 }}
10 changes: 0 additions & 10 deletions .npmignore

This file was deleted.

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**
101 changes: 86 additions & 15 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 All @@ -51,7 +51,7 @@ following namespace:
```typescript
import { Lattice } from "@anduril-industries/lattice-sdk";

const request: Lattice.EntityOverride = {
const request: Lattice.GetEntityRequest = {
...
};
```
Expand All @@ -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,26 +533,19 @@ 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({
prefix: "prefix",
sinceTimestamp: "2024-01-15T09:30:00Z",
pageToken: "pageToken",
allObjectsInMesh: true
});
for await (const item of response) {
const pageableResponse = await client.objects.listObjects();
for await (const item of pageableResponse) {
console.log(item);
}

// Or you can manually iterate page-by-page
let page = await client.objects.listObjects({
prefix: "prefix",
sinceTimestamp: "2024-01-15T09:30:00Z",
pageToken: "pageToken",
allObjectsInMesh: true
});
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 Expand Up @@ -620,6 +628,69 @@ console.log(data);
console.log(rawResponse.headers['X-My-Header']);
```

### Logging

The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.

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

const client = new LatticeClient({
...
logging: {
level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
silent: false, // defaults to true, set to false to enable logging
}
});
```
The `logging` object can have the following properties:
- `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
- `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
- `silent`: Whether to silence the logger. Defaults to `true`.

The `level` property can be one of the following values:
- `logging.LogLevel.Debug`
- `logging.LogLevel.Info`
- `logging.LogLevel.Warn`
- `logging.LogLevel.Error`

To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.

<details>
<summary>Custom logger examples</summary>

Here's an example using the popular `winston` logging library.
```ts
import winston from 'winston';

const winstonLogger = winston.createLogger({...});

const logger: logging.ILogger = {
debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
info: (msg, ...args) => winstonLogger.info(msg, ...args),
warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
error: (msg, ...args) => winstonLogger.error(msg, ...args),
};
```

Here's an example using the popular `pino` logging library.

```ts
import pino from 'pino';

const pinoLogger = pino({...});

const logger: logging.ILogger = {
debug: (msg, ...args) => pinoLogger.debug(args, msg),
info: (msg, ...args) => pinoLogger.info(args, msg),
warn: (msg, ...args) => pinoLogger.warn(args, msg),
error: (msg, ...args) => pinoLogger.error(args, msg),
};
```
</details>


### Runtime Compatibility


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
14 changes: 9 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 @@ -40,22 +43,23 @@
"test:unit": "vitest --project unit",
"test:wire": "vitest --project wire"
},
"dependencies": {},
"devDependencies": {
"webpack": "^5.97.1",
"ts-loader": "^9.5.1",
"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