@baziapi/sdk 1.0.1 → 1.0.3
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 +14 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ console.log(result.luckPillars?.pillars); // 10-year luck cycles
|
|
|
59
59
|
```typescript
|
|
60
60
|
const client = new BaziClient({
|
|
61
61
|
apiKey: 'bazi_xxxx', // Your BaZi API key
|
|
62
|
-
baseUrl: 'https://api.
|
|
62
|
+
baseUrl: 'https://api.example.com', // API base URL (default: production)
|
|
63
63
|
timeout: 10_000, // Request timeout in ms (default: 10s)
|
|
64
64
|
retries: 3, // Retry attempts for transient errors (default: 3)
|
|
65
65
|
retryDelay: 500, // Base retry delay in ms, exponential (default: 500ms)
|
|
@@ -175,18 +175,20 @@ import type {
|
|
|
175
175
|
For CSP-compliant usage, add the API domain to your `connect-src` directive:
|
|
176
176
|
|
|
177
177
|
```
|
|
178
|
-
Content-Security-Policy: connect-src 'self' https://api.
|
|
178
|
+
Content-Security-Policy: connect-src 'self' https://api.example.com;
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
---
|
|
182
182
|
|
|
183
|
-
## Examples
|
|
183
|
+
## 📂 Runnable Examples
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
- [
|
|
188
|
-
- [
|
|
189
|
-
- [
|
|
185
|
+
Explore complete, plug-and-play runnable code examples in the official repository:
|
|
186
|
+
|
|
187
|
+
- 🚀 [**Node.js (ESM)**](https://github.com/Shoyas/bazi-api-sdk/tree/main/packages/bazi/examples/node-esm) — Modern ES Modules (`import`) with error handling
|
|
188
|
+
- 📦 [**Node.js (CommonJS)**](https://github.com/Shoyas/bazi-api-sdk/tree/main/packages/bazi/examples/node-cjs) — Legacy Node.js (`require`) setup
|
|
189
|
+
- ⚡ [**Bun**](https://github.com/Shoyas/bazi-api-sdk/tree/main/packages/bazi/examples/bun) — High-performance TypeScript execution with Bun runtime
|
|
190
|
+
- 🌐 [**Next.js 14 (App Router)**](https://github.com/Shoyas/bazi-api-sdk/tree/main/packages/bazi/examples/next-js) — Secure Server Component calculation without leaking API keys
|
|
191
|
+
- 💻 [**Browser / CDN**](https://github.com/Shoyas/bazi-api-sdk/tree/main/packages/bazi/examples/browser) — Standalone HTML & Vanilla JavaScript integration via CDN
|
|
190
192
|
|
|
191
193
|
---
|
|
192
194
|
|
|
@@ -700,7 +702,7 @@ functions:
|
|
|
700
702
|
| Field | Value |
|
|
701
703
|
| ------------------ | ----------------------------------------------- |
|
|
702
704
|
| **Method** | `POST` |
|
|
703
|
-
| **URL** | `https://api.
|
|
705
|
+
| **URL** | `https://api.example.com/api/v1/bazi/calculate` |
|
|
704
706
|
| **Authentication** | Header Auth → `Authorization: Bearer bazi_xxxx` |
|
|
705
707
|
| **Content-Type** | `application/json` |
|
|
706
708
|
|
|
@@ -743,7 +745,7 @@ return [{ json: result }];
|
|
|
743
745
|
|
|
744
746
|
| Field | Value |
|
|
745
747
|
| ---------------- | ----------------------------------------------- |
|
|
746
|
-
| **URL** | `https://api.
|
|
748
|
+
| **URL** | `https://api.example.com/api/v1/bazi/calculate` |
|
|
747
749
|
| **Payload Type** | `JSON` |
|
|
748
750
|
| **Headers** | `Authorization: Bearer bazi_xxxx` |
|
|
749
751
|
|
|
@@ -815,7 +817,7 @@ Use **HTTP → Make a request** module:
|
|
|
815
817
|
|
|
816
818
|
| Field | Value |
|
|
817
819
|
| ------------- | ----------------------------------------------- |
|
|
818
|
-
| **URL** | `https://api.
|
|
820
|
+
| **URL** | `https://api.example.com/api/v1/bazi/calculate` |
|
|
819
821
|
| **Method** | `POST` |
|
|
820
822
|
| **Headers** | `Authorization: Bearer bazi_xxxx` |
|
|
821
823
|
| **Body type** | `Raw` → `application/json` |
|
|
@@ -837,7 +839,7 @@ Use **HTTP → Make a request** module:
|
|
|
837
839
|
#### cURL (Testing / CI)
|
|
838
840
|
|
|
839
841
|
```bash
|
|
840
|
-
curl -X POST https://api.
|
|
842
|
+
curl -X POST https://api.example.com/api/v1/bazi/calculate \
|
|
841
843
|
-H "Authorization: Bearer bazi_xxxx" \
|
|
842
844
|
-H "Content-Type: application/json" \
|
|
843
845
|
-d '{
|
package/dist/index.cjs
CHANGED
|
@@ -722,7 +722,7 @@ async function verifyWebhookSignature(options) {
|
|
|
722
722
|
var __defProp = Object.defineProperty;
|
|
723
723
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
724
724
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
725
|
-
const DEFAULT_BASE_URL = "https://api.
|
|
725
|
+
const DEFAULT_BASE_URL = "https://api.example.com";
|
|
726
726
|
const DEFAULT_TIMEOUT = 1e4;
|
|
727
727
|
const DEFAULT_RETRIES = 3;
|
|
728
728
|
const DEFAULT_RETRY_DELAY = 500;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -720,7 +720,7 @@ async function verifyWebhookSignature(options) {
|
|
|
720
720
|
var __defProp = Object.defineProperty;
|
|
721
721
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
722
722
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
723
|
-
const DEFAULT_BASE_URL = "https://api.
|
|
723
|
+
const DEFAULT_BASE_URL = "https://api.example.com";
|
|
724
724
|
const DEFAULT_TIMEOUT = 1e4;
|
|
725
725
|
const DEFAULT_RETRIES = 3;
|
|
726
726
|
const DEFAULT_RETRY_DELAY = 500;
|