{"_id":"@adaskothebeast/http-params-processor-angular-resource","_rev":"4-35ce6ef31ea286d935c727cb4cb31ae8","name":"@adaskothebeast/http-params-processor-angular-resource","dist-tags":{"latest":"12.0.0"},"versions":{"10.0.0":{"name":"@adaskothebeast/http-params-processor-angular-resource","version":"10.0.0","keywords":["ng","angular","httpResource","resource","http","params"],"author":{"name":"Adam Pluciński","email":"adaskothebeast@gmail.com"},"_id":"@adaskothebeast/http-params-processor-angular-resource@10.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"dist":{"shasum":"448f201db04009ca9ce1acd8359568d89560c6ca","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-angular-resource/-/http-params-processor-angular-resource-10.0.0.tgz","fileCount":6,"integrity":"sha512-6l6LrarnICd+NbhJOvecD9Hl5n8t5+bVcMNJdkoiVxDc9fqDlReDVGhLlbNmJsgGzvbSQlQ1LzpGFLF5twr55g==","signatures":[{"sig":"MEUCIQCpl9WAUSN8dnFGdib3J8Mgm8+eMN73fUpJ+fCxRT+UzgIgYCkgRgO4+IdwVDX2YnfMyTGlHOp65AS+XtfPqWA469o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42642},"module":"fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs","exports":{".":{"types":"./types/adaskothebeast-http-params-processor-angular-resource.d.ts","default":"./fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"1e61d6323f67038b9af916e4f3d263a73fe76497","typings":"types/adaskothebeast-http-params-processor-angular-resource.d.ts","_npmUser":{"name":"adasko","email":"adaskothebeast@gmail.com"},"repository":{"url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git","type":"git"},"_npmVersion":"11.6.2","description":"Angular httpResource integration for http-params-processor - complex query parameters for Resource API","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":"^21.0.0","@angular/common":"^21.0.0","@adaskothebeast/http-params-processor-angular":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-angular-resource_10.0.0_1768076963586_0.9864941729703303","host":"s3://npm-registry-packages-npm-production"}},"11.0.0":{"name":"@adaskothebeast/http-params-processor-angular-resource","version":"11.0.0","author":{"url":"https://github.com/adaskothebeast","name":"Adam Pluciński","email":"adaskothebeast@gmail.com"},"license":"MIT","_id":"@adaskothebeast/http-params-processor-angular-resource@11.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"dist":{"shasum":"f859ac729911b0c896ca43fa7d9431b7579668b6","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-angular-resource/-/http-params-processor-angular-resource-11.0.0.tgz","fileCount":6,"integrity":"sha512-6BA1egfBIHGYh5mxYlFKzslRoTxmlmuB+H4wd2kJcltBOf3n36kxTtkW8+AdvWF7K0ZhppxHKtw1eEC7vr3YkA==","signatures":[{"sig":"MEYCIQDNB9jyzcZaYTB8CY2D1KGssVSSGnle9GWUHnRHngVkWgIhAPZ6NmfhKPiMB+qtd1o5bjGw6D0G8m11J4AWj06lBEa6","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-angular-resource@11.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":24744},"module":"fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs","exports":{".":{"types":"./types/adaskothebeast-http-params-processor-angular-resource.d.ts","default":"./fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs"},"./package.json":{"default":"./package.json"}},"typings":"types/adaskothebeast-http-params-processor-angular-resource.d.ts","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:af4d6204-4fb2-4246-a6ad-dd5f0d48cf38"}},"repository":{"url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git","type":"git"},"_npmVersion":"11.6.2","description":"<a alt=\"Nx logo\" href=\"https://nx.dev\" target=\"_blank\" rel=\"noreferrer\"><img src=\"https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png\" width=\"45\"></a>","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":">=21.0.0","@angular/common":">=21.0.0","@adaskothebeast/http-params-processor-angular":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-angular-resource_11.0.0_1768757262758_0.9465077793911145","host":"s3://npm-registry-packages-npm-production"}},"11.1.0":{"name":"@adaskothebeast/http-params-processor-angular-resource","version":"11.1.0","author":{"url":"https://github.com/adaskothebeast","name":"Adam Pluciński","email":"adaskothebeast@gmail.com"},"license":"MIT","_id":"@adaskothebeast/http-params-processor-angular-resource@11.1.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"dist":{"shasum":"3d0f109f182f1c36e26598e2e5cb0aab9cd8d356","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-angular-resource/-/http-params-processor-angular-resource-11.1.0.tgz","fileCount":6,"integrity":"sha512-Nhf/ih6msXKU/6o1WEIah99lT44oR8CQbKZy0FhbTVNDzihCC4X1Cd8JRz4kjKV+OHTgifibiyorQSon86GFPQ==","signatures":[{"sig":"MEUCIQDESeok1nnpbiTW5mH2Bt/zlgKRNu8pv2ILV2nk7Jv0/QIgCXj4WjbdIGu6akMb+ciRbwm7mM09qLT+xPpehi2QSHI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-angular-resource@11.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":24744},"module":"fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs","exports":{".":{"types":"./types/adaskothebeast-http-params-processor-angular-resource.d.ts","default":"./fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs"},"./package.json":{"default":"./package.json"}},"typings":"types/adaskothebeast-http-params-processor-angular-resource.d.ts","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:af4d6204-4fb2-4246-a6ad-dd5f0d48cf38"}},"repository":{"url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git","type":"git"},"_npmVersion":"11.6.2","description":"<a alt=\"Nx logo\" href=\"https://nx.dev\" target=\"_blank\" rel=\"noreferrer\"><img src=\"https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png\" width=\"45\"></a>","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":">=21.0.0","@angular/common":">=21.0.0","@adaskothebeast/http-params-processor-angular":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-angular-resource_11.1.0_1768758916969_0.24717278593276548","host":"s3://npm-registry-packages-npm-production"}},"12.0.0":{"name":"@adaskothebeast/http-params-processor-angular-resource","version":"12.0.0","description":"Angular httpResource helpers that build signal driven requests from deeply nested query parameter objects.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","angular","httpresource","signals","resource","ng"],"license":"MIT","author":{"name":"Adam Pluciński","email":"adaskothebeast@gmail.com","url":"https://github.com/adaskothebeast"},"repository":{"type":"git","url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git"},"bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","peerDependencies":{"@adaskothebeast/http-params-processor-angular":"^12.0.0","@angular/common":">=22.0.8","@angular/core":">=22.0.8"},"sideEffects":false,"module":"fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs","typings":"types/adaskothebeast-http-params-processor-angular-resource.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./types/adaskothebeast-http-params-processor-angular-resource.d.ts","default":"./fesm2022/adaskothebeast-http-params-processor-angular-resource.mjs"}},"type":"module","dependencies":{"tslib":"^2.3.0"},"gitHead":"73d31a6c26a6f2819f6c98aabb36659532e4cdd0","_id":"@adaskothebeast/http-params-processor-angular-resource@12.0.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-5UvT30w0jrT+qUBxY09jyIUyWN1xfcjSQliW9450r5f0zmn0mB13iNhK3Wkyl7hqNkUzF9uZdGg2PHDLmZXqWQ==","shasum":"05067cf27cc166346e931a4ade678419ea31f695","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-angular-resource/-/http-params-processor-angular-resource-12.0.0.tgz","fileCount":6,"unpackedSize":30258,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCrsKlXsmcv9ssU8XjLWQPCC/mWszCGpha3Cs84ZQ4UBgIgUzC/qg197NoYlw7vj6lU1O9v0vtfyHxCGle3fEa+Emc="}]},"_npmUser":{"name":"adasko","email":"adaskothebeast@gmail.com"},"directories":{},"maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/http-params-processor-angular-resource_12.0.0_1785235815559_0.6659542540854209"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-10T20:29:23.526Z","modified":"2026-07-28T10:50:16.309Z","10.0.0":"2026-01-10T20:29:23.727Z","11.0.0":"2026-01-18T17:27:42.911Z","11.1.0":"2026-01-18T17:55:17.106Z","12.0.0":"2026-07-28T10:50:15.717Z"},"bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"author":{"name":"Adam Pluciński","email":"adaskothebeast@gmail.com","url":"https://github.com/adaskothebeast"},"license":"MIT","homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","repository":{"type":"git","url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git"},"description":"Angular httpResource helpers that build signal driven requests from deeply nested query parameter objects.","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"readme":"# 🅰️ @adaskothebeast/http-params-processor-angular-resource\n\n**Signal driven `httpResource` helpers for [HttpParamsProcessor](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor): declare a nested params object and get a reactive Angular resource that reloads itself.**\n\n[![npm](https://img.shields.io/npm/v/%40adaskothebeast%2Fhttp-params-processor-angular-resource?color=cb3837&logo=npm)](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-angular-resource)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nBuilt on top of the `-angular` package and Angular's own `httpResource`. Published in Angular Package Format (ESM). `sideEffects: false`.\n\n---\n\n## 📦 Install\n\n```bash\nnpm i @adaskothebeast/http-params-processor-angular-resource @adaskothebeast/http-params-processor-angular @adaskothebeast/http-params-processor-core\n```\n\nPeer dependencies: `@adaskothebeast/http-params-processor-angular ^12.0.0`, `@angular/common >=22.0.8`, `@angular/core >=22.0.8`.\n\nThis package depends on the **`-angular`** package (it injects `HttpParamsProcessorService`), not on `core` directly. `core` still has to be installed because `-angular` requires it.\n\n---\n\n## 🎯 What it does\n\n`httpResourceWithParams` wraps `httpResource` and does three things for you:\n\n1. reads `url` and `paramsValue` inside the resource's request function, so any signal you touch there becomes a dependency,\n2. flattens the params object with `HttpParamsProcessorService.process(paramsKey, value)`,\n3. copies the resulting `HttpParams` into the `params` record of an `HttpResourceRequest`.\n\nYou get a plain `HttpResourceRef<T>` back, with the usual `value()`, `status()`, `isLoading()`, `error()` and `reload()`.\n\n---\n\n## 🧰 API\n\n| Export                                          | Signature                                                                                      |\n| ----------------------------------------------- | ---------------------------------------------------------------------------------------------- |\n| `httpResourceWithParams<T>(options)`            | `HttpResourceRef<T>` when `defaultValue` is given, otherwise `HttpResourceRef<T \\| undefined>` |\n| `reactiveHttpResourceWithParams<T, P>(options)` | Same, with a `params: () => P \\| undefined` shorthand instead of `paramsValue`                 |\n\nTypes: `HttpResourceWithParamsOptions<TResult, TRaw>`, `ReactiveHttpResourceWithParamsOptions<T, P>` (which is `Omit<HttpResourceWithParamsOptions<T>, 'paramsValue'>` plus `params`).\n\n### Options\n\n| Option             | Type                                                                                           | Default          |\n| ------------------ | ---------------------------------------------------------------------------------------------- | ---------------- |\n| `url`              | `string \\| (() => string \\| undefined)`                                                        | required         |\n| `paramsKey`        | `string`                                                                                       | required         |\n| `paramsValue`      | `Signal<Record<string, unknown> \\| undefined> \\| (() => Record<string, unknown> \\| undefined)` | required         |\n| `processorOptions` | `HttpParamsProcessorOptions` (`keyFormatter`, `valueConverters`)                               | service defaults |\n| `additionalParams` | `Record<string, string \\| string[]>`                                                           | none             |\n| `method`           | `string`                                                                                       | `'GET'`          |\n| `headers`          | `Record<string, string \\| string[]> \\| (() => Record<string, string \\| string[]>)`             | none             |\n| `body`             | `unknown`                                                                                      | omitted          |\n| `reportProgress`   | `boolean`                                                                                      | omitted          |\n| `withCredentials`  | `boolean`                                                                                      | omitted          |\n| `defaultValue`     | `TResult`                                                                                      | none             |\n| `equal`            | `(a: TResult, b: TResult) => boolean`                                                          | Angular default  |\n| `map`              | `(value: TRaw) => TResult`                                                                     | none             |\n| `injector`         | `Injector`                                                                                     | the ambient one  |\n\n---\n\n## ⚡ Usage\n\n```ts\nimport { httpResourceWithParams } from '@adaskothebeast/http-params-processor-angular-resource';\nimport { Component, signal } from '@angular/core';\n\n@Component({ selector: 'app-users', template: '...' })\nexport class UsersComponent {\n  readonly status = signal('active');\n\n  readonly users = httpResourceWithParams<User[]>({\n    url: '/api/users',\n    paramsKey: 'filter',\n    paramsValue: () => ({ status: this.status(), roles: ['admin', 'user'] }),\n    defaultValue: [],\n  });\n}\n\n// users.value(), users.isLoading(), users.error(); reloads when `status` changes\nthis.status.set('inactive');\n```\n\n`reactiveHttpResourceWithParams` is the same call with a `params` function, which reads slightly better when every field comes from a signal:\n\n```ts\nconst statusFilter = signal('active');\nconst roleFilter = signal(['admin']);\n\nconst users = reactiveHttpResourceWithParams<User[], FilterParams>({\n  url: '/api/users',\n  paramsKey: 'filter',\n  params: () => ({ status: statusFilter(), roles: roleFilter() }),\n});\n```\n\nConditional loading, static extras, a different verb and response mapping:\n\n```ts\nconst selectedId = signal<number | undefined>(undefined);\n\nconst detail = httpResourceWithParams<UserDto, RawUserDto>({\n  url: () => (selectedId() === undefined ? undefined : '/api/users/detail'),\n  paramsKey: 'filter',\n  paramsValue: () => ({ id: selectedId() }),\n  additionalParams: { page: '1', size: '10' },\n  headers: { 'X-Custom-Header': 'custom-value' },\n  method: 'POST',\n  body: { action: 'search' },\n  map: (raw) => toUserDto(raw),\n});\n```\n\n---\n\n## 🎛️ Options and configuration\n\n`processorOptions` is forwarded verbatim to `HttpParamsProcessorService.process`, so you can override the key formatter or value converters per resource:\n\n```ts\nimport { BracketNotationKeyFormattingStrategy } from '@adaskothebeast/http-params-processor-key-bracket-notation';\n\nhttpResourceWithParams<User[]>({\n  url: '/api/users',\n  paramsKey: 'filter',\n  paramsValue: () => ({ status: 'active' }),\n  processorOptions: {\n    keyFormatter: new BracketNotationKeyFormattingStrategy(),\n  },\n});\n```\n\nApplication-wide defaults still come from the `-angular` DI tokens `HTTP_PARAMS_KEY_FORMATTER` and `HTTP_PARAMS_VALUE_CONVERTERS`.\n\n---\n\n## 📤 Output examples\n\nFor `paramsKey: 'filter'` and `paramsValue: () => ({ status: 'active', roles: ['admin', 'user'] })` the generated `HttpResourceRequest` is:\n\n```text\nurl:    /api/users\nmethod: GET\nparams: {\n  'filter.status':   'active',\n  'filter.roles[0]': 'admin',\n  'filter.roles[1]': 'user'\n}\n```\n\nA single value per key becomes a `string`, a key with several values becomes a `string[]`, and `additionalParams` are spread in first:\n\n```text\nadditionalParams { page: '1' } + { status: 'active' }\n  => { page: '1', 'filter.status': 'active' }\n```\n\n---\n\n## ⚠️ Edge cases\n\n- Both functions call `inject`, so they must run in an **injection context** (field initializer, constructor, or `runInInjectionContext`). Pass `injector` explicitly when you construct a resource later.\n- If the `url` function returns `undefined`, the request function returns `undefined` and the resource stays in `status() === 'idle'`. Same when `paramsValue` returns `undefined`; this is the supported way to defer a request.\n- `paramsValue` returning `{}` is **not** idle: an empty params object produces an empty `params` record and the request is sent.\n- Processed params are written into the record **after** `additionalParams`, so a processed key wins if it collides with a static one.\n- `defaultValue` is only forwarded when it is not `undefined`; use `null` or an empty array if you need an explicit \"no data yet\" value.\n- Encoding is Angular's job: the flattened keys go into `HttpResourceRequest.params` as raw strings and `HttpClient` encodes them.\n- The same behaviour guarantees as the `-angular` service apply to the params object: `null`/`undefined` skipped, `$type` ignored, circular references throw `Circular reference detected at key: <key>` from inside the request function.\n- `reactiveHttpResourceWithParams` is a thin delegation (`paramsValue: options.params`), so anything valid for `httpResourceWithParams` is valid there too.\n\n---\n\n## 🔗 Related packages\n\n- `HttpClient` based service: [`-angular`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-angular)\n- Engine: [`-core`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-core)\n- Other adapters: [`-fetch`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-fetch), [`-axios`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-axios), [`-react-tanstack-query`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-react-tanstack-query), [`-react-swr`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-react-swr)\n- Key formatting: `-key-bracket-notation`, `-key-rails`, `-key-flat`, `-key-custom-delimiter`, `-key-json`\n\nFull matrix and recipes: [main README](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor#readme).\n\n---\n\n## 📄 License\n\n[MIT](./LICENSE) © Adam Pluciński\n","readmeFilename":"README.md","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","angular","httpresource","signals","resource","ng"]}