feat: set peerDependencies
This commit is contained in:
14
.prettierrc
Normal file
14
.prettierrc
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"trailingComma": "all",
|
||||
"tabWidth": 2,
|
||||
"printWidth": 120,
|
||||
"singleQuote": false,
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.ts",
|
||||
"options": {
|
||||
"parser": "typescript"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"deno.enable": true,
|
||||
"deno.lint": false,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit"
|
||||
|
||||
@@ -33,7 +33,7 @@ import { MongoTestContainer } from "@valkyr/testcontainers/mongodb";
|
||||
const container = await MongoTestContainer.start();
|
||||
|
||||
console.log(container.url()); // mongodb://user:pass@127.0.0.1:27017
|
||||
console.log(await container.client.db("admin").command({ ping: 1 })) // { ok: 1 }
|
||||
console.log(await container.client.db("admin").command({ ping: 1 })); // { ok: 1 }
|
||||
|
||||
await container.stop();
|
||||
```
|
||||
|
||||
@@ -101,7 +101,10 @@ export class MongoTestContainer {
|
||||
* @param image - Which docker image to run.
|
||||
* @param config - Configuration for the Mongo container.
|
||||
*/
|
||||
static async start(image: string = "mongo:8.0.3", config: Partial<MongoConnectionInfo> = {}): Promise<MongoTestContainer> {
|
||||
static async start(
|
||||
image: string = "mongo:8.0.3",
|
||||
config: Partial<MongoConnectionInfo> = {},
|
||||
): Promise<MongoTestContainer> {
|
||||
const port = getAvailablePort({ preferredPort: config.port });
|
||||
if (port === undefined) {
|
||||
throw new Error("Unable to assign to a random port");
|
||||
@@ -111,7 +114,10 @@ export class MongoTestContainer {
|
||||
|
||||
const container = await docker.createContainer({
|
||||
Image: image,
|
||||
Env: [`MONGO_INITDB_ROOT_USERNAME=${config.user ?? "root"}`, `MONGO_INITDB_ROOT_PASSWORD=${config.pass ?? "password"}`],
|
||||
Env: [
|
||||
`MONGO_INITDB_ROOT_USERNAME=${config.user ?? "root"}`,
|
||||
`MONGO_INITDB_ROOT_PASSWORD=${config.pass ?? "password"}`,
|
||||
],
|
||||
ExposedPorts: {
|
||||
"27017/tcp": {},
|
||||
},
|
||||
|
||||
@@ -168,9 +168,9 @@ export class PostgresTestContainer {
|
||||
* @param options - Connection options to append to the URL.
|
||||
*/
|
||||
url(name: string, options?: PostgresConnectionOptions): PostgresConnectionUrl {
|
||||
return `postgres://${this.username}:${this.password}@${this.host}:${this.port}/${name}${
|
||||
postgresOptionsToString(options)
|
||||
}`;
|
||||
return `postgres://${this.username}:${this.password}@${this.host}:${this.port}/${name}${postgresOptionsToString(
|
||||
options,
|
||||
)}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
deno.json
10
deno.json
@@ -1,21 +1,17 @@
|
||||
{
|
||||
"name": "@valkyr/testcontainers",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"exports": {
|
||||
".": "./mod.ts",
|
||||
"./mongodb": "./containers/mongodb.ts",
|
||||
"./postgres": "./containers/postgres.ts"
|
||||
},
|
||||
"publish": {
|
||||
"exclude": [
|
||||
".github",
|
||||
".vscode",
|
||||
".gitignore",
|
||||
"tests"
|
||||
]
|
||||
"exclude": [".github", ".vscode", ".gitignore", "tests"]
|
||||
},
|
||||
"tasks": {
|
||||
"lint": "npx eslint -c eslint.config.mjs .",
|
||||
"fmt": "npx prettier --write .",
|
||||
"test": "deno test --allow-all",
|
||||
"test:publish": "deno publish --dry-run",
|
||||
"ncu": "npx ncu -u -p npm"
|
||||
|
||||
126
deno.lock
generated
126
deno.lock
generated
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "4",
|
||||
"version": "5",
|
||||
"specifiers": {
|
||||
"npm:@jsr/std__assert@1.0.12": "1.0.12",
|
||||
"npm:@jsr/std__async@1.0.12": "1.0.12",
|
||||
@@ -14,8 +14,8 @@
|
||||
"npm:typescript-eslint@8.30.1": "8.30.1_eslint@9.24.0_typescript@5.8.3_@typescript-eslint+parser@8.30.1__eslint@9.24.0__typescript@5.8.3"
|
||||
},
|
||||
"npm": {
|
||||
"@eslint-community/eslint-utils@4.6.1_eslint@9.24.0": {
|
||||
"integrity": "sha512-KTsJMmobmbrFLe3LDh0PC2FXpcSYJt/MLjlkh/9LEnmKYLSYmT/0EW9JWANjeoemiuZrmogti0tW5Ch+qNUYDw==",
|
||||
"@eslint-community/eslint-utils@4.7.0_eslint@9.24.0": {
|
||||
"integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
|
||||
"dependencies": [
|
||||
"eslint",
|
||||
"eslint-visitor-keys@3.4.3"
|
||||
@@ -24,16 +24,16 @@
|
||||
"@eslint-community/regexpp@4.12.1": {
|
||||
"integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ=="
|
||||
},
|
||||
"@eslint/config-array@0.20.0": {
|
||||
"integrity": "sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==",
|
||||
"@eslint/config-array@0.20.1": {
|
||||
"integrity": "sha512-OL0RJzC/CBzli0DrrR31qzj6d6i6Mm3HByuhflhl4LOBiWxN+3i6/t/ZQQNii4tjksXi8r2CRW1wMpWA2ULUEw==",
|
||||
"dependencies": [
|
||||
"@eslint/object-schema",
|
||||
"debug",
|
||||
"minimatch@3.1.2"
|
||||
]
|
||||
},
|
||||
"@eslint/config-helpers@0.2.1": {
|
||||
"integrity": "sha512-RI17tsD2frtDu/3dmI7QRrD4bedNKPM08ziRYaC5AhkGrzIAJelm9kJU1TznK+apx6V+cqRz8tfpEeG3oIyjxw=="
|
||||
"@eslint/config-helpers@0.2.3": {
|
||||
"integrity": "sha512-u180qk2Um1le4yf0ruXH3PYFeEZeYC3p/4wCTKrr2U1CmGdzGi3KtY0nuPDH48UJxlKCC5RDzbcbh4X0XlqgHg=="
|
||||
},
|
||||
"@eslint/core@0.12.0": {
|
||||
"integrity": "sha512-cmrR6pytBuSMTaBweKoGMwu3EiHiEC+DoyupPmlZ0HxBJBtIxwe+j/E4XPIKNx+Q74c8lXKPwYawBf5glsTkHg==",
|
||||
@@ -90,35 +90,45 @@
|
||||
"@humanwhocodes/retry@0.3.1": {
|
||||
"integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="
|
||||
},
|
||||
"@humanwhocodes/retry@0.4.2": {
|
||||
"integrity": "sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ=="
|
||||
"@humanwhocodes/retry@0.4.3": {
|
||||
"integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="
|
||||
},
|
||||
"@jsr/std__assert@1.0.12": {
|
||||
"integrity": "sha512-9pmgjJhuljZCmLlbvsRV6aLT5+YCmhX/yIjaWYav7R7Vup2DOLAgpUOs4JkzRbwn7fdKYrwHT8+DjqPr7Ti8mg==",
|
||||
"dependencies": [
|
||||
"@jsr/std__internal"
|
||||
]
|
||||
],
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__assert/1.0.12.tgz"
|
||||
},
|
||||
"@jsr/std__async@1.0.12": {
|
||||
"integrity": "sha512-NUaSOcwMetVeVkIqet2Ammy2A5YxG8ViFxryBbTaC4h7l/cgAkU59U3zF58ek4Y8HZ0Nx5De7qBptPfp62kcgw=="
|
||||
"integrity": "sha512-NUaSOcwMetVeVkIqet2Ammy2A5YxG8ViFxryBbTaC4h7l/cgAkU59U3zF58ek4Y8HZ0Nx5De7qBptPfp62kcgw==",
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__async/1.0.12.tgz"
|
||||
},
|
||||
"@jsr/std__data-structures@1.0.6": {
|
||||
"integrity": "sha512-Ejc8mHLuoYxXLu2zPquvqijdgQ19OV+1DdVDrLc/Cg+tiuGh4Dq2FSnLiPINh4lO1AJ3XcZcYPx38RxdsZcCOg=="
|
||||
"@jsr/std__data-structures@1.0.8": {
|
||||
"integrity": "sha512-7BHBUlBEJ/9w2zv9sNmyuQOINBTEP1erxLHMpIDBa7GMCV1Nxm6LvgC4R5cgN90FFKpoCFa9PPB66Hkeem9Q2g==",
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__data-structures/1.0.8.tgz"
|
||||
},
|
||||
"@jsr/std__fs@1.0.16": {
|
||||
"integrity": "sha512-xnqp8XqEFN+ttkERg9GG+AxyipSd+rfCquLPviF5ZSwN6oCV1TM0ZNoKHXNk/EJAsz28YjF4sfgdJt8XwTV2UQ==",
|
||||
"dependencies": [
|
||||
"@jsr/std__path"
|
||||
]
|
||||
],
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__fs/1.0.16.tgz"
|
||||
},
|
||||
"@jsr/std__internal@1.0.6": {
|
||||
"integrity": "sha512-1NLtCx9XAL44nt56gzmRSCgXjIthHVzK62fTkJdq8/XsP7eN9a21AZDpc0EGJ/cgvmmOB52UGh46OuKrrY7eVg=="
|
||||
"@jsr/std__internal@1.0.9": {
|
||||
"integrity": "sha512-s+f4qrJzZgPAy7XuFOtgaSaxyPLnnEmAfXGLvRXGxPTL76URLVHkF+hOzqXz+bmk8/awybF6BRsasxtAQOV23Q==",
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__internal/1.0.9.tgz"
|
||||
},
|
||||
"@jsr/std__net@1.0.4": {
|
||||
"integrity": "sha512-KJGU8ZpQ70sMW2Zk+wU3wFUkggS9lTLfRFBygnV9VaK8KI+1ggiqtB06rH4a14CNRGM9y46Mn/ZCbQUd4Q45Jg=="
|
||||
"integrity": "sha512-KJGU8ZpQ70sMW2Zk+wU3wFUkggS9lTLfRFBygnV9VaK8KI+1ggiqtB06rH4a14CNRGM9y46Mn/ZCbQUd4Q45Jg==",
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__net/1.0.4.tgz"
|
||||
},
|
||||
"@jsr/std__path@1.0.8": {
|
||||
"integrity": "sha512-eNBGlh/8ZVkMxtFH4bwIzlAeKoHYk5in4wrBZhi20zMdOiuX4QozP4+19mIXBT2lzHDjhuVLyECbhFeR304iDg=="
|
||||
"@jsr/std__path@1.1.1": {
|
||||
"integrity": "sha512-+x5LgcNUSpMzOZIRmFSjqrMTCxHlgXjWzK8ZFr7lwgHfWZxoVXeis3MFQlkR5mN5uQ61Y1P30Li1PU0yx9uluA==",
|
||||
"dependencies": [
|
||||
"@jsr/std__internal"
|
||||
],
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__path/1.1.1.tgz"
|
||||
},
|
||||
"@jsr/std__testing@1.0.11": {
|
||||
"integrity": "sha512-pqQDYtIsaDf+x4NHQ+WiixRJ8DfhgFQRdlHWWssFAzIYwleR+VHLTNlgsgg+AH3mIIR+gTkBmKk21hTkM/WbMQ==",
|
||||
@@ -129,10 +139,11 @@
|
||||
"@jsr/std__fs",
|
||||
"@jsr/std__internal",
|
||||
"@jsr/std__path"
|
||||
]
|
||||
],
|
||||
"tarball": "https://npm.jsr.io/~/11/@jsr/std__testing/1.0.11.tgz"
|
||||
},
|
||||
"@mongodb-js/saslprep@1.2.2": {
|
||||
"integrity": "sha512-EB0O3SCSNRUFk66iRCpI+cXzIjdswfCs7F6nOC3RAGJ7xr5YhaicvsRwJ9eyzYvYRlCSDUO/c7g4yNulxKC1WA==",
|
||||
"@mongodb-js/saslprep@1.3.0": {
|
||||
"integrity": "sha512-zlayKCsIjYb7/IdfqxorK5+xUMyi4vOKcFy10wKJYc63NSdKI8mNME+uJqfatkPmOSMMUiojrL58IePKBm3gvQ==",
|
||||
"dependencies": [
|
||||
"sparse-bitfield"
|
||||
]
|
||||
@@ -154,8 +165,8 @@
|
||||
"fastq"
|
||||
]
|
||||
},
|
||||
"@types/estree@1.0.7": {
|
||||
"integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ=="
|
||||
"@types/estree@1.0.8": {
|
||||
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="
|
||||
},
|
||||
"@types/json-schema@7.0.15": {
|
||||
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="
|
||||
@@ -248,17 +259,18 @@
|
||||
"integrity": "sha512-aEhgas7aJ6vZnNFC7K4/vMGDGyOiqWcYZPpIWrTKuTAlsvDNKy2GFDqh9smL+iq069ZvR0YzEeq0B8NJlLzjFA==",
|
||||
"dependencies": [
|
||||
"@typescript-eslint/types",
|
||||
"eslint-visitor-keys@4.2.0"
|
||||
"eslint-visitor-keys@4.2.1"
|
||||
]
|
||||
},
|
||||
"acorn-jsx@5.3.2_acorn@8.14.1": {
|
||||
"acorn-jsx@5.3.2_acorn@8.15.0": {
|
||||
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
|
||||
"dependencies": [
|
||||
"acorn"
|
||||
]
|
||||
},
|
||||
"acorn@8.14.1": {
|
||||
"integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg=="
|
||||
"acorn@8.15.0": {
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"bin": true
|
||||
},
|
||||
"ajv@6.12.6": {
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
@@ -281,15 +293,15 @@
|
||||
"balanced-match@1.0.2": {
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"brace-expansion@1.1.11": {
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"brace-expansion@1.1.12": {
|
||||
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
||||
"dependencies": [
|
||||
"balanced-match",
|
||||
"concat-map"
|
||||
]
|
||||
},
|
||||
"brace-expansion@2.0.1": {
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"brace-expansion@2.0.2": {
|
||||
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
||||
"dependencies": [
|
||||
"balanced-match"
|
||||
]
|
||||
@@ -300,8 +312,8 @@
|
||||
"fill-range"
|
||||
]
|
||||
},
|
||||
"bson@6.10.3": {
|
||||
"integrity": "sha512-MTxGsqgYTwfshYWTRdmZRC+M7FnG1b4y7RO7p2k3X24Wq0yv1m77Wsj0BzlPzd/IowgESfsruQCUToa7vbOpPQ=="
|
||||
"bson@6.10.4": {
|
||||
"integrity": "sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng=="
|
||||
},
|
||||
"callsites@3.1.0": {
|
||||
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
|
||||
@@ -333,8 +345,8 @@
|
||||
"which"
|
||||
]
|
||||
},
|
||||
"debug@4.4.0": {
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"debug@4.4.1": {
|
||||
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
|
||||
"dependencies": [
|
||||
"ms"
|
||||
]
|
||||
@@ -351,8 +363,8 @@
|
||||
"eslint"
|
||||
]
|
||||
},
|
||||
"eslint-scope@8.3.0": {
|
||||
"integrity": "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==",
|
||||
"eslint-scope@8.4.0": {
|
||||
"integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
|
||||
"dependencies": [
|
||||
"esrecurse",
|
||||
"estraverse"
|
||||
@@ -361,8 +373,8 @@
|
||||
"eslint-visitor-keys@3.4.3": {
|
||||
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="
|
||||
},
|
||||
"eslint-visitor-keys@4.2.0": {
|
||||
"integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="
|
||||
"eslint-visitor-keys@4.2.1": {
|
||||
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="
|
||||
},
|
||||
"eslint@9.24.0": {
|
||||
"integrity": "sha512-eh/jxIEJyZrvbWRe4XuVclLPDYSYYYgLy5zXGGxD6j8zjSAxFEzI2fL/8xNq6O2yKqVt+eF2YhV+hxjV6UKXwQ==",
|
||||
@@ -377,7 +389,7 @@
|
||||
"@eslint/plugin-kit",
|
||||
"@humanfs/node",
|
||||
"@humanwhocodes/module-importer",
|
||||
"@humanwhocodes/retry@0.4.2",
|
||||
"@humanwhocodes/retry@0.4.3",
|
||||
"@types/estree",
|
||||
"@types/json-schema",
|
||||
"ajv",
|
||||
@@ -386,7 +398,7 @@
|
||||
"debug",
|
||||
"escape-string-regexp",
|
||||
"eslint-scope",
|
||||
"eslint-visitor-keys@4.2.0",
|
||||
"eslint-visitor-keys@4.2.1",
|
||||
"espree",
|
||||
"esquery",
|
||||
"esutils",
|
||||
@@ -402,14 +414,15 @@
|
||||
"minimatch@3.1.2",
|
||||
"natural-compare",
|
||||
"optionator"
|
||||
]
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"espree@10.3.0_acorn@8.14.1": {
|
||||
"integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==",
|
||||
"espree@10.4.0_acorn@8.15.0": {
|
||||
"integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
|
||||
"dependencies": [
|
||||
"acorn",
|
||||
"acorn-jsx",
|
||||
"eslint-visitor-keys@4.2.0"
|
||||
"eslint-visitor-keys@4.2.1"
|
||||
]
|
||||
},
|
||||
"esquery@1.6.0": {
|
||||
@@ -537,7 +550,8 @@
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"dependencies": [
|
||||
"argparse"
|
||||
]
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"json-buffer@3.0.1": {
|
||||
"integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="
|
||||
@@ -586,13 +600,13 @@
|
||||
"minimatch@3.1.2": {
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dependencies": [
|
||||
"brace-expansion@1.1.11"
|
||||
"brace-expansion@1.1.12"
|
||||
]
|
||||
},
|
||||
"minimatch@9.0.5": {
|
||||
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
|
||||
"dependencies": [
|
||||
"brace-expansion@2.0.1"
|
||||
"brace-expansion@2.0.2"
|
||||
]
|
||||
},
|
||||
"mongodb-connection-string-url@3.0.2": {
|
||||
@@ -661,7 +675,8 @@
|
||||
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="
|
||||
},
|
||||
"prettier@3.5.3": {
|
||||
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw=="
|
||||
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
|
||||
"bin": true
|
||||
},
|
||||
"punycode@2.3.1": {
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="
|
||||
@@ -681,8 +696,9 @@
|
||||
"queue-microtask"
|
||||
]
|
||||
},
|
||||
"semver@7.7.1": {
|
||||
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="
|
||||
"semver@7.7.2": {
|
||||
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
|
||||
"bin": true
|
||||
},
|
||||
"shebang-command@2.0.0": {
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
@@ -743,7 +759,8 @@
|
||||
]
|
||||
},
|
||||
"typescript@5.8.3": {
|
||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="
|
||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||
"bin": true
|
||||
},
|
||||
"uri-js@4.4.1": {
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
@@ -765,7 +782,8 @@
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dependencies": [
|
||||
"isexe"
|
||||
]
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"word-wrap@1.2.5": {
|
||||
"integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="
|
||||
|
||||
@@ -70,7 +70,8 @@ export class Container {
|
||||
*
|
||||
* @param query - Query parameters to send to the request
|
||||
*/
|
||||
async logs(query: {
|
||||
async logs(
|
||||
query: {
|
||||
follow?: boolean;
|
||||
stdout?: boolean;
|
||||
stderr?: boolean;
|
||||
@@ -78,7 +79,8 @@ export class Container {
|
||||
until?: number;
|
||||
timestamps?: boolean;
|
||||
tail?: number | "all";
|
||||
} = {}): Promise<Response> {
|
||||
} = {},
|
||||
): Promise<Response> {
|
||||
return modem.request({ method: "GET", path: `/containers/${this.id}/logs`, query });
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,13 @@ class Modem {
|
||||
* @param param.body - Request body. _(Ignored for `GET` requests.)_
|
||||
* @param param.headers - Headers to send with the request.
|
||||
*/
|
||||
async request(
|
||||
{ method, path, query = {}, body, headers = {} }: { method: "POST" | "GET" | "DELETE" } & RequestOptions,
|
||||
): Promise<Response> {
|
||||
async request({
|
||||
method,
|
||||
path,
|
||||
query = {},
|
||||
body,
|
||||
headers = {},
|
||||
}: { method: "POST" | "GET" | "DELETE" } & RequestOptions): Promise<Response> {
|
||||
return this.client.fetch(`http://docker${path}${toSearchParams(query)}`, {
|
||||
method,
|
||||
body,
|
||||
|
||||
@@ -15,16 +15,22 @@ export default [
|
||||
{
|
||||
files: ["**/*.ts"],
|
||||
rules: {
|
||||
"@typescript-eslint/ban-ts-comment": ["error", {
|
||||
"@typescript-eslint/ban-ts-comment": [
|
||||
"error",
|
||||
{
|
||||
"ts-expect-error": "allow-with-description",
|
||||
minimumDescriptionLength: 10,
|
||||
}],
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", {
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
}],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2,7 +2,10 @@ import { NEW_LINE, PROTOCOL } from "./common.ts";
|
||||
import { Response } from "./response.ts";
|
||||
|
||||
export class Request {
|
||||
constructor(readonly connection: Deno.Conn, readonly options: RequestOptions) {}
|
||||
constructor(
|
||||
readonly connection: Deno.Conn,
|
||||
readonly options: RequestOptions,
|
||||
) {}
|
||||
|
||||
async send(): Promise<Response> {
|
||||
const http = await this.encode(this.toHttp());
|
||||
@@ -12,9 +15,7 @@ export class Request {
|
||||
|
||||
toHttp() {
|
||||
const { method, path, headers = {}, body } = this.options;
|
||||
const parts: string[] = [
|
||||
`${method} ${path} ${PROTOCOL}`,
|
||||
];
|
||||
const parts: string[] = [`${method} ${path} ${PROTOCOL}`];
|
||||
for (const key in headers) {
|
||||
parts.push(`${key}: ${(headers as any)[key]}`);
|
||||
}
|
||||
|
||||
@@ -13,5 +13,9 @@
|
||||
"postgres": "3.4.5",
|
||||
"prettier": "3.5.3",
|
||||
"typescript-eslint": "8.30.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"mongodb": "^6.0.0",
|
||||
"postgres": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user