Skip to content
Comms.ID
Esc
↑↓navigate↵open⌘Jpreview
On this page

Upgrading the ASX element

Upgrading the ASX element

Hand-written, next to the generated reference. The generator keeps this file and does not check it. Newest first.

1.1.0 to 1.1.1

This patch preserves the service error when its retry wait cannot fit the request deadline. A rate-limit response with a 60-second Retry-After and the default 10-second deadline now reports FAIR_USE_CEILING instead of TIMEOUT. No retry is sent early.

Update the exact script URL and integrity together:

<script
  src="https://cdn.comms.id/asx/1.1.1.js"
  integrity="sha384-djkyPx+Ux3TpHLUw949UZrRG6bFVE7pMWMDvhQk2l5SGYe4usem9jw5zrMIxFfqE"
  crossorigin="anonymous"
></script>

The bundle is 31,626 bytes (10,169 bytes gzipped). Attributes, events and theme defaults are unchanged. Earlier exact-version files remain available with their original bytes; the major alias takes this patch when the CDN is deployed.

1.0.0 to 1.1.0

The element now uses the shared Comms.ID theme for default colours, borders, focus and corner radius. It inherits light/dark tokens when the host imports @comms-id/theme/tokens.css; without that stylesheet it uses the light defaults. Existing --comms-id-* overrides and ::part() styles keep priority. Fonts still inherit from the host page.

The public attributes, events, requests and shadow isolation are unchanged. Review the new default appearance before updating a version-pinned script. The major alias https://cdn.comms.id/asx/v1.js takes this release when the CDN is deployed; older exact-version files stay unchanged.

<script
  src="https://cdn.comms.id/asx/1.1.0.js"
  integrity="sha384-gHeoeoXmBwKGb7A+MRwfcdQpqnvVDgY3vZe2lQ7L3WNg6+2sN2A29NBOJjuHOkvW"
  crossorigin="anonymous"
></script>

The new file is 31,558 bytes (10,112 bytes gzipped, below the 15,000-byte limit). The element remains a CDN asset; the theme dependency is bundled into it, so a plain script install needs no npm step.

0.1.0 to 1.0.0

In one line

Change the script’s version and its integrity hash. Nothing else on your page changes.

What changed

  • One behaviour you can see: the element waits 400 ms after the last key before it asks for suggestions (it was 200 ms). The old wait was shorter than the usual gap between keys, so a person who types at an ordinary speed sent a request after almost every key, and every suggest request counts against the fair-use ceiling (150 requests a product a day to start). With the new wait the same person sends one suggest request for a pause, not one for each key. To keep the old wait, add debounce="200" to the element.
  • Nothing else changed. The two files differ in one character, the default wait (200 became 400 in the bundled controller). The attributes (the debounce attribute still overrides the default), events, properties, parts, custom properties and content security policy needs are the same as in 0.1.0. 1.0.0 is the launch release; the 0.x releases were prereleases. The size is the same (29,014 bytes; gzipped 9,438 to 9,440 of the 15,000 allowed).
  • New URLs. https://cdn.comms.id/asx/1.0.0.js is new, and so is the major alias https://cdn.comms.id/asx/v1.js, which follows the newest 1.x release (1.0.0 now). The alias https://cdn.comms.id/asx/v0.js is not changed by this release and keeps serving 0.1.0.

Script tag

Before (0.1.0):

<script
  src="https://cdn.comms.id/asx/0.1.0.js"
  integrity="sha384-n36tKWoGxxv7fzblp3KkU0Q6ETioz+2i2Lv+MkpyLB6AkLtO8jHdfIIMnbt7rQ3O"
  crossorigin="anonymous"
></script>

After (1.0.0):

<script
  src="https://cdn.comms.id/asx/1.0.0.js"
  integrity="sha384-g+kWpAgfdLK5TcHRKHexsYF+aJhRTzrzK/HiWSWXiIuOyTrtIKV/N3fplhfoEz7K"
  crossorigin="anonymous"
></script>

If you use the major alias https://cdn.comms.id/asx/v0.js, change it to https://cdn.comms.id/asx/v1.js to take 1.0.0. The alias cannot carry an integrity hash, because its bytes change with each release. 0.1.0.js stays served and unchanged, so a page that is not upgraded keeps working as before.

npm

No npm change is needed for the element: @comms-id/asx-element is not published to npm, the element is served from the CDN only. The default wait comes from the controller, so the npm packages that run it get the same default in their next minor release: @comms-id/asx (0.3.0 now, then 0.4.0) and, as a patch, @comms-id/asx-react (0.2.0 now). The API does not change: only the default of debounceMs (200 became 400); pass debounceMs: 200 to keep the old wait. A range such as ^0.3.0 stays on 0.3.x for a 0.x package, so to take the new default change the range to ^0.4.0.

Check a release yourself

The CDN manifest lists every released version with the hash of its exact bytes:

curl -s https://cdn.comms.id/manifest.json
curl -s https://cdn.comms.id/asx/1.0.0.js | openssl dgst -sha384 -binary | openssl base64 -A

The second command, for the version you are moving to, must print the hash in that version’s script tag above (for 1.0.0: g+kWpAgfdLK5TcHRKHexsYF+aJhRTzrzK/HiWSWXiIuOyTrtIKV/N3fplhfoEz7K). A released file never changes, so a page that has not been upgraded keeps working.

After the change, the element must still be defined and answer: open the page and use the field, and the element works as before. A wrong hash blocks the script; the browser console names the integrity failure.

Was this page helpful?