@harkly/js 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/dist/api.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { type Client } from "openapi-fetch";
2
+ import type { paths } from "./generated/api-types";
3
+ export type { paths } from "./generated/api-types";
4
+ export type HarklyApiOptions = {
5
+ apiKey: string;
6
+ baseUrl?: string;
7
+ fetch?: typeof fetch;
8
+ };
9
+ export declare function createHarklyApi(o: HarklyApiOptions): Client<paths>;
package/dist/api.js ADDED
@@ -0,0 +1,4 @@
1
+ import t from"openapi-fetch";function a(e){if(!e.apiKey.startsWith("hk_live_"))throw Error("createHarklyApi needs an API key (hk_live_…), not a public key");return t({baseUrl:e.baseUrl??"https://api.harkly.app",headers:{authorization:`Bearer ${e.apiKey}`,"user-agent":"@harkly/js-api"},fetch:e.fetch})}export{a as createHarklyApi};
2
+
3
+ //# debugId=E99BAF83826D863464756E2164756E21
4
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/api.ts"],
4
+ "sourcesContent": [
5
+ "// A typed client for the Harkly API, generated from the same document the\n// server serves at /openapi.json. Server-side only: it carries an API key.\nimport createClient, { type Client } from \"openapi-fetch\";\nimport type { paths } from \"./generated/api-types\";\n\nexport type { paths } from \"./generated/api-types\";\n\nexport type HarklyApiOptions = {\n apiKey: string;\n baseUrl?: string;\n fetch?: typeof fetch;\n};\n\nexport function createHarklyApi(o: HarklyApiOptions): Client<paths> {\n if (!o.apiKey.startsWith(\"hk_live_\")) throw new Error(\"createHarklyApi needs an API key (hk_live_…), not a public key\");\n return createClient<paths>({\n baseUrl: o.baseUrl ?? \"https://api.harkly.app\",\n headers: { authorization: `Bearer ${o.apiKey}`, \"user-agent\": \"@harkly/js-api\" },\n fetch: o.fetch,\n });\n}\n"
6
+ ],
7
+ "mappings": "AAEA,6BAWO,SAAS,CAAe,CAAC,EAAoC,CAClE,GAAI,CAAC,EAAE,OAAO,WAAW,UAAU,EAAG,MAAU,MAAM,gEAA+D,EACrH,OAAO,EAAoB,CACzB,QAAS,EAAE,SAAW,yBACtB,QAAS,CAAE,cAAe,UAAU,EAAE,SAAU,aAAc,gBAAiB,EAC/E,MAAO,EAAE,KACX,CAAC",
8
+ "debugId": "E99BAF83826D863464756E2164756E21",
9
+ "names": []
10
+ }