@bunny.net/api-client-effect-v4-database 0.0.0-stage → 1.0.202611301935

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # @bunny.net/api-client-effect-v4-database
2
+
3
+ ## 1.0.202611301935
4
+
5
+ Republished without a code change (restamped at 2026-11-30T19:35Z): the same generated code as the previous version.
6
+
7
+ ## 1.0.202611301153
8
+
9
+ Regenerated from the upstream spec (`info.version` 1.0.1, fetched 2026-11-30T11:53Z).
10
+
11
+ No previous snapshot to diff against.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bunny.net
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,84 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <a href="https://bunny.net">
3
+ <img src="https://github.com/BunnyWay/bunnynet-typescript/blob/main/asset/bunny.png?raw=true" width="500" height="auto" alt="Bunny"/>
4
+ </a>
5
+ </div>
2
6
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
7
+ # Bunny Database API client for Effect 4
8
+
9
+ This package contains `@bunny.net/api-client-effect-v4-database`, the Bunny
10
+ Database API as an [Effect](https://effect.website) service: databases, their
11
+ usage and statistics, their access tokens, the regions and limits, and live
12
+ metrics. It is generated from the official OpenAPI spec, so there is one method
13
+ per endpoint, a schema per model and a typed error per documented status.
14
+
15
+ Effect 3 or 4? This package is the Effect 4 flavour (`effect` 4, HTTP client
16
+ from `effect/http`). On Effect 3, install
17
+ `@bunny.net/api-client-effect-database` instead; the exported names are the
18
+ same.
19
+
20
+ ## 🥕 Usage
21
+
22
+ Install it together with `effect`:
23
+
24
+ ```sh
25
+ npm install @bunny.net/api-client-effect-v4-database effect
26
+ ```
27
+
28
+ ### Listing your databases
29
+
30
+ ```typescript
31
+ import { Effect, Layer } from "effect";
32
+ import { FetchHttpClient } from "effect/http";
33
+ import { BunnyDatabase } from "@bunny.net/api-client-effect-v4-database";
34
+ import { BunnyCredentials } from "@bunny.net/api-client-effect-v4-runtime";
35
+
36
+ const program = Effect.gen(function* () {
37
+ const database = yield* BunnyDatabase;
38
+ const databases = yield* database.listDatabasesV3({ query: { page: 1 } });
39
+ for (const db of databases.value.Items) {
40
+ console.log(db.Id, db.Name);
41
+ }
42
+ });
43
+
44
+ const Live = BunnyDatabase.Default.pipe(
45
+ Layer.provide(BunnyCredentials.fromEnv()), // reads BUNNYNET_API_KEY
46
+ Layer.provide(FetchHttpClient.layer),
47
+ );
48
+
49
+ await Effect.runPromise(program.pipe(Effect.provide(Live)));
50
+ ```
51
+
52
+ `BunnyDatabase.Default` talks to `https://api.bunny.net/database`;
53
+ `BunnyDatabase.layer({ baseUrl })` targets another host. Every method returns
54
+ `{ status, value }` typed by the documented success statuses. A documented error
55
+ status fails with `BunnyResponseError`, carrying the status and the decoded
56
+ body, and anything else with another `BunnyClientError`. Transport failures come
57
+ through as Effect's own `HttpClientError` from `effect/http`, so retries,
58
+ timeouts and tracing are whatever your `HttpClient` layer does.
59
+
60
+ The credential is an API key or a JWT: provide `BunnyCredentials.bearer(jwt)` in
61
+ place of `BunnyCredentials.fromEnv()` and the token is sent bare, as
62
+ `Authorization: <jwt>`, instead of the key. The key may be a scoped one. A
63
+ scoped key works on the operations for which Bunny's API reference names a
64
+ permission, and needs that permission: one of `Database.Create`,
65
+ `Database.Delete`, `Database.Read`, `Database.Statistics` and `Database.Update`.
66
+ The other operations take the account key or a JWT only. The generated code does
67
+ not say which operation needs which; the API reference does.
68
+
69
+ The package exports the service, `securitySchemes`, the component schemas and
70
+ the per-operation `*Input` types. The spec names several response schemas like
71
+ per-operation aliases, so the response aliases are not re-exported. The same API
72
+ with Zod schemas instead of Effect is `@bunny.net/api-client-zod-database`. On
73
+ Deno, import `npm:@bunny.net/api-client-effect-v4-database`.
74
+
75
+ Versions are `<spec major>.<minor>.<fetch time>`: a breaking change in Bunny's
76
+ spec raises the minor, so the caret range `npm install` writes follows breaking
77
+ upstream changes; depend with `~` to review them first.
78
+
79
+ ## 🔧 Contributing
80
+
81
+ This package is generated from the official OpenAPI spec and versioned from it.
82
+ How to regenerate it, how versions are derived and how to run the checks is
83
+ described in
84
+ [docs/human_development.md](https://github.com/BunnyWay/bunnynet-typescript/blob/main/docs/human_development.md).
package/dist/mod.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Curated barrel for the Bunny Database API: `/v3/databases` (create, read,
3
+ * update and delete a database, its usage and statistics, its access
4
+ * tokens), `/v3/config` (regions and limits) and `/v3/live` (live metrics).
5
+ * The default server is the host the spec documents,
6
+ * `https://api.bunny.net/database`.
7
+ *
8
+ * `./src/generated/{schemas,client}.ts` are produced by
9
+ * `pnpm codegen:database-effect-v4`. Do not hand-edit them: a re-run overwrites
10
+ * both.
11
+ *
12
+ * This barrel does not `export *` from both generated files. The spec names
13
+ * three response component schemas (`CreateDatabaseV3Response`,
14
+ * `ListConfigV3Response`, `UpdateDatabaseV3Response`) exactly as the client
15
+ * names the response type of the operations that return them, so a double
16
+ * `export *` is ambiguous. The component schemas are the shapes a caller
17
+ * wants: `schemas.ts` is exported whole, and from `client.ts` only the service,
18
+ * its type and `securitySchemes` and the per-operation `*Input` types, none of
19
+ * which collide. The list below is written by hand; a new operation's input
20
+ * type is added to it.
21
+ */
22
+ export * from "./src/generated/schemas.js";
23
+ export { BunnyDatabase, type BunnyDatabaseService, securitySchemes, } from "./src/generated/client.js";
24
+ export type { CreateDatabaseV3Input, DeleteDatabaseV3Input, GenerateDatabaseTokenV3Input, GetDatabaseStatisticsV3Input, GetDatabaseUsageV3Input, GetDatabaseV3Input, GetLiveDatabasesMetricsV3Input, GetOptimalConfigV3Input, GetOptimalSingleRegionConfigV3Input, ListDatabasesV3Input, RevokeDatabaseTokensV3Input, UpdateDatabaseV3Input, } from "./src/generated/client.js";
package/dist/mod.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Curated barrel for the Bunny Database API: `/v3/databases` (create, read,
3
+ * update and delete a database, its usage and statistics, its access
4
+ * tokens), `/v3/config` (regions and limits) and `/v3/live` (live metrics).
5
+ * The default server is the host the spec documents,
6
+ * `https://api.bunny.net/database`.
7
+ *
8
+ * `./src/generated/{schemas,client}.ts` are produced by
9
+ * `pnpm codegen:database-effect-v4`. Do not hand-edit them: a re-run overwrites
10
+ * both.
11
+ *
12
+ * This barrel does not `export *` from both generated files. The spec names
13
+ * three response component schemas (`CreateDatabaseV3Response`,
14
+ * `ListConfigV3Response`, `UpdateDatabaseV3Response`) exactly as the client
15
+ * names the response type of the operations that return them, so a double
16
+ * `export *` is ambiguous. The component schemas are the shapes a caller
17
+ * wants: `schemas.ts` is exported whole, and from `client.ts` only the service,
18
+ * its type and `securitySchemes` and the per-operation `*Input` types, none of
19
+ * which collide. The list below is written by hand; a new operation's input
20
+ * type is added to it.
21
+ */
22
+ export * from "./src/generated/schemas.js";
23
+ export { BunnyDatabase, securitySchemes, } from "./src/generated/client.js";
24
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,aAAa,EAEb,eAAe,GAChB,MAAM,2BAA2B,CAAC","sourcesContent":["/**\n * Curated barrel for the Bunny Database API: `/v3/databases` (create, read,\n * update and delete a database, its usage and statistics, its access\n * tokens), `/v3/config` (regions and limits) and `/v3/live` (live metrics).\n * The default server is the host the spec documents,\n * `https://api.bunny.net/database`.\n *\n * `./src/generated/{schemas,client}.ts` are produced by\n * `pnpm codegen:database-effect-v4`. Do not hand-edit them: a re-run overwrites\n * both.\n *\n * This barrel does not `export *` from both generated files. The spec names\n * three response component schemas (`CreateDatabaseV3Response`,\n * `ListConfigV3Response`, `UpdateDatabaseV3Response`) exactly as the client\n * names the response type of the operations that return them, so a double\n * `export *` is ambiguous. The component schemas are the shapes a caller\n * wants: `schemas.ts` is exported whole, and from `client.ts` only the service,\n * its type and `securitySchemes` and the per-operation `*Input` types, none of\n * which collide. The list below is written by hand; a new operation's input\n * type is added to it.\n */\nexport * from \"./src/generated/schemas.ts\";\nexport {\n BunnyDatabase,\n type BunnyDatabaseService,\n securitySchemes,\n} from \"./src/generated/client.ts\";\nexport type {\n CreateDatabaseV3Input,\n DeleteDatabaseV3Input,\n GenerateDatabaseTokenV3Input,\n GetDatabaseStatisticsV3Input,\n GetDatabaseUsageV3Input,\n GetDatabaseV3Input,\n GetLiveDatabasesMetricsV3Input,\n GetOptimalConfigV3Input,\n GetOptimalSingleRegionConfigV3Input,\n ListDatabasesV3Input,\n RevokeDatabaseTokensV3Input,\n UpdateDatabaseV3Input,\n} from \"./src/generated/client.ts\";\n"]}