nuki-api-js 1.1.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +13 -3
  3. package/dist/components-b80s6chi.d.ts +1407 -0
  4. package/dist/components-b80s6chi.d.ts.map +1 -0
  5. package/dist/components-dzxfxa30.d.ts +1407 -0
  6. package/dist/components-dzxfxa30.d.ts.map +1 -0
  7. package/dist/components.cjs +2496 -108
  8. package/dist/components.d.cts +2 -0
  9. package/dist/components.d.cts.map +1 -0
  10. package/dist/components.d.mts +1 -1596
  11. package/dist/components.d.mts.map +1 -1
  12. package/dist/components.mjs +2393 -1
  13. package/dist/effect.cjs +131 -24
  14. package/dist/effect.d.cts +317 -0
  15. package/dist/effect.d.cts.map +1 -0
  16. package/dist/effect.d.mts +75 -5
  17. package/dist/effect.d.mts.map +1 -1
  18. package/dist/effect.mjs +125 -4
  19. package/dist/index.cjs +107 -22
  20. package/dist/index.d.cts +148 -0
  21. package/dist/index.d.cts.map +1 -0
  22. package/dist/index.d.mts +148 -0
  23. package/dist/index.d.mts.map +1 -0
  24. package/dist/index.d.ts +10717 -10535
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.mjs +29 -24
  27. package/dist/{schemas-e6jr28te.js → schemas-eegfu8of.js} +785 -378
  28. package/dist/{schemas-ihzqrsub.cjs → schemas-noervfwu.cjs} +864 -377
  29. package/dist/schemas.cjs +81 -1
  30. package/dist/schemas.d.cts +38740 -0
  31. package/dist/schemas.d.cts.map +1 -0
  32. package/dist/schemas.d.mts +10265 -9987
  33. package/dist/schemas.d.mts.map +1 -1
  34. package/dist/schemas.mjs +1 -1
  35. package/dist/types.d.cts +7238 -0
  36. package/dist/types.d.cts.map +1 -0
  37. package/dist/types.d.mts +324 -232
  38. package/dist/types.d.mts.map +1 -1
  39. package/package.json +58 -30
  40. package/dist/components-eiu9qz9x.js +0 -2351
  41. package/dist/components-iddduu87.cjs +0 -2458
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) SferaDev
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -27,6 +27,12 @@ const accounts = await client.api.account.getAccountsResource({});
27
27
 
28
28
  Operations are grouped by tag: `client.api.<tag>.<operation>(params)`.
29
29
 
30
+ Every operation can also be called by method and path:
31
+
32
+ ```ts
33
+ const accounts = await client.request("GET /account");
34
+ ```
35
+
30
36
  ### Custom fetch
31
37
 
32
38
  ```ts
@@ -36,22 +42,26 @@ const client = new NukiApi({
36
42
  });
37
43
  ```
38
44
 
45
+ ## Errors
46
+
47
+ A call that gets an HTTP error response rejects with `{ status, payload }`: `status` is the HTTP status code and `payload` is the parsed JSON error body, or the raw body text, up to 1000 characters, when it is not JSON. A request that gets no response at all, for example because the network failed, rejects with an `Error` whose message names the method, the path and the reason, and whose `cause` is the original exception. A request cancelled through `signal` rejects with what the signal was aborted with, as is: the `AbortError`, or the `TimeoutError` of `AbortSignal.timeout()`.
48
+
39
49
  ## Effect
40
50
 
41
- The `effect` entrypoint exposes every operation as an `Effect`. It requires `effect` as a peer dependency.
51
+ The `effect` entrypoint exposes every operation as an `Effect`. It requires `effect` 4 as a peer dependency.
42
52
 
43
53
  ```ts
44
54
  import { Effect } from "effect";
45
55
  import { ApiService, makeApiLayer } from "nuki-api-js/effect";
46
56
 
47
- const program = ApiService.account.getAccountsResource({});
57
+ const program = ApiService.account.getAccountsResource();
48
58
 
49
59
  await Effect.runPromise(
50
60
  program.pipe(Effect.provide(makeApiLayer({ token: process.env.NUKI_TOKEN })))
51
61
  );
52
62
  ```
53
63
 
54
- Errors are typed as `ApiError`, `NetworkError` and `ValidationError`.
64
+ Errors are typed as `ApiError`, `NetworkError` and `ValidationError`. An HTTP error response fails with `ApiError`, which carries the HTTP `status`; a request that never gets a response fails with `NetworkError`.
55
65
 
56
66
  ## Entrypoints
57
67