Luca Casonato
971f09abe4
fix(runtime): use more null proto objects ( #23921 )
...
This is a primordialization effort to improve resistance against users
tampering with the global `Object` prototype.
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 00:03:35 +02:00
Bartek Iwańczuk
462ce14a78
refactor: migrate extensions to virtual ops module ( #22135 )
...
First pass of migrating away from `Deno.core.ensureFastOps()`.
A few "tricky" ones have been left for a follow up.
2024-01-26 23:46:46 +01:00
Kenta Moriuchi
515a34b4de
refactor: use core.ensureFastOps()
( #21888 )
2024-01-10 15:37:25 -07:00
Kenta Moriuchi
c2c115ebd8
fix(ext): enable prefer-primordials for internal TypeScript ( #21813 )
...
Enabled prefer-primordials lint for ext/cron and ext/kv.
2024-01-07 23:20:02 +01:00
Kenta Moriuchi
b2cd254c35
fix: strict type check for cross realms ( #21669 )
...
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when
using `Object.prototype.isPrototypeOf` to check built-in types.
```js
import vm from "node:vm";
const err = new Error();
const crossErr = vm.runInNewContext(`new Error()`);
console.assert( !(crossErr instanceof Error) );
console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) );
```
This PR changes to check using internal slots solves them.
---
current:
```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error {}
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
Date {}
```
this PR:
```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error: message
at <anonymous>:1:1
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
2018-12-10T02:26:59.002Z
```
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-04 09:42:38 +05:30
David Sherret
7e72f3af61
chore: update copyright to 2024 ( #21753 )
2024-01-01 19:58:21 +00:00
Matt Mastracci
0efe438f7c
perf: remove opAsync ( #21690 )
...
`opAsync` requires a lookup by name on each async call. This is a
mechanical translation of all opAsync calls to ensureFastOps.
The `opAsync` API on Deno.core will be removed at a later time.
2023-12-27 02:30:26 +01:00
Heyang Zhou
10ab8c1ef1
feat(unstable): append commit versionstamp to key ( #21556 )
2023-12-14 00:58:20 +08:00
Igor Zinkovsky
86769b0d1c
feat(ext/kv) add backoffSchedule to enqueue ( #21474 )
...
Also reduces the time to run `kv_queue_undelivered_test.ts` test from
100 seconds down to 3 seconds.
closes #21437
2023-12-12 22:51:23 -08:00
Raashid Anwar
cac17267fb
fix(ext/kv): throw error if already closed ( #21459 )
...
If KV is closed and tries to listen queue should throw an error
closes #20991
2023-12-05 10:16:47 -08:00
Luca Casonato
74e39a927c
feat(unstable): kv.watch() ( #21147 )
...
This commit adds support for a new `kv.watch()` method that allows
watching for changes to a key-value pair. This is useful for cases
where you want to be notified when a key-value pair changes, but
don't want to have to poll for changes.
---------
Co-authored-by: losfair <zhy20000919@hotmail.com>
2023-12-05 21:21:46 +08:00
Luca Casonato
d42f154312
feat: disposable Deno resources ( #20845 )
...
This commit implements Symbol.dispose and Symbol.asyncDispose for
the relevant resources.
Closes #20839
---------
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-01 20:26:12 +01:00
Igor Zinkovsky
f0a022bed4
fix(kv_queues): graceful shutdown ( #20627 )
...
This fixes the `TypeError: Database closed` error during shutdown.
2023-09-26 20:06:57 -07:00
Igor Zinkovsky
035df85732
feat(kv_queues): increase max queue delay to 30 days ( #20626 )
2023-09-22 09:40:35 -07:00
Heyang Zhou
375d8a5bd5
fix(ext/kv): same expireIn
should generate same expireAt
( #20396 )
...
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-09-08 23:20:28 +08:00
Heyang Zhou
c77c836a23
feat(ext/kv): key expiration ( #20091 )
...
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-08-18 17:34:16 +08:00
Luca Casonato
476e4ed03c
fix(ext/kv): expose Deno.AtomicOperation ( #19674 )
2023-07-01 09:24:15 +02:00
Igor Zinkovsky
0773463de1
chore(kv) fix and re-enable queue test ( #19529 )
...
The callback draining code is no longer needed after #19513 .
2023-06-17 15:02:32 -07:00
Igor Zinkovsky
fd9d6baea3
feat(kv) queue implementation ( #19459 )
...
Extend the unstable `Deno.Kv` API to support queues.
2023-06-13 17:49:57 -07:00
Luca Casonato
d905f20cad
fix(ext/kv): throw on the Kv constructor ( #18978 )
...
Closes #18963
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-03 23:08:42 +02:00
Luca Casonato
93a78d3d4a
fix(ext/kv): KvU64#valueOf and KvU64 inspect ( #18656 )
...
`new Deno.KvU64(1n) + 2n == 3n` is now true.
`new Deno.KvU64(1n)` is now inspected as `[Deno.KvU64: 1n]`
(`Object(1n)` is inspected as `[BigInt: 1n]`).
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-03 11:44:00 +00:00
Luca Casonato
1066490847
fix(ext/kv): stricter structured clone serializer ( #18914 )
2023-04-29 17:43:07 +02:00
Luca Casonato
3fbb31c3c1
feat(kv): return ok bool from atomic commit ( #18873 )
2023-04-27 16:59:02 +02:00
Ryan Dahl
2df6db36c8
feat(ext/kv): add more atomic operation helpers ( #18854 )
...
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-04-26 17:14:01 +00:00
Bartek Iwańczuk
97820fe8ab
refactor(ext/kv): don't use bigint literals ( #18841 )
...
This causes `DCHECK` fail in V8 when pointer compression
is disabled.
2023-04-25 20:43:39 +00:00
Ryan Dahl
2184103a5e
feat(kv): AtomicOperation#sum ( #18704 )
2023-04-15 10:33:31 +02:00
Luca Casonato
e0bf8e6faf
fix(ext/kv): keys must be arrays ( #18655 )
...
There was some leftover code from previous iterations, where keys could
be single parts instead of arrays also. This didn't match the types.
2023-04-11 14:36:01 +00:00
Luca Casonato
02e01b171f
fix(dts): improve types for the Deno.KV API ( #18510 )
2023-03-30 22:52:31 +02:00
Luca Casonato
e888c3f534
feat(ext/kv): return versionstamp from set/commit ( #18512 )
...
This commit updates the `Deno.Kv` API to return the new commited
versionstamp for the mutated data from `db.set` and `ao.commit`. This is
returned in the form of a `Deno.KvCommitResult` object that has a
`versionstamp` property.
2023-03-30 20:57:21 +02:00
Heyang Zhou
27834dfc10
chore(ext/kv): add limits ( #18415 )
2023-03-25 15:29:36 +08:00
Heyang Zhou
94ef428b56
fix(ext/kv): add missing getMany
method ( #18410 )
...
The `getMany` method was missing from the implementation of the
`Deno.Kv` class. This patch fixes it.
2023-03-24 20:06:27 +08:00
Ryan Dahl
f9c8d98b77
Revert "refactor: rename Deno.openKv() to Deno.kv() ( #18349 )" ( #18362 )
...
This reverts commit 50b793c9ed
.
2023-03-22 20:23:36 +01:00
Ryan Dahl
50b793c9ed
refactor: rename Deno.openKv() to Deno.kv() ( #18349 )
2023-03-22 10:02:40 -04:00
Heyang Zhou
92ebf4afe5
feat(ext/kv): key-value store ( #18232 )
...
This commit adds unstable "Deno.openKv()" API that allows to open
a key-value database at a specified path.
---------
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-22 12:13:24 +08:00