@versori/run 0.1.0-alpha.11 → 0.1.0-alpha.13
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/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/connect.d.ts +3 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/connect.d.ts.map +1 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/connect.js +28 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/deno_transport.d.ts +35 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/deno_transport.d.ts.map +1 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/deno_transport.js +328 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/mod.d.ts +3 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/mod.js +2 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/version.d.ts +2 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/version.d.ts.map +1 -0
- package/esm/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/version.js +2 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.js +2 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts +21 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/concat.js +32 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/copy.d.ts +41 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/copy.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/copy.js +50 -0
- package/{script/deps/jsr.io/@std/fmt/1.0.6 → esm/deps/jsr.io/@std/fmt/1.0.5}/colors.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/fs/{1.0.16 → 1.0.11}/exists.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/io/0.225.2/_common.d.ts +3 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/_common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/_common.js +8 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/_constants.d.ts +3 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/_constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/_constants.js +4 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/buffer.d.ts +321 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/buffer.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/buffer.js +488 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/copy.d.ts +25 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/copy.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/copy.js +36 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/iterate_reader.d.ts +80 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/iterate_reader.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/iterate_reader.js +96 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/mod.d.ts +25 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/mod.js +25 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/read_all.d.ts +42 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/read_all.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/read_all.js +72 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/reader_from_stream_reader.d.ts +20 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/reader_from_stream_reader.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/reader_from_stream_reader.js +36 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/to_readable_stream.d.ts +40 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/to_readable_stream.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/to_readable_stream.js +54 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/to_writable_stream.d.ts +27 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/to_writable_stream.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.2/to_writable_stream.js +44 -0
- package/esm/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts +21 -0
- package/esm/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.14/console_handler.js +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.14/rotating_file_handler.js +1 -1
- package/esm/src/context/Context.d.ts +14 -4
- package/esm/src/context/Context.d.ts.map +1 -1
- package/esm/src/context/Context.js +16 -10
- package/esm/src/context/ContextProvider.d.ts +3 -4
- package/esm/src/context/ContextProvider.d.ts.map +1 -1
- package/esm/src/context/ContextProvider.js +5 -5
- package/esm/src/dsl/http/versori/platformapi.d.ts +2 -1
- package/esm/src/dsl/http/versori/platformapi.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/platformapi.js +12 -1
- package/esm/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/esm/src/dsl/http/versori/roundtripper.js +32 -35
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts +45 -3
- package/esm/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/esm/src/dsl/triggers/WebhookTrigger.js +10 -6
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts +6 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/esm/src/interpreter/memory/MemoryInterpreter.js +67 -5
- package/esm/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/esm/src/interpreter/memory/compilers/webhook.js +106 -32
- package/esm/src/kv/nats/NatsKeyValueProvider.d.ts +2 -1
- package/esm/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/esm/src/kv/nats/NatsKeyValueProvider.js +1 -1
- package/package.json +2 -1
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/connect.d.ts +3 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/connect.d.ts.map +1 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/connect.js +31 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/deno_transport.d.ts +35 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/deno_transport.d.ts.map +1 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/deno_transport.js +333 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/mod.d.ts +3 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/mod.js +20 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/version.d.ts +2 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/version.d.ts.map +1 -0
- package/script/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/version.js +5 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/_types.js +3 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts +21 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/concat.js +35 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/copy.d.ts +41 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/copy.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/copy.js +53 -0
- package/{esm/deps/jsr.io/@std/fmt/1.0.6 → script/deps/jsr.io/@std/fmt/1.0.5}/colors.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/fs/{1.0.16 → 1.0.11}/exists.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/io/0.225.2/_common.d.ts +3 -0
- package/script/deps/jsr.io/@std/io/0.225.2/_common.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/_common.js +11 -0
- package/script/deps/jsr.io/@std/io/0.225.2/_constants.d.ts +3 -0
- package/script/deps/jsr.io/@std/io/0.225.2/_constants.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/_constants.js +7 -0
- package/script/deps/jsr.io/@std/io/0.225.2/buffer.d.ts +321 -0
- package/script/deps/jsr.io/@std/io/0.225.2/buffer.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/buffer.js +492 -0
- package/script/deps/jsr.io/@std/io/0.225.2/copy.d.ts +25 -0
- package/script/deps/jsr.io/@std/io/0.225.2/copy.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/copy.js +39 -0
- package/script/deps/jsr.io/@std/io/0.225.2/iterate_reader.d.ts +80 -0
- package/script/deps/jsr.io/@std/io/0.225.2/iterate_reader.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/iterate_reader.js +100 -0
- package/script/deps/jsr.io/@std/io/0.225.2/mod.d.ts +25 -0
- package/script/deps/jsr.io/@std/io/0.225.2/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/mod.js +41 -0
- package/script/deps/jsr.io/@std/io/0.225.2/read_all.d.ts +42 -0
- package/script/deps/jsr.io/@std/io/0.225.2/read_all.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/read_all.js +76 -0
- package/script/deps/jsr.io/@std/io/0.225.2/reader_from_stream_reader.d.ts +20 -0
- package/script/deps/jsr.io/@std/io/0.225.2/reader_from_stream_reader.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/reader_from_stream_reader.js +39 -0
- package/script/deps/jsr.io/@std/io/0.225.2/to_readable_stream.d.ts +40 -0
- package/script/deps/jsr.io/@std/io/0.225.2/to_readable_stream.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/to_readable_stream.js +57 -0
- package/script/deps/jsr.io/@std/io/0.225.2/to_writable_stream.d.ts +27 -0
- package/script/deps/jsr.io/@std/io/0.225.2/to_writable_stream.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.2/to_writable_stream.js +47 -0
- package/script/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts +21 -0
- package/script/deps/jsr.io/@std/log/0.224.14/base_handler.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/log/0.224.14/console_handler.js +1 -1
- package/script/deps/jsr.io/@std/log/0.224.14/rotating_file_handler.js +1 -1
- package/script/src/context/Context.d.ts +14 -4
- package/script/src/context/Context.d.ts.map +1 -1
- package/script/src/context/Context.js +16 -10
- package/script/src/context/ContextProvider.d.ts +3 -4
- package/script/src/context/ContextProvider.d.ts.map +1 -1
- package/script/src/context/ContextProvider.js +5 -5
- package/script/src/dsl/http/versori/platformapi.d.ts +2 -1
- package/script/src/dsl/http/versori/platformapi.d.ts.map +1 -1
- package/script/src/dsl/http/versori/platformapi.js +12 -1
- package/script/src/dsl/http/versori/roundtripper.d.ts.map +1 -1
- package/script/src/dsl/http/versori/roundtripper.js +32 -35
- package/script/src/dsl/triggers/WebhookTrigger.d.ts +45 -3
- package/script/src/dsl/triggers/WebhookTrigger.d.ts.map +1 -1
- package/script/src/dsl/triggers/WebhookTrigger.js +10 -6
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts +6 -1
- package/script/src/interpreter/memory/MemoryInterpreter.d.ts.map +1 -1
- package/script/src/interpreter/memory/MemoryInterpreter.js +67 -5
- package/script/src/interpreter/memory/compilers/webhook.d.ts.map +1 -1
- package/script/src/interpreter/memory/compilers/webhook.js +109 -32
- package/script/src/kv/nats/NatsKeyValueProvider.d.ts +2 -1
- package/script/src/kv/nats/NatsKeyValueProvider.d.ts.map +1 -1
- package/script/src/kv/nats/NatsKeyValueProvider.js +3 -3
- /package/esm/deps/jsr.io/@std/fmt/{1.0.6 → 1.0.5}/colors.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/fmt/{1.0.6 → 1.0.5}/colors.js +0 -0
- /package/esm/deps/jsr.io/@std/fs/{1.0.16 → 1.0.11}/exists.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/fs/{1.0.16 → 1.0.11}/exists.js +0 -0
- /package/script/deps/jsr.io/@std/fmt/{1.0.6 → 1.0.5}/colors.d.ts +0 -0
- /package/script/deps/jsr.io/@std/fmt/{1.0.6 → 1.0.5}/colors.js +0 -0
- /package/script/deps/jsr.io/@std/fs/{1.0.16 → 1.0.11}/exists.d.ts +0 -0
- /package/script/deps/jsr.io/@std/fs/{1.0.16 → 1.0.11}/exists.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/connect.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EAGf,MAAM,8CAA8C,CAAC;AAStD,wBAAgB,OAAO,CAAC,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAiB7E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020-2024 The NATS Authors
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
import { denoResolveHost, DenoTransport } from "./deno_transport.js";
|
|
16
|
+
import { errors, hasWsProtocol, NatsConnectionImpl, setTransportFactory, } from "../../../nats-core/3.0.2/src/internal_mod.js";
|
|
17
|
+
export function connect(opts = {}) {
|
|
18
|
+
if (hasWsProtocol(opts)) {
|
|
19
|
+
return Promise.reject(errors.InvalidArgumentError.format(`servers`, `deno client doesn't support websockets, use the 'wsconnect' function instead`));
|
|
20
|
+
}
|
|
21
|
+
setTransportFactory({
|
|
22
|
+
factory: () => {
|
|
23
|
+
return new DenoTransport();
|
|
24
|
+
},
|
|
25
|
+
dnsResolveFn: denoResolveHost,
|
|
26
|
+
});
|
|
27
|
+
return NatsConnectionImpl.connect(opts);
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ConnectionOptions, ServerInfo, Transport } from "../../../nats-core/3.0.2/src/internal_mod.js";
|
|
2
|
+
export declare class DenoTransport implements Transport {
|
|
3
|
+
version: string;
|
|
4
|
+
lang: string;
|
|
5
|
+
closeError?: Error;
|
|
6
|
+
private options;
|
|
7
|
+
private buf;
|
|
8
|
+
private encrypted;
|
|
9
|
+
private done;
|
|
10
|
+
private closedNotification;
|
|
11
|
+
private conn;
|
|
12
|
+
private frames;
|
|
13
|
+
private pendingWrite;
|
|
14
|
+
constructor();
|
|
15
|
+
connect(hp: {
|
|
16
|
+
hostname: string;
|
|
17
|
+
port: number;
|
|
18
|
+
tlsName: string;
|
|
19
|
+
}, options: ConnectionOptions): Promise<void>;
|
|
20
|
+
get isClosed(): boolean;
|
|
21
|
+
peekInfo(): Promise<ServerInfo>;
|
|
22
|
+
loadTlsOptions(hostname: string): Promise<Deno.StartTlsOptions>;
|
|
23
|
+
startTLS(hostname: string): Promise<void>;
|
|
24
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Uint8Array>;
|
|
25
|
+
maybeWriteFrame(): void;
|
|
26
|
+
send(frame: Uint8Array): void;
|
|
27
|
+
isEncrypted(): boolean;
|
|
28
|
+
close(err?: Error): Promise<void>;
|
|
29
|
+
disconnect(): void;
|
|
30
|
+
_closed(err?: Error, internal?: boolean): Promise<void>;
|
|
31
|
+
closed(): Promise<void | Error>;
|
|
32
|
+
discard(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function denoResolveHost(s: string): Promise<string[]>;
|
|
35
|
+
//# sourceMappingURL=deno_transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deno_transport.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/deno_transport.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,iBAAiB,EAEjB,UAAU,EAEV,SAAS,EACV,MAAM,8CAA8C,CAAC;AAUtD,qBAAa,aAAc,YAAW,SAAS;IAC7C,OAAO,EAAE,MAAM,CAAW;IAC1B,IAAI,EAAE,MAAM,CAAQ;IACpB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,kBAAkB,CAAsC;IAChE,OAAO,CAAC,IAAI,CAA+B;IAC3C,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,YAAY,CAAuB;;IAQrC,OAAO,CACX,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EACvD,OAAO,EAAE,iBAAiB;IA4C5B,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAEK,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC;IAgC/B,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC;IAoB/D,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,UAAU,CAAC;IA2BlE,eAAe,IAAI,IAAI;IAuBvB,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAU7B,WAAW,IAAI,OAAO;IAItB,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjC,UAAU;IAKJ,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAyC1D,MAAM,IAAI,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;IAI/B,OAAO;CAGR;AAED,wBAAsB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAelE"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020-2024 The NATS Authors
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
import { checkOptions, checkUnsupportedOption, DataBuffer, deferred, Empty, errors, extractProtocolMessage, INFO, render, } from "../../../nats-core/3.0.2/src/internal_mod.js";
|
|
16
|
+
import { writeAll } from "../../../../@std/io/0.225.2/mod.js";
|
|
17
|
+
import { version } from "./version.js";
|
|
18
|
+
const VERSION = version;
|
|
19
|
+
const LANG = "nats.deno";
|
|
20
|
+
const ReadBufferSize = 1024 * 256;
|
|
21
|
+
export class DenoTransport {
|
|
22
|
+
constructor() {
|
|
23
|
+
Object.defineProperty(this, "version", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: VERSION
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(this, "lang", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: LANG
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(this, "closeError", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: void 0
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(this, "options", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true,
|
|
45
|
+
value: void 0
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(this, "buf", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
value: void 0
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(this, "encrypted", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
value: false
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(this, "done", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: false
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(this, "closedNotification", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: deferred()
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(this, "conn", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: void 0
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(this, "frames", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: void 0
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(this, "pendingWrite", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
value: void 0
|
|
88
|
+
});
|
|
89
|
+
this.buf = new Uint8Array(ReadBufferSize);
|
|
90
|
+
this.frames = [];
|
|
91
|
+
this.pendingWrite = null;
|
|
92
|
+
}
|
|
93
|
+
async connect(hp, options) {
|
|
94
|
+
this.options = options;
|
|
95
|
+
const { tls } = this.options;
|
|
96
|
+
const { handshakeFirst } = tls || {};
|
|
97
|
+
try {
|
|
98
|
+
if (handshakeFirst === true) {
|
|
99
|
+
const opts = await this.loadTlsOptions(hp.hostname);
|
|
100
|
+
const ctls = {
|
|
101
|
+
caCerts: opts.caCerts,
|
|
102
|
+
hostname: hp.hostname,
|
|
103
|
+
port: hp.port,
|
|
104
|
+
};
|
|
105
|
+
this.conn = await Deno.connectTls(ctls);
|
|
106
|
+
this.encrypted = true;
|
|
107
|
+
// do nothing yet.
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.conn = await Deno.connect(hp);
|
|
111
|
+
}
|
|
112
|
+
if (this.done) {
|
|
113
|
+
this.conn.close();
|
|
114
|
+
}
|
|
115
|
+
const info = await this.peekInfo();
|
|
116
|
+
checkOptions(info, this.options);
|
|
117
|
+
const { tls_required: tlsRequired, tls_available: tlsAvailable } = info;
|
|
118
|
+
const desired = tlsAvailable === true && options.tls !== null;
|
|
119
|
+
if (!handshakeFirst && (tlsRequired || desired)) {
|
|
120
|
+
const tlsn = hp.tlsName ? hp.tlsName : hp.hostname;
|
|
121
|
+
await this.startTLS(tlsn);
|
|
122
|
+
}
|
|
123
|
+
if (this.done) {
|
|
124
|
+
this.conn.close();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
this.conn?.close();
|
|
129
|
+
const _err = err;
|
|
130
|
+
throw new errors.ConnectionError(_err.message.toLowerCase(), {
|
|
131
|
+
cause: err,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
get isClosed() {
|
|
136
|
+
return this.done;
|
|
137
|
+
}
|
|
138
|
+
async peekInfo() {
|
|
139
|
+
const inbound = new DataBuffer();
|
|
140
|
+
let pm;
|
|
141
|
+
while (true) {
|
|
142
|
+
const c = await this.conn.read(this.buf);
|
|
143
|
+
if (c === null) {
|
|
144
|
+
// EOF
|
|
145
|
+
throw new Error("socket closed while expecting INFO");
|
|
146
|
+
}
|
|
147
|
+
else if (c) {
|
|
148
|
+
const frame = this.buf.subarray(0, c);
|
|
149
|
+
if (this.options.debug) {
|
|
150
|
+
console.info(`> ${render(frame)}`);
|
|
151
|
+
}
|
|
152
|
+
inbound.fill(frame);
|
|
153
|
+
const raw = inbound.peek();
|
|
154
|
+
pm = extractProtocolMessage(raw);
|
|
155
|
+
if (pm !== "") {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// reset the buffer to previously read, so the client
|
|
161
|
+
// can validate the info matches the connection
|
|
162
|
+
this.buf = new Uint8Array(inbound.drain());
|
|
163
|
+
// expecting the info protocol
|
|
164
|
+
const m = INFO.exec(pm);
|
|
165
|
+
if (!m) {
|
|
166
|
+
throw new Error("unexpected response from server");
|
|
167
|
+
}
|
|
168
|
+
return JSON.parse(m[1]);
|
|
169
|
+
}
|
|
170
|
+
async loadTlsOptions(hostname) {
|
|
171
|
+
const tls = this.options && this.options.tls
|
|
172
|
+
? this.options.tls
|
|
173
|
+
: {};
|
|
174
|
+
// these options are not available in Deno
|
|
175
|
+
checkUnsupportedOption("tls.ca", tls.ca);
|
|
176
|
+
checkUnsupportedOption("tls.cert", tls.cert);
|
|
177
|
+
checkUnsupportedOption("tls.certFile", tls.certFile);
|
|
178
|
+
checkUnsupportedOption("tls.key", tls.key);
|
|
179
|
+
checkUnsupportedOption("tls.keyFile", tls.keyFile);
|
|
180
|
+
const sto = { hostname };
|
|
181
|
+
if (tls.caFile) {
|
|
182
|
+
const ca = await Deno.readTextFile(tls.caFile);
|
|
183
|
+
sto.caCerts = [ca];
|
|
184
|
+
}
|
|
185
|
+
return sto;
|
|
186
|
+
}
|
|
187
|
+
async startTLS(hostname) {
|
|
188
|
+
const sto = await (this.loadTlsOptions(hostname));
|
|
189
|
+
this.conn = await Deno.startTls(
|
|
190
|
+
//@ts-ignore: just the conn
|
|
191
|
+
this.conn, sto);
|
|
192
|
+
// this is necessary because the startTls process doesn't
|
|
193
|
+
// reject a bad certificate, however the next write will.
|
|
194
|
+
// to identify this as the error, we force it
|
|
195
|
+
await this.conn.write(Empty);
|
|
196
|
+
this.encrypted = true;
|
|
197
|
+
}
|
|
198
|
+
async *[Symbol.asyncIterator]() {
|
|
199
|
+
let reason;
|
|
200
|
+
// yield what we initially read
|
|
201
|
+
yield this.buf;
|
|
202
|
+
while (!this.done) {
|
|
203
|
+
try {
|
|
204
|
+
this.buf = new Uint8Array(ReadBufferSize);
|
|
205
|
+
const c = await this.conn.read(this.buf);
|
|
206
|
+
if (c === null) {
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
if (c) {
|
|
210
|
+
const frame = this.buf.subarray(0, c);
|
|
211
|
+
if (this.options.debug) {
|
|
212
|
+
console.info(`> ${render(frame)}`);
|
|
213
|
+
}
|
|
214
|
+
yield frame;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
reason = err;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this._closed(reason).then().catch();
|
|
223
|
+
}
|
|
224
|
+
maybeWriteFrame() {
|
|
225
|
+
if (this.pendingWrite) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const frame = this.frames.shift();
|
|
229
|
+
if (!frame) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
this.pendingWrite = writeAll(this.conn, frame).then(() => {
|
|
233
|
+
this.pendingWrite = null;
|
|
234
|
+
this.maybeWriteFrame();
|
|
235
|
+
}).then(() => {
|
|
236
|
+
if (this.options.debug) {
|
|
237
|
+
console.info(`< ${render(frame)}`);
|
|
238
|
+
}
|
|
239
|
+
}).catch((err) => {
|
|
240
|
+
if (this.options.debug) {
|
|
241
|
+
console.error(`!!! ${render(frame)}: ${err}`);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
send(frame) {
|
|
246
|
+
// if we are closed, don't do anything
|
|
247
|
+
if (this.done) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// push the frame
|
|
251
|
+
this.frames.push(frame);
|
|
252
|
+
this.maybeWriteFrame();
|
|
253
|
+
}
|
|
254
|
+
isEncrypted() {
|
|
255
|
+
return this.encrypted;
|
|
256
|
+
}
|
|
257
|
+
close(err) {
|
|
258
|
+
return this._closed(err, false);
|
|
259
|
+
}
|
|
260
|
+
disconnect() {
|
|
261
|
+
this._closed(undefined, true)
|
|
262
|
+
.then().catch();
|
|
263
|
+
}
|
|
264
|
+
async _closed(err, internal = true) {
|
|
265
|
+
if (this.done) {
|
|
266
|
+
// it is possible for close to be called before the connection
|
|
267
|
+
// ever happens or after the protocol requested a close (async connection/upgrade)
|
|
268
|
+
// so even if we already cleaned up, attempt to close the connection
|
|
269
|
+
try {
|
|
270
|
+
this.conn?.close();
|
|
271
|
+
}
|
|
272
|
+
catch (_err) {
|
|
273
|
+
// ignored
|
|
274
|
+
}
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
this.done = true;
|
|
278
|
+
this.closeError = err;
|
|
279
|
+
if (!err && internal) {
|
|
280
|
+
try {
|
|
281
|
+
// this is a noop but gives us a place to hang
|
|
282
|
+
// a close and ensure that we sent all before closing
|
|
283
|
+
// we wait for the operation to fail or succeed
|
|
284
|
+
this.frames.push(Empty);
|
|
285
|
+
this.maybeWriteFrame();
|
|
286
|
+
if (this.pendingWrite) {
|
|
287
|
+
await this.pendingWrite;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
catch (err) {
|
|
291
|
+
if (this.options.debug) {
|
|
292
|
+
console.log("transport close terminated with an error", err);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
try {
|
|
297
|
+
this.conn?.close();
|
|
298
|
+
}
|
|
299
|
+
catch (_err) {
|
|
300
|
+
// ignored
|
|
301
|
+
}
|
|
302
|
+
if (internal) {
|
|
303
|
+
this.closedNotification.resolve(err);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
closed() {
|
|
307
|
+
return this.closedNotification;
|
|
308
|
+
}
|
|
309
|
+
discard() {
|
|
310
|
+
// ignored - this is not required, as there's no throttling
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
export async function denoResolveHost(s) {
|
|
314
|
+
const a = Deno.resolveDns(s, "A");
|
|
315
|
+
const aaaa = Deno.resolveDns(s, "AAAA");
|
|
316
|
+
const ips = [];
|
|
317
|
+
const w = await Promise.allSettled([a, aaaa]);
|
|
318
|
+
if (w[0].status === "fulfilled") {
|
|
319
|
+
ips.push(...w[0].value);
|
|
320
|
+
}
|
|
321
|
+
if (w[1].status === "fulfilled") {
|
|
322
|
+
ips.push(...w[1].value);
|
|
323
|
+
}
|
|
324
|
+
if (ips.length === 0) {
|
|
325
|
+
ips.push(s);
|
|
326
|
+
}
|
|
327
|
+
return ips;
|
|
328
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@nats-io/transport-deno/3.0.2/src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxy type of {@code Uint8Array<ArrayBuffer} or {@code Uint8Array} in TypeScript 5.7 or below respectively.
|
|
3
|
+
*
|
|
4
|
+
* This type is internal utility type and should not be used directly.
|
|
5
|
+
*
|
|
6
|
+
* @internal @private
|
|
7
|
+
*/
|
|
8
|
+
export type Uint8Array_ = ReturnType<Uint8Array["slice"]>;
|
|
9
|
+
//# sourceMappingURL=_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.5/_types.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
+
export type { Uint8Array_ };
|
|
3
|
+
/**
|
|
4
|
+
* Concatenate an array of byte slices into a single slice.
|
|
5
|
+
*
|
|
6
|
+
* @param buffers Array of byte slices to concatenate.
|
|
7
|
+
* @returns A new byte slice containing all the input slices concatenated.
|
|
8
|
+
*
|
|
9
|
+
* @example Basic usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { concat } from "@std/bytes/concat";
|
|
12
|
+
* import { assertEquals } from "@std/assert";
|
|
13
|
+
*
|
|
14
|
+
* const a = new Uint8Array([0, 1, 2]);
|
|
15
|
+
* const b = new Uint8Array([3, 4, 5]);
|
|
16
|
+
*
|
|
17
|
+
* assertEquals(concat([a, b]), new Uint8Array([0, 1, 2, 3, 4, 5]));
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function concat(buffers: Uint8Array[]): Uint8Array_;
|
|
21
|
+
//# sourceMappingURL=concat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.5/concat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,WAAW,CAazD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Concatenate an array of byte slices into a single slice.
|
|
5
|
+
*
|
|
6
|
+
* @param buffers Array of byte slices to concatenate.
|
|
7
|
+
* @returns A new byte slice containing all the input slices concatenated.
|
|
8
|
+
*
|
|
9
|
+
* @example Basic usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { concat } from "@std/bytes/concat";
|
|
12
|
+
* import { assertEquals } from "@std/assert";
|
|
13
|
+
*
|
|
14
|
+
* const a = new Uint8Array([0, 1, 2]);
|
|
15
|
+
* const b = new Uint8Array([3, 4, 5]);
|
|
16
|
+
*
|
|
17
|
+
* assertEquals(concat([a, b]), new Uint8Array([0, 1, 2, 3, 4, 5]));
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function concat(buffers) {
|
|
21
|
+
let length = 0;
|
|
22
|
+
for (const buffer of buffers) {
|
|
23
|
+
length += buffer.length;
|
|
24
|
+
}
|
|
25
|
+
const output = new Uint8Array(length);
|
|
26
|
+
let index = 0;
|
|
27
|
+
for (const buffer of buffers) {
|
|
28
|
+
output.set(buffer, index);
|
|
29
|
+
index += buffer.length;
|
|
30
|
+
}
|
|
31
|
+
return output;
|
|
32
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy bytes from the source array to the destination array and returns the
|
|
3
|
+
* number of bytes copied.
|
|
4
|
+
*
|
|
5
|
+
* If the source array is larger than what the `dst` array can hold, only the
|
|
6
|
+
* amount of bytes that fit in the `dst` array are copied.
|
|
7
|
+
*
|
|
8
|
+
* @param src Source array to copy from.
|
|
9
|
+
* @param dst Destination array to copy to.
|
|
10
|
+
* @param offset Offset in the destination array to start copying to. Defaults
|
|
11
|
+
* to 0.
|
|
12
|
+
* @returns Number of bytes copied.
|
|
13
|
+
*
|
|
14
|
+
* @example Basic usage
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { copy } from "@std/bytes/copy";
|
|
17
|
+
* import { assertEquals } from "@std/assert";
|
|
18
|
+
*
|
|
19
|
+
* const src = new Uint8Array([9, 8, 7]);
|
|
20
|
+
* const dst = new Uint8Array([0, 1, 2, 3, 4, 5]);
|
|
21
|
+
*
|
|
22
|
+
* assertEquals(copy(src, dst), 3);
|
|
23
|
+
* assertEquals(dst, new Uint8Array([9, 8, 7, 3, 4, 5]));
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example Copy with offset
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { copy } from "@std/bytes/copy";
|
|
29
|
+
* import { assertEquals } from "@std/assert";
|
|
30
|
+
*
|
|
31
|
+
* const src = new Uint8Array([1, 1, 1, 1]);
|
|
32
|
+
* const dst = new Uint8Array([0, 0, 0, 0]);
|
|
33
|
+
*
|
|
34
|
+
* assertEquals(copy(src, dst, 1), 3);
|
|
35
|
+
* assertEquals(dst, new Uint8Array([0, 1, 1, 1]));
|
|
36
|
+
* ```
|
|
37
|
+
* Defining an offset will start copying at the specified index in the
|
|
38
|
+
* destination array.
|
|
39
|
+
*/
|
|
40
|
+
export declare function copy(src: Uint8Array, dst: Uint8Array, offset?: number): number;
|
|
41
|
+
//# sourceMappingURL=copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.5/copy.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,SAAI,GAAG,MAAM,CAQzE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Copy bytes from the source array to the destination array and returns the
|
|
5
|
+
* number of bytes copied.
|
|
6
|
+
*
|
|
7
|
+
* If the source array is larger than what the `dst` array can hold, only the
|
|
8
|
+
* amount of bytes that fit in the `dst` array are copied.
|
|
9
|
+
*
|
|
10
|
+
* @param src Source array to copy from.
|
|
11
|
+
* @param dst Destination array to copy to.
|
|
12
|
+
* @param offset Offset in the destination array to start copying to. Defaults
|
|
13
|
+
* to 0.
|
|
14
|
+
* @returns Number of bytes copied.
|
|
15
|
+
*
|
|
16
|
+
* @example Basic usage
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { copy } from "@std/bytes/copy";
|
|
19
|
+
* import { assertEquals } from "@std/assert";
|
|
20
|
+
*
|
|
21
|
+
* const src = new Uint8Array([9, 8, 7]);
|
|
22
|
+
* const dst = new Uint8Array([0, 1, 2, 3, 4, 5]);
|
|
23
|
+
*
|
|
24
|
+
* assertEquals(copy(src, dst), 3);
|
|
25
|
+
* assertEquals(dst, new Uint8Array([9, 8, 7, 3, 4, 5]));
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Copy with offset
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { copy } from "@std/bytes/copy";
|
|
31
|
+
* import { assertEquals } from "@std/assert";
|
|
32
|
+
*
|
|
33
|
+
* const src = new Uint8Array([1, 1, 1, 1]);
|
|
34
|
+
* const dst = new Uint8Array([0, 0, 0, 0]);
|
|
35
|
+
*
|
|
36
|
+
* assertEquals(copy(src, dst, 1), 3);
|
|
37
|
+
* assertEquals(dst, new Uint8Array([0, 1, 1, 1]));
|
|
38
|
+
* ```
|
|
39
|
+
* Defining an offset will start copying at the specified index in the
|
|
40
|
+
* destination array.
|
|
41
|
+
*/
|
|
42
|
+
export function copy(src, dst, offset = 0) {
|
|
43
|
+
offset = Math.max(0, Math.min(offset, dst.byteLength));
|
|
44
|
+
const dstBytesAvailable = dst.byteLength - offset;
|
|
45
|
+
if (src.byteLength > dstBytesAvailable) {
|
|
46
|
+
src = src.subarray(0, dstBytesAvailable);
|
|
47
|
+
}
|
|
48
|
+
dst.set(src, offset);
|
|
49
|
+
return src.byteLength;
|
|
50
|
+
}
|
package/{script/deps/jsr.io/@std/fmt/1.0.6 → esm/deps/jsr.io/@std/fmt/1.0.5}/colors.d.ts.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fmt/1.0.
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fmt/1.0.5/colors.ts"],"names":[],"mappings":"AAoEA,qEAAqE;AACrE,MAAM,WAAW,GAAG;IAClB,0BAA0B;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,4BAA4B;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,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a,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAcD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAuB9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAuBhE;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exists.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.
|
|
1
|
+
{"version":3,"file":"exists.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.11/exists.ts"],"names":[],"mappings":"AAEA,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,OAAO,CAAC,CAsClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAqCT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_common.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/io/0.225.2/_common.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAKxD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
export function isCloser(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && value !== undefined &&
|
|
5
|
+
"close" in value &&
|
|
6
|
+
// deno-lint-ignore no-explicit-any
|
|
7
|
+
typeof value["close"] === "function";
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_constants.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/io/0.225.2/_constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,QAAS,CAAC;AACzC,eAAO,MAAM,mBAAmB,QAAY,CAAC"}
|