@canopy-io/node 0.20.0 → 0.21.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23108 -9501
- package/dist/index.d.ts +23108 -9501
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -117,6 +117,7 @@ var CanopyClient = class {
|
|
|
117
117
|
maxBackoffMs;
|
|
118
118
|
authHeaders;
|
|
119
119
|
extraHeaders;
|
|
120
|
+
environmentId;
|
|
120
121
|
fetchImpl;
|
|
121
122
|
constructor(options = {}) {
|
|
122
123
|
if (!options.apiKey && !options.accessToken) {
|
|
@@ -129,6 +130,7 @@ var CanopyClient = class {
|
|
|
129
130
|
this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
130
131
|
this.maxBackoffMs = options.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS;
|
|
131
132
|
this.extraHeaders = options.headers ?? {};
|
|
133
|
+
this.environmentId = options.environmentId;
|
|
132
134
|
this.fetchImpl = options.fetch ?? globalThis.fetch;
|
|
133
135
|
if (typeof this.fetchImpl !== "function") {
|
|
134
136
|
throw new TypeError(
|
|
@@ -262,6 +264,10 @@ var CanopyClient = class {
|
|
|
262
264
|
if (options.body !== void 0) {
|
|
263
265
|
headers["Content-Type"] = "application/json";
|
|
264
266
|
}
|
|
267
|
+
const environmentId = options.environmentId === void 0 ? this.environmentId : options.environmentId;
|
|
268
|
+
if (environmentId) {
|
|
269
|
+
headers["X-Canopy-Environment"] = environmentId;
|
|
270
|
+
}
|
|
265
271
|
Object.assign(headers, options.headers, this.authHeaders);
|
|
266
272
|
const init = { method, headers, signal: controller.signal };
|
|
267
273
|
if (options.body !== void 0) {
|