Spaces:
Paused
Paused
Upload folder using huggingface_hub (part 25)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +1581 -0
- node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +135 -0
- node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +216 -0
- node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +113 -0
- node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +9 -0
- node_modules/@tybys/wasm-util/package.json +58 -0
- node_modules/@types/archiver/LICENSE +21 -0
- node_modules/@types/archiver/README.md +16 -0
- node_modules/@types/archiver/index.d.ts +137 -0
- node_modules/@types/archiver/package.json +38 -0
- node_modules/@types/bcryptjs/LICENSE +21 -0
- node_modules/@types/bcryptjs/README.md +15 -0
- node_modules/@types/bcryptjs/index.d.ts +124 -0
- node_modules/@types/bcryptjs/package.json +35 -0
- node_modules/@types/better-sqlite3/LICENSE +21 -0
- node_modules/@types/better-sqlite3/README.md +15 -0
- node_modules/@types/better-sqlite3/index.d.ts +159 -0
- node_modules/@types/better-sqlite3/package.json +63 -0
- node_modules/@types/body-parser/LICENSE +21 -0
- node_modules/@types/body-parser/README.md +15 -0
- node_modules/@types/body-parser/index.d.ts +95 -0
- node_modules/@types/body-parser/package.json +64 -0
- node_modules/@types/chai/LICENSE +21 -0
- node_modules/@types/chai/README.md +15 -0
- node_modules/@types/chai/index.d.ts +2145 -0
- node_modules/@types/chai/package.json +75 -0
- node_modules/@types/chai/register-should.d.ts +7 -0
- node_modules/@types/connect/LICENSE +21 -0
- node_modules/@types/connect/README.md +15 -0
- node_modules/@types/connect/index.d.ts +91 -0
- node_modules/@types/connect/package.json +32 -0
- node_modules/@types/cookie-parser/LICENSE +21 -0
- node_modules/@types/cookie-parser/README.md +61 -0
- node_modules/@types/cookie-parser/index.d.ts +41 -0
- node_modules/@types/cookie-parser/package.json +38 -0
- node_modules/@types/cookiejar/LICENSE +21 -0
- node_modules/@types/cookiejar/README.md +15 -0
- node_modules/@types/cookiejar/index.d.ts +110 -0
- node_modules/@types/cookiejar/package.json +30 -0
- node_modules/@types/cors/LICENSE +21 -0
- node_modules/@types/cors/README.md +75 -0
- node_modules/@types/cors/index.d.ts +56 -0
- node_modules/@types/cors/package.json +38 -0
- node_modules/@types/deep-eql/LICENSE +21 -0
- node_modules/@types/deep-eql/README.md +57 -0
- node_modules/@types/deep-eql/index.d.ts +38 -0
- node_modules/@types/deep-eql/package.json +25 -0
- node_modules/@types/esrecurse/LICENSE +21 -0
- node_modules/@types/esrecurse/README.md +72 -0
- node_modules/@types/esrecurse/index.d.ts +53 -0
node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs
ADDED
|
@@ -0,0 +1,1581 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { _WebAssembly } from "../webassembly.mjs";
|
| 2 |
+
import { resolve } from "./path.mjs";
|
| 3 |
+
// Linux fcntl flag bits ↔ Windows libuv flag bits. `pathOpen()` builds
|
| 4 |
+
// `flagsRes` using Linux constants (O_CREAT=0x40, O_EXCL=0x80,
|
| 5 |
+
// O_APPEND=0x400). Windows libuv expects different bits (O_CREAT=0x100,
|
| 6 |
+
// O_EXCL=0x400, O_APPEND=0x8). Without translation,
|
| 7 |
+
// `fs.openSync(path, 0x241 /* L:WRONLY|CREAT|TRUNC */)` is rejected
|
| 8 |
+
// with EINVAL because Linux's 0x40 happens to mean O_TEMPORARY on
|
| 9 |
+
// Windows — and O_TEMPORARY without O_CREAT is invalid.
|
| 10 |
+
const _isWin32Flags = typeof process !== 'undefined' && process.platform === 'win32';
|
| 11 |
+
function _toWinOpenFlags(f) {
|
| 12 |
+
let r = f & 3; // RDONLY/WRONLY/RDWR — same on both
|
| 13 |
+
if ((f & 0x40) !== 0)
|
| 14 |
+
r |= 0x100; // O_CREAT: Linux 0x40 -> Windows 0x100
|
| 15 |
+
if ((f & 0x80) !== 0)
|
| 16 |
+
r |= 0x400; // O_EXCL: Linux 0x80 -> Windows 0x400
|
| 17 |
+
if ((f & 0x200) !== 0)
|
| 18 |
+
r |= 0x200; // O_TRUNC: same value on both
|
| 19 |
+
if ((f & 0x400) !== 0)
|
| 20 |
+
r |= 0x8; // O_APPEND: Linux 0x400 -> Windows 0x8
|
| 21 |
+
return r;
|
| 22 |
+
}
|
| 23 |
+
import { WasiErrno, WasiRights, FileControlFlag, WasiFileControlFlag, WasiFdFlag, WasiFileType, WasiClockid, WasiFstFlag, WasiEventType, WasiSubclockflags } from "./types.mjs";
|
| 24 |
+
import { concatBuffer, toFileStat, AsyncTable, SyncTable } from "./fd.mjs";
|
| 25 |
+
import { WasiError } from "./error.mjs";
|
| 26 |
+
import { isPromiseLike, sleepBreakIf, unsharedSlice } from "./util.mjs";
|
| 27 |
+
import { getRights } from "./rights.mjs";
|
| 28 |
+
import { extendMemory } from "../memory.mjs";
|
| 29 |
+
import { wrapAsyncImport } from "../jspi.mjs";
|
| 30 |
+
function copyMemory(targets, src) {
|
| 31 |
+
if (targets.length === 0 || src.length === 0)
|
| 32 |
+
return 0;
|
| 33 |
+
let copied = 0;
|
| 34 |
+
let left = src.length - copied;
|
| 35 |
+
for (let i = 0; i < targets.length; ++i) {
|
| 36 |
+
const target = targets[i];
|
| 37 |
+
if (left < target.length) {
|
| 38 |
+
target.set(src.subarray(copied, copied + left), 0);
|
| 39 |
+
copied += left;
|
| 40 |
+
left = 0;
|
| 41 |
+
return copied;
|
| 42 |
+
}
|
| 43 |
+
target.set(src.subarray(copied, copied + target.length), 0);
|
| 44 |
+
copied += target.length;
|
| 45 |
+
left -= target.length;
|
| 46 |
+
}
|
| 47 |
+
return copied;
|
| 48 |
+
}
|
| 49 |
+
const _memory = new WeakMap();
|
| 50 |
+
const _wasi = new WeakMap();
|
| 51 |
+
const _fs = new WeakMap();
|
| 52 |
+
function getMemory(wasi) {
|
| 53 |
+
return _memory.get(wasi);
|
| 54 |
+
}
|
| 55 |
+
function getFs(wasi) {
|
| 56 |
+
const fs = _fs.get(wasi);
|
| 57 |
+
if (!fs)
|
| 58 |
+
throw new Error('filesystem is unavailable');
|
| 59 |
+
return fs;
|
| 60 |
+
}
|
| 61 |
+
function handleError(err) {
|
| 62 |
+
if (err instanceof WasiError) {
|
| 63 |
+
if (process.env.NODE_ENV !== 'production') {
|
| 64 |
+
console.warn(err);
|
| 65 |
+
}
|
| 66 |
+
return err.errno;
|
| 67 |
+
}
|
| 68 |
+
switch (err.code) {
|
| 69 |
+
case 'ENOENT': return WasiErrno.ENOENT;
|
| 70 |
+
case 'EBADF': return WasiErrno.EBADF;
|
| 71 |
+
case 'EINVAL': return WasiErrno.EINVAL;
|
| 72 |
+
case 'EPERM': return WasiErrno.EPERM;
|
| 73 |
+
case 'EPROTO': return WasiErrno.EPROTO;
|
| 74 |
+
case 'EEXIST': return WasiErrno.EEXIST;
|
| 75 |
+
case 'ENOTDIR': return WasiErrno.ENOTDIR;
|
| 76 |
+
case 'EMFILE': return WasiErrno.EMFILE;
|
| 77 |
+
case 'EACCES': return WasiErrno.EACCES;
|
| 78 |
+
case 'EISDIR': return WasiErrno.EISDIR;
|
| 79 |
+
case 'ENOTEMPTY': return WasiErrno.ENOTEMPTY;
|
| 80 |
+
case 'ENOSYS': return WasiErrno.ENOSYS;
|
| 81 |
+
}
|
| 82 |
+
throw err;
|
| 83 |
+
}
|
| 84 |
+
function defineName(name, f) {
|
| 85 |
+
Object.defineProperty(f, 'name', { value: name });
|
| 86 |
+
return f;
|
| 87 |
+
}
|
| 88 |
+
function tryCall(f, wasi, args) {
|
| 89 |
+
let r;
|
| 90 |
+
try {
|
| 91 |
+
r = f.apply(wasi, args);
|
| 92 |
+
}
|
| 93 |
+
catch (err) {
|
| 94 |
+
return handleError(err);
|
| 95 |
+
}
|
| 96 |
+
if (isPromiseLike(r)) {
|
| 97 |
+
return r.then(_ => _, handleError);
|
| 98 |
+
}
|
| 99 |
+
return r;
|
| 100 |
+
}
|
| 101 |
+
function syscallWrap(self, name, f) {
|
| 102 |
+
let debug = false;
|
| 103 |
+
const NODE_DEBUG_NATIVE = (() => {
|
| 104 |
+
try {
|
| 105 |
+
return process.env.NODE_DEBUG_NATIVE;
|
| 106 |
+
}
|
| 107 |
+
catch (_) {
|
| 108 |
+
return undefined;
|
| 109 |
+
}
|
| 110 |
+
})();
|
| 111 |
+
if (typeof NODE_DEBUG_NATIVE === 'string' && NODE_DEBUG_NATIVE.split(',').includes('wasi')) {
|
| 112 |
+
debug = true;
|
| 113 |
+
}
|
| 114 |
+
return debug
|
| 115 |
+
? defineName(name, function () {
|
| 116 |
+
const args = Array.prototype.slice.call(arguments);
|
| 117 |
+
let debugArgs = [`${name}(${Array.from({ length: arguments.length }).map(() => '%d').join(', ')})`];
|
| 118 |
+
debugArgs = debugArgs.concat(args);
|
| 119 |
+
console.debug.apply(console, debugArgs);
|
| 120 |
+
return tryCall(f, self, args);
|
| 121 |
+
})
|
| 122 |
+
: defineName(name, function () {
|
| 123 |
+
return tryCall(f, self, arguments);
|
| 124 |
+
});
|
| 125 |
+
}
|
| 126 |
+
function resolvePathSync(fs, fileDescriptor, path, flags) {
|
| 127 |
+
let resolvedPath = resolve(fileDescriptor.realPath, path);
|
| 128 |
+
if ((flags & 1) === 1) {
|
| 129 |
+
try {
|
| 130 |
+
resolvedPath = fs.readlinkSync(resolvedPath);
|
| 131 |
+
}
|
| 132 |
+
catch (err) {
|
| 133 |
+
if (err.code !== 'EINVAL' && err.code !== 'ENOENT') {
|
| 134 |
+
throw err;
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
return resolvedPath;
|
| 139 |
+
}
|
| 140 |
+
async function resolvePathAsync(fs, fileDescriptor, path, flags) {
|
| 141 |
+
let resolvedPath = resolve(fileDescriptor.realPath, path);
|
| 142 |
+
if ((flags & 1) === 1) {
|
| 143 |
+
try {
|
| 144 |
+
resolvedPath = await fs.promises.readlink(resolvedPath);
|
| 145 |
+
}
|
| 146 |
+
catch (err) {
|
| 147 |
+
if (err.code !== 'EINVAL' && err.code !== 'ENOENT') {
|
| 148 |
+
throw err;
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
return resolvedPath;
|
| 153 |
+
}
|
| 154 |
+
// eslint-disable-next-line spaced-comment
|
| 155 |
+
const encoder = /*#__PURE__*/ new TextEncoder();
|
| 156 |
+
// eslint-disable-next-line spaced-comment
|
| 157 |
+
const decoder = /*#__PURE__*/ new TextDecoder();
|
| 158 |
+
const INT64_MAX = (BigInt(1) << BigInt(63)) - BigInt(1);
|
| 159 |
+
function readStdin() {
|
| 160 |
+
const value = window.prompt();
|
| 161 |
+
if (value === null)
|
| 162 |
+
return new Uint8Array();
|
| 163 |
+
const buffer = new TextEncoder().encode(value + '\n');
|
| 164 |
+
return buffer;
|
| 165 |
+
}
|
| 166 |
+
function validateFstFlagsOrReturn(flags) {
|
| 167 |
+
return (Boolean((flags) & ~(WasiFstFlag.SET_ATIM | WasiFstFlag.SET_ATIM_NOW |
|
| 168 |
+
WasiFstFlag.SET_MTIM | WasiFstFlag.SET_MTIM_NOW)) ||
|
| 169 |
+
((flags) & (WasiFstFlag.SET_ATIM | WasiFstFlag.SET_ATIM_NOW)) ===
|
| 170 |
+
(WasiFstFlag.SET_ATIM | WasiFstFlag.SET_ATIM_NOW) ||
|
| 171 |
+
((flags) & (WasiFstFlag.SET_MTIM | WasiFstFlag.SET_MTIM_NOW)) ===
|
| 172 |
+
(WasiFstFlag.SET_MTIM | WasiFstFlag.SET_MTIM_NOW));
|
| 173 |
+
}
|
| 174 |
+
export class WASI {
|
| 175 |
+
constructor(args, env, fds, asyncFs, fs, asyncify) {
|
| 176 |
+
this.args_get = syscallWrap(this, 'args_get', function (argv, argv_buf) {
|
| 177 |
+
argv = Number(argv);
|
| 178 |
+
argv_buf = Number(argv_buf);
|
| 179 |
+
if (argv === 0 || argv_buf === 0) {
|
| 180 |
+
return WasiErrno.EINVAL;
|
| 181 |
+
}
|
| 182 |
+
const { HEAPU8, view } = getMemory(this);
|
| 183 |
+
const wasi = _wasi.get(this);
|
| 184 |
+
const args = wasi.args;
|
| 185 |
+
for (let i = 0; i < args.length; ++i) {
|
| 186 |
+
const arg = args[i];
|
| 187 |
+
view.setInt32(argv, argv_buf, true);
|
| 188 |
+
argv += 4;
|
| 189 |
+
const data = encoder.encode(arg + '\0');
|
| 190 |
+
HEAPU8.set(data, argv_buf);
|
| 191 |
+
argv_buf += data.length;
|
| 192 |
+
}
|
| 193 |
+
return WasiErrno.ESUCCESS;
|
| 194 |
+
});
|
| 195 |
+
this.args_sizes_get = syscallWrap(this, 'args_sizes_get', function (argc, argv_buf_size) {
|
| 196 |
+
argc = Number(argc);
|
| 197 |
+
argv_buf_size = Number(argv_buf_size);
|
| 198 |
+
if (argc === 0 || argv_buf_size === 0) {
|
| 199 |
+
return WasiErrno.EINVAL;
|
| 200 |
+
}
|
| 201 |
+
const { view } = getMemory(this);
|
| 202 |
+
const wasi = _wasi.get(this);
|
| 203 |
+
const args = wasi.args;
|
| 204 |
+
view.setUint32(argc, args.length, true);
|
| 205 |
+
view.setUint32(argv_buf_size, encoder.encode(args.join('\0') + '\0').length, true);
|
| 206 |
+
return WasiErrno.ESUCCESS;
|
| 207 |
+
});
|
| 208 |
+
this.environ_get = syscallWrap(this, 'environ_get', function (environ, environ_buf) {
|
| 209 |
+
environ = Number(environ);
|
| 210 |
+
environ_buf = Number(environ_buf);
|
| 211 |
+
if (environ === 0 || environ_buf === 0) {
|
| 212 |
+
return WasiErrno.EINVAL;
|
| 213 |
+
}
|
| 214 |
+
const { HEAPU8, view } = getMemory(this);
|
| 215 |
+
const wasi = _wasi.get(this);
|
| 216 |
+
const env = wasi.env;
|
| 217 |
+
for (let i = 0; i < env.length; ++i) {
|
| 218 |
+
const pair = env[i];
|
| 219 |
+
view.setInt32(environ, environ_buf, true);
|
| 220 |
+
environ += 4;
|
| 221 |
+
const data = encoder.encode(pair + '\0');
|
| 222 |
+
HEAPU8.set(data, environ_buf);
|
| 223 |
+
environ_buf += data.length;
|
| 224 |
+
}
|
| 225 |
+
return WasiErrno.ESUCCESS;
|
| 226 |
+
});
|
| 227 |
+
this.environ_sizes_get = syscallWrap(this, 'environ_sizes_get', function (len, buflen) {
|
| 228 |
+
len = Number(len);
|
| 229 |
+
buflen = Number(buflen);
|
| 230 |
+
if (len === 0 || buflen === 0) {
|
| 231 |
+
return WasiErrno.EINVAL;
|
| 232 |
+
}
|
| 233 |
+
const { view } = getMemory(this);
|
| 234 |
+
const wasi = _wasi.get(this);
|
| 235 |
+
view.setUint32(len, wasi.env.length, true);
|
| 236 |
+
view.setUint32(buflen, encoder.encode(wasi.env.join('\0') + '\0').length, true);
|
| 237 |
+
return WasiErrno.ESUCCESS;
|
| 238 |
+
});
|
| 239 |
+
this.clock_res_get = syscallWrap(this, 'clock_res_get', function (id, resolution) {
|
| 240 |
+
resolution = Number(resolution);
|
| 241 |
+
if (resolution === 0) {
|
| 242 |
+
return WasiErrno.EINVAL;
|
| 243 |
+
}
|
| 244 |
+
const { view } = getMemory(this);
|
| 245 |
+
switch (id) {
|
| 246 |
+
case WasiClockid.REALTIME:
|
| 247 |
+
view.setBigUint64(resolution, BigInt(1000000), true);
|
| 248 |
+
return WasiErrno.ESUCCESS;
|
| 249 |
+
case WasiClockid.MONOTONIC:
|
| 250 |
+
case WasiClockid.PROCESS_CPUTIME_ID:
|
| 251 |
+
case WasiClockid.THREAD_CPUTIME_ID:
|
| 252 |
+
view.setBigUint64(resolution, BigInt(1000), true);
|
| 253 |
+
return WasiErrno.ESUCCESS;
|
| 254 |
+
default: return WasiErrno.EINVAL;
|
| 255 |
+
}
|
| 256 |
+
});
|
| 257 |
+
this.clock_time_get = syscallWrap(this, 'clock_time_get', function (id, _percision, time) {
|
| 258 |
+
time = Number(time);
|
| 259 |
+
if (time === 0) {
|
| 260 |
+
return WasiErrno.EINVAL;
|
| 261 |
+
}
|
| 262 |
+
const { view } = getMemory(this);
|
| 263 |
+
switch (id) {
|
| 264 |
+
case WasiClockid.REALTIME:
|
| 265 |
+
view.setBigUint64(time, BigInt(Date.now()) * BigInt(1000000), true);
|
| 266 |
+
return WasiErrno.ESUCCESS;
|
| 267 |
+
case WasiClockid.MONOTONIC:
|
| 268 |
+
case WasiClockid.PROCESS_CPUTIME_ID:
|
| 269 |
+
case WasiClockid.THREAD_CPUTIME_ID: {
|
| 270 |
+
const t = performance.now() / 1000;
|
| 271 |
+
const s = Math.trunc(t);
|
| 272 |
+
const ms = Math.floor((t - s) * 1000);
|
| 273 |
+
const result = BigInt(s) * BigInt(1000000000) + BigInt(ms) * BigInt(1000000);
|
| 274 |
+
view.setBigUint64(time, result, true);
|
| 275 |
+
return WasiErrno.ESUCCESS;
|
| 276 |
+
}
|
| 277 |
+
default: return WasiErrno.EINVAL;
|
| 278 |
+
}
|
| 279 |
+
});
|
| 280 |
+
this.fd_advise = syscallWrap(this, 'fd_advise', function (_fd, _offset, _len, _advice) {
|
| 281 |
+
return WasiErrno.ENOSYS;
|
| 282 |
+
});
|
| 283 |
+
this.fd_fdstat_get = syscallWrap(this, 'fd_fdstat_get', function (fd, fdstat) {
|
| 284 |
+
fdstat = Number(fdstat);
|
| 285 |
+
if (fdstat === 0) {
|
| 286 |
+
return WasiErrno.EINVAL;
|
| 287 |
+
}
|
| 288 |
+
const wasi = _wasi.get(this);
|
| 289 |
+
const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0));
|
| 290 |
+
const { view } = getMemory(this);
|
| 291 |
+
view.setUint16(fdstat, fileDescriptor.type, true);
|
| 292 |
+
view.setUint16(fdstat + 2, 0, true);
|
| 293 |
+
view.setBigUint64(fdstat + 8, fileDescriptor.rightsBase, true);
|
| 294 |
+
view.setBigUint64(fdstat + 16, fileDescriptor.rightsInheriting, true);
|
| 295 |
+
return WasiErrno.ESUCCESS;
|
| 296 |
+
});
|
| 297 |
+
this.fd_fdstat_set_flags = syscallWrap(this, 'fd_fdstat_set_flags', function (_fd, _flags) {
|
| 298 |
+
return WasiErrno.ENOSYS;
|
| 299 |
+
});
|
| 300 |
+
this.fd_fdstat_set_rights = syscallWrap(this, 'fd_fdstat_set_rights', function (fd, rightsBase, rightsInheriting) {
|
| 301 |
+
const wasi = _wasi.get(this);
|
| 302 |
+
const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0));
|
| 303 |
+
if ((rightsBase | fileDescriptor.rightsBase) > fileDescriptor.rightsBase) {
|
| 304 |
+
return WasiErrno.ENOTCAPABLE;
|
| 305 |
+
}
|
| 306 |
+
if ((rightsInheriting | fileDescriptor.rightsInheriting) >
|
| 307 |
+
fileDescriptor.rightsInheriting) {
|
| 308 |
+
return WasiErrno.ENOTCAPABLE;
|
| 309 |
+
}
|
| 310 |
+
fileDescriptor.rightsBase = rightsBase;
|
| 311 |
+
fileDescriptor.rightsInheriting = rightsInheriting;
|
| 312 |
+
return WasiErrno.ESUCCESS;
|
| 313 |
+
});
|
| 314 |
+
this.fd_prestat_get = syscallWrap(this, 'fd_prestat_get', function (fd, prestat) {
|
| 315 |
+
prestat = Number(prestat);
|
| 316 |
+
if (prestat === 0) {
|
| 317 |
+
return WasiErrno.EINVAL;
|
| 318 |
+
}
|
| 319 |
+
const wasi = _wasi.get(this);
|
| 320 |
+
let fileDescriptor;
|
| 321 |
+
try {
|
| 322 |
+
fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0));
|
| 323 |
+
}
|
| 324 |
+
catch (err) {
|
| 325 |
+
if (err instanceof WasiError)
|
| 326 |
+
return err.errno;
|
| 327 |
+
throw err;
|
| 328 |
+
}
|
| 329 |
+
if (fileDescriptor.preopen !== 1)
|
| 330 |
+
return WasiErrno.EINVAL;
|
| 331 |
+
const { view } = getMemory(this);
|
| 332 |
+
// preopen type is dir(0)
|
| 333 |
+
view.setUint32(prestat, 0, true);
|
| 334 |
+
view.setUint32(prestat + 4, encoder.encode(fileDescriptor.path).length, true);
|
| 335 |
+
return WasiErrno.ESUCCESS;
|
| 336 |
+
});
|
| 337 |
+
this.fd_prestat_dir_name = syscallWrap(this, 'fd_prestat_dir_name', function (fd, path, path_len) {
|
| 338 |
+
path = Number(path);
|
| 339 |
+
path_len = Number(path_len);
|
| 340 |
+
if (path === 0) {
|
| 341 |
+
return WasiErrno.EINVAL;
|
| 342 |
+
}
|
| 343 |
+
const wasi = _wasi.get(this);
|
| 344 |
+
const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0));
|
| 345 |
+
if (fileDescriptor.preopen !== 1)
|
| 346 |
+
return WasiErrno.EBADF;
|
| 347 |
+
const buffer = encoder.encode(fileDescriptor.path);
|
| 348 |
+
const size = buffer.length;
|
| 349 |
+
if (size > path_len)
|
| 350 |
+
return WasiErrno.ENOBUFS;
|
| 351 |
+
const { HEAPU8 } = getMemory(this);
|
| 352 |
+
HEAPU8.set(buffer, path);
|
| 353 |
+
return WasiErrno.ESUCCESS;
|
| 354 |
+
});
|
| 355 |
+
this.fd_seek = syscallWrap(this, 'fd_seek', function (fd, offset, whence, newOffset) {
|
| 356 |
+
newOffset = Number(newOffset);
|
| 357 |
+
if (newOffset === 0) {
|
| 358 |
+
return WasiErrno.EINVAL;
|
| 359 |
+
}
|
| 360 |
+
if (fd === 0 || fd === 1 || fd === 2)
|
| 361 |
+
return WasiErrno.ESUCCESS;
|
| 362 |
+
const wasi = _wasi.get(this);
|
| 363 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_SEEK, BigInt(0));
|
| 364 |
+
const r = fileDescriptor.seek(offset, whence);
|
| 365 |
+
const { view } = getMemory(this);
|
| 366 |
+
view.setBigUint64(newOffset, r, true);
|
| 367 |
+
return WasiErrno.ESUCCESS;
|
| 368 |
+
});
|
| 369 |
+
this.fd_tell = syscallWrap(this, 'fd_tell', function (fd, offset) {
|
| 370 |
+
const wasi = _wasi.get(this);
|
| 371 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_TELL, BigInt(0));
|
| 372 |
+
const pos = BigInt(fileDescriptor.pos);
|
| 373 |
+
const { view } = getMemory(this);
|
| 374 |
+
view.setBigUint64(Number(offset), pos, true);
|
| 375 |
+
return WasiErrno.ESUCCESS;
|
| 376 |
+
});
|
| 377 |
+
this.poll_oneoff = syscallWrap(this, 'poll_oneoff', function (in_ptr, out_ptr, nsubscriptions, nevents) {
|
| 378 |
+
in_ptr = Number(in_ptr);
|
| 379 |
+
out_ptr = Number(out_ptr);
|
| 380 |
+
nevents = Number(nevents);
|
| 381 |
+
nsubscriptions = Number(nsubscriptions);
|
| 382 |
+
nsubscriptions = nsubscriptions >>> 0;
|
| 383 |
+
if (in_ptr === 0 || out_ptr === 0 || nsubscriptions === 0 || nevents === 0) {
|
| 384 |
+
return WasiErrno.EINVAL;
|
| 385 |
+
}
|
| 386 |
+
const { view } = getMemory(this);
|
| 387 |
+
view.setUint32(nevents, 0, true);
|
| 388 |
+
let i = 0;
|
| 389 |
+
let timer_userdata = BigInt(0);
|
| 390 |
+
let cur_timeout = BigInt(0);
|
| 391 |
+
let has_timeout = 0;
|
| 392 |
+
let min_timeout = BigInt(0);
|
| 393 |
+
let sub;
|
| 394 |
+
const subscriptions = Array(nsubscriptions);
|
| 395 |
+
for (i = 0; i < nsubscriptions; i++) {
|
| 396 |
+
sub = in_ptr + i * 48;
|
| 397 |
+
const userdata = view.getBigUint64(sub, true);
|
| 398 |
+
const type = view.getUint8(sub + 8);
|
| 399 |
+
const clockIdOrFd = view.getUint32(sub + 16, true);
|
| 400 |
+
const timeout = view.getBigUint64(sub + 24, true);
|
| 401 |
+
const precision = view.getBigUint64(sub + 32, true);
|
| 402 |
+
const flags = view.getUint16(sub + 40, true);
|
| 403 |
+
subscriptions[i] = {
|
| 404 |
+
userdata,
|
| 405 |
+
type,
|
| 406 |
+
u: {
|
| 407 |
+
clock: {
|
| 408 |
+
clock_id: clockIdOrFd,
|
| 409 |
+
timeout,
|
| 410 |
+
precision,
|
| 411 |
+
flags
|
| 412 |
+
},
|
| 413 |
+
fd_readwrite: {
|
| 414 |
+
fd: clockIdOrFd
|
| 415 |
+
}
|
| 416 |
+
}
|
| 417 |
+
};
|
| 418 |
+
}
|
| 419 |
+
const fdevents = [];
|
| 420 |
+
for (i = 0; i < nsubscriptions; i++) {
|
| 421 |
+
sub = subscriptions[i];
|
| 422 |
+
switch (sub.type) {
|
| 423 |
+
case WasiEventType.CLOCK: {
|
| 424 |
+
if (sub.u.clock.flags === WasiSubclockflags.ABSTIME) {
|
| 425 |
+
/* Convert absolute time to relative delay. */
|
| 426 |
+
const now = BigInt(Date.now()) * BigInt(1000000);
|
| 427 |
+
cur_timeout = sub.u.clock.timeout - now;
|
| 428 |
+
}
|
| 429 |
+
else {
|
| 430 |
+
cur_timeout = sub.u.clock.timeout;
|
| 431 |
+
}
|
| 432 |
+
if (has_timeout === 0 || cur_timeout < min_timeout) {
|
| 433 |
+
min_timeout = cur_timeout;
|
| 434 |
+
timer_userdata = sub.userdata;
|
| 435 |
+
has_timeout = 1;
|
| 436 |
+
}
|
| 437 |
+
break;
|
| 438 |
+
}
|
| 439 |
+
case WasiEventType.FD_READ:
|
| 440 |
+
case WasiEventType.FD_WRITE:
|
| 441 |
+
fdevents.push(sub);
|
| 442 |
+
break;
|
| 443 |
+
default: return WasiErrno.EINVAL;
|
| 444 |
+
}
|
| 445 |
+
}
|
| 446 |
+
if (fdevents.length > 0) {
|
| 447 |
+
for (i = 0; i < fdevents.length; i++) {
|
| 448 |
+
const fdevent = fdevents[i];
|
| 449 |
+
const event = out_ptr + 32 * i;
|
| 450 |
+
view.setBigUint64(event, fdevent.userdata, true);
|
| 451 |
+
view.setUint32(event + 8, WasiErrno.ENOSYS, true);
|
| 452 |
+
view.setUint32(event + 12, fdevent.type, true);
|
| 453 |
+
view.setBigUint64(event + 16, BigInt(0), true);
|
| 454 |
+
view.setUint16(event + 24, 0, true);
|
| 455 |
+
view.setUint32(nevents, 1, true);
|
| 456 |
+
}
|
| 457 |
+
view.setUint32(nevents, fdevents.length, true);
|
| 458 |
+
return WasiErrno.ESUCCESS;
|
| 459 |
+
}
|
| 460 |
+
if (has_timeout) {
|
| 461 |
+
const delay = Number(min_timeout / BigInt(1000000));
|
| 462 |
+
// if (isMainThread || typeof SharedArrayBuffer !== 'function') {
|
| 463 |
+
sleepBreakIf(delay, () => false);
|
| 464 |
+
// } else {
|
| 465 |
+
// const buf = new SharedArrayBuffer(4)
|
| 466 |
+
// const arr = new Int32Array(buf)
|
| 467 |
+
// postMsg({
|
| 468 |
+
// __tybys_wasm_util_wasi__: {
|
| 469 |
+
// type: 'set-timeout',
|
| 470 |
+
// payload: {
|
| 471 |
+
// buffer: buf,
|
| 472 |
+
// delay
|
| 473 |
+
// }
|
| 474 |
+
// }
|
| 475 |
+
// })
|
| 476 |
+
// Atomics.wait(arr, 0, 0)
|
| 477 |
+
// }
|
| 478 |
+
const event = out_ptr;
|
| 479 |
+
view.setBigUint64(event, timer_userdata, true);
|
| 480 |
+
view.setUint32(event + 8, WasiErrno.ESUCCESS, true);
|
| 481 |
+
view.setUint32(event + 12, WasiEventType.CLOCK, true);
|
| 482 |
+
view.setUint32(nevents, 1, true);
|
| 483 |
+
}
|
| 484 |
+
return WasiErrno.ESUCCESS;
|
| 485 |
+
});
|
| 486 |
+
this.proc_exit = syscallWrap(this, 'proc_exit', function (rval) {
|
| 487 |
+
if ((typeof process === 'object') && (process !== null) && (typeof process.exit === 'function')) {
|
| 488 |
+
process.exit(rval);
|
| 489 |
+
}
|
| 490 |
+
return WasiErrno.ESUCCESS;
|
| 491 |
+
});
|
| 492 |
+
this.proc_raise = syscallWrap(this, 'proc_raise', function (_sig) {
|
| 493 |
+
return WasiErrno.ENOSYS;
|
| 494 |
+
});
|
| 495 |
+
this.sched_yield = syscallWrap(this, 'sched_yield', function () {
|
| 496 |
+
return WasiErrno.ESUCCESS;
|
| 497 |
+
});
|
| 498 |
+
this.random_get = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function'
|
| 499 |
+
? syscallWrap(this, 'random_get', function (buf, buf_len) {
|
| 500 |
+
buf = Number(buf);
|
| 501 |
+
if (buf === 0) {
|
| 502 |
+
return WasiErrno.EINVAL;
|
| 503 |
+
}
|
| 504 |
+
buf_len = Number(buf_len);
|
| 505 |
+
const { HEAPU8, view } = getMemory(this);
|
| 506 |
+
if ((typeof SharedArrayBuffer === 'function' && HEAPU8.buffer instanceof SharedArrayBuffer) ||
|
| 507 |
+
(Object.prototype.toString.call(HEAPU8.buffer) === '[object SharedArrayBuffer]')) {
|
| 508 |
+
for (let i = buf; i < buf + buf_len; ++i) {
|
| 509 |
+
view.setUint8(i, Math.floor(Math.random() * 256));
|
| 510 |
+
}
|
| 511 |
+
return WasiErrno.ESUCCESS;
|
| 512 |
+
}
|
| 513 |
+
let pos;
|
| 514 |
+
const stride = 65536;
|
| 515 |
+
for (pos = 0; pos + stride < buf_len; pos += stride) {
|
| 516 |
+
crypto.getRandomValues(HEAPU8.subarray(buf + pos, buf + pos + stride));
|
| 517 |
+
}
|
| 518 |
+
crypto.getRandomValues(HEAPU8.subarray(buf + pos, buf + buf_len));
|
| 519 |
+
return WasiErrno.ESUCCESS;
|
| 520 |
+
})
|
| 521 |
+
: syscallWrap(this, 'random_get', function (buf, buf_len) {
|
| 522 |
+
buf = Number(buf);
|
| 523 |
+
if (buf === 0) {
|
| 524 |
+
return WasiErrno.EINVAL;
|
| 525 |
+
}
|
| 526 |
+
buf_len = Number(buf_len);
|
| 527 |
+
const { view } = getMemory(this);
|
| 528 |
+
for (let i = buf; i < buf + buf_len; ++i) {
|
| 529 |
+
view.setUint8(i, Math.floor(Math.random() * 256));
|
| 530 |
+
}
|
| 531 |
+
return WasiErrno.ESUCCESS;
|
| 532 |
+
});
|
| 533 |
+
this.sock_recv = syscallWrap(this, 'sock_recv', function () {
|
| 534 |
+
return WasiErrno.ENOTSUP;
|
| 535 |
+
});
|
| 536 |
+
this.sock_send = syscallWrap(this, 'sock_send', function () {
|
| 537 |
+
return WasiErrno.ENOTSUP;
|
| 538 |
+
});
|
| 539 |
+
this.sock_shutdown = syscallWrap(this, 'sock_shutdown', function () {
|
| 540 |
+
return WasiErrno.ENOTSUP;
|
| 541 |
+
});
|
| 542 |
+
this.sock_accept = syscallWrap(this, 'sock_accept', function () {
|
| 543 |
+
return WasiErrno.ENOTSUP;
|
| 544 |
+
});
|
| 545 |
+
_wasi.set(this, {
|
| 546 |
+
fds,
|
| 547 |
+
args,
|
| 548 |
+
env
|
| 549 |
+
});
|
| 550 |
+
if (fs)
|
| 551 |
+
_fs.set(this, fs);
|
| 552 |
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
| 553 |
+
const _this = this;
|
| 554 |
+
function defineImport(name, syncVersion, asyncVersion, parameterType, returnType) {
|
| 555 |
+
if (asyncFs) {
|
| 556 |
+
if (asyncify) {
|
| 557 |
+
_this[name] = asyncify.wrapImportFunction(syscallWrap(_this, name, asyncVersion));
|
| 558 |
+
}
|
| 559 |
+
else {
|
| 560 |
+
_this[name] = wrapAsyncImport(syscallWrap(_this, name, asyncVersion), parameterType, returnType);
|
| 561 |
+
}
|
| 562 |
+
}
|
| 563 |
+
else {
|
| 564 |
+
_this[name] = syscallWrap(_this, name, syncVersion);
|
| 565 |
+
}
|
| 566 |
+
}
|
| 567 |
+
defineImport('fd_allocate', function fd_allocate(fd, offset, len) {
|
| 568 |
+
const wasi = _wasi.get(this);
|
| 569 |
+
const fs = getFs(this);
|
| 570 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_ALLOCATE, BigInt(0));
|
| 571 |
+
const stat = fs.fstatSync(fileDescriptor.fd, { bigint: true });
|
| 572 |
+
if (stat.size < offset + len) {
|
| 573 |
+
fs.ftruncateSync(fileDescriptor.fd, Number(offset + len));
|
| 574 |
+
}
|
| 575 |
+
return WasiErrno.ESUCCESS;
|
| 576 |
+
}, async function fd_allocate(fd, offset, len) {
|
| 577 |
+
const wasi = _wasi.get(this);
|
| 578 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_ALLOCATE, BigInt(0));
|
| 579 |
+
const h = fileDescriptor.fd;
|
| 580 |
+
const stat = await h.stat({ bigint: true });
|
| 581 |
+
if (stat.size < offset + len) {
|
| 582 |
+
await h.truncate(Number(offset + len));
|
| 583 |
+
}
|
| 584 |
+
return WasiErrno.ESUCCESS;
|
| 585 |
+
}, ['i32', 'i64', 'f64'], ['i32']);
|
| 586 |
+
defineImport('fd_close', function fd_close(fd) {
|
| 587 |
+
const wasi = _wasi.get(this);
|
| 588 |
+
const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0));
|
| 589 |
+
const fs = getFs(this);
|
| 590 |
+
fs.closeSync(fileDescriptor.fd);
|
| 591 |
+
wasi.fds.remove(fd);
|
| 592 |
+
return WasiErrno.ESUCCESS;
|
| 593 |
+
}, async function fd_close(fd) {
|
| 594 |
+
const wasi = _wasi.get(this);
|
| 595 |
+
const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0));
|
| 596 |
+
await fileDescriptor.fd.close();
|
| 597 |
+
wasi.fds.remove(fd);
|
| 598 |
+
return WasiErrno.ESUCCESS;
|
| 599 |
+
}, ['i32'], ['i32']);
|
| 600 |
+
defineImport('fd_datasync', function fd_datasync(fd) {
|
| 601 |
+
const wasi = _wasi.get(this);
|
| 602 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_DATASYNC, BigInt(0));
|
| 603 |
+
const fs = getFs(this);
|
| 604 |
+
fs.fdatasyncSync(fileDescriptor.fd);
|
| 605 |
+
return WasiErrno.ESUCCESS;
|
| 606 |
+
}, async function fd_datasync(fd) {
|
| 607 |
+
const wasi = _wasi.get(this);
|
| 608 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_DATASYNC, BigInt(0));
|
| 609 |
+
await fileDescriptor.fd.datasync();
|
| 610 |
+
return WasiErrno.ESUCCESS;
|
| 611 |
+
}, ['i32'], ['i32']);
|
| 612 |
+
defineImport('fd_filestat_get', function fd_filestat_get(fd, buf) {
|
| 613 |
+
buf = Number(buf);
|
| 614 |
+
if (buf === 0)
|
| 615 |
+
return WasiErrno.EINVAL;
|
| 616 |
+
const wasi = _wasi.get(this);
|
| 617 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_GET, BigInt(0));
|
| 618 |
+
const fs = getFs(this);
|
| 619 |
+
const stat = fs.fstatSync(fileDescriptor.fd, { bigint: true });
|
| 620 |
+
const { view } = getMemory(this);
|
| 621 |
+
toFileStat(view, buf, stat);
|
| 622 |
+
return WasiErrno.ESUCCESS;
|
| 623 |
+
}, async function fd_filestat_get(fd, buf) {
|
| 624 |
+
buf = Number(buf);
|
| 625 |
+
if (buf === 0)
|
| 626 |
+
return WasiErrno.EINVAL;
|
| 627 |
+
const wasi = _wasi.get(this);
|
| 628 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_GET, BigInt(0));
|
| 629 |
+
const h = fileDescriptor.fd;
|
| 630 |
+
const stat = await h.stat({ bigint: true });
|
| 631 |
+
const { view } = getMemory(this);
|
| 632 |
+
toFileStat(view, buf, stat);
|
| 633 |
+
return WasiErrno.ESUCCESS;
|
| 634 |
+
}, ['i32', 'i32'], ['i32']);
|
| 635 |
+
defineImport('fd_filestat_set_size', function fd_filestat_set_size(fd, size) {
|
| 636 |
+
const wasi = _wasi.get(this);
|
| 637 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_SET_SIZE, BigInt(0));
|
| 638 |
+
const fs = getFs(this);
|
| 639 |
+
fs.ftruncateSync(fileDescriptor.fd, Number(size));
|
| 640 |
+
return WasiErrno.ESUCCESS;
|
| 641 |
+
}, async function fd_filestat_set_size(fd, size) {
|
| 642 |
+
const wasi = _wasi.get(this);
|
| 643 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_SET_SIZE, BigInt(0));
|
| 644 |
+
const h = fileDescriptor.fd;
|
| 645 |
+
await h.truncate(Number(size));
|
| 646 |
+
return WasiErrno.ESUCCESS;
|
| 647 |
+
}, ['i32', 'i64'], ['i32']);
|
| 648 |
+
function fdFilestatGetTimes(fd, atim, mtim, flags) {
|
| 649 |
+
const wasi = _wasi.get(this);
|
| 650 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_FILESTAT_SET_TIMES, BigInt(0));
|
| 651 |
+
if ((flags & WasiFstFlag.SET_ATIM_NOW) === WasiFstFlag.SET_ATIM_NOW) {
|
| 652 |
+
atim = BigInt(Date.now() * 1000000);
|
| 653 |
+
}
|
| 654 |
+
if ((flags & WasiFstFlag.SET_MTIM_NOW) === WasiFstFlag.SET_MTIM_NOW) {
|
| 655 |
+
mtim = BigInt(Date.now() * 1000000);
|
| 656 |
+
}
|
| 657 |
+
return { fileDescriptor, atim, mtim };
|
| 658 |
+
}
|
| 659 |
+
defineImport('fd_filestat_set_times', function fd_filestat_set_times(fd, atim, mtim, flags) {
|
| 660 |
+
if (validateFstFlagsOrReturn(flags)) {
|
| 661 |
+
return WasiErrno.EINVAL;
|
| 662 |
+
}
|
| 663 |
+
const { fileDescriptor, atim: atimRes, mtim: mtimRes } = fdFilestatGetTimes.call(this, fd, atim, mtim, flags);
|
| 664 |
+
const fs = getFs(this);
|
| 665 |
+
fs.futimesSync(fileDescriptor.fd, Number(atimRes), Number(mtimRes));
|
| 666 |
+
return WasiErrno.ESUCCESS;
|
| 667 |
+
}, async function fd_filestat_set_times(fd, atim, mtim, flags) {
|
| 668 |
+
if (validateFstFlagsOrReturn(flags)) {
|
| 669 |
+
return WasiErrno.EINVAL;
|
| 670 |
+
}
|
| 671 |
+
const { fileDescriptor, atim: atimRes, mtim: mtimRes } = fdFilestatGetTimes.call(this, fd, atim, mtim, flags);
|
| 672 |
+
const h = fileDescriptor.fd;
|
| 673 |
+
await h.utimes(Number(atimRes), Number(mtimRes));
|
| 674 |
+
return WasiErrno.ESUCCESS;
|
| 675 |
+
}, ['i32', 'i64', 'i64', 'i32'], ['i32']);
|
| 676 |
+
defineImport('fd_pread', function fd_pread(fd, iovs, iovslen, offset, size) {
|
| 677 |
+
iovs = Number(iovs);
|
| 678 |
+
size = Number(size);
|
| 679 |
+
if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) {
|
| 680 |
+
return WasiErrno.EINVAL;
|
| 681 |
+
}
|
| 682 |
+
const { HEAPU8, view } = getMemory(this);
|
| 683 |
+
const wasi = _wasi.get(this);
|
| 684 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0));
|
| 685 |
+
if (!iovslen) {
|
| 686 |
+
view.setUint32(size, 0, true);
|
| 687 |
+
return WasiErrno.ESUCCESS;
|
| 688 |
+
}
|
| 689 |
+
let totalSize = 0;
|
| 690 |
+
const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 691 |
+
const offset = iovs + (i * 8);
|
| 692 |
+
const buf = view.getInt32(offset, true);
|
| 693 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 694 |
+
totalSize += bufLen;
|
| 695 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 696 |
+
});
|
| 697 |
+
let nread = 0;
|
| 698 |
+
const buffer = (() => {
|
| 699 |
+
try {
|
| 700 |
+
return new Uint8Array(new SharedArrayBuffer(totalSize));
|
| 701 |
+
}
|
| 702 |
+
catch (_) {
|
| 703 |
+
return new Uint8Array(totalSize);
|
| 704 |
+
}
|
| 705 |
+
})();
|
| 706 |
+
buffer._isBuffer = true;
|
| 707 |
+
const fs = getFs(this);
|
| 708 |
+
const bytesRead = fs.readSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(offset));
|
| 709 |
+
nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0;
|
| 710 |
+
view.setUint32(size, nread, true);
|
| 711 |
+
return WasiErrno.ESUCCESS;
|
| 712 |
+
}, async function (fd, iovs, iovslen, offset, size) {
|
| 713 |
+
iovs = Number(iovs);
|
| 714 |
+
size = Number(size);
|
| 715 |
+
if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) {
|
| 716 |
+
return WasiErrno.EINVAL;
|
| 717 |
+
}
|
| 718 |
+
const { HEAPU8, view } = getMemory(this);
|
| 719 |
+
const wasi = _wasi.get(this);
|
| 720 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0));
|
| 721 |
+
if (!iovslen) {
|
| 722 |
+
view.setUint32(size, 0, true);
|
| 723 |
+
return WasiErrno.ESUCCESS;
|
| 724 |
+
}
|
| 725 |
+
let totalSize = 0;
|
| 726 |
+
const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 727 |
+
const offset = iovs + (i * 8);
|
| 728 |
+
const buf = view.getInt32(offset, true);
|
| 729 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 730 |
+
totalSize += bufLen;
|
| 731 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 732 |
+
});
|
| 733 |
+
let nread = 0;
|
| 734 |
+
const buffer = new Uint8Array(totalSize);
|
| 735 |
+
buffer._isBuffer = true;
|
| 736 |
+
const { bytesRead } = await fileDescriptor.fd.read(buffer, 0, buffer.length, Number(offset));
|
| 737 |
+
nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0;
|
| 738 |
+
view.setUint32(size, nread, true);
|
| 739 |
+
return WasiErrno.ESUCCESS;
|
| 740 |
+
}, ['i32', 'i32', 'i32', 'i64', 'i32'], ['i32']);
|
| 741 |
+
defineImport('fd_pwrite', function fd_pwrite(fd, iovs, iovslen, offset, size) {
|
| 742 |
+
iovs = Number(iovs);
|
| 743 |
+
size = Number(size);
|
| 744 |
+
if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) {
|
| 745 |
+
return WasiErrno.EINVAL;
|
| 746 |
+
}
|
| 747 |
+
const { HEAPU8, view } = getMemory(this);
|
| 748 |
+
const wasi = _wasi.get(this);
|
| 749 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0));
|
| 750 |
+
if (!iovslen) {
|
| 751 |
+
view.setUint32(size, 0, true);
|
| 752 |
+
return WasiErrno.ESUCCESS;
|
| 753 |
+
}
|
| 754 |
+
const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 755 |
+
const offset = iovs + (i * 8);
|
| 756 |
+
const buf = view.getInt32(offset, true);
|
| 757 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 758 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 759 |
+
}));
|
| 760 |
+
const fs = getFs(this);
|
| 761 |
+
const nwritten = fs.writeSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(offset));
|
| 762 |
+
view.setUint32(size, nwritten, true);
|
| 763 |
+
return WasiErrno.ESUCCESS;
|
| 764 |
+
}, async function fd_pwrite(fd, iovs, iovslen, offset, size) {
|
| 765 |
+
iovs = Number(iovs);
|
| 766 |
+
size = Number(size);
|
| 767 |
+
if ((iovs === 0 && iovslen) || size === 0 || offset > INT64_MAX) {
|
| 768 |
+
return WasiErrno.EINVAL;
|
| 769 |
+
}
|
| 770 |
+
const { HEAPU8, view } = getMemory(this);
|
| 771 |
+
const wasi = _wasi.get(this);
|
| 772 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0));
|
| 773 |
+
if (!iovslen) {
|
| 774 |
+
view.setUint32(size, 0, true);
|
| 775 |
+
return WasiErrno.ESUCCESS;
|
| 776 |
+
}
|
| 777 |
+
const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 778 |
+
const offset = iovs + (i * 8);
|
| 779 |
+
const buf = view.getInt32(offset, true);
|
| 780 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 781 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 782 |
+
}));
|
| 783 |
+
const { bytesWritten } = await fileDescriptor.fd.write(buffer, 0, buffer.length, Number(offset));
|
| 784 |
+
view.setUint32(size, bytesWritten, true);
|
| 785 |
+
return WasiErrno.ESUCCESS;
|
| 786 |
+
}, ['i32', 'i32', 'i32', 'i64', 'i32'], ['i32']);
|
| 787 |
+
defineImport('fd_read', function fd_read(fd, iovs, iovslen, size) {
|
| 788 |
+
iovs = Number(iovs);
|
| 789 |
+
size = Number(size);
|
| 790 |
+
if ((iovs === 0 && iovslen) || size === 0) {
|
| 791 |
+
return WasiErrno.EINVAL;
|
| 792 |
+
}
|
| 793 |
+
const { HEAPU8, view } = getMemory(this);
|
| 794 |
+
const wasi = _wasi.get(this);
|
| 795 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ, BigInt(0));
|
| 796 |
+
if (!iovslen) {
|
| 797 |
+
view.setUint32(size, 0, true);
|
| 798 |
+
return WasiErrno.ESUCCESS;
|
| 799 |
+
}
|
| 800 |
+
let totalSize = 0;
|
| 801 |
+
const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 802 |
+
const offset = iovs + (i * 8);
|
| 803 |
+
const buf = view.getInt32(offset, true);
|
| 804 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 805 |
+
totalSize += bufLen;
|
| 806 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 807 |
+
});
|
| 808 |
+
let buffer;
|
| 809 |
+
let nread = 0;
|
| 810 |
+
if (fd === 0) {
|
| 811 |
+
if (typeof window === 'undefined' || typeof window.prompt !== 'function') {
|
| 812 |
+
return WasiErrno.ENOTSUP;
|
| 813 |
+
}
|
| 814 |
+
buffer = readStdin();
|
| 815 |
+
nread = buffer ? copyMemory(ioVecs, buffer) : 0;
|
| 816 |
+
}
|
| 817 |
+
else {
|
| 818 |
+
buffer = (() => {
|
| 819 |
+
try {
|
| 820 |
+
return new Uint8Array(new SharedArrayBuffer(totalSize));
|
| 821 |
+
}
|
| 822 |
+
catch (_) {
|
| 823 |
+
return new Uint8Array(totalSize);
|
| 824 |
+
}
|
| 825 |
+
})();
|
| 826 |
+
buffer._isBuffer = true;
|
| 827 |
+
const fs = getFs(this);
|
| 828 |
+
const bytesRead = fs.readSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(fileDescriptor.pos));
|
| 829 |
+
nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0;
|
| 830 |
+
fileDescriptor.pos += BigInt(nread);
|
| 831 |
+
}
|
| 832 |
+
view.setUint32(size, nread, true);
|
| 833 |
+
return WasiErrno.ESUCCESS;
|
| 834 |
+
}, async function fd_read(fd, iovs, iovslen, size) {
|
| 835 |
+
iovs = Number(iovs);
|
| 836 |
+
size = Number(size);
|
| 837 |
+
if ((iovs === 0 && iovslen) || size === 0) {
|
| 838 |
+
return WasiErrno.EINVAL;
|
| 839 |
+
}
|
| 840 |
+
const { HEAPU8, view } = getMemory(this);
|
| 841 |
+
const wasi = _wasi.get(this);
|
| 842 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ, BigInt(0));
|
| 843 |
+
if (!iovslen) {
|
| 844 |
+
view.setUint32(size, 0, true);
|
| 845 |
+
return WasiErrno.ESUCCESS;
|
| 846 |
+
}
|
| 847 |
+
let totalSize = 0;
|
| 848 |
+
const ioVecs = Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 849 |
+
const offset = iovs + (i * 8);
|
| 850 |
+
const buf = view.getInt32(offset, true);
|
| 851 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 852 |
+
totalSize += bufLen;
|
| 853 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 854 |
+
});
|
| 855 |
+
let buffer;
|
| 856 |
+
let nread = 0;
|
| 857 |
+
if (fd === 0) {
|
| 858 |
+
if (typeof window === 'undefined' || typeof window.prompt !== 'function') {
|
| 859 |
+
return WasiErrno.ENOTSUP;
|
| 860 |
+
}
|
| 861 |
+
buffer = readStdin();
|
| 862 |
+
nread = buffer ? copyMemory(ioVecs, buffer) : 0;
|
| 863 |
+
}
|
| 864 |
+
else {
|
| 865 |
+
buffer = new Uint8Array(totalSize);
|
| 866 |
+
buffer._isBuffer = true;
|
| 867 |
+
const { bytesRead } = await fileDescriptor.fd.read(buffer, 0, buffer.length, Number(fileDescriptor.pos));
|
| 868 |
+
nread = buffer ? copyMemory(ioVecs, buffer.subarray(0, bytesRead)) : 0;
|
| 869 |
+
fileDescriptor.pos += BigInt(nread);
|
| 870 |
+
}
|
| 871 |
+
view.setUint32(size, nread, true);
|
| 872 |
+
return WasiErrno.ESUCCESS;
|
| 873 |
+
}, ['i32', 'i32', 'i32', 'i32'], ['i32']);
|
| 874 |
+
defineImport('fd_readdir', function fd_readdir(fd, buf, buf_len, cookie, bufused) {
|
| 875 |
+
buf = Number(buf);
|
| 876 |
+
buf_len = Number(buf_len);
|
| 877 |
+
bufused = Number(bufused);
|
| 878 |
+
if (buf === 0 || bufused === 0)
|
| 879 |
+
return WasiErrno.ESUCCESS;
|
| 880 |
+
const wasi = _wasi.get(this);
|
| 881 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READDIR, BigInt(0));
|
| 882 |
+
const fs = getFs(this);
|
| 883 |
+
const entries = fs.readdirSync(fileDescriptor.realPath, { withFileTypes: true });
|
| 884 |
+
const { HEAPU8, view } = getMemory(this);
|
| 885 |
+
let bufferUsed = 0;
|
| 886 |
+
for (let i = Number(cookie); i < entries.length; i++) {
|
| 887 |
+
const nameData = encoder.encode(entries[i].name);
|
| 888 |
+
const entryInfo = fs.statSync(resolve(fileDescriptor.realPath, entries[i].name), { bigint: true });
|
| 889 |
+
const entryData = new Uint8Array(24 + nameData.byteLength);
|
| 890 |
+
const entryView = new DataView(entryData.buffer);
|
| 891 |
+
entryView.setBigUint64(0, BigInt(i + 1), true);
|
| 892 |
+
entryView.setBigUint64(8, BigInt(entryInfo.ino ? entryInfo.ino : 0), true);
|
| 893 |
+
entryView.setUint32(16, nameData.byteLength, true);
|
| 894 |
+
let type;
|
| 895 |
+
if (entries[i].isFile()) {
|
| 896 |
+
type = WasiFileType.REGULAR_FILE;
|
| 897 |
+
}
|
| 898 |
+
else if (entries[i].isDirectory()) {
|
| 899 |
+
type = WasiFileType.DIRECTORY;
|
| 900 |
+
}
|
| 901 |
+
else if (entries[i].isSymbolicLink()) {
|
| 902 |
+
type = WasiFileType.SYMBOLIC_LINK;
|
| 903 |
+
}
|
| 904 |
+
else if (entries[i].isCharacterDevice()) {
|
| 905 |
+
type = WasiFileType.CHARACTER_DEVICE;
|
| 906 |
+
}
|
| 907 |
+
else if (entries[i].isBlockDevice()) {
|
| 908 |
+
type = WasiFileType.BLOCK_DEVICE;
|
| 909 |
+
}
|
| 910 |
+
else if (entries[i].isSocket()) {
|
| 911 |
+
type = WasiFileType.SOCKET_STREAM;
|
| 912 |
+
}
|
| 913 |
+
else {
|
| 914 |
+
type = WasiFileType.UNKNOWN;
|
| 915 |
+
}
|
| 916 |
+
entryView.setUint8(20, type);
|
| 917 |
+
entryData.set(nameData, 24);
|
| 918 |
+
const data = entryData.slice(0, Math.min(entryData.length, buf_len - bufferUsed));
|
| 919 |
+
HEAPU8.set(data, buf + bufferUsed);
|
| 920 |
+
bufferUsed += data.byteLength;
|
| 921 |
+
}
|
| 922 |
+
view.setUint32(bufused, bufferUsed, true);
|
| 923 |
+
return WasiErrno.ESUCCESS;
|
| 924 |
+
}, async function fd_readdir(fd, buf, buf_len, cookie, bufused) {
|
| 925 |
+
buf = Number(buf);
|
| 926 |
+
buf_len = Number(buf_len);
|
| 927 |
+
bufused = Number(bufused);
|
| 928 |
+
if (buf === 0 || bufused === 0)
|
| 929 |
+
return WasiErrno.ESUCCESS;
|
| 930 |
+
const wasi = _wasi.get(this);
|
| 931 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READDIR, BigInt(0));
|
| 932 |
+
const fs = getFs(this);
|
| 933 |
+
const entries = await fs.promises.readdir(fileDescriptor.realPath, { withFileTypes: true });
|
| 934 |
+
const { HEAPU8, view } = getMemory(this);
|
| 935 |
+
let bufferUsed = 0;
|
| 936 |
+
for (let i = Number(cookie); i < entries.length; i++) {
|
| 937 |
+
const nameData = encoder.encode(entries[i].name);
|
| 938 |
+
const entryInfo = await fs.promises.stat(resolve(fileDescriptor.realPath, entries[i].name), { bigint: true });
|
| 939 |
+
const entryData = new Uint8Array(24 + nameData.byteLength);
|
| 940 |
+
const entryView = new DataView(entryData.buffer);
|
| 941 |
+
entryView.setBigUint64(0, BigInt(i + 1), true);
|
| 942 |
+
entryView.setBigUint64(8, BigInt(entryInfo.ino ? entryInfo.ino : 0), true);
|
| 943 |
+
entryView.setUint32(16, nameData.byteLength, true);
|
| 944 |
+
let type;
|
| 945 |
+
if (entries[i].isFile()) {
|
| 946 |
+
type = WasiFileType.REGULAR_FILE;
|
| 947 |
+
}
|
| 948 |
+
else if (entries[i].isDirectory()) {
|
| 949 |
+
type = WasiFileType.DIRECTORY;
|
| 950 |
+
}
|
| 951 |
+
else if (entries[i].isSymbolicLink()) {
|
| 952 |
+
type = WasiFileType.SYMBOLIC_LINK;
|
| 953 |
+
}
|
| 954 |
+
else if (entries[i].isCharacterDevice()) {
|
| 955 |
+
type = WasiFileType.CHARACTER_DEVICE;
|
| 956 |
+
}
|
| 957 |
+
else if (entries[i].isBlockDevice()) {
|
| 958 |
+
type = WasiFileType.BLOCK_DEVICE;
|
| 959 |
+
}
|
| 960 |
+
else if (entries[i].isSocket()) {
|
| 961 |
+
type = WasiFileType.SOCKET_STREAM;
|
| 962 |
+
}
|
| 963 |
+
else {
|
| 964 |
+
type = WasiFileType.UNKNOWN;
|
| 965 |
+
}
|
| 966 |
+
entryView.setUint8(20, type);
|
| 967 |
+
entryData.set(nameData, 24);
|
| 968 |
+
const data = entryData.slice(0, Math.min(entryData.length, buf_len - bufferUsed));
|
| 969 |
+
HEAPU8.set(data, buf + bufferUsed);
|
| 970 |
+
bufferUsed += data.byteLength;
|
| 971 |
+
}
|
| 972 |
+
view.setUint32(bufused, bufferUsed, true);
|
| 973 |
+
return WasiErrno.ESUCCESS;
|
| 974 |
+
}, ['i32', 'i32', 'i32', 'i64', 'i32'], ['i32']);
|
| 975 |
+
defineImport('fd_renumber', function fd_renumber(from, to) {
|
| 976 |
+
const wasi = _wasi.get(this);
|
| 977 |
+
wasi.fds.renumber(to, from);
|
| 978 |
+
return WasiErrno.ESUCCESS;
|
| 979 |
+
}, async function fd_renumber(from, to) {
|
| 980 |
+
const wasi = _wasi.get(this);
|
| 981 |
+
await wasi.fds.renumber(to, from);
|
| 982 |
+
return WasiErrno.ESUCCESS;
|
| 983 |
+
}, ['i32', 'i32'], ['i32']);
|
| 984 |
+
defineImport('fd_sync', function fd_sync(fd) {
|
| 985 |
+
const wasi = _wasi.get(this);
|
| 986 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_SYNC, BigInt(0));
|
| 987 |
+
const fs = getFs(this);
|
| 988 |
+
fs.fsyncSync(fileDescriptor.fd);
|
| 989 |
+
return WasiErrno.ESUCCESS;
|
| 990 |
+
}, async function fd_sync(fd) {
|
| 991 |
+
const wasi = _wasi.get(this);
|
| 992 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_SYNC, BigInt(0));
|
| 993 |
+
await fileDescriptor.fd.sync();
|
| 994 |
+
return WasiErrno.ESUCCESS;
|
| 995 |
+
}, ['i32'], ['i32']);
|
| 996 |
+
defineImport('fd_write', function fd_write(fd, iovs, iovslen, size) {
|
| 997 |
+
iovs = Number(iovs);
|
| 998 |
+
size = Number(size);
|
| 999 |
+
if ((iovs === 0 && iovslen) || size === 0) {
|
| 1000 |
+
return WasiErrno.EINVAL;
|
| 1001 |
+
}
|
| 1002 |
+
const { HEAPU8, view } = getMemory(this);
|
| 1003 |
+
const wasi = _wasi.get(this);
|
| 1004 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE, BigInt(0));
|
| 1005 |
+
if (!iovslen) {
|
| 1006 |
+
view.setUint32(size, 0, true);
|
| 1007 |
+
return WasiErrno.ESUCCESS;
|
| 1008 |
+
}
|
| 1009 |
+
const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 1010 |
+
const offset = iovs + (i * 8);
|
| 1011 |
+
const buf = view.getInt32(offset, true);
|
| 1012 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 1013 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 1014 |
+
}));
|
| 1015 |
+
let nwritten;
|
| 1016 |
+
if (fd === 1 || fd === 2) {
|
| 1017 |
+
nwritten = fileDescriptor.write(buffer);
|
| 1018 |
+
}
|
| 1019 |
+
else {
|
| 1020 |
+
const fs = getFs(this);
|
| 1021 |
+
nwritten = fs.writeSync(fileDescriptor.fd, buffer, 0, buffer.length, Number(fileDescriptor.pos));
|
| 1022 |
+
fileDescriptor.pos += BigInt(nwritten);
|
| 1023 |
+
}
|
| 1024 |
+
view.setUint32(size, nwritten, true);
|
| 1025 |
+
return WasiErrno.ESUCCESS;
|
| 1026 |
+
}, async function fd_write(fd, iovs, iovslen, size) {
|
| 1027 |
+
iovs = Number(iovs);
|
| 1028 |
+
size = Number(size);
|
| 1029 |
+
if ((iovs === 0 && iovslen) || size === 0) {
|
| 1030 |
+
return WasiErrno.EINVAL;
|
| 1031 |
+
}
|
| 1032 |
+
const { HEAPU8, view } = getMemory(this);
|
| 1033 |
+
const wasi = _wasi.get(this);
|
| 1034 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE, BigInt(0));
|
| 1035 |
+
if (!iovslen) {
|
| 1036 |
+
view.setUint32(size, 0, true);
|
| 1037 |
+
return WasiErrno.ESUCCESS;
|
| 1038 |
+
}
|
| 1039 |
+
const buffer = concatBuffer(Array.from({ length: Number(iovslen) }, (_, i) => {
|
| 1040 |
+
const offset = iovs + (i * 8);
|
| 1041 |
+
const buf = view.getInt32(offset, true);
|
| 1042 |
+
const bufLen = view.getUint32(offset + 4, true);
|
| 1043 |
+
return HEAPU8.subarray(buf, buf + bufLen);
|
| 1044 |
+
}));
|
| 1045 |
+
let nwritten;
|
| 1046 |
+
if (fd === 1 || fd === 2) {
|
| 1047 |
+
nwritten = fileDescriptor.write(buffer);
|
| 1048 |
+
}
|
| 1049 |
+
else {
|
| 1050 |
+
nwritten = await (await (fileDescriptor.fd.write(buffer, 0, buffer.length, Number(fileDescriptor.pos)))).bytesWritten;
|
| 1051 |
+
fileDescriptor.pos += BigInt(nwritten);
|
| 1052 |
+
}
|
| 1053 |
+
view.setUint32(size, nwritten, true);
|
| 1054 |
+
return WasiErrno.ESUCCESS;
|
| 1055 |
+
}, ['i32', 'i32', 'i32', 'i32'], ['i32']);
|
| 1056 |
+
defineImport('path_create_directory', function path_create_directory(fd, path, path_len) {
|
| 1057 |
+
path = Number(path);
|
| 1058 |
+
path_len = Number(path_len);
|
| 1059 |
+
if (path === 0) {
|
| 1060 |
+
return WasiErrno.EINVAL;
|
| 1061 |
+
}
|
| 1062 |
+
const { HEAPU8 } = getMemory(this);
|
| 1063 |
+
const wasi = _wasi.get(this);
|
| 1064 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0));
|
| 1065 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1066 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1067 |
+
const fs = getFs(this);
|
| 1068 |
+
fs.mkdirSync(pathString);
|
| 1069 |
+
return WasiErrno.ESUCCESS;
|
| 1070 |
+
}, async function path_create_directory(fd, path, path_len) {
|
| 1071 |
+
path = Number(path);
|
| 1072 |
+
path_len = Number(path_len);
|
| 1073 |
+
if (path === 0) {
|
| 1074 |
+
return WasiErrno.EINVAL;
|
| 1075 |
+
}
|
| 1076 |
+
const { HEAPU8 } = getMemory(this);
|
| 1077 |
+
const wasi = _wasi.get(this);
|
| 1078 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0));
|
| 1079 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1080 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1081 |
+
const fs = getFs(this);
|
| 1082 |
+
await fs.promises.mkdir(pathString);
|
| 1083 |
+
return WasiErrno.ESUCCESS;
|
| 1084 |
+
}, ['i32', 'i32', 'i32'], ['i32']);
|
| 1085 |
+
defineImport('path_filestat_get', function path_filestat_get(fd, flags, path, path_len, filestat) {
|
| 1086 |
+
path = Number(path);
|
| 1087 |
+
path_len = Number(path_len);
|
| 1088 |
+
filestat = Number(filestat);
|
| 1089 |
+
if (path === 0 || filestat === 0) {
|
| 1090 |
+
return WasiErrno.EINVAL;
|
| 1091 |
+
}
|
| 1092 |
+
const { HEAPU8, view } = getMemory(this);
|
| 1093 |
+
const wasi = _wasi.get(this);
|
| 1094 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0));
|
| 1095 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1096 |
+
const fs = getFs(this);
|
| 1097 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1098 |
+
let stat;
|
| 1099 |
+
if ((flags & 1) === 1) {
|
| 1100 |
+
stat = fs.statSync(pathString, { bigint: true });
|
| 1101 |
+
}
|
| 1102 |
+
else {
|
| 1103 |
+
stat = fs.lstatSync(pathString, { bigint: true });
|
| 1104 |
+
}
|
| 1105 |
+
toFileStat(view, filestat, stat);
|
| 1106 |
+
return WasiErrno.ESUCCESS;
|
| 1107 |
+
}, async function path_filestat_get(fd, flags, path, path_len, filestat) {
|
| 1108 |
+
path = Number(path);
|
| 1109 |
+
path_len = Number(path_len);
|
| 1110 |
+
filestat = Number(filestat);
|
| 1111 |
+
if (path === 0 || filestat === 0) {
|
| 1112 |
+
return WasiErrno.EINVAL;
|
| 1113 |
+
}
|
| 1114 |
+
const { HEAPU8, view } = getMemory(this);
|
| 1115 |
+
const wasi = _wasi.get(this);
|
| 1116 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0));
|
| 1117 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1118 |
+
const fs = getFs(this);
|
| 1119 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1120 |
+
let stat;
|
| 1121 |
+
if ((flags & 1) === 1) {
|
| 1122 |
+
stat = await fs.promises.stat(pathString, { bigint: true });
|
| 1123 |
+
}
|
| 1124 |
+
else {
|
| 1125 |
+
stat = await fs.promises.lstat(pathString, { bigint: true });
|
| 1126 |
+
}
|
| 1127 |
+
toFileStat(view, filestat, stat);
|
| 1128 |
+
return WasiErrno.ESUCCESS;
|
| 1129 |
+
}, ['i32', 'i32', 'i32', 'i32', 'i32'], ['i32']);
|
| 1130 |
+
defineImport('path_filestat_set_times', function path_filestat_set_times(fd, flags, path, path_len, atim, mtim, fst_flags) {
|
| 1131 |
+
path = Number(path);
|
| 1132 |
+
path_len = Number(path_len);
|
| 1133 |
+
if (path === 0)
|
| 1134 |
+
return WasiErrno.EINVAL;
|
| 1135 |
+
const { HEAPU8 } = getMemory(this);
|
| 1136 |
+
const wasi = _wasi.get(this);
|
| 1137 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0));
|
| 1138 |
+
if (validateFstFlagsOrReturn(fst_flags)) {
|
| 1139 |
+
return WasiErrno.EINVAL;
|
| 1140 |
+
}
|
| 1141 |
+
const fs = getFs(this);
|
| 1142 |
+
const resolvedPath = resolvePathSync(fs, fileDescriptor, decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)), flags);
|
| 1143 |
+
if ((fst_flags & WasiFstFlag.SET_ATIM_NOW) === WasiFstFlag.SET_ATIM_NOW) {
|
| 1144 |
+
atim = BigInt(Date.now() * 1000000);
|
| 1145 |
+
}
|
| 1146 |
+
if ((fst_flags & WasiFstFlag.SET_MTIM_NOW) === WasiFstFlag.SET_MTIM_NOW) {
|
| 1147 |
+
mtim = BigInt(Date.now() * 1000000);
|
| 1148 |
+
}
|
| 1149 |
+
fs.utimesSync(resolvedPath, Number(atim), Number(mtim));
|
| 1150 |
+
return WasiErrno.ESUCCESS;
|
| 1151 |
+
}, async function path_filestat_set_times(fd, flags, path, path_len, atim, mtim, fst_flags) {
|
| 1152 |
+
path = Number(path);
|
| 1153 |
+
path_len = Number(path_len);
|
| 1154 |
+
if (path === 0)
|
| 1155 |
+
return WasiErrno.EINVAL;
|
| 1156 |
+
const { HEAPU8 } = getMemory(this);
|
| 1157 |
+
const wasi = _wasi.get(this);
|
| 1158 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0));
|
| 1159 |
+
if (validateFstFlagsOrReturn(fst_flags)) {
|
| 1160 |
+
return WasiErrno.EINVAL;
|
| 1161 |
+
}
|
| 1162 |
+
const fs = getFs(this);
|
| 1163 |
+
const resolvedPath = await resolvePathAsync(fs, fileDescriptor, decoder.decode(unsharedSlice(HEAPU8, path, path + path_len)), flags);
|
| 1164 |
+
if ((fst_flags & WasiFstFlag.SET_ATIM_NOW) === WasiFstFlag.SET_ATIM_NOW) {
|
| 1165 |
+
atim = BigInt(Date.now() * 1000000);
|
| 1166 |
+
}
|
| 1167 |
+
if ((fst_flags & WasiFstFlag.SET_MTIM_NOW) === WasiFstFlag.SET_MTIM_NOW) {
|
| 1168 |
+
mtim = BigInt(Date.now() * 1000000);
|
| 1169 |
+
}
|
| 1170 |
+
await fs.promises.utimes(resolvedPath, Number(atim), Number(mtim));
|
| 1171 |
+
return WasiErrno.ESUCCESS;
|
| 1172 |
+
}, ['i32', 'i32', 'i32', 'i32', 'i64', 'i64', 'i32'], ['i32']);
|
| 1173 |
+
defineImport('path_link', function path_link(old_fd, old_flags, old_path, old_path_len, new_fd, new_path, new_path_len) {
|
| 1174 |
+
old_path = Number(old_path);
|
| 1175 |
+
old_path_len = Number(old_path_len);
|
| 1176 |
+
new_path = Number(new_path);
|
| 1177 |
+
new_path_len = Number(new_path_len);
|
| 1178 |
+
if (old_path === 0 || new_path === 0) {
|
| 1179 |
+
return WasiErrno.EINVAL;
|
| 1180 |
+
}
|
| 1181 |
+
const wasi = _wasi.get(this);
|
| 1182 |
+
let oldWrap;
|
| 1183 |
+
let newWrap;
|
| 1184 |
+
if (old_fd === new_fd) {
|
| 1185 |
+
oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE | WasiRights.PATH_LINK_TARGET, BigInt(0));
|
| 1186 |
+
}
|
| 1187 |
+
else {
|
| 1188 |
+
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0));
|
| 1189 |
+
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0));
|
| 1190 |
+
}
|
| 1191 |
+
const { HEAPU8 } = getMemory(this);
|
| 1192 |
+
const fs = getFs(this);
|
| 1193 |
+
const resolvedOldPath = resolvePathSync(fs, oldWrap, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags);
|
| 1194 |
+
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
| 1195 |
+
fs.linkSync(resolvedOldPath, resolvedNewPath);
|
| 1196 |
+
return WasiErrno.ESUCCESS;
|
| 1197 |
+
}, async function path_link(old_fd, old_flags, old_path, old_path_len, new_fd, new_path, new_path_len) {
|
| 1198 |
+
old_path = Number(old_path);
|
| 1199 |
+
old_path_len = Number(old_path_len);
|
| 1200 |
+
new_path = Number(new_path);
|
| 1201 |
+
new_path_len = Number(new_path_len);
|
| 1202 |
+
if (old_path === 0 || new_path === 0) {
|
| 1203 |
+
return WasiErrno.EINVAL;
|
| 1204 |
+
}
|
| 1205 |
+
const wasi = _wasi.get(this);
|
| 1206 |
+
let oldWrap;
|
| 1207 |
+
let newWrap;
|
| 1208 |
+
if (old_fd === new_fd) {
|
| 1209 |
+
oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE | WasiRights.PATH_LINK_TARGET, BigInt(0));
|
| 1210 |
+
}
|
| 1211 |
+
else {
|
| 1212 |
+
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0));
|
| 1213 |
+
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0));
|
| 1214 |
+
}
|
| 1215 |
+
const { HEAPU8 } = getMemory(this);
|
| 1216 |
+
const fs = getFs(this);
|
| 1217 |
+
const resolvedOldPath = await resolvePathAsync(fs, oldWrap, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags);
|
| 1218 |
+
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
| 1219 |
+
await fs.promises.link(resolvedOldPath, resolvedNewPath);
|
| 1220 |
+
return WasiErrno.ESUCCESS;
|
| 1221 |
+
}, ['i32', 'i32', 'i32', 'i32', 'i32', 'i32', 'i32'], ['i32']);
|
| 1222 |
+
function pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags) {
|
| 1223 |
+
const read = (fs_rights_base & (WasiRights.FD_READ |
|
| 1224 |
+
WasiRights.FD_READDIR)) !== BigInt(0);
|
| 1225 |
+
const write = (fs_rights_base & (WasiRights.FD_DATASYNC |
|
| 1226 |
+
WasiRights.FD_WRITE |
|
| 1227 |
+
WasiRights.FD_ALLOCATE |
|
| 1228 |
+
WasiRights.FD_FILESTAT_SET_SIZE)) !== BigInt(0);
|
| 1229 |
+
let flags = write ? read ? FileControlFlag.O_RDWR : FileControlFlag.O_WRONLY : FileControlFlag.O_RDONLY;
|
| 1230 |
+
let needed_base = WasiRights.PATH_OPEN;
|
| 1231 |
+
let needed_inheriting = fs_rights_base | fs_rights_inheriting;
|
| 1232 |
+
if ((o_flags & WasiFileControlFlag.O_CREAT) !== 0) {
|
| 1233 |
+
flags |= FileControlFlag.O_CREAT;
|
| 1234 |
+
needed_base |= WasiRights.PATH_CREATE_FILE;
|
| 1235 |
+
}
|
| 1236 |
+
if ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0) {
|
| 1237 |
+
flags |= FileControlFlag.O_DIRECTORY;
|
| 1238 |
+
}
|
| 1239 |
+
if ((o_flags & WasiFileControlFlag.O_EXCL) !== 0) {
|
| 1240 |
+
flags |= FileControlFlag.O_EXCL;
|
| 1241 |
+
}
|
| 1242 |
+
if ((o_flags & WasiFileControlFlag.O_TRUNC) !== 0) {
|
| 1243 |
+
flags |= FileControlFlag.O_TRUNC;
|
| 1244 |
+
needed_base |= WasiRights.PATH_FILESTAT_SET_SIZE;
|
| 1245 |
+
}
|
| 1246 |
+
if ((fs_flags & WasiFdFlag.APPEND) !== 0) {
|
| 1247 |
+
flags |= FileControlFlag.O_APPEND;
|
| 1248 |
+
}
|
| 1249 |
+
if ((fs_flags & WasiFdFlag.DSYNC) !== 0) {
|
| 1250 |
+
// flags |= FileControlFlag.O_DSYNC;
|
| 1251 |
+
needed_inheriting |= WasiRights.FD_DATASYNC;
|
| 1252 |
+
}
|
| 1253 |
+
if ((fs_flags & WasiFdFlag.NONBLOCK) !== 0) {
|
| 1254 |
+
flags |= FileControlFlag.O_NONBLOCK;
|
| 1255 |
+
}
|
| 1256 |
+
if ((fs_flags & WasiFdFlag.RSYNC) !== 0) {
|
| 1257 |
+
flags |= FileControlFlag.O_SYNC;
|
| 1258 |
+
needed_inheriting |= WasiRights.FD_SYNC;
|
| 1259 |
+
}
|
| 1260 |
+
if ((fs_flags & WasiFdFlag.SYNC) !== 0) {
|
| 1261 |
+
flags |= FileControlFlag.O_SYNC;
|
| 1262 |
+
needed_inheriting |= WasiRights.FD_SYNC;
|
| 1263 |
+
}
|
| 1264 |
+
if (write && (flags & (FileControlFlag.O_APPEND | FileControlFlag.O_TRUNC)) === 0) {
|
| 1265 |
+
needed_inheriting |= WasiRights.FD_SEEK;
|
| 1266 |
+
}
|
| 1267 |
+
return { flags, needed_base, needed_inheriting };
|
| 1268 |
+
}
|
| 1269 |
+
defineImport('path_open', function path_open(dirfd, dirflags, path, path_len, o_flags, fs_rights_base, fs_rights_inheriting, fs_flags, fd) {
|
| 1270 |
+
path = Number(path);
|
| 1271 |
+
fd = Number(fd);
|
| 1272 |
+
if (path === 0 || fd === 0) {
|
| 1273 |
+
return WasiErrno.EINVAL;
|
| 1274 |
+
}
|
| 1275 |
+
path_len = Number(path_len);
|
| 1276 |
+
fs_rights_base = BigInt(fs_rights_base);
|
| 1277 |
+
fs_rights_inheriting = BigInt(fs_rights_inheriting);
|
| 1278 |
+
const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags);
|
| 1279 |
+
const wasi = _wasi.get(this);
|
| 1280 |
+
const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting);
|
| 1281 |
+
const memory = getMemory(this);
|
| 1282 |
+
const HEAPU8 = memory.HEAPU8;
|
| 1283 |
+
const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1284 |
+
const fs = getFs(this);
|
| 1285 |
+
const resolved_path = resolvePathSync(fs, fileDescriptor, pathString, dirflags);
|
| 1286 |
+
const r = fs.openSync(resolved_path, _isWin32Flags ? _toWinOpenFlags(flagsRes) : flagsRes, 0o666);
|
| 1287 |
+
const filetype = wasi.fds.getFileTypeByFd(r);
|
| 1288 |
+
if ((filetype !== WasiFileType.DIRECTORY) &&
|
| 1289 |
+
((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 ||
|
| 1290 |
+
(resolved_path.endsWith('/')))) {
|
| 1291 |
+
return WasiErrno.ENOTDIR;
|
| 1292 |
+
}
|
| 1293 |
+
const { base: max_base, inheriting: max_inheriting } = getRights(wasi.fds.stdio, r, flagsRes, filetype);
|
| 1294 |
+
const wrap = wasi.fds.insert(r, resolved_path, resolved_path, filetype, fs_rights_base & max_base, fs_rights_inheriting & max_inheriting, 0);
|
| 1295 |
+
const stat = fs.fstatSync(r, { bigint: true });
|
| 1296 |
+
if (stat.isFile()) {
|
| 1297 |
+
wrap.size = stat.size;
|
| 1298 |
+
if ((flagsRes & FileControlFlag.O_APPEND) !== 0) {
|
| 1299 |
+
wrap.pos = stat.size;
|
| 1300 |
+
}
|
| 1301 |
+
}
|
| 1302 |
+
const view = memory.view;
|
| 1303 |
+
view.setInt32(fd, wrap.id, true);
|
| 1304 |
+
return WasiErrno.ESUCCESS;
|
| 1305 |
+
}, async function path_open(dirfd, dirflags, path, path_len, o_flags, fs_rights_base, fs_rights_inheriting, fs_flags, fd) {
|
| 1306 |
+
path = Number(path);
|
| 1307 |
+
fd = Number(fd);
|
| 1308 |
+
if (path === 0 || fd === 0) {
|
| 1309 |
+
return WasiErrno.EINVAL;
|
| 1310 |
+
}
|
| 1311 |
+
path_len = Number(path_len);
|
| 1312 |
+
fs_rights_base = BigInt(fs_rights_base);
|
| 1313 |
+
fs_rights_inheriting = BigInt(fs_rights_inheriting);
|
| 1314 |
+
const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags);
|
| 1315 |
+
const wasi = _wasi.get(this);
|
| 1316 |
+
const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting);
|
| 1317 |
+
const memory = getMemory(this);
|
| 1318 |
+
const HEAPU8 = memory.HEAPU8;
|
| 1319 |
+
const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1320 |
+
const fs = getFs(this);
|
| 1321 |
+
const resolved_path = await resolvePathAsync(fs, fileDescriptor, pathString, dirflags);
|
| 1322 |
+
const r = await fs.promises.open(resolved_path, _isWin32Flags ? _toWinOpenFlags(flagsRes) : flagsRes, 0o666);
|
| 1323 |
+
const filetype = await wasi.fds.getFileTypeByFd(r);
|
| 1324 |
+
if ((o_flags & WasiFileControlFlag.O_DIRECTORY) !== 0 && filetype !== WasiFileType.DIRECTORY) {
|
| 1325 |
+
return WasiErrno.ENOTDIR;
|
| 1326 |
+
}
|
| 1327 |
+
const { base: max_base, inheriting: max_inheriting } = getRights(wasi.fds.stdio, r.fd, flagsRes, filetype);
|
| 1328 |
+
const wrap = wasi.fds.insert(r, resolved_path, resolved_path, filetype, fs_rights_base & max_base, fs_rights_inheriting & max_inheriting, 0);
|
| 1329 |
+
const stat = await r.stat({ bigint: true });
|
| 1330 |
+
if (stat.isFile()) {
|
| 1331 |
+
wrap.size = stat.size;
|
| 1332 |
+
if ((flagsRes & FileControlFlag.O_APPEND) !== 0) {
|
| 1333 |
+
wrap.pos = stat.size;
|
| 1334 |
+
}
|
| 1335 |
+
}
|
| 1336 |
+
const view = memory.view;
|
| 1337 |
+
view.setInt32(fd, wrap.id, true);
|
| 1338 |
+
return WasiErrno.ESUCCESS;
|
| 1339 |
+
}, ['i32', 'i32', 'i32', 'i32', 'i32', 'i64', 'i64', 'i32', 'i32'], ['i32']);
|
| 1340 |
+
defineImport('path_readlink', function path_readlink(fd, path, path_len, buf, buf_len, bufused) {
|
| 1341 |
+
path = Number(path);
|
| 1342 |
+
path_len = Number(path_len);
|
| 1343 |
+
buf = Number(buf);
|
| 1344 |
+
buf_len = Number(buf_len);
|
| 1345 |
+
bufused = Number(bufused);
|
| 1346 |
+
if (path === 0 || buf === 0 || bufused === 0) {
|
| 1347 |
+
return WasiErrno.EINVAL;
|
| 1348 |
+
}
|
| 1349 |
+
const { HEAPU8, view } = getMemory(this);
|
| 1350 |
+
const wasi = _wasi.get(this);
|
| 1351 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_READLINK, BigInt(0));
|
| 1352 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1353 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1354 |
+
const fs = getFs(this);
|
| 1355 |
+
const link = fs.readlinkSync(pathString);
|
| 1356 |
+
const linkData = encoder.encode(link);
|
| 1357 |
+
const len = Math.min(linkData.length, buf_len);
|
| 1358 |
+
if (len >= buf_len)
|
| 1359 |
+
return WasiErrno.ENOBUFS;
|
| 1360 |
+
HEAPU8.set(linkData.subarray(0, len), buf);
|
| 1361 |
+
HEAPU8[buf + len] = 0;
|
| 1362 |
+
view.setUint32(bufused, len, true);
|
| 1363 |
+
return WasiErrno.ESUCCESS;
|
| 1364 |
+
}, async function path_readlink(fd, path, path_len, buf, buf_len, bufused) {
|
| 1365 |
+
path = Number(path);
|
| 1366 |
+
path_len = Number(path_len);
|
| 1367 |
+
buf = Number(buf);
|
| 1368 |
+
buf_len = Number(buf_len);
|
| 1369 |
+
bufused = Number(bufused);
|
| 1370 |
+
if (path === 0 || buf === 0 || bufused === 0) {
|
| 1371 |
+
return WasiErrno.EINVAL;
|
| 1372 |
+
}
|
| 1373 |
+
const { HEAPU8, view } = getMemory(this);
|
| 1374 |
+
const wasi = _wasi.get(this);
|
| 1375 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_READLINK, BigInt(0));
|
| 1376 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1377 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1378 |
+
const fs = getFs(this);
|
| 1379 |
+
const link = await fs.promises.readlink(pathString);
|
| 1380 |
+
const linkData = encoder.encode(link);
|
| 1381 |
+
const len = Math.min(linkData.length, buf_len);
|
| 1382 |
+
if (len >= buf_len)
|
| 1383 |
+
return WasiErrno.ENOBUFS;
|
| 1384 |
+
HEAPU8.set(linkData.subarray(0, len), buf);
|
| 1385 |
+
HEAPU8[buf + len] = 0;
|
| 1386 |
+
view.setUint32(bufused, len, true);
|
| 1387 |
+
return WasiErrno.ESUCCESS;
|
| 1388 |
+
}, ['i32', 'i32', 'i32', 'i32', 'i32', 'i32'], ['i32']);
|
| 1389 |
+
defineImport('path_remove_directory', function path_remove_directory(fd, path, path_len) {
|
| 1390 |
+
path = Number(path);
|
| 1391 |
+
path_len = Number(path_len);
|
| 1392 |
+
if (path === 0) {
|
| 1393 |
+
return WasiErrno.EINVAL;
|
| 1394 |
+
}
|
| 1395 |
+
const { HEAPU8 } = getMemory(this);
|
| 1396 |
+
const wasi = _wasi.get(this);
|
| 1397 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0));
|
| 1398 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1399 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1400 |
+
const fs = getFs(this);
|
| 1401 |
+
fs.rmdirSync(pathString);
|
| 1402 |
+
return WasiErrno.ESUCCESS;
|
| 1403 |
+
}, async function path_remove_directory(fd, path, path_len) {
|
| 1404 |
+
path = Number(path);
|
| 1405 |
+
path_len = Number(path_len);
|
| 1406 |
+
if (path === 0) {
|
| 1407 |
+
return WasiErrno.EINVAL;
|
| 1408 |
+
}
|
| 1409 |
+
const { HEAPU8 } = getMemory(this);
|
| 1410 |
+
const wasi = _wasi.get(this);
|
| 1411 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0));
|
| 1412 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1413 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1414 |
+
const fs = getFs(this);
|
| 1415 |
+
await fs.promises.rmdir(pathString);
|
| 1416 |
+
return WasiErrno.ESUCCESS;
|
| 1417 |
+
}, ['i32', 'i32', 'i32'], ['i32']);
|
| 1418 |
+
defineImport('path_rename', function path_rename(old_fd, old_path, old_path_len, new_fd, new_path, new_path_len) {
|
| 1419 |
+
old_path = Number(old_path);
|
| 1420 |
+
old_path_len = Number(old_path_len);
|
| 1421 |
+
new_path = Number(new_path);
|
| 1422 |
+
new_path_len = Number(new_path_len);
|
| 1423 |
+
if (old_path === 0 || new_path === 0) {
|
| 1424 |
+
return WasiErrno.EINVAL;
|
| 1425 |
+
}
|
| 1426 |
+
const wasi = _wasi.get(this);
|
| 1427 |
+
let oldWrap;
|
| 1428 |
+
let newWrap;
|
| 1429 |
+
if (old_fd === new_fd) {
|
| 1430 |
+
oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE | WasiRights.PATH_RENAME_TARGET, BigInt(0));
|
| 1431 |
+
}
|
| 1432 |
+
else {
|
| 1433 |
+
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0));
|
| 1434 |
+
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0));
|
| 1435 |
+
}
|
| 1436 |
+
const { HEAPU8 } = getMemory(this);
|
| 1437 |
+
const resolvedOldPath = resolve(oldWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)));
|
| 1438 |
+
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
| 1439 |
+
const fs = getFs(this);
|
| 1440 |
+
fs.renameSync(resolvedOldPath, resolvedNewPath);
|
| 1441 |
+
return WasiErrno.ESUCCESS;
|
| 1442 |
+
}, async function path_rename(old_fd, old_path, old_path_len, new_fd, new_path, new_path_len) {
|
| 1443 |
+
old_path = Number(old_path);
|
| 1444 |
+
old_path_len = Number(old_path_len);
|
| 1445 |
+
new_path = Number(new_path);
|
| 1446 |
+
new_path_len = Number(new_path_len);
|
| 1447 |
+
if (old_path === 0 || new_path === 0) {
|
| 1448 |
+
return WasiErrno.EINVAL;
|
| 1449 |
+
}
|
| 1450 |
+
const wasi = _wasi.get(this);
|
| 1451 |
+
let oldWrap;
|
| 1452 |
+
let newWrap;
|
| 1453 |
+
if (old_fd === new_fd) {
|
| 1454 |
+
oldWrap = newWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE | WasiRights.PATH_RENAME_TARGET, BigInt(0));
|
| 1455 |
+
}
|
| 1456 |
+
else {
|
| 1457 |
+
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0));
|
| 1458 |
+
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0));
|
| 1459 |
+
}
|
| 1460 |
+
const { HEAPU8 } = getMemory(this);
|
| 1461 |
+
const resolvedOldPath = resolve(oldWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)));
|
| 1462 |
+
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
| 1463 |
+
const fs = getFs(this);
|
| 1464 |
+
await fs.promises.rename(resolvedOldPath, resolvedNewPath);
|
| 1465 |
+
return WasiErrno.ESUCCESS;
|
| 1466 |
+
}, ['i32', 'i32', 'i32', 'i32', 'i32', 'i32'], ['i32']);
|
| 1467 |
+
defineImport('path_symlink', function path_symlink(old_path, old_path_len, fd, new_path, new_path_len) {
|
| 1468 |
+
old_path = Number(old_path);
|
| 1469 |
+
old_path_len = Number(old_path_len);
|
| 1470 |
+
new_path = Number(new_path);
|
| 1471 |
+
new_path_len = Number(new_path_len);
|
| 1472 |
+
if (old_path === 0 || new_path === 0) {
|
| 1473 |
+
return WasiErrno.EINVAL;
|
| 1474 |
+
}
|
| 1475 |
+
const { HEAPU8 } = getMemory(this);
|
| 1476 |
+
const wasi = _wasi.get(this);
|
| 1477 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
|
| 1478 |
+
const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
|
| 1479 |
+
if (oldPath.length > 0 && oldPath[0] === '/') {
|
| 1480 |
+
return WasiErrno.EPERM;
|
| 1481 |
+
}
|
| 1482 |
+
let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len));
|
| 1483 |
+
newPath = resolve(fileDescriptor.realPath, newPath);
|
| 1484 |
+
const fs = getFs(this);
|
| 1485 |
+
fs.symlinkSync(oldPath, newPath);
|
| 1486 |
+
return WasiErrno.ESUCCESS;
|
| 1487 |
+
}, async function path_symlink(old_path, old_path_len, fd, new_path, new_path_len) {
|
| 1488 |
+
old_path = Number(old_path);
|
| 1489 |
+
old_path_len = Number(old_path_len);
|
| 1490 |
+
new_path = Number(new_path);
|
| 1491 |
+
new_path_len = Number(new_path_len);
|
| 1492 |
+
if (old_path === 0 || new_path === 0) {
|
| 1493 |
+
return WasiErrno.EINVAL;
|
| 1494 |
+
}
|
| 1495 |
+
const { HEAPU8 } = getMemory(this);
|
| 1496 |
+
const wasi = _wasi.get(this);
|
| 1497 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
|
| 1498 |
+
const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
|
| 1499 |
+
let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len));
|
| 1500 |
+
newPath = resolve(fileDescriptor.realPath, newPath);
|
| 1501 |
+
const fs = getFs(this);
|
| 1502 |
+
await fs.promises.symlink(oldPath, newPath);
|
| 1503 |
+
return WasiErrno.ESUCCESS;
|
| 1504 |
+
}, ['i32', 'i32', 'i32', 'i32', 'i32'], ['i32']);
|
| 1505 |
+
defineImport('path_unlink_file', function path_unlink_file(fd, path, path_len) {
|
| 1506 |
+
path = Number(path);
|
| 1507 |
+
path_len = Number(path_len);
|
| 1508 |
+
if (path === 0) {
|
| 1509 |
+
return WasiErrno.EINVAL;
|
| 1510 |
+
}
|
| 1511 |
+
const { HEAPU8 } = getMemory(this);
|
| 1512 |
+
const wasi = _wasi.get(this);
|
| 1513 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0));
|
| 1514 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1515 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1516 |
+
const fs = getFs(this);
|
| 1517 |
+
fs.unlinkSync(pathString);
|
| 1518 |
+
return WasiErrno.ESUCCESS;
|
| 1519 |
+
}, async function path_unlink_file(fd, path, path_len) {
|
| 1520 |
+
path = Number(path);
|
| 1521 |
+
path_len = Number(path_len);
|
| 1522 |
+
if (path === 0) {
|
| 1523 |
+
return WasiErrno.EINVAL;
|
| 1524 |
+
}
|
| 1525 |
+
const { HEAPU8 } = getMemory(this);
|
| 1526 |
+
const wasi = _wasi.get(this);
|
| 1527 |
+
const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0));
|
| 1528 |
+
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
| 1529 |
+
pathString = resolve(fileDescriptor.realPath, pathString);
|
| 1530 |
+
const fs = getFs(this);
|
| 1531 |
+
await fs.promises.unlink(pathString);
|
| 1532 |
+
return WasiErrno.ESUCCESS;
|
| 1533 |
+
}, ['i32', 'i32', 'i32'], ['i32']);
|
| 1534 |
+
this._setMemory = function setMemory(m) {
|
| 1535 |
+
if (!(m instanceof _WebAssembly.Memory)) {
|
| 1536 |
+
throw new TypeError('"instance.exports.memory" property must be a WebAssembly.Memory');
|
| 1537 |
+
}
|
| 1538 |
+
_memory.set(_this, extendMemory(m));
|
| 1539 |
+
};
|
| 1540 |
+
}
|
| 1541 |
+
static createSync(args, env, preopens, stdio, fs, print, printErr) {
|
| 1542 |
+
const fds = new SyncTable({
|
| 1543 |
+
size: 3,
|
| 1544 |
+
in: stdio[0],
|
| 1545 |
+
out: stdio[1],
|
| 1546 |
+
err: stdio[2],
|
| 1547 |
+
fs,
|
| 1548 |
+
print,
|
| 1549 |
+
printErr
|
| 1550 |
+
});
|
| 1551 |
+
const _this = new WASI(args, env, fds, false, fs);
|
| 1552 |
+
if (preopens.length > 0) {
|
| 1553 |
+
for (let i = 0; i < preopens.length; ++i) {
|
| 1554 |
+
const realPath = fs.realpathSync(preopens[i].realPath, 'utf8');
|
| 1555 |
+
const fd = fs.openSync(realPath, 'r', 0o666);
|
| 1556 |
+
fds.insertPreopen(fd, preopens[i].mappedPath, realPath);
|
| 1557 |
+
}
|
| 1558 |
+
}
|
| 1559 |
+
return _this;
|
| 1560 |
+
}
|
| 1561 |
+
static async createAsync(args, env, preopens, stdio, fs, print, printErr, asyncify) {
|
| 1562 |
+
const fds = new AsyncTable({
|
| 1563 |
+
size: 3,
|
| 1564 |
+
in: stdio[0],
|
| 1565 |
+
out: stdio[1],
|
| 1566 |
+
err: stdio[2],
|
| 1567 |
+
print,
|
| 1568 |
+
printErr
|
| 1569 |
+
});
|
| 1570 |
+
const _this = new WASI(args, env, fds, true, fs, asyncify);
|
| 1571 |
+
if (preopens.length > 0) {
|
| 1572 |
+
for (let i = 0; i < preopens.length; ++i) {
|
| 1573 |
+
const entry = preopens[i];
|
| 1574 |
+
const realPath = await fs.promises.realpath(entry.realPath);
|
| 1575 |
+
const fd = await fs.promises.open(realPath, 'r', 0o666);
|
| 1576 |
+
await fds.insertPreopen(fd, entry.mappedPath, realPath);
|
| 1577 |
+
}
|
| 1578 |
+
}
|
| 1579 |
+
return _this;
|
| 1580 |
+
}
|
| 1581 |
+
}
|
node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { WasiError } from "./error.mjs";
|
| 2 |
+
import { WasiErrno, WasiRights, WasiFileType } from "./types.mjs";
|
| 3 |
+
export const RIGHTS_ALL = WasiRights.FD_DATASYNC |
|
| 4 |
+
WasiRights.FD_READ |
|
| 5 |
+
WasiRights.FD_SEEK |
|
| 6 |
+
WasiRights.FD_FDSTAT_SET_FLAGS |
|
| 7 |
+
WasiRights.FD_SYNC |
|
| 8 |
+
WasiRights.FD_TELL |
|
| 9 |
+
WasiRights.FD_WRITE |
|
| 10 |
+
WasiRights.FD_ADVISE |
|
| 11 |
+
WasiRights.FD_ALLOCATE |
|
| 12 |
+
WasiRights.PATH_CREATE_DIRECTORY |
|
| 13 |
+
WasiRights.PATH_CREATE_FILE |
|
| 14 |
+
WasiRights.PATH_LINK_SOURCE |
|
| 15 |
+
WasiRights.PATH_LINK_TARGET |
|
| 16 |
+
WasiRights.PATH_OPEN |
|
| 17 |
+
WasiRights.FD_READDIR |
|
| 18 |
+
WasiRights.PATH_READLINK |
|
| 19 |
+
WasiRights.PATH_RENAME_SOURCE |
|
| 20 |
+
WasiRights.PATH_RENAME_TARGET |
|
| 21 |
+
WasiRights.PATH_FILESTAT_GET |
|
| 22 |
+
WasiRights.PATH_FILESTAT_SET_SIZE |
|
| 23 |
+
WasiRights.PATH_FILESTAT_SET_TIMES |
|
| 24 |
+
WasiRights.FD_FILESTAT_GET |
|
| 25 |
+
WasiRights.FD_FILESTAT_SET_TIMES |
|
| 26 |
+
WasiRights.FD_FILESTAT_SET_SIZE |
|
| 27 |
+
WasiRights.PATH_SYMLINK |
|
| 28 |
+
WasiRights.PATH_UNLINK_FILE |
|
| 29 |
+
WasiRights.PATH_REMOVE_DIRECTORY |
|
| 30 |
+
WasiRights.POLL_FD_READWRITE |
|
| 31 |
+
WasiRights.SOCK_SHUTDOWN |
|
| 32 |
+
WasiRights.SOCK_ACCEPT;
|
| 33 |
+
export const BLOCK_DEVICE_BASE = RIGHTS_ALL;
|
| 34 |
+
export const BLOCK_DEVICE_INHERITING = RIGHTS_ALL;
|
| 35 |
+
export const CHARACTER_DEVICE_BASE = RIGHTS_ALL;
|
| 36 |
+
export const CHARACTER_DEVICE_INHERITING = RIGHTS_ALL;
|
| 37 |
+
export const REGULAR_FILE_BASE = WasiRights.FD_DATASYNC |
|
| 38 |
+
WasiRights.FD_READ |
|
| 39 |
+
WasiRights.FD_SEEK |
|
| 40 |
+
WasiRights.FD_FDSTAT_SET_FLAGS |
|
| 41 |
+
WasiRights.FD_SYNC |
|
| 42 |
+
WasiRights.FD_TELL |
|
| 43 |
+
WasiRights.FD_WRITE |
|
| 44 |
+
WasiRights.FD_ADVISE |
|
| 45 |
+
WasiRights.FD_ALLOCATE |
|
| 46 |
+
WasiRights.FD_FILESTAT_GET |
|
| 47 |
+
WasiRights.FD_FILESTAT_SET_SIZE |
|
| 48 |
+
WasiRights.FD_FILESTAT_SET_TIMES |
|
| 49 |
+
WasiRights.POLL_FD_READWRITE;
|
| 50 |
+
export const REGULAR_FILE_INHERITING = /*#__PURE__*/ BigInt(0);
|
| 51 |
+
export const DIRECTORY_BASE = WasiRights.FD_FDSTAT_SET_FLAGS |
|
| 52 |
+
WasiRights.FD_SYNC |
|
| 53 |
+
WasiRights.FD_ADVISE |
|
| 54 |
+
WasiRights.PATH_CREATE_DIRECTORY |
|
| 55 |
+
WasiRights.PATH_CREATE_FILE |
|
| 56 |
+
WasiRights.PATH_LINK_SOURCE |
|
| 57 |
+
WasiRights.PATH_LINK_TARGET |
|
| 58 |
+
WasiRights.PATH_OPEN |
|
| 59 |
+
WasiRights.FD_READDIR |
|
| 60 |
+
WasiRights.PATH_READLINK |
|
| 61 |
+
WasiRights.PATH_RENAME_SOURCE |
|
| 62 |
+
WasiRights.PATH_RENAME_TARGET |
|
| 63 |
+
WasiRights.PATH_FILESTAT_GET |
|
| 64 |
+
WasiRights.PATH_FILESTAT_SET_SIZE |
|
| 65 |
+
WasiRights.PATH_FILESTAT_SET_TIMES |
|
| 66 |
+
WasiRights.FD_FILESTAT_GET |
|
| 67 |
+
WasiRights.FD_FILESTAT_SET_TIMES |
|
| 68 |
+
WasiRights.PATH_SYMLINK |
|
| 69 |
+
WasiRights.PATH_UNLINK_FILE |
|
| 70 |
+
WasiRights.PATH_REMOVE_DIRECTORY |
|
| 71 |
+
WasiRights.POLL_FD_READWRITE;
|
| 72 |
+
export const DIRECTORY_INHERITING = DIRECTORY_BASE | REGULAR_FILE_BASE;
|
| 73 |
+
export const SOCKET_BASE = (WasiRights.FD_READ |
|
| 74 |
+
WasiRights.FD_FDSTAT_SET_FLAGS |
|
| 75 |
+
WasiRights.FD_WRITE |
|
| 76 |
+
WasiRights.FD_FILESTAT_GET |
|
| 77 |
+
WasiRights.POLL_FD_READWRITE |
|
| 78 |
+
WasiRights.SOCK_SHUTDOWN);
|
| 79 |
+
export const SOCKET_INHERITING = RIGHTS_ALL;
|
| 80 |
+
export const TTY_BASE = WasiRights.FD_READ |
|
| 81 |
+
WasiRights.FD_FDSTAT_SET_FLAGS |
|
| 82 |
+
WasiRights.FD_WRITE |
|
| 83 |
+
WasiRights.FD_FILESTAT_GET |
|
| 84 |
+
WasiRights.POLL_FD_READWRITE;
|
| 85 |
+
export const TTY_INHERITING = /*#__PURE__*/ BigInt(0);
|
| 86 |
+
export function getRights(stdio, fd, flags, type) {
|
| 87 |
+
const ret = {
|
| 88 |
+
base: BigInt(0),
|
| 89 |
+
inheriting: BigInt(0)
|
| 90 |
+
};
|
| 91 |
+
if (type === WasiFileType.UNKNOWN) {
|
| 92 |
+
throw new WasiError('Unknown file type', WasiErrno.EINVAL);
|
| 93 |
+
}
|
| 94 |
+
switch (type) {
|
| 95 |
+
case WasiFileType.REGULAR_FILE:
|
| 96 |
+
ret.base = REGULAR_FILE_BASE;
|
| 97 |
+
ret.inheriting = REGULAR_FILE_INHERITING;
|
| 98 |
+
break;
|
| 99 |
+
case WasiFileType.DIRECTORY:
|
| 100 |
+
ret.base = DIRECTORY_BASE;
|
| 101 |
+
ret.inheriting = DIRECTORY_INHERITING;
|
| 102 |
+
break;
|
| 103 |
+
case WasiFileType.SOCKET_STREAM:
|
| 104 |
+
case WasiFileType.SOCKET_DGRAM:
|
| 105 |
+
ret.base = SOCKET_BASE;
|
| 106 |
+
ret.inheriting = SOCKET_INHERITING;
|
| 107 |
+
break;
|
| 108 |
+
case WasiFileType.CHARACTER_DEVICE:
|
| 109 |
+
if (stdio.indexOf(fd) !== -1) {
|
| 110 |
+
ret.base = TTY_BASE;
|
| 111 |
+
ret.inheriting = TTY_INHERITING;
|
| 112 |
+
}
|
| 113 |
+
else {
|
| 114 |
+
ret.base = CHARACTER_DEVICE_BASE;
|
| 115 |
+
ret.inheriting = CHARACTER_DEVICE_INHERITING;
|
| 116 |
+
}
|
| 117 |
+
break;
|
| 118 |
+
case WasiFileType.BLOCK_DEVICE:
|
| 119 |
+
ret.base = BLOCK_DEVICE_BASE;
|
| 120 |
+
ret.inheriting = BLOCK_DEVICE_INHERITING;
|
| 121 |
+
break;
|
| 122 |
+
default:
|
| 123 |
+
ret.base = BigInt(0);
|
| 124 |
+
ret.inheriting = BigInt(0);
|
| 125 |
+
}
|
| 126 |
+
/* Disable read/write bits depending on access mode. */
|
| 127 |
+
const read_or_write_only = flags & (0 | 1 | 2);
|
| 128 |
+
if (read_or_write_only === 0) {
|
| 129 |
+
ret.base &= ~WasiRights.FD_WRITE;
|
| 130 |
+
}
|
| 131 |
+
else if (read_or_write_only === 1) {
|
| 132 |
+
ret.base &= ~WasiRights.FD_READ;
|
| 133 |
+
}
|
| 134 |
+
return ret;
|
| 135 |
+
}
|
node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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DRINUSE";
|
| 8 |
+
WasiErrno[WasiErrno["EADDRNOTAVAIL"] = 4] = "EADDRNOTAVAIL";
|
| 9 |
+
WasiErrno[WasiErrno["EAFNOSUPPORT"] = 5] = "EAFNOSUPPORT";
|
| 10 |
+
WasiErrno[WasiErrno["EAGAIN"] = 6] = "EAGAIN";
|
| 11 |
+
WasiErrno[WasiErrno["EALREADY"] = 7] = "EALREADY";
|
| 12 |
+
WasiErrno[WasiErrno["EBADF"] = 8] = "EBADF";
|
| 13 |
+
WasiErrno[WasiErrno["EBADMSG"] = 9] = "EBADMSG";
|
| 14 |
+
WasiErrno[WasiErrno["EBUSY"] = 10] = "EBUSY";
|
| 15 |
+
WasiErrno[WasiErrno["ECANCELED"] = 11] = "ECANCELED";
|
| 16 |
+
WasiErrno[WasiErrno["ECHILD"] = 12] = "ECHILD";
|
| 17 |
+
WasiErrno[WasiErrno["ECONNABORTED"] = 13] = "ECONNABORTED";
|
| 18 |
+
WasiErrno[WasiErrno["ECONNREFUSED"] = 14] = "ECONNREFUSED";
|
| 19 |
+
WasiErrno[WasiErrno["ECONNRESET"] = 15] = "ECONNRESET";
|
| 20 |
+
WasiErrno[WasiErrno["EDEADLK"] = 16] = "EDEADLK";
|
| 21 |
+
WasiErrno[WasiErrno["EDESTADDRREQ"] = 17] = "EDESTADDRREQ";
|
| 22 |
+
WasiErrno[WasiErrno["EDOM"] = 18] = "EDOM";
|
| 23 |
+
WasiErrno[WasiErrno["EDQUOT"] = 19] = "EDQUOT";
|
| 24 |
+
WasiErrno[WasiErrno["EEXIST"] = 20] = "EEXIST";
|
| 25 |
+
WasiErrno[WasiErrno["EFAULT"] = 21] = "EFAULT";
|
| 26 |
+
WasiErrno[WasiErrno["EFBIG"] = 22] = "EFBIG";
|
| 27 |
+
WasiErrno[WasiErrno["EHOSTUNREACH"] = 23] = "EHOSTUNREACH";
|
| 28 |
+
WasiErrno[WasiErrno["EIDRM"] = 24] = "EIDRM";
|
| 29 |
+
WasiErrno[WasiErrno["EILSEQ"] = 25] = "EILSEQ";
|
| 30 |
+
WasiErrno[WasiErrno["EINPROGRESS"] = 26] = "EINPROGRESS";
|
| 31 |
+
WasiErrno[WasiErrno["EINTR"] = 27] = "EINTR";
|
| 32 |
+
WasiErrno[WasiErrno["EINVAL"] = 28] = "EINVAL";
|
| 33 |
+
WasiErrno[WasiErrno["EIO"] = 29] = "EIO";
|
| 34 |
+
WasiErrno[WasiErrno["EISCONN"] = 30] = "EISCONN";
|
| 35 |
+
WasiErrno[WasiErrno["EISDIR"] = 31] = "EISDIR";
|
| 36 |
+
WasiErrno[WasiErrno["ELOOP"] = 32] = "ELOOP";
|
| 37 |
+
WasiErrno[WasiErrno["EMFILE"] = 33] = "EMFILE";
|
| 38 |
+
WasiErrno[WasiErrno["EMLINK"] = 34] = "EMLINK";
|
| 39 |
+
WasiErrno[WasiErrno["EMSGSIZE"] = 35] = "EMSGSIZE";
|
| 40 |
+
WasiErrno[WasiErrno["EMULTIHOP"] = 36] = "EMULTIHOP";
|
| 41 |
+
WasiErrno[WasiErrno["ENAMETOOLONG"] = 37] = "ENAMETOOLONG";
|
| 42 |
+
WasiErrno[WasiErrno["ENETDOWN"] = 38] = "ENETDOWN";
|
| 43 |
+
WasiErrno[WasiErrno["ENETRESET"] = 39] = "ENETRESET";
|
| 44 |
+
WasiErrno[WasiErrno["ENETUNREACH"] = 40] = "ENETUNREACH";
|
| 45 |
+
WasiErrno[WasiErrno["ENFILE"] = 41] = "ENFILE";
|
| 46 |
+
WasiErrno[WasiErrno["ENOBUFS"] = 42] = "ENOBUFS";
|
| 47 |
+
WasiErrno[WasiErrno["ENODEV"] = 43] = "ENODEV";
|
| 48 |
+
WasiErrno[WasiErrno["ENOENT"] = 44] = "ENOENT";
|
| 49 |
+
WasiErrno[WasiErrno["ENOEXEC"] = 45] = "ENOEXEC";
|
| 50 |
+
WasiErrno[WasiErrno["ENOLCK"] = 46] = "ENOLCK";
|
| 51 |
+
WasiErrno[WasiErrno["ENOLINK"] = 47] = "ENOLINK";
|
| 52 |
+
WasiErrno[WasiErrno["ENOMEM"] = 48] = "ENOMEM";
|
| 53 |
+
WasiErrno[WasiErrno["ENOMSG"] = 49] = "ENOMSG";
|
| 54 |
+
WasiErrno[WasiErrno["ENOPROTOOPT"] = 50] = "ENOPROTOOPT";
|
| 55 |
+
WasiErrno[WasiErrno["ENOSPC"] = 51] = "ENOSPC";
|
| 56 |
+
WasiErrno[WasiErrno["ENOSYS"] = 52] = "ENOSYS";
|
| 57 |
+
WasiErrno[WasiErrno["ENOTCONN"] = 53] = "ENOTCONN";
|
| 58 |
+
WasiErrno[WasiErrno["ENOTDIR"] = 54] = "ENOTDIR";
|
| 59 |
+
WasiErrno[WasiErrno["ENOTEMPTY"] = 55] = "ENOTEMPTY";
|
| 60 |
+
WasiErrno[WasiErrno["ENOTRECOVERABLE"] = 56] = "ENOTRECOVERABLE";
|
| 61 |
+
WasiErrno[WasiErrno["ENOTSOCK"] = 57] = "ENOTSOCK";
|
| 62 |
+
WasiErrno[WasiErrno["ENOTSUP"] = 58] = "ENOTSUP";
|
| 63 |
+
WasiErrno[WasiErrno["ENOTTY"] = 59] = "ENOTTY";
|
| 64 |
+
WasiErrno[WasiErrno["ENXIO"] = 60] = "ENXIO";
|
| 65 |
+
WasiErrno[WasiErrno["EOVERFLOW"] = 61] = "EOVERFLOW";
|
| 66 |
+
WasiErrno[WasiErrno["EOWNERDEAD"] = 62] = "EOWNERDEAD";
|
| 67 |
+
WasiErrno[WasiErrno["EPERM"] = 63] = "EPERM";
|
| 68 |
+
WasiErrno[WasiErrno["EPIPE"] = 64] = "EPIPE";
|
| 69 |
+
WasiErrno[WasiErrno["EPROTO"] = 65] = "EPROTO";
|
| 70 |
+
WasiErrno[WasiErrno["EPROTONOSUPPORT"] = 66] = "EPROTONOSUPPORT";
|
| 71 |
+
WasiErrno[WasiErrno["EPROTOTYPE"] = 67] = "EPROTOTYPE";
|
| 72 |
+
WasiErrno[WasiErrno["ERANGE"] = 68] = "ERANGE";
|
| 73 |
+
WasiErrno[WasiErrno["EROFS"] = 69] = "EROFS";
|
| 74 |
+
WasiErrno[WasiErrno["ESPIPE"] = 70] = "ESPIPE";
|
| 75 |
+
WasiErrno[WasiErrno["ESRCH"] = 71] = "ESRCH";
|
| 76 |
+
WasiErrno[WasiErrno["ESTALE"] = 72] = "ESTALE";
|
| 77 |
+
WasiErrno[WasiErrno["ETIMEDOUT"] = 73] = "ETIMEDOUT";
|
| 78 |
+
WasiErrno[WasiErrno["ETXTBSY"] = 74] = "ETXTBSY";
|
| 79 |
+
WasiErrno[WasiErrno["EXDEV"] = 75] = "EXDEV";
|
| 80 |
+
WasiErrno[WasiErrno["ENOTCAPABLE"] = 76] = "ENOTCAPABLE";
|
| 81 |
+
})(WasiErrno || (WasiErrno = {}));
|
| 82 |
+
export var WasiFileType;
|
| 83 |
+
(function (WasiFileType) {
|
| 84 |
+
WasiFileType[WasiFileType["UNKNOWN"] = 0] = "UNKNOWN";
|
| 85 |
+
WasiFileType[WasiFileType["BLOCK_DEVICE"] = 1] = "BLOCK_DEVICE";
|
| 86 |
+
WasiFileType[WasiFileType["CHARACTER_DEVICE"] = 2] = "CHARACTER_DEVICE";
|
| 87 |
+
WasiFileType[WasiFileType["DIRECTORY"] = 3] = "DIRECTORY";
|
| 88 |
+
WasiFileType[WasiFileType["REGULAR_FILE"] = 4] = "REGULAR_FILE";
|
| 89 |
+
WasiFileType[WasiFileType["SOCKET_DGRAM"] = 5] = "SOCKET_DGRAM";
|
| 90 |
+
WasiFileType[WasiFileType["SOCKET_STREAM"] = 6] = "SOCKET_STREAM";
|
| 91 |
+
WasiFileType[WasiFileType["SYMBOLIC_LINK"] = 7] = "SYMBOLIC_LINK";
|
| 92 |
+
})(WasiFileType || (WasiFileType = {}));
|
| 93 |
+
const FD_DATASYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(0));
|
| 94 |
+
const FD_READ = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(1));
|
| 95 |
+
const FD_SEEK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(2));
|
| 96 |
+
const FD_FDSTAT_SET_FLAGS = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(3));
|
| 97 |
+
const FD_SYNC = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(4));
|
| 98 |
+
const FD_TELL = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(5));
|
| 99 |
+
const FD_WRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(6));
|
| 100 |
+
const FD_ADVISE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(7));
|
| 101 |
+
const FD_ALLOCATE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(8));
|
| 102 |
+
const PATH_CREATE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(9));
|
| 103 |
+
const PATH_CREATE_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(10));
|
| 104 |
+
const PATH_LINK_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(11));
|
| 105 |
+
const PATH_LINK_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(12));
|
| 106 |
+
const PATH_OPEN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(13));
|
| 107 |
+
const FD_READDIR = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(14));
|
| 108 |
+
const PATH_READLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(15));
|
| 109 |
+
const PATH_RENAME_SOURCE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(16));
|
| 110 |
+
const PATH_RENAME_TARGET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(17));
|
| 111 |
+
const PATH_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(18));
|
| 112 |
+
const PATH_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(19));
|
| 113 |
+
const PATH_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(20));
|
| 114 |
+
const FD_FILESTAT_GET = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(21));
|
| 115 |
+
const FD_FILESTAT_SET_SIZE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(22));
|
| 116 |
+
const FD_FILESTAT_SET_TIMES = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(23));
|
| 117 |
+
const PATH_SYMLINK = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(24));
|
| 118 |
+
const PATH_REMOVE_DIRECTORY = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(25));
|
| 119 |
+
const PATH_UNLINK_FILE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(26));
|
| 120 |
+
const POLL_FD_READWRITE = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(27));
|
| 121 |
+
const SOCK_SHUTDOWN = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(28));
|
| 122 |
+
const SOCK_ACCEPT = ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/ BigInt(29));
|
| 123 |
+
export const WasiRights = {
|
| 124 |
+
FD_DATASYNC,
|
| 125 |
+
FD_READ,
|
| 126 |
+
FD_SEEK,
|
| 127 |
+
FD_FDSTAT_SET_FLAGS,
|
| 128 |
+
FD_SYNC,
|
| 129 |
+
FD_TELL,
|
| 130 |
+
FD_WRITE,
|
| 131 |
+
FD_ADVISE,
|
| 132 |
+
FD_ALLOCATE,
|
| 133 |
+
PATH_CREATE_DIRECTORY,
|
| 134 |
+
PATH_CREATE_FILE,
|
| 135 |
+
PATH_LINK_SOURCE,
|
| 136 |
+
PATH_LINK_TARGET,
|
| 137 |
+
PATH_OPEN,
|
| 138 |
+
FD_READDIR,
|
| 139 |
+
PATH_READLINK,
|
| 140 |
+
PATH_RENAME_SOURCE,
|
| 141 |
+
PATH_RENAME_TARGET,
|
| 142 |
+
PATH_FILESTAT_GET,
|
| 143 |
+
PATH_FILESTAT_SET_SIZE,
|
| 144 |
+
PATH_FILESTAT_SET_TIMES,
|
| 145 |
+
FD_FILESTAT_GET,
|
| 146 |
+
FD_FILESTAT_SET_SIZE,
|
| 147 |
+
FD_FILESTAT_SET_TIMES,
|
| 148 |
+
PATH_SYMLINK,
|
| 149 |
+
PATH_REMOVE_DIRECTORY,
|
| 150 |
+
PATH_UNLINK_FILE,
|
| 151 |
+
POLL_FD_READWRITE,
|
| 152 |
+
SOCK_SHUTDOWN,
|
| 153 |
+
SOCK_ACCEPT
|
| 154 |
+
};
|
| 155 |
+
export var WasiWhence;
|
| 156 |
+
(function (WasiWhence) {
|
| 157 |
+
WasiWhence[WasiWhence["SET"] = 0] = "SET";
|
| 158 |
+
WasiWhence[WasiWhence["CUR"] = 1] = "CUR";
|
| 159 |
+
WasiWhence[WasiWhence["END"] = 2] = "END";
|
| 160 |
+
})(WasiWhence || (WasiWhence = {}));
|
| 161 |
+
export var FileControlFlag;
|
| 162 |
+
(function (FileControlFlag) {
|
| 163 |
+
FileControlFlag[FileControlFlag["O_RDONLY"] = 0] = "O_RDONLY";
|
| 164 |
+
FileControlFlag[FileControlFlag["O_WRONLY"] = 1] = "O_WRONLY";
|
| 165 |
+
FileControlFlag[FileControlFlag["O_RDWR"] = 2] = "O_RDWR";
|
| 166 |
+
FileControlFlag[FileControlFlag["O_CREAT"] = 64] = "O_CREAT";
|
| 167 |
+
FileControlFlag[FileControlFlag["O_EXCL"] = 128] = "O_EXCL";
|
| 168 |
+
FileControlFlag[FileControlFlag["O_NOCTTY"] = 256] = "O_NOCTTY";
|
| 169 |
+
FileControlFlag[FileControlFlag["O_TRUNC"] = 512] = "O_TRUNC";
|
| 170 |
+
FileControlFlag[FileControlFlag["O_APPEND"] = 1024] = "O_APPEND";
|
| 171 |
+
FileControlFlag[FileControlFlag["O_DIRECTORY"] = 65536] = "O_DIRECTORY";
|
| 172 |
+
FileControlFlag[FileControlFlag["O_NOATIME"] = 262144] = "O_NOATIME";
|
| 173 |
+
FileControlFlag[FileControlFlag["O_NOFOLLOW"] = 131072] = "O_NOFOLLOW";
|
| 174 |
+
FileControlFlag[FileControlFlag["O_SYNC"] = 1052672] = "O_SYNC";
|
| 175 |
+
FileControlFlag[FileControlFlag["O_DIRECT"] = 16384] = "O_DIRECT";
|
| 176 |
+
FileControlFlag[FileControlFlag["O_NONBLOCK"] = 2048] = "O_NONBLOCK";
|
| 177 |
+
})(FileControlFlag || (FileControlFlag = {}));
|
| 178 |
+
export var WasiFileControlFlag;
|
| 179 |
+
(function (WasiFileControlFlag) {
|
| 180 |
+
WasiFileControlFlag[WasiFileControlFlag["O_CREAT"] = 1] = "O_CREAT";
|
| 181 |
+
WasiFileControlFlag[WasiFileControlFlag["O_DIRECTORY"] = 2] = "O_DIRECTORY";
|
| 182 |
+
WasiFileControlFlag[WasiFileControlFlag["O_EXCL"] = 4] = "O_EXCL";
|
| 183 |
+
WasiFileControlFlag[WasiFileControlFlag["O_TRUNC"] = 8] = "O_TRUNC";
|
| 184 |
+
})(WasiFileControlFlag || (WasiFileControlFlag = {}));
|
| 185 |
+
export var WasiFdFlag;
|
| 186 |
+
(function (WasiFdFlag) {
|
| 187 |
+
WasiFdFlag[WasiFdFlag["APPEND"] = 1] = "APPEND";
|
| 188 |
+
WasiFdFlag[WasiFdFlag["DSYNC"] = 2] = "DSYNC";
|
| 189 |
+
WasiFdFlag[WasiFdFlag["NONBLOCK"] = 4] = "NONBLOCK";
|
| 190 |
+
WasiFdFlag[WasiFdFlag["RSYNC"] = 8] = "RSYNC";
|
| 191 |
+
WasiFdFlag[WasiFdFlag["SYNC"] = 16] = "SYNC";
|
| 192 |
+
})(WasiFdFlag || (WasiFdFlag = {}));
|
| 193 |
+
export var WasiClockid;
|
| 194 |
+
(function (WasiClockid) {
|
| 195 |
+
WasiClockid[WasiClockid["REALTIME"] = 0] = "REALTIME";
|
| 196 |
+
WasiClockid[WasiClockid["MONOTONIC"] = 1] = "MONOTONIC";
|
| 197 |
+
WasiClockid[WasiClockid["PROCESS_CPUTIME_ID"] = 2] = "PROCESS_CPUTIME_ID";
|
| 198 |
+
WasiClockid[WasiClockid["THREAD_CPUTIME_ID"] = 3] = "THREAD_CPUTIME_ID";
|
| 199 |
+
})(WasiClockid || (WasiClockid = {}));
|
| 200 |
+
export var WasiFstFlag;
|
| 201 |
+
(function (WasiFstFlag) {
|
| 202 |
+
WasiFstFlag[WasiFstFlag["SET_ATIM"] = 1] = "SET_ATIM";
|
| 203 |
+
WasiFstFlag[WasiFstFlag["SET_ATIM_NOW"] = 2] = "SET_ATIM_NOW";
|
| 204 |
+
WasiFstFlag[WasiFstFlag["SET_MTIM"] = 4] = "SET_MTIM";
|
| 205 |
+
WasiFstFlag[WasiFstFlag["SET_MTIM_NOW"] = 8] = "SET_MTIM_NOW";
|
| 206 |
+
})(WasiFstFlag || (WasiFstFlag = {}));
|
| 207 |
+
export var WasiEventType;
|
| 208 |
+
(function (WasiEventType) {
|
| 209 |
+
WasiEventType[WasiEventType["CLOCK"] = 0] = "CLOCK";
|
| 210 |
+
WasiEventType[WasiEventType["FD_READ"] = 1] = "FD_READ";
|
| 211 |
+
WasiEventType[WasiEventType["FD_WRITE"] = 2] = "FD_WRITE";
|
| 212 |
+
})(WasiEventType || (WasiEventType = {}));
|
| 213 |
+
export var WasiSubclockflags;
|
| 214 |
+
(function (WasiSubclockflags) {
|
| 215 |
+
WasiSubclockflags[WasiSubclockflags["ABSTIME"] = 1] = "ABSTIME";
|
| 216 |
+
})(WasiSubclockflags || (WasiSubclockflags = {}));
|
node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* eslint-disable spaced-comment */
|
| 2 |
+
export function validateObject(value, name) {
|
| 3 |
+
if (value === null || typeof value !== 'object') {
|
| 4 |
+
throw new TypeError(`${name} must be an object. Received ${value === null ? 'null' : typeof value}`);
|
| 5 |
+
}
|
| 6 |
+
}
|
| 7 |
+
export function validateArray(value, name) {
|
| 8 |
+
if (!Array.isArray(value)) {
|
| 9 |
+
throw new TypeError(`${name} must be an array. Received ${value === null ? 'null' : typeof value}`);
|
| 10 |
+
}
|
| 11 |
+
}
|
| 12 |
+
export function validateBoolean(value, name) {
|
| 13 |
+
if (typeof value !== 'boolean') {
|
| 14 |
+
throw new TypeError(`${name} must be a boolean. Received ${value === null ? 'null' : typeof value}`);
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
export function validateString(value, name) {
|
| 18 |
+
if (typeof value !== 'string') {
|
| 19 |
+
throw new TypeError(`${name} must be a string. Received ${value === null ? 'null' : typeof value}`);
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
export function validateFunction(value, name) {
|
| 23 |
+
if (typeof value !== 'function') {
|
| 24 |
+
throw new TypeError(`${name} must be a function. Received ${value === null ? 'null' : typeof value}`);
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
export function validateUndefined(value, name) {
|
| 28 |
+
if (value !== undefined) {
|
| 29 |
+
throw new TypeError(`${name} must be undefined. Received ${value === null ? 'null' : typeof value}`);
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
export function validateInt32(value, name, min = -2147483648, max = 2147483647) {
|
| 33 |
+
if (typeof value !== 'number') {
|
| 34 |
+
throw new TypeError(`${name} must be a number. Received ${value === null ? 'null' : typeof value}`);
|
| 35 |
+
}
|
| 36 |
+
if (!Number.isInteger(value)) {
|
| 37 |
+
throw new RangeError(`${name} must be a integer.`);
|
| 38 |
+
}
|
| 39 |
+
if (value < min || value > max) {
|
| 40 |
+
throw new RangeError(`${name} must be >= ${min} && <= ${max}. Received ${value}`);
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
export function isPromiseLike(obj) {
|
| 44 |
+
return !!(obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function');
|
| 45 |
+
}
|
| 46 |
+
export function wrapInstanceExports(exports, mapFn) {
|
| 47 |
+
const newExports = Object.create(null);
|
| 48 |
+
Object.keys(exports).forEach(name => {
|
| 49 |
+
const exportValue = exports[name];
|
| 50 |
+
Object.defineProperty(newExports, name, {
|
| 51 |
+
enumerable: true,
|
| 52 |
+
value: mapFn(exportValue, name)
|
| 53 |
+
});
|
| 54 |
+
});
|
| 55 |
+
return newExports;
|
| 56 |
+
}
|
| 57 |
+
const _require = /*#__PURE__*/ (function () {
|
| 58 |
+
let nativeRequire;
|
| 59 |
+
if (typeof __webpack_public_path__ !== 'undefined') {
|
| 60 |
+
nativeRequire = (function () {
|
| 61 |
+
return typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined;
|
| 62 |
+
})();
|
| 63 |
+
}
|
| 64 |
+
else {
|
| 65 |
+
nativeRequire = (function () {
|
| 66 |
+
return typeof __webpack_public_path__ !== 'undefined' ? (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : undefined) : (typeof require !== 'undefined' ? require : undefined);
|
| 67 |
+
})();
|
| 68 |
+
}
|
| 69 |
+
return nativeRequire;
|
| 70 |
+
})();
|
| 71 |
+
export const isMainThread = /*#__PURE__*/ (function () {
|
| 72 |
+
let worker_threads;
|
| 73 |
+
try {
|
| 74 |
+
worker_threads = _require('worker_threads');
|
| 75 |
+
}
|
| 76 |
+
catch (_) { }
|
| 77 |
+
if (!worker_threads) {
|
| 78 |
+
return typeof importScripts === 'undefined';
|
| 79 |
+
}
|
| 80 |
+
return worker_threads.isMainThread;
|
| 81 |
+
})();
|
| 82 |
+
export const postMsg = isMainThread
|
| 83 |
+
? () => { }
|
| 84 |
+
: /*#__PURE__*/ (function () {
|
| 85 |
+
let worker_threads;
|
| 86 |
+
try {
|
| 87 |
+
worker_threads = _require('worker_threads');
|
| 88 |
+
}
|
| 89 |
+
catch (_) { }
|
| 90 |
+
if (!worker_threads) {
|
| 91 |
+
return postMessage;
|
| 92 |
+
}
|
| 93 |
+
return function postMessage(data) {
|
| 94 |
+
worker_threads.parentPort.postMessage({ data });
|
| 95 |
+
};
|
| 96 |
+
})();
|
| 97 |
+
export function sleepBreakIf(delay, breakIf) {
|
| 98 |
+
const start = Date.now();
|
| 99 |
+
const end = start + delay;
|
| 100 |
+
let ret = false;
|
| 101 |
+
while (Date.now() < end) {
|
| 102 |
+
if (breakIf()) {
|
| 103 |
+
ret = true;
|
| 104 |
+
break;
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
return ret;
|
| 108 |
+
}
|
| 109 |
+
export function unsharedSlice(view, start, end) {
|
| 110 |
+
return ((typeof SharedArrayBuffer === 'function' && view.buffer instanceof SharedArrayBuffer) || (Object.prototype.toString.call(view.buffer.constructor) === '[object SharedArrayBuffer]'))
|
| 111 |
+
? view.slice(start, end)
|
| 112 |
+
: view.subarray(start, end);
|
| 113 |
+
}
|
node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const _WebAssembly = typeof WebAssembly !== 'undefined'
|
| 2 |
+
? WebAssembly
|
| 3 |
+
: typeof WXWebAssembly !== 'undefined'
|
| 4 |
+
? WXWebAssembly
|
| 5 |
+
: undefined;
|
| 6 |
+
if (!_WebAssembly) {
|
| 7 |
+
throw new Error('WebAssembly is not supported in this environment');
|
| 8 |
+
}
|
| 9 |
+
export { _WebAssembly };
|
node_modules/@tybys/wasm-util/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@tybys/wasm-util",
|
| 3 |
+
"version": "0.10.2",
|
| 4 |
+
"description": "WASI polyfill for browser and some wasm util",
|
| 5 |
+
"main": "./lib/cjs/index.js",
|
| 6 |
+
"module": "./dist/wasm-util.esm-bundler.js",
|
| 7 |
+
"types": "./dist/wasm-util.d.ts",
|
| 8 |
+
"exports": {
|
| 9 |
+
".": {
|
| 10 |
+
"module": "./dist/wasm-util.esm-bundler.js",
|
| 11 |
+
"import": "./lib/mjs/index.mjs",
|
| 12 |
+
"require": "./lib/cjs/index.js",
|
| 13 |
+
"types": "./dist/wasm-util.d.ts"
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"scripts": {
|
| 17 |
+
"build": "tsgo build",
|
| 18 |
+
"watch": "tsgo watch",
|
| 19 |
+
"test": "jest",
|
| 20 |
+
"lint": "eslint ./src/**/*.{ts,js} --fix",
|
| 21 |
+
"prepare": "npm run build"
|
| 22 |
+
},
|
| 23 |
+
"publishConfig": {
|
| 24 |
+
"access": "public"
|
| 25 |
+
},
|
| 26 |
+
"keywords": [
|
| 27 |
+
"wasm",
|
| 28 |
+
"webassembly",
|
| 29 |
+
"wasi",
|
| 30 |
+
"polyfill"
|
| 31 |
+
],
|
| 32 |
+
"repository": {
|
| 33 |
+
"type": "git",
|
| 34 |
+
"url": "https://github.com/toyobayashi/wasm-util.git"
|
| 35 |
+
},
|
| 36 |
+
"author": "toyobayashi",
|
| 37 |
+
"license": "MIT",
|
| 38 |
+
"dependencies": {
|
| 39 |
+
"tslib": "^2.4.0"
|
| 40 |
+
},
|
| 41 |
+
"devDependencies": {
|
| 42 |
+
"@tybys/ts-transform-module-specifier": "^0.0.2",
|
| 43 |
+
"@tybys/ts-transform-pure-class": "^0.1.1",
|
| 44 |
+
"@tybys/tsgo": "^1.1.0",
|
| 45 |
+
"@types/node": "^14.14.31",
|
| 46 |
+
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
| 47 |
+
"@typescript-eslint/parser": "^5.40.1",
|
| 48 |
+
"eslint": "^8.25.0",
|
| 49 |
+
"eslint-config-standard-with-typescript": "^23.0.0",
|
| 50 |
+
"eslint-plugin-import": "^2.26.0",
|
| 51 |
+
"eslint-plugin-n": "^15.3.0",
|
| 52 |
+
"eslint-plugin-promise": "^6.1.0",
|
| 53 |
+
"memfs-browser": "^3.4.13000",
|
| 54 |
+
"mocha": "^10.1.0",
|
| 55 |
+
"ts-node": "^10.9.1",
|
| 56 |
+
"typescript": "~4.8.3"
|
| 57 |
+
}
|
| 58 |
+
}
|
node_modules/@types/archiver/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/archiver/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/archiver`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for archiver (https://github.com/archiverjs/node-archiver).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/archiver.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Mon, 27 Oct 2025 19:02:12 GMT
|
| 12 |
+
* Dependencies: [@types/readdir-glob](https://npmjs.com/package/@types/readdir-glob)
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [ Esri
|
| 16 |
+
// Dolan Miu](https://github.com/dolanmiu), [Crevil](https://github.com/crevil), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
node_modules/@types/archiver/index.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as fs from "fs";
|
| 2 |
+
import ReaddirGlob = require("readdir-glob");
|
| 3 |
+
import stream = require("stream");
|
| 4 |
+
import { ZlibOptions } from "zlib";
|
| 5 |
+
|
| 6 |
+
type Partial<T> = {
|
| 7 |
+
[P in keyof T]?: T[P];
|
| 8 |
+
};
|
| 9 |
+
|
| 10 |
+
// This library adds `cwd` to the options
|
| 11 |
+
type GlobOptions = ReaddirGlob.Options & { cwd?: string };
|
| 12 |
+
|
| 13 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- support for ConstructorFn function and classes
|
| 14 |
+
type ConstructorFn<T> = Function | (new(...params: any[]) => T);
|
| 15 |
+
|
| 16 |
+
declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver;
|
| 17 |
+
|
| 18 |
+
declare namespace archiver {
|
| 19 |
+
type Format = "zip" | "tar";
|
| 20 |
+
|
| 21 |
+
function create(format: string, options?: ArchiverOptions): Archiver;
|
| 22 |
+
|
| 23 |
+
/** Check if the format is already registered. */
|
| 24 |
+
function isRegisteredFormat(format: string): boolean;
|
| 25 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
| 26 |
+
function registerFormat(format: string, module: Function): void;
|
| 27 |
+
|
| 28 |
+
interface EntryData {
|
| 29 |
+
/** Sets the entry name including internal path */
|
| 30 |
+
name: string;
|
| 31 |
+
/** Sets the entry date */
|
| 32 |
+
date?: Date | string | undefined;
|
| 33 |
+
/** Sets the entry permissions */
|
| 34 |
+
mode?: number | undefined;
|
| 35 |
+
/**
|
| 36 |
+
* Sets a path prefix for the entry name.
|
| 37 |
+
* Useful when working with methods like `directory` or `glob`
|
| 38 |
+
*/
|
| 39 |
+
prefix?: string | undefined;
|
| 40 |
+
/**
|
| 41 |
+
* Sets the fs stat data for this entry allowing
|
| 42 |
+
* for reduction of fs stat calls when stat data is already known
|
| 43 |
+
*/
|
| 44 |
+
stats?: fs.Stats | undefined;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
interface ZipEntryData extends EntryData {
|
| 48 |
+
/** Sets the compression method to STORE */
|
| 49 |
+
store?: boolean | undefined;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
type TarEntryData = EntryData;
|
| 53 |
+
|
| 54 |
+
interface ProgressData {
|
| 55 |
+
entries: {
|
| 56 |
+
total: number;
|
| 57 |
+
processed: number;
|
| 58 |
+
};
|
| 59 |
+
fs: {
|
| 60 |
+
totalBytes: number;
|
| 61 |
+
processedBytes: number;
|
| 62 |
+
};
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/** A function that lets you either opt out of including an entry (by returning false), or modify the contents of an entry as it is added (by returning an EntryData) */
|
| 66 |
+
type EntryDataFunction = (entry: EntryData) => false | EntryData;
|
| 67 |
+
|
| 68 |
+
class ArchiverError extends Error {
|
| 69 |
+
code: string; // Since archiver format support is modular, we cannot enumerate all possible error codes, as the modules can throw arbitrary ones.
|
| 70 |
+
data: any;
|
| 71 |
+
path?: any;
|
| 72 |
+
|
| 73 |
+
constructor(code: string, data: any);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
interface Archiver extends stream.Transform {
|
| 77 |
+
abort(): this;
|
| 78 |
+
append(source: stream.Readable | Buffer | string, data?: EntryData | ZipEntryData | TarEntryData): this;
|
| 79 |
+
|
| 80 |
+
/** if false is passed for destpath, the path of a chunk of data in the archive is set to the root */
|
| 81 |
+
directory(dirpath: string, destpath: false | string, data?: Partial<EntryData> | EntryDataFunction): this;
|
| 82 |
+
file(filename: string, data: EntryData): this;
|
| 83 |
+
glob(pattern: string, options?: GlobOptions, data?: Partial<EntryData>): this;
|
| 84 |
+
finalize(): Promise<void>;
|
| 85 |
+
|
| 86 |
+
setFormat(format: string): this;
|
| 87 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
| 88 |
+
setModule(module: Function): this;
|
| 89 |
+
|
| 90 |
+
pointer(): number;
|
| 91 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
| 92 |
+
use(plugin: Function): this;
|
| 93 |
+
|
| 94 |
+
symlink(filepath: string, target: string, mode?: number): this;
|
| 95 |
+
|
| 96 |
+
on(event: "error" | "warning", listener: (error: ArchiverError) => void): this;
|
| 97 |
+
on(event: "data", listener: (data: Buffer) => void): this;
|
| 98 |
+
on(event: "progress", listener: (progress: ProgressData) => void): this;
|
| 99 |
+
on(event: "close" | "drain" | "finish", listener: () => void): this;
|
| 100 |
+
on(event: "pipe" | "unpipe", listener: (src: stream.Readable) => void): this;
|
| 101 |
+
on(event: "entry", listener: (entry: EntryData) => void): this;
|
| 102 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
type ArchiverOptions = CoreOptions & TransformOptions & ZipOptions & TarOptions;
|
| 106 |
+
|
| 107 |
+
interface CoreOptions {
|
| 108 |
+
statConcurrency?: number | undefined;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
interface TransformOptions {
|
| 112 |
+
allowHalfOpen?: boolean | undefined;
|
| 113 |
+
readableObjectMode?: boolean | undefined;
|
| 114 |
+
writeableObjectMode?: boolean | undefined;
|
| 115 |
+
decodeStrings?: boolean | undefined;
|
| 116 |
+
encoding?: string | undefined;
|
| 117 |
+
highWaterMark?: number | undefined;
|
| 118 |
+
objectmode?: boolean | undefined;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
interface ZipOptions {
|
| 122 |
+
comment?: string | undefined;
|
| 123 |
+
forceLocalTime?: boolean | undefined;
|
| 124 |
+
forceZip64?: boolean | undefined;
|
| 125 |
+
/** @default false */
|
| 126 |
+
namePrependSlash?: boolean | undefined;
|
| 127 |
+
store?: boolean | undefined;
|
| 128 |
+
zlib?: ZlibOptions | undefined;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
interface TarOptions {
|
| 132 |
+
gzip?: boolean | undefined;
|
| 133 |
+
gzipOptions?: ZlibOptions | undefined;
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
export = archiver;
|
node_modules/@types/archiver/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/archiver",
|
| 3 |
+
"version": "7.0.0",
|
| 4 |
+
"description": "TypeScript definitions for archiver",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/archiver",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": " Esri\n// Dolan Miu",
|
| 10 |
+
"githubUsername": "dolanmiu",
|
| 11 |
+
"url": "https://github.com/dolanmiu"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Crevil",
|
| 15 |
+
"githubUsername": "crevil",
|
| 16 |
+
"url": "https://github.com/crevil"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Piotr Błażejewicz",
|
| 20 |
+
"githubUsername": "peterblazejewicz",
|
| 21 |
+
"url": "https://github.com/peterblazejewicz"
|
| 22 |
+
}
|
| 23 |
+
],
|
| 24 |
+
"main": "",
|
| 25 |
+
"types": "index.d.ts",
|
| 26 |
+
"repository": {
|
| 27 |
+
"type": "git",
|
| 28 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 29 |
+
"directory": "types/archiver"
|
| 30 |
+
},
|
| 31 |
+
"scripts": {},
|
| 32 |
+
"dependencies": {
|
| 33 |
+
"@types/readdir-glob": "*"
|
| 34 |
+
},
|
| 35 |
+
"peerDependencies": {},
|
| 36 |
+
"typesPublisherContentHash": "731a8e9a62243b895360c618aa46fc9bff1b97c14b10a057e4ef77d343b04efc",
|
| 37 |
+
"typeScriptVersion": "5.2"
|
| 38 |
+
}
|
node_modules/@types/bcryptjs/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/bcryptjs/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/bcryptjs`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for bcryptjs (https://github.com/dcodeIO/bcrypt.js).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bcryptjs.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Mon, 06 Nov 2023 22:41:04 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Joshua Filby](https://github.com/Joshua-F), [Rafael Kraut](https://github.com/RafaelKr), and [Branislav Holý](https://github.com/branoholy).
|
node_modules/@types/bcryptjs/index.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Sets the pseudo random number generator to use as a fallback if neither node's crypto module nor the Web Crypto API is available.
|
| 3 |
+
* Please note: It is highly important that the PRNG used is cryptographically secure and that it is seeded properly!
|
| 4 |
+
* @param random Function taking the number of bytes to generate as its sole argument, returning the corresponding array of cryptographically secure random byte values.
|
| 5 |
+
*/
|
| 6 |
+
export declare function setRandomFallback(random: (random: number) => number[]): void;
|
| 7 |
+
|
| 8 |
+
/**
|
| 9 |
+
* Synchronously generates a salt.
|
| 10 |
+
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
| 11 |
+
* @return Resulting salt
|
| 12 |
+
* @throws If a random fallback is required but not set
|
| 13 |
+
*/
|
| 14 |
+
export declare function genSaltSync(rounds?: number): string;
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Asynchronously generates a salt.
|
| 18 |
+
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
| 19 |
+
* @return Promise with resulting salt, if callback has been omitted
|
| 20 |
+
*/
|
| 21 |
+
export declare function genSalt(rounds?: number): Promise<string>;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Asynchronously generates a salt.
|
| 25 |
+
* @param callback Callback receiving the error, if any, and the resulting salt
|
| 26 |
+
*/
|
| 27 |
+
export declare function genSalt(callback: (err: Error | null, salt: string) => void): void;
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Asynchronously generates a salt.
|
| 31 |
+
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
| 32 |
+
* @param callback Callback receiving the error, if any, and the resulting salt
|
| 33 |
+
*/
|
| 34 |
+
export declare function genSalt(rounds: number, callback: (err: Error | null, salt: string) => void): void;
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Synchronously generates a hash for the given string.
|
| 38 |
+
* @param s String to hash
|
| 39 |
+
* @param salt Salt length to generate or salt to use, default to 10
|
| 40 |
+
* @return Resulting hash
|
| 41 |
+
*/
|
| 42 |
+
export declare function hashSync(s: string, salt?: number | string): string;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Asynchronously generates a hash for the given string.
|
| 46 |
+
* @param s String to hash
|
| 47 |
+
* @param salt Salt length to generate or salt to use
|
| 48 |
+
* @return Promise with resulting hash, if callback has been omitted
|
| 49 |
+
*/
|
| 50 |
+
export declare function hash(s: string, salt: number | string): Promise<string>;
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Asynchronously generates a hash for the given string.
|
| 54 |
+
* @param s String to hash
|
| 55 |
+
* @param salt Salt length to generate or salt to use
|
| 56 |
+
* @param callback Callback receiving the error, if any, and the resulting hash
|
| 57 |
+
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
| 58 |
+
*/
|
| 59 |
+
export declare function hash(
|
| 60 |
+
s: string,
|
| 61 |
+
salt: number | string,
|
| 62 |
+
callback?: (err: Error | null, hash: string) => void,
|
| 63 |
+
progressCallback?: (percent: number) => void,
|
| 64 |
+
): void;
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* Synchronously tests a string against a hash.
|
| 68 |
+
* @param s String to compare
|
| 69 |
+
* @param hash Hash to test against
|
| 70 |
+
* @return true if matching, otherwise false
|
| 71 |
+
*/
|
| 72 |
+
export declare function compareSync(s: string, hash: string): boolean;
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Asynchronously compares the given data against the given hash.
|
| 76 |
+
* @param s Data to compare
|
| 77 |
+
* @param hash Data to be compared to
|
| 78 |
+
* @return Promise, if callback has been omitted
|
| 79 |
+
*/
|
| 80 |
+
export declare function compare(s: string, hash: string): Promise<boolean>;
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Asynchronously compares the given data against the given hash.
|
| 84 |
+
* @param s Data to compare
|
| 85 |
+
* @param hash Data to be compared to
|
| 86 |
+
* @param callback Callback receiving the error, if any, otherwise the result
|
| 87 |
+
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
| 88 |
+
*/
|
| 89 |
+
export declare function compare(
|
| 90 |
+
s: string,
|
| 91 |
+
hash: string,
|
| 92 |
+
callback?: (err: Error | null, success: boolean) => void,
|
| 93 |
+
progressCallback?: (percent: number) => void,
|
| 94 |
+
): void;
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Gets the number of rounds used to encrypt the specified hash.
|
| 98 |
+
* @param hash Hash to extract the used number of rounds from
|
| 99 |
+
* @return Number of rounds used
|
| 100 |
+
*/
|
| 101 |
+
export declare function getRounds(hash: string): number;
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* Gets the salt portion from a hash. Does not validate the hash.
|
| 105 |
+
* @param hash Hash to extract the salt from
|
| 106 |
+
* @return Extracted salt part
|
| 107 |
+
*/
|
| 108 |
+
export declare function getSalt(hash: string): string;
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet.
|
| 112 |
+
* @function
|
| 113 |
+
* @param b Byte array
|
| 114 |
+
* @param len Maximum input length
|
| 115 |
+
*/
|
| 116 |
+
export declare function encodeBase64(b: Readonly<ArrayLike<number>>, len: number): string;
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet.
|
| 120 |
+
* @function
|
| 121 |
+
* @param s String to decode
|
| 122 |
+
* @param len Maximum output length
|
| 123 |
+
*/
|
| 124 |
+
export declare function decodeBase64(s: string, len: number): number[];
|
node_modules/@types/bcryptjs/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/bcryptjs",
|
| 3 |
+
"version": "2.4.6",
|
| 4 |
+
"description": "TypeScript definitions for bcryptjs",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bcryptjs",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Joshua Filby",
|
| 10 |
+
"githubUsername": "Joshua-F",
|
| 11 |
+
"url": "https://github.com/Joshua-F"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Rafael Kraut",
|
| 15 |
+
"githubUsername": "RafaelKr",
|
| 16 |
+
"url": "https://github.com/RafaelKr"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Branislav Holý",
|
| 20 |
+
"githubUsername": "branoholy",
|
| 21 |
+
"url": "https://github.com/branoholy"
|
| 22 |
+
}
|
| 23 |
+
],
|
| 24 |
+
"main": "",
|
| 25 |
+
"types": "index.d.ts",
|
| 26 |
+
"repository": {
|
| 27 |
+
"type": "git",
|
| 28 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 29 |
+
"directory": "types/bcryptjs"
|
| 30 |
+
},
|
| 31 |
+
"scripts": {},
|
| 32 |
+
"dependencies": {},
|
| 33 |
+
"typesPublisherContentHash": "b39980d6e9840f900b6f594a24d8f24dcce0864b2e9b631ed39ce6ef5b690daa",
|
| 34 |
+
"typeScriptVersion": "4.5"
|
| 35 |
+
}
|
node_modules/@types/better-sqlite3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/better-sqlite3/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/better-sqlite3`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for better-sqlite3 (https://github.com/JoshuaWise/better-sqlite3).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/better-sqlite3.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Fri, 04 Apr 2025 18:38:14 GMT
|
| 12 |
+
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Ben Davies](https://github.com/Morfent), [Mathew Rumsey](https://github.com/matrumz), [Santiago Aguilar](https://github.com/sant123), [Alessandro Vergani](https://github.com/loghorn), [Andrew Kaiser](https://github.com/andykais), [Mark Stewart](https://github.com/mrkstwrt), [Florian Stamer](https://github.com/stamerf), and [Beeno Tung](https://github.com/beenotung).
|
node_modules/@types/better-sqlite3/index.d.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
|
| 3 |
+
// FIXME: Is this `any` really necessary?
|
| 4 |
+
type VariableArgFunction = (...params: any[]) => unknown;
|
| 5 |
+
type ArgumentTypes<F extends VariableArgFunction> = F extends (...args: infer A) => unknown ? A : never;
|
| 6 |
+
type ElementOf<T> = T extends Array<infer E> ? E : T;
|
| 7 |
+
|
| 8 |
+
declare namespace BetterSqlite3 {
|
| 9 |
+
interface Statement<BindParameters extends unknown[], Result = unknown> {
|
| 10 |
+
database: Database;
|
| 11 |
+
source: string;
|
| 12 |
+
reader: boolean;
|
| 13 |
+
readonly: boolean;
|
| 14 |
+
busy: boolean;
|
| 15 |
+
|
| 16 |
+
run(...params: BindParameters): Database.RunResult;
|
| 17 |
+
get(...params: BindParameters): Result | undefined;
|
| 18 |
+
all(...params: BindParameters): Result[];
|
| 19 |
+
iterate(...params: BindParameters): IterableIterator<Result>;
|
| 20 |
+
pluck(toggleState?: boolean): this;
|
| 21 |
+
expand(toggleState?: boolean): this;
|
| 22 |
+
raw(toggleState?: boolean): this;
|
| 23 |
+
bind(...params: BindParameters): this;
|
| 24 |
+
columns(): ColumnDefinition[];
|
| 25 |
+
safeIntegers(toggleState?: boolean): this;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
interface ColumnDefinition {
|
| 29 |
+
name: string;
|
| 30 |
+
column: string | null;
|
| 31 |
+
table: string | null;
|
| 32 |
+
database: string | null;
|
| 33 |
+
type: string | null;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
interface Transaction<F extends VariableArgFunction> {
|
| 37 |
+
(...params: ArgumentTypes<F>): ReturnType<F>;
|
| 38 |
+
default(...params: ArgumentTypes<F>): ReturnType<F>;
|
| 39 |
+
deferred(...params: ArgumentTypes<F>): ReturnType<F>;
|
| 40 |
+
immediate(...params: ArgumentTypes<F>): ReturnType<F>;
|
| 41 |
+
exclusive(...params: ArgumentTypes<F>): ReturnType<F>;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
interface VirtualTableOptions {
|
| 45 |
+
rows: (...params: unknown[]) => Generator;
|
| 46 |
+
columns: string[];
|
| 47 |
+
parameters?: string[] | undefined;
|
| 48 |
+
safeIntegers?: boolean | undefined;
|
| 49 |
+
directOnly?: boolean | undefined;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
interface Database {
|
| 53 |
+
memory: boolean;
|
| 54 |
+
readonly: boolean;
|
| 55 |
+
name: string;
|
| 56 |
+
open: boolean;
|
| 57 |
+
inTransaction: boolean;
|
| 58 |
+
|
| 59 |
+
prepare<BindParameters extends unknown[] | {} = unknown[], Result = unknown>(
|
| 60 |
+
source: string,
|
| 61 |
+
): BindParameters extends unknown[] ? Statement<BindParameters, Result> : Statement<[BindParameters], Result>;
|
| 62 |
+
transaction<F extends VariableArgFunction>(fn: F): Transaction<F>;
|
| 63 |
+
exec(source: string): this;
|
| 64 |
+
pragma(source: string, options?: Database.PragmaOptions): unknown;
|
| 65 |
+
function(
|
| 66 |
+
name: string,
|
| 67 |
+
cb: (...params: any[]) => any,
|
| 68 |
+
): this;
|
| 69 |
+
function(
|
| 70 |
+
name: string,
|
| 71 |
+
options: Database.RegistrationOptions,
|
| 72 |
+
cb: (...params: any[]) => any,
|
| 73 |
+
): this;
|
| 74 |
+
aggregate<T>(
|
| 75 |
+
name: string,
|
| 76 |
+
options: Database.RegistrationOptions & {
|
| 77 |
+
start?: T | (() => T);
|
| 78 |
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
| 79 |
+
step: (total: T, next: ElementOf<T>) => T | void;
|
| 80 |
+
inverse?: ((total: T, dropped: T) => T) | undefined;
|
| 81 |
+
result?: ((total: T) => unknown) | undefined;
|
| 82 |
+
},
|
| 83 |
+
): this;
|
| 84 |
+
loadExtension(path: string): this;
|
| 85 |
+
close(): this;
|
| 86 |
+
defaultSafeIntegers(toggleState?: boolean): this;
|
| 87 |
+
backup(destinationFile: string, options?: Database.BackupOptions): Promise<Database.BackupMetadata>;
|
| 88 |
+
table(name: string, options: VirtualTableOptions): this;
|
| 89 |
+
unsafeMode(unsafe?: boolean): this;
|
| 90 |
+
serialize(options?: Database.SerializeOptions): Buffer;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
interface DatabaseConstructor {
|
| 94 |
+
new(filename?: string | Buffer, options?: Database.Options): Database;
|
| 95 |
+
(filename?: string, options?: Database.Options): Database;
|
| 96 |
+
prototype: Database;
|
| 97 |
+
SqliteError: SqliteErrorType;
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
declare class SqliteErrorClass extends Error {
|
| 102 |
+
name: string;
|
| 103 |
+
message: string;
|
| 104 |
+
code: string;
|
| 105 |
+
constructor(message: string, code: string);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
type SqliteErrorType = typeof SqliteErrorClass;
|
| 109 |
+
|
| 110 |
+
declare namespace Database {
|
| 111 |
+
interface RunResult {
|
| 112 |
+
changes: number;
|
| 113 |
+
lastInsertRowid: number | bigint;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
interface Options {
|
| 117 |
+
readonly?: boolean | undefined;
|
| 118 |
+
fileMustExist?: boolean | undefined;
|
| 119 |
+
timeout?: number | undefined;
|
| 120 |
+
verbose?: ((message?: unknown, ...additionalArgs: unknown[]) => void) | undefined;
|
| 121 |
+
nativeBinding?: string | undefined;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
interface SerializeOptions {
|
| 125 |
+
attached?: string;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
interface PragmaOptions {
|
| 129 |
+
simple?: boolean | undefined;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
interface RegistrationOptions {
|
| 133 |
+
varargs?: boolean | undefined;
|
| 134 |
+
deterministic?: boolean | undefined;
|
| 135 |
+
safeIntegers?: boolean | undefined;
|
| 136 |
+
directOnly?: boolean | undefined;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
type AggregateOptions = Parameters<BetterSqlite3.Database["aggregate"]>[1];
|
| 140 |
+
|
| 141 |
+
interface BackupMetadata {
|
| 142 |
+
totalPages: number;
|
| 143 |
+
remainingPages: number;
|
| 144 |
+
}
|
| 145 |
+
interface BackupOptions {
|
| 146 |
+
progress: (info: BackupMetadata) => number;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
type SqliteError = SqliteErrorType;
|
| 150 |
+
type Statement<BindParameters extends unknown[] | {} = unknown[], Result = unknown> = BindParameters extends
|
| 151 |
+
unknown[] ? BetterSqlite3.Statement<BindParameters, Result>
|
| 152 |
+
: BetterSqlite3.Statement<[BindParameters], Result>;
|
| 153 |
+
type ColumnDefinition = BetterSqlite3.ColumnDefinition;
|
| 154 |
+
type Transaction<T extends VariableArgFunction = VariableArgFunction> = BetterSqlite3.Transaction<T>;
|
| 155 |
+
type Database = BetterSqlite3.Database;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
declare const Database: BetterSqlite3.DatabaseConstructor;
|
| 159 |
+
export = Database;
|
node_modules/@types/better-sqlite3/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/better-sqlite3",
|
| 3 |
+
"version": "7.6.13",
|
| 4 |
+
"description": "TypeScript definitions for better-sqlite3",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/better-sqlite3",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Ben Davies",
|
| 10 |
+
"githubUsername": "Morfent",
|
| 11 |
+
"url": "https://github.com/Morfent"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Mathew Rumsey",
|
| 15 |
+
"githubUsername": "matrumz",
|
| 16 |
+
"url": "https://github.com/matrumz"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Santiago Aguilar",
|
| 20 |
+
"githubUsername": "sant123",
|
| 21 |
+
"url": "https://github.com/sant123"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Alessandro Vergani",
|
| 25 |
+
"githubUsername": "loghorn",
|
| 26 |
+
"url": "https://github.com/loghorn"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Andrew Kaiser",
|
| 30 |
+
"githubUsername": "andykais",
|
| 31 |
+
"url": "https://github.com/andykais"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Mark Stewart",
|
| 35 |
+
"githubUsername": "mrkstwrt",
|
| 36 |
+
"url": "https://github.com/mrkstwrt"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "Florian Stamer",
|
| 40 |
+
"githubUsername": "stamerf",
|
| 41 |
+
"url": "https://github.com/stamerf"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Beeno Tung",
|
| 45 |
+
"githubUsername": "beenotung",
|
| 46 |
+
"url": "https://github.com/beenotung"
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"main": "",
|
| 50 |
+
"types": "index.d.ts",
|
| 51 |
+
"repository": {
|
| 52 |
+
"type": "git",
|
| 53 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 54 |
+
"directory": "types/better-sqlite3"
|
| 55 |
+
},
|
| 56 |
+
"scripts": {},
|
| 57 |
+
"dependencies": {
|
| 58 |
+
"@types/node": "*"
|
| 59 |
+
},
|
| 60 |
+
"peerDependencies": {},
|
| 61 |
+
"typesPublisherContentHash": "d3573b172a1ed98c5e63d112a1d270bef2b683e7f13829155088694326b5fbac",
|
| 62 |
+
"typeScriptVersion": "5.1"
|
| 63 |
+
}
|
node_modules/@types/body-parser/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/body-parser/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/body-parser`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for body-parser (https://github.com/expressjs/body-parser).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Sat, 07 Jun 2025 02:15:25 GMT
|
| 12 |
+
* Dependencies: [@types/connect](https://npmjs.com/package/@types/connect), [@types/node](https://npmjs.com/package/@types/node)
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Santi Albo](https://github.com/santialbo), [Vilic Vane](https://github.com/vilic), [Jonathan Häberle](https://github.com/dreampulse), [Gevik Babakhani](https://github.com/blendsdk), [Tomasz Łaziuk](https://github.com/tlaziuk), [Jason Walton](https://github.com/jwalton), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Sebastian Beltran](https://github.com/bjohansebas).
|
node_modules/@types/body-parser/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
|
| 3 |
+
import { NextHandleFunction } from "connect";
|
| 4 |
+
import * as http from "http";
|
| 5 |
+
|
| 6 |
+
// for docs go to https://github.com/expressjs/body-parser/tree/1.19.0#body-parser
|
| 7 |
+
|
| 8 |
+
declare namespace bodyParser {
|
| 9 |
+
interface BodyParser {
|
| 10 |
+
/**
|
| 11 |
+
* @deprecated use individual json/urlencoded middlewares
|
| 12 |
+
*/
|
| 13 |
+
(options?: OptionsJson & OptionsText & OptionsUrlencoded): NextHandleFunction;
|
| 14 |
+
/**
|
| 15 |
+
* Returns middleware that only parses json and only looks at requests
|
| 16 |
+
* where the Content-Type header matches the type option.
|
| 17 |
+
*/
|
| 18 |
+
json(options?: OptionsJson): NextHandleFunction;
|
| 19 |
+
/**
|
| 20 |
+
* Returns middleware that parses all bodies as a Buffer and only looks at requests
|
| 21 |
+
* where the Content-Type header matches the type option.
|
| 22 |
+
*/
|
| 23 |
+
raw(options?: Options): NextHandleFunction;
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Returns middleware that parses all bodies as a string and only looks at requests
|
| 27 |
+
* where the Content-Type header matches the type option.
|
| 28 |
+
*/
|
| 29 |
+
text(options?: OptionsText): NextHandleFunction;
|
| 30 |
+
/**
|
| 31 |
+
* Returns middleware that only parses urlencoded bodies and only looks at requests
|
| 32 |
+
* where the Content-Type header matches the type option
|
| 33 |
+
*/
|
| 34 |
+
urlencoded(options?: OptionsUrlencoded): NextHandleFunction;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
interface Options {
|
| 38 |
+
/** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */
|
| 39 |
+
inflate?: boolean | undefined;
|
| 40 |
+
/**
|
| 41 |
+
* Controls the maximum request body size. If this is a number,
|
| 42 |
+
* then the value specifies the number of bytes; if it is a string,
|
| 43 |
+
* the value is passed to the bytes library for parsing. Defaults to '100kb'.
|
| 44 |
+
*/
|
| 45 |
+
limit?: number | string | undefined;
|
| 46 |
+
/**
|
| 47 |
+
* The type option is used to determine what media type the middleware will parse
|
| 48 |
+
*/
|
| 49 |
+
type?: string | string[] | ((req: http.IncomingMessage) => any) | undefined;
|
| 50 |
+
/**
|
| 51 |
+
* The verify option, if supplied, is called as verify(req, res, buf, encoding),
|
| 52 |
+
* where buf is a Buffer of the raw request body and encoding is the encoding of the request.
|
| 53 |
+
*/
|
| 54 |
+
verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
interface OptionsJson extends Options {
|
| 58 |
+
/**
|
| 59 |
+
* The reviver option is passed directly to JSON.parse as the second argument.
|
| 60 |
+
*/
|
| 61 |
+
reviver?(key: string, value: any): any;
|
| 62 |
+
/**
|
| 63 |
+
* When set to `true`, will only accept arrays and objects;
|
| 64 |
+
* when `false` will accept anything JSON.parse accepts. Defaults to `true`.
|
| 65 |
+
*/
|
| 66 |
+
strict?: boolean | undefined;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
interface OptionsText extends Options {
|
| 70 |
+
/**
|
| 71 |
+
* Specify the default character set for the text content if the charset
|
| 72 |
+
* is not specified in the Content-Type header of the request.
|
| 73 |
+
* Defaults to `utf-8`.
|
| 74 |
+
*/
|
| 75 |
+
defaultCharset?: string | undefined;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
interface OptionsUrlencoded extends Options {
|
| 79 |
+
/**
|
| 80 |
+
* The extended option allows to choose between parsing the URL-encoded data
|
| 81 |
+
* with the querystring library (when `false`) or the qs library (when `true`).
|
| 82 |
+
*/
|
| 83 |
+
extended?: boolean | undefined;
|
| 84 |
+
/**
|
| 85 |
+
* The parameterLimit option controls the maximum number of parameters
|
| 86 |
+
* that are allowed in the URL-encoded data. If a request contains more parameters than this value,
|
| 87 |
+
* a 413 will be returned to the client. Defaults to 1000.
|
| 88 |
+
*/
|
| 89 |
+
parameterLimit?: number | undefined;
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
declare const bodyParser: bodyParser.BodyParser;
|
| 94 |
+
|
| 95 |
+
export = bodyParser;
|
node_modules/@types/body-parser/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/body-parser",
|
| 3 |
+
"version": "1.19.6",
|
| 4 |
+
"description": "TypeScript definitions for body-parser",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Santi Albo",
|
| 10 |
+
"githubUsername": "santialbo",
|
| 11 |
+
"url": "https://github.com/santialbo"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Vilic Vane",
|
| 15 |
+
"githubUsername": "vilic",
|
| 16 |
+
"url": "https://github.com/vilic"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Jonathan Häberle",
|
| 20 |
+
"githubUsername": "dreampulse",
|
| 21 |
+
"url": "https://github.com/dreampulse"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Gevik Babakhani",
|
| 25 |
+
"githubUsername": "blendsdk",
|
| 26 |
+
"url": "https://github.com/blendsdk"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Tomasz Łaziuk",
|
| 30 |
+
"githubUsername": "tlaziuk",
|
| 31 |
+
"url": "https://github.com/tlaziuk"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Jason Walton",
|
| 35 |
+
"githubUsername": "jwalton",
|
| 36 |
+
"url": "https://github.com/jwalton"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "Piotr Błażejewicz",
|
| 40 |
+
"githubUsername": "peterblazejewicz",
|
| 41 |
+
"url": "https://github.com/peterblazejewicz"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Sebastian Beltran",
|
| 45 |
+
"githubUsername": "bjohansebas",
|
| 46 |
+
"url": "https://github.com/bjohansebas"
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"main": "",
|
| 50 |
+
"types": "index.d.ts",
|
| 51 |
+
"repository": {
|
| 52 |
+
"type": "git",
|
| 53 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 54 |
+
"directory": "types/body-parser"
|
| 55 |
+
},
|
| 56 |
+
"scripts": {},
|
| 57 |
+
"dependencies": {
|
| 58 |
+
"@types/connect": "*",
|
| 59 |
+
"@types/node": "*"
|
| 60 |
+
},
|
| 61 |
+
"peerDependencies": {},
|
| 62 |
+
"typesPublisherContentHash": "d788c843f427d6ca19640ee90eb433324a18f23aed05402a82c4e47e6d60b29d",
|
| 63 |
+
"typeScriptVersion": "5.1"
|
| 64 |
+
}
|
node_modules/@types/chai/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/chai/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/chai`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for chai (http://chaijs.com/).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Mon, 20 Oct 2025 23:32:35 GMT
|
| 12 |
+
* Dependencies: [@types/deep-eql](https://npmjs.com/package/@types/deep-eql), [assertion-error](https://npmjs.com/package/assertion-error)
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70), [Matt Wistrand](https://github.com/mwistrand), [Shaun Luttin](https://github.com/shaunluttin), [Satana Charuwichitratana](https://github.com/micksatana), [Erik Schierboom](https://github.com/ErikSchierboom), [Bogdan Paranytsia](https://github.com/bparan), [CXuesong](https://github.com/CXuesong), and [Joey Kilpatrick](https://github.com/joeykilpatrick).
|
node_modules/@types/chai/index.d.ts
ADDED
|
@@ -0,0 +1,2145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import deepEqual = require("deep-eql");
|
| 2 |
+
import { AssertionError as ImportedAssertionError } from "assertion-error";
|
| 3 |
+
|
| 4 |
+
declare global {
|
| 5 |
+
namespace Chai {
|
| 6 |
+
export type Message = string | (() => string);
|
| 7 |
+
export type ObjectProperty = string | symbol | number;
|
| 8 |
+
|
| 9 |
+
export interface PathInfo {
|
| 10 |
+
parent: object;
|
| 11 |
+
name: string;
|
| 12 |
+
value?: any;
|
| 13 |
+
exists: boolean;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export interface Constructor<T> {
|
| 17 |
+
new(...args: any[]): T;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
export interface ErrorConstructor {
|
| 21 |
+
new(...args: any[]): Error;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
export interface ChaiUtils {
|
| 25 |
+
addChainableMethod(
|
| 26 |
+
// object to define the method on, e.g. chai.Assertion.prototype
|
| 27 |
+
ctx: object,
|
| 28 |
+
// method name
|
| 29 |
+
name: string,
|
| 30 |
+
// method itself; any arguments
|
| 31 |
+
method: (...args: any[]) => void,
|
| 32 |
+
// called when property is accessed
|
| 33 |
+
chainingBehavior?: () => void,
|
| 34 |
+
): void;
|
| 35 |
+
overwriteChainableMethod(
|
| 36 |
+
ctx: object,
|
| 37 |
+
name: string,
|
| 38 |
+
method: (...args: any[]) => void,
|
| 39 |
+
chainingBehavior?: () => void,
|
| 40 |
+
): void;
|
| 41 |
+
addLengthGuard(
|
| 42 |
+
fn: Function,
|
| 43 |
+
assertionName: string,
|
| 44 |
+
isChainable: boolean,
|
| 45 |
+
): void;
|
| 46 |
+
addMethod(ctx: object, name: string, method: Function): void;
|
| 47 |
+
addProperty(ctx: object, name: string, getter: () => any): void;
|
| 48 |
+
overwriteMethod(ctx: object, name: string, method: Function): void;
|
| 49 |
+
overwriteProperty(ctx: object, name: string, getter: (this: AssertionStatic, _super: any) => any): void;
|
| 50 |
+
compareByInspect(a: object, b: object): -1 | 1;
|
| 51 |
+
expectTypes(obj: object, types: string[]): void;
|
| 52 |
+
flag(obj: object, key: string, value?: any): any;
|
| 53 |
+
getActual(obj: object, args: AssertionArgs): any;
|
| 54 |
+
getProperties(obj: object): string[];
|
| 55 |
+
getEnumerableProperties(obj: object): string[];
|
| 56 |
+
getOwnEnumerablePropertySymbols(obj: object): symbol[];
|
| 57 |
+
getOwnEnumerableProperties(obj: object): Array<string | symbol>;
|
| 58 |
+
getMessage(errorLike: Error | string): string;
|
| 59 |
+
getMessage(obj: any, args: AssertionArgs): string;
|
| 60 |
+
inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean): string;
|
| 61 |
+
isProxyEnabled(): boolean;
|
| 62 |
+
objDisplay(obj: object): void;
|
| 63 |
+
proxify(obj: object, nonChainableMethodName: string): object;
|
| 64 |
+
test(obj: object, args: AssertionArgs): boolean;
|
| 65 |
+
transferFlags(assertion: Assertion, obj: object, includeAll?: boolean): void;
|
| 66 |
+
compatibleInstance(thrown: Error, errorLike: Error | ErrorConstructor): boolean;
|
| 67 |
+
compatibleConstructor(thrown: Error, errorLike: Error | ErrorConstructor): boolean;
|
| 68 |
+
compatibleMessage(thrown: Error, errMatcher: string | RegExp): boolean;
|
| 69 |
+
getConstructorName(constructorFn: Function): string;
|
| 70 |
+
getFuncName(constructorFn: Function): string | null;
|
| 71 |
+
|
| 72 |
+
// Reexports from pathval:
|
| 73 |
+
hasProperty(obj: object | undefined | null, name: ObjectProperty): boolean;
|
| 74 |
+
getPathInfo(obj: object, path: string): PathInfo;
|
| 75 |
+
getPathValue(obj: object, path: string): object | undefined;
|
| 76 |
+
|
| 77 |
+
eql: typeof deepEqual;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
export type ChaiPlugin = (chai: ChaiStatic, utils: ChaiUtils) => void;
|
| 81 |
+
|
| 82 |
+
export interface ChaiStatic {
|
| 83 |
+
expect: ExpectStatic;
|
| 84 |
+
should(): Should;
|
| 85 |
+
/**
|
| 86 |
+
* Provides a way to extend the internals of Chai
|
| 87 |
+
*/
|
| 88 |
+
use(fn: ChaiPlugin): ChaiStatic;
|
| 89 |
+
util: ChaiUtils;
|
| 90 |
+
assert: AssertStatic;
|
| 91 |
+
config: Config;
|
| 92 |
+
Assertion: AssertionStatic;
|
| 93 |
+
AssertionError: typeof AssertionError;
|
| 94 |
+
version: string;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
export interface ExpectStatic {
|
| 98 |
+
(val: any, message?: string): Assertion;
|
| 99 |
+
fail(message?: string): never;
|
| 100 |
+
fail(actual: any, expected: any, message?: string, operator?: Operator): never;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
export interface AssertStatic extends Assert {
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
// chai.Assertion.prototype.assert arguments
|
| 107 |
+
export type AssertionArgs = [
|
| 108 |
+
any, // expression to be tested
|
| 109 |
+
Message, // message or function that returns message to display if expression fails
|
| 110 |
+
Message, // negatedMessage or function that returns negatedMessage to display if expression fails
|
| 111 |
+
any?, // expected value
|
| 112 |
+
any?, // actual value
|
| 113 |
+
boolean?, // showDiff, when set to `true`, assert will display a diff in addition to the message if expression fails
|
| 114 |
+
];
|
| 115 |
+
|
| 116 |
+
export interface AssertionPrototype {
|
| 117 |
+
assert(...args: AssertionArgs): void;
|
| 118 |
+
_obj: any;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
export interface AssertionStatic extends AssertionPrototype {
|
| 122 |
+
prototype: AssertionPrototype;
|
| 123 |
+
|
| 124 |
+
new(target: any, message?: string, ssfi?: Function, lockSsfi?: boolean): Assertion;
|
| 125 |
+
|
| 126 |
+
// Deprecated properties:
|
| 127 |
+
includeStack: boolean;
|
| 128 |
+
showDiff: boolean;
|
| 129 |
+
|
| 130 |
+
// Partials of functions on ChaiUtils:
|
| 131 |
+
addProperty(name: string, getter: (this: AssertionStatic) => any): void;
|
| 132 |
+
addMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void;
|
| 133 |
+
addChainableMethod(
|
| 134 |
+
name: string,
|
| 135 |
+
method: (this: AssertionStatic, ...args: any[]) => void,
|
| 136 |
+
chainingBehavior?: () => void,
|
| 137 |
+
): void;
|
| 138 |
+
overwriteProperty(name: string, getter: (this: AssertionStatic, _super: any) => any): void;
|
| 139 |
+
overwriteMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void;
|
| 140 |
+
overwriteChainableMethod(
|
| 141 |
+
name: string,
|
| 142 |
+
method: (this: AssertionStatic, ...args: any[]) => void,
|
| 143 |
+
chainingBehavior?: () => void,
|
| 144 |
+
): void;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!==";
|
| 148 |
+
|
| 149 |
+
export type OperatorComparable = boolean | null | number | string | undefined | Date;
|
| 150 |
+
|
| 151 |
+
export interface ShouldAssertion {
|
| 152 |
+
equal(value1: any, value2: any, message?: string): void;
|
| 153 |
+
Throw: ShouldThrow;
|
| 154 |
+
throw: ShouldThrow;
|
| 155 |
+
exist(value: any, message?: string): void;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
export interface Should extends ShouldAssertion {
|
| 159 |
+
not: ShouldAssertion;
|
| 160 |
+
fail(message?: string): never;
|
| 161 |
+
fail(actual: any, expected: any, message?: string, operator?: Operator): never;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
export interface ShouldThrow {
|
| 165 |
+
(actual: Function, expected?: string | RegExp, message?: string): void;
|
| 166 |
+
(actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
export interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
| 170 |
+
not: Assertion;
|
| 171 |
+
deep: Deep;
|
| 172 |
+
ordered: Ordered;
|
| 173 |
+
nested: Nested;
|
| 174 |
+
own: Own;
|
| 175 |
+
any: KeyFilter;
|
| 176 |
+
all: KeyFilter;
|
| 177 |
+
a: Assertion;
|
| 178 |
+
an: Assertion;
|
| 179 |
+
include: Include;
|
| 180 |
+
includes: Include;
|
| 181 |
+
contain: Include;
|
| 182 |
+
contains: Include;
|
| 183 |
+
ok: Assertion;
|
| 184 |
+
true: Assertion;
|
| 185 |
+
false: Assertion;
|
| 186 |
+
null: Assertion;
|
| 187 |
+
undefined: Assertion;
|
| 188 |
+
NaN: Assertion;
|
| 189 |
+
exist: Assertion;
|
| 190 |
+
empty: Assertion;
|
| 191 |
+
arguments: Assertion;
|
| 192 |
+
Arguments: Assertion;
|
| 193 |
+
finite: Assertion;
|
| 194 |
+
equal: Equal;
|
| 195 |
+
equals: Equal;
|
| 196 |
+
eq: Equal;
|
| 197 |
+
eql: Equal;
|
| 198 |
+
eqls: Equal;
|
| 199 |
+
containSubset: ContainSubset;
|
| 200 |
+
property: Property;
|
| 201 |
+
ownProperty: Property;
|
| 202 |
+
haveOwnProperty: Property;
|
| 203 |
+
ownPropertyDescriptor: OwnPropertyDescriptor;
|
| 204 |
+
haveOwnPropertyDescriptor: OwnPropertyDescriptor;
|
| 205 |
+
length: Length;
|
| 206 |
+
lengthOf: Length;
|
| 207 |
+
match: Match;
|
| 208 |
+
matches: Match;
|
| 209 |
+
string(string: string, message?: string): Assertion;
|
| 210 |
+
keys: Keys;
|
| 211 |
+
key(string: string): Assertion;
|
| 212 |
+
throw: Throw;
|
| 213 |
+
throws: Throw;
|
| 214 |
+
Throw: Throw;
|
| 215 |
+
respondTo: RespondTo;
|
| 216 |
+
respondsTo: RespondTo;
|
| 217 |
+
itself: Assertion;
|
| 218 |
+
satisfy: Satisfy;
|
| 219 |
+
satisfies: Satisfy;
|
| 220 |
+
closeTo: CloseTo;
|
| 221 |
+
approximately: CloseTo;
|
| 222 |
+
members: Members;
|
| 223 |
+
increase: PropertyChange;
|
| 224 |
+
increases: PropertyChange;
|
| 225 |
+
decrease: PropertyChange;
|
| 226 |
+
decreases: PropertyChange;
|
| 227 |
+
change: PropertyChange;
|
| 228 |
+
changes: PropertyChange;
|
| 229 |
+
extensible: Assertion;
|
| 230 |
+
sealed: Assertion;
|
| 231 |
+
frozen: Assertion;
|
| 232 |
+
oneOf: OneOf;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
export interface LanguageChains {
|
| 236 |
+
to: Assertion;
|
| 237 |
+
be: Assertion;
|
| 238 |
+
been: Assertion;
|
| 239 |
+
is: Assertion;
|
| 240 |
+
that: Assertion;
|
| 241 |
+
which: Assertion;
|
| 242 |
+
and: Assertion;
|
| 243 |
+
has: Assertion;
|
| 244 |
+
have: Assertion;
|
| 245 |
+
with: Assertion;
|
| 246 |
+
at: Assertion;
|
| 247 |
+
of: Assertion;
|
| 248 |
+
same: Assertion;
|
| 249 |
+
but: Assertion;
|
| 250 |
+
does: Assertion;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
export interface NumericComparison {
|
| 254 |
+
above: NumberComparer;
|
| 255 |
+
gt: NumberComparer;
|
| 256 |
+
greaterThan: NumberComparer;
|
| 257 |
+
least: NumberComparer;
|
| 258 |
+
gte: NumberComparer;
|
| 259 |
+
greaterThanOrEqual: NumberComparer;
|
| 260 |
+
below: NumberComparer;
|
| 261 |
+
lt: NumberComparer;
|
| 262 |
+
lessThan: NumberComparer;
|
| 263 |
+
most: NumberComparer;
|
| 264 |
+
lte: NumberComparer;
|
| 265 |
+
lessThanOrEqual: NumberComparer;
|
| 266 |
+
within(start: number, finish: number, message?: string): Assertion;
|
| 267 |
+
within(start: Date, finish: Date, message?: string): Assertion;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
export interface NumberComparer {
|
| 271 |
+
(value: number | Date, message?: string): Assertion;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
export interface TypeComparison {
|
| 275 |
+
(type: string, message?: string): Assertion;
|
| 276 |
+
instanceof: InstanceOf;
|
| 277 |
+
instanceOf: InstanceOf;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
export interface InstanceOf {
|
| 281 |
+
(constructor: any, message?: string): Assertion;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
export interface CloseTo {
|
| 285 |
+
(expected: number, delta: number, message?: string): Assertion;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
export interface Nested {
|
| 289 |
+
include: Include;
|
| 290 |
+
includes: Include;
|
| 291 |
+
contain: Include;
|
| 292 |
+
contains: Include;
|
| 293 |
+
property: Property;
|
| 294 |
+
members: Members;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
export interface Own {
|
| 298 |
+
include: Include;
|
| 299 |
+
includes: Include;
|
| 300 |
+
contain: Include;
|
| 301 |
+
contains: Include;
|
| 302 |
+
property: Property;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
export interface Deep extends KeyFilter {
|
| 306 |
+
be: Assertion;
|
| 307 |
+
equal: Equal;
|
| 308 |
+
equals: Equal;
|
| 309 |
+
eq: Equal;
|
| 310 |
+
include: Include;
|
| 311 |
+
includes: Include;
|
| 312 |
+
contain: Include;
|
| 313 |
+
contains: Include;
|
| 314 |
+
property: Property;
|
| 315 |
+
ordered: Ordered;
|
| 316 |
+
nested: Nested;
|
| 317 |
+
oneOf: OneOf;
|
| 318 |
+
own: Own;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
export interface Ordered {
|
| 322 |
+
members: Members;
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
export interface KeyFilter {
|
| 326 |
+
keys: Keys;
|
| 327 |
+
members: Members;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
export interface Equal {
|
| 331 |
+
(value: any, message?: string): Assertion;
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
export interface ContainSubset {
|
| 335 |
+
(expected: any): Assertion;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
export interface Property {
|
| 339 |
+
(name: string | symbol, value: any, message?: string): Assertion;
|
| 340 |
+
(name: string | symbol, message?: string): Assertion;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
export interface OwnPropertyDescriptor {
|
| 344 |
+
(name: string | symbol, descriptor: PropertyDescriptor, message?: string): Assertion;
|
| 345 |
+
(name: string | symbol, message?: string): Assertion;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
export interface Length extends LanguageChains, NumericComparison {
|
| 349 |
+
(length: number, message?: string): Assertion;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
export interface Include {
|
| 353 |
+
(value: any, message?: string): Assertion;
|
| 354 |
+
keys: Keys;
|
| 355 |
+
deep: Deep;
|
| 356 |
+
ordered: Ordered;
|
| 357 |
+
members: Members;
|
| 358 |
+
any: KeyFilter;
|
| 359 |
+
all: KeyFilter;
|
| 360 |
+
oneOf: OneOf;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
export interface OneOf {
|
| 364 |
+
(list: readonly unknown[], message?: string): Assertion;
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
export interface Match {
|
| 368 |
+
(regexp: RegExp, message?: string): Assertion;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
export interface Keys {
|
| 372 |
+
(...keys: string[]): Assertion;
|
| 373 |
+
(keys: readonly any[] | Object): Assertion;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
export interface Throw {
|
| 377 |
+
(expected?: string | RegExp, message?: string): Assertion;
|
| 378 |
+
(constructor: Error | Function, expected?: string | RegExp, message?: string): Assertion;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
export interface RespondTo {
|
| 382 |
+
(method: string, message?: string): Assertion;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
export interface Satisfy {
|
| 386 |
+
(matcher: Function, message?: string): Assertion;
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
export interface Members {
|
| 390 |
+
(set: readonly any[], message?: string): Assertion;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
export interface PropertyChange {
|
| 394 |
+
(object: Object, property?: string, message?: string): DeltaAssertion;
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
export interface DeltaAssertion extends Assertion {
|
| 398 |
+
by(delta: number, msg?: string): Assertion;
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
export interface Assert {
|
| 402 |
+
/**
|
| 403 |
+
* @param expression Expression to test for truthiness.
|
| 404 |
+
* @param message Message to display on error.
|
| 405 |
+
*/
|
| 406 |
+
(expression: any, message?: string): asserts expression;
|
| 407 |
+
|
| 408 |
+
/**
|
| 409 |
+
* Throws a failure.
|
| 410 |
+
*
|
| 411 |
+
* @param message Message to display on error.
|
| 412 |
+
* @remarks Node.js assert module-compatible.
|
| 413 |
+
*/
|
| 414 |
+
fail(message?: string): never;
|
| 415 |
+
|
| 416 |
+
/**
|
| 417 |
+
* Throws a failure.
|
| 418 |
+
*
|
| 419 |
+
* T Type of the objects.
|
| 420 |
+
* @param actual Actual value.
|
| 421 |
+
* @param expected Potential expected value.
|
| 422 |
+
* @param message Message to display on error.
|
| 423 |
+
* @param operator Comparison operator, if not strict equality.
|
| 424 |
+
* @remarks Node.js assert module-compatible.
|
| 425 |
+
*/
|
| 426 |
+
fail<T>(actual: T, expected: T, message?: string, operator?: Operator): never;
|
| 427 |
+
|
| 428 |
+
/**
|
| 429 |
+
* Asserts that object is truthy.
|
| 430 |
+
*
|
| 431 |
+
* @param object Object to test.
|
| 432 |
+
* @param message Message to display on error.
|
| 433 |
+
*/
|
| 434 |
+
isOk(value: unknown, message?: string): asserts value;
|
| 435 |
+
|
| 436 |
+
/**
|
| 437 |
+
* Asserts that object is truthy.
|
| 438 |
+
*
|
| 439 |
+
* @param object Object to test.
|
| 440 |
+
* @param message Message to display on error.
|
| 441 |
+
*/
|
| 442 |
+
ok(value: unknown, message?: string): asserts value;
|
| 443 |
+
|
| 444 |
+
/**
|
| 445 |
+
* Asserts that object is falsy.
|
| 446 |
+
*
|
| 447 |
+
* T Type of object.
|
| 448 |
+
* @param object Object to test.
|
| 449 |
+
* @param message Message to display on error.
|
| 450 |
+
*/
|
| 451 |
+
isNotOk<T>(value: T, message?: string): void;
|
| 452 |
+
|
| 453 |
+
/**
|
| 454 |
+
* Asserts that object is falsy.
|
| 455 |
+
*
|
| 456 |
+
* T Type of object.
|
| 457 |
+
* @param object Object to test.
|
| 458 |
+
* @param message Message to display on error.
|
| 459 |
+
*/
|
| 460 |
+
notOk<T>(value: T, message?: string): void;
|
| 461 |
+
|
| 462 |
+
/**
|
| 463 |
+
* Asserts non-strict equality (==) of actual and expected.
|
| 464 |
+
*
|
| 465 |
+
* T Type of the objects.
|
| 466 |
+
* @param actual Actual value.
|
| 467 |
+
* @param expected Potential expected value.
|
| 468 |
+
* @param message Message to display on error.
|
| 469 |
+
*/
|
| 470 |
+
equal<T>(actual: T, expected: T, message?: string): void;
|
| 471 |
+
|
| 472 |
+
/**
|
| 473 |
+
* Asserts non-strict inequality (!=) of actual and expected.
|
| 474 |
+
*
|
| 475 |
+
* T Type of the objects.
|
| 476 |
+
* @param actual Actual value.
|
| 477 |
+
* @param expected Potential expected value.
|
| 478 |
+
* @param message Message to display on error.
|
| 479 |
+
*/
|
| 480 |
+
notEqual<T>(actual: T, expected: T, message?: string): void;
|
| 481 |
+
|
| 482 |
+
/**
|
| 483 |
+
* Asserts strict equality (===) of actual and expected.
|
| 484 |
+
*
|
| 485 |
+
* T Type of the objects.
|
| 486 |
+
* @param actual Actual value.
|
| 487 |
+
* @param expected Potential expected value.
|
| 488 |
+
* @param message Message to display on error.
|
| 489 |
+
*/
|
| 490 |
+
strictEqual<T>(actual: T, expected: T, message?: string): void;
|
| 491 |
+
|
| 492 |
+
/**
|
| 493 |
+
* Asserts strict inequality (!==) of actual and expected.
|
| 494 |
+
*
|
| 495 |
+
* T Type of the objects.
|
| 496 |
+
* @param actual Actual value.
|
| 497 |
+
* @param expected Potential expected value.
|
| 498 |
+
* @param message Message to display on error.
|
| 499 |
+
*/
|
| 500 |
+
notStrictEqual<T>(actual: T, expected: T, message?: string): void;
|
| 501 |
+
|
| 502 |
+
/**
|
| 503 |
+
* Asserts that actual is deeply equal to expected.
|
| 504 |
+
*
|
| 505 |
+
* T Type of the objects.
|
| 506 |
+
* @param actual Actual value.
|
| 507 |
+
* @param expected Potential expected value.
|
| 508 |
+
* @param message Message to display on error.
|
| 509 |
+
*/
|
| 510 |
+
deepEqual<T>(actual: T, expected: T, message?: string): void;
|
| 511 |
+
|
| 512 |
+
/**
|
| 513 |
+
* Asserts that actual is not deeply equal to expected.
|
| 514 |
+
*
|
| 515 |
+
* T Type of the objects.
|
| 516 |
+
* @param actual Actual value.
|
| 517 |
+
* @param expected Potential expected value.
|
| 518 |
+
* @param message Message to display on error.
|
| 519 |
+
*/
|
| 520 |
+
notDeepEqual<T>(actual: T, expected: T, message?: string): void;
|
| 521 |
+
|
| 522 |
+
/**
|
| 523 |
+
* Alias to deepEqual
|
| 524 |
+
*
|
| 525 |
+
* T Type of the objects.
|
| 526 |
+
* @param actual Actual value.
|
| 527 |
+
* @param expected Potential expected value.
|
| 528 |
+
* @param message Message to display on error.
|
| 529 |
+
*/
|
| 530 |
+
deepStrictEqual<T>(actual: T, expected: T, message?: string): void;
|
| 531 |
+
|
| 532 |
+
/**
|
| 533 |
+
* Partially matches actual and expected.
|
| 534 |
+
*
|
| 535 |
+
* @param actual Actual value.
|
| 536 |
+
* @param expected Potential subset of the value.
|
| 537 |
+
* @param message Message to display on error.
|
| 538 |
+
*/
|
| 539 |
+
containSubset(val: any, exp: any, msg?: string): void;
|
| 540 |
+
|
| 541 |
+
/**
|
| 542 |
+
* Partially matches actual and expected.
|
| 543 |
+
*
|
| 544 |
+
* @param actual Actual value.
|
| 545 |
+
* @param expected Potential subset of the value.
|
| 546 |
+
* @param message Message to display on error.
|
| 547 |
+
*/
|
| 548 |
+
containsSubset(val: any, exp: any, msg?: string): void;
|
| 549 |
+
|
| 550 |
+
/**
|
| 551 |
+
* No partial match between actual and expected exists.
|
| 552 |
+
*
|
| 553 |
+
* @param actual Actual value.
|
| 554 |
+
* @param expected Potential subset of the value.
|
| 555 |
+
* @param message Message to display on error.
|
| 556 |
+
*/
|
| 557 |
+
doesNotContainSubset(val: any, exp: any, msg?: string): void;
|
| 558 |
+
|
| 559 |
+
/**
|
| 560 |
+
* Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
|
| 561 |
+
*
|
| 562 |
+
* @param valueToCheck Actual value.
|
| 563 |
+
* @param valueToBeAbove Minimum Potential expected value.
|
| 564 |
+
* @param message Message to display on error.
|
| 565 |
+
*/
|
| 566 |
+
isAbove(valueToCheck: number, valueToBeAbove: number, message?: string): void;
|
| 567 |
+
|
| 568 |
+
/**
|
| 569 |
+
* Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.
|
| 570 |
+
*
|
| 571 |
+
* @param valueToCheck Actual value.
|
| 572 |
+
* @param valueToBeAtLeast Minimum Potential expected value.
|
| 573 |
+
* @param message Message to display on error.
|
| 574 |
+
*/
|
| 575 |
+
isAtLeast(valueToCheck: number, valueToBeAtLeast: number, message?: string): void;
|
| 576 |
+
|
| 577 |
+
/**
|
| 578 |
+
* Asserts valueToCheck is strictly less than (<) valueToBeBelow.
|
| 579 |
+
*
|
| 580 |
+
* @param valueToCheck Actual value.
|
| 581 |
+
* @param valueToBeBelow Minimum Potential expected value.
|
| 582 |
+
* @param message Message to display on error.
|
| 583 |
+
*/
|
| 584 |
+
isBelow(valueToCheck: number, valueToBeBelow: number, message?: string): void;
|
| 585 |
+
|
| 586 |
+
/**
|
| 587 |
+
* Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.
|
| 588 |
+
*
|
| 589 |
+
* @param valueToCheck Actual value.
|
| 590 |
+
* @param valueToBeAtMost Minimum Potential expected value.
|
| 591 |
+
* @param message Message to display on error.
|
| 592 |
+
*/
|
| 593 |
+
isAtMost(valueToCheck: number, valueToBeAtMost: number, message?: string): void;
|
| 594 |
+
|
| 595 |
+
/**
|
| 596 |
+
* Asserts that value is true.
|
| 597 |
+
*
|
| 598 |
+
* @param value Actual value.
|
| 599 |
+
* @param message Message to display on error.
|
| 600 |
+
*/
|
| 601 |
+
isTrue(value: unknown, message?: string): asserts value is true;
|
| 602 |
+
|
| 603 |
+
/**
|
| 604 |
+
* Asserts that value is false.
|
| 605 |
+
*
|
| 606 |
+
* @param value Actual value.
|
| 607 |
+
* @param message Message to display on error.
|
| 608 |
+
*/
|
| 609 |
+
isFalse(value: unknown, message?: string): asserts value is false;
|
| 610 |
+
|
| 611 |
+
/**
|
| 612 |
+
* Asserts that value is not true.
|
| 613 |
+
*
|
| 614 |
+
* T Type of value.
|
| 615 |
+
* @param value Actual value.
|
| 616 |
+
* @param message Message to display on error.
|
| 617 |
+
*/
|
| 618 |
+
isNotTrue<T>(value: T, message?: string): asserts value is Exclude<T, true>;
|
| 619 |
+
|
| 620 |
+
/**
|
| 621 |
+
* Asserts that value is not false.
|
| 622 |
+
*
|
| 623 |
+
* @param value Actual value.
|
| 624 |
+
* @param message Message to display on error.
|
| 625 |
+
*/
|
| 626 |
+
isNotFalse<T>(value: T, message?: string): asserts value is Exclude<T, false>;
|
| 627 |
+
|
| 628 |
+
/**
|
| 629 |
+
* Asserts that value is null.
|
| 630 |
+
*
|
| 631 |
+
* @param value Actual value.
|
| 632 |
+
* @param message Message to display on error.
|
| 633 |
+
*/
|
| 634 |
+
isNull(value: unknown, message?: string): asserts value is null;
|
| 635 |
+
|
| 636 |
+
/**
|
| 637 |
+
* Asserts that value is not null.
|
| 638 |
+
*
|
| 639 |
+
* T Type of value.
|
| 640 |
+
* @param value Actual value.
|
| 641 |
+
* @param message Message to display on error.
|
| 642 |
+
*/
|
| 643 |
+
isNotNull<T>(value: T, message?: string): asserts value is Exclude<T, null>;
|
| 644 |
+
|
| 645 |
+
/**
|
| 646 |
+
* Asserts that value is NaN.
|
| 647 |
+
*
|
| 648 |
+
* T Type of value.
|
| 649 |
+
* @param value Actual value.
|
| 650 |
+
* @param message Message to display on error.
|
| 651 |
+
*/
|
| 652 |
+
isNaN<T>(value: T, message?: string): void;
|
| 653 |
+
|
| 654 |
+
/**
|
| 655 |
+
* Asserts that value is not NaN.
|
| 656 |
+
*
|
| 657 |
+
* T Type of value.
|
| 658 |
+
* @param value Actual value.
|
| 659 |
+
* @param message Message to display on error.
|
| 660 |
+
*/
|
| 661 |
+
isNotNaN<T>(value: T, message?: string): void;
|
| 662 |
+
|
| 663 |
+
/**
|
| 664 |
+
* Asserts that the target is neither null nor undefined.
|
| 665 |
+
*
|
| 666 |
+
* T Type of value.
|
| 667 |
+
* @param value Actual value.
|
| 668 |
+
* @param message Message to display on error.
|
| 669 |
+
*/
|
| 670 |
+
exists<T>(value: T, message?: string): asserts value is NonNullable<T>;
|
| 671 |
+
|
| 672 |
+
/**
|
| 673 |
+
* Asserts that the target is either null or undefined.
|
| 674 |
+
*
|
| 675 |
+
* @param value Actual value.
|
| 676 |
+
* @param message Message to display on error.
|
| 677 |
+
*/
|
| 678 |
+
notExists(value: unknown, message?: string): asserts value is
|
| 679 |
+
| null
|
| 680 |
+
| undefined;
|
| 681 |
+
|
| 682 |
+
/**
|
| 683 |
+
* Asserts that value is undefined.
|
| 684 |
+
*
|
| 685 |
+
* @param value Actual value.
|
| 686 |
+
* @param message Message to display on error.
|
| 687 |
+
*/
|
| 688 |
+
isUndefined(value: unknown, message?: string): asserts value is undefined;
|
| 689 |
+
|
| 690 |
+
/**
|
| 691 |
+
* Asserts that value is not undefined.
|
| 692 |
+
*
|
| 693 |
+
* T Type of value.
|
| 694 |
+
* @param value Actual value.
|
| 695 |
+
* @param message Message to display on error.
|
| 696 |
+
*/
|
| 697 |
+
isDefined<T>(value: T, message?: string): asserts value is Exclude<T, undefined>;
|
| 698 |
+
|
| 699 |
+
/**
|
| 700 |
+
* Asserts that value is a function.
|
| 701 |
+
*
|
| 702 |
+
* T Type of value.
|
| 703 |
+
* @param value Actual value.
|
| 704 |
+
* @param message Message to display on error.
|
| 705 |
+
*/
|
| 706 |
+
isFunction<T>(value: T, message?: string): void;
|
| 707 |
+
|
| 708 |
+
/**
|
| 709 |
+
* Asserts that value is not a function.
|
| 710 |
+
*
|
| 711 |
+
* T Type of value.
|
| 712 |
+
* @param value Actual value.
|
| 713 |
+
* @param message Message to display on error.
|
| 714 |
+
*/
|
| 715 |
+
isNotFunction<T>(value: T, message?: string): void;
|
| 716 |
+
|
| 717 |
+
/**
|
| 718 |
+
* Asserts that value is an object of type 'Object'
|
| 719 |
+
* (as revealed by Object.prototype.toString).
|
| 720 |
+
*
|
| 721 |
+
* T Type of value.
|
| 722 |
+
* @param value Actual value.
|
| 723 |
+
* @param message Message to display on error.
|
| 724 |
+
* @remarks The assertion does not match subclassed objects.
|
| 725 |
+
*/
|
| 726 |
+
isObject<T>(value: T, message?: string): void;
|
| 727 |
+
|
| 728 |
+
/**
|
| 729 |
+
* Asserts that value is not an object of type 'Object'
|
| 730 |
+
* (as revealed by Object.prototype.toString).
|
| 731 |
+
*
|
| 732 |
+
* T Type of value.
|
| 733 |
+
* @param value Actual value.
|
| 734 |
+
* @param message Message to display on error.
|
| 735 |
+
*/
|
| 736 |
+
isNotObject<T>(value: T, message?: string): void;
|
| 737 |
+
|
| 738 |
+
/**
|
| 739 |
+
* Asserts that value is an array.
|
| 740 |
+
*
|
| 741 |
+
* T Type of value.
|
| 742 |
+
* @param value Actual value.
|
| 743 |
+
* @param message Message to display on error.
|
| 744 |
+
*/
|
| 745 |
+
isArray<T>(value: T, message?: string): void;
|
| 746 |
+
|
| 747 |
+
/**
|
| 748 |
+
* Asserts that value is not an array.
|
| 749 |
+
*
|
| 750 |
+
* T Type of value.
|
| 751 |
+
* @param value Actual value.
|
| 752 |
+
* @param message Message to display on error.
|
| 753 |
+
*/
|
| 754 |
+
isNotArray<T>(value: T, message?: string): void;
|
| 755 |
+
|
| 756 |
+
/**
|
| 757 |
+
* Asserts that value is a string.
|
| 758 |
+
*
|
| 759 |
+
* T Type of value.
|
| 760 |
+
* @param value Actual value.
|
| 761 |
+
* @param message Message to display on error.
|
| 762 |
+
*/
|
| 763 |
+
isString<T>(value: T, message?: string): void;
|
| 764 |
+
|
| 765 |
+
/**
|
| 766 |
+
* Asserts that value is not a string.
|
| 767 |
+
*
|
| 768 |
+
* T Type of value.
|
| 769 |
+
* @param value Actual value.
|
| 770 |
+
* @param message Message to display on error.
|
| 771 |
+
*/
|
| 772 |
+
isNotString<T>(value: T, message?: string): void;
|
| 773 |
+
|
| 774 |
+
/**
|
| 775 |
+
* Asserts that value is a number.
|
| 776 |
+
*
|
| 777 |
+
* T Type of value.
|
| 778 |
+
* @param value Actual value.
|
| 779 |
+
* @param message Message to display on error.
|
| 780 |
+
*/
|
| 781 |
+
isNumber<T>(value: T, message?: string): void;
|
| 782 |
+
|
| 783 |
+
/**
|
| 784 |
+
* Asserts that value is not a number.
|
| 785 |
+
*
|
| 786 |
+
* T Type of value.
|
| 787 |
+
* @param value Actual value.
|
| 788 |
+
* @param message Message to display on error.
|
| 789 |
+
*/
|
| 790 |
+
isNotNumber<T>(value: T, message?: string): void;
|
| 791 |
+
|
| 792 |
+
/**
|
| 793 |
+
* Asserts that value is a finite number.
|
| 794 |
+
* Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
|
| 795 |
+
*
|
| 796 |
+
* T Type of value
|
| 797 |
+
* @param value Actual value
|
| 798 |
+
* @param message Message to display on error.
|
| 799 |
+
*/
|
| 800 |
+
isFinite<T>(value: T, message?: string): void;
|
| 801 |
+
|
| 802 |
+
/**
|
| 803 |
+
* Asserts that value is a boolean.
|
| 804 |
+
*
|
| 805 |
+
* T Type of value.
|
| 806 |
+
* @param value Actual value.
|
| 807 |
+
* @param message Message to display on error.
|
| 808 |
+
*/
|
| 809 |
+
isBoolean<T>(value: T, message?: string): void;
|
| 810 |
+
|
| 811 |
+
/**
|
| 812 |
+
* Asserts that value is not a boolean.
|
| 813 |
+
*
|
| 814 |
+
* T Type of value.
|
| 815 |
+
* @param value Actual value.
|
| 816 |
+
* @param message Message to display on error.
|
| 817 |
+
*/
|
| 818 |
+
isNotBoolean<T>(value: T, message?: string): void;
|
| 819 |
+
|
| 820 |
+
/**
|
| 821 |
+
* Asserts that value's type is name, as determined by Object.prototype.toString.
|
| 822 |
+
*
|
| 823 |
+
* T Type of value.
|
| 824 |
+
* @param value Actual value.
|
| 825 |
+
* @param name Potential expected type name of value.
|
| 826 |
+
* @param message Message to display on error.
|
| 827 |
+
*/
|
| 828 |
+
typeOf<T>(value: T, name: string, message?: string): void;
|
| 829 |
+
|
| 830 |
+
/**
|
| 831 |
+
* Asserts that value's type is not name, as determined by Object.prototype.toString.
|
| 832 |
+
*
|
| 833 |
+
* T Type of value.
|
| 834 |
+
* @param value Actual value.
|
| 835 |
+
* @param name Potential expected type name of value.
|
| 836 |
+
* @param message Message to display on error.
|
| 837 |
+
*/
|
| 838 |
+
notTypeOf<T>(value: T, name: string, message?: string): void;
|
| 839 |
+
|
| 840 |
+
/**
|
| 841 |
+
* Asserts that value is an instance of constructor.
|
| 842 |
+
*
|
| 843 |
+
* T Expected type of value.
|
| 844 |
+
* @param value Actual value.
|
| 845 |
+
* @param constructor Potential expected contructor of value.
|
| 846 |
+
* @param message Message to display on error.
|
| 847 |
+
*/
|
| 848 |
+
instanceOf<T>(
|
| 849 |
+
value: unknown,
|
| 850 |
+
constructor: Constructor<T>,
|
| 851 |
+
message?: string,
|
| 852 |
+
): asserts value is T;
|
| 853 |
+
|
| 854 |
+
/**
|
| 855 |
+
* Asserts that value is not an instance of constructor.
|
| 856 |
+
*
|
| 857 |
+
* T Type of value.
|
| 858 |
+
* U Type that value shouldn't be an instance of.
|
| 859 |
+
* @param value Actual value.
|
| 860 |
+
* @param constructor Potential expected contructor of value.
|
| 861 |
+
* @param message Message to display on error.
|
| 862 |
+
*/
|
| 863 |
+
notInstanceOf<T, U>(value: T, type: Constructor<U>, message?: string): asserts value is Exclude<T, U>;
|
| 864 |
+
|
| 865 |
+
/**
|
| 866 |
+
* Asserts that haystack includes needle.
|
| 867 |
+
*
|
| 868 |
+
* @param haystack Container string.
|
| 869 |
+
* @param needle Potential substring of haystack.
|
| 870 |
+
* @param message Message to display on error.
|
| 871 |
+
*/
|
| 872 |
+
include(haystack: string, needle: string, message?: string): void;
|
| 873 |
+
|
| 874 |
+
/**
|
| 875 |
+
* Asserts that haystack includes needle.
|
| 876 |
+
*
|
| 877 |
+
* T Type of values in haystack.
|
| 878 |
+
* @param haystack Container array, set or map.
|
| 879 |
+
* @param needle Potential value contained in haystack.
|
| 880 |
+
* @param message Message to display on error.
|
| 881 |
+
*/
|
| 882 |
+
include<T>(
|
| 883 |
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
| 884 |
+
needle: T,
|
| 885 |
+
message?: string,
|
| 886 |
+
): void;
|
| 887 |
+
|
| 888 |
+
/**
|
| 889 |
+
* Asserts that haystack includes needle.
|
| 890 |
+
*
|
| 891 |
+
* T Type of values in haystack.
|
| 892 |
+
* @param haystack WeakSet container.
|
| 893 |
+
* @param needle Potential value contained in haystack.
|
| 894 |
+
* @param message Message to display on error.
|
| 895 |
+
*/
|
| 896 |
+
include<T extends object>(haystack: WeakSet<T>, needle: T, message?: string): void;
|
| 897 |
+
|
| 898 |
+
/**
|
| 899 |
+
* Asserts that haystack includes needle.
|
| 900 |
+
*
|
| 901 |
+
* T Type of haystack.
|
| 902 |
+
* @param haystack Object.
|
| 903 |
+
* @param needle Potential subset of the haystack's properties.
|
| 904 |
+
* @param message Message to display on error.
|
| 905 |
+
*/
|
| 906 |
+
include<T>(haystack: T, needle: Partial<T>, message?: string): void;
|
| 907 |
+
|
| 908 |
+
/**
|
| 909 |
+
* Asserts that haystack does not include needle.
|
| 910 |
+
*
|
| 911 |
+
* @param haystack Container string.
|
| 912 |
+
* @param needle Potential substring of haystack.
|
| 913 |
+
* @param message Message to display on error.
|
| 914 |
+
*/
|
| 915 |
+
notInclude(haystack: string, needle: string, message?: string): void;
|
| 916 |
+
|
| 917 |
+
/**
|
| 918 |
+
* Asserts that haystack does not include needle.
|
| 919 |
+
*
|
| 920 |
+
* T Type of values in haystack.
|
| 921 |
+
* @param haystack Container array, set or map.
|
| 922 |
+
* @param needle Potential value contained in haystack.
|
| 923 |
+
* @param message Message to display on error.
|
| 924 |
+
*/
|
| 925 |
+
notInclude<T>(
|
| 926 |
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
| 927 |
+
needle: T,
|
| 928 |
+
message?: string,
|
| 929 |
+
): void;
|
| 930 |
+
|
| 931 |
+
/**
|
| 932 |
+
* Asserts that haystack does not include needle.
|
| 933 |
+
*
|
| 934 |
+
* T Type of values in haystack.
|
| 935 |
+
* @param haystack WeakSet container.
|
| 936 |
+
* @param needle Potential value contained in haystack.
|
| 937 |
+
* @param message Message to display on error.
|
| 938 |
+
*/
|
| 939 |
+
notInclude<T extends object>(haystack: WeakSet<T>, needle: T, message?: string): void;
|
| 940 |
+
|
| 941 |
+
/**
|
| 942 |
+
* Asserts that haystack does not include needle.
|
| 943 |
+
*
|
| 944 |
+
* T Type of haystack.
|
| 945 |
+
* @param haystack Object.
|
| 946 |
+
* @param needle Potential subset of the haystack's properties.
|
| 947 |
+
* @param message Message to display on error.
|
| 948 |
+
*/
|
| 949 |
+
notInclude<T>(haystack: T, needle: Partial<T>, message?: string): void;
|
| 950 |
+
|
| 951 |
+
/**
|
| 952 |
+
* Asserts that haystack includes needle. Deep equality is used.
|
| 953 |
+
*
|
| 954 |
+
* @param haystack Container string.
|
| 955 |
+
* @param needle Potential substring of haystack.
|
| 956 |
+
* @param message Message to display on error.
|
| 957 |
+
*
|
| 958 |
+
* @deprecated Does not have any effect on string. Use {@link Assert#include} instead.
|
| 959 |
+
*/
|
| 960 |
+
deepInclude(haystack: string, needle: string, message?: string): void;
|
| 961 |
+
|
| 962 |
+
/**
|
| 963 |
+
* Asserts that haystack includes needle. Deep equality is used.
|
| 964 |
+
*
|
| 965 |
+
* T Type of values in haystack.
|
| 966 |
+
* @param haystack Container array, set or map.
|
| 967 |
+
* @param needle Potential value contained in haystack.
|
| 968 |
+
* @param message Message to display on error.
|
| 969 |
+
*/
|
| 970 |
+
deepInclude<T>(
|
| 971 |
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
| 972 |
+
needle: T,
|
| 973 |
+
message?: string,
|
| 974 |
+
): void;
|
| 975 |
+
|
| 976 |
+
/**
|
| 977 |
+
* Asserts that haystack includes needle. Deep equality is used.
|
| 978 |
+
*
|
| 979 |
+
* T Type of haystack.
|
| 980 |
+
* @param haystack Object.
|
| 981 |
+
* @param needle Potential subset of the haystack's properties.
|
| 982 |
+
* @param message Message to display on error.
|
| 983 |
+
*/
|
| 984 |
+
deepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void;
|
| 985 |
+
|
| 986 |
+
/**
|
| 987 |
+
* Asserts that haystack does not include needle. Deep equality is used.
|
| 988 |
+
*
|
| 989 |
+
* @param haystack Container string.
|
| 990 |
+
* @param needle Potential substring of haystack.
|
| 991 |
+
* @param message Message to display on error.
|
| 992 |
+
*
|
| 993 |
+
* @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead.
|
| 994 |
+
*/
|
| 995 |
+
notDeepInclude(haystack: string, needle: string, message?: string): void;
|
| 996 |
+
|
| 997 |
+
/**
|
| 998 |
+
* Asserts that haystack does not include needle. Deep equality is used.
|
| 999 |
+
*
|
| 1000 |
+
* T Type of values in haystack.
|
| 1001 |
+
* @param haystack Container array, set or map.
|
| 1002 |
+
* @param needle Potential value contained in haystack.
|
| 1003 |
+
* @param message Message to display on error.
|
| 1004 |
+
*/
|
| 1005 |
+
notDeepInclude<T>(
|
| 1006 |
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
| 1007 |
+
needle: T,
|
| 1008 |
+
message?: string,
|
| 1009 |
+
): void;
|
| 1010 |
+
|
| 1011 |
+
/**
|
| 1012 |
+
* Asserts that haystack does not include needle. Deep equality is used.
|
| 1013 |
+
*
|
| 1014 |
+
* T Type of haystack.
|
| 1015 |
+
* @param haystack Object.
|
| 1016 |
+
* @param needle Potential subset of the haystack's properties.
|
| 1017 |
+
* @param message Message to display on error.
|
| 1018 |
+
*/
|
| 1019 |
+
notDeepInclude<T>(haystack: T, needle: T extends WeakSet<any> ? never : Partial<T>, message?: string): void;
|
| 1020 |
+
|
| 1021 |
+
/**
|
| 1022 |
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.
|
| 1023 |
+
*
|
| 1024 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1025 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
| 1026 |
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
| 1027 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1028 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
| 1029 |
+
*
|
| 1030 |
+
* @param haystack
|
| 1031 |
+
* @param needle
|
| 1032 |
+
* @param message Message to display on error.
|
| 1033 |
+
*/
|
| 1034 |
+
nestedInclude(haystack: any, needle: any, message?: string): void;
|
| 1035 |
+
|
| 1036 |
+
/**
|
| 1037 |
+
* Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object.
|
| 1038 |
+
*
|
| 1039 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1040 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
| 1041 |
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
| 1042 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1043 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
| 1044 |
+
*
|
| 1045 |
+
* @param haystack
|
| 1046 |
+
* @param needle
|
| 1047 |
+
* @param message Message to display on error.
|
| 1048 |
+
*/
|
| 1049 |
+
notNestedInclude(haystack: any, needle: any, message?: string): void;
|
| 1050 |
+
|
| 1051 |
+
/**
|
| 1052 |
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality
|
| 1053 |
+
*
|
| 1054 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1055 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
| 1056 |
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
| 1057 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1058 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
| 1059 |
+
*
|
| 1060 |
+
* @param haystack
|
| 1061 |
+
* @param needle
|
| 1062 |
+
* @param message Message to display on error.
|
| 1063 |
+
*/
|
| 1064 |
+
deepNestedInclude(haystack: any, needle: any, message?: string): void;
|
| 1065 |
+
|
| 1066 |
+
/**
|
| 1067 |
+
* Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality.
|
| 1068 |
+
*
|
| 1069 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1070 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
| 1071 |
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
| 1072 |
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
| 1073 |
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
| 1074 |
+
*
|
| 1075 |
+
* @param haystack
|
| 1076 |
+
* @param needle
|
| 1077 |
+
* @param message Message to display on error.
|
| 1078 |
+
*/
|
| 1079 |
+
notDeepNestedInclude(haystack: any, needle: any, message?: string): void;
|
| 1080 |
+
|
| 1081 |
+
/**
|
| 1082 |
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.
|
| 1083 |
+
*
|
| 1084 |
+
* @param haystack
|
| 1085 |
+
* @param needle
|
| 1086 |
+
* @param message Message to display on error.
|
| 1087 |
+
*/
|
| 1088 |
+
ownInclude(haystack: any, needle: any, message?: string): void;
|
| 1089 |
+
|
| 1090 |
+
/**
|
| 1091 |
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.
|
| 1092 |
+
*
|
| 1093 |
+
* @param haystack
|
| 1094 |
+
* @param needle
|
| 1095 |
+
* @param message Message to display on error.
|
| 1096 |
+
*/
|
| 1097 |
+
notOwnInclude(haystack: any, needle: any, message?: string): void;
|
| 1098 |
+
|
| 1099 |
+
/**
|
| 1100 |
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep
|
| 1101 |
+
*
|
| 1102 |
+
* @param haystack
|
| 1103 |
+
* @param needle
|
| 1104 |
+
* @param message Message to display on error.
|
| 1105 |
+
*/
|
| 1106 |
+
deepOwnInclude(haystack: any, needle: any, message?: string): void;
|
| 1107 |
+
|
| 1108 |
+
/**
|
| 1109 |
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality.
|
| 1110 |
+
*
|
| 1111 |
+
* @param haystack
|
| 1112 |
+
* @param needle
|
| 1113 |
+
* @param message Message to display on error.
|
| 1114 |
+
*/
|
| 1115 |
+
notDeepOwnInclude(haystack: any, needle: any, message?: string): void;
|
| 1116 |
+
|
| 1117 |
+
/**
|
| 1118 |
+
* Asserts that value matches the regular expression regexp.
|
| 1119 |
+
*
|
| 1120 |
+
* @param value Actual value.
|
| 1121 |
+
* @param regexp Potential match of value.
|
| 1122 |
+
* @param message Message to display on error.
|
| 1123 |
+
*/
|
| 1124 |
+
match(value: string, regexp: RegExp, message?: string): void;
|
| 1125 |
+
|
| 1126 |
+
/**
|
| 1127 |
+
* Asserts that value does not match the regular expression regexp.
|
| 1128 |
+
*
|
| 1129 |
+
* @param value Actual value.
|
| 1130 |
+
* @param regexp Potential match of value.
|
| 1131 |
+
* @param message Message to display on error.
|
| 1132 |
+
*/
|
| 1133 |
+
notMatch(expected: any, regexp: RegExp, message?: string): void;
|
| 1134 |
+
|
| 1135 |
+
/**
|
| 1136 |
+
* Asserts that object has a property named by property.
|
| 1137 |
+
*
|
| 1138 |
+
* T Type of object.
|
| 1139 |
+
* @param object Container object.
|
| 1140 |
+
* @param property Potential contained property of object.
|
| 1141 |
+
* @param message Message to display on error.
|
| 1142 |
+
*/
|
| 1143 |
+
property<T>(object: T, property: string, /* keyof T */ message?: string): void;
|
| 1144 |
+
|
| 1145 |
+
/**
|
| 1146 |
+
* Asserts that object does not have a property named by property.
|
| 1147 |
+
*
|
| 1148 |
+
* T Type of object.
|
| 1149 |
+
* @param object Container object.
|
| 1150 |
+
* @param property Potential contained property of object.
|
| 1151 |
+
* @param message Message to display on error.
|
| 1152 |
+
*/
|
| 1153 |
+
notProperty<T>(object: T, property: string, /* keyof T */ message?: string): void;
|
| 1154 |
+
|
| 1155 |
+
/**
|
| 1156 |
+
* Asserts that object has a property named by property, which can be a string
|
| 1157 |
+
* using dot- and bracket-notation for deep reference.
|
| 1158 |
+
*
|
| 1159 |
+
* T Type of object.
|
| 1160 |
+
* @param object Container object.
|
| 1161 |
+
* @param property Potential contained property of object.
|
| 1162 |
+
* @param message Message to display on error.
|
| 1163 |
+
*/
|
| 1164 |
+
deepProperty<T>(object: T, property: string, message?: string): void;
|
| 1165 |
+
|
| 1166 |
+
/**
|
| 1167 |
+
* Asserts that object does not have a property named by property, which can be a
|
| 1168 |
+
* string using dot- and bracket-notation for deep reference.
|
| 1169 |
+
*
|
| 1170 |
+
* T Type of object.
|
| 1171 |
+
* @param object Container object.
|
| 1172 |
+
* @param property Potential contained property of object.
|
| 1173 |
+
* @param message Message to display on error.
|
| 1174 |
+
*/
|
| 1175 |
+
notDeepProperty<T>(object: T, property: string, message?: string): void;
|
| 1176 |
+
|
| 1177 |
+
/**
|
| 1178 |
+
* Asserts that object has a property named by property with value given by value.
|
| 1179 |
+
*
|
| 1180 |
+
* T Type of object.
|
| 1181 |
+
* V Type of value.
|
| 1182 |
+
* @param object Container object.
|
| 1183 |
+
* @param property Potential contained property of object.
|
| 1184 |
+
* @param value Potential expected property value.
|
| 1185 |
+
* @param message Message to display on error.
|
| 1186 |
+
*/
|
| 1187 |
+
propertyVal<T, V>(object: T, property: string, /* keyof T */ value: V, message?: string): void;
|
| 1188 |
+
|
| 1189 |
+
/**
|
| 1190 |
+
* Asserts that object has a property named by property with value given by value.
|
| 1191 |
+
*
|
| 1192 |
+
* T Type of object.
|
| 1193 |
+
* V Type of value.
|
| 1194 |
+
* @param object Container object.
|
| 1195 |
+
* @param property Potential contained property of object.
|
| 1196 |
+
* @param value Potential expected property value.
|
| 1197 |
+
* @param message Message to display on error.
|
| 1198 |
+
*/
|
| 1199 |
+
notPropertyVal<T, V>(object: T, property: string, /* keyof T */ value: V, message?: string): void;
|
| 1200 |
+
|
| 1201 |
+
/**
|
| 1202 |
+
* Asserts that object has a property named by property, which can be a string
|
| 1203 |
+
* using dot- and bracket-notation for deep reference.
|
| 1204 |
+
*
|
| 1205 |
+
* T Type of object.
|
| 1206 |
+
* V Type of value.
|
| 1207 |
+
* @param object Container object.
|
| 1208 |
+
* @param property Potential contained property of object.
|
| 1209 |
+
* @param value Potential expected property value.
|
| 1210 |
+
* @param message Message to display on error.
|
| 1211 |
+
*/
|
| 1212 |
+
deepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void;
|
| 1213 |
+
|
| 1214 |
+
/**
|
| 1215 |
+
* Asserts that object does not have a property named by property, which can be a
|
| 1216 |
+
* string using dot- and bracket-notation for deep reference.
|
| 1217 |
+
*
|
| 1218 |
+
* T Type of object.
|
| 1219 |
+
* V Type of value.
|
| 1220 |
+
* @param object Container object.
|
| 1221 |
+
* @param property Potential contained property of object.
|
| 1222 |
+
* @param value Potential expected property value.
|
| 1223 |
+
* @param message Message to display on error.
|
| 1224 |
+
*/
|
| 1225 |
+
notDeepPropertyVal<T, V>(object: T, property: string, value: V, message?: string): void;
|
| 1226 |
+
|
| 1227 |
+
/**
|
| 1228 |
+
* Asserts that object has a length property with the expected value.
|
| 1229 |
+
*
|
| 1230 |
+
* T Type of object.
|
| 1231 |
+
* @param object Container object.
|
| 1232 |
+
* @param length Potential expected length of object.
|
| 1233 |
+
* @param message Message to display on error.
|
| 1234 |
+
*/
|
| 1235 |
+
lengthOf<T extends { readonly length?: number | undefined } | { readonly size?: number | undefined }>(
|
| 1236 |
+
object: T,
|
| 1237 |
+
length: number,
|
| 1238 |
+
message?: string,
|
| 1239 |
+
): void;
|
| 1240 |
+
|
| 1241 |
+
/**
|
| 1242 |
+
* Asserts that fn will throw an error.
|
| 1243 |
+
*
|
| 1244 |
+
* @param fn Function that may throw.
|
| 1245 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1246 |
+
* @param ignored Ignored parameter.
|
| 1247 |
+
* @param message Message to display on error.
|
| 1248 |
+
*/
|
| 1249 |
+
throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
|
| 1250 |
+
|
| 1251 |
+
/**
|
| 1252 |
+
* Asserts that fn will throw an error.
|
| 1253 |
+
*
|
| 1254 |
+
* @param fn Function that may throw.
|
| 1255 |
+
* @param errorLike Expected error constructor or error instance.
|
| 1256 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1257 |
+
* @param message Message to display on error.
|
| 1258 |
+
*/
|
| 1259 |
+
throw(
|
| 1260 |
+
fn: () => void,
|
| 1261 |
+
errorLike?: ErrorConstructor | Error | null,
|
| 1262 |
+
errMsgMatcher?: RegExp | string | null,
|
| 1263 |
+
message?: string,
|
| 1264 |
+
): void;
|
| 1265 |
+
|
| 1266 |
+
/**
|
| 1267 |
+
* Asserts that fn will throw an error.
|
| 1268 |
+
*
|
| 1269 |
+
* @param fn Function that may throw.
|
| 1270 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1271 |
+
* @param ignored Ignored parameter.
|
| 1272 |
+
* @param message Message to display on error.
|
| 1273 |
+
*/
|
| 1274 |
+
throws(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
|
| 1275 |
+
|
| 1276 |
+
/**
|
| 1277 |
+
* Asserts that fn will throw an error.
|
| 1278 |
+
*
|
| 1279 |
+
* @param fn Function that may throw.
|
| 1280 |
+
* @param errorLike Expected error constructor or error instance.
|
| 1281 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1282 |
+
* @param message Message to display on error.
|
| 1283 |
+
*/
|
| 1284 |
+
throws(
|
| 1285 |
+
fn: () => void,
|
| 1286 |
+
errorLike?: ErrorConstructor | Error | null,
|
| 1287 |
+
errMsgMatcher?: RegExp | string | null,
|
| 1288 |
+
message?: string,
|
| 1289 |
+
): void;
|
| 1290 |
+
|
| 1291 |
+
/**
|
| 1292 |
+
* Asserts that fn will throw an error.
|
| 1293 |
+
*
|
| 1294 |
+
* @param fn Function that may throw.
|
| 1295 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1296 |
+
* @param ignored Ignored parameter.
|
| 1297 |
+
* @param message Message to display on error.
|
| 1298 |
+
*/
|
| 1299 |
+
Throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
|
| 1300 |
+
|
| 1301 |
+
/**
|
| 1302 |
+
* Asserts that fn will throw an error.
|
| 1303 |
+
*
|
| 1304 |
+
* @param fn Function that may throw.
|
| 1305 |
+
* @param errorLike Expected error constructor or error instance.
|
| 1306 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1307 |
+
* @param message Message to display on error.
|
| 1308 |
+
*/
|
| 1309 |
+
Throw(
|
| 1310 |
+
fn: () => void,
|
| 1311 |
+
errorLike?: ErrorConstructor | Error | null,
|
| 1312 |
+
errMsgMatcher?: RegExp | string | null,
|
| 1313 |
+
message?: string,
|
| 1314 |
+
): void;
|
| 1315 |
+
|
| 1316 |
+
/**
|
| 1317 |
+
* Asserts that fn will not throw an error.
|
| 1318 |
+
*
|
| 1319 |
+
* @param fn Function that may throw.
|
| 1320 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1321 |
+
* @param ignored Ignored parameter.
|
| 1322 |
+
* @param message Message to display on error.
|
| 1323 |
+
*/
|
| 1324 |
+
doesNotThrow(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void;
|
| 1325 |
+
|
| 1326 |
+
/**
|
| 1327 |
+
* Asserts that fn will not throw an error.
|
| 1328 |
+
*
|
| 1329 |
+
* @param fn Function that may throw.
|
| 1330 |
+
* @param errorLike Expected error constructor or error instance.
|
| 1331 |
+
* @param errMsgMatcher Expected error message matcher.
|
| 1332 |
+
* @param message Message to display on error.
|
| 1333 |
+
*/
|
| 1334 |
+
doesNotThrow(
|
| 1335 |
+
fn: () => void,
|
| 1336 |
+
errorLike?: ErrorConstructor | Error | null,
|
| 1337 |
+
errMsgMatcher?: RegExp | string | null,
|
| 1338 |
+
message?: string,
|
| 1339 |
+
): void;
|
| 1340 |
+
|
| 1341 |
+
/**
|
| 1342 |
+
* Compares two values using operator.
|
| 1343 |
+
*
|
| 1344 |
+
* @param val1 Left value during comparison.
|
| 1345 |
+
* @param operator Comparison operator.
|
| 1346 |
+
* @param val2 Right value during comparison.
|
| 1347 |
+
* @param message Message to display on error.
|
| 1348 |
+
*/
|
| 1349 |
+
operator(val1: OperatorComparable, operator: Operator, val2: OperatorComparable, message?: string): void;
|
| 1350 |
+
|
| 1351 |
+
/**
|
| 1352 |
+
* Asserts that the target is equal to expected, to within a +/- delta range.
|
| 1353 |
+
*
|
| 1354 |
+
* @param actual Actual value
|
| 1355 |
+
* @param expected Potential expected value.
|
| 1356 |
+
* @param delta Maximum differenced between values.
|
| 1357 |
+
* @param message Message to display on error.
|
| 1358 |
+
*/
|
| 1359 |
+
closeTo(actual: number, expected: number, delta: number, message?: string): void;
|
| 1360 |
+
|
| 1361 |
+
/**
|
| 1362 |
+
* Asserts that the target is equal to expected, to within a +/- delta range.
|
| 1363 |
+
*
|
| 1364 |
+
* @param actual Actual value
|
| 1365 |
+
* @param expected Potential expected value.
|
| 1366 |
+
* @param delta Maximum differenced between values.
|
| 1367 |
+
* @param message Message to display on error.
|
| 1368 |
+
*/
|
| 1369 |
+
approximately(act: number, exp: number, delta: number, message?: string): void;
|
| 1370 |
+
|
| 1371 |
+
/**
|
| 1372 |
+
* Asserts that set1 and set2 have the same members. Order is not take into account.
|
| 1373 |
+
*
|
| 1374 |
+
* T Type of set values.
|
| 1375 |
+
* @param set1 Actual set of values.
|
| 1376 |
+
* @param set2 Potential expected set of values.
|
| 1377 |
+
* @param message Message to display on error.
|
| 1378 |
+
*/
|
| 1379 |
+
sameMembers<T>(set1: T[], set2: T[], message?: string): void;
|
| 1380 |
+
|
| 1381 |
+
/**
|
| 1382 |
+
* Asserts that set1 and set2 have the same members using deep equality checking.
|
| 1383 |
+
* Order is not take into account.
|
| 1384 |
+
*
|
| 1385 |
+
* T Type of set values.
|
| 1386 |
+
* @param set1 Actual set of values.
|
| 1387 |
+
* @param set2 Potential expected set of values.
|
| 1388 |
+
* @param message Message to display on error.
|
| 1389 |
+
*/
|
| 1390 |
+
sameDeepMembers<T>(set1: T[], set2: T[], message?: string): void;
|
| 1391 |
+
|
| 1392 |
+
/**
|
| 1393 |
+
* Asserts that `set1` and `set2` don't have the same members in any order.
|
| 1394 |
+
* Uses a deep equality check.
|
| 1395 |
+
*
|
| 1396 |
+
* T Type of set values.
|
| 1397 |
+
* @param set1
|
| 1398 |
+
* @param set2
|
| 1399 |
+
* @param message
|
| 1400 |
+
*/
|
| 1401 |
+
notSameDeepMembers<T>(set1: T[], set2: T[], message?: string): void;
|
| 1402 |
+
|
| 1403 |
+
/**
|
| 1404 |
+
* Asserts that set1 and set2 have the same members in the same order.
|
| 1405 |
+
* Uses a strict equality check (===).
|
| 1406 |
+
*
|
| 1407 |
+
* T Type of set values.
|
| 1408 |
+
* @param set1 Actual set of values.
|
| 1409 |
+
* @param set2 Potential expected set of values.
|
| 1410 |
+
* @param message Message to display on error.
|
| 1411 |
+
*/
|
| 1412 |
+
sameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
|
| 1413 |
+
|
| 1414 |
+
/**
|
| 1415 |
+
* Asserts that set1 and set2 don’t have the same members in the same order.
|
| 1416 |
+
* Uses a strict equality check (===).
|
| 1417 |
+
*
|
| 1418 |
+
* T Type of set values.
|
| 1419 |
+
* @param set1 Actual set of values.
|
| 1420 |
+
* @param set2 Potential expected set of values.
|
| 1421 |
+
* @param message Message to display on error.
|
| 1422 |
+
*/
|
| 1423 |
+
notSameOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
|
| 1424 |
+
|
| 1425 |
+
/**
|
| 1426 |
+
* Asserts that set1 and set2 have the same members in the same order.
|
| 1427 |
+
* Uses a deep equality check.
|
| 1428 |
+
*
|
| 1429 |
+
* T Type of set values.
|
| 1430 |
+
* @param set1 Actual set of values.
|
| 1431 |
+
* @param set2 Potential expected set of values.
|
| 1432 |
+
* @param message Message to display on error.
|
| 1433 |
+
*/
|
| 1434 |
+
sameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
|
| 1435 |
+
|
| 1436 |
+
/**
|
| 1437 |
+
* Asserts that set1 and set2 don’t have the same members in the same order.
|
| 1438 |
+
* Uses a deep equality check.
|
| 1439 |
+
*
|
| 1440 |
+
* T Type of set values.
|
| 1441 |
+
* @param set1 Actual set of values.
|
| 1442 |
+
* @param set2 Potential expected set of values.
|
| 1443 |
+
* @param message Message to display on error.
|
| 1444 |
+
*/
|
| 1445 |
+
notSameDeepOrderedMembers<T>(set1: T[], set2: T[], message?: string): void;
|
| 1446 |
+
|
| 1447 |
+
/**
|
| 1448 |
+
* Asserts that subset is included in superset in the same order beginning with the first element in superset.
|
| 1449 |
+
* Uses a strict equality check (===).
|
| 1450 |
+
*
|
| 1451 |
+
* T Type of set values.
|
| 1452 |
+
* @param superset Actual set of values.
|
| 1453 |
+
* @param subset Potential contained set of values.
|
| 1454 |
+
* @param message Message to display on error.
|
| 1455 |
+
*/
|
| 1456 |
+
includeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1457 |
+
|
| 1458 |
+
/**
|
| 1459 |
+
* Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
|
| 1460 |
+
* Uses a strict equality check (===).
|
| 1461 |
+
*
|
| 1462 |
+
* T Type of set values.
|
| 1463 |
+
* @param superset Actual set of values.
|
| 1464 |
+
* @param subset Potential contained set of values.
|
| 1465 |
+
* @param message Message to display on error.
|
| 1466 |
+
*/
|
| 1467 |
+
notIncludeOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1468 |
+
|
| 1469 |
+
/**
|
| 1470 |
+
* Asserts that subset is included in superset in the same order beginning with the first element in superset.
|
| 1471 |
+
* Uses a deep equality check.
|
| 1472 |
+
*
|
| 1473 |
+
* T Type of set values.
|
| 1474 |
+
* @param superset Actual set of values.
|
| 1475 |
+
* @param subset Potential contained set of values.
|
| 1476 |
+
* @param message Message to display on error.
|
| 1477 |
+
*/
|
| 1478 |
+
includeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1479 |
+
|
| 1480 |
+
/**
|
| 1481 |
+
* Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
|
| 1482 |
+
* Uses a deep equality check.
|
| 1483 |
+
*
|
| 1484 |
+
* T Type of set values.
|
| 1485 |
+
* @param superset Actual set of values.
|
| 1486 |
+
* @param subset Potential contained set of values.
|
| 1487 |
+
* @param message Message to display on error.
|
| 1488 |
+
*/
|
| 1489 |
+
notIncludeDeepOrderedMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1490 |
+
|
| 1491 |
+
/**
|
| 1492 |
+
* Asserts that subset is included in superset. Order is not take into account.
|
| 1493 |
+
*
|
| 1494 |
+
* T Type of set values.
|
| 1495 |
+
* @param superset Actual set of values.
|
| 1496 |
+
* @param subset Potential contained set of values.
|
| 1497 |
+
* @param message Message to display on error.
|
| 1498 |
+
*/
|
| 1499 |
+
includeMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1500 |
+
|
| 1501 |
+
/**
|
| 1502 |
+
* Asserts that subset isn’t included in superset in any order.
|
| 1503 |
+
* Uses a strict equality check (===). Duplicates are ignored.
|
| 1504 |
+
*
|
| 1505 |
+
* T Type of set values.
|
| 1506 |
+
* @param superset Actual set of values.
|
| 1507 |
+
* @param subset Potential not contained set of values.
|
| 1508 |
+
* @param message Message to display on error.
|
| 1509 |
+
*/
|
| 1510 |
+
notIncludeMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1511 |
+
|
| 1512 |
+
/**
|
| 1513 |
+
* Asserts that subset is included in superset using deep equality checking.
|
| 1514 |
+
* Order is not take into account.
|
| 1515 |
+
*
|
| 1516 |
+
* T Type of set values.
|
| 1517 |
+
* @param superset Actual set of values.
|
| 1518 |
+
* @param subset Potential contained set of values.
|
| 1519 |
+
* @param message Message to display on error.
|
| 1520 |
+
*/
|
| 1521 |
+
includeDeepMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1522 |
+
|
| 1523 |
+
/**
|
| 1524 |
+
* Asserts that `subset` isn't included in `superset` in any order. Uses a
|
| 1525 |
+
* deep equality check. Duplicates are ignored.
|
| 1526 |
+
*
|
| 1527 |
+
* assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members');
|
| 1528 |
+
*
|
| 1529 |
+
* T Type of set values.
|
| 1530 |
+
* @param superset Actual set of values.
|
| 1531 |
+
* @param subset Potential contained set of values.
|
| 1532 |
+
* @param message Message to display on error.
|
| 1533 |
+
*/
|
| 1534 |
+
notIncludeDeepMembers<T>(superset: T[], subset: T[], message?: string): void;
|
| 1535 |
+
|
| 1536 |
+
/**
|
| 1537 |
+
* Asserts that non-object, non-array value inList appears in the flat array list.
|
| 1538 |
+
*
|
| 1539 |
+
* T Type of list values.
|
| 1540 |
+
* @param inList Value expected to be in the list.
|
| 1541 |
+
* @param list List of values.
|
| 1542 |
+
* @param message Message to display on error.
|
| 1543 |
+
*/
|
| 1544 |
+
oneOf<T>(inList: T, list: T[], message?: string): void;
|
| 1545 |
+
|
| 1546 |
+
/**
|
| 1547 |
+
* Asserts that a function changes the value of a property.
|
| 1548 |
+
*
|
| 1549 |
+
* T Type of object.
|
| 1550 |
+
* @param modifier Function to run.
|
| 1551 |
+
* @param object Container object.
|
| 1552 |
+
* @param property Property of object expected to be modified.
|
| 1553 |
+
* @param message Message to display on error.
|
| 1554 |
+
*/
|
| 1555 |
+
changes<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
|
| 1556 |
+
|
| 1557 |
+
/**
|
| 1558 |
+
* Asserts that a function changes the value of a property by an amount (delta).
|
| 1559 |
+
*
|
| 1560 |
+
* @param modifier function
|
| 1561 |
+
* @param object or getter function
|
| 1562 |
+
* @param property name _optional_
|
| 1563 |
+
* @param change amount (delta)
|
| 1564 |
+
* @param message _optional_
|
| 1565 |
+
*/
|
| 1566 |
+
changesBy<T>(
|
| 1567 |
+
modifier: Function,
|
| 1568 |
+
object: T,
|
| 1569 |
+
property: string,
|
| 1570 |
+
/* keyof T */ change: number,
|
| 1571 |
+
message?: string,
|
| 1572 |
+
): void;
|
| 1573 |
+
changesBy<T>(modifier: Function, object: T, change: number, message?: string): void;
|
| 1574 |
+
|
| 1575 |
+
/**
|
| 1576 |
+
* Asserts that a function does not change the value of a property.
|
| 1577 |
+
*
|
| 1578 |
+
* T Type of object.
|
| 1579 |
+
* @param modifier Function to run.
|
| 1580 |
+
* @param object Container object.
|
| 1581 |
+
* @param property Property of object expected not to be modified.
|
| 1582 |
+
* @param message Message to display on error.
|
| 1583 |
+
*/
|
| 1584 |
+
doesNotChange<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
|
| 1585 |
+
|
| 1586 |
+
/**
|
| 1587 |
+
* Asserts that a function increases an object property.
|
| 1588 |
+
*
|
| 1589 |
+
* T Type of object.
|
| 1590 |
+
* @param modifier Function to run.
|
| 1591 |
+
* @param object Container object.
|
| 1592 |
+
* @param property Property of object expected to be increased.
|
| 1593 |
+
* @param message Message to display on error.
|
| 1594 |
+
*/
|
| 1595 |
+
increases<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
|
| 1596 |
+
|
| 1597 |
+
/**
|
| 1598 |
+
* Asserts that a function increases a numeric object property or a function's return value by an amount (delta).
|
| 1599 |
+
*
|
| 1600 |
+
* T Type of object or function.
|
| 1601 |
+
* @param modifier function
|
| 1602 |
+
* @param object or getter function
|
| 1603 |
+
* @param property name _optional_
|
| 1604 |
+
* @param change amount (delta)
|
| 1605 |
+
* @param message _optional_
|
| 1606 |
+
*/
|
| 1607 |
+
increasesBy<T>(
|
| 1608 |
+
modifier: Function,
|
| 1609 |
+
object: T,
|
| 1610 |
+
property: string,
|
| 1611 |
+
/* keyof T */ change: number,
|
| 1612 |
+
message?: string,
|
| 1613 |
+
): void;
|
| 1614 |
+
increasesBy<T>(modifier: Function, object: T, change: number, message?: string): void;
|
| 1615 |
+
|
| 1616 |
+
/**
|
| 1617 |
+
* Asserts that a function does not increase an object property.
|
| 1618 |
+
*
|
| 1619 |
+
* T Type of object.
|
| 1620 |
+
* @param modifier Function to run.
|
| 1621 |
+
* @param object Container object.
|
| 1622 |
+
* @param property Property of object expected not to be increased.
|
| 1623 |
+
* @param message Message to display on error.
|
| 1624 |
+
*/
|
| 1625 |
+
doesNotIncrease<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
|
| 1626 |
+
|
| 1627 |
+
/**
|
| 1628 |
+
* Asserts that a function does not increase a numeric object property or function's return value by an amount (delta).
|
| 1629 |
+
*
|
| 1630 |
+
* T Type of object or function.
|
| 1631 |
+
* @param modifier function
|
| 1632 |
+
* @param object or getter function
|
| 1633 |
+
* @param property name _optional_
|
| 1634 |
+
* @param change amount (delta)
|
| 1635 |
+
* @param message _optional_
|
| 1636 |
+
*/
|
| 1637 |
+
|
| 1638 |
+
increasesButNotBy<T>(
|
| 1639 |
+
modifier: Function,
|
| 1640 |
+
object: T,
|
| 1641 |
+
property: string,
|
| 1642 |
+
/* keyof T */ change: number,
|
| 1643 |
+
message?: string,
|
| 1644 |
+
): void;
|
| 1645 |
+
increasesButNotBy<T>(modifier: Function, object: T, change: number, message?: string): void;
|
| 1646 |
+
|
| 1647 |
+
/**
|
| 1648 |
+
* Asserts that a function decreases an object property.
|
| 1649 |
+
*
|
| 1650 |
+
* T Type of object.
|
| 1651 |
+
* @param modifier Function to run.
|
| 1652 |
+
* @param object Container object.
|
| 1653 |
+
* @param property Property of object expected to be decreased.
|
| 1654 |
+
* @param message Message to display on error.
|
| 1655 |
+
*/
|
| 1656 |
+
decreases<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
|
| 1657 |
+
|
| 1658 |
+
/**
|
| 1659 |
+
* Asserts that a function decreases a numeric object property or a function's return value by an amount (delta)
|
| 1660 |
+
*
|
| 1661 |
+
* T Type of object or function.
|
| 1662 |
+
* @param modifier function
|
| 1663 |
+
* @param object or getter function
|
| 1664 |
+
* @param property name _optional_
|
| 1665 |
+
* @param change amount (delta)
|
| 1666 |
+
* @param message _optional_
|
| 1667 |
+
*/
|
| 1668 |
+
|
| 1669 |
+
decreasesBy<T>(
|
| 1670 |
+
modifier: Function,
|
| 1671 |
+
object: T,
|
| 1672 |
+
property: string,
|
| 1673 |
+
/* keyof T */ change: number,
|
| 1674 |
+
message?: string,
|
| 1675 |
+
): void;
|
| 1676 |
+
decreasesBy<T>(modifier: Function, object: T, change: number, message?: string): void;
|
| 1677 |
+
|
| 1678 |
+
/**
|
| 1679 |
+
* Asserts that a function does not decrease an object property.
|
| 1680 |
+
*
|
| 1681 |
+
* T Type of object.
|
| 1682 |
+
* @param modifier Function to run.
|
| 1683 |
+
* @param object Container object.
|
| 1684 |
+
* @param property Property of object expected not to be decreased.
|
| 1685 |
+
* @param message Message to display on error.
|
| 1686 |
+
*/
|
| 1687 |
+
doesNotDecrease<T>(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void;
|
| 1688 |
+
|
| 1689 |
+
/**
|
| 1690 |
+
* Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
|
| 1691 |
+
*
|
| 1692 |
+
* T Type of object or function.
|
| 1693 |
+
* @param modifier function
|
| 1694 |
+
* @param object or getter function
|
| 1695 |
+
* @param property name _optional_
|
| 1696 |
+
* @param change amount (delta)
|
| 1697 |
+
* @param message _optional_
|
| 1698 |
+
*/
|
| 1699 |
+
|
| 1700 |
+
doesNotDecreaseBy<T>(
|
| 1701 |
+
modifier: Function,
|
| 1702 |
+
object: T,
|
| 1703 |
+
property: string,
|
| 1704 |
+
/* keyof T */ change: number,
|
| 1705 |
+
message?: string,
|
| 1706 |
+
): void;
|
| 1707 |
+
doesNotDecreaseBy<T>(modifier: Function, object: T, change: number, message?: string): void;
|
| 1708 |
+
|
| 1709 |
+
/**
|
| 1710 |
+
* Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
|
| 1711 |
+
*
|
| 1712 |
+
* T Type of object or function.
|
| 1713 |
+
* @param modifier function
|
| 1714 |
+
* @param object or getter function
|
| 1715 |
+
* @param property name _optional_
|
| 1716 |
+
* @param change amount (delta)
|
| 1717 |
+
* @param message _optional_
|
| 1718 |
+
*/
|
| 1719 |
+
|
| 1720 |
+
decreasesButNotBy<T>(
|
| 1721 |
+
modifier: Function,
|
| 1722 |
+
object: T,
|
| 1723 |
+
property: string,
|
| 1724 |
+
/* keyof T */ change: number,
|
| 1725 |
+
message?: string,
|
| 1726 |
+
): void;
|
| 1727 |
+
decreasesButNotBy<T>(modifier: Function, object: T, change: number, message?: string): void;
|
| 1728 |
+
|
| 1729 |
+
/**
|
| 1730 |
+
* Asserts if value is not a false value, and throws if it is a true value.
|
| 1731 |
+
*
|
| 1732 |
+
* T Type of object.
|
| 1733 |
+
* @param object Actual value.
|
| 1734 |
+
* @param message Message to display on error.
|
| 1735 |
+
* @remarks This is added to allow for chai to be a drop-in replacement for
|
| 1736 |
+
* Node’s assert class.
|
| 1737 |
+
*/
|
| 1738 |
+
ifError<T>(object: T, message?: string): void;
|
| 1739 |
+
|
| 1740 |
+
/**
|
| 1741 |
+
* Asserts that object is extensible (can have new properties added to it).
|
| 1742 |
+
*
|
| 1743 |
+
* T Type of object
|
| 1744 |
+
* @param object Actual value.
|
| 1745 |
+
* @param message Message to display on error.
|
| 1746 |
+
*/
|
| 1747 |
+
isExtensible<T>(object: T, message?: string): void;
|
| 1748 |
+
|
| 1749 |
+
/**
|
| 1750 |
+
* Asserts that object is extensible (can have new properties added to it).
|
| 1751 |
+
*
|
| 1752 |
+
* T Type of object
|
| 1753 |
+
* @param object Actual value.
|
| 1754 |
+
* @param message Message to display on error.
|
| 1755 |
+
*/
|
| 1756 |
+
extensible<T>(object: T, message?: string): void;
|
| 1757 |
+
|
| 1758 |
+
/**
|
| 1759 |
+
* Asserts that object is not extensible.
|
| 1760 |
+
*
|
| 1761 |
+
* T Type of object
|
| 1762 |
+
* @param object Actual value.
|
| 1763 |
+
* @param message Message to display on error.
|
| 1764 |
+
*/
|
| 1765 |
+
isNotExtensible<T>(object: T, message?: string): void;
|
| 1766 |
+
|
| 1767 |
+
/**
|
| 1768 |
+
* Asserts that object is not extensible.
|
| 1769 |
+
*
|
| 1770 |
+
* T Type of object
|
| 1771 |
+
* @param object Actual value.
|
| 1772 |
+
* @param message Message to display on error.
|
| 1773 |
+
*/
|
| 1774 |
+
notExtensible<T>(object: T, message?: string): void;
|
| 1775 |
+
|
| 1776 |
+
/**
|
| 1777 |
+
* Asserts that object is sealed (can have new properties added to it
|
| 1778 |
+
* and its existing properties cannot be removed).
|
| 1779 |
+
*
|
| 1780 |
+
* T Type of object
|
| 1781 |
+
* @param object Actual value.
|
| 1782 |
+
* @param message Message to display on error.
|
| 1783 |
+
*/
|
| 1784 |
+
isSealed<T>(object: T, message?: string): void;
|
| 1785 |
+
|
| 1786 |
+
/**
|
| 1787 |
+
* Asserts that object is sealed (can have new properties added to it
|
| 1788 |
+
* and its existing properties cannot be removed).
|
| 1789 |
+
*
|
| 1790 |
+
* T Type of object
|
| 1791 |
+
* @param object Actual value.
|
| 1792 |
+
* @param message Message to display on error.
|
| 1793 |
+
*/
|
| 1794 |
+
sealed<T>(object: T, message?: string): void;
|
| 1795 |
+
|
| 1796 |
+
/**
|
| 1797 |
+
* Asserts that object is not sealed.
|
| 1798 |
+
*
|
| 1799 |
+
* T Type of object
|
| 1800 |
+
* @param object Actual value.
|
| 1801 |
+
* @param message Message to display on error.
|
| 1802 |
+
*/
|
| 1803 |
+
isNotSealed<T>(object: T, message?: string): void;
|
| 1804 |
+
|
| 1805 |
+
/**
|
| 1806 |
+
* Asserts that object is not sealed.
|
| 1807 |
+
*
|
| 1808 |
+
* T Type of object
|
| 1809 |
+
* @param object Actual value.
|
| 1810 |
+
* @param message Message to display on error.
|
| 1811 |
+
*/
|
| 1812 |
+
notSealed<T>(object: T, message?: string): void;
|
| 1813 |
+
|
| 1814 |
+
/**
|
| 1815 |
+
* Asserts that object is frozen (cannot have new properties added to it
|
| 1816 |
+
* and its existing properties cannot be removed).
|
| 1817 |
+
*
|
| 1818 |
+
* T Type of object
|
| 1819 |
+
* @param object Actual value.
|
| 1820 |
+
* @param message Message to display on error.
|
| 1821 |
+
*/
|
| 1822 |
+
isFrozen<T>(object: T, message?: string): void;
|
| 1823 |
+
|
| 1824 |
+
/**
|
| 1825 |
+
* Asserts that object is frozen (cannot have new properties added to it
|
| 1826 |
+
* and its existing properties cannot be removed).
|
| 1827 |
+
*
|
| 1828 |
+
* T Type of object
|
| 1829 |
+
* @param object Actual value.
|
| 1830 |
+
* @param message Message to display on error.
|
| 1831 |
+
*/
|
| 1832 |
+
frozen<T>(object: T, message?: string): void;
|
| 1833 |
+
|
| 1834 |
+
/**
|
| 1835 |
+
* Asserts that object is not frozen (cannot have new properties added to it
|
| 1836 |
+
* and its existing properties cannot be removed).
|
| 1837 |
+
*
|
| 1838 |
+
* T Type of object
|
| 1839 |
+
* @param object Actual value.
|
| 1840 |
+
* @param message Message to display on error.
|
| 1841 |
+
*/
|
| 1842 |
+
isNotFrozen<T>(object: T, message?: string): void;
|
| 1843 |
+
|
| 1844 |
+
/**
|
| 1845 |
+
* Asserts that object is not frozen (cannot have new properties added to it
|
| 1846 |
+
* and its existing properties cannot be removed).
|
| 1847 |
+
*
|
| 1848 |
+
* T Type of object
|
| 1849 |
+
* @param object Actual value.
|
| 1850 |
+
* @param message Message to display on error.
|
| 1851 |
+
*/
|
| 1852 |
+
notFrozen<T>(object: T, message?: string): void;
|
| 1853 |
+
|
| 1854 |
+
/**
|
| 1855 |
+
* Asserts that the target does not contain any values. For arrays and
|
| 1856 |
+
* strings, it checks the length property. For Map and Set instances, it
|
| 1857 |
+
* checks the size property. For non-function objects, it gets the count
|
| 1858 |
+
* of own enumerable string keys.
|
| 1859 |
+
*
|
| 1860 |
+
* T Type of object
|
| 1861 |
+
* @param object Actual value.
|
| 1862 |
+
* @param message Message to display on error.
|
| 1863 |
+
*/
|
| 1864 |
+
isEmpty<T>(object: T, message?: string): void;
|
| 1865 |
+
|
| 1866 |
+
/**
|
| 1867 |
+
* Asserts that the target contains values. For arrays and strings, it checks
|
| 1868 |
+
* the length property. For Map and Set instances, it checks the size property.
|
| 1869 |
+
* For non-function objects, it gets the count of own enumerable string keys.
|
| 1870 |
+
*
|
| 1871 |
+
* T Type of object.
|
| 1872 |
+
* @param object Object to test.
|
| 1873 |
+
* @param message Message to display on error.
|
| 1874 |
+
*/
|
| 1875 |
+
isNotEmpty<T>(object: T, message?: string): void;
|
| 1876 |
+
|
| 1877 |
+
/**
|
| 1878 |
+
* Asserts that `object` has at least one of the `keys` provided.
|
| 1879 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1880 |
+
* will be used as the expected set of keys.
|
| 1881 |
+
*
|
| 1882 |
+
* T Type of object.
|
| 1883 |
+
* @param object Object to test.
|
| 1884 |
+
* @param keys Keys to check
|
| 1885 |
+
* @param message Message to display on error.
|
| 1886 |
+
*/
|
| 1887 |
+
hasAnyKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
|
| 1888 |
+
|
| 1889 |
+
/**
|
| 1890 |
+
* Asserts that `object` has all and only all of the `keys` provided.
|
| 1891 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1892 |
+
* will be used as the expected set of keys.
|
| 1893 |
+
*
|
| 1894 |
+
* T Type of object.
|
| 1895 |
+
* @param object Object to test.
|
| 1896 |
+
* @param keys Keys to check
|
| 1897 |
+
* @param message Message to display on error.
|
| 1898 |
+
*/
|
| 1899 |
+
hasAllKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
|
| 1900 |
+
|
| 1901 |
+
/**
|
| 1902 |
+
* Asserts that `object` has all of the `keys` provided but may have more keys not listed.
|
| 1903 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1904 |
+
* will be used as the expected set of keys.
|
| 1905 |
+
*
|
| 1906 |
+
* T Type of object.
|
| 1907 |
+
* @param object Object to test.
|
| 1908 |
+
* @param keys Keys to check
|
| 1909 |
+
* @param message Message to display on error.
|
| 1910 |
+
*/
|
| 1911 |
+
containsAllKeys<T>(
|
| 1912 |
+
object: T,
|
| 1913 |
+
keys: Array<Object | string> | { [key: string]: any },
|
| 1914 |
+
message?: string,
|
| 1915 |
+
): void;
|
| 1916 |
+
|
| 1917 |
+
/**
|
| 1918 |
+
* Asserts that `object` has none of the `keys` provided.
|
| 1919 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1920 |
+
* will be used as the expected set of keys.
|
| 1921 |
+
*
|
| 1922 |
+
* T Type of object.
|
| 1923 |
+
* @param object Object to test.
|
| 1924 |
+
* @param keys Keys to check
|
| 1925 |
+
* @param message Message to display on error.
|
| 1926 |
+
*/
|
| 1927 |
+
doesNotHaveAnyKeys<T>(
|
| 1928 |
+
object: T,
|
| 1929 |
+
keys: Array<Object | string> | { [key: string]: any },
|
| 1930 |
+
message?: string,
|
| 1931 |
+
): void;
|
| 1932 |
+
|
| 1933 |
+
/**
|
| 1934 |
+
* Asserts that `object` does not have at least one of the `keys` provided.
|
| 1935 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1936 |
+
* will be used as the expected set of keys.
|
| 1937 |
+
*
|
| 1938 |
+
* T Type of object.
|
| 1939 |
+
* @param object Object to test.
|
| 1940 |
+
* @param keys Keys to check
|
| 1941 |
+
* @param message Message to display on error.
|
| 1942 |
+
*/
|
| 1943 |
+
doesNotHaveAllKeys<T>(
|
| 1944 |
+
object: T,
|
| 1945 |
+
keys: Array<Object | string> | { [key: string]: any },
|
| 1946 |
+
message?: string,
|
| 1947 |
+
): void;
|
| 1948 |
+
|
| 1949 |
+
/**
|
| 1950 |
+
* Asserts that `object` has at least one of the `keys` provided.
|
| 1951 |
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
| 1952 |
+
* a deep comparison.
|
| 1953 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1954 |
+
* will be used as the expected set of keys.
|
| 1955 |
+
*
|
| 1956 |
+
* T Type of object.
|
| 1957 |
+
* @param object Object to test.
|
| 1958 |
+
* @param keys Keys to check
|
| 1959 |
+
* @param message Message to display on error.
|
| 1960 |
+
*/
|
| 1961 |
+
hasAnyDeepKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
|
| 1962 |
+
|
| 1963 |
+
/**
|
| 1964 |
+
* Asserts that `object` has all and only all of the `keys` provided.
|
| 1965 |
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
| 1966 |
+
* a deep comparison.
|
| 1967 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1968 |
+
* will be used as the expected set of keys.
|
| 1969 |
+
*
|
| 1970 |
+
* T Type of object.
|
| 1971 |
+
* @param object Object to test.
|
| 1972 |
+
* @param keys Keys to check
|
| 1973 |
+
* @param message Message to display on error.
|
| 1974 |
+
*/
|
| 1975 |
+
hasAllDeepKeys<T>(object: T, keys: Array<Object | string> | { [key: string]: any }, message?: string): void;
|
| 1976 |
+
|
| 1977 |
+
/**
|
| 1978 |
+
* Asserts that `object` contains all of the `keys` provided.
|
| 1979 |
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
| 1980 |
+
* a deep comparison.
|
| 1981 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 1982 |
+
* will be used as the expected set of keys.
|
| 1983 |
+
*
|
| 1984 |
+
* T Type of object.
|
| 1985 |
+
* @param object Object to test.
|
| 1986 |
+
* @param keys Keys to check
|
| 1987 |
+
* @param message Message to display on error.
|
| 1988 |
+
*/
|
| 1989 |
+
containsAllDeepKeys<T>(
|
| 1990 |
+
object: T,
|
| 1991 |
+
keys: Array<Object | string> | { [key: string]: any },
|
| 1992 |
+
message?: string,
|
| 1993 |
+
): void;
|
| 1994 |
+
|
| 1995 |
+
/**
|
| 1996 |
+
* Asserts that `object` contains all of the `keys` provided.
|
| 1997 |
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
| 1998 |
+
* a deep comparison.
|
| 1999 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 2000 |
+
* will be used as the expected set of keys.
|
| 2001 |
+
*
|
| 2002 |
+
* T Type of object.
|
| 2003 |
+
* @param object Object to test.
|
| 2004 |
+
* @param keys Keys to check
|
| 2005 |
+
* @param message Message to display on error.
|
| 2006 |
+
*/
|
| 2007 |
+
doesNotHaveAnyDeepKeys<T>(
|
| 2008 |
+
object: T,
|
| 2009 |
+
keys: Array<Object | string> | { [key: string]: any },
|
| 2010 |
+
message?: string,
|
| 2011 |
+
): void;
|
| 2012 |
+
|
| 2013 |
+
/**
|
| 2014 |
+
* Asserts that `object` contains all of the `keys` provided.
|
| 2015 |
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
| 2016 |
+
* a deep comparison.
|
| 2017 |
+
* You can also provide a single object instead of a `keys` array and its keys
|
| 2018 |
+
* will be used as the expected set of keys.
|
| 2019 |
+
*
|
| 2020 |
+
* T Type of object.
|
| 2021 |
+
* @param object Object to test.
|
| 2022 |
+
* @param keys Keys to check
|
| 2023 |
+
* @param message Message to display on error.
|
| 2024 |
+
*/
|
| 2025 |
+
doesNotHaveAllDeepKeys<T>(
|
| 2026 |
+
object: T,
|
| 2027 |
+
keys: Array<Object | string> | { [key: string]: any },
|
| 2028 |
+
message?: string,
|
| 2029 |
+
): void;
|
| 2030 |
+
|
| 2031 |
+
/**
|
| 2032 |
+
* Asserts that object has a direct or inherited property named by property,
|
| 2033 |
+
* which can be a string using dot- and bracket-notation for nested reference.
|
| 2034 |
+
*
|
| 2035 |
+
* T Type of object.
|
| 2036 |
+
* @param object Object to test.
|
| 2037 |
+
* @param property Property to test.
|
| 2038 |
+
* @param message Message to display on error.
|
| 2039 |
+
*/
|
| 2040 |
+
nestedProperty<T>(object: T, property: string, message?: string): void;
|
| 2041 |
+
|
| 2042 |
+
/**
|
| 2043 |
+
* Asserts that object does not have a property named by property,
|
| 2044 |
+
* which can be a string using dot- and bracket-notation for nested reference.
|
| 2045 |
+
* The property cannot exist on the object nor anywhere in its prototype chain.
|
| 2046 |
+
*
|
| 2047 |
+
* T Type of object.
|
| 2048 |
+
* @param object Object to test.
|
| 2049 |
+
* @param property Property to test.
|
| 2050 |
+
* @param message Message to display on error.
|
| 2051 |
+
*/
|
| 2052 |
+
notNestedProperty<T>(object: T, property: string, message?: string): void;
|
| 2053 |
+
|
| 2054 |
+
/**
|
| 2055 |
+
* Asserts that object has a property named by property with value given by value.
|
| 2056 |
+
* property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
|
| 2057 |
+
*
|
| 2058 |
+
* T Type of object.
|
| 2059 |
+
* @param object Object to test.
|
| 2060 |
+
* @param property Property to test.
|
| 2061 |
+
* @param value Value to test.
|
| 2062 |
+
* @param message Message to display on error.
|
| 2063 |
+
*/
|
| 2064 |
+
nestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
|
| 2065 |
+
|
| 2066 |
+
/**
|
| 2067 |
+
* Asserts that object does not have a property named by property with value given by value.
|
| 2068 |
+
* property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
|
| 2069 |
+
*
|
| 2070 |
+
* T Type of object.
|
| 2071 |
+
* @param object Object to test.
|
| 2072 |
+
* @param property Property to test.
|
| 2073 |
+
* @param value Value to test.
|
| 2074 |
+
* @param message Message to display on error.
|
| 2075 |
+
*/
|
| 2076 |
+
notNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
|
| 2077 |
+
|
| 2078 |
+
/**
|
| 2079 |
+
* Asserts that object has a property named by property with a value given by value.
|
| 2080 |
+
* property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
|
| 2081 |
+
*
|
| 2082 |
+
* T Type of object.
|
| 2083 |
+
* @param object Object to test.
|
| 2084 |
+
* @param property Property to test.
|
| 2085 |
+
* @param value Value to test.
|
| 2086 |
+
* @param message Message to display on error.
|
| 2087 |
+
*/
|
| 2088 |
+
deepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
|
| 2089 |
+
|
| 2090 |
+
/**
|
| 2091 |
+
* Asserts that object does not have a property named by property with value given by value.
|
| 2092 |
+
* property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
|
| 2093 |
+
*
|
| 2094 |
+
* T Type of object.
|
| 2095 |
+
* @param object Object to test.
|
| 2096 |
+
* @param property Property to test.
|
| 2097 |
+
* @param value Value to test.
|
| 2098 |
+
* @param message Message to display on error.
|
| 2099 |
+
*/
|
| 2100 |
+
notDeepNestedPropertyVal<T>(object: T, property: string, value: any, message?: string): void;
|
| 2101 |
+
}
|
| 2102 |
+
|
| 2103 |
+
export interface Config {
|
| 2104 |
+
/**
|
| 2105 |
+
* Default: false
|
| 2106 |
+
*/
|
| 2107 |
+
includeStack: boolean;
|
| 2108 |
+
|
| 2109 |
+
/**
|
| 2110 |
+
* Default: true
|
| 2111 |
+
*/
|
| 2112 |
+
showDiff: boolean;
|
| 2113 |
+
|
| 2114 |
+
/**
|
| 2115 |
+
* Default: 40
|
| 2116 |
+
*/
|
| 2117 |
+
truncateThreshold: number;
|
| 2118 |
+
|
| 2119 |
+
/**
|
| 2120 |
+
* Default: true
|
| 2121 |
+
*/
|
| 2122 |
+
useProxy: boolean;
|
| 2123 |
+
|
| 2124 |
+
/**
|
| 2125 |
+
* Default: ['then', 'catch', 'inspect', 'toJSON']
|
| 2126 |
+
*/
|
| 2127 |
+
proxyExcludedKeys: string[];
|
| 2128 |
+
|
| 2129 |
+
deepEqual: <L, R>(expected: L, actual: R) => void;
|
| 2130 |
+
}
|
| 2131 |
+
|
| 2132 |
+
export type { ImportedAssertionError as AssertionError };
|
| 2133 |
+
}
|
| 2134 |
+
}
|
| 2135 |
+
|
| 2136 |
+
export function use(fn: Chai.ChaiPlugin): Chai.ChaiStatic;
|
| 2137 |
+
|
| 2138 |
+
export const util: Chai.ChaiUtils;
|
| 2139 |
+
export const config: Chai.Config;
|
| 2140 |
+
export const Assertion: Chai.AssertionStatic;
|
| 2141 |
+
export const AssertionError: typeof ImportedAssertionError;
|
| 2142 |
+
export function should(): Chai.Should;
|
| 2143 |
+
export function Should(): Chai.Should;
|
| 2144 |
+
export const assert: Chai.AssertStatic;
|
| 2145 |
+
export const expect: Chai.ExpectStatic;
|
node_modules/@types/chai/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/chai",
|
| 3 |
+
"version": "5.2.3",
|
| 4 |
+
"description": "TypeScript definitions for chai",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Bart van der Schoor",
|
| 10 |
+
"githubUsername": "Bartvds",
|
| 11 |
+
"url": "https://github.com/Bartvds"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Andrew Brown",
|
| 15 |
+
"githubUsername": "AGBrown",
|
| 16 |
+
"url": "https://github.com/AGBrown"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Olivier Chevet",
|
| 20 |
+
"githubUsername": "olivr70",
|
| 21 |
+
"url": "https://github.com/olivr70"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Matt Wistrand",
|
| 25 |
+
"githubUsername": "mwistrand",
|
| 26 |
+
"url": "https://github.com/mwistrand"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Shaun Luttin",
|
| 30 |
+
"githubUsername": "shaunluttin",
|
| 31 |
+
"url": "https://github.com/shaunluttin"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Satana Charuwichitratana",
|
| 35 |
+
"githubUsername": "micksatana",
|
| 36 |
+
"url": "https://github.com/micksatana"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "Erik Schierboom",
|
| 40 |
+
"githubUsername": "ErikSchierboom",
|
| 41 |
+
"url": "https://github.com/ErikSchierboom"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Bogdan Paranytsia",
|
| 45 |
+
"githubUsername": "bparan",
|
| 46 |
+
"url": "https://github.com/bparan"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "CXuesong",
|
| 50 |
+
"githubUsername": "CXuesong",
|
| 51 |
+
"url": "https://github.com/CXuesong"
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"name": "Joey Kilpatrick",
|
| 55 |
+
"githubUsername": "joeykilpatrick",
|
| 56 |
+
"url": "https://github.com/joeykilpatrick"
|
| 57 |
+
}
|
| 58 |
+
],
|
| 59 |
+
"type": "module",
|
| 60 |
+
"main": "",
|
| 61 |
+
"types": "index.d.ts",
|
| 62 |
+
"repository": {
|
| 63 |
+
"type": "git",
|
| 64 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 65 |
+
"directory": "types/chai"
|
| 66 |
+
},
|
| 67 |
+
"scripts": {},
|
| 68 |
+
"dependencies": {
|
| 69 |
+
"@types/deep-eql": "*",
|
| 70 |
+
"assertion-error": "^2.0.1"
|
| 71 |
+
},
|
| 72 |
+
"peerDependencies": {},
|
| 73 |
+
"typesPublisherContentHash": "d9d83f1594f42010e624e46e4c8cfeee284bdd04cb05eb0730aec14140f2a833",
|
| 74 |
+
"typeScriptVersion": "5.2"
|
| 75 |
+
}
|
node_modules/@types/chai/register-should.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare global {
|
| 2 |
+
interface Object {
|
| 3 |
+
should: Chai.Assertion;
|
| 4 |
+
}
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
export {};
|
node_modules/@types/connect/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/connect/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/connect`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for connect (https://github.com/senchalabs/connect).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
| 12 |
+
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Maxime LUCE](https://github.com/SomaticIT), and [Evan Hahn](https://github.com/EvanHahn).
|
node_modules/@types/connect/index.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
|
| 3 |
+
import * as http from "http";
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Create a new connect server.
|
| 7 |
+
*/
|
| 8 |
+
declare function createServer(): createServer.Server;
|
| 9 |
+
|
| 10 |
+
declare namespace createServer {
|
| 11 |
+
export type ServerHandle = HandleFunction | http.Server;
|
| 12 |
+
|
| 13 |
+
export class IncomingMessage extends http.IncomingMessage {
|
| 14 |
+
originalUrl?: http.IncomingMessage["url"] | undefined;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
type NextFunction = (err?: any) => void;
|
| 18 |
+
|
| 19 |
+
export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void;
|
| 20 |
+
export type NextHandleFunction = (req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void;
|
| 21 |
+
export type ErrorHandleFunction = (
|
| 22 |
+
err: any,
|
| 23 |
+
req: IncomingMessage,
|
| 24 |
+
res: http.ServerResponse,
|
| 25 |
+
next: NextFunction,
|
| 26 |
+
) => void;
|
| 27 |
+
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
| 28 |
+
|
| 29 |
+
export interface ServerStackItem {
|
| 30 |
+
route: string;
|
| 31 |
+
handle: ServerHandle;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
export interface Server extends NodeJS.EventEmitter {
|
| 35 |
+
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
|
| 36 |
+
|
| 37 |
+
route: string;
|
| 38 |
+
stack: ServerStackItem[];
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Utilize the given middleware `handle` to the given `route`,
|
| 42 |
+
* defaulting to _/_. This "route" is the mount-point for the
|
| 43 |
+
* middleware, when given a value other than _/_ the middleware
|
| 44 |
+
* is only effective when that segment is present in the request's
|
| 45 |
+
* pathname.
|
| 46 |
+
*
|
| 47 |
+
* For example if we were to mount a function at _/admin_, it would
|
| 48 |
+
* be invoked on _/admin_, and _/admin/settings_, however it would
|
| 49 |
+
* not be invoked for _/_, or _/posts_.
|
| 50 |
+
*/
|
| 51 |
+
use(fn: NextHandleFunction): Server;
|
| 52 |
+
use(fn: HandleFunction): Server;
|
| 53 |
+
use(route: string, fn: NextHandleFunction): Server;
|
| 54 |
+
use(route: string, fn: HandleFunction): Server;
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Handle server requests, punting them down
|
| 58 |
+
* the middleware stack.
|
| 59 |
+
*/
|
| 60 |
+
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Listen for connections.
|
| 64 |
+
*
|
| 65 |
+
* This method takes the same arguments
|
| 66 |
+
* as node's `http.Server#listen()`.
|
| 67 |
+
*
|
| 68 |
+
* HTTP and HTTPS:
|
| 69 |
+
*
|
| 70 |
+
* If you run your application both as HTTP
|
| 71 |
+
* and HTTPS you may wrap them individually,
|
| 72 |
+
* since your Connect "server" is really just
|
| 73 |
+
* a JavaScript `Function`.
|
| 74 |
+
*
|
| 75 |
+
* var connect = require('connect')
|
| 76 |
+
* , http = require('http')
|
| 77 |
+
* , https = require('https');
|
| 78 |
+
*
|
| 79 |
+
* var app = connect();
|
| 80 |
+
*
|
| 81 |
+
* http.createServer(app).listen(80);
|
| 82 |
+
* https.createServer(options, app).listen(443);
|
| 83 |
+
*/
|
| 84 |
+
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
|
| 85 |
+
listen(port: number, hostname?: string, callback?: Function): http.Server;
|
| 86 |
+
listen(path: string, callback?: Function): http.Server;
|
| 87 |
+
listen(handle: any, listeningListener?: Function): http.Server;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
export = createServer;
|
node_modules/@types/connect/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/connect",
|
| 3 |
+
"version": "3.4.38",
|
| 4 |
+
"description": "TypeScript definitions for connect",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Maxime LUCE",
|
| 10 |
+
"githubUsername": "SomaticIT",
|
| 11 |
+
"url": "https://github.com/SomaticIT"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Evan Hahn",
|
| 15 |
+
"githubUsername": "EvanHahn",
|
| 16 |
+
"url": "https://github.com/EvanHahn"
|
| 17 |
+
}
|
| 18 |
+
],
|
| 19 |
+
"main": "",
|
| 20 |
+
"types": "index.d.ts",
|
| 21 |
+
"repository": {
|
| 22 |
+
"type": "git",
|
| 23 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 24 |
+
"directory": "types/connect"
|
| 25 |
+
},
|
| 26 |
+
"scripts": {},
|
| 27 |
+
"dependencies": {
|
| 28 |
+
"@types/node": "*"
|
| 29 |
+
},
|
| 30 |
+
"typesPublisherContentHash": "8990242237504bdec53088b79e314b94bec69286df9de56db31f22de403b4092",
|
| 31 |
+
"typeScriptVersion": "4.5"
|
| 32 |
+
}
|
node_modules/@types/cookie-parser/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/cookie-parser/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/cookie-parser`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for cookie-parser (https://github.com/expressjs/cookie-parser).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie-parser.
|
| 9 |
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie-parser/index.d.ts)
|
| 10 |
+
````ts
|
| 11 |
+
import express = require("express");
|
| 12 |
+
|
| 13 |
+
declare module "express" {
|
| 14 |
+
// Inject additional properties on express.Request
|
| 15 |
+
interface Request {
|
| 16 |
+
/**
|
| 17 |
+
* This request's secret.
|
| 18 |
+
* Optionally set by cookie-parser if secret(s) are provided. Can be used by other middleware.
|
| 19 |
+
* [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to add your own properties.
|
| 20 |
+
*/
|
| 21 |
+
secret?: string | undefined;
|
| 22 |
+
/** Parsed cookies that have not been signed */
|
| 23 |
+
cookies: Record<string, any>;
|
| 24 |
+
/** Parsed cookies that have been signed */
|
| 25 |
+
signedCookies: Record<string, any>;
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
declare function cookieParser(
|
| 30 |
+
secret?: string | string[],
|
| 31 |
+
options?: cookieParser.CookieParseOptions,
|
| 32 |
+
): express.RequestHandler;
|
| 33 |
+
|
| 34 |
+
declare namespace cookieParser {
|
| 35 |
+
interface CookieParseOptions {
|
| 36 |
+
decode?(val: string): string;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
function JSONCookie(jsonCookie: string): object | undefined;
|
| 40 |
+
|
| 41 |
+
function JSONCookies<T extends { [key: string]: string }>(jsonCookies: T): { [P in keyof T]: object | undefined };
|
| 42 |
+
|
| 43 |
+
function signedCookie(cookie: string, secret: string | string[]): string | false;
|
| 44 |
+
|
| 45 |
+
function signedCookies<T extends { [key: string]: string }>(
|
| 46 |
+
cookies: T,
|
| 47 |
+
secret: string | string[],
|
| 48 |
+
): { [P in keyof T]?: string | false };
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
export = cookieParser;
|
| 52 |
+
|
| 53 |
+
````
|
| 54 |
+
|
| 55 |
+
### Additional Details
|
| 56 |
+
* Last updated: Fri, 24 Oct 2025 04:02:41 GMT
|
| 57 |
+
* Dependencies: none
|
| 58 |
+
* Peer dependencies: [@types/express](https://npmjs.com/package/@types/express)
|
| 59 |
+
|
| 60 |
+
# Credits
|
| 61 |
+
These definitions were written by [Santi Albo](https://github.com/santialbo), [BendingBender](https://github.com/BendingBender), and [Sebastian Beltran](https://github.com/bjohansebas).
|
node_modules/@types/cookie-parser/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import express = require("express");
|
| 2 |
+
|
| 3 |
+
declare module "express" {
|
| 4 |
+
// Inject additional properties on express.Request
|
| 5 |
+
interface Request {
|
| 6 |
+
/**
|
| 7 |
+
* This request's secret.
|
| 8 |
+
* Optionally set by cookie-parser if secret(s) are provided. Can be used by other middleware.
|
| 9 |
+
* [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to add your own properties.
|
| 10 |
+
*/
|
| 11 |
+
secret?: string | undefined;
|
| 12 |
+
/** Parsed cookies that have not been signed */
|
| 13 |
+
cookies: Record<string, any>;
|
| 14 |
+
/** Parsed cookies that have been signed */
|
| 15 |
+
signedCookies: Record<string, any>;
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
declare function cookieParser(
|
| 20 |
+
secret?: string | string[],
|
| 21 |
+
options?: cookieParser.CookieParseOptions,
|
| 22 |
+
): express.RequestHandler;
|
| 23 |
+
|
| 24 |
+
declare namespace cookieParser {
|
| 25 |
+
interface CookieParseOptions {
|
| 26 |
+
decode?(val: string): string;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
function JSONCookie(jsonCookie: string): object | undefined;
|
| 30 |
+
|
| 31 |
+
function JSONCookies<T extends { [key: string]: string }>(jsonCookies: T): { [P in keyof T]: object | undefined };
|
| 32 |
+
|
| 33 |
+
function signedCookie(cookie: string, secret: string | string[]): string | false;
|
| 34 |
+
|
| 35 |
+
function signedCookies<T extends { [key: string]: string }>(
|
| 36 |
+
cookies: T,
|
| 37 |
+
secret: string | string[],
|
| 38 |
+
): { [P in keyof T]?: string | false };
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
export = cookieParser;
|
node_modules/@types/cookie-parser/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/cookie-parser",
|
| 3 |
+
"version": "1.4.10",
|
| 4 |
+
"description": "TypeScript definitions for cookie-parser",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie-parser",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Santi Albo",
|
| 10 |
+
"githubUsername": "santialbo",
|
| 11 |
+
"url": "https://github.com/santialbo"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "BendingBender",
|
| 15 |
+
"githubUsername": "BendingBender",
|
| 16 |
+
"url": "https://github.com/BendingBender"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Sebastian Beltran",
|
| 20 |
+
"githubUsername": "bjohansebas",
|
| 21 |
+
"url": "https://github.com/bjohansebas"
|
| 22 |
+
}
|
| 23 |
+
],
|
| 24 |
+
"main": "",
|
| 25 |
+
"types": "index.d.ts",
|
| 26 |
+
"repository": {
|
| 27 |
+
"type": "git",
|
| 28 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 29 |
+
"directory": "types/cookie-parser"
|
| 30 |
+
},
|
| 31 |
+
"scripts": {},
|
| 32 |
+
"dependencies": {},
|
| 33 |
+
"peerDependencies": {
|
| 34 |
+
"@types/express": "*"
|
| 35 |
+
},
|
| 36 |
+
"typesPublisherContentHash": "2084e147e6529a1c84dc4645ec42b321c2b0165db9aac73e158e4bc9950ffe35",
|
| 37 |
+
"typeScriptVersion": "5.2"
|
| 38 |
+
}
|
node_modules/@types/cookiejar/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/cookiejar/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/cookiejar`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for cookiejar (https://github.com/bmeck/node-cookiejar).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookiejar.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Mon, 20 Nov 2023 23:36:24 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Rafal Proszowski](https://github.com/paroxp), and [Charles Samborski](https://github.com/demurgos).
|
node_modules/@types/cookiejar/index.d.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export class CookieAccessInfo {
|
| 2 |
+
/**
|
| 3 |
+
* Class to determine matching qualities of a cookie
|
| 4 |
+
* @param domain string domain to match
|
| 5 |
+
* @param path string path to match
|
| 6 |
+
* @param secure boolean access is secure (ssl generally)
|
| 7 |
+
* @param script boolean access is from a script
|
| 8 |
+
*/
|
| 9 |
+
constructor(domain: string, path?: string, secure?: boolean, script?: boolean);
|
| 10 |
+
|
| 11 |
+
static All: CookieAccessInfo;
|
| 12 |
+
domain: string; // domain to match
|
| 13 |
+
path: string; // path to match
|
| 14 |
+
secure: boolean; // access is secure (ssl generally)
|
| 15 |
+
script: boolean; // access is from a script
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
export class Cookie {
|
| 19 |
+
name: string; // name of the cookie
|
| 20 |
+
value: string; // string associated with the cookie
|
| 21 |
+
domain: string; // domain to match (on a cookie a '.' at the start means a wildcard matching anything ending in the rest)
|
| 22 |
+
explicit_domain: boolean; // if the domain was explicitly set via the cookie string
|
| 23 |
+
path: string; // base path to match (matches any path starting with this '/' is root)
|
| 24 |
+
explicit_path: boolean; // if the path was explicitly set via the cookie string
|
| 25 |
+
noscript: boolean; // if it should be kept from scripts
|
| 26 |
+
secure: boolean; // should it only be transmitted over secure means
|
| 27 |
+
expiration_date: number; // number of millis since 1970 at which this should be removed
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* It turns input into a Cookie (singleton if given a Cookie), the
|
| 31 |
+
* request_domain argument is used to default the domain if it is not
|
| 32 |
+
* explicit in the cookie string, the request_path argument is used to set
|
| 33 |
+
* the path if it is not explicit in a cookie String.
|
| 34 |
+
*
|
| 35 |
+
* Explicit domains/paths will cascade, implied domains/paths must exactly
|
| 36 |
+
* match (see http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Pat).
|
| 37 |
+
* @param cookie string or a cookie to work on
|
| 38 |
+
* @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string
|
| 39 |
+
* @param requestPath string argument is used to set the path if it is not explicit in a cookie String
|
| 40 |
+
*/
|
| 41 |
+
constructor(cookie: string | Cookie, requestDomain?: string, requestPath?: string);
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* the set-cookie: string for this cookie
|
| 45 |
+
*/
|
| 46 |
+
toString(): string;
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* the cookie: string for this cookie
|
| 50 |
+
*/
|
| 51 |
+
toValueString(): string;
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* parses the string onto this cookie or a new one if called directly
|
| 55 |
+
* @param cookie string to be parsed into a Cookie
|
| 56 |
+
* @param requestDomain string definind the requesting domain
|
| 57 |
+
* @param requestPath string defining the requesting path
|
| 58 |
+
*/
|
| 59 |
+
parse(cookie: string, requestDomain?: string, requestPath?: string): Cookie;
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* returns true if the access_info allows retrieval of this cookie
|
| 63 |
+
* @param accessInfo CookieAccessInfo
|
| 64 |
+
*/
|
| 65 |
+
matches(accessInfo: CookieAccessInfo): boolean;
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* returns true if the cookies cannot exist in the same space
|
| 69 |
+
* (domain and path match)
|
| 70 |
+
* @param cookie Cookie
|
| 71 |
+
*/
|
| 72 |
+
collidesWith(cookie: Cookie): boolean;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
export class CookieJar {
|
| 76 |
+
/**
|
| 77 |
+
* class to hold numerous cookies from multiple domains correctly
|
| 78 |
+
*/
|
| 79 |
+
constructor();
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
* modify (or add if not already-existing) a cookie to the jar
|
| 83 |
+
* @param cookie string | Cookie
|
| 84 |
+
* @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string
|
| 85 |
+
* @param requestPath string argument is used to set the path if it is not explicit in a cookie String
|
| 86 |
+
*/
|
| 87 |
+
setCookie(cookie: string | Cookie, requestDomain?: string, requestPath?: string): Cookie | false;
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* modify (or add if not already-existing) a large number of cookies to the
|
| 91 |
+
* jar
|
| 92 |
+
* @param cookie string or list of strings defining cookies
|
| 93 |
+
* @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string
|
| 94 |
+
* @param requestPath string argument is used to set the path if it is not explicit in a cookie String
|
| 95 |
+
*/
|
| 96 |
+
setCookies(cookie: string | readonly string[], requestDomain?: string, requestPath?: string): Cookie[];
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* get a cookie with the name and access_info matching
|
| 100 |
+
* @param cookieName string to be parsed into a Cookie
|
| 101 |
+
* @param accessInfo CookieAccessInfo
|
| 102 |
+
*/
|
| 103 |
+
getCookie(cookieName: string, accessInfo: CookieAccessInfo): Cookie | undefined;
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* grab all cookies matching this access_info
|
| 107 |
+
* @param accessInfo CookieAccessInfo
|
| 108 |
+
*/
|
| 109 |
+
getCookies(accessInfo: CookieAccessInfo): readonly Cookie[] & { toValueString(): string };
|
| 110 |
+
}
|
node_modules/@types/cookiejar/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/cookiejar",
|
| 3 |
+
"version": "2.1.5",
|
| 4 |
+
"description": "TypeScript definitions for cookiejar",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookiejar",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Rafal Proszowski",
|
| 10 |
+
"githubUsername": "paroxp",
|
| 11 |
+
"url": "https://github.com/paroxp"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Charles Samborski",
|
| 15 |
+
"githubUsername": "demurgos",
|
| 16 |
+
"url": "https://github.com/demurgos"
|
| 17 |
+
}
|
| 18 |
+
],
|
| 19 |
+
"main": "",
|
| 20 |
+
"types": "index.d.ts",
|
| 21 |
+
"repository": {
|
| 22 |
+
"type": "git",
|
| 23 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 24 |
+
"directory": "types/cookiejar"
|
| 25 |
+
},
|
| 26 |
+
"scripts": {},
|
| 27 |
+
"dependencies": {},
|
| 28 |
+
"typesPublisherContentHash": "551e326993669a1935321e02c337463332b2f28f70d829872d1eb8e3b594596b",
|
| 29 |
+
"typeScriptVersion": "4.5"
|
| 30 |
+
}
|
node_modules/@types/cors/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/cors/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/cors`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for cors (https://github.com/expressjs/cors/).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors.
|
| 9 |
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors/index.d.ts)
|
| 10 |
+
````ts
|
| 11 |
+
/// <reference types="node" />
|
| 12 |
+
|
| 13 |
+
import { IncomingHttpHeaders } from "http";
|
| 14 |
+
|
| 15 |
+
type StaticOrigin = boolean | string | RegExp | Array<boolean | string | RegExp>;
|
| 16 |
+
|
| 17 |
+
type CustomOrigin = (
|
| 18 |
+
requestOrigin: string | undefined,
|
| 19 |
+
callback: (err: Error | null, origin?: StaticOrigin) => void,
|
| 20 |
+
) => void;
|
| 21 |
+
|
| 22 |
+
declare namespace e {
|
| 23 |
+
interface CorsRequest {
|
| 24 |
+
method?: string | undefined;
|
| 25 |
+
headers: IncomingHttpHeaders;
|
| 26 |
+
}
|
| 27 |
+
interface CorsOptions {
|
| 28 |
+
/**
|
| 29 |
+
* @default '*'
|
| 30 |
+
*/
|
| 31 |
+
origin?: StaticOrigin | CustomOrigin | undefined;
|
| 32 |
+
/**
|
| 33 |
+
* @default 'GET,HEAD,PUT,PATCH,POST,DELETE'
|
| 34 |
+
*/
|
| 35 |
+
methods?: string | string[] | undefined;
|
| 36 |
+
allowedHeaders?: string | string[] | undefined;
|
| 37 |
+
exposedHeaders?: string | string[] | undefined;
|
| 38 |
+
credentials?: boolean | undefined;
|
| 39 |
+
maxAge?: number | undefined;
|
| 40 |
+
/**
|
| 41 |
+
* @default false
|
| 42 |
+
*/
|
| 43 |
+
preflightContinue?: boolean | undefined;
|
| 44 |
+
/**
|
| 45 |
+
* @default 204
|
| 46 |
+
*/
|
| 47 |
+
optionsSuccessStatus?: number | undefined;
|
| 48 |
+
}
|
| 49 |
+
type CorsOptionsDelegate<T extends CorsRequest = CorsRequest> = (
|
| 50 |
+
req: T,
|
| 51 |
+
callback: (err: Error | null, options?: CorsOptions) => void,
|
| 52 |
+
) => void;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
declare function e<T extends e.CorsRequest = e.CorsRequest>(
|
| 56 |
+
options?: e.CorsOptions | e.CorsOptionsDelegate<T>,
|
| 57 |
+
): (
|
| 58 |
+
req: T,
|
| 59 |
+
res: {
|
| 60 |
+
statusCode?: number | undefined;
|
| 61 |
+
setHeader(key: string, value: string): any;
|
| 62 |
+
end(): any;
|
| 63 |
+
},
|
| 64 |
+
next: (err?: any) => any,
|
| 65 |
+
) => void;
|
| 66 |
+
export = e;
|
| 67 |
+
|
| 68 |
+
````
|
| 69 |
+
|
| 70 |
+
### Additional Details
|
| 71 |
+
* Last updated: Sat, 07 Jun 2025 02:15:25 GMT
|
| 72 |
+
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
| 73 |
+
|
| 74 |
+
# Credits
|
| 75 |
+
These definitions were written by [Alan Plum](https://github.com/pluma), [Gaurav Sharma](https://github.com/gtpan77), and [Sebastian Beltran](https://github.com/bjohansebas).
|
node_modules/@types/cors/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
|
| 3 |
+
import { IncomingHttpHeaders } from "http";
|
| 4 |
+
|
| 5 |
+
type StaticOrigin = boolean | string | RegExp | Array<boolean | string | RegExp>;
|
| 6 |
+
|
| 7 |
+
type CustomOrigin = (
|
| 8 |
+
requestOrigin: string | undefined,
|
| 9 |
+
callback: (err: Error | null, origin?: StaticOrigin) => void,
|
| 10 |
+
) => void;
|
| 11 |
+
|
| 12 |
+
declare namespace e {
|
| 13 |
+
interface CorsRequest {
|
| 14 |
+
method?: string | undefined;
|
| 15 |
+
headers: IncomingHttpHeaders;
|
| 16 |
+
}
|
| 17 |
+
interface CorsOptions {
|
| 18 |
+
/**
|
| 19 |
+
* @default '*'
|
| 20 |
+
*/
|
| 21 |
+
origin?: StaticOrigin | CustomOrigin | undefined;
|
| 22 |
+
/**
|
| 23 |
+
* @default 'GET,HEAD,PUT,PATCH,POST,DELETE'
|
| 24 |
+
*/
|
| 25 |
+
methods?: string | string[] | undefined;
|
| 26 |
+
allowedHeaders?: string | string[] | undefined;
|
| 27 |
+
exposedHeaders?: string | string[] | undefined;
|
| 28 |
+
credentials?: boolean | undefined;
|
| 29 |
+
maxAge?: number | undefined;
|
| 30 |
+
/**
|
| 31 |
+
* @default false
|
| 32 |
+
*/
|
| 33 |
+
preflightContinue?: boolean | undefined;
|
| 34 |
+
/**
|
| 35 |
+
* @default 204
|
| 36 |
+
*/
|
| 37 |
+
optionsSuccessStatus?: number | undefined;
|
| 38 |
+
}
|
| 39 |
+
type CorsOptionsDelegate<T extends CorsRequest = CorsRequest> = (
|
| 40 |
+
req: T,
|
| 41 |
+
callback: (err: Error | null, options?: CorsOptions) => void,
|
| 42 |
+
) => void;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
declare function e<T extends e.CorsRequest = e.CorsRequest>(
|
| 46 |
+
options?: e.CorsOptions | e.CorsOptionsDelegate<T>,
|
| 47 |
+
): (
|
| 48 |
+
req: T,
|
| 49 |
+
res: {
|
| 50 |
+
statusCode?: number | undefined;
|
| 51 |
+
setHeader(key: string, value: string): any;
|
| 52 |
+
end(): any;
|
| 53 |
+
},
|
| 54 |
+
next: (err?: any) => any,
|
| 55 |
+
) => void;
|
| 56 |
+
export = e;
|
node_modules/@types/cors/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/cors",
|
| 3 |
+
"version": "2.8.19",
|
| 4 |
+
"description": "TypeScript definitions for cors",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Alan Plum",
|
| 10 |
+
"githubUsername": "pluma",
|
| 11 |
+
"url": "https://github.com/pluma"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Gaurav Sharma",
|
| 15 |
+
"githubUsername": "gtpan77",
|
| 16 |
+
"url": "https://github.com/gtpan77"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Sebastian Beltran",
|
| 20 |
+
"githubUsername": "bjohansebas",
|
| 21 |
+
"url": "https://github.com/bjohansebas"
|
| 22 |
+
}
|
| 23 |
+
],
|
| 24 |
+
"main": "",
|
| 25 |
+
"types": "index.d.ts",
|
| 26 |
+
"repository": {
|
| 27 |
+
"type": "git",
|
| 28 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 29 |
+
"directory": "types/cors"
|
| 30 |
+
},
|
| 31 |
+
"scripts": {},
|
| 32 |
+
"dependencies": {
|
| 33 |
+
"@types/node": "*"
|
| 34 |
+
},
|
| 35 |
+
"peerDependencies": {},
|
| 36 |
+
"typesPublisherContentHash": "a090e558c5f443573318c2955deecddc840bd8dfaac7cdedf31c7f6ede8d0b47",
|
| 37 |
+
"typeScriptVersion": "5.1"
|
| 38 |
+
}
|
node_modules/@types/deep-eql/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/deep-eql/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/deep-eql`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for deep-eql (https://github.com/chaijs/deep-eql).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql.
|
| 9 |
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql/index.d.ts)
|
| 10 |
+
````ts
|
| 11 |
+
declare namespace deepEqual {
|
| 12 |
+
/**
|
| 13 |
+
* Memoization class used to speed up comparison.
|
| 14 |
+
*/
|
| 15 |
+
class MemoizeMap extends WeakMap<object, MemoizeMap | boolean> {}
|
| 16 |
+
|
| 17 |
+
interface DeepEqualOptions<T1 = unknown, T2 = unknown> {
|
| 18 |
+
/**
|
| 19 |
+
* Override default algorithm, determining custom equality.
|
| 20 |
+
*/
|
| 21 |
+
comparator?: (leftHandOperand: T1, rightHandOperand: T2) => boolean | null;
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Provide a custom memoization object which will cache the results of
|
| 25 |
+
* complex objects for a speed boost.
|
| 26 |
+
*
|
| 27 |
+
* By passing `false` you can disable memoization, but this will cause circular
|
| 28 |
+
* references to blow the stack.
|
| 29 |
+
*/
|
| 30 |
+
memoize?: MemoizeMap | false;
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Assert deeply nested sameValue equality between two objects of any type.
|
| 36 |
+
*
|
| 37 |
+
* @param leftHandOperand
|
| 38 |
+
* @param rightHandOperand
|
| 39 |
+
* @param [options] Additional options
|
| 40 |
+
* @return equal match
|
| 41 |
+
*/
|
| 42 |
+
declare function deepEqual<T1, T2>(
|
| 43 |
+
leftHandOperand: T1,
|
| 44 |
+
rightHandOperand: T2,
|
| 45 |
+
options?: deepEqual.DeepEqualOptions<T1, T2>,
|
| 46 |
+
): boolean;
|
| 47 |
+
|
| 48 |
+
export = deepEqual;
|
| 49 |
+
|
| 50 |
+
````
|
| 51 |
+
|
| 52 |
+
### Additional Details
|
| 53 |
+
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
| 54 |
+
* Dependencies: none
|
| 55 |
+
|
| 56 |
+
# Credits
|
| 57 |
+
These definitions were written by [Rodrigo Pietnechuk](https://github.com/ghnoob).
|
node_modules/@types/deep-eql/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare namespace deepEqual {
|
| 2 |
+
/**
|
| 3 |
+
* Memoization class used to speed up comparison.
|
| 4 |
+
*/
|
| 5 |
+
class MemoizeMap extends WeakMap<object, MemoizeMap | boolean> {}
|
| 6 |
+
|
| 7 |
+
interface DeepEqualOptions<T1 = unknown, T2 = unknown> {
|
| 8 |
+
/**
|
| 9 |
+
* Override default algorithm, determining custom equality.
|
| 10 |
+
*/
|
| 11 |
+
comparator?: (leftHandOperand: T1, rightHandOperand: T2) => boolean | null;
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Provide a custom memoization object which will cache the results of
|
| 15 |
+
* complex objects for a speed boost.
|
| 16 |
+
*
|
| 17 |
+
* By passing `false` you can disable memoization, but this will cause circular
|
| 18 |
+
* references to blow the stack.
|
| 19 |
+
*/
|
| 20 |
+
memoize?: MemoizeMap | false;
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Assert deeply nested sameValue equality between two objects of any type.
|
| 26 |
+
*
|
| 27 |
+
* @param leftHandOperand
|
| 28 |
+
* @param rightHandOperand
|
| 29 |
+
* @param [options] Additional options
|
| 30 |
+
* @return equal match
|
| 31 |
+
*/
|
| 32 |
+
declare function deepEqual<T1, T2>(
|
| 33 |
+
leftHandOperand: T1,
|
| 34 |
+
rightHandOperand: T2,
|
| 35 |
+
options?: deepEqual.DeepEqualOptions<T1, T2>,
|
| 36 |
+
): boolean;
|
| 37 |
+
|
| 38 |
+
export = deepEqual;
|
node_modules/@types/deep-eql/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/deep-eql",
|
| 3 |
+
"version": "4.0.2",
|
| 4 |
+
"description": "TypeScript definitions for deep-eql",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Rodrigo Pietnechuk",
|
| 10 |
+
"githubUsername": "ghnoob",
|
| 11 |
+
"url": "https://github.com/ghnoob"
|
| 12 |
+
}
|
| 13 |
+
],
|
| 14 |
+
"main": "",
|
| 15 |
+
"types": "index.d.ts",
|
| 16 |
+
"repository": {
|
| 17 |
+
"type": "git",
|
| 18 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 19 |
+
"directory": "types/deep-eql"
|
| 20 |
+
},
|
| 21 |
+
"scripts": {},
|
| 22 |
+
"dependencies": {},
|
| 23 |
+
"typesPublisherContentHash": "3b8981ce557947fc00ca08cbd93b4206bfc0943360956867381a0a3f6b1eabf5",
|
| 24 |
+
"typeScriptVersion": "4.5"
|
| 25 |
+
}
|
node_modules/@types/esrecurse/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
node_modules/@types/esrecurse/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/esrecurse`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for esrecurse (https://github.com/estools/esrecurse).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/esrecurse.
|
| 9 |
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/esrecurse/index.d.ts)
|
| 10 |
+
````ts
|
| 11 |
+
/**
|
| 12 |
+
* Options for the Visitor constructor and visit function.
|
| 13 |
+
*/
|
| 14 |
+
interface VisitorOptions {
|
| 15 |
+
/**
|
| 16 |
+
* Fallback strategy for unknown node types.
|
| 17 |
+
* @default 'iteration'
|
| 18 |
+
*/
|
| 19 |
+
fallback?: "iteration" | ((node: any) => string[]);
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Custom keys for child nodes by node type.
|
| 23 |
+
* @default {}
|
| 24 |
+
*/
|
| 25 |
+
childVisitorKeys?: Record<string, string[]>;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* A visitor class for recursively traversing ECMAScript AST.
|
| 30 |
+
*/
|
| 31 |
+
declare class Visitor {
|
| 32 |
+
/**
|
| 33 |
+
* Creates a new Visitor instance.
|
| 34 |
+
* @param options Configuration options for the visitor.
|
| 35 |
+
*/
|
| 36 |
+
constructor(visitor?: Visitor | null, options?: VisitorOptions | null);
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Visits a node, invoking the appropriate handler.
|
| 40 |
+
* @param node The AST node to visit.
|
| 41 |
+
*/
|
| 42 |
+
visit(node: any): void;
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Visits the children of a node based on childVisitorKeys.
|
| 46 |
+
* @param node The AST node whose children to visit.
|
| 47 |
+
*/
|
| 48 |
+
visitChildren(node: any): void;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Visits an AST node with the specified visitor.
|
| 53 |
+
* @param ast The AST node to traverse.
|
| 54 |
+
* @param visitor A visitor instance or visitor object.
|
| 55 |
+
* @param options Configuration options for the traversal.
|
| 56 |
+
*/
|
| 57 |
+
declare function visit(
|
| 58 |
+
ast: any,
|
| 59 |
+
visitor?: Visitor | Record<string, (node: any) => void> | null,
|
| 60 |
+
options?: VisitorOptions,
|
| 61 |
+
): void;
|
| 62 |
+
|
| 63 |
+
export { visit, Visitor, type VisitorOptions };
|
| 64 |
+
|
| 65 |
+
````
|
| 66 |
+
|
| 67 |
+
### Additional Details
|
| 68 |
+
* Last updated: Sat, 19 Jul 2025 03:47:05 GMT
|
| 69 |
+
* Dependencies: none
|
| 70 |
+
|
| 71 |
+
# Credits
|
| 72 |
+
These definitions were written by [Jimmy Leung](https://github.com/hkleungai).
|
node_modules/@types/esrecurse/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Options for the Visitor constructor and visit function.
|
| 3 |
+
*/
|
| 4 |
+
interface VisitorOptions {
|
| 5 |
+
/**
|
| 6 |
+
* Fallback strategy for unknown node types.
|
| 7 |
+
* @default 'iteration'
|
| 8 |
+
*/
|
| 9 |
+
fallback?: "iteration" | ((node: any) => string[]);
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Custom keys for child nodes by node type.
|
| 13 |
+
* @default {}
|
| 14 |
+
*/
|
| 15 |
+
childVisitorKeys?: Record<string, string[]>;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* A visitor class for recursively traversing ECMAScript AST.
|
| 20 |
+
*/
|
| 21 |
+
declare class Visitor {
|
| 22 |
+
/**
|
| 23 |
+
* Creates a new Visitor instance.
|
| 24 |
+
* @param options Configuration options for the visitor.
|
| 25 |
+
*/
|
| 26 |
+
constructor(visitor?: Visitor | null, options?: VisitorOptions | null);
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Visits a node, invoking the appropriate handler.
|
| 30 |
+
* @param node The AST node to visit.
|
| 31 |
+
*/
|
| 32 |
+
visit(node: any): void;
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Visits the children of a node based on childVisitorKeys.
|
| 36 |
+
* @param node The AST node whose children to visit.
|
| 37 |
+
*/
|
| 38 |
+
visitChildren(node: any): void;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Visits an AST node with the specified visitor.
|
| 43 |
+
* @param ast The AST node to traverse.
|
| 44 |
+
* @param visitor A visitor instance or visitor object.
|
| 45 |
+
* @param options Configuration options for the traversal.
|
| 46 |
+
*/
|
| 47 |
+
declare function visit(
|
| 48 |
+
ast: any,
|
| 49 |
+
visitor?: Visitor | Record<string, (node: any) => void> | null,
|
| 50 |
+
options?: VisitorOptions,
|
| 51 |
+
): void;
|
| 52 |
+
|
| 53 |
+
export { visit, Visitor, type VisitorOptions };
|