{"_id":"@brad-jones/dk8slock","name":"@brad-jones/dk8slock","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@brad-jones/dk8slock","version":"0.2.0","description":"A distributed lock for deno (& other Js Runtimes) powered by K8s Leases.","author":{"name":"Brad Jones","email":"brad@bjc.id.au"},"repository":{"type":"git","url":"git+https://github.com/brad-jones/dk8slock.git"},"license":"MIT","bugs":{"url":"https://github.com/brad-jones/dk8slock/issues"},"module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js"}},"dependencies":{"@kubernetes/client-node":"^1.0.0","dayjs":"^1.11.13","@deno/shim-deno":"~0.18.0"},"devDependencies":{"@types/node":"^20.9.0"},"_id":"@brad-jones/dk8slock@0.2.0","gitHead":"69c9bf8c0d7b853d8820471c8e23286fd4eb2e2e","homepage":"https://github.com/brad-jones/dk8slock#readme","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-aGKjpaw7i9/OPNh8dvBQoyVOIMnwvKcMnA01aeyf5rnVxKOgce5WTaT9K4rW3CrZqQOQDxqns71oEGzj15ZTlA==","shasum":"2ef10b086647252f85879acbeaf2e3db94e95378","tarball":"https://registry.npmjs.org/@brad-jones/dk8slock/-/dk8slock-0.2.0.tgz","fileCount":285,"unpackedSize":535255,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@brad-jones%2fdk8slock@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCEtVgWDhxd2MZ5B7XoesWucgTradkFRWskB2BhMfeOdwIgW6QE2n3y7ISTIMD3hX1aek9clzTg8Etz8jqOqtQubbY="}]},"_npmUser":{"name":"gears","email":"brad@bjc.id.au"},"directories":{},"maintainers":[{"name":"gears","email":"brad@bjc.id.au"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dk8slock_0.2.0_1737536243170_0.6378308237090575"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-22T08:57:23.031Z","0.2.0":"2025-01-22T08:57:23.350Z","modified":"2025-01-22T08:57:23.878Z"},"maintainers":[{"name":"gears","email":"brad@bjc.id.au"}],"description":"A distributed lock for deno (& other Js Runtimes) powered by K8s Leases.","homepage":"https://github.com/brad-jones/dk8slock#readme","repository":{"type":"git","url":"git+https://github.com/brad-jones/dk8slock.git"},"author":{"name":"Brad Jones","email":"brad@bjc.id.au"},"bugs":{"url":"https://github.com/brad-jones/dk8slock/issues"},"license":"MIT","readme":"# dk8slock\n\nA distributed lock for deno _(& other Js Runtimes)_ powered by [K8s Leases](https://kubernetes.io/docs/concepts/architecture/leases).\n\nInspired by:\n\n- <https://github.com/jrhouston/k8slock>\n- <https://www.acritelli.com/blog/kubernetes-leases>\n\n## Quick Start\n\nThis uses the power of [Disposeables](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html)\nto create a lock for the entire function.\n\n### Deno\n\n```ts\nimport { disposeableLock } from \"jsr:@brad-jones/dk8slock\";\n\nasync function contentiousFunc() {\n  await using _ = await disposeableLock(\"MyLock\");\n  // Anything you do here is guaranteed to be only executing by a single worker.\n}\n```\n\n### Node.js\n\nInstall the node package with your favorite package manager.\\\n`npm` used here but `pnpm`, `yarn` & others all work in much the same way.\n\n`npm install @brad-jones/dk8slock`\n\n_NB: Don't attempt to use the [JSR](https://jsr.io) package with Node.js it will not work!_\n\n## Known Issues\n\n- `@cloudydeno/kubernetes-client` leaks resources, it doesn't seem to close HttpClients.\n\n  ```\n  error: Leaks detected:\n  - An HTTP client was created during the test, but not closed during the test. Close the HTTP client by calling `httpClient.close()`.\n  ```\n\n  Hence why our tests currently set `sanitizeResources: false`\n","readmeFilename":"README.md"}