Socket
Socket
Sign inDemoInstall

@fastly/js-compute

Package Overview
Dependencies
Maintainers
5
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastly/js-compute - npm Package Versions

1
1011

0.5.1

Diff

Changelog

Source

0.5.1 (2022-08-31)

Fixed

  • Removed type: "module" from the @fastly/js-compute package.json file as the package still uses require
fastly-compute-at-edge
published 0.5.0 •

Changelog

Source

0.5.0 (2022-08-30)

Added

  • Implemented ObjectStore and ObjectStoreEntry classes for interacting with Fastly ObjectStore (#110)
  • add btoa and atob native implementations (#227) (8b8c31f)
Object-store support

This release adds support for Fastly Object-store, which is globally consistent key-value storage accessible across the Fastly Network. This makes it possible for your Fastly Compute application to read and write from Object-stores.

We've added two classes, ObjectStore, and ObjectStoreEntry. ObjectStore is used to interact with a particular Object-store and ObjectStoreEntry is a particular value within an Object-store. We've made ObjectStoreEntry have a similar API as Response to make it simpler to read and write from Object-stores. I.e. ObjectStoreEntry has a body property which is a ReadableStream and has arrayBuffer/json/text methods - just like Response.

The way to use these classes is best shown with an example:

async function app(event) {
  // Create a connection the the Object-store named 'example-store'
  const store = new ObjectStore('example-store')
  
  // Create or update the 'hello' key with the contents 'world'
  await store.put('hello', 'world')
  
  // Retrieve the contents of the 'hello' key
  // Note: Object-stores are eventually consistent, this means that the updated contents associated may not be available to read from all
  // Fastly edge locations immediately and some edge locations may continue returning the previous contents associated with the key.
  const hello = await store.get('hello')
  
  // Read the contents of the `hello` key into a string
  const hellotext = await hello.text()
  return new Response(hellotext)
}

addEventListener("fetch", event => {
  event.respondWith(app(event))
})
Added btoa and atob global functions

These two functions enable you to encode to (btoa) and decode from (atob) Base64 strings. They follow the same specification as the atob and btoa functions that exist in web-browsers.

addEventListener("fetch", event => {
  event.respondWith(new Response(atob(btoa('hello from fastly'))))
})
Improved Console Support

Previously our console methods only supported a single argument and would convert the argument to a string via String(argument), this unfortunately made it difficult to log out complex objects such as Request objects or similar.

We've updated our console methods and they now support any number of arguments. As well as supporting any number of arguments, we've also changed the implementation to have better support for logging out complex objects.

This is a before and after example of what happens when logging a Request with our console methods.

Before:

const request = new Request('https://www.fastly.com', {body:'I am the body', method: 'POST'});
console.log(request); // outputs `[object Object]`.

After:

const request = new Request('https://www.fastly.com', {body:'I am the body', method: 'POST'});
console.log(request); // outputs `Request: {method: POST, url: https://www.fastly.com/, version: 2, headers: {}, body: null, bodyUsed: false}`.

Changed

  • Improved console output for all types (#204)
fastly-compute-at-edge
published 0.4.0 •

Changelog

Source

0.4.0 (2022-07-28)

Added

  • Implement the DecompressionStream builtin #160
  • Improve performace of Regular Expression literals via precompilation #146

Fixed

  • Calling tee on the client request no longer causes the application to hang #156
fastly-compute-at-edge
published 0.3.0 •

Changelog

Source

0.3.0 (2022-06-29)

Added

  • Implement the CompressionStream builtin #84

Changed

  • Removed the requirement for a fastly.toml file to be present when using js-compute-runtimes CLI to compile a WASM file
  • Breaking change: Removed --skip-pkg argument from js-compute-runtime's CLI #108
  • Breaking change: Removed console.trace method

Fixed

  • Fix the response error message text
  • Throw an error if constructors are called as plain functions
  • Fix the behavior of console.debug
  • Allow builtin classes to be extended
fastly-compute-at-edge
published 0.2.5 •

Changelog

Source

0.2.5 (2022-04-20)

Changed

  • Updated the js-compute-runtime to 0.2.5 : Increased max uri length to 8k, and properly forwards http headers to upstream requests even if the headers aren't ever read from
fastly-compute-at-edge
published 0.2.4 •

Changelog

Source

0.2.4 (2022-02-09)

Changed

  • Support streaming upstream request bodies
fastly-compute-at-edge
published 0.2.2 •

Changelog

Source

0.2.2 (2022-02-03)

Added

  • Add full support for TransformStreams
  • Support directly piping Request/Response bodies to other Requests/Responses instead of manually copying every chunk
  • Add support for the queueMicrotask global function
  • Add support for the structuredClone global function
  • Add support for the location global object as an instance of WorkerLocation
  • Support BigUint64Array and BigInt64Array in crypto.getRandomValues
  • Enable class static blocks syntax
  • Returned the exit code from the JS Compute Runtime, by passing it up through our CLI

Changed

  • Increase max supported header size from 4096 bytes to 69000 bytes
  • Update to SpiderMonkey 96 beta

Fixed

  • Avoid waiting for async tasks that weren't passed to FetchEvent#waitUntil
  • Significantly improve spec-compliance of Request and Response builtins
triblondon
published 0.2.1 •

Changelog

Source

0.2.1 (2021-11-10)

Added

  • Updated the js-compute-runtime to 0.2.2 (Which includes fixes to geoip, a way to get environment variables, improves debugging of exceptions in the request handler, and other updates)
  • Added the Env namespace for accessing Fastly Compute environment variables.
torch2424
published 0.2.0 •

Changelog

Source

0.2.0 (2021-08-31)

Added

  • Implement the WHATWG URL and URLSearchParam classes
  • Enable private class fields and methods, plus ergonomic brand checks
  • Breaking change: Implement FetchEvent#waitUntil
  • Mark builtins that rely on hostcalls as request-handler-only
  • Add support for including binary files, and for using typed arrays as Response bodies
  • Improve handling of hostcall errors

Fixed

  • Breaking change: Make FetchEvent handling more spec-compliant
  • Normalize HTTP method names when constructing Requests
  • Don't trap when trying to delete a non-existent header
  • Properly support base argument in URL constructor
triblondon
published 0.1.0 •

Changelog

Source

0.1.0 (2021-07-28)

Added

  • Initial Release
  • Includes TypeScript type definitions for Fastly Compute flavored ServiceWorkers APIs
  • Also includes the js-compute-runtime CLI for bundling JavaScript applications
1
1011
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc