@bunny.net/api-client-effect-v4 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +75 -2
- package/dist/mod.d.ts +13 -0
- package/dist/mod.js +14 -0
- package/dist/mod.js.map +1 -0
- package/package.json +51 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @bunny.net/api-client-effect-v4
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e9e8638: Depends on the clients' new minors, in which `value` of an error status the spec
|
|
8
|
+
declares without content is `unknown` (the API's body) instead of `undefined`;
|
|
9
|
+
their changelogs list what that breaks.
|
|
10
|
+
- Updated dependencies [e9e8638]
|
|
11
|
+
- @bunny.net/api-client-effect-v4-runtime@1.2.0
|
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,76 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
7
|
+
# Bunny API client for Effect 4
|
|
8
|
+
|
|
9
|
+
This package contains `@bunny.net/api-client-effect-v4`, the whole Bunny API as
|
|
10
|
+
one [Effect](https://effect.website) package. It re-exports the four generated
|
|
11
|
+
clients under a namespace each, plus the runtime they share:
|
|
12
|
+
|
|
13
|
+
- `BunnyCore`: pull zones, storage zone management, DNS, video, billing, purge
|
|
14
|
+
and statistics (`@bunny.net/api-client-effect-v4-core`)
|
|
15
|
+
- `BunnyCompute`: Edge Scripting (`@bunny.net/api-client-effect-v4-compute`)
|
|
16
|
+
- `BunnyMagicContainers`: Magic Containers
|
|
17
|
+
(`@bunny.net/api-client-effect-v4-magic-containers`)
|
|
18
|
+
- `BunnyStorage`: Edge Storage files (`@bunny.net/api-client-effect-v4-storage`)
|
|
19
|
+
- `BunnyCredentials` and the error types
|
|
20
|
+
(`@bunny.net/api-client-effect-v4-runtime`)
|
|
21
|
+
|
|
22
|
+
Install a single client instead if that is all you need; each one is published
|
|
23
|
+
on its own and versions with its spec.
|
|
24
|
+
|
|
25
|
+
## 🥕 Usage
|
|
26
|
+
|
|
27
|
+
Install it together with `effect`:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm install @bunny.net/api-client-effect-v4 effect
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Using two APIs with one credential
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { Effect, Layer } from "effect";
|
|
37
|
+
import { FetchHttpClient } from "effect/http";
|
|
38
|
+
import {
|
|
39
|
+
BunnyCompute,
|
|
40
|
+
BunnyCore,
|
|
41
|
+
BunnyCredentials,
|
|
42
|
+
} from "@bunny.net/api-client-effect-v4";
|
|
43
|
+
|
|
44
|
+
const program = Effect.gen(function* () {
|
|
45
|
+
const core = yield* BunnyCore.BunnyCore;
|
|
46
|
+
const compute = yield* BunnyCompute.BunnyCompute;
|
|
47
|
+
const zones = yield* core.pullZonePublicIndexAll({ query: { perPage: 10 } });
|
|
48
|
+
const scripts = yield* compute
|
|
49
|
+
.listEdgeScriptsEndpointListEdgeScriptsByAccount({});
|
|
50
|
+
console.log(zones.value.length, "pull zones");
|
|
51
|
+
console.log(scripts.value.Items?.length ?? 0, "scripts");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const services = Layer.mergeAll(
|
|
55
|
+
BunnyCore.BunnyCore.Default,
|
|
56
|
+
BunnyCompute.BunnyCompute.Default,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const Live = services.pipe(
|
|
60
|
+
Layer.provide(BunnyCredentials.fromEnv()), // reads BUNNYNET_API_KEY
|
|
61
|
+
Layer.provide(FetchHttpClient.layer),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
await Effect.runPromise(program.pipe(Effect.provide(Live)));
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Every client is an Effect service that needs an `HttpClient` and
|
|
68
|
+
`BunnyCredentials`; merge the ones you use and provide both once. Each client's
|
|
69
|
+
README describes its own host and credential. The same package with Zod schemas
|
|
70
|
+
instead of Effect is `@bunny.net/api-client-zod`. On Deno, import
|
|
71
|
+
`npm:@bunny.net/api-client-effect-v4`.
|
|
72
|
+
|
|
73
|
+
## 🔧 Contributing
|
|
74
|
+
|
|
75
|
+
The development setup, the commands and how releases are made are described in
|
|
76
|
+
[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,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Umbrella over every Bunny.net API client surface for Effect 4. Each
|
|
3
|
+
* surface is also published on its own (`@bunny.net/api-client-effect-v4-core`,
|
|
4
|
+
* `-compute`, `-magic-containers`, `-storage`) and versions independently;
|
|
5
|
+
* install one of those if you only need a single API.
|
|
6
|
+
*
|
|
7
|
+
* Namespaced because every surface exports the same scaffolding names.
|
|
8
|
+
*/
|
|
9
|
+
export * as BunnyCore from "@bunny.net/api-client-effect-v4-core";
|
|
10
|
+
export * as BunnyCompute from "@bunny.net/api-client-effect-v4-compute";
|
|
11
|
+
export * as BunnyMagicContainers from "@bunny.net/api-client-effect-v4-magic-containers";
|
|
12
|
+
export * as BunnyStorage from "@bunny.net/api-client-effect-v4-storage";
|
|
13
|
+
export * from "@bunny.net/api-client-effect-v4-runtime";
|
package/dist/mod.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Umbrella over every Bunny.net API client surface for Effect 4. Each
|
|
3
|
+
* surface is also published on its own (`@bunny.net/api-client-effect-v4-core`,
|
|
4
|
+
* `-compute`, `-magic-containers`, `-storage`) and versions independently;
|
|
5
|
+
* install one of those if you only need a single API.
|
|
6
|
+
*
|
|
7
|
+
* Namespaced because every surface exports the same scaffolding names.
|
|
8
|
+
*/
|
|
9
|
+
export * as BunnyCore from "@bunny.net/api-client-effect-v4-core";
|
|
10
|
+
export * as BunnyCompute from "@bunny.net/api-client-effect-v4-compute";
|
|
11
|
+
export * as BunnyMagicContainers from "@bunny.net/api-client-effect-v4-magic-containers";
|
|
12
|
+
export * as BunnyStorage from "@bunny.net/api-client-effect-v4-storage";
|
|
13
|
+
export * from "@bunny.net/api-client-effect-v4-runtime";
|
|
14
|
+
//# sourceMappingURL=mod.js.map
|
package/dist/mod.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,SAAS,MAAM,sCAAsC,CAAC;AAClE,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,oBAAoB,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAC;AACxE,cAAc,yCAAyC,CAAC","sourcesContent":["/**\n * Umbrella over every Bunny.net API client surface for Effect 4. Each\n * surface is also published on its own (`@bunny.net/api-client-effect-v4-core`,\n * `-compute`, `-magic-containers`, `-storage`) and versions independently;\n * install one of those if you only need a single API.\n *\n * Namespaced because every surface exports the same scaffolding names.\n */\nexport * as BunnyCore from \"@bunny.net/api-client-effect-v4-core\";\nexport * as BunnyCompute from \"@bunny.net/api-client-effect-v4-compute\";\nexport * as BunnyMagicContainers from \"@bunny.net/api-client-effect-v4-magic-containers\";\nexport * as BunnyStorage from \"@bunny.net/api-client-effect-v4-storage\";\nexport * from \"@bunny.net/api-client-effect-v4-runtime\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunny.net/api-client-effect-v4",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Bunny.net API client for Effect 4 — umbrella package re-exporting every surface api. Install a single surface package instead if you only need one.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/BunnyWay/bunnynet-typescript.git",
|
|
10
|
+
"directory": "packages/api-client-effect-v4"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"bunny",
|
|
14
|
+
"bunny.net",
|
|
15
|
+
"bunnycdn",
|
|
16
|
+
"api-client",
|
|
17
|
+
"effect",
|
|
18
|
+
"effect-ts",
|
|
19
|
+
"openapi",
|
|
20
|
+
"cdn",
|
|
21
|
+
"edge-scripting",
|
|
22
|
+
"magic-containers",
|
|
23
|
+
"storage"
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"CHANGELOG.md",
|
|
29
|
+
"!dist/tsconfig.tsbuildinfo"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/mod.d.ts",
|
|
34
|
+
"default": "./dist/mod.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@bunny.net/api-client-effect-v4-core": "^1.1.202611171049",
|
|
39
|
+
"@bunny.net/api-client-effect-v4-compute": "^1.1.202611171049",
|
|
40
|
+
"@bunny.net/api-client-effect-v4-magic-containers": "^1.4.202611171049",
|
|
41
|
+
"@bunny.net/api-client-effect-v4-runtime": "^1.2.0",
|
|
42
|
+
"@bunny.net/api-client-effect-v4-storage": "^1.1.202611171049"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"effect": "^4.1.4"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"effect": "^4.1.4"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc -b",
|
|
52
|
+
"clean": "rm -rf dist"
|
|
53
|
+
}
|
|
6
54
|
}
|