@anduril-industries/lattice-sdk 4.7.0 → 4.8.0
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 +10 -2
- package/dist/cjs/BaseClient.d.ts +3 -0
- package/dist/cjs/BaseClient.js +17 -2
- package/dist/cjs/api/resources/entities/client/Client.js +6 -6
- package/dist/cjs/api/resources/oauth/client/Client.js +1 -1
- package/dist/cjs/api/resources/objects/client/Client.js +9 -5
- package/dist/cjs/api/resources/tasks/client/Client.js +9 -9
- package/dist/cjs/api/types/TransponderCodes.d.ts +6 -1
- package/dist/cjs/core/auth/AuthProvider.d.ts +1 -0
- package/dist/cjs/core/auth/AuthProvider.js +7 -0
- package/dist/cjs/core/auth/index.d.ts +1 -1
- package/dist/cjs/core/auth/index.js +3 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +6 -0
- package/dist/cjs/core/fetcher/Fetcher.js +9 -8
- package/dist/cjs/core/fetcher/requestWithRetries.js +4 -1
- package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
- package/dist/cjs/core/url/index.d.ts +1 -0
- package/dist/cjs/core/url/index.js +3 -1
- package/dist/cjs/core/url/qs.d.ts +2 -1
- package/dist/cjs/core/url/qs.js +24 -12
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +3 -0
- package/dist/esm/BaseClient.mjs +17 -2
- package/dist/esm/api/resources/entities/client/Client.mjs +6 -6
- package/dist/esm/api/resources/oauth/client/Client.mjs +1 -1
- package/dist/esm/api/resources/objects/client/Client.mjs +9 -5
- package/dist/esm/api/resources/tasks/client/Client.mjs +9 -9
- package/dist/esm/api/types/TransponderCodes.d.mts +6 -1
- package/dist/esm/core/auth/AuthProvider.d.mts +1 -0
- package/dist/esm/core/auth/AuthProvider.mjs +6 -1
- package/dist/esm/core/auth/index.d.mts +1 -1
- package/dist/esm/core/auth/index.mjs +1 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +6 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +9 -8
- package/dist/esm/core/fetcher/requestWithRetries.mjs +4 -1
- package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
- package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
- package/dist/esm/core/url/index.d.mts +1 -0
- package/dist/esm/core/url/index.mjs +1 -0
- package/dist/esm/core/url/qs.d.mts +2 -1
- package/dist/esm/core/url/qs.mjs +24 -12
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
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
|
-
|
|
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
|
|
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
|
|
package/dist/cjs/BaseClient.d.ts
CHANGED
|
@@ -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. */
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -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.
|
|
47
|
-
"User-Agent": "@anduril-industries/lattice-sdk/4.
|
|
46
|
+
"X-Fern-SDK-Version": "4.8.0",
|
|
47
|
+
"User-Agent": "@anduril-industries/lattice-sdk/4.8.0",
|
|
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;
|
|
@@ -100,7 +100,7 @@ class EntitiesClient {
|
|
|
100
100
|
method: "PUT",
|
|
101
101
|
headers: _headers,
|
|
102
102
|
contentType: "application/json",
|
|
103
|
-
|
|
103
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
104
104
|
requestType: "json",
|
|
105
105
|
body: request,
|
|
106
106
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -155,7 +155,7 @@ class EntitiesClient {
|
|
|
155
155
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/entities/${core.url.encodePathParam(entityId)}`),
|
|
156
156
|
method: "GET",
|
|
157
157
|
headers: _headers,
|
|
158
|
-
|
|
158
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
159
159
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
160
160
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
161
161
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -220,7 +220,7 @@ class EntitiesClient {
|
|
|
220
220
|
method: "PUT",
|
|
221
221
|
headers: _headers,
|
|
222
222
|
contentType: "application/json",
|
|
223
|
-
|
|
223
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
224
224
|
requestType: "json",
|
|
225
225
|
body: _body,
|
|
226
226
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -280,7 +280,7 @@ class EntitiesClient {
|
|
|
280
280
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/entities/${core.url.encodePathParam(entityId)}/override/${core.url.encodePathParam(fieldPath)}`),
|
|
281
281
|
method: "DELETE",
|
|
282
282
|
headers: _headers,
|
|
283
|
-
|
|
283
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
284
284
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
285
285
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
286
286
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -347,7 +347,7 @@ class EntitiesClient {
|
|
|
347
347
|
method: "POST",
|
|
348
348
|
headers: _headers,
|
|
349
349
|
contentType: "application/json",
|
|
350
|
-
|
|
350
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
351
351
|
requestType: "json",
|
|
352
352
|
body: request,
|
|
353
353
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -418,7 +418,7 @@ class EntitiesClient {
|
|
|
418
418
|
method: "POST",
|
|
419
419
|
headers: _headers,
|
|
420
420
|
contentType: "application/json",
|
|
421
|
-
|
|
421
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
422
422
|
requestType: "json",
|
|
423
423
|
body: request,
|
|
424
424
|
responseType: "sse",
|
|
@@ -81,7 +81,7 @@ class OauthClient {
|
|
|
81
81
|
method: "POST",
|
|
82
82
|
headers: _headers,
|
|
83
83
|
contentType: "application/x-www-form-urlencoded",
|
|
84
|
-
|
|
84
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
85
85
|
requestType: "form",
|
|
86
86
|
body: Object.assign(Object.assign({}, request), { grant_type: "client_credentials" }),
|
|
87
87
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -91,7 +91,11 @@ class ObjectsClient {
|
|
|
91
91
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, "api/v1/objects"),
|
|
92
92
|
method: "GET",
|
|
93
93
|
headers: _headers,
|
|
94
|
-
|
|
94
|
+
queryString: core.url
|
|
95
|
+
.queryBuilder()
|
|
96
|
+
.addMany(_queryParams)
|
|
97
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
98
|
+
.build(),
|
|
95
99
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
96
100
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
97
101
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -155,7 +159,7 @@ class ObjectsClient {
|
|
|
155
159
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/objects/${core.url.encodePathParam(objectPath)}`),
|
|
156
160
|
method: "GET",
|
|
157
161
|
headers: _headers,
|
|
158
|
-
|
|
162
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
159
163
|
responseType: "binary-response",
|
|
160
164
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
161
165
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
@@ -220,7 +224,7 @@ class ObjectsClient {
|
|
|
220
224
|
method: "POST",
|
|
221
225
|
headers: _headers,
|
|
222
226
|
contentType: "application/octet-stream",
|
|
223
|
-
|
|
227
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
224
228
|
requestType: "bytes",
|
|
225
229
|
duplex: "half",
|
|
226
230
|
body: _binaryUploadRequest.body,
|
|
@@ -287,7 +291,7 @@ class ObjectsClient {
|
|
|
287
291
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/objects/${core.url.encodePathParam(objectPath)}`),
|
|
288
292
|
method: "DELETE",
|
|
289
293
|
headers: _headers,
|
|
290
|
-
|
|
294
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
291
295
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
292
296
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
293
297
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -348,7 +352,7 @@ class ObjectsClient {
|
|
|
348
352
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/objects/${core.url.encodePathParam(objectPath)}`),
|
|
349
353
|
method: "HEAD",
|
|
350
354
|
headers: _headers,
|
|
351
|
-
|
|
355
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
352
356
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
353
357
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
354
358
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -101,7 +101,7 @@ class TasksClient {
|
|
|
101
101
|
method: "POST",
|
|
102
102
|
headers: _headers,
|
|
103
103
|
contentType: "application/json",
|
|
104
|
-
|
|
104
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
105
105
|
requestType: "json",
|
|
106
106
|
body: request,
|
|
107
107
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -165,7 +165,7 @@ class TasksClient {
|
|
|
165
165
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/tasks/${core.url.encodePathParam(taskId)}`),
|
|
166
166
|
method: "GET",
|
|
167
167
|
headers: _headers,
|
|
168
|
-
|
|
168
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
169
169
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
170
170
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
171
171
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -233,7 +233,7 @@ class TasksClient {
|
|
|
233
233
|
method: "PUT",
|
|
234
234
|
headers: _headers,
|
|
235
235
|
contentType: "application/json",
|
|
236
|
-
|
|
236
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
237
237
|
requestType: "json",
|
|
238
238
|
body: _body,
|
|
239
239
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -304,7 +304,7 @@ class TasksClient {
|
|
|
304
304
|
method: "PUT",
|
|
305
305
|
headers: _headers,
|
|
306
306
|
contentType: "application/json",
|
|
307
|
-
|
|
307
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
308
308
|
requestType: "json",
|
|
309
309
|
body: _body,
|
|
310
310
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -375,7 +375,7 @@ class TasksClient {
|
|
|
375
375
|
method: "POST",
|
|
376
376
|
headers: _headers,
|
|
377
377
|
contentType: "application/json",
|
|
378
|
-
|
|
378
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
379
379
|
requestType: "json",
|
|
380
380
|
body: request,
|
|
381
381
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -427,7 +427,7 @@ class TasksClient {
|
|
|
427
427
|
method: "POST",
|
|
428
428
|
headers: _headers,
|
|
429
429
|
contentType: "application/json",
|
|
430
|
-
|
|
430
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
431
431
|
requestType: "json",
|
|
432
432
|
body: request,
|
|
433
433
|
responseType: "sse",
|
|
@@ -511,7 +511,7 @@ class TasksClient {
|
|
|
511
511
|
method: "POST",
|
|
512
512
|
headers: _headers,
|
|
513
513
|
contentType: "application/json",
|
|
514
|
-
|
|
514
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
515
515
|
requestType: "json",
|
|
516
516
|
body: request,
|
|
517
517
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
@@ -574,7 +574,7 @@ class TasksClient {
|
|
|
574
574
|
method: "POST",
|
|
575
575
|
headers: _headers,
|
|
576
576
|
contentType: "application/json",
|
|
577
|
-
|
|
577
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
578
578
|
requestType: "json",
|
|
579
579
|
body: request,
|
|
580
580
|
responseType: "sse",
|
|
@@ -645,7 +645,7 @@ class TasksClient {
|
|
|
645
645
|
method: "POST",
|
|
646
646
|
headers: _headers,
|
|
647
647
|
contentType: "application/json",
|
|
648
|
-
|
|
648
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
649
649
|
requestType: "json",
|
|
650
650
|
body: _body,
|
|
651
651
|
responseType: "sse",
|
|
@@ -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
|
|
20
|
+
* in 100-foot increments up to 10,000 feet MSL. A zero value indicates No Statement.
|
|
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. */
|
|
@@ -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
|
|
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");
|
|
@@ -8,7 +8,13 @@ export declare namespace Fetcher {
|
|
|
8
8
|
method: string;
|
|
9
9
|
contentType?: string;
|
|
10
10
|
headers?: Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Prefer `queryString` (produced by `core.url.queryBuilder()`).
|
|
13
|
+
* Retained for backwards compatibility with custom fetchers and callers that
|
|
14
|
+
* still construct request args with a query-parameter object.
|
|
15
|
+
*/
|
|
11
16
|
queryParameters?: Record<string, unknown>;
|
|
17
|
+
queryString?: string;
|
|
12
18
|
body?: unknown;
|
|
13
19
|
timeoutMs?: number;
|
|
14
20
|
maxRetries?: number;
|
|
@@ -75,16 +75,11 @@ const SENSITIVE_QUERY_PARAMS = new Set([
|
|
|
75
75
|
]);
|
|
76
76
|
function redactQueryParameters(queryParameters) {
|
|
77
77
|
if (queryParameters == null) {
|
|
78
|
-
return
|
|
78
|
+
return undefined;
|
|
79
79
|
}
|
|
80
80
|
const redacted = {};
|
|
81
81
|
for (const [key, value] of Object.entries(queryParameters)) {
|
|
82
|
-
|
|
83
|
-
redacted[key] = "[REDACTED]";
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
redacted[key] = value;
|
|
87
|
-
}
|
|
82
|
+
redacted[key] = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()) ? "[REDACTED]" : value;
|
|
88
83
|
}
|
|
89
84
|
return redacted;
|
|
90
85
|
}
|
|
@@ -186,7 +181,13 @@ function getHeaders(args) {
|
|
|
186
181
|
function fetcherImpl(args) {
|
|
187
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
183
|
var _a, _b, _c;
|
|
189
|
-
|
|
184
|
+
let url = args.url;
|
|
185
|
+
if (args.queryString != null && args.queryString.length > 0) {
|
|
186
|
+
url = `${url}?${args.queryString}`;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
url = (0, createRequestUrl_js_1.createRequestUrl)(args.url, args.queryParameters);
|
|
190
|
+
}
|
|
190
191
|
const requestBody = yield (0, getRequestBody_js_1.getRequestBody)({
|
|
191
192
|
body: args.body,
|
|
192
193
|
type: (_a = args.requestType) !== null && _a !== void 0 ? _a : "other",
|
|
@@ -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 (
|
|
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();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a fluent builder for constructing URL query strings.
|
|
3
|
+
*
|
|
4
|
+
* Each `.add()` call serializes its value immediately (like C#'s builder),
|
|
5
|
+
* so no format tracking is needed — the style is applied at add-time.
|
|
6
|
+
*
|
|
7
|
+
* Usage (generated code):
|
|
8
|
+
*
|
|
9
|
+
* const qs = core.url.queryBuilder()
|
|
10
|
+
* .add("limit", limit)
|
|
11
|
+
* .add("tags", tags, { style: "comma" }) // explode: false
|
|
12
|
+
* .mergeAdditional(requestOptions?.queryParams)
|
|
13
|
+
* .build();
|
|
14
|
+
*/
|
|
15
|
+
export declare function queryBuilder(): QueryStringBuilder;
|
|
16
|
+
declare class QueryStringBuilder {
|
|
17
|
+
private parts;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a query parameter, serializing it immediately.
|
|
20
|
+
*
|
|
21
|
+
* By default arrays use "repeat" format (`key=a&key=b`).
|
|
22
|
+
* Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
|
|
23
|
+
* to get comma-separated values (`key=a,b,c`).
|
|
24
|
+
*
|
|
25
|
+
* Null / undefined values are silently skipped.
|
|
26
|
+
*/
|
|
27
|
+
add(key: string, value: unknown, options?: {
|
|
28
|
+
style?: "comma";
|
|
29
|
+
}): this;
|
|
30
|
+
/**
|
|
31
|
+
* Adds multiple query parameters at once from a record.
|
|
32
|
+
* All parameters use the default "repeat" array format.
|
|
33
|
+
* Null / undefined values are silently skipped.
|
|
34
|
+
*/
|
|
35
|
+
addMany(params: Record<string, unknown>): this;
|
|
36
|
+
/**
|
|
37
|
+
* Merges additional query parameters supplied at call-time via
|
|
38
|
+
* `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
|
|
39
|
+
*/
|
|
40
|
+
mergeAdditional(additionalParams?: Record<string, unknown>): this;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the assembled query string (without the leading `?`).
|
|
43
|
+
* Returns an empty string when no parameters were added.
|
|
44
|
+
*/
|
|
45
|
+
build(): string;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryBuilder = queryBuilder;
|
|
4
|
+
const qs_js_1 = require("./qs.js");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a fluent builder for constructing URL query strings.
|
|
7
|
+
*
|
|
8
|
+
* Each `.add()` call serializes its value immediately (like C#'s builder),
|
|
9
|
+
* so no format tracking is needed — the style is applied at add-time.
|
|
10
|
+
*
|
|
11
|
+
* Usage (generated code):
|
|
12
|
+
*
|
|
13
|
+
* const qs = core.url.queryBuilder()
|
|
14
|
+
* .add("limit", limit)
|
|
15
|
+
* .add("tags", tags, { style: "comma" }) // explode: false
|
|
16
|
+
* .mergeAdditional(requestOptions?.queryParams)
|
|
17
|
+
* .build();
|
|
18
|
+
*/
|
|
19
|
+
function queryBuilder() {
|
|
20
|
+
return new QueryStringBuilder();
|
|
21
|
+
}
|
|
22
|
+
class QueryStringBuilder {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.parts = new Map();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Adds a query parameter, serializing it immediately.
|
|
28
|
+
*
|
|
29
|
+
* By default arrays use "repeat" format (`key=a&key=b`).
|
|
30
|
+
* Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
|
|
31
|
+
* to get comma-separated values (`key=a,b,c`).
|
|
32
|
+
*
|
|
33
|
+
* Null / undefined values are silently skipped.
|
|
34
|
+
*/
|
|
35
|
+
add(key, value, options) {
|
|
36
|
+
if (value === undefined || value === null) {
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: (options === null || options === void 0 ? void 0 : options.style) === "comma" ? "comma" : "repeat" });
|
|
40
|
+
if (serialized.length > 0) {
|
|
41
|
+
this.parts.set(key, serialized);
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Adds multiple query parameters at once from a record.
|
|
47
|
+
* All parameters use the default "repeat" array format.
|
|
48
|
+
* Null / undefined values are silently skipped.
|
|
49
|
+
*/
|
|
50
|
+
addMany(params) {
|
|
51
|
+
if (params != null) {
|
|
52
|
+
for (const [key, value] of Object.entries(params)) {
|
|
53
|
+
this.add(key, value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Merges additional query parameters supplied at call-time via
|
|
60
|
+
* `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
|
|
61
|
+
*/
|
|
62
|
+
mergeAdditional(additionalParams) {
|
|
63
|
+
if (additionalParams != null) {
|
|
64
|
+
for (const [key, value] of Object.entries(additionalParams)) {
|
|
65
|
+
if (value === undefined || value === null) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: "repeat" });
|
|
69
|
+
if (serialized.length > 0) {
|
|
70
|
+
this.parts.set(key, serialized);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns the assembled query string (without the leading `?`).
|
|
78
|
+
* Returns an empty string when no parameters were added.
|
|
79
|
+
*/
|
|
80
|
+
build() {
|
|
81
|
+
return [...this.parts.values()].join("&");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toQueryString = exports.join = exports.encodePathParam = void 0;
|
|
3
|
+
exports.toQueryString = exports.queryBuilder = exports.join = exports.encodePathParam = void 0;
|
|
4
4
|
var encodePathParam_js_1 = require("./encodePathParam.js");
|
|
5
5
|
Object.defineProperty(exports, "encodePathParam", { enumerable: true, get: function () { return encodePathParam_js_1.encodePathParam; } });
|
|
6
6
|
var join_js_1 = require("./join.js");
|
|
7
7
|
Object.defineProperty(exports, "join", { enumerable: true, get: function () { return join_js_1.join; } });
|
|
8
|
+
var QueryStringBuilder_js_1 = require("./QueryStringBuilder.js");
|
|
9
|
+
Object.defineProperty(exports, "queryBuilder", { enumerable: true, get: function () { return QueryStringBuilder_js_1.queryBuilder; } });
|
|
8
10
|
var qs_js_1 = require("./qs.js");
|
|
9
11
|
Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return qs_js_1.toQueryString; } });
|
package/dist/cjs/core/url/qs.js
CHANGED
|
@@ -26,19 +26,31 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
26
26
|
if (value.length === 0) {
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const effectiveFormat = options.arrayFormat;
|
|
30
|
+
if (effectiveFormat === "comma") {
|
|
31
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
32
|
+
const encodedValues = value
|
|
33
|
+
.filter((item) => item !== undefined && item !== null)
|
|
34
|
+
.map((item) => encodeValue(item, options.encode));
|
|
35
|
+
if (encodedValues.length > 0) {
|
|
36
|
+
parts.push(`${encodedKey}=${encodedValues.join(",")}`);
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (let i = 0; i < value.length; i++) {
|
|
41
|
+
const item = value[i];
|
|
42
|
+
if (item === undefined) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
46
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
47
|
+
parts.push(...stringifyObject(item, arrayKey, options));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
51
|
+
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
52
|
+
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.
|
|
1
|
+
export declare const SDK_VERSION = "4.8.0";
|
package/dist/cjs/version.js
CHANGED