@journeybee/sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/generated/client.gen.d.ts +13 -0
- package/dist/generated/client.gen.d.ts.map +1 -0
- package/dist/generated/client.gen.js +6 -0
- package/dist/generated/client.gen.js.map +1 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +4 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/sdk.gen.d.ts +6555 -0
- package/dist/generated/sdk.gen.d.ts.map +1 -0
- package/dist/generated/sdk.gen.js +4647 -0
- package/dist/generated/sdk.gen.js.map +1 -0
- package/dist/generated/types.gen.d.ts +15735 -0
- package/dist/generated/types.gen.d.ts.map +1 -0
- package/dist/generated/types.gen.js +3 -0
- package/dist/generated/types.gen.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Journeybee
|
|
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
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @journeybee/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the [Journeybee](https://journeybee.io) PRM API. Auto-generated from the OpenAPI spec with full type safety.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @journeybee/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { client, listPartners, getLead, createLead } from "@journeybee/sdk";
|
|
15
|
+
|
|
16
|
+
// Configure once
|
|
17
|
+
client.setConfig({
|
|
18
|
+
baseUrl: "https://api.journeybee.io/v1",
|
|
19
|
+
auth: "your-api-key",
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// List partners
|
|
23
|
+
const { data: partners } = await listPartners({
|
|
24
|
+
query: { search: "Acme", per_page: 10 },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Get a lead
|
|
28
|
+
const { data: lead } = await getLead({
|
|
29
|
+
path: { uuid: "lead-uuid" },
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Create a lead
|
|
33
|
+
const { data: newLead } = await createLead({
|
|
34
|
+
body: {
|
|
35
|
+
first_name: "Jane",
|
|
36
|
+
last_name: "Smith",
|
|
37
|
+
email: "jane@acme.com",
|
|
38
|
+
partnership_uuid: "partner-uuid",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Authentication
|
|
44
|
+
|
|
45
|
+
Get your API key from **Settings > API Keys** in the Journeybee app.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
client.setConfig({
|
|
49
|
+
baseUrl: "https://api.journeybee.io/v1",
|
|
50
|
+
auth: "your-api-key",
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Multi-tenant / per-request clients
|
|
55
|
+
|
|
56
|
+
The default singleton is fine for single-tenant servers and CLI tools. For multi-tenant servers (one Node process handling multiple users) use `createClient` to build per-request clients instead of mutating the singleton:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createClient, createConfig, listPartners } from "@journeybee/sdk";
|
|
60
|
+
|
|
61
|
+
const userClient = createClient(
|
|
62
|
+
createConfig({
|
|
63
|
+
baseUrl: "https://api.journeybee.io/v1",
|
|
64
|
+
auth: userApiKey,
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const { data } = await listPartners({ client: userClient });
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Every SDK function accepts an optional `client` option that overrides the default. This is how `@journeybee/mcp`'s HTTP transport handles per-request auth safely.
|
|
72
|
+
|
|
73
|
+
## Environment variables
|
|
74
|
+
|
|
75
|
+
**None.** `@journeybee/sdk` is a library consumed by other code — it has zero runtime env var reads. Configuration happens in code via `client.setConfig()` or per-call `client` options. If you need an env-based config, wire it up in your own app (the MCP server is a good example).
|
|
76
|
+
|
|
77
|
+
## Available Functions
|
|
78
|
+
|
|
79
|
+
Every API endpoint has a corresponding typed function:
|
|
80
|
+
|
|
81
|
+
| Pattern | Example |
|
|
82
|
+
| --------- | ------------------------------------------- |
|
|
83
|
+
| `listX` | `listPartners`, `listLeads`, `listDeals` |
|
|
84
|
+
| `getX` | `getPartner`, `getLead`, `getDeal` |
|
|
85
|
+
| `createX` | `createPartner`, `createLead`, `createDeal` |
|
|
86
|
+
| `updateX` | `updatePartner`, `updateLead`, `updateDeal` |
|
|
87
|
+
| `deleteX` | `deletePartner`, `deleteLead`, `deleteDeal` |
|
|
88
|
+
|
|
89
|
+
Plus sub-resource functions: `addLeadTag`, `removeLeadTag`, `createPartnerContact`, `addResourceBlock`, etc.
|
|
90
|
+
|
|
91
|
+
## Error Handling
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
const { data, error } = await getLead({ path: { uuid: "..." } });
|
|
95
|
+
|
|
96
|
+
if (error) {
|
|
97
|
+
console.error(error.code, error.message);
|
|
98
|
+
// error.code: "not_found" | "validation_error" | "unauthorized" | ...
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
console.log(data.first_name);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
- [API Reference](https://docs.journeybee.io/api-reference)
|
|
108
|
+
- [Authentication Guide](https://docs.journeybee.io/guides/authentication)
|
|
109
|
+
- [MCP Server](https://docs.journeybee.io/guides/mcp)
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ClientOptions } from './types.gen';
|
|
2
|
+
import { type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch';
|
|
3
|
+
/**
|
|
4
|
+
* The `createClientConfig()` function will be called on client initialization
|
|
5
|
+
* and the returned object will become the client's initial configuration.
|
|
6
|
+
*
|
|
7
|
+
* You may want to initialize your client this way instead of calling
|
|
8
|
+
* `setConfig()`. This is useful for example if you're using Next.js
|
|
9
|
+
* to ensure your client always has the correct values.
|
|
10
|
+
*/
|
|
11
|
+
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
|
|
12
|
+
export declare const client: import("@hey-api/client-fetch").Client;
|
|
13
|
+
//# sourceMappingURL=client.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.gen.d.ts","sourceRoot":"","sources":["../../src/generated/client.gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,IAAI,oBAAoB,EAA8B,MAAM,uBAAuB,CAAC;AAE5H;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,oBAAoB,GAAG,aAAa,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,oBAAoB,GAAG,CAAC,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7K,eAAO,MAAM,MAAM,wCAEhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.gen.js","sourceRoot":"","sources":["../../src/generated/client.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAGrD,OAAO,EAA2D,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAY5H,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAgB;IAC3D,OAAO,EAAE,8BAA8B;CAC1C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|