bun-types 1.2.23-canary.20250925T140721 → 1.2.23-canary.20250927T140547

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bun.d.ts CHANGED
@@ -5047,6 +5047,7 @@ declare module "bun" {
5047
5047
  type SupportedCryptoAlgorithms =
5048
5048
  | "blake2b256"
5049
5049
  | "blake2b512"
5050
+ | "blake2s256"
5050
5051
  | "md4"
5051
5052
  | "md5"
5052
5053
  | "ripemd160"
package/docs/api/fetch.md CHANGED
@@ -336,7 +336,7 @@ This will print the request and response headers to your terminal:
336
336
  ```sh
337
337
  [fetch] > HTTP/1.1 GET http://example.com/
338
338
  [fetch] > Connection: keep-alive
339
- [fetch] > User-Agent: Bun/1.2.23-canary.20250925T140721
339
+ [fetch] > User-Agent: Bun/1.2.23-canary.20250927T140547
340
340
  [fetch] > Accept: */*
341
341
  [fetch] > Host: example.com
342
342
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -184,6 +184,7 @@ Bun.hash.rapidhash("data", 1234);
184
184
 
185
185
  - `"blake2b256"`
186
186
  - `"blake2b512"`
187
+ - `"blake2s256"`
187
188
  - `"md4"`
188
189
  - `"md5"`
189
190
  - `"ripemd160"`
package/docs/api/redis.md CHANGED
@@ -161,6 +161,102 @@ const randomTag = await redis.srandmember("tags");
161
161
  const poppedTag = await redis.spop("tags");
162
162
  ```
163
163
 
164
+ ## Pub/Sub
165
+
166
+ Bun provides native bindings for the [Redis
167
+ Pub/Sub](https://redis.io/docs/latest/develop/pubsub/) protocol. **New in Bun
168
+ 1.2.23**
169
+
170
+ {% callout %}
171
+ **🚧** — The Redis Pub/Sub feature is experimental. Although we expect it to be
172
+ stable, we're currently actively looking for feedback and areas for improvement.
173
+ {% /callout %}
174
+
175
+ ### Basic Usage
176
+
177
+ To get started publishing messages, you can set up a publisher in
178
+ `publisher.ts`:
179
+
180
+ ```typescript#publisher.ts
181
+ import { RedisClient } from "bun";
182
+
183
+ const writer = new RedisClient("redis://localhost:6739");
184
+ await writer.connect();
185
+
186
+ writer.publish("general", "Hello everyone!");
187
+
188
+ writer.close();
189
+ ```
190
+
191
+ In another file, create the subscriber in `subscriber.ts`:
192
+
193
+ ```typescript#subscriber.ts
194
+ import { RedisClient } from "bun";
195
+
196
+ const listener = new RedisClient("redis://localhost:6739");
197
+ await listener.connect();
198
+
199
+ await listener.subscribe("general", (message, channel) => {
200
+ console.log(`Received: ${message}`);
201
+ });
202
+ ```
203
+
204
+ In one shell, run your subscriber:
205
+
206
+ ```bash
207
+ bun run subscriber.ts
208
+ ```
209
+
210
+ and, in another, run your publisher:
211
+
212
+ ```bash
213
+ bun run publisher.ts
214
+ ```
215
+
216
+ {% callout %}
217
+ **Note:** The subscription mode takes over the `RedisClient` connection. A
218
+ client with subscriptions can only call `RedisClient.prototype.subscribe()`. In
219
+ other words, applications which need to message Redis need a separate
220
+ connection, acquirable through `.duplicate()`:
221
+
222
+ ```typescript
223
+ import { RedisClient } from "bun";
224
+
225
+ const redis = new RedisClient("redis://localhost:6379");
226
+ await redis.connect();
227
+ const subscriber = await redis.duplicate();
228
+
229
+ await subscriber.subscribe("foo", () => {});
230
+ await redis.set("bar", "baz");
231
+ ```
232
+
233
+ {% /callout %}
234
+
235
+ ### Publishing
236
+
237
+ Publishing messages is done through the `publish()` method:
238
+
239
+ ```typescript
240
+ await client.publish(channelName, message);
241
+ ```
242
+
243
+ ### Subscriptions
244
+
245
+ The Bun `RedisClient` allows you to subscribe to channels through the
246
+ `.subscribe()` method:
247
+
248
+ ```typescript
249
+ await client.subscribe(channel, (message, channel) => {});
250
+ ```
251
+
252
+ You can unsubscribe through the `.unsubscribe()` method:
253
+
254
+ ```typescript
255
+ await client.unsubscribe(); // Unsubscribe from all channels.
256
+ await client.unsubscribe(channel); // Unsubscribe a particular channel.
257
+ await client.unsubscribe(channel, listener); // Unsubscribe a particular listener.
258
+ ```
259
+
164
260
  ## Advanced Usage
165
261
 
166
262
  ### Command Execution and Pipelining
@@ -482,9 +578,10 @@ When connecting to Redis servers using older versions that don't support RESP3,
482
578
 
483
579
  Current limitations of the Redis client we are planning to address in future versions:
484
580
 
485
- - [ ] No dedicated API for pub/sub functionality (though you can use the raw command API)
486
581
  - [ ] Transactions (MULTI/EXEC) must be done through raw commands for now
487
582
  - [ ] Streams are supported but without dedicated methods
583
+ - [ ] Pub/Sub does not currently support binary data, nor pattern-based
584
+ subscriptions.
488
585
 
489
586
  Unsupported features:
490
587
 
package/docs/api/spawn.md CHANGED
@@ -140,7 +140,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie
140
140
  ```ts
141
141
  const proc = Bun.spawn(["bun", "--version"]);
142
142
  const text = await proc.stdout.text();
143
- console.log(text); // => "1.2.23-canary.20250925T140721\n"
143
+ console.log(text); // => "1.2.23-canary.20250927T140547\n"
144
144
  ```
145
145
 
146
146
  Configure the output stream by passing one of the following values to `stdout/stderr`:
package/docs/cli/pm.md CHANGED
@@ -213,7 +213,7 @@ To display current package version and help:
213
213
 
214
214
  ```bash
215
215
  $ bun pm version
216
- bun pm version v1.2.23-canary.20250925T140721 (ca7428e9)
216
+ bun pm version v1.2.23-canary.20250927T140547 (ca7428e9)
217
217
  Current package version: v1.0.0
218
218
 
219
219
  Increment:
@@ -7,7 +7,7 @@ Use `bun publish` to publish a package to the npm registry.
7
7
  $ bun publish
8
8
 
9
9
  ## Output
10
- bun publish v1.2.23-canary.20250925T140721 (ca7428e9)
10
+ bun publish v1.2.23-canary.20250927T140547 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
package/docs/cli/test.md CHANGED
@@ -109,6 +109,85 @@ Use the `--timeout` flag to specify a _per-test_ timeout in milliseconds. If a t
109
109
  $ bun test --timeout 20
110
110
  ```
111
111
 
112
+ ## Concurrent test execution
113
+
114
+ By default, Bun runs all tests sequentially within each test file. You can enable concurrent execution to run async tests in parallel, significantly speeding up test suites with independent tests.
115
+
116
+ ### `--concurrent` flag
117
+
118
+ Use the `--concurrent` flag to run all tests concurrently within their respective files:
119
+
120
+ ```sh
121
+ $ bun test --concurrent
122
+ ```
123
+
124
+ When this flag is enabled, all tests will run in parallel unless explicitly marked with `test.serial`.
125
+
126
+ ### `--max-concurrency` flag
127
+
128
+ Control the maximum number of tests running simultaneously with the `--max-concurrency` flag:
129
+
130
+ ```sh
131
+ # Limit to 4 concurrent tests
132
+ $ bun test --concurrent --max-concurrency 4
133
+
134
+ # Default: 20
135
+ $ bun test --concurrent
136
+ ```
137
+
138
+ This helps prevent resource exhaustion when running many concurrent tests. The default value is 20.
139
+
140
+ ### `test.concurrent`
141
+
142
+ Mark individual tests to run concurrently, even when the `--concurrent` flag is not used:
143
+
144
+ ```ts
145
+ import { test, expect } from "bun:test";
146
+
147
+ // These tests run in parallel with each other
148
+ test.concurrent("concurrent test 1", async () => {
149
+ await fetch("/api/endpoint1");
150
+ expect(true).toBe(true);
151
+ });
152
+
153
+ test.concurrent("concurrent test 2", async () => {
154
+ await fetch("/api/endpoint2");
155
+ expect(true).toBe(true);
156
+ });
157
+
158
+ // This test runs sequentially
159
+ test("sequential test", () => {
160
+ expect(1 + 1).toBe(2);
161
+ });
162
+ ```
163
+
164
+ ### `test.serial`
165
+
166
+ Force tests to run sequentially, even when the `--concurrent` flag is enabled:
167
+
168
+ ```ts
169
+ import { test, expect } from "bun:test";
170
+
171
+ let sharedState = 0;
172
+
173
+ // These tests must run in order
174
+ test.serial("first serial test", () => {
175
+ sharedState = 1;
176
+ expect(sharedState).toBe(1);
177
+ });
178
+
179
+ test.serial("second serial test", () => {
180
+ // Depends on the previous test
181
+ expect(sharedState).toBe(1);
182
+ sharedState = 2;
183
+ });
184
+
185
+ // This test can run concurrently if --concurrent is enabled
186
+ test("independent test", () => {
187
+ expect(true).toBe(true);
188
+ });
189
+ ```
190
+
112
191
  ## Rerun tests
113
192
 
114
193
  Use the `--rerun-each` flag to run each test multiple times. This is useful for detecting flaky or non-deterministic test failures.
@@ -117,6 +196,36 @@ Use the `--rerun-each` flag to run each test multiple times. This is useful for
117
196
  $ bun test --rerun-each 100
118
197
  ```
119
198
 
199
+ ## Randomize test execution order
200
+
201
+ Use the `--randomize` flag to run tests in a random order. This helps detect tests that depend on shared state or execution order.
202
+
203
+ ```sh
204
+ $ bun test --randomize
205
+ ```
206
+
207
+ When using `--randomize`, the seed used for randomization will be displayed in the test summary:
208
+
209
+ ```sh
210
+ $ bun test --randomize
211
+ # ... test output ...
212
+ --seed=12345
213
+ 2 pass
214
+ 8 fail
215
+ Ran 10 tests across 2 files. [50.00ms]
216
+ ```
217
+
218
+ ### Reproducible random order with `--seed`
219
+
220
+ Use the `--seed` flag to specify a seed for the randomization. This allows you to reproduce the same test order when debugging order-dependent failures.
221
+
222
+ ```sh
223
+ # Reproduce a previous randomized run
224
+ $ bun test --seed 123456
225
+ ```
226
+
227
+ The `--seed` flag implies `--randomize`, so you don't need to specify both. Using the same seed value will always produce the same test execution order, making it easier to debug intermittent failures caused by test interdependencies.
228
+
120
229
  ## Bail out with `--bail`
121
230
 
122
231
  Use the `--bail` flag to abort the test run early after a pre-determined number of test failures. By default Bun will run all tests and report all failures, but sometimes in CI environments it's preferable to terminate earlier to reduce CPU usage.
@@ -9,7 +9,7 @@ $ bunx nuxi init my-nuxt-app
9
9
  ✔ Which package manager would you like to use?
10
10
  bun
11
11
  ◐ Installing dependencies...
12
- bun install v1.2.23-canary.20250925T140721 (16b4bf34)
12
+ bun install v1.2.23-canary.20250927T140547 (16b4bf34)
13
13
  + @nuxt/devtools@0.8.2
14
14
  + nuxt@3.7.0
15
15
  785 packages installed [2.67s]
@@ -15,7 +15,7 @@ This will add the package to `peerDependencies` in `package.json`.
15
15
  ```json-diff
16
16
  {
17
17
  "peerDependencies": {
18
- + "@types/bun": "^1.2.23-canary.20250925T140721"
18
+ + "@types/bun": "^1.2.23-canary.20250927T140547"
19
19
  }
20
20
  }
21
21
  ```
@@ -27,7 +27,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
27
27
  ```json-diff
28
28
  {
29
29
  "peerDependencies": {
30
- "@types/bun": "^1.2.23-canary.20250925T140721"
30
+ "@types/bun": "^1.2.23-canary.20250927T140547"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  + "@types/bun": {
@@ -97,7 +97,7 @@ $ bun update
97
97
  $ bun update @types/bun --latest
98
98
 
99
99
  # Update a dependency to a specific version
100
- $ bun update @types/bun@1.2.23-canary.20250925T140721
100
+ $ bun update @types/bun@1.2.23-canary.20250927T140547
101
101
 
102
102
  # Update all dependencies to the latest versions
103
103
  $ bun update --latest
@@ -21,7 +21,7 @@ Here's what the output of a typical test run looks like. In this case, there are
21
21
 
22
22
  ```sh
23
23
  $ bun test
24
- bun test v1.2.23-canary.20250925T140721 (9c68abdb)
24
+ bun test v1.2.23-canary.20250927T140547 (9c68abdb)
25
25
 
26
26
  test.test.js:
27
27
  ✓ add [0.87ms]
@@ -47,7 +47,7 @@ To only run certain test files, pass a positional argument to `bun test`. The ru
47
47
 
48
48
  ```sh
49
49
  $ bun test test3
50
- bun test v1.2.23-canary.20250925T140721 (9c68abdb)
50
+ bun test v1.2.23-canary.20250927T140547 (9c68abdb)
51
51
 
52
52
  test3.test.js:
53
53
  ✓ add [1.40ms]
@@ -85,7 +85,7 @@ Adding `-t add` will only run tests with "add" in the name. This works with test
85
85
 
86
86
  ```sh
87
87
  $ bun test -t add
88
- bun test v1.2.23-canary.20250925T140721 (9c68abdb)
88
+ bun test v1.2.23-canary.20250927T140547 (9c68abdb)
89
89
 
90
90
  test.test.js:
91
91
  ✓ add [1.79ms]
@@ -18,7 +18,7 @@ The first time this test is executed, Bun will evaluate the value passed into `e
18
18
 
19
19
  ```sh
20
20
  $ bun test test/snap
21
- bun test v1.2.23-canary.20250925T140721 (9c68abdb)
21
+ bun test v1.2.23-canary.20250927T140547 (9c68abdb)
22
22
 
23
23
  test/snap.test.ts:
24
24
  ✓ snapshot [1.48ms]
@@ -61,7 +61,7 @@ Later, when this test file is executed again, Bun will read the snapshot file an
61
61
 
62
62
  ```sh
63
63
  $ bun test
64
- bun test v1.2.23-canary.20250925T140721 (9c68abdb)
64
+ bun test v1.2.23-canary.20250927T140547 (9c68abdb)
65
65
 
66
66
  test/snap.test.ts:
67
67
  ✓ snapshot [1.05ms]
@@ -78,7 +78,7 @@ To update snapshots, use the `--update-snapshots` flag.
78
78
 
79
79
  ```sh
80
80
  $ bun test --update-snapshots
81
- bun test v1.2.23-canary.20250925T140721 (9c68abdb)
81
+ bun test v1.2.23-canary.20250927T140547 (9c68abdb)
82
82
 
83
83
  test/snap.test.ts:
84
84
  ✓ snapshot [0.86ms]
@@ -29,7 +29,7 @@ To regenerate snapshots, use the `--update-snapshots` flag.
29
29
 
30
30
  ```sh
31
31
  $ bun test --update-snapshots
32
- bun test v1.2.23-canary.20250925T140721 (9c68abdb)
32
+ bun test v1.2.23-canary.20250927T140547 (9c68abdb)
33
33
 
34
34
  test/snap.test.ts:
35
35
  ✓ snapshot [0.86ms]
@@ -5,7 +5,7 @@ name: Get the current Bun version
5
5
  Get the current version of Bun in a semver format.
6
6
 
7
7
  ```ts#index.ts
8
- Bun.version; // => "1.2.23-canary.20250925T140721"
8
+ Bun.version; // => "1.2.23-canary.20250927T140547"
9
9
  ```
10
10
 
11
11
  ---
@@ -14,7 +14,7 @@ Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Us
14
14
  ```bash#macOS/Linux_(curl)
15
15
  $ curl -fsSL https://bun.com/install | bash # for macOS, Linux, and WSL
16
16
  # to install a specific version
17
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250925T140721"
17
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250927T140547"
18
18
  ```
19
19
 
20
20
  ```bash#npm
@@ -189,10 +189,10 @@ Since Bun is a single binary, you can install older versions of Bun by re-runnin
189
189
 
190
190
  ### Installing a specific version of Bun on Linux/Mac
191
191
 
192
- To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.23-canary.20250925T140721`.
192
+ To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.23-canary.20250927T140547`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250925T140721"
195
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250927T140547"
196
196
  ```
197
197
 
198
198
  ### Installing a specific version of Bun on Windows
@@ -201,7 +201,7 @@ On Windows, you can install a specific version of Bun by passing the version num
201
201
 
202
202
  ```sh
203
203
  # PowerShell:
204
- $ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.23-canary.20250925T140721"
204
+ $ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.23-canary.20250927T140547"
205
205
  ```
206
206
 
207
207
  ## Downloading Bun binaries directly
@@ -21,7 +21,7 @@ $ sudo pacman -S base-devel ccache cmake git go libiconv libtool make ninja pkg-
21
21
  ```
22
22
 
23
23
  ```bash#Fedora
24
- $ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config rustc ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
24
+ $ sudo dnf install cargo clang19 llvm19 lld19 ccache cmake git golang libtool ninja-build pkg-config rustc ruby libatomic-static libstdc++-static sed unzip which libicu-devel 'perl(Math::BigInt)'
25
25
  ```
26
26
 
27
27
  ```bash#openSUSE Tumbleweed
@@ -124,11 +124,11 @@ await fetch("https://example.com", {
124
124
  This prints the `fetch` request as a single-line `curl` command to let you copy-paste into your terminal to replicate the request.
125
125
 
126
126
  ```sh
127
- [fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.23-canary.20250925T140721" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
127
+ [fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.23-canary.20250927T140547" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
128
128
  [fetch] > HTTP/1.1 POST https://example.com/
129
129
  [fetch] > content-type: application/json
130
130
  [fetch] > Connection: keep-alive
131
- [fetch] > User-Agent: Bun/1.2.23-canary.20250925T140721
131
+ [fetch] > User-Agent: Bun/1.2.23-canary.20250927T140547
132
132
  [fetch] > Accept: */*
133
133
  [fetch] > Host: example.com
134
134
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -170,7 +170,7 @@ This prints the following to the console:
170
170
  [fetch] > HTTP/1.1 POST https://example.com/
171
171
  [fetch] > content-type: application/json
172
172
  [fetch] > Connection: keep-alive
173
- [fetch] > User-Agent: Bun/1.2.23-canary.20250925T140721
173
+ [fetch] > User-Agent: Bun/1.2.23-canary.20250927T140547
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
package/docs/test/dom.md CHANGED
@@ -55,7 +55,7 @@ Let's run this test with `bun test`:
55
55
 
56
56
  ```bash
57
57
  $ bun test
58
- bun test v1.2.23-canary.20250925T140721
58
+ bun test v1.2.23-canary.20250927T140547
59
59
 
60
60
  dom.test.ts:
61
61
  ✓ dom test [0.82ms]
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.23-canary.20250925T140721",
2
+ "version": "1.2.23-canary.20250927T140547",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",
package/redis.d.ts CHANGED
@@ -52,21 +52,25 @@ declare module "bun" {
52
52
 
53
53
  export namespace RedisClient {
54
54
  type KeyLike = string | ArrayBufferView | Blob;
55
+ type StringPubSubListener = (message: string, channel: string) => void;
56
+
57
+ // Buffer subscriptions are not yet implemented
58
+ // type BufferPubSubListener = (message: Uint8Array<ArrayBuffer>, channel: string) => void;
55
59
  }
56
60
 
57
61
  export class RedisClient {
58
62
  /**
59
63
  * Creates a new Redis client
60
- * @param url URL to connect to, defaults to process.env.VALKEY_URL, process.env.REDIS_URL, or "valkey://localhost:6379"
64
+ *
65
+ * @param url URL to connect to, defaults to `process.env.VALKEY_URL`,
66
+ * `process.env.REDIS_URL`, or `"valkey://localhost:6379"`
61
67
  * @param options Additional options
62
68
  *
63
69
  * @example
64
70
  * ```ts
65
- * const valkey = new RedisClient();
66
- *
67
- * await valkey.set("hello", "world");
68
- *
69
- * console.log(await valkey.get("hello"));
71
+ * const redis = new RedisClient();
72
+ * await redis.set("hello", "world");
73
+ * console.log(await redis.get("hello"));
70
74
  * ```
71
75
  */
72
76
  constructor(url?: string, options?: RedisOptions);
@@ -88,12 +92,14 @@ declare module "bun" {
88
92
 
89
93
  /**
90
94
  * Callback fired when the client disconnects from the Redis server
95
+ *
91
96
  * @param error The error that caused the disconnection
92
97
  */
93
98
  onclose: ((this: RedisClient, error: Error) => void) | null;
94
99
 
95
100
  /**
96
101
  * Connect to the Redis server
102
+ *
97
103
  * @returns A promise that resolves when connected
98
104
  */
99
105
  connect(): Promise<void>;
@@ -152,10 +158,12 @@ declare module "bun" {
152
158
  set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, px: "PX", milliseconds: number): Promise<"OK">;
153
159
 
154
160
  /**
155
- * Set key to hold the string value with expiration at a specific Unix timestamp
161
+ * Set key to hold the string value with expiration at a specific Unix
162
+ * timestamp
156
163
  * @param key The key to set
157
164
  * @param value The value to set
158
- * @param exat Set the specified Unix time at which the key will expire, in seconds
165
+ * @param exat Set the specified Unix time at which the key will expire, in
166
+ * seconds
159
167
  * @returns Promise that resolves with "OK" on success
160
168
  */
161
169
  set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, exat: "EXAT", timestampSeconds: number): Promise<"OK">;
@@ -179,7 +187,8 @@ declare module "bun" {
179
187
  * @param key The key to set
180
188
  * @param value The value to set
181
189
  * @param nx Only set the key if it does not already exist
182
- * @returns Promise that resolves with "OK" on success, or null if the key already exists
190
+ * @returns Promise that resolves with "OK" on success, or null if the key
191
+ * already exists
183
192
  */
184
193
  set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, nx: "NX"): Promise<"OK" | null>;
185
194
 
@@ -188,7 +197,8 @@ declare module "bun" {
188
197
  * @param key The key to set
189
198
  * @param value The value to set
190
199
  * @param xx Only set the key if it already exists
191
- * @returns Promise that resolves with "OK" on success, or null if the key does not exist
200
+ * @returns Promise that resolves with "OK" on success, or null if the key
201
+ * does not exist
192
202
  */
193
203
  set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, xx: "XX"): Promise<"OK" | null>;
194
204
 
@@ -196,8 +206,10 @@ declare module "bun" {
196
206
  * Set key to hold the string value and return the old value
197
207
  * @param key The key to set
198
208
  * @param value The value to set
199
- * @param get Return the old string stored at key, or null if key did not exist
200
- * @returns Promise that resolves with the old value, or null if key did not exist
209
+ * @param get Return the old string stored at key, or null if key did not
210
+ * exist
211
+ * @returns Promise that resolves with the old value, or null if key did not
212
+ * exist
201
213
  */
202
214
  set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, get: "GET"): Promise<string | null>;
203
215
 
@@ -243,7 +255,8 @@ declare module "bun" {
243
255
  /**
244
256
  * Determine if a key exists
245
257
  * @param key The key to check
246
- * @returns Promise that resolves with true if the key exists, false otherwise
258
+ * @returns Promise that resolves with true if the key exists, false
259
+ * otherwise
247
260
  */
248
261
  exists(key: RedisClient.KeyLike): Promise<boolean>;
249
262
 
@@ -258,7 +271,8 @@ declare module "bun" {
258
271
  /**
259
272
  * Get the time to live for a key in seconds
260
273
  * @param key The key to get the TTL for
261
- * @returns Promise that resolves with the TTL, -1 if no expiry, or -2 if key doesn't exist
274
+ * @returns Promise that resolves with the TTL, -1 if no expiry, or -2 if
275
+ * key doesn't exist
262
276
  */
263
277
  ttl(key: RedisClient.KeyLike): Promise<number>;
264
278
 
@@ -290,7 +304,8 @@ declare module "bun" {
290
304
  * Check if a value is a member of a set
291
305
  * @param key The set key
292
306
  * @param member The member to check
293
- * @returns Promise that resolves with true if the member exists, false otherwise
307
+ * @returns Promise that resolves with true if the member exists, false
308
+ * otherwise
294
309
  */
295
310
  sismember(key: RedisClient.KeyLike, member: string): Promise<boolean>;
296
311
 
@@ -298,7 +313,8 @@ declare module "bun" {
298
313
  * Add a member to a set
299
314
  * @param key The set key
300
315
  * @param member The member to add
301
- * @returns Promise that resolves with 1 if the member was added, 0 if it already existed
316
+ * @returns Promise that resolves with 1 if the member was added, 0 if it
317
+ * already existed
302
318
  */
303
319
  sadd(key: RedisClient.KeyLike, member: string): Promise<number>;
304
320
 
@@ -306,7 +322,8 @@ declare module "bun" {
306
322
  * Remove a member from a set
307
323
  * @param key The set key
308
324
  * @param member The member to remove
309
- * @returns Promise that resolves with 1 if the member was removed, 0 if it didn't exist
325
+ * @returns Promise that resolves with 1 if the member was removed, 0 if it
326
+ * didn't exist
310
327
  */
311
328
  srem(key: RedisClient.KeyLike, member: string): Promise<number>;
312
329
 
@@ -320,14 +337,16 @@ declare module "bun" {
320
337
  /**
321
338
  * Get a random member from a set
322
339
  * @param key The set key
323
- * @returns Promise that resolves with a random member, or null if the set is empty
340
+ * @returns Promise that resolves with a random member, or null if the set
341
+ * is empty
324
342
  */
325
343
  srandmember(key: RedisClient.KeyLike): Promise<string | null>;
326
344
 
327
345
  /**
328
346
  * Remove and return a random member from a set
329
347
  * @param key The set key
330
- * @returns Promise that resolves with the removed member, or null if the set is empty
348
+ * @returns Promise that resolves with the removed member, or null if the
349
+ * set is empty
331
350
  */
332
351
  spop(key: RedisClient.KeyLike): Promise<string | null>;
333
352
 
@@ -394,28 +413,32 @@ declare module "bun" {
394
413
  /**
395
414
  * Remove and get the first element in a list
396
415
  * @param key The list key
397
- * @returns Promise that resolves with the first element, or null if the list is empty
416
+ * @returns Promise that resolves with the first element, or null if the
417
+ * list is empty
398
418
  */
399
419
  lpop(key: RedisClient.KeyLike): Promise<string | null>;
400
420
 
401
421
  /**
402
422
  * Remove the expiration from a key
403
423
  * @param key The key to persist
404
- * @returns Promise that resolves with 1 if the timeout was removed, 0 if the key doesn't exist or has no timeout
424
+ * @returns Promise that resolves with 1 if the timeout was removed, 0 if
425
+ * the key doesn't exist or has no timeout
405
426
  */
406
427
  persist(key: RedisClient.KeyLike): Promise<number>;
407
428
 
408
429
  /**
409
430
  * Get the expiration time of a key as a UNIX timestamp in milliseconds
410
431
  * @param key The key to check
411
- * @returns Promise that resolves with the timestamp, or -1 if the key has no expiration, or -2 if the key doesn't exist
432
+ * @returns Promise that resolves with the timestamp, or -1 if the key has
433
+ * no expiration, or -2 if the key doesn't exist
412
434
  */
413
435
  pexpiretime(key: RedisClient.KeyLike): Promise<number>;
414
436
 
415
437
  /**
416
438
  * Get the time to live for a key in milliseconds
417
439
  * @param key The key to check
418
- * @returns Promise that resolves with the TTL in milliseconds, or -1 if the key has no expiration, or -2 if the key doesn't exist
440
+ * @returns Promise that resolves with the TTL in milliseconds, or -1 if the
441
+ * key has no expiration, or -2 if the key doesn't exist
419
442
  */
420
443
  pttl(key: RedisClient.KeyLike): Promise<number>;
421
444
 
@@ -429,42 +452,48 @@ declare module "bun" {
429
452
  /**
430
453
  * Get the number of members in a set
431
454
  * @param key The set key
432
- * @returns Promise that resolves with the cardinality (number of elements) of the set
455
+ * @returns Promise that resolves with the cardinality (number of elements)
456
+ * of the set
433
457
  */
434
458
  scard(key: RedisClient.KeyLike): Promise<number>;
435
459
 
436
460
  /**
437
461
  * Get the length of the value stored in a key
438
462
  * @param key The key to check
439
- * @returns Promise that resolves with the length of the string value, or 0 if the key doesn't exist
463
+ * @returns Promise that resolves with the length of the string value, or 0
464
+ * if the key doesn't exist
440
465
  */
441
466
  strlen(key: RedisClient.KeyLike): Promise<number>;
442
467
 
443
468
  /**
444
469
  * Get the number of members in a sorted set
445
470
  * @param key The sorted set key
446
- * @returns Promise that resolves with the cardinality (number of elements) of the sorted set
471
+ * @returns Promise that resolves with the cardinality (number of elements)
472
+ * of the sorted set
447
473
  */
448
474
  zcard(key: RedisClient.KeyLike): Promise<number>;
449
475
 
450
476
  /**
451
477
  * Remove and return members with the highest scores in a sorted set
452
478
  * @param key The sorted set key
453
- * @returns Promise that resolves with the removed member and its score, or null if the set is empty
479
+ * @returns Promise that resolves with the removed member and its score, or
480
+ * null if the set is empty
454
481
  */
455
482
  zpopmax(key: RedisClient.KeyLike): Promise<string | null>;
456
483
 
457
484
  /**
458
485
  * Remove and return members with the lowest scores in a sorted set
459
486
  * @param key The sorted set key
460
- * @returns Promise that resolves with the removed member and its score, or null if the set is empty
487
+ * @returns Promise that resolves with the removed member and its score, or
488
+ * null if the set is empty
461
489
  */
462
490
  zpopmin(key: RedisClient.KeyLike): Promise<string | null>;
463
491
 
464
492
  /**
465
493
  * Get one or multiple random members from a sorted set
466
494
  * @param key The sorted set key
467
- * @returns Promise that resolves with a random member, or null if the set is empty
495
+ * @returns Promise that resolves with a random member, or null if the set
496
+ * is empty
468
497
  */
469
498
  zrandmember(key: RedisClient.KeyLike): Promise<string | null>;
470
499
 
@@ -472,7 +501,8 @@ declare module "bun" {
472
501
  * Append a value to a key
473
502
  * @param key The key to append to
474
503
  * @param value The value to append
475
- * @returns Promise that resolves with the length of the string after the append operation
504
+ * @returns Promise that resolves with the length of the string after the
505
+ * append operation
476
506
  */
477
507
  append(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
478
508
 
@@ -480,7 +510,8 @@ declare module "bun" {
480
510
  * Set the value of a key and return its old value
481
511
  * @param key The key to set
482
512
  * @param value The value to set
483
- * @returns Promise that resolves with the old value, or null if the key didn't exist
513
+ * @returns Promise that resolves with the old value, or null if the key
514
+ * didn't exist
484
515
  */
485
516
  getset(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<string | null>;
486
517
 
@@ -488,7 +519,8 @@ declare module "bun" {
488
519
  * Prepend one or multiple values to a list
489
520
  * @param key The list key
490
521
  * @param value The value to prepend
491
- * @returns Promise that resolves with the length of the list after the push operation
522
+ * @returns Promise that resolves with the length of the list after the push
523
+ * operation
492
524
  */
493
525
  lpush(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
494
526
 
@@ -496,7 +528,8 @@ declare module "bun" {
496
528
  * Prepend a value to a list, only if the list exists
497
529
  * @param key The list key
498
530
  * @param value The value to prepend
499
- * @returns Promise that resolves with the length of the list after the push operation, or 0 if the list doesn't exist
531
+ * @returns Promise that resolves with the length of the list after the push
532
+ * operation, or 0 if the list doesn't exist
500
533
  */
501
534
  lpushx(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
502
535
 
@@ -504,7 +537,8 @@ declare module "bun" {
504
537
  * Add one or more members to a HyperLogLog
505
538
  * @param key The HyperLogLog key
506
539
  * @param element The element to add
507
- * @returns Promise that resolves with 1 if the HyperLogLog was altered, 0 otherwise
540
+ * @returns Promise that resolves with 1 if the HyperLogLog was altered, 0
541
+ * otherwise
508
542
  */
509
543
  pfadd(key: RedisClient.KeyLike, element: string): Promise<number>;
510
544
 
@@ -512,7 +546,8 @@ declare module "bun" {
512
546
  * Append one or multiple values to a list
513
547
  * @param key The list key
514
548
  * @param value The value to append
515
- * @returns Promise that resolves with the length of the list after the push operation
549
+ * @returns Promise that resolves with the length of the list after the push
550
+ * operation
516
551
  */
517
552
  rpush(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
518
553
 
@@ -520,7 +555,8 @@ declare module "bun" {
520
555
  * Append a value to a list, only if the list exists
521
556
  * @param key The list key
522
557
  * @param value The value to append
523
- * @returns Promise that resolves with the length of the list after the push operation, or 0 if the list doesn't exist
558
+ * @returns Promise that resolves with the length of the list after the push
559
+ * operation, or 0 if the list doesn't exist
524
560
  */
525
561
  rpushx(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
526
562
 
@@ -528,7 +564,8 @@ declare module "bun" {
528
564
  * Set the value of a key, only if the key does not exist
529
565
  * @param key The key to set
530
566
  * @param value The value to set
531
- * @returns Promise that resolves with 1 if the key was set, 0 if the key was not set
567
+ * @returns Promise that resolves with 1 if the key was set, 0 if the key
568
+ * was not set
532
569
  */
533
570
  setnx(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
534
571
 
@@ -536,14 +573,16 @@ declare module "bun" {
536
573
  * Get the score associated with the given member in a sorted set
537
574
  * @param key The sorted set key
538
575
  * @param member The member to get the score for
539
- * @returns Promise that resolves with the score of the member as a string, or null if the member or key doesn't exist
576
+ * @returns Promise that resolves with the score of the member as a string,
577
+ * or null if the member or key doesn't exist
540
578
  */
541
579
  zscore(key: RedisClient.KeyLike, member: string): Promise<string | null>;
542
580
 
543
581
  /**
544
582
  * Get the values of all specified keys
545
583
  * @param keys The keys to get
546
- * @returns Promise that resolves with an array of values, with null for keys that don't exist
584
+ * @returns Promise that resolves with an array of values, with null for
585
+ * keys that don't exist
547
586
  */
548
587
  mget(...keys: RedisClient.KeyLike[]): Promise<(string | null)[]>;
549
588
 
@@ -557,37 +596,46 @@ declare module "bun" {
557
596
  /**
558
597
  * Return a serialized version of the value stored at the specified key
559
598
  * @param key The key to dump
560
- * @returns Promise that resolves with the serialized value, or null if the key doesn't exist
599
+ * @returns Promise that resolves with the serialized value, or null if the
600
+ * key doesn't exist
561
601
  */
562
602
  dump(key: RedisClient.KeyLike): Promise<string | null>;
563
603
 
564
604
  /**
565
605
  * Get the expiration time of a key as a UNIX timestamp in seconds
606
+ *
566
607
  * @param key The key to check
567
- * @returns Promise that resolves with the timestamp, or -1 if the key has no expiration, or -2 if the key doesn't exist
608
+ * @returns Promise that resolves with the timestamp, or -1 if the key has
609
+ * no expiration, or -2 if the key doesn't exist
568
610
  */
569
611
  expiretime(key: RedisClient.KeyLike): Promise<number>;
570
612
 
571
613
  /**
572
614
  * Get the value of a key and delete the key
615
+ *
573
616
  * @param key The key to get and delete
574
- * @returns Promise that resolves with the value of the key, or null if the key doesn't exist
617
+ * @returns Promise that resolves with the value of the key, or null if the
618
+ * key doesn't exist
575
619
  */
576
620
  getdel(key: RedisClient.KeyLike): Promise<string | null>;
577
621
 
578
622
  /**
579
623
  * Get the value of a key and optionally set its expiration
624
+ *
580
625
  * @param key The key to get
581
- * @returns Promise that resolves with the value of the key, or null if the key doesn't exist
626
+ * @returns Promise that resolves with the value of the key, or null if the
627
+ * key doesn't exist
582
628
  */
583
629
  getex(key: RedisClient.KeyLike): Promise<string | null>;
584
630
 
585
631
  /**
586
632
  * Get the value of a key and set its expiration in seconds
633
+ *
587
634
  * @param key The key to get
588
635
  * @param ex Set the specified expire time, in seconds
589
636
  * @param seconds The number of seconds until expiration
590
- * @returns Promise that resolves with the value of the key, or null if the key doesn't exist
637
+ * @returns Promise that resolves with the value of the key, or null if the
638
+ * key doesn't exist
591
639
  */
592
640
  getex(key: RedisClient.KeyLike, ex: "EX", seconds: number): Promise<string | null>;
593
641
 
@@ -602,6 +650,7 @@ declare module "bun" {
602
650
 
603
651
  /**
604
652
  * Get the value of a key and set its expiration at a specific Unix timestamp in seconds
653
+ *
605
654
  * @param key The key to get
606
655
  * @param exat Set the specified Unix time at which the key will expire, in seconds
607
656
  * @param timestampSeconds The Unix timestamp in seconds
@@ -611,6 +660,7 @@ declare module "bun" {
611
660
 
612
661
  /**
613
662
  * Get the value of a key and set its expiration at a specific Unix timestamp in milliseconds
663
+ *
614
664
  * @param key The key to get
615
665
  * @param pxat Set the specified Unix time at which the key will expire, in milliseconds
616
666
  * @param timestampMilliseconds The Unix timestamp in milliseconds
@@ -620,6 +670,7 @@ declare module "bun" {
620
670
 
621
671
  /**
622
672
  * Get the value of a key and remove its expiration
673
+ *
623
674
  * @param key The key to get
624
675
  * @param persist Remove the expiration from the key
625
676
  * @returns Promise that resolves with the value of the key, or null if the key doesn't exist
@@ -634,10 +685,133 @@ declare module "bun" {
634
685
 
635
686
  /**
636
687
  * Ping the server with a message
688
+ *
637
689
  * @param message The message to send to the server
638
690
  * @returns Promise that resolves with the message if the server is reachable, or throws an error if the server is not reachable
639
691
  */
640
692
  ping(message: RedisClient.KeyLike): Promise<string>;
693
+
694
+ /**
695
+ * Publish a message to a Redis channel.
696
+ *
697
+ * @param channel The channel to publish to.
698
+ * @param message The message to publish.
699
+ *
700
+ * @returns The number of clients that received the message. Note that in a
701
+ * cluster this returns the total number of clients in the same node.
702
+ */
703
+ publish(channel: string, message: string): Promise<number>;
704
+
705
+ /**
706
+ * Subscribe to a Redis channel.
707
+ *
708
+ * Subscribing disables automatic pipelining, so all commands will be
709
+ * received immediately.
710
+ *
711
+ * Subscribing moves the channel to a dedicated subscription state which
712
+ * prevents most other commands from being executed until unsubscribed. Only
713
+ * {@link ping `.ping()`}, {@link subscribe `.subscribe()`}, and
714
+ * {@link unsubscribe `.unsubscribe()`} are legal to invoke in a subscribed
715
+ * upon channel.
716
+ *
717
+ * @param channel The channel to subscribe to.
718
+ * @param listener The listener to call when a message is received on the
719
+ * channel. The listener will receive the message as the first argument and
720
+ * the channel as the second argument.
721
+ *
722
+ * @example
723
+ * ```ts
724
+ * await client.subscribe("my-channel", (message, channel) => {
725
+ * console.log(`Received message on ${channel}: ${message}`);
726
+ * });
727
+ * ```
728
+ */
729
+ subscribe(channel: string, listener: RedisClient.StringPubSubListener): Promise<number>;
730
+
731
+ /**
732
+ * Subscribe to multiple Redis channels.
733
+ *
734
+ * Subscribing disables automatic pipelining, so all commands will be
735
+ * received immediately.
736
+ *
737
+ * Subscribing moves the channels to a dedicated subscription state in which
738
+ * only a limited set of commands can be executed.
739
+ *
740
+ * @param channels An array of channels to subscribe to.
741
+ * @param listener The listener to call when a message is received on any of
742
+ * the subscribed channels. The listener will receive the message as the
743
+ * first argument and the channel as the second argument.
744
+ */
745
+ subscribe(channels: string[], listener: RedisClient.StringPubSubListener): Promise<number>;
746
+
747
+ /**
748
+ * Unsubscribe from a singular Redis channel.
749
+ *
750
+ * @param channel The channel to unsubscribe from.
751
+ *
752
+ * If there are no more channels subscribed to, the client automatically
753
+ * re-enables pipelining if it was previously enabled.
754
+ *
755
+ * Unsubscribing moves the channel back to a normal state out of the
756
+ * subscription state if all channels have been unsubscribed from. For
757
+ * further details on the subscription state, see
758
+ * {@link subscribe `.subscribe()`}.
759
+ */
760
+ unsubscribe(channel: string): Promise<void>;
761
+
762
+ /**
763
+ * Remove a listener from a given Redis channel.
764
+ *
765
+ * If there are no more channels subscribed to, the client automatically
766
+ * re-enables pipelining if it was previously enabled.
767
+ *
768
+ * Unsubscribing moves the channel back to a normal state out of the
769
+ * subscription state if all channels have been unsubscribed from. For
770
+ * further details on the subscription state, see
771
+ * {@link subscribe `.subscribe()`}.
772
+ *
773
+ * @param channel The channel to unsubscribe from.
774
+ * @param listener The listener to remove. This is tested against
775
+ * referential equality so you must pass the exact same listener instance as
776
+ * when subscribing.
777
+ */
778
+ unsubscribe(channel: string, listener: RedisClient.StringPubSubListener): Promise<void>;
779
+
780
+ /**
781
+ * Unsubscribe from all registered Redis channels.
782
+ *
783
+ * The client will automatically re-enable pipelining if it was previously
784
+ * enabled.
785
+ *
786
+ * Unsubscribing moves the channel back to a normal state out of the
787
+ * subscription state if all channels have been unsubscribed from. For
788
+ * further details on the subscription state, see
789
+ * {@link subscribe `.subscribe()`}.
790
+ */
791
+ unsubscribe(): Promise<void>;
792
+
793
+ /**
794
+ * Unsubscribe from multiple Redis channels.
795
+ *
796
+ * @param channels An array of channels to unsubscribe from.
797
+ *
798
+ * If there are no more channels subscribed to, the client automatically
799
+ * re-enables pipelining if it was previously enabled.
800
+ *
801
+ * Unsubscribing moves the channel back to a normal state out of the
802
+ * subscription state if all channels have been unsubscribed from. For
803
+ * further details on the subscription state, see
804
+ * {@link subscribe `.subscribe()`}.
805
+ */
806
+ unsubscribe(channels: string[]): Promise<void>;
807
+
808
+ /**
809
+ * @brief Create a new RedisClient instance with the same configuration as
810
+ * the current instance.
811
+ *
812
+ * This will open up a new connection to the Redis server.
813
+ */
814
+ duplicate(): Promise<RedisClient>;
641
815
  }
642
816
 
643
817
  /**
package/sql.d.ts CHANGED
@@ -12,6 +12,68 @@ declare module "bun" {
12
12
  release(): void;
13
13
  }
14
14
 
15
+ type ArrayType =
16
+ | "BOOLEAN"
17
+ | "BYTEA"
18
+ | "CHAR"
19
+ | "NAME"
20
+ | "TEXT"
21
+ | "CHAR"
22
+ | "VARCHAR"
23
+ | "SMALLINT"
24
+ | "INT2VECTOR"
25
+ | "INTEGER"
26
+ | "INT"
27
+ | "BIGINT"
28
+ | "REAL"
29
+ | "DOUBLE PRECISION"
30
+ | "NUMERIC"
31
+ | "MONEY"
32
+ | "OID"
33
+ | "TID"
34
+ | "XID"
35
+ | "CID"
36
+ | "JSON"
37
+ | "JSONB"
38
+ | "JSONPATH"
39
+ | "XML"
40
+ | "POINT"
41
+ | "LSEG"
42
+ | "PATH"
43
+ | "BOX"
44
+ | "POLYGON"
45
+ | "LINE"
46
+ | "CIRCLE"
47
+ | "CIDR"
48
+ | "MACADDR"
49
+ | "INET"
50
+ | "MACADDR8"
51
+ | "DATE"
52
+ | "TIME"
53
+ | "TIMESTAMP"
54
+ | "TIMESTAMPTZ"
55
+ | "INTERVAL"
56
+ | "TIMETZ"
57
+ | "BIT"
58
+ | "VARBIT"
59
+ | "ACLITEM"
60
+ | "PG_DATABASE"
61
+ | (string & {});
62
+
63
+ /**
64
+ * Represents a SQL array parameter
65
+ */
66
+ interface SQLArrayParameter {
67
+ /**
68
+ * The serialized values of the array parameter
69
+ */
70
+ serializedValues: string;
71
+ /**
72
+ * The type of the array parameter
73
+ */
74
+ arrayType: ArrayType;
75
+ }
76
+
15
77
  /**
16
78
  * Represents a client within a transaction context Extends SQL with savepoint
17
79
  * functionality
@@ -630,6 +692,21 @@ declare module "bun" {
630
692
  */
631
693
  reserve(): Promise<ReservedSQL>;
632
694
 
695
+ /**
696
+ * Creates a new SQL array parameter
697
+ * @param values - The values to create the array parameter from
698
+ * @param typeNameOrTypeID - The type name or type ID to create the array parameter from, if omitted it will default to JSON
699
+ * @returns A new SQL array parameter
700
+ *
701
+ * @example
702
+ * ```ts
703
+ * const array = sql.array([1, 2, 3], "INT");
704
+ * await sql`CREATE TABLE users_posts (user_id INT, posts_id INT[])`;
705
+ * await sql`INSERT INTO users_posts (user_id, posts_id) VALUES (${user.id}, ${array})`;
706
+ * ```
707
+ */
708
+ array(values: any[], typeNameOrTypeID?: number | ArrayType): SQLArrayParameter;
709
+
633
710
  /**
634
711
  * Begins a new transaction.
635
712
  *