@baziapi/sdk 1.0.0 → 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 +36 -34
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @baziapi/sdk
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@baziapi/sdk)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
|
|
@@ -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.baziapi.pro', // 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.baziapi.pro;
|
|
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.baziapi.pro/api/v1/bazi/calculate` |
|
|
704
706
|
| **Authentication** | Header Auth → `Authorization: Bearer bazi_xxxx` |
|
|
705
707
|
| **Content-Type** | `application/json` |
|
|
706
708
|
|
|
@@ -741,11 +743,11 @@ return [{ json: result }];
|
|
|
741
743
|
|
|
742
744
|
**Option A — Webhooks by Zapier → POST**:
|
|
743
745
|
|
|
744
|
-
| Field | Value
|
|
745
|
-
| ---------------- |
|
|
746
|
-
| **URL** | `https://api.
|
|
747
|
-
| **Payload Type** | `JSON`
|
|
748
|
-
| **Headers** | `Authorization: Bearer bazi_xxxx`
|
|
746
|
+
| Field | Value |
|
|
747
|
+
| ---------------- | ----------------------------------------------- |
|
|
748
|
+
| **URL** | `https://api.baziapi.pro/api/v1/bazi/calculate` |
|
|
749
|
+
| **Payload Type** | `JSON` |
|
|
750
|
+
| **Headers** | `Authorization: Bearer bazi_xxxx` |
|
|
749
751
|
|
|
750
752
|
**Data:**
|
|
751
753
|
|
|
@@ -813,12 +815,12 @@ export default defineComponent({
|
|
|
813
815
|
|
|
814
816
|
Use **HTTP → Make a request** module:
|
|
815
817
|
|
|
816
|
-
| Field | Value
|
|
817
|
-
| ------------- |
|
|
818
|
-
| **URL** | `https://api.
|
|
819
|
-
| **Method** | `POST`
|
|
820
|
-
| **Headers** | `Authorization: Bearer bazi_xxxx`
|
|
821
|
-
| **Body type** | `Raw` → `application/json`
|
|
818
|
+
| Field | Value |
|
|
819
|
+
| ------------- | ----------------------------------------------- |
|
|
820
|
+
| **URL** | `https://api.baziapi.pro/api/v1/bazi/calculate` |
|
|
821
|
+
| **Method** | `POST` |
|
|
822
|
+
| **Headers** | `Authorization: Bearer bazi_xxxx` |
|
|
823
|
+
| **Body type** | `Raw` → `application/json` |
|
|
822
824
|
|
|
823
825
|
**Body:**
|
|
824
826
|
|
|
@@ -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.baziapi.pro/api/v1/bazi/calculate \
|
|
841
843
|
-H "Authorization: Bearer bazi_xxxx" \
|
|
842
844
|
-H "Content-Type: application/json" \
|
|
843
845
|
-d '{
|
|
@@ -859,15 +861,14 @@ To use this SDK in production, you need an active API Key from our platform. We
|
|
|
859
861
|
|
|
860
862
|
### Monthly Plans
|
|
861
863
|
|
|
862
|
-
| Feature
|
|
863
|
-
|
|
|
864
|
-
| **Target**
|
|
865
|
-
| **Price**
|
|
866
|
-
| **Rate Limit**
|
|
867
|
-
| **API Keys**
|
|
868
|
-
| **14-Day Trial** | ✅ | ❌ | ❌ | ❌ |
|
|
864
|
+
| Feature | 🆓 Free | 🚀 Basic | ⚡ Pro | 💎 Premium |
|
|
865
|
+
| -------------- | :--------------: | :-----------: | :-----------: | :-------------: |
|
|
866
|
+
| **Target** | Developer / Test | Indie Dev | Startup | Enterprise |
|
|
867
|
+
| **Price** | $0 / mo | $19 / mo | $49 / mo | $149 / mo |
|
|
868
|
+
| **Rate Limit** | 30 req / min | 300 req / min | 500 req / min | 1,000 req / min |
|
|
869
|
+
| **API Keys** | 1 | 3 | 10 | 30 |
|
|
869
870
|
|
|
870
|
-
### Yearly Plans _(Save
|
|
871
|
+
### Yearly Plans _(Save ~20%)_
|
|
871
872
|
|
|
872
873
|
| Feature | 🆓 Free | 🚀 Basic | ⚡ Pro | 💎 Premium |
|
|
873
874
|
| ---------------------- | :----------: | :-----------: | :-----------: | :-------------: |
|
|
@@ -875,18 +876,19 @@ To use this SDK in production, you need an active API Key from our platform. We
|
|
|
875
876
|
| **Billed Annually** | — | $180 / yr | $468 / yr | $1,428 / yr |
|
|
876
877
|
| **Savings vs Monthly** | — | ~21% off | ~20% off | ~20% off |
|
|
877
878
|
| **Rate Limit** | 30 req / min | 300 req / min | 500 req / min | 1,000 req / min |
|
|
878
|
-
| **API Keys** | 1 | 3 | 10 |
|
|
879
|
+
| **API Keys** | 1 | 3 | 10 | 30 |
|
|
879
880
|
|
|
880
881
|
> 💡 **Need more?** Contact us for custom enterprise plans with higher rate limits and dedicated support.
|
|
881
882
|
|
|
882
|
-
👉 **
|
|
883
|
+
👉 **Get your API Key & View Details:** N/A _(Coming Soon)_
|
|
883
884
|
|
|
884
885
|
---
|
|
885
886
|
|
|
886
887
|
## Support
|
|
887
888
|
|
|
888
|
-
- **Email:**
|
|
889
|
-
- **Documentation:**
|
|
889
|
+
- **Email:** shoyas@github.com
|
|
890
|
+
- **Documentation:** N/A _(Coming Soon)_
|
|
891
|
+
- **Repository:** [https://github.com/Shoyas/bazi-api-sdk](https://github.com/Shoyas/bazi-api-sdk)
|
|
890
892
|
|
|
891
893
|
---
|
|
892
894
|
|
package/dist/index.cjs
CHANGED
|
@@ -655,7 +655,7 @@ class WebhookService {
|
|
|
655
655
|
*
|
|
656
656
|
* @example
|
|
657
657
|
* ```typescript
|
|
658
|
-
* import { BaziClient } from '@
|
|
658
|
+
* import { BaziClient } from '@baziapi/sdk';
|
|
659
659
|
*
|
|
660
660
|
* const client = new BaziClient();
|
|
661
661
|
* const isValid = await client.webhooks.verifySignature({
|
|
@@ -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.baziapi.pro";
|
|
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
|
@@ -710,7 +710,7 @@ declare class WebhookService {
|
|
|
710
710
|
*
|
|
711
711
|
* @example
|
|
712
712
|
* ```typescript
|
|
713
|
-
* import { BaziClient } from '@
|
|
713
|
+
* import { BaziClient } from '@baziapi/sdk';
|
|
714
714
|
*
|
|
715
715
|
* const client = new BaziClient();
|
|
716
716
|
* const isValid = await client.webhooks.verifySignature({
|
|
@@ -760,7 +760,7 @@ interface BaziClientOptions {
|
|
|
760
760
|
readonly apiKey?: string;
|
|
761
761
|
/**
|
|
762
762
|
* Base URL of the BaZi API server.
|
|
763
|
-
* @default 'https://api.
|
|
763
|
+
* @default 'https://api.baziapi.pro'
|
|
764
764
|
*/
|
|
765
765
|
readonly baseUrl?: string;
|
|
766
766
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -710,7 +710,7 @@ declare class WebhookService {
|
|
|
710
710
|
*
|
|
711
711
|
* @example
|
|
712
712
|
* ```typescript
|
|
713
|
-
* import { BaziClient } from '@
|
|
713
|
+
* import { BaziClient } from '@baziapi/sdk';
|
|
714
714
|
*
|
|
715
715
|
* const client = new BaziClient();
|
|
716
716
|
* const isValid = await client.webhooks.verifySignature({
|
|
@@ -760,7 +760,7 @@ interface BaziClientOptions {
|
|
|
760
760
|
readonly apiKey?: string;
|
|
761
761
|
/**
|
|
762
762
|
* Base URL of the BaZi API server.
|
|
763
|
-
* @default 'https://api.
|
|
763
|
+
* @default 'https://api.baziapi.pro'
|
|
764
764
|
*/
|
|
765
765
|
readonly baseUrl?: string;
|
|
766
766
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -710,7 +710,7 @@ declare class WebhookService {
|
|
|
710
710
|
*
|
|
711
711
|
* @example
|
|
712
712
|
* ```typescript
|
|
713
|
-
* import { BaziClient } from '@
|
|
713
|
+
* import { BaziClient } from '@baziapi/sdk';
|
|
714
714
|
*
|
|
715
715
|
* const client = new BaziClient();
|
|
716
716
|
* const isValid = await client.webhooks.verifySignature({
|
|
@@ -760,7 +760,7 @@ interface BaziClientOptions {
|
|
|
760
760
|
readonly apiKey?: string;
|
|
761
761
|
/**
|
|
762
762
|
* Base URL of the BaZi API server.
|
|
763
|
-
* @default 'https://api.
|
|
763
|
+
* @default 'https://api.baziapi.pro'
|
|
764
764
|
*/
|
|
765
765
|
readonly baseUrl?: string;
|
|
766
766
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -653,7 +653,7 @@ class WebhookService {
|
|
|
653
653
|
*
|
|
654
654
|
* @example
|
|
655
655
|
* ```typescript
|
|
656
|
-
* import { BaziClient } from '@
|
|
656
|
+
* import { BaziClient } from '@baziapi/sdk';
|
|
657
657
|
*
|
|
658
658
|
* const client = new BaziClient();
|
|
659
659
|
* const isValid = await client.webhooks.verifySignature({
|
|
@@ -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.baziapi.pro";
|
|
724
724
|
const DEFAULT_TIMEOUT = 1e4;
|
|
725
725
|
const DEFAULT_RETRIES = 3;
|
|
726
726
|
const DEFAULT_RETRY_DELAY = 500;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baziapi/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Official TypeScript SDK for the BaZi API",
|
|
5
5
|
"author": "Md. Nasir Uddin Shoyas",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/Shoyas/bazi-api-sdk.git",
|
|
10
10
|
"directory": "packages/bazi"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://
|
|
12
|
+
"homepage": "https://github.com/Shoyas/bazi-api-sdk#readme",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/Shoyas/bazi-api-sdk/issues"
|
|
15
15
|
},
|
|
@@ -44,15 +44,6 @@
|
|
|
44
44
|
"api-client"
|
|
45
45
|
],
|
|
46
46
|
"sideEffects": false,
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
49
|
-
"@typescript-eslint/parser": "^8.0.0",
|
|
50
|
-
"@vitest/coverage-v8": "^2.0.0",
|
|
51
|
-
"eslint": "^9.0.0",
|
|
52
|
-
"typescript": "^5.6.3",
|
|
53
|
-
"unbuild": "^3.0.0",
|
|
54
|
-
"vitest": "^2.0.0"
|
|
55
|
-
},
|
|
56
47
|
"scripts": {
|
|
57
48
|
"build": "unbuild",
|
|
58
49
|
"dev": "unbuild --stub",
|
|
@@ -62,5 +53,14 @@
|
|
|
62
53
|
"type-check": "tsc --noEmit",
|
|
63
54
|
"lint": "eslint src",
|
|
64
55
|
"clean": "rm -rf dist"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
59
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
60
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
61
|
+
"eslint": "^9.0.0",
|
|
62
|
+
"typescript": "^5.6.3",
|
|
63
|
+
"unbuild": "^3.0.0",
|
|
64
|
+
"vitest": "^2.0.0"
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|