Registry / devops / taskcluster-lib-urls

taskcluster-lib-urls

JSON →
library13.0.2jsnpmunverified

taskcluster-lib-urls is a JavaScript library designed to generate consistent URLs for various Taskcluster resources and deployment methods. It currently maintains version 13.0.2, with major versions releasing periodically, indicating active development and integration of new Taskcluster features. This package serves as the canonical reference implementation for defining Taskcluster URL paths, ensuring uniformity across different language bindings (e.g., Python, Go). It provides a programmatic way to construct URLs for Taskcluster APIs, schemas, documentation, and UI components, either by passing a root URL with each call or by pre-configuring an instance with a fixed root URL for convenience. The library adheres to the Taskcluster URL Format specification, making it essential for any application interacting with the Taskcluster ecosystem.

npm install taskcluster-lib-urls
INSTALL
IMPORT
SIG · TASKCLUSTER-LIB-UR
T
taskcluster-lib-urls
devopsjavascriptv13.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

api
import { api } from 'taskcluster-lib-urls';
const { api } = require('taskcluster-lib-urls');
While CommonJS `require` is shown in older documentation, ESM `import` is the modern standard for Node.js modules. The library exports named functions.
withRootUrl
import { withRootUrl } from 'taskcluster-lib-urls';
const withRootUrl = require('taskcluster-lib-urls').withRootUrl;
Use named import for `withRootUrl` which returns a class instance. The README uses `libUrls.withRoot(rootUrl)` but the export is `withRootUrl`.
testRootUrl
import { testRootUrl } from 'taskcluster-lib-urls';
import testRootUrl from 'taskcluster-lib-urls';
`testRootUrl` is a named export, not a default export. It provides a common mock URL for testing.

This quickstart demonstrates how to instantiate the library with a base root URL using `withRootUrl` and then generate various Taskcluster resource URLs relative to that root.

import { withRootUrl } from 'taskcluster-lib-urls'; const rootUrl = 'https://taskcluster.net'; // Or use process.env.TASKCLUSTER_ROOT_URL ?? '' const urls = withRootUrl(rootUrl); console.log('API URL:', urls.api('auth', 'v1', 'foo/bar')); console.log('Schema URL:', urls.schema('auth', 'v1/foo.yml')); console.log('API Reference URL:', urls.apiReference('auth', 'v1')); console.log('Exchange Reference URL:', urls.exchangeReference('auth', 'v1')); console.log('UI URL:', urls.ui('foo/bar')); console.log('API Manifest URL:', urls.apiManifest()); console.log('Docs URL:', urls.docs('foo/bar')); console.log('Test Root URL:', urls.testRootUrl());
Debug
Known issues
breakingThe `testRootUrl()` helper function changed its return value from `https://tc-tests.localhost` to `https://tc-tests.example.com`.
fix
Update any tests that rely on the specific `testRootUrl` value to expect `https://tc-tests.example.com`. A simple search-and-replace should resolve this.
affects: >=11.0.0
breakingThe method `servicesManifest` was renamed to `apiManifest`. Additionally, several new schema-related methods were introduced: `apiReferenceSchema`, `exchangesReferenceSchema`, `apiManifestSchema`, and `metadataMetaschema`.
fix
Replace all calls to `servicesManifest` with `apiManifest`. Review your codebase to utilize the newly added schema methods if applicable.
affects: >=12.0.0
gotchaThe library now provides more helpful error messages when `rootUrl` is empty or missing, rather than potentially failing silently or returning malformed URLs.
fix
Ensure that a valid `rootUrl` is always provided to URL generation functions. If you were relying on prior silent failures, this update will now throw explicit errors, which should be caught and handled.
affects: >=10.1.1
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'api')
Attempting to call an `api` method (or similar) directly on the result of `require('taskcluster-lib-urls')` without destructuring or using `libUrls.api`.
fix
When using CommonJS `require`, ensure you either call methods like `libUrls.api(rootUrl, ...)` or destructure specific methods: `const { api } = require('taskcluster-lib-urls'); api(rootUrl, ...)`.
Error: rootUrl must be a string
One of the URL building functions was called with an `undefined` or non-string `rootUrl` argument.
fix
Always provide a valid string for the `rootUrl` parameter when calling any URL generation method, either directly or when initializing with `withRootUrl`.
Upgrade
Version history
13.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
taskcluster-lib-urls — npm install taskcluster-lib-urls · libregistry