{"id":26208376,"url":"https://github.com/web-pacotes/vault","last_synced_at":"2026-04-11T19:03:13.406Z","repository":{"id":180604692,"uuid":"665301542","full_name":"web-pacotes/vault","owner":"web-pacotes","description":"A small, token based container designed for dependency injection 🫙","archived":false,"fork":false,"pushed_at":"2023-07-16T15:36:50.000Z","size":141,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-31T10:42:20.199Z","etag":null,"topics":["angular","container","dependency-injection","di","nodejs","react","svelte","typescript","vault","vue","web-pacotes"],"latest_commit_sha":null,"homepage":"https://web-pacotes.github.io/vault","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/web-pacotes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-11T22:53:40.000Z","updated_at":"2023-07-16T13:59:49.000Z","dependencies_parsed_at":"2023-12-14T12:46:05.719Z","dependency_job_id":null,"html_url":"https://github.com/web-pacotes/vault","commit_stats":null,"previous_names":["web-pacotes/vault"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/web-pacotes/vault","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-pacotes%2Fvault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-pacotes%2Fvault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-pacotes%2Fvault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-pacotes%2Fvault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/web-pacotes","download_url":"https://codeload.github.com/web-pacotes/vault/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-pacotes%2Fvault/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262406995,"owners_count":23306294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","container","dependency-injection","di","nodejs","react","svelte","typescript","vault","vue","web-pacotes"],"created_at":"2025-03-12T06:28:35.941Z","updated_at":"2025-12-30T21:07:24.036Z","avatar_url":"https://github.com/web-pacotes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vault\n\nA small, token based container designed for dependency injection 🫙\n\n![npm version](https://badgen.net/npm/v/@web-pacotes/vault) ![npm total downloads](https://badgen.net/npm/dt/@web-pacotes/vault) ![bundlephobia bundle size](https://badgen.net/bundlephobia/min/@web-pacotes/vault)\n\n---\n\n## How to use\n\nUsing Vault to store and lookup dependencies is as simple as:\n\n```typescript\n// Create a vault\nconst vault = new Vault();\n\n// Create some tokens\nconst token = 'my cool token';\n\n// Store dependencies!\nvault.store('my secret message', token);\n\n// Look them up at some point in your program\nconst dependency = vault.lookup\u003cstring\u003e(token);\n\n// It should print \"just lookup this dependency: my secret message\"\nconsole.info(`just lookup this dependency: ${dependency}`);\n```\n\n## Features\n\n- Store primitive and non-primitive dependencies\n- Prevent store nullable or undefined values\n- Type inferred lookups\n\n## Why should I use Vault?\n\nIf you're working in a _context_ based environment and you want to retrieve dependencies based on the context state, then Vault was designed for you. Simply register the vault instance to your context and get the dependencies in some point in your app after. Here's an example on how you can use it in SvelteKit:\n\n```typescript\n// src/routes/+page.ts\n\nexport const load = (async () =\u003e {\n    const dependency = new AuthenticationRepositoryImpl(...);\n    const vault = new Vault();\n\n    vault.store(dependency, 'AuthenticationRepository');\n\n    setContext('vault', dependency);\n});\n\n...\n\n// src/lib/components/AuthenticationStore.ts\n\nconst { value } = getContext('vault');\nconst authenticationRepo = vault.lookup\u003cAuthenticationRepository\u003e('AuthenticationRepository');\n\nconst store = writable\u003cAuthenticationState\u003e();\n\nreturn {\n    store.subscribe,\n    authenticate: () =\u003e authenticationRepo.loginAnonymously(),\n};\n\n```\n\n---\n\n## Bugs and Contributions\n\nFound any bug (including typos) in the package? Do you have any suggestion\nor feature to include for future releases? Please create an issue via\nGitHub in order to track each contribution. Also, pull requests are very\nwelcome!\n\nTo contribute, start by setting up your local development environment. The [setup.md](setup.md) document will onboard you on how to do so!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-pacotes%2Fvault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweb-pacotes%2Fvault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-pacotes%2Fvault/lists"}