@punchline-analytics/sdk 0.1.0 → 0.1.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 +2 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @punchline-analytics/sdk
|
|
2
2
|
|
|
3
|
-
A typed client for the [Punchline Analytics](https://
|
|
3
|
+
A typed client for the [Punchline Analytics](https://punchlineanalytics.com) API. Its methods and types are generated from the same OpenAPI spec the API is tested against, so they always match. Works in Node.js 18+, Deno, Bun and edge runtimes: anywhere with `fetch`. No dependencies.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install @punchline-analytics/sdk
|
|
@@ -19,6 +19,6 @@ const { results } = await punchline.query({
|
|
|
19
19
|
});
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Keep the key server-side. Full guide: [TypeScript SDK](https://
|
|
22
|
+
Keep the key server-side. Full guide: [TypeScript SDK](https://punchlineanalytics.com/docs/sdk).
|
|
23
23
|
|
|
24
24
|
MIT licensed.
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface Transport {
|
|
|
8
8
|
interface ClientOptions {
|
|
9
9
|
/** A key from Site settings → API and AI access: pk_live_… */
|
|
10
10
|
apiKey: string;
|
|
11
|
-
/** Default: https://
|
|
11
|
+
/** Default: https://app.punchlineanalytics.com */
|
|
12
12
|
baseUrl?: string;
|
|
13
13
|
/** Custom fetch (tests, proxies). Default: global fetch. */
|
|
14
14
|
fetch?: typeof fetch;
|
|
@@ -24,7 +24,7 @@ declare class PunchlineError extends Error {
|
|
|
24
24
|
readonly docsUrl: string | null;
|
|
25
25
|
constructor(status: number, type: string, code: string, message: string, param: string | null, docsUrl: string | null);
|
|
26
26
|
}
|
|
27
|
-
declare const DEFAULT_BASE_URL = "https://
|
|
27
|
+
declare const DEFAULT_BASE_URL = "https://app.punchlineanalytics.com";
|
|
28
28
|
|
|
29
29
|
type Alert = {
|
|
30
30
|
id?: string;
|
|
@@ -234,6 +234,18 @@ type CreateHandoffResponse = {
|
|
|
234
234
|
url?: string;
|
|
235
235
|
kind?: string;
|
|
236
236
|
expires_at?: string;
|
|
237
|
+
/** With url: the receipt for agents (handoff spec 0.3). Show it next to what was built; agents pass the link on far more reliably with it. */
|
|
238
|
+
receipt?: {
|
|
239
|
+
kind?: string;
|
|
240
|
+
summary?: string;
|
|
241
|
+
value?: number;
|
|
242
|
+
currency?: string;
|
|
243
|
+
expires_at?: string;
|
|
244
|
+
open_url?: string;
|
|
245
|
+
next_step?: string;
|
|
246
|
+
};
|
|
247
|
+
/** The receipt as text, labelled "Receipt for software agents:", ready to put on the page */
|
|
248
|
+
receipt_text?: string;
|
|
237
249
|
agent?: Record<string, unknown>;
|
|
238
250
|
};
|
|
239
251
|
};
|
|
@@ -246,6 +258,8 @@ type CreateHandoffBody = {
|
|
|
246
258
|
expires_in_days?: number;
|
|
247
259
|
/** A path or https URL on your site; the response adds the token to it */
|
|
248
260
|
url?: string;
|
|
261
|
+
/** What was built, for the receipt: "Team plan + SMS reminders" */
|
|
262
|
+
summary?: string;
|
|
249
263
|
/** The agent's request, used in memory only */
|
|
250
264
|
visitor?: {
|
|
251
265
|
ip: string;
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var PunchlineError = class extends Error {
|
|
|
15
15
|
param;
|
|
16
16
|
docsUrl;
|
|
17
17
|
};
|
|
18
|
-
var DEFAULT_BASE_URL = "https://
|
|
18
|
+
var DEFAULT_BASE_URL = "https://app.punchlineanalytics.com";
|
|
19
19
|
function createTransport(opts) {
|
|
20
20
|
if (!/^pk_(live|test)_[A-Za-z0-9]{32}$/.test(opts.apiKey)) throw new Error("apiKey should look like pk_live_ followed by 32 characters");
|
|
21
21
|
const base = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punchline-analytics/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Typed client for the Punchline Analytics API, generated from its OpenAPI spec.",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://punchlineanalytics.com/docs/sdk",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"analytics",
|
|
10
10
|
"ai-agents",
|