@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @canopy-io/node
2
2
 
3
+ ## 0.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a7fda0b: An `environmentId` option on the client sends `X-Canopy-Environment`, so an account API key can reach the routes that act in an Environment; `RequestOptions.environmentId` names another Environment for one call, or `null` none. The generated types cover the management API: Applications and Environments with their settings, single sign-on, the auth domain and SCIM, administrator roles, grants and administrators, billing reads, the Account and account webhooks (298 operations, up from 201). The skill's choosing, node and mistakes references say which key goes where and how to provision an Environment with an account key.
8
+
3
9
  ## 0.20.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -119,6 +119,7 @@ var CanopyClient = class {
119
119
  maxBackoffMs;
120
120
  authHeaders;
121
121
  extraHeaders;
122
+ environmentId;
122
123
  fetchImpl;
123
124
  constructor(options = {}) {
124
125
  if (!options.apiKey && !options.accessToken) {
@@ -131,6 +132,7 @@ var CanopyClient = class {
131
132
  this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
132
133
  this.maxBackoffMs = options.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS;
133
134
  this.extraHeaders = options.headers ?? {};
135
+ this.environmentId = options.environmentId;
134
136
  this.fetchImpl = options.fetch ?? globalThis.fetch;
135
137
  if (typeof this.fetchImpl !== "function") {
136
138
  throw new TypeError(
@@ -264,6 +266,10 @@ var CanopyClient = class {
264
266
  if (options.body !== void 0) {
265
267
  headers["Content-Type"] = "application/json";
266
268
  }
269
+ const environmentId = options.environmentId === void 0 ? this.environmentId : options.environmentId;
270
+ if (environmentId) {
271
+ headers["X-Canopy-Environment"] = environmentId;
272
+ }
267
273
  Object.assign(headers, options.headers, this.authHeaders);
268
274
  const init = { method, headers, signal: controller.signal };
269
275
  if (options.body !== void 0) {