@taskcluster/client 105.0.0 → 106.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskcluster/client",
3
- "version": "105.0.0",
3
+ "version": "106.0.0",
4
4
  "author": "Jonas Finnemann Jensen <jopsen@gmail.com>",
5
5
  "description": "Client for interfacing taskcluster components",
6
6
  "license": "MPL-2.0",
package/src/apis.js CHANGED
@@ -605,6 +605,33 @@ export default {
605
605
  "title": "Get Temporary GCP Credentials",
606
606
  "type": "function"
607
607
  },
608
+ {
609
+ "args": [
610
+ "appName",
611
+ "owner"
612
+ ],
613
+ "category": "Github Credentials",
614
+ "description": "Get a Github application installation token scoped to the given repositories\nand permissions, using the configured app `appName`.\n\nRequesting `<permission>: <level>` on `<owner>/<repo>` requires the scope\n`auth:github-repo-token:<appName>/<owner>/<repo>:<permission>:<level>`.\nLevels and permissions are matched exactly to github token permissions\nwhich can be found at\nhttps://docs.github.com/en/rest/apps/apps?apiVersion=2026-03-10#create-an-installation-access-token-for-an-app.\nWhile token access is widened (requesting a write token will give a read+write one)\nscopes are not. Holding `:contents:write` alone only allows requesting a `write` token.\nBoth owner and repo must be in lowercase in the scope.\n\nThe token expires after an hour but this behavior is github dependent.\nYou should read the `expires` property from the response if you intend\nto maintain active credentials in your task.",
615
+ "input": "v1/github-repo-token-request.json#",
616
+ "method": "post",
617
+ "name": "githubRepoToken",
618
+ "output": "v1/github-token-response.json#",
619
+ "query": [
620
+ ],
621
+ "route": "/github/<appName>/<owner>/repo-token",
622
+ "scopes": {
623
+ "AllOf": [
624
+ {
625
+ "each": "auth:github-repo-token:<appName>/<owner>/<repoPerm>",
626
+ "for": "repoPerm",
627
+ "in": "repoPerms"
628
+ }
629
+ ]
630
+ },
631
+ "stability": "experimental",
632
+ "title": "Get a repository scoped github token",
633
+ "type": "function"
634
+ },
608
635
  {
609
636
  "args": [
610
637
  ],
package/src/client.js CHANGED
@@ -247,6 +247,10 @@ export const createClient = (reference, name) => {
247
247
  throw new Error('options.randomizationFactor must be between 0 and 1!');
248
248
  }
249
249
 
250
+ if (this._options.authorizedScopes != null && !Array.isArray(this._options.authorizedScopes)) {
251
+ throw new Error('options.authorizedScopes must be an array of scopes');
252
+ }
253
+
250
254
  if (this._options.agent) {
251
255
  // We have explicit options for new agent create one...
252
256
  this._httpAgent = {
@@ -286,7 +290,7 @@ export const createClient = (reference, name) => {
286
290
 
287
291
  // If set of authorized scopes is provided, we'll restrict the request
288
292
  // to only use these scopes
289
- if (Array.isArray(this._options.authorizedScopes)) {
293
+ if (this._options.authorizedScopes) {
290
294
  ext.authorizedScopes = this._options.authorizedScopes;
291
295
  }
292
296