profile
viewpoint
Chris Knight cknight UK Web and Android App Dev, Contributor to Deno @denoland

cknight/deno 1

A secure JavaScript and TypeScript runtime

onjara/optic 1

A powerful logging framework for Deno

cknight/deno_website2 0

deno.land website

release onjara/optic

v0.7

released time in a day

created tagonjara/optic

tagv0.7

A powerful logging framework for Deno

created time in a day

push eventonjara/optic

Chris Knight

commit sha dc21ebf1a85349467000133ebb51b7eb8a683ee7

WIP: date/time rotation strategy

view details

push time in a day

release onjara/optic

v0.6

released time in 7 days

created tagonjara/optic

tagv0.6

A powerful logging framework for Deno

created time in 7 days

push eventonjara/optic

Chris Knight

commit sha 66d1573f449ea1d10974a2cf434cfb7ea82ed042

chore: fix formatting

view details

push time in 7 days

push eventonjara/optic

Chris Knight

commit sha c12838a7f161a6d29c5683787d7f6f7f217740d1

fix: fix off by 1 error with byte rotation max keep index

view details

push time in 7 days

push eventonjara/optic

Chris Knight

commit sha 1de99cdeea31f66c517e941873540ca11bfc5b4b

test: add logging to track down ci issue

view details

push time in 7 days

push eventonjara/optic

Chris Knight

commit sha 9d95c35d55128a42fb5082873b52d05f41ac4277

test: add logging to track down ci issue

view details

push time in 7 days

push eventonjara/optic

Chris Knight

commit sha a8159ac4bc0ef058d5713e234e5cb5b575b1a1ca

test: add logging to track down ci issue

view details

push time in 7 days

push eventonjara/optic

Chris Knight

commit sha 30ba658c487944cac53b90a39adb172683a9e3b9

bump ci

view details

push time in 7 days

push eventonjara/optic

Chris Knight

commit sha 43bf4ec466674a7ef64d9eb8731f6efc55b38f29

feat: detailed log stats in log footer

view details

push time in 7 days

push eventonjara/optic

Chris Knight

commit sha 183169c9d0458fe4f7e0191be68facf25e830a60

feat: significant performance improvements, support for arrays

view details

push time in 8 days

release onjara/optic

v0.5

released time in 10 days

created tagonjara/optic

tagv0.5

A powerful logging framework for Deno

created time in 10 days

push eventonjara/optic

Chris Knight

commit sha 1ec5f072b07f45db17bff4526a3114f259564c8e

feat: full, proper, deep cloning of objects in obfuscators

view details

push time in 10 days

create barnchcknight/deno_website2

branch : optic

created branch time in 12 days

PR opened denoland/deno_website2

Add optic logging framework
+7 -0

0 comment

1 changed file

pr created time in 12 days

release onjara/optic

v0.4

released time in 12 days

created tagonjara/optic

tagv0.4

A powerful logging framework for Deno

created time in 12 days

push eventonjara/optic

Chris Knight

commit sha 735fe3926649c8c05f5d5bffa8b8fe0e8bcc8719

feat: typed errors

view details

push time in 12 days

push eventonjara/optic

Chris Knight

commit sha d9f79918399030bcb313cef76d47086b1811715c

doc: fix example comment wording

view details

push time in 13 days

push eventonjara/optic

Chris Knight

commit sha 3628fbc6de38b69da53d35e7bac8441de132ba08

doc: remove significant breaking changes warning

view details

push time in 13 days

release onjara/optic

v0.3

released time in 13 days

created tagonjara/optic

tagv0.3

A powerful logging framework for Deno

created time in 13 days

push eventonjara/optic

Chris Knight

commit sha 022d3a907d392d81628d78b5ca16cecfce80ff87

feat: add setup/destroy interfaces to monitors, filters and obfuscators

view details

push time in 13 days

release onjara/optic

v0.2.1

released time in 13 days

created tagonjara/optic

tagv0.2

A powerful logging framework for Deno

created time in 13 days

created tagonjara/optic

tagv0.2.1

A powerful logging framework for Deno

created time in 13 days

created tagonjara/optic

tag0.2

A powerful logging framework for Deno

created time in 13 days

release onjara/optic

0.2

released time in 13 days

push eventonjara/optic

Chris Knight

commit sha d08505661888b72e12b84e07848d356c6732dc72

doc: add headline docs

view details

push time in 13 days

created tagonjara/optic

tag0.1

A powerful logging framework for Deno

created time in 13 days

release onjara/optic

0.1

released time in 13 days

pull request commentdenoland/deno

Feature: Dependency count and module sizes for `deno info`. Feedback wanted.

Having carefully looked at the JSON output proposed here vs #6372 what's demonstrated above does look better to me, both in structure and extensibility. However, I'm not conversant enough in Rust to comment on the implementations. There's still the question of what to do with repeated dependencies in the JSON output, not sure what works best there, but I'm guessing leave it blank as proposed for the non-JSON output.

KrisChambers

comment created time in 13 days

issue openedonjara/optic

1.0 Release Map

  • [ ] Review and complete log meta for header/footer
  • [ ] Add optional setup/destroy functions to Filter, Monitor and Obfuscator interfaces
  • [ ] Typed errors
  • [ ] FileStream - Date/Time rotation policy
  • [ ] Performance tests
  • [ ] Functional testing

created time in 13 days

push eventonjara/optic

Chris Knight

commit sha a01957fff68fba4e1aa338f1c627d1e85be307f6

doc: reorder stream/logging docs

view details

push time in 14 days

push eventonjara/optic

Chris Knight

commit sha 7f4c658f8bd8c2f7537a76de78c2b15ea8a5b5e0

doc: tweaks

view details

push time in 14 days

push eventonjara/optic

Chris Knight

commit sha 0fb0b3b84731b777f67093a2ddf9afda8965eb0e

doc: clean up examples

view details

push time in 14 days

pull request commentdenoland/deno

Feature: Dependency count and module sizes for `deno info`. Feedback wanted.

Thanks for all your work @KrisChambers this is looking great. Like you I prefer your option 2, reporting on the size of the module (and the total size with it's subdependencies) once and leaving blank for further appearances in the tree. An alternative would be to add (repeat), (duplicate), (see above) or some such. E.g.

file:///home/k/Code/deno/my_test/server.ts (127 Bytes, total = 61.97 KB)
├─┬ https://deno.land/std/http/server.ts (10.19 KB, total = 61.64 KB)
│ ├── https://deno.land/std/encoding/utf8.ts (433 Bytes, total = 433 Bytes)
│ ├─┬ https://deno.land/std/io/bufio.ts (21.14 KB, total = 25.88 KB)
│ │ ├── https://deno.land/std/bytes/mod.ts (4.34 KB, total = 4.34 KB)
│ │ └── https://deno.land/std/_util/assert.ts (405 Bytes, total = 405 Bytes)
│ ├── https://deno.land/std/_util/assert.ts (see above)

However, maybe just keep it simple for now and not adorn the duplicate entries with anything as per your original option 2 suggestion. That would make for a good starting point which could be iterated on later if needed.

KrisChambers

comment created time in 14 days

push eventonjara/optic

Chris Knight

commit sha f168dafe74821d3b1263b439c41c233b79e562cb

chore: remove gitignore

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 281f2ec5d30dc957f2cf91f7d3b0927fa2e71afb

chore: fix CI badge

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha b985af47602d209b51367fa0be065faec15ab91e

chore: add badges and unstable flag for linting

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha f65b0f4573b1aeaf6b94e02bcbf5ff964ae9c2f1

chore: add linting to CI

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha d7e29009575b95b3c8ff95f8f6d692b47fed44ce

test: given local date formatting, switch to regular expression matching

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 2f2ff001000f7324667337afdcbbb928b37fde1e

test: switch to epoch time to avoid machine differences in date string

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 42bbf35d3a812768b1ec03386ec14da2ece9d7fd

test: change from date string to epoch ms to avoid machine differences

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 7e683a2ebd1d1a20cb6827fa45f6f428eab3facd

chore: add allow-run to test CI command

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha a3595cab22a897070f390823e4eca16897983b8f

chore: upgrade dependencies

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 10f23c66cfc9657acaa7aa745aff7b7814d260fe

doc: cleanup

view details

Chris Knight

commit sha 1e2fce9e946505314d61a8ed774c78c9690d2095

Merge branch 'master' of github.com:onjara/optic

view details

Chris Knight

commit sha 3865c4f1a279e61b28e308af38b63927f6f4f071

chore: ci tweak

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 27748a6d0e7d57b75c84fe2705b2def7f8a090c9

Create optic-ci.yml

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 366729c00d220e03d44ee1312e359c86a0846d96

doc: filestream readme

view details

push time in 15 days

push eventonjara/optic

Chris Knight

commit sha 8ec508acf90bb05d9c2dd4228c1033c33d3848f8

doc: improve logging docs

view details

push time in 17 days

push eventonjara/optic

Chris Knight

commit sha b493178727fa8b4d392115cb0dac3f987e29a1c0

doc: logger documentation

view details

push time in 17 days

push eventonjara/optic

Chris Knight

commit sha fb5a5a0e5ddb4d57195ce99dad3c1783ecdc5cd5

doc: improve indentation

view details

push time in 24 days

push eventonjara/optic

Chris Knight

commit sha f3bb7563ddf7793b6c43004e8c40fb8c26502b0c

feat: Export all necessary modules in mod.ts, doc: further README improvements

view details

push time in 24 days

push eventonjara/optic

Chris Knight

commit sha 99f3e563325ec1757d7b05c432e02dfde1d3dacd

doc: add formatter teasers

view details

push time in 25 days

push eventonjara/optic

Chris Knight

commit sha 768727d0848eb63823c54af6cafa1cac8732a3fb

doc: formatters

view details

push time in 25 days

startedonjara/optic

started time in a month

push eventonjara/optic

Chris Knight

commit sha 2b236a0e05ab708be70619d60299b29a8ab72d8a

refactor: rename log-gear to optic

view details

push time in a month

create barnchonjara/optic

branch : master

created branch time in a month

created repositoryonjara/optic

A logging framework for Deno

created time in a month

push eventcknight/logGear

Chris Knight

commit sha 2981fb4a065078cd930533e1da6bc74f5f68481e

doc: add Monitor section to README

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha e68d38856571777c25427d736f6061ce28e07ba5

doc: add Monitor section to README

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha 148120813b9307977b8a2fed5ee9e81d303e5c8e

refactor: rename Triggers to Monitors

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha 4339db63f6b18766736901d13443f6ade1ebf137

doc: fix table text

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha d1dbd106dfffdcfb755afdea8931cf47dcecab66

feat: improve RegExReplacer and docs

view details

push time in a month

pull request commentdenoland/deno

Add sync permissions

@bartlomieju I first encountered this problem in a personal project where I needed to get the value of an environment variable in a constructor, but wanted to check first if the permission had been granted. Constructors are synchronous and therefore I could not use the permissions API there. There are workarounds for this of course, but it is unnecessarily limiting, especially so when the underlying ops call is synchronous. Another use case would be embedding a permissions call into an existing workflow. Imagine that module a calls module b, calls module c, calls function d, calls function e, etc. all in a synchronous nature. If within 'e' or below, you want to embed a permission call you have to retrofit a,b,c,d,e, etc. with async and consider any implications of doing so. This is a poor user experience.

cknight

comment created time in a month

push eventcknight/logGear

Chris Knight

commit sha c980176452a4b51ea8473dc5ee2ce8e8af221922

feat: Support reg ex group matching obfuscation

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha 0399b0cb3d8b1d625fe0822aba751326a2936854

doc: Add filters README

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha 5f52392af6372f8877a4b317d456775513bc2068

feat: add logger name to logger and log record

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha a736dadb5de5a99481d45c752a99a24232d34903

doc: finish first pass at jsdoc

view details

push time in a month

pull request commentdenoland/deno

std/log - Expose Logger type and improve public interface for get & set log levels

Thanks @PaulThompson, this looks much better, appreciate you taking the time to rework this. One small comment, otherwise LGTM.

PaulThompson

comment created time in a month

push eventcknight/logGear

Chris Knight

commit sha 768ec18ccb963b6284b2a69348bd00c975f65847

doc: document public functions

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha 26ac15b9152ab08d6f071e426d74c181c3639670

feat: Complete mod setup and documentaion for fileStream

view details

push time in a month

push eventcknight/logGear

Chris Knight

commit sha 36139d78f96b8906fed05b34eadbb43f9cf6f517

feat: 1st pass at ByteRotationStrategy

view details

push time in a month

pull request commentdenoland/deno

fix(std/node): do not use absolute urls

Oops! :)

ry

comment created time in a month

push eventcknight/logGear

Chris Knight

commit sha 68bff2d4d8b07498b2ec97c152b5671f4b810b27

feat: byte rotation strategy, retention policy

view details

push time in a month

pull request commentdenoland/deno

std/log - Expose base class for Logger instances

@PaulThompson Thanks for your contribution, however, I'm not entirely clear on what it is you are trying to achieve. I see better encapsulation around log level and logger name, but these relatively small changes could be achieved without shifting the logger to an abstract base class. Can you describe your use case more? Why have an abstract base class with only one implementation?

PaulThompson

comment created time in a month

issue closeddenoland/deno

Require read permission to perform Deno.bundle()

Deno.bundle() takes in as argument a file name as a string. If the file is of a supported media type (currently javascript, JSX, Typescript, TSX, Json or Wasm), it will bundle that file up and return the output to the calling module as a string of Javascript. No permissions are required. This effectively gives the calling module the ability to read the contents of any these media types located anywhere on the file system without requiring any permission.

Proof of concept

/some/other/dir/secrets.json

{"my_secret_API_key":"abcd1234"}

/deno/module/dir/bundle_poc.ts

const [ maybeDiagnostics, output ] = await Deno.bundle("/some/other/dir/secrets.json");
console.log(output);

when executed as: deno bundle_poc.ts

The output (trimmed) is:

Compile file:///deno/module/dir/bundle_poc.ts
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

// This is a specialised implementation of a System module loader.

// @ts-nocheck
/* eslint-disable */

let System, __inst, __inst_s;

<...trimmed output...>

{ "my_secret_API_key": "abcd1234" }

__inst_s("secrets");

As demonstrated above, this method exposes the json data to the calling module. If Deno.bundle() can access any of these media types on the file system and allow the content to be accessed in the module, it should be required to run under the --allow-read permission.

closed time in a month

cknight

issue commentdenoland/deno

Require read permission to perform Deno.bundle()

Thanks @bartlomieju, I agree. Closing.

cknight

comment created time in a month

push eventcknight/logGear

Chris Knight

commit sha e6f0b1a78c1e767cd8fcbc5a44df12519a8661fd

WIP: fileStream

view details

push time in a month

pull request commentdenoland/deno

Revert "feat: URL support in Deno filesystem methods (#5990)"

@ry see benchmark code above

caspervonb

comment created time in a month

delete branch cknight/deno

delete branch : simplifyBufIoDeps

delete time in a month

push eventcknight/deno

Chris Knight

commit sha ed155c7e8544945b918b2df4c6f79ebfb47c4ddb

doc: move to building from source section and add additional target

view details

push time in a month

pull request commentdenoland/deno

doc: add info on installing wasm32-wasi target

Yeah, even thought it's not needed for the build, it's probably a better place for this. I'll move it.

cknight

comment created time in a month

PR opened denoland/deno

doc: add info on installing wasm32-wasi target

cc @caspervonb

+8 -0

0 comment

1 changed file

pr created time in a month

create barnchcknight/deno

branch : wasiManualUpdate

created branch time in a month

PR opened denoland/deno

[BREAKING] refactor (std): Reduce dependencies

With a few minor tweaks and one breaking change, this PR reduces the number of dependencies across a number of std modules. The breaking change is to move copyBytes out of std/io/util.ts and into std/bytes/mod.ts. In addition to providing the core solution of removing dependencies here, std/bytes seems a more natural home for this function anyway.

Essentially, std/path/mod.ts has 20 dependencies(*) and was being indirectly imported without use in a number of modules. A small amount of code reshuffling in this PR has enabled the dependency on std/path/mod.ts to be removed from many modules resulting in a large drop in dependencies for these modules.

Example deno info std/io/bufio.ts on master:

local: /home/dev/deno/std/io/bufio.ts
type: TypeScript
compiled: /home/dev/.cache/deno/gen/file/home/dev/deno/std/io/bufio.ts.js
map: /home/dev/.cache/deno/gen/file/home/dev/deno/std/io/bufio.ts.js.map
deps:
file:///home/dev/deno/std/io/bufio.ts
  ├─┬ file:///home/dev/deno/std/io/util.ts
  │ └─┬ file:///home/dev/deno/std/path/mod.ts
  │   ├── file:///home/dev/deno/std/path/_constants.ts
  │   ├─┬ file:///home/dev/deno/std/path/win32.ts
  │   │ ├── file:///home/dev/deno/std/path/_constants.ts
  │   │ ├─┬ file:///home/dev/deno/std/path/_util.ts
  │   │ │ └── file:///home/dev/deno/std/path/_constants.ts
  │   │ └── file:///home/dev/deno/std/_util/assert.ts
  │   ├─┬ file:///home/dev/deno/std/path/posix.ts
  │   │ ├── file:///home/dev/deno/std/path/_constants.ts
  │   │ └── file:///home/dev/deno/std/path/_util.ts
  │   ├─┬ file:///home/dev/deno/std/path/common.ts
  │   │ └─┬ file:///home/dev/deno/std/path/separator.ts
  │   │   └── file:///home/dev/deno/std/path/_constants.ts
  │   ├── file:///home/dev/deno/std/path/separator.ts
  │   ├── file:///home/dev/deno/std/path/_interface.ts
  │   └─┬ file:///home/dev/deno/std/path/glob.ts
  │     ├── file:///home/dev/deno/std/path/separator.ts
  │     ├─┬ file:///home/dev/deno/std/path/_globrex.ts
  │     │ └── file:///home/dev/deno/std/path/_constants.ts
  │     ├── file:///home/dev/deno/std/path/mod.ts
  │     └── file:///home/dev/deno/std/_util/assert.ts
  └── file:///home/dev/deno/std/_util/assert.ts

Example deno info std/io/bufio.ts on this PR:

local: /home/dev/deno/std/io/bufio.ts
type: TypeScript
compiled: /home/dev/.cache/deno/gen/file/home/dev/deno/std/io/bufio.ts.js
map: /home/dev/.cache/deno/gen/file/home/dev/deno/std/io/bufio.ts.js.map
deps:
file:///home/dev/deno/std/io/bufio.ts
  ├── file:///home/dev/deno/std/bytes/mod.ts
  └── file:///home/dev/deno/std/_util/assert.ts
module Dependency count on master Dependency count with this PR
std/bytes/mod.ts 22 1
std/io/bufio.ts 23 2
std/textproto/mod.ts 25 2
std/ws/mod.ts 59 30
std/archive/tar.ts 33 6
std/encoding/csv.ts 32 9
std/http/_io.ts 48 19
std/io/mod.ts 30 9
std/log/handlers.ts 33 6
std/mime/multipart.ts 45 37
  • NOTE - all dependency counts taken from deno info and are not de-duped, meaning the numbers can be inflated if the same dependency is being pulled in multiple times.
+82 -66

0 comment

8 changed files

pr created time in a month

create barnchcknight/deno

branch : simplifyBufIoDeps

created branch time in a month

issue openeddenoland/deno

Feature request: Add size and count of unique deps to Deno info

Currently deno info mod.ts will produce a dependency tree of mod.ts. It would be a nice enhancement if next to each module the size in bytes could be shown in addition to the size of the sub-tree. This would help spot bloated dependencies.

Another nice to have improvement would be a count of total and unique dependencies listed.

Possible output:

local: /development/deno/deno/std/archive/tar.ts
type: TypeScript
compiled: /.cache/deno/gen/file/development/deno/deno/std/archive/tar.ts.js
map: /.cache/deno/gen/file/development/deno/deno/std/archive/tar.ts.js.map
deps: 6 (5 unique)
file:///development/deno/deno/std/archive/tar.ts (1,863 bytes, total = 32,163 bytes)
  ├─┬ file:///development/deno/deno/std/io/readers.ts (15,612 bytes, total = 22,252 bytes)
  │ └── file:///development/deno/deno/std/encoding/utf8.ts (6,810 bytes)
  ├─┬ file:///development/deno/deno/std/io/bufio.ts (5,773 bytes, total = 15,223 bytes)
  │ ├── file:///development/deno/deno/std/bytes/mod.ts (8,220 bytes)
  │ └── file:///development/deno/deno/std/_util/assert.ts (1,223 bytes)
  └── file:///development/deno/deno/std/_util/assert.ts (1,223 bytes)

(byte number above don't add up and are for illustrative purposes only)

created time in a month

push eventcknight/logGear

Chris Knight

commit sha 8ea0ddb0309b40608621c91b1040161f41942668

test: add logger tests

view details

push time in a month

issue commentdenoland/deno

datetime – more general aproach?

I like the flexibility, but perhaps not the verbosity of having to create a full set of definitions every time you wanted to parse or format a date. Or were you thinking of shipping a default set of definitions which could be overridden? As a user, I would like to format or parse a date with a custom format in a line or two of code ideally.

timreichen

comment created time in a month

pull request commentdenoland/deno

Add sync permissions

Yes. This somewhat speculative PR was focused on extending the existing spec, retaining compliance with it while at the same time exposing sync alternatives. I fully understand if you don't want to take this approach (in which case please close without merge), though I'd be interested if you had any alternative suggestions for exposing a synchronous method for accessing permissions.

cknight

comment created time in a month

issue commentdenoland/deno

datetime – more general aproach?

It does look clean and I like keeping close to JS standards. However, it is also less flexible. Some people write 12-hour times as 4:45am, 4:45a.m., 4:45 A.M. or 4:45 a.m. and probably others for example. The above proposal doesn't allow for these variants. I personally like having the power and flexibility of a full set of parsing/formatting tokens to allow exact specification of the format, a feature found in the widely used moment library. I guess it comes down to how far we want to take this. For example, do we also want to support weekday names? E.g. Wed, W, Wednesday. Same question for months. E.g. Jan, January.

timreichen

comment created time in a month

PR opened denoland/deno

Add sync permissions

A proposed solution for #6388

+122 -11

0 comment

4 changed files

pr created time in a month

push eventcknight/deno

Chris Knight

commit sha c104ed0c3aa81d2473201655584703b6757df113

doc: fix wording

view details

push time in a month

create barnchcknight/deno

branch : addSyncPermissions

created branch time in 2 months

issue commentdenoland/deno

datetime – more general aproach?

Date may not support microseconds, but strings "can" and without the tokens to represent the microseconds you wouldn't be able to parse something like 2000-01-20 11:30:23.123456' into aDate`. I guess the key is to document the loss of precision.

As for 12-hour times you could follow moment's approach with the 'a' token to represent the location of either 'am' or 'pm' in the string. The presence of the token 'a' would dictate if hours/full hours were 12 or 24 based. E.g.

parseDate("01.01.2020 10:01pm", "DD.MM.YYYY hh:mma") 
// output: Date(2020, 0, 1, 22, 01)

stringifyDate(new Date(2020, 0, 1, 22, 1), "DD.MM.YYYY hh:mma"); 
// output: "01.01.2020 10:01pm" 
timreichen

comment created time in 2 months

issue openeddenoland/deno

[Discussion] Expose sync versions of Deno.permissions functions

Deno.permissions.* functions return Promise's. E.g.

  query(desc: PermissionDescriptor): Promise<PermissionStatus>;

even though the underlying op is a sync call:

return sendSync("op_query_permission", desc).state;

Then sync return from above is then wrapped and returned as a Promise. E.g. from Deno.permissions.query:

return Promise.resolve(new PermissionStatus(state));

I understand that this is to be compliant with Web APIs, however this means that you cannot query permissions from class constructors for example, and if you find yourself deep in a sync workflow call chain and need to work with a permission, having to retrofit async all the way back to top level.

I would like to propose adding sync versions of these functions, and if this is OK, I will raise a PR to implement them.

Deno.permissions.querySync(desc: PermissionDescriptor): PermissionStatus;
Deno.permissions.revokeSync(desc: PermissionDescriptor): PermissionStatus;
Deno.permissions.requestSync(desc: PermissionDescriptor): PermissionStatus;

created time in 2 months

more