@icib.dev/api-client 1.0.1 → 1.0.2
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/README.md +19 -11
- package/dist/api/apiClient.d.ts +1 -3620
- package/dist/api/apiClient.d.ts.map +1 -1
- package/dist/api/apiClient.js +2 -144
- package/dist/api/client.js +1 -1
- package/dist/api/contexts/items.d.ts +5 -0
- package/dist/api/contexts/items.d.ts.map +1 -0
- package/dist/api/contexts/items.js +8 -0
- package/dist/api/index.d.ts +1 -72
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -72
- package/dist/api/types/index.d.ts +1 -1926
- package/dist/api/types/index.d.ts.map +1 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ To regenerate the client from the OpenAPI spec:
|
|
|
29
29
|
npm run generate
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
By default, the spec URL is `$BASE_URL/docs/openapi` when the `BASE_URL` env variable is set (e.g. `BASE_URL=https://api.example.com`). If unset, it falls back to the ICIB default.
|
|
33
|
+
|
|
32
34
|
With options:
|
|
33
35
|
|
|
34
36
|
```bash
|
|
@@ -37,7 +39,7 @@ npm run generate -- --url https://api.icib.dev/docs/?format=openapi --out api
|
|
|
37
39
|
|
|
38
40
|
### Output
|
|
39
41
|
|
|
40
|
-
The generator creates an `api/` folder:
|
|
42
|
+
The generator creates an `api/` folder and a local manifest (`api-client.manifest.json`, gitignored):
|
|
41
43
|
|
|
42
44
|
```
|
|
43
45
|
api/
|
|
@@ -50,6 +52,22 @@ api/
|
|
|
50
52
|
└── index.ts # Re-exports all contexts and types
|
|
51
53
|
```
|
|
52
54
|
|
|
55
|
+
### Hash verification
|
|
56
|
+
|
|
57
|
+
The build verifies that the generated client matches the current OpenAPI docs. When you run `npm run build`, it:
|
|
58
|
+
|
|
59
|
+
1. Reads the manifest (created by `generate`)
|
|
60
|
+
2. Fetches the current docs and compares their hash
|
|
61
|
+
3. Hashes the generated client files and compares with the manifest
|
|
62
|
+
|
|
63
|
+
**If docs changed:** Build fails with:
|
|
64
|
+
> API docs have changed. Run `npm run generate` to regenerate the client, then update your application.
|
|
65
|
+
|
|
66
|
+
**If client was manually edited:** Build fails with:
|
|
67
|
+
> Generated client files were modified. Run `npm run generate` to regenerate.
|
|
68
|
+
|
|
69
|
+
**If manifest is missing:** Run `npm run generate` first (e.g. after a fresh clone).
|
|
70
|
+
|
|
53
71
|
### JSDoc documentation
|
|
54
72
|
|
|
55
73
|
The generated client includes JSDoc comments from the OpenAPI spec:
|
|
@@ -77,13 +95,3 @@ await apiClient.QR_Code.generateCsv(
|
|
|
77
95
|
{ download: true, filename: "qrcodes.csv" },
|
|
78
96
|
);
|
|
79
97
|
```
|
|
80
|
-
|
|
81
|
-
## Publishing
|
|
82
|
-
|
|
83
|
-
To publish to npm under the `@icib.dev` scope:
|
|
84
|
-
|
|
85
|
-
1. Ensure you're logged in: `npm login`
|
|
86
|
-
2. Create the org if needed: `npm org create icib.dev` (or add your user to it)
|
|
87
|
-
3. Publish: `npm publish --access public`
|
|
88
|
-
|
|
89
|
-
The `prepublishOnly` script will automatically run `generate` and `build` before publishing.
|