Repository navigation
v0.5.0
Pre-release
Pre-release
·
466 commits
to master
since this release
Summary
- Initial support for R2! Overview doc
- Mitigations for the breaking changes in the latest Deno version 1.22.0, which removed
Deno.emitdenoflarerelied onDeno.emitbundling inserveandpush!- New version relies on
deno bundleunder the hood (see below for details)
- Option to specify/override script environment bindings via the command line, no
.denoflareconfig file needed for complicated workers - Declarative support for Custom Domains for Workers, bind a worker to your custom domain (even an apex domain) via
denoflare push
Installation
- Follow the installation instructions on our docs page: https://denoflare.dev/cli
New in this release (R2-related):
r2: TypeScript types for theR2Bucketruntime APIcli:denoflare r2 <subcommand>- vhost-style by default, option for explicit path or vhost
r2: associated functions incommon/r2r2.tsexports 21 lightweight r2 s3-compatible API operation functions, and common utils like v4 signing etc- self-contained, no deps on aws or aws4fetch, can be used within workers themselves
- new namespace-aware parsing functions in
common/xml_parser.ts - new dep on fast-xml-parser
- can be remote imported from Deno projects
- or bundled to a single javascript file for non-Deno environments
deno bundle https://raw.githubusercontent.com/skymethod/denoflare/v0.5.0/common/r2/r2.ts-> 99k unminified, 48k minified, 13k gzipped (includes fast-xml-parser)
put-objectsupports streaming uploads for large files
Supported operations
listBuckets
headBucket
createBucket
deleteBucket
getBucketEncryption
deleteBucketEncryption
putBucketEncryption
getBucketLocation
listObjects
listObjectsV2
getObject
headObject
putObject
deleteObject
deleteObjects
copyObject
createMultipartUpload
abortMultipartUpload
completeMultipartUpload
uploadPart
uploadPartCopy
-
serve,push: new worker binding to an existing r2 bucket- can also be used locally in
serve, will proxy local calls to the real bucket over the r2 s3-compatible api - works in both
localIsolationmodes (none,isolate)
- can also be used locally in
-
r2-public-read: New example worker for making a bucket public- supports conditional requests, range requests, and objects stored with pre-existing content-encoding
- optional input flag to enable directory listing as html, configurable page limit
- optional input flag to enable routing similar to Cloudflare Pages, index.html served for directories, etc
- optional allow/deny ip lists
- can be deployed as is to a custom domain in a zone you own with a single push command
denoflare push https://raw.githubusercontent.com/skymethod/denoflare/v0.5.0/examples/r2-public-read-worker/worker.ts \
--name my-bucket-public-read \
--r2-bucket-binding bucket:my-bucket \
--text-binding flags:listDirectories \
--custom-domain my-bucket.my-domain.com \
--account-id $CF_ACCOUNT_ID \
--api-token $CF_API_TOKEN
r2-presigned-url: New example worker for making a bucket available via presigned GET requests- generate private credentials to use only with users to this presigned worker (e.g.
$USER_ACCESS_KEY:$USER_SECRET_KEYbelow) so you don't have to use actual r2 credentials - generate them with a new cli command: denoflare r2 generate-credentials
- generate presigned urls using s3 standard tools like presign
- generate private credentials to use only with users to this presigned worker (e.g.
AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$USER_SECRET_ACCESS_KEY \
aws s3 presign s3://b/video.mp4 --endpoint-url https://my-bucket.my-domain.com
r2-presigned-url: (continued)- optional allow/deny ip lists
- configurable
maxSkewMinutes, default: 15 - configurable
maxExpiresMinutes, default: 7 days - supports conditional requests, range requests, and objects stored with pre-existing content-encoding
- can be deployed as is to a custom domain in a zone you own with a single push command
denoflare push https://raw.githubusercontent.com/skymethod/denoflare/v0.5.0/examples/r2-presigned-url-worker/worker.ts \
--name my-bucket-public-read \
--r2-bucket-binding bucket:my-bucket \
--secret-binding credentials:$USER_ACCESS_KEY_ID:$USER_SECRET_ACCESS_KEY \
--custom-domain my-bucket.my-domain.com \
--account-id $CF_ACCOUNT_ID \
--api-token $CF_API_TOKEN
analytics: New R2 analytics- Daily aggregate class a operations, class b operations, egress, storage, and associated costs
- Per bucket cost, current storage, current object count, and egress
denoflare analytics r2
New in this release (non-R2-related):
tail: Handle new response status property coming back for each request message in all formatters including webtail.cfapi: better cli docs for the supported subcommands- added list-zones, list/put/delete workers domains, list-memberships, list-accounts, list-scripts, get-user
push: New Script-level config propertycustomDomainsto define one or more custom domains on which to bind the worker when deploying, including apex domains!- uses the new Custom Domains for Workers
- no additional route/dns setup needed
push: Use custom domains specified on the command line, if present.push,serve: Option to override bindings from the command line.push,serve: Ability to set--account-idand--api-tokenon the command line.denoflareconfig no longer needed for workers with environment variable bindings!
cli: Unified cli command handling, all subcommands, arguments, and options available via--help- Abbreviated subcommand names are allowed when unambiguous. e.g.
denoflare r2 lbinstead ofdenoflare r2 list-buckets
- Abbreviated subcommand names are allowed when unambiguous. e.g.
deno: Support the latest Deno version 1.22.0, which removedDeno.emit, breaking us!- On 1.22+, bundling (for
pushandserve) is now done by spawningdeno bundleunder the hood - needs new
--allow-runpermission or--allow-run=~/.deno/bin/deno Deno.emitis still used when running on Deno pre 1.22- The official replacement for
Deno.emitis a new userland x/deno_emit module- Not a great replacement, they have no plans to ever type check in this module
- Also quite buggy right now
- Add
--bundle backend=moduleif you want to try it out within denoflare instead ofdeno bundle
- Renamed the
emitutility function tobundle, supporting the three different backends:builtin(Deno.emitpre 1.22),process(deno bundle), andmodule(x/deno_emit)
- On 1.22+, bundling (for
do alarms: Updated types withgetAlarm/setAlarm/deleteAlarmto try them out in production, no local emulation yetdocs: Tons of new documentation, including the ability to generate regenerate online docs pages for every cli commandsite: New tweaks to support the new docs, like<Aside>and links inside code blocks