@anduril-industries/lattice-sdk 4.7.1 → 4.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -670,11 +670,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque
670
670
  as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
671
671
  retry limit (default: 2).
672
672
 
673
- A request is deemed retryable when any of the following HTTP status codes is returned:
673
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
674
674
 
675
+ **`legacy`** (current default): retries on
675
676
  - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
676
677
  - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
677
- - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
678
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
679
+
680
+ **`recommended`**: retries on
681
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
682
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
683
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
684
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
685
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
678
686
 
679
687
  Use the `maxRetries` request option to configure this behavior.
680
688
 
@@ -1,6 +1,7 @@
1
1
  import { OAuthAuthProvider } from "./auth/OAuthAuthProvider.js";
2
2
  import * as core from "./core/index.js";
3
3
  import type * as environments from "./environments.js";
4
+ export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | OAuthAuthProvider.AuthOptions;
4
5
  export type BaseClientOptions = {
5
6
  environment?: core.Supplier<environments.LatticeEnvironment | string>;
6
7
  /** Specify a custom URL to connect the client to. */
@@ -15,6 +16,8 @@ export type BaseClientOptions = {
15
16
  fetch?: typeof fetch;
16
17
  /** Configure logging for the client. */
17
18
  logging?: core.logging.LogConfig | core.logging.Logger;
19
+ /** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
20
+ auth?: AuthOption;
18
21
  } & OAuthAuthProvider.AuthOptions;
19
22
  export interface BaseRequestOptions {
20
23
  /** The maximum time to wait for a response in seconds. */
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@anduril-industries/lattice-sdk",
46
- "X-Fern-SDK-Version": "4.7.1",
47
- "User-Agent": "@anduril-industries/lattice-sdk/4.7.1",
46
+ "X-Fern-SDK-Version": "4.8.1",
47
+ "User-Agent": "@anduril-industries/lattice-sdk/4.8.1",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -53,6 +53,21 @@ function normalizeClientOptions(options) {
53
53
  function normalizeClientOptionsWithAuth(options) {
54
54
  var _a;
55
55
  const normalized = normalizeClientOptions(options);
56
+ if (options.auth === false) {
57
+ normalized.authProvider = new core.NoOpAuthProvider();
58
+ return normalized;
59
+ }
60
+ if (options.auth != null) {
61
+ if (typeof options.auth === "function") {
62
+ normalized.authProvider = { getAuthRequest: options.auth };
63
+ return normalized;
64
+ }
65
+ if (core.isAuthProvider(options.auth)) {
66
+ normalized.authProvider = options.auth;
67
+ return normalized;
68
+ }
69
+ Object.assign(normalized, options.auth);
70
+ }
56
71
  const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
57
72
  (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = OAuthAuthProvider_js_1.OAuthAuthProvider.createInstance(normalizedWithNoOpAuthProvider));
58
73
  return normalized;
@@ -83,7 +83,7 @@ export interface Entity {
83
83
  targetPriority?: Lattice.TargetPriority | undefined;
84
84
  /** Describes an entity's signal characteristics, primarily used when an entity is a signal of interest. */
85
85
  signal?: Lattice.Signal | undefined;
86
- /** A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S interrogations. These are related to ADS-B modes. */
86
+ /** A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S, C interrogations. These are related to ADS-B modes. */
87
87
  transponderCodes?: Lattice.TransponderCodes | undefined;
88
88
  /**
89
89
  * Describes an entity's security classification levels at an overall classification level and on a per
@@ -1,6 +1,6 @@
1
1
  import type * as Lattice from "../index.js";
2
2
  /**
3
- * A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S interrogations.
3
+ * A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S, C interrogations.
4
4
  */
5
5
  export interface TransponderCodes {
6
6
  /** The mode 1 code assigned to military assets. */
@@ -15,6 +15,11 @@ export interface TransponderCodes {
15
15
  mode5?: Lattice.Mode5 | undefined;
16
16
  /** The Mode S transponder codes. */
17
17
  modeS?: Lattice.ModeS | undefined;
18
+ /**
19
+ * The Mode C altitude reported by the transponder in feet. Mode C provides pressure altitude in 100-foot increments up
20
+ * to 10,000 feet MSL. Valid altitudes include 0 ft (sea level). An unset field indicates no Mode C response was received.
21
+ */
22
+ modeCAltitudeFt?: number | undefined;
18
23
  }
19
24
  export declare namespace TransponderCodes {
20
25
  /** The validity of the response from the Mode 4 interrogation. */
@@ -5,3 +5,4 @@ export interface AuthProvider {
5
5
  endpointMetadata?: EndpointMetadata;
6
6
  }): Promise<AuthRequest>;
7
7
  }
8
+ export declare function isAuthProvider(value: unknown): value is AuthProvider;
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAuthProvider = isAuthProvider;
4
+ function isAuthProvider(value) {
5
+ return (typeof value === "object" &&
6
+ value !== null &&
7
+ "getAuthRequest" in value &&
8
+ typeof value.getAuthRequest === "function");
9
+ }
@@ -1,4 +1,4 @@
1
- export type { AuthProvider } from "./AuthProvider.js";
1
+ export { type AuthProvider, isAuthProvider } from "./AuthProvider.js";
2
2
  export type { AuthRequest } from "./AuthRequest.js";
3
3
  export { BasicAuth } from "./BasicAuth.js";
4
4
  export { BearerToken } from "./BearerToken.js";
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = void 0;
3
+ exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = exports.isAuthProvider = void 0;
4
+ var AuthProvider_js_1 = require("./AuthProvider.js");
5
+ Object.defineProperty(exports, "isAuthProvider", { enumerable: true, get: function () { return AuthProvider_js_1.isAuthProvider; } });
4
6
  var BasicAuth_js_1 = require("./BasicAuth.js");
5
7
  Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_js_1.BasicAuth; } });
6
8
  var BearerToken_js_1 = require("./BearerToken.js");
@@ -14,6 +14,9 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
14
14
  const MAX_RETRY_DELAY = 60000; // in milliseconds
15
15
  const DEFAULT_MAX_RETRIES = 2;
16
16
  const JITTER_FACTOR = 0.2; // 20% random jitter
17
+ function isRetryableStatusCode(statusCode) {
18
+ return [408, 429].includes(statusCode) || statusCode >= 500;
19
+ }
17
20
  function addPositiveJitter(delay) {
18
21
  const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
19
22
  return delay * jitterMultiplier;
@@ -53,7 +56,7 @@ function requestWithRetries(requestFn_1) {
53
56
  return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
54
57
  let response = yield requestFn();
55
58
  for (let i = 0; i < maxRetries; ++i) {
56
- if ([408, 429].includes(response.status) || response.status >= 500) {
59
+ if (isRetryableStatusCode(response.status)) {
57
60
  const delay = getRetryDelayFromHeaders(response, i);
58
61
  yield new Promise((resolve) => setTimeout(resolve, delay));
59
62
  response = yield requestFn();
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.7.1";
1
+ export declare const SDK_VERSION = "4.8.1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "4.7.1";
4
+ exports.SDK_VERSION = "4.8.1";
@@ -1,6 +1,7 @@
1
1
  import { OAuthAuthProvider } from "./auth/OAuthAuthProvider.mjs";
2
2
  import * as core from "./core/index.mjs";
3
3
  import type * as environments from "./environments.mjs";
4
+ export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | OAuthAuthProvider.AuthOptions;
4
5
  export type BaseClientOptions = {
5
6
  environment?: core.Supplier<environments.LatticeEnvironment | string>;
6
7
  /** Specify a custom URL to connect the client to. */
@@ -15,6 +16,8 @@ export type BaseClientOptions = {
15
16
  fetch?: typeof fetch;
16
17
  /** Configure logging for the client. */
17
18
  logging?: core.logging.LogConfig | core.logging.Logger;
19
+ /** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
20
+ auth?: AuthOption;
18
21
  } & OAuthAuthProvider.AuthOptions;
19
22
  export interface BaseRequestOptions {
20
23
  /** The maximum time to wait for a response in seconds. */
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@anduril-industries/lattice-sdk",
9
- "X-Fern-SDK-Version": "4.7.1",
10
- "User-Agent": "@anduril-industries/lattice-sdk/4.7.1",
9
+ "X-Fern-SDK-Version": "4.8.1",
10
+ "User-Agent": "@anduril-industries/lattice-sdk/4.8.1",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -16,6 +16,21 @@ export function normalizeClientOptions(options) {
16
16
  export function normalizeClientOptionsWithAuth(options) {
17
17
  var _a;
18
18
  const normalized = normalizeClientOptions(options);
19
+ if (options.auth === false) {
20
+ normalized.authProvider = new core.NoOpAuthProvider();
21
+ return normalized;
22
+ }
23
+ if (options.auth != null) {
24
+ if (typeof options.auth === "function") {
25
+ normalized.authProvider = { getAuthRequest: options.auth };
26
+ return normalized;
27
+ }
28
+ if (core.isAuthProvider(options.auth)) {
29
+ normalized.authProvider = options.auth;
30
+ return normalized;
31
+ }
32
+ Object.assign(normalized, options.auth);
33
+ }
19
34
  const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
20
35
  (_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = OAuthAuthProvider.createInstance(normalizedWithNoOpAuthProvider));
21
36
  return normalized;
@@ -83,7 +83,7 @@ export interface Entity {
83
83
  targetPriority?: Lattice.TargetPriority | undefined;
84
84
  /** Describes an entity's signal characteristics, primarily used when an entity is a signal of interest. */
85
85
  signal?: Lattice.Signal | undefined;
86
- /** A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S interrogations. These are related to ADS-B modes. */
86
+ /** A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S, C interrogations. These are related to ADS-B modes. */
87
87
  transponderCodes?: Lattice.TransponderCodes | undefined;
88
88
  /**
89
89
  * Describes an entity's security classification levels at an overall classification level and on a per
@@ -1,6 +1,6 @@
1
1
  import type * as Lattice from "../index.mjs";
2
2
  /**
3
- * A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S interrogations.
3
+ * A message describing any transponder codes associated with Mode 1, 2, 3, 4, 5, S, C interrogations.
4
4
  */
5
5
  export interface TransponderCodes {
6
6
  /** The mode 1 code assigned to military assets. */
@@ -15,6 +15,11 @@ export interface TransponderCodes {
15
15
  mode5?: Lattice.Mode5 | undefined;
16
16
  /** The Mode S transponder codes. */
17
17
  modeS?: Lattice.ModeS | undefined;
18
+ /**
19
+ * The Mode C altitude reported by the transponder in feet. Mode C provides pressure altitude in 100-foot increments up
20
+ * to 10,000 feet MSL. Valid altitudes include 0 ft (sea level). An unset field indicates no Mode C response was received.
21
+ */
22
+ modeCAltitudeFt?: number | undefined;
18
23
  }
19
24
  export declare namespace TransponderCodes {
20
25
  /** The validity of the response from the Mode 4 interrogation. */
@@ -5,3 +5,4 @@ export interface AuthProvider {
5
5
  endpointMetadata?: EndpointMetadata;
6
6
  }): Promise<AuthRequest>;
7
7
  }
8
+ export declare function isAuthProvider(value: unknown): value is AuthProvider;
@@ -1 +1,6 @@
1
- export {};
1
+ export function isAuthProvider(value) {
2
+ return (typeof value === "object" &&
3
+ value !== null &&
4
+ "getAuthRequest" in value &&
5
+ typeof value.getAuthRequest === "function");
6
+ }
@@ -1,4 +1,4 @@
1
- export type { AuthProvider } from "./AuthProvider.mjs";
1
+ export { type AuthProvider, isAuthProvider } from "./AuthProvider.mjs";
2
2
  export type { AuthRequest } from "./AuthRequest.mjs";
3
3
  export { BasicAuth } from "./BasicAuth.mjs";
4
4
  export { BearerToken } from "./BearerToken.mjs";
@@ -1,3 +1,4 @@
1
+ export { isAuthProvider } from "./AuthProvider.mjs";
1
2
  export { BasicAuth } from "./BasicAuth.mjs";
2
3
  export { BearerToken } from "./BearerToken.mjs";
3
4
  export { NoOpAuthProvider } from "./NoOpAuthProvider.mjs";
@@ -11,6 +11,9 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
11
11
  const MAX_RETRY_DELAY = 60000; // in milliseconds
12
12
  const DEFAULT_MAX_RETRIES = 2;
13
13
  const JITTER_FACTOR = 0.2; // 20% random jitter
14
+ function isRetryableStatusCode(statusCode) {
15
+ return [408, 429].includes(statusCode) || statusCode >= 500;
16
+ }
14
17
  function addPositiveJitter(delay) {
15
18
  const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
16
19
  return delay * jitterMultiplier;
@@ -50,7 +53,7 @@ export function requestWithRetries(requestFn_1) {
50
53
  return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
51
54
  let response = yield requestFn();
52
55
  for (let i = 0; i < maxRetries; ++i) {
53
- if ([408, 429].includes(response.status) || response.status >= 500) {
56
+ if (isRetryableStatusCode(response.status)) {
54
57
  const delay = getRetryDelayFromHeaders(response, i);
55
58
  yield new Promise((resolve) => setTimeout(resolve, delay));
56
59
  response = yield requestFn();
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.7.1";
1
+ export declare const SDK_VERSION = "4.8.1";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.7.1";
1
+ export const SDK_VERSION = "4.8.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anduril-industries/lattice-sdk",
3
- "version": "4.7.1",
3
+ "version": "4.8.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",