@kookee/sdk 0.0.23 → 0.0.24

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 CHANGED
@@ -42,8 +42,8 @@ const post = await kookee.blog.getBySlug('hello-world');
42
42
  // List posts with pagination
43
43
  const posts = await kookee.blog.list({ page: 1, limit: 10 });
44
44
 
45
- // Filter by tag slug
46
- const taggedPosts = await kookee.blog.list({ tag: 'news' });
45
+ // Filter by tag slugs
46
+ const taggedPosts = await kookee.blog.list({ tags: ['news'] });
47
47
 
48
48
  // Search posts
49
49
  const searchResults = await kookee.blog.list({ search: 'tutorial' });
@@ -56,40 +56,172 @@ const postById = await kookee.blog.getById('post-uuid');
56
56
 
57
57
  // Get all tags with post counts
58
58
  const tags = await kookee.blog.getTags();
59
- ```
60
59
 
61
- ## Response Types
60
+ // React to a post
61
+ await kookee.blog.react('post-id', { reactionType: 'heart', action: 'add' });
62
+
63
+ // Get translations
64
+ const translations = await kookee.blog.getTranslationsBySlug('my-post');
65
+ ```
62
66
 
63
- ### BlogPostListItem (returned by `list()`)
67
+ ## Help Center
64
68
 
65
69
  ```typescript
66
- interface BlogPostListItem {
67
- id: string;
68
- slug: string;
69
- title: string;
70
- excerptHtml: string | null;
71
- coverImageUrl: string | null;
72
- status: string;
73
- publishedAt: string | null;
74
- metadata: Record<string, unknown> | null;
75
- createdAt: string;
76
- author: { name: string };
77
- tags: Array<{ name: string; slug: string }>;
70
+ // List categories
71
+ const categories = await kookee.help.categories();
72
+
73
+ // List articles with pagination
74
+ const articles = await kookee.help.list({ page: 1, limit: 10 });
75
+
76
+ // Filter by category slug
77
+ const categoryArticles = await kookee.help.list({ category: 'getting-started' });
78
+
79
+ // Semantic search
80
+ const results = await kookee.help.search({ query: 'how to reset password', limit: 5 });
81
+
82
+ // Get single article
83
+ const article = await kookee.help.getBySlug('getting-started');
84
+ const articleById = await kookee.help.getById('article-uuid');
85
+
86
+ // Get article translations
87
+ const translations = await kookee.help.getTranslationsBySlug('getting-started');
88
+
89
+ // AI-powered chat
90
+ const response = await kookee.help.chat({
91
+ messages: [{ role: 'user', content: 'How do I reset my password?' }],
92
+ });
93
+
94
+ // Streaming chat
95
+ for await (const chunk of kookee.help.chatStream({ messages })) {
96
+ if (chunk.type === 'delta') console.log(chunk.content);
97
+ if (chunk.type === 'sources') console.log('Sources:', chunk.sources);
78
98
  }
99
+
100
+ // Vote on article usefulness
101
+ await kookee.help.voteUsefulness('article-id', 'yes');
79
102
  ```
80
103
 
81
- ### BlogPost (returned by `getBySlug()` and `getById()`)
104
+ ## Changelog
82
105
 
83
106
  ```typescript
84
- interface BlogPost extends BlogPostListItem {
85
- contentHtml: string;
86
- metaTitle: string | null;
87
- metaDescription: string | null;
88
- updatedAt: string;
89
- }
107
+ // List entries
108
+ const entries = await kookee.changelog.list({ page: 1, limit: 10 });
109
+
110
+ // Filter by type: 'feature' | 'fix' | 'improvement' | 'breaking' | 'security' | 'deprecated' | 'other'
111
+ const fixes = await kookee.changelog.list({ type: 'fix' });
112
+
113
+ // Order by version or date
114
+ const sorted = await kookee.changelog.list({ orderBy: 'version', order: 'desc' });
115
+
116
+ // Get single entry
117
+ const entry = await kookee.changelog.getBySlug('v1-0-0');
118
+ const entryById = await kookee.changelog.getById('entry-uuid');
119
+
120
+ // Get translations
121
+ const translations = await kookee.changelog.getTranslationsBySlug('v1-0-0');
122
+
123
+ // React to an entry
124
+ await kookee.changelog.react('entry-id', { reactionType: 'fire', action: 'add' });
90
125
  ```
91
126
 
92
- ### Paginated Response
127
+ ## Announcements
128
+
129
+ ```typescript
130
+ // List announcements
131
+ const announcements = await kookee.announcements.list({ page: 1, limit: 10 });
132
+
133
+ // Filter by type: 'info' | 'warning' | 'critical' | 'promotion' | 'maintenance' | 'newFeature'
134
+ const critical = await kookee.announcements.list({ type: 'critical' });
135
+
136
+ // Exclude already-seen announcements
137
+ const unseen = await kookee.announcements.list({ excludeIds: ['id1', 'id2'] });
138
+
139
+ // Get single announcement
140
+ const announcement = await kookee.announcements.getById('announcement-uuid');
141
+
142
+ // Get translations
143
+ const translations = await kookee.announcements.getTranslationsById('announcement-uuid');
144
+ ```
145
+
146
+ ## Pages
147
+
148
+ ```typescript
149
+ // List pages
150
+ const pages = await kookee.pages.list({ page: 1, limit: 10 });
151
+
152
+ // Search pages
153
+ const results = await kookee.pages.list({ search: 'privacy' });
154
+
155
+ // Get single page
156
+ const page = await kookee.pages.getBySlug('privacy-policy');
157
+ const pageById = await kookee.pages.getById('page-uuid');
158
+
159
+ // Get translations
160
+ const translations = await kookee.pages.getTranslationsBySlug('privacy-policy');
161
+ ```
162
+
163
+ ## Feedback
164
+
165
+ ```typescript
166
+ // List feedback posts
167
+ const posts = await kookee.feedback.list({ page: 1, limit: 10 });
168
+
169
+ // Filter by status: 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined'
170
+ const planned = await kookee.feedback.list({ status: 'planned' });
171
+
172
+ // Filter by category: 'feature' | 'improvement' | 'bug' | 'other'
173
+ const bugs = await kookee.feedback.list({ category: 'bug' });
174
+
175
+ // Sort options: 'newest' | 'top' | 'trending'
176
+ const trending = await kookee.feedback.list({ sort: 'trending' });
177
+
178
+ // Get single post with comments
179
+ const post = await kookee.feedback.getById('post-uuid');
180
+
181
+ // Vote on a post
182
+ await kookee.feedback.vote('post-id', { action: 'upvote' });
183
+
184
+ // Get top contributors
185
+ const contributors = await kookee.feedback.getTopContributors({ limit: 10 });
186
+ ```
187
+
188
+ ## Config
189
+
190
+ ```typescript
191
+ // Get a single config value
192
+ const config = await kookee.config.getByKey('feature_flags');
193
+
194
+ // Get multiple config values
195
+ const configs = await kookee.config.list({ keys: ['feature_flags', 'theme'] });
196
+ ```
197
+
198
+ ## Reactions
199
+
200
+ Blog posts and changelog entries support reactions:
201
+
202
+ ```typescript
203
+ // Available reaction types: 'fire' | 'heart' | 'rocket' | 'eyes' | 'mindblown'
204
+ await kookee.blog.react('post-id', { reactionType: 'heart', action: 'add' });
205
+
206
+ // Remove a reaction
207
+ await kookee.blog.react('post-id', { reactionType: 'heart', action: 'remove' });
208
+ ```
209
+
210
+ ## Localization
211
+
212
+ Most endpoints support locale options:
213
+
214
+ ```typescript
215
+ // Specify locale
216
+ const posts = await kookee.blog.list({ locale: 'de' });
217
+
218
+ // With fallback to default locale if translation doesn't exist
219
+ const post = await kookee.blog.getBySlug('hello-world', { locale: 'de', fallback: true });
220
+ ```
221
+
222
+ ## Paginated Response
223
+
224
+ All list endpoints return a paginated response:
93
225
 
94
226
  ```typescript
95
227
  interface PaginatedResponse<T> {
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var I="https://api.kookee.dev",H="Kookee-API-Key",i=class extends Error{constructor(t,n,o){super(n);this.code=t;this.status=o;this.name="KookeeApiError";}},P=class{baseUrl;apiKey;constructor(e,t){this.apiKey=e,this.baseUrl=t??I;}getHeaders(){return {"Content-Type":"application/json",[H]:this.apiKey}}async get(e,t){let n=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,s]of Object.entries(t))if(s!=null)if(Array.isArray(s))for(let a of s)n.searchParams.append(y,String(a));else n.searchParams.set(y,String(s));}let o=await fetch(n.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(n)}async*streamPost(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!n.ok){let a=null;try{a=await n.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${n.status}`,n.status)}if(!n.body)return;let o=n.body.getReader(),y=new TextDecoder,s="";try{for(;;){let{done:a,value:C}=await o.read();if(a)break;s+=y.decode(C,{stream:!0});let R=s.split(`
2
- `);s=R.pop()??"";for(let B of R){let d=B.trim();if(!(!d||d.startsWith(":"))&&d.startsWith("data: ")){let f=d.slice(6);if(f==="[DONE]")return;yield JSON.parse(f);}}}}finally{o.releaseLock();}}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new i(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var p=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...n}=e??{},o=t?.length?{...n,excludeIds:t.join(",")}:n;return this.http.get("/v1/announcements",o)}async getById(e,t){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}/translations`)}};var l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/blog/posts",e)}async getBySlug(e,t){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}`,t)}async getTags(){return this.http.get("/v1/blog/tags")}async getTranslationsById(e){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/blog/posts/${encodeURIComponent(e)}/reactions`,t)}};var g=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/changelog",e)}async getBySlug(e,t){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/changelog/${encodeURIComponent(e)}/reactions`,t)}};var c=class{constructor(e){this.http=e;}async getByKey(e){return this.http.get(`/v1/config/${encodeURIComponent(e)}`)}async list(e){return this.http.get("/v1/config",e)}};var m=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,n){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:n})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var u=class{http;announcements;blog;changelog;config;help;pages;constructor(e){if(!e.apiKey)throw new Error("apiKey is required");this.http=new P(e.apiKey,e.baseUrl),this.announcements=new p(this.http),this.blog=new l(this.http),this.changelog=new g(this.http),this.config=new c(this.http),this.help=new m(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=p;exports.BlogModule=l;exports.ChangelogModule=g;exports.ConfigModule=c;exports.HelpModule=m;exports.Kookee=u;exports.KookeeApiError=i;exports.PagesModule=h;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var B="https://api.kookee.dev",H="Kookee-API-Key",x="Kookee-Project-Id",i=class n extends Error{constructor(t,s,o){super(s);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,n.prototype);}},u=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??B;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[H]=this.apiKey),this.projectId&&(e[x]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let a of r)s.searchParams.append(y,String(a));else s.searchParams.set(y,String(r));}let o=await fetch(s.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let o=s.body.getReader(),y=new TextDecoder,r="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;r+=y.decode(b,{stream:!0});let C=r.split(`
2
+ `);r=C.pop()??"";for(let I of C){let P=I.trim();if(!(!P||P.startsWith(":"))&&P.startsWith("data: ")){let R=P.slice(6);if(R==="[DONE]")return;yield JSON.parse(R);}}}}finally{o.releaseLock();}}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new i(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var p=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...s}=e??{},o=t?.length?{...s,excludeIds:t.join(",")}:s;return this.http.get("/v1/announcements",o)}async getById(e,t){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}/translations`)}};var c=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/blog/posts",e)}async getBySlug(e,t){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}`,t)}async getTags(){return this.http.get("/v1/blog/tags")}async getTranslationsById(e){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/blog/posts/${encodeURIComponent(e)}/reactions`,t)}};var l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/changelog",e)}async getBySlug(e,t){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/changelog/${encodeURIComponent(e)}/reactions`,t)}};var g=class{constructor(e){this.http=e;}async getByKey(e){return this.http.get(`/v1/config/${encodeURIComponent(e)}`)}async list(e){return this.http.get("/v1/config",e)}};var m=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var f=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=p;exports.BlogModule=c;exports.ChangelogModule=l;exports.ConfigModule=g;exports.FeedbackModule=m;exports.HelpModule=d;exports.Kookee=f;exports.KookeeApiError=i;exports.PagesModule=h;//# sourceMappingURL=index.cjs.map
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","reader","decoder","buffer","done","lines","line","trimmed","data","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"aAEA,IAAMA,CAAAA,CAAmB,wBAAA,CACnBC,CAAAA,CAAiB,gBAAA,CAEVC,EAAN,cAA6B,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,CAAAA,CAChB,CACA,MAAMD,CAAO,CAAA,CAJG,IAAA,CAAA,IAAA,CAAAD,CAAAA,CAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,CAAK,IAAA,CAAO,iBACd,CACF,CAAA,CAEaC,CAAAA,CAAN,KAAiB,CACL,OAAA,CACA,MAAA,CAEjB,WAAA,CAAYC,EAAgBC,CAAAA,CAAkB,CAC5C,IAAA,CAAK,MAAA,CAASD,CAAAA,CACd,IAAA,CAAK,OAAA,CAAUC,CAAAA,EAAWR,EAC5B,CAEQ,UAAA,EAAqC,CAC3C,OAAO,CACL,cAAA,CAAgB,kBAAA,CAChB,CAACC,CAAc,EAAG,IAAA,CAAK,MACzB,CACF,CAEA,MAAM,GAAA,CAAOQ,CAAAA,CAAcC,EAA6B,CACtD,IAAMC,CAAAA,CAAM,IAAI,GAAA,CAAI,CAAA,EAAG,IAAA,CAAK,OAAO,GAAGF,CAAI,CAAA,CAAE,CAAA,CAE5C,GAAIC,CAAAA,CAAAA,CACF,IAAA,GAAW,CAACE,CAAAA,CAAKC,CAAK,CAAA,GAAK,MAAA,CAAO,OAAA,CAAQH,CAAM,CAAA,CAC9C,GAA2BG,CAAAA,EAAU,IAAA,CACnC,GAAI,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CACrB,IAAA,IAAWC,CAAAA,IAAQD,CAAAA,CACjBF,CAAAA,CAAI,aAAa,MAAA,CAAOC,CAAAA,CAAK,MAAA,CAAOE,CAAI,CAAC,CAAA,CAAA,KAG3CH,CAAAA,CAAI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AA,EAAuC,CAC3C,OAAO,IAAA,CAAK,KAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.cjs","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n async *streamPost<T>(path: string, body?: unknown): AsyncIterable<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: {\n ...this.getHeaders(),\n Accept: 'text/event-stream',\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n let errorData: ApiError | null = null;\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n if (!response.body) {\n return;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(':')) continue;\n if (trimmed.startsWith('data: ')) {\n const data = trimmed.slice(6);\n if (data === '[DONE]') return;\n yield JSON.parse(data) as T;\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpChatStreamChunk,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk> {\n return this.http.streamPost<HelpChatStreamChunk>('/v1/help/chat/stream', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/feedback.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","PROJECT_ID_HEADER","KookeeApiError","_KookeeApiError","code","message","status","HttpClient","options","headers","path","params","url","key","value","item","response","body","errorData","reader","decoder","buffer","done","lines","line","trimmed","data","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","FeedbackModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"aAEA,IAAMA,CAAAA,CAAmB,wBAAA,CACnBC,CAAAA,CAAiB,gBAAA,CACjBC,EAAoB,mBAAA,CAEbC,CAAAA,CAAN,MAAMC,CAAAA,SAAuB,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,UAAAD,CA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AA,CAAK,IACf,CAAA,UAAA,EAAa,kBAAA,CAAmBA,CAAI,CAAC,CAAA,aAAA,CACvC,CACF,CACF,EC3BO,IAAMY,EAAN,KAAa,CACD,KAED,aAAA,CACA,IAAA,CACA,SAAA,CACA,MAAA,CACA,QAAA,CACA,IAAA,CACA,MAEhB,WAAA,CAAYC,CAAAA,CAAsB,CAChC,GAAI,CAACA,EAAO,MAAA,EAAU,CAACA,CAAAA,CAAO,SAAA,CAC5B,MAAM,IAAI,MAAM,wCAAwC,CAAA,CAG1D,KAAK,IAAA,CAAO,IAAIxC,EAAW,CAAE,MAAA,CAAQwC,CAAAA,CAAO,MAAA,CAAQ,SAAA,CAAWA,CAAAA,CAAO,UAAW,OAAA,CAASA,CAAAA,CAAO,OAAQ,CAAC,CAAA,CAE1G,IAAA,CAAK,cAAgB,IAAIpB,CAAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,CACrD,IAAA,CAAK,KAAO,IAAIM,CAAAA,CAAW,KAAK,IAAI,CAAA,CACpC,KAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,CAAA,CAC9C,KAAK,MAAA,CAAS,IAAIE,EAAa,IAAA,CAAK,IAAI,EACxC,IAAA,CAAK,QAAA,CAAW,IAAIC,CAAAA,CAAe,IAAA,CAAK,IAAI,EAC5C,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.cjs","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\nconst PROJECT_ID_HEADER = 'Kookee-Project-Id';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n Object.setPrototypeOf(this, KookeeApiError.prototype);\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey?: string;\n private readonly projectId?: string;\n\n constructor(options: { apiKey?: string; projectId?: string; baseUrl?: string }) {\n this.apiKey = options.apiKey;\n this.projectId = options.projectId;\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n };\n if (this.apiKey) {\n headers[API_KEY_HEADER] = this.apiKey;\n }\n if (this.projectId) {\n headers[PROJECT_ID_HEADER] = this.projectId;\n }\n return headers;\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n async *streamPost<T>(path: string, body?: unknown): AsyncIterable<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: {\n ...this.getHeaders(),\n Accept: 'text/event-stream',\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n let errorData: ApiError | null = null;\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n if (!response.body) {\n return;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(':')) continue;\n if (trimmed.startsWith('data: ')) {\n const data = trimmed.slice(6);\n if (data === '[DONE]') return;\n yield JSON.parse(data) as T;\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n FeedbackPost,\n FeedbackPostCategory,\n FeedbackPostListItem,\n FeedbackPostStatus,\n FeedbackSortOption,\n FeedbackTopContributor,\n FeedbackVoteResponse,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface FeedbackListParams extends PaginationParams {\n status?: FeedbackPostStatus;\n category?: FeedbackPostCategory;\n search?: string;\n sort?: FeedbackSortOption;\n}\n\nexport interface FeedbackVoteParams {\n action: 'upvote' | 'downvote';\n}\n\nexport interface FeedbackTopContributorsParams {\n limit?: number;\n}\n\nexport class FeedbackModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>> {\n return this.http.get<PaginatedResponse<FeedbackPostListItem>>('/v1/feedback', params);\n }\n\n async getById(id: string): Promise<FeedbackPost> {\n return this.http.get<FeedbackPost>(`/v1/feedback/by-id/${encodeURIComponent(id)}`);\n }\n\n async vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse> {\n return this.http.post<FeedbackVoteResponse>(\n `/v1/feedback/${encodeURIComponent(postId)}/vote`,\n params\n );\n }\n\n async getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]> {\n return this.http.get<FeedbackTopContributor[]>('/v1/feedback/top-contributors', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpChatStreamChunk,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk> {\n return this.http.streamPost<HelpChatStreamChunk>('/v1/help/chat/stream', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { FeedbackModule } from './modules/feedback';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly feedback: FeedbackModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey && !config.projectId) {\n throw new Error('Either apiKey or projectId is required');\n }\n\n this.http = new HttpClient({ apiKey: config.apiKey, projectId: config.projectId, baseUrl: config.baseUrl });\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.feedback = new FeedbackModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -5,8 +5,13 @@ declare class KookeeApiError extends Error {
5
5
  }
6
6
  declare class HttpClient {
7
7
  private readonly baseUrl;
8
- private readonly apiKey;
9
- constructor(apiKey: string, baseUrl?: string);
8
+ private readonly apiKey?;
9
+ private readonly projectId?;
10
+ constructor(options: {
11
+ apiKey?: string;
12
+ projectId?: string;
13
+ baseUrl?: string;
14
+ });
10
15
  private getHeaders;
11
16
  get<T>(path: string, params?: object): Promise<T>;
12
17
  post<T>(path: string, body?: unknown): Promise<T>;
@@ -15,7 +20,8 @@ declare class HttpClient {
15
20
  }
16
21
 
17
22
  interface KookeeConfig {
18
- apiKey: string;
23
+ apiKey?: string;
24
+ projectId?: string;
19
25
  baseUrl?: string;
20
26
  }
21
27
  interface PaginationParams {
@@ -44,13 +50,14 @@ interface BlogTagWithCount extends BlogTag {
44
50
  interface BlogPostAuthor {
45
51
  name: string;
46
52
  }
53
+ type BlogPostStatus = 'draft' | 'published' | 'archived';
47
54
  interface BlogPostListItem {
48
55
  id: string;
49
56
  slug: string;
50
57
  title: string;
51
58
  excerptHtml: string | null;
52
59
  coverImageUrl: string | null;
53
- status: string;
60
+ status: BlogPostStatus;
54
61
  publishedAt: string | null;
55
62
  metadata: Record<string, NonNullable<unknown>> | null;
56
63
  createdAt: string;
@@ -75,6 +82,7 @@ interface PageListItem {
75
82
  id: string;
76
83
  slug: string;
77
84
  title: string;
85
+ views: number;
78
86
  createdAt: string;
79
87
  updatedAt: string;
80
88
  locale: string;
@@ -84,7 +92,6 @@ interface Page extends PageListItem {
84
92
  contentHtml: string;
85
93
  metaTitle: string | null;
86
94
  metaDescription: string | null;
87
- views: number;
88
95
  }
89
96
  interface HelpCategory {
90
97
  slug: string;
@@ -93,15 +100,22 @@ interface HelpCategory {
93
100
  icon: string | null;
94
101
  articleCount: number;
95
102
  }
103
+ interface HelpArticleAuthor {
104
+ name: string;
105
+ }
96
106
  interface HelpArticleListItem {
97
107
  id: string;
98
108
  slug: string;
99
109
  title: string;
100
110
  excerptHtml: string | null;
111
+ status: string;
112
+ position: number;
113
+ metadata: Record<string, unknown>;
101
114
  category: {
102
115
  name: string;
103
116
  slug: string;
104
117
  };
118
+ author: HelpArticleAuthor;
105
119
  createdAt: string;
106
120
  views: number;
107
121
  locale: string;
@@ -163,6 +177,7 @@ interface AnnouncementAuthor {
163
177
  interface AnnouncementListItem {
164
178
  id: string;
165
179
  title: string;
180
+ contentHtml: string;
166
181
  type: AnnouncementType;
167
182
  publishedAt: string | null;
168
183
  unpublishAt: string | null;
@@ -173,7 +188,6 @@ interface AnnouncementListItem {
173
188
  author: AnnouncementAuthor;
174
189
  }
175
190
  interface Announcement extends AnnouncementListItem {
176
- contentHtml: string;
177
191
  updatedAt: string;
178
192
  }
179
193
  interface PublicConfig {
@@ -210,10 +224,18 @@ interface HelpChatResponse {
210
224
  message: string;
211
225
  sources: HelpChatSource[];
212
226
  }
227
+ type HelpArticleVisibility = 'public' | 'chatbot_only';
228
+ interface HelpChatSourceCategory {
229
+ slug: string;
230
+ name: string;
231
+ }
213
232
  interface HelpChatSource {
214
233
  id: string;
215
234
  slug: string;
216
235
  title: string;
236
+ visibility: HelpArticleVisibility;
237
+ metadata: Record<string, unknown> | null;
238
+ category: HelpChatSourceCategory;
217
239
  }
218
240
  type HelpChatStreamChunk = {
219
241
  type: 'delta';
@@ -227,6 +249,53 @@ type HelpChatStreamChunk = {
227
249
  type: 'error';
228
250
  message: string;
229
251
  };
252
+ type FeedbackPostStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
253
+ type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
254
+ type FeedbackSortOption = 'newest' | 'top' | 'trending';
255
+ interface FeedbackAuthor {
256
+ id: string;
257
+ name: string;
258
+ image: string | null;
259
+ isTeamMember?: boolean;
260
+ }
261
+ interface FeedbackAssignee {
262
+ id: string;
263
+ name: string | null;
264
+ image: string | null;
265
+ }
266
+ interface FeedbackComment {
267
+ id: string;
268
+ content: string;
269
+ createdAt: string;
270
+ updatedAt: string;
271
+ isOfficial: boolean;
272
+ author: FeedbackAuthor;
273
+ }
274
+ interface FeedbackPostListItem {
275
+ id: string;
276
+ title: string;
277
+ contentText: string | null;
278
+ status: FeedbackPostStatus;
279
+ category: FeedbackPostCategory;
280
+ voteCount: number;
281
+ commentCount: number;
282
+ createdAt: string;
283
+ author: FeedbackAuthor;
284
+ assignee: FeedbackAssignee | null;
285
+ }
286
+ interface FeedbackPost extends FeedbackPostListItem {
287
+ contentHtml: string | null;
288
+ comments: FeedbackComment[];
289
+ }
290
+ interface FeedbackTopContributor {
291
+ id: string;
292
+ name: string;
293
+ image: string | null;
294
+ totalVotes: number;
295
+ }
296
+ interface FeedbackVoteResponse {
297
+ voteCount: number;
298
+ }
230
299
 
231
300
  interface AnnouncementListParams extends PaginationParams, LocaleOptions {
232
301
  type?: AnnouncementType;
@@ -295,6 +364,27 @@ declare class ConfigModule {
295
364
  list(params?: ConfigListParams): Promise<PublicConfig[]>;
296
365
  }
297
366
 
367
+ interface FeedbackListParams extends PaginationParams {
368
+ status?: FeedbackPostStatus;
369
+ category?: FeedbackPostCategory;
370
+ search?: string;
371
+ sort?: FeedbackSortOption;
372
+ }
373
+ interface FeedbackVoteParams {
374
+ action: 'upvote' | 'downvote';
375
+ }
376
+ interface FeedbackTopContributorsParams {
377
+ limit?: number;
378
+ }
379
+ declare class FeedbackModule {
380
+ private readonly http;
381
+ constructor(http: HttpClient);
382
+ list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
383
+ getById(id: string): Promise<FeedbackPost>;
384
+ vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
385
+ getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]>;
386
+ }
387
+
298
388
  interface HelpCategoriesParams extends LocaleOptions {
299
389
  }
300
390
  interface HelpListParams extends PaginationParams, LocaleOptions {
@@ -347,10 +437,11 @@ declare class Kookee {
347
437
  readonly blog: BlogModule;
348
438
  readonly changelog: ChangelogModule;
349
439
  readonly config: ConfigModule;
440
+ readonly feedback: FeedbackModule;
350
441
  readonly help: HelpModule;
351
442
  readonly pages: PagesModule;
352
443
  constructor(config: KookeeConfig);
353
444
  health(): Promise<HealthCheckResponse>;
354
445
  }
355
446
 
356
- export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
447
+ export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
package/dist/index.d.ts CHANGED
@@ -5,8 +5,13 @@ declare class KookeeApiError extends Error {
5
5
  }
6
6
  declare class HttpClient {
7
7
  private readonly baseUrl;
8
- private readonly apiKey;
9
- constructor(apiKey: string, baseUrl?: string);
8
+ private readonly apiKey?;
9
+ private readonly projectId?;
10
+ constructor(options: {
11
+ apiKey?: string;
12
+ projectId?: string;
13
+ baseUrl?: string;
14
+ });
10
15
  private getHeaders;
11
16
  get<T>(path: string, params?: object): Promise<T>;
12
17
  post<T>(path: string, body?: unknown): Promise<T>;
@@ -15,7 +20,8 @@ declare class HttpClient {
15
20
  }
16
21
 
17
22
  interface KookeeConfig {
18
- apiKey: string;
23
+ apiKey?: string;
24
+ projectId?: string;
19
25
  baseUrl?: string;
20
26
  }
21
27
  interface PaginationParams {
@@ -44,13 +50,14 @@ interface BlogTagWithCount extends BlogTag {
44
50
  interface BlogPostAuthor {
45
51
  name: string;
46
52
  }
53
+ type BlogPostStatus = 'draft' | 'published' | 'archived';
47
54
  interface BlogPostListItem {
48
55
  id: string;
49
56
  slug: string;
50
57
  title: string;
51
58
  excerptHtml: string | null;
52
59
  coverImageUrl: string | null;
53
- status: string;
60
+ status: BlogPostStatus;
54
61
  publishedAt: string | null;
55
62
  metadata: Record<string, NonNullable<unknown>> | null;
56
63
  createdAt: string;
@@ -75,6 +82,7 @@ interface PageListItem {
75
82
  id: string;
76
83
  slug: string;
77
84
  title: string;
85
+ views: number;
78
86
  createdAt: string;
79
87
  updatedAt: string;
80
88
  locale: string;
@@ -84,7 +92,6 @@ interface Page extends PageListItem {
84
92
  contentHtml: string;
85
93
  metaTitle: string | null;
86
94
  metaDescription: string | null;
87
- views: number;
88
95
  }
89
96
  interface HelpCategory {
90
97
  slug: string;
@@ -93,15 +100,22 @@ interface HelpCategory {
93
100
  icon: string | null;
94
101
  articleCount: number;
95
102
  }
103
+ interface HelpArticleAuthor {
104
+ name: string;
105
+ }
96
106
  interface HelpArticleListItem {
97
107
  id: string;
98
108
  slug: string;
99
109
  title: string;
100
110
  excerptHtml: string | null;
111
+ status: string;
112
+ position: number;
113
+ metadata: Record<string, unknown>;
101
114
  category: {
102
115
  name: string;
103
116
  slug: string;
104
117
  };
118
+ author: HelpArticleAuthor;
105
119
  createdAt: string;
106
120
  views: number;
107
121
  locale: string;
@@ -163,6 +177,7 @@ interface AnnouncementAuthor {
163
177
  interface AnnouncementListItem {
164
178
  id: string;
165
179
  title: string;
180
+ contentHtml: string;
166
181
  type: AnnouncementType;
167
182
  publishedAt: string | null;
168
183
  unpublishAt: string | null;
@@ -173,7 +188,6 @@ interface AnnouncementListItem {
173
188
  author: AnnouncementAuthor;
174
189
  }
175
190
  interface Announcement extends AnnouncementListItem {
176
- contentHtml: string;
177
191
  updatedAt: string;
178
192
  }
179
193
  interface PublicConfig {
@@ -210,10 +224,18 @@ interface HelpChatResponse {
210
224
  message: string;
211
225
  sources: HelpChatSource[];
212
226
  }
227
+ type HelpArticleVisibility = 'public' | 'chatbot_only';
228
+ interface HelpChatSourceCategory {
229
+ slug: string;
230
+ name: string;
231
+ }
213
232
  interface HelpChatSource {
214
233
  id: string;
215
234
  slug: string;
216
235
  title: string;
236
+ visibility: HelpArticleVisibility;
237
+ metadata: Record<string, unknown> | null;
238
+ category: HelpChatSourceCategory;
217
239
  }
218
240
  type HelpChatStreamChunk = {
219
241
  type: 'delta';
@@ -227,6 +249,53 @@ type HelpChatStreamChunk = {
227
249
  type: 'error';
228
250
  message: string;
229
251
  };
252
+ type FeedbackPostStatus = 'open' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
253
+ type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
254
+ type FeedbackSortOption = 'newest' | 'top' | 'trending';
255
+ interface FeedbackAuthor {
256
+ id: string;
257
+ name: string;
258
+ image: string | null;
259
+ isTeamMember?: boolean;
260
+ }
261
+ interface FeedbackAssignee {
262
+ id: string;
263
+ name: string | null;
264
+ image: string | null;
265
+ }
266
+ interface FeedbackComment {
267
+ id: string;
268
+ content: string;
269
+ createdAt: string;
270
+ updatedAt: string;
271
+ isOfficial: boolean;
272
+ author: FeedbackAuthor;
273
+ }
274
+ interface FeedbackPostListItem {
275
+ id: string;
276
+ title: string;
277
+ contentText: string | null;
278
+ status: FeedbackPostStatus;
279
+ category: FeedbackPostCategory;
280
+ voteCount: number;
281
+ commentCount: number;
282
+ createdAt: string;
283
+ author: FeedbackAuthor;
284
+ assignee: FeedbackAssignee | null;
285
+ }
286
+ interface FeedbackPost extends FeedbackPostListItem {
287
+ contentHtml: string | null;
288
+ comments: FeedbackComment[];
289
+ }
290
+ interface FeedbackTopContributor {
291
+ id: string;
292
+ name: string;
293
+ image: string | null;
294
+ totalVotes: number;
295
+ }
296
+ interface FeedbackVoteResponse {
297
+ voteCount: number;
298
+ }
230
299
 
231
300
  interface AnnouncementListParams extends PaginationParams, LocaleOptions {
232
301
  type?: AnnouncementType;
@@ -295,6 +364,27 @@ declare class ConfigModule {
295
364
  list(params?: ConfigListParams): Promise<PublicConfig[]>;
296
365
  }
297
366
 
367
+ interface FeedbackListParams extends PaginationParams {
368
+ status?: FeedbackPostStatus;
369
+ category?: FeedbackPostCategory;
370
+ search?: string;
371
+ sort?: FeedbackSortOption;
372
+ }
373
+ interface FeedbackVoteParams {
374
+ action: 'upvote' | 'downvote';
375
+ }
376
+ interface FeedbackTopContributorsParams {
377
+ limit?: number;
378
+ }
379
+ declare class FeedbackModule {
380
+ private readonly http;
381
+ constructor(http: HttpClient);
382
+ list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
383
+ getById(id: string): Promise<FeedbackPost>;
384
+ vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
385
+ getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]>;
386
+ }
387
+
298
388
  interface HelpCategoriesParams extends LocaleOptions {
299
389
  }
300
390
  interface HelpListParams extends PaginationParams, LocaleOptions {
@@ -347,10 +437,11 @@ declare class Kookee {
347
437
  readonly blog: BlogModule;
348
438
  readonly changelog: ChangelogModule;
349
439
  readonly config: ConfigModule;
440
+ readonly feedback: FeedbackModule;
350
441
  readonly help: HelpModule;
351
442
  readonly pages: PagesModule;
352
443
  constructor(config: KookeeConfig);
353
444
  health(): Promise<HealthCheckResponse>;
354
445
  }
355
446
 
356
- export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type HealthCheckResponse, type HelpArticle, type HelpArticleListItem, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
447
+ export { type Announcement, type AnnouncementAuthor, type AnnouncementGetByIdParams, type AnnouncementListItem, type AnnouncementListParams, AnnouncementModule, type AnnouncementOrderBy, type AnnouncementType, type ApiError, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogListParams, BlogModule, type BlogPost, type BlogPostAuthor, type BlogPostListItem, type BlogPostStatus, type BlogTag, type BlogTagWithCount, type ChangelogAuthor, type ChangelogEntry, type ChangelogEntryListItem, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogListParams, ChangelogModule, type ChangelogOrderBy, type ChangelogType, type ConfigListParams, ConfigModule, type FeedbackAssignee, type FeedbackAuthor, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackPostStatus, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type HealthCheckResponse, type HelpArticle, type HelpArticleAuthor, type HelpArticleListItem, type HelpArticleVisibility, type HelpCategoriesParams, type HelpCategory, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type LocaleOptions, type OrderDirection, type Page, type PageListItem, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type VoteUsefulnessResponse };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var I="https://api.kookee.dev",H="Kookee-API-Key",i=class extends Error{constructor(t,n,o){super(n);this.code=t;this.status=o;this.name="KookeeApiError";}},P=class{baseUrl;apiKey;constructor(e,t){this.apiKey=e,this.baseUrl=t??I;}getHeaders(){return {"Content-Type":"application/json",[H]:this.apiKey}}async get(e,t){let n=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,s]of Object.entries(t))if(s!=null)if(Array.isArray(s))for(let a of s)n.searchParams.append(y,String(a));else n.searchParams.set(y,String(s));}let o=await fetch(n.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(n)}async*streamPost(e,t){let n=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!n.ok){let a=null;try{a=await n.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${n.status}`,n.status)}if(!n.body)return;let o=n.body.getReader(),y=new TextDecoder,s="";try{for(;;){let{done:a,value:C}=await o.read();if(a)break;s+=y.decode(C,{stream:!0});let R=s.split(`
2
- `);s=R.pop()??"";for(let B of R){let d=B.trim();if(!(!d||d.startsWith(":"))&&d.startsWith("data: ")){let f=d.slice(6);if(f==="[DONE]")return;yield JSON.parse(f);}}}}finally{o.releaseLock();}}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new i(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var p=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...n}=e??{},o=t?.length?{...n,excludeIds:t.join(",")}:n;return this.http.get("/v1/announcements",o)}async getById(e,t){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}/translations`)}};var l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/blog/posts",e)}async getBySlug(e,t){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}`,t)}async getTags(){return this.http.get("/v1/blog/tags")}async getTranslationsById(e){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/blog/posts/${encodeURIComponent(e)}/reactions`,t)}};var g=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/changelog",e)}async getBySlug(e,t){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/changelog/${encodeURIComponent(e)}/reactions`,t)}};var c=class{constructor(e){this.http=e;}async getByKey(e){return this.http.get(`/v1/config/${encodeURIComponent(e)}`)}async list(e){return this.http.get("/v1/config",e)}};var m=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,n){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:n})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var u=class{http;announcements;blog;changelog;config;help;pages;constructor(e){if(!e.apiKey)throw new Error("apiKey is required");this.http=new P(e.apiKey,e.baseUrl),this.announcements=new p(this.http),this.blog=new l(this.http),this.changelog=new g(this.http),this.config=new c(this.http),this.help=new m(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};export{p as AnnouncementModule,l as BlogModule,g as ChangelogModule,c as ConfigModule,m as HelpModule,u as Kookee,i as KookeeApiError,h as PagesModule};//# sourceMappingURL=index.js.map
1
+ var B="https://api.kookee.dev",H="Kookee-API-Key",x="Kookee-Project-Id",i=class n extends Error{constructor(t,s,o){super(s);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,n.prototype);}},u=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??B;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[H]=this.apiKey),this.projectId&&(e[x]=this.projectId),e}async get(e,t){let s=new URL(`${this.baseUrl}${e}`);if(t){for(let[y,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let a of r)s.searchParams.append(y,String(a));else s.searchParams.set(y,String(r));}let o=await fetch(s.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(s)}async*streamPost(e,t){let s=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!s.ok){let a=null;try{a=await s.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${s.status}`,s.status)}if(!s.body)return;let o=s.body.getReader(),y=new TextDecoder,r="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;r+=y.decode(b,{stream:!0});let C=r.split(`
2
+ `);r=C.pop()??"";for(let I of C){let P=I.trim();if(!(!P||P.startsWith(":"))&&P.startsWith("data: ")){let R=P.slice(6);if(R==="[DONE]")return;yield JSON.parse(R);}}}}finally{o.releaseLock();}}async handleResponse(e){if(!e.ok){let t=null;try{t=await e.json();}catch{}throw new i(t?.code??"UNKNOWN_ERROR",t?.message??`Request failed with status ${e.status}`,e.status)}return e.json()}};var p=class{constructor(e){this.http=e;}async list(e){let{excludeIds:t,...s}=e??{},o=t?.length?{...s,excludeIds:t.join(",")}:s;return this.http.get("/v1/announcements",o)}async getById(e,t){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/announcements/${encodeURIComponent(e)}/translations`)}};var c=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/blog/posts",e)}async getBySlug(e,t){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}`,t)}async getTags(){return this.http.get("/v1/blog/tags")}async getTranslationsById(e){return this.http.get(`/v1/blog/posts/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/blog/posts/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/blog/posts/${encodeURIComponent(e)}/reactions`,t)}};var l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/changelog",e)}async getBySlug(e,t){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/changelog/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/changelog/${encodeURIComponent(e)}/translations`)}async react(e,t){return this.http.post(`/v1/changelog/${encodeURIComponent(e)}/reactions`,t)}};var g=class{constructor(e){this.http=e;}async getByKey(e){return this.http.get(`/v1/config/${encodeURIComponent(e)}`)}async list(e){return this.http.get("/v1/config",e)}};var m=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/feedback",e)}async getById(e){return this.http.get(`/v1/feedback/by-id/${encodeURIComponent(e)}`)}async vote(e,t){return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/vote`,t)}async getTopContributors(e){return this.http.get("/v1/feedback/top-contributors",e)}};var d=class{constructor(e){this.http=e;}async categories(e){return this.http.get("/v1/help/categories",e)}async list(e){return this.http.get("/v1/help/articles",e)}async getBySlug(e,t){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}`,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.http.get(`/v1/help/articles/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/help/articles/${encodeURIComponent(e)}/translations`)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}async voteUsefulness(e,t,s){return this.http.post(`/v1/help/articles/by-id/${encodeURIComponent(e)}/vote-usefulness`,{vote:t,previousVote:s})}};var h=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/pages",e)}async getBySlug(e,t){return this.http.get(`/v1/pages/${encodeURIComponent(e)}`,t)}async getById(e,t){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/pages/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/pages/${encodeURIComponent(e)}/translations`)}};var f=class{http;announcements;blog;changelog;config;feedback;help;pages;constructor(e){if(!e.apiKey&&!e.projectId)throw new Error("Either apiKey or projectId is required");this.http=new u({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.announcements=new p(this.http),this.blog=new c(this.http),this.changelog=new l(this.http),this.config=new g(this.http),this.feedback=new m(this.http),this.help=new d(this.http),this.pages=new h(this.http);}async health(){return this.http.get("/v1/health")}};export{p as AnnouncementModule,c as BlogModule,l as ChangelogModule,g as ConfigModule,m as FeedbackModule,d as HelpModule,f as Kookee,i as KookeeApiError,h as PagesModule};//# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","KookeeApiError","code","message","status","HttpClient","apiKey","baseUrl","path","params","url","key","value","item","response","body","errorData","reader","decoder","buffer","done","lines","line","trimmed","data","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"AAEA,IAAMA,CAAAA,CAAmB,wBAAA,CACnBC,CAAAA,CAAiB,gBAAA,CAEVC,EAAN,cAA6B,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,CAAAA,CAChB,CACA,MAAMD,CAAO,CAAA,CAJG,IAAA,CAAA,IAAA,CAAAD,CAAAA,CAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,CAAK,IAAA,CAAO,iBACd,CACF,CAAA,CAEaC,CAAAA,CAAN,KAAiB,CACL,OAAA,CACA,MAAA,CAEjB,WAAA,CAAYC,EAAgBC,CAAAA,CAAkB,CAC5C,IAAA,CAAK,MAAA,CAASD,CAAAA,CACd,IAAA,CAAK,OAAA,CAAUC,CAAAA,EAAWR,EAC5B,CAEQ,UAAA,EAAqC,CAC3C,OAAO,CACL,cAAA,CAAgB,kBAAA,CAChB,CAACC,CAAc,EAAG,IAAA,CAAK,MACzB,CACF,CAEA,MAAM,GAAA,CAAOQ,CAAAA,CAAcC,EAA6B,CACtD,IAAMC,CAAAA,CAAM,IAAI,GAAA,CAAI,CAAA,EAAG,IAAA,CAAK,OAAO,GAAGF,CAAI,CAAA,CAAE,CAAA,CAE5C,GAAIC,CAAAA,CAAAA,CACF,IAAA,GAAW,CAACE,CAAAA,CAAKC,CAAK,CAAA,GAAK,MAAA,CAAO,OAAA,CAAQH,CAAM,CAAA,CAC9C,GAA2BG,CAAAA,EAAU,IAAA,CACnC,GAAI,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CACrB,IAAA,IAAWC,CAAAA,IAAQD,CAAAA,CACjBF,CAAAA,CAAI,aAAa,MAAA,CAAOC,CAAAA,CAAK,MAAA,CAAOE,CAAI,CAAC,CAAA,CAAA,KAG3CH,CAAAA,CAAI,YAAA,CAAa,IAAIC,CAAAA,CAAK,MAAA,CAAOC,CAAK,CA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YAAY,CACxD,CACF","file":"index.js","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey: string;\n\n constructor(apiKey: string, baseUrl?: string) {\n this.apiKey = apiKey;\n this.baseUrl = baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/json',\n [API_KEY_HEADER]: this.apiKey,\n };\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n async *streamPost<T>(path: string, body?: unknown): AsyncIterable<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: {\n ...this.getHeaders(),\n Accept: 'text/event-stream',\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n let errorData: ApiError | null = null;\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n if (!response.body) {\n return;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(':')) continue;\n if (trimmed.startsWith('data: ')) {\n const data = trimmed.slice(6);\n if (data === '[DONE]') return;\n yield JSON.parse(data) as T;\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpChatStreamChunk,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk> {\n return this.http.streamPost<HelpChatStreamChunk>('/v1/help/chat/stream', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this.http = new HttpClient(config.apiKey, config.baseUrl);\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/http-client.ts","../src/lib/modules/announcement.ts","../src/lib/modules/blog.ts","../src/lib/modules/changelog.ts","../src/lib/modules/config.ts","../src/lib/modules/feedback.ts","../src/lib/modules/help.ts","../src/lib/modules/pages.ts","../src/lib/client.ts"],"names":["DEFAULT_BASE_URL","API_KEY_HEADER","PROJECT_ID_HEADER","KookeeApiError","_KookeeApiError","code","message","status","HttpClient","options","headers","path","params","url","key","value","item","response","body","errorData","reader","decoder","buffer","done","lines","line","trimmed","data","AnnouncementModule","http","excludeIds","rest","queryParams","id","BlogModule","slug","postId","ChangelogModule","changelogId","ConfigModule","FeedbackModule","HelpModule","articleId","vote","previousVote","PagesModule","pageId","Kookee","config"],"mappings":"AAEA,IAAMA,CAAAA,CAAmB,wBAAA,CACnBC,CAAAA,CAAiB,gBAAA,CACjBC,EAAoB,mBAAA,CAEbC,CAAAA,CAAN,MAAMC,CAAAA,SAAuB,KAAM,CACxC,WAAA,CACkBC,CAAAA,CAChBC,CAAAA,CACgBC,EAChB,CACA,KAAA,CAAMD,CAAO,CAAA,CAJG,UAAAD,CAAAA,CAEA,IAAA,CAAA,MAAA,CAAAE,CAAAA,CAGhB,IAAA,C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C,CAAA,aAAA,CACvC,CACF,CACF,EC3BO,IAAMY,EAAN,KAAa,CACD,KAED,aAAA,CACA,IAAA,CACA,SAAA,CACA,MAAA,CACA,QAAA,CACA,IAAA,CACA,MAEhB,WAAA,CAAYC,CAAAA,CAAsB,CAChC,GAAI,CAACA,EAAO,MAAA,EAAU,CAACA,CAAAA,CAAO,SAAA,CAC5B,MAAM,IAAI,MAAM,wCAAwC,CAAA,CAG1D,KAAK,IAAA,CAAO,IAAIxC,EAAW,CAAE,MAAA,CAAQwC,CAAAA,CAAO,MAAA,CAAQ,SAAA,CAAWA,CAAAA,CAAO,UAAW,OAAA,CAASA,CAAAA,CAAO,OAAQ,CAAC,CAAA,CAE1G,IAAA,CAAK,cAAgB,IAAIpB,CAAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,CACrD,IAAA,CAAK,KAAO,IAAIM,CAAAA,CAAW,KAAK,IAAI,CAAA,CACpC,KAAK,SAAA,CAAY,IAAIG,CAAAA,CAAgB,IAAA,CAAK,IAAI,CAAA,CAC9C,KAAK,MAAA,CAAS,IAAIE,EAAa,IAAA,CAAK,IAAI,EACxC,IAAA,CAAK,QAAA,CAAW,IAAIC,CAAAA,CAAe,IAAA,CAAK,IAAI,EAC5C,IAAA,CAAK,IAAA,CAAO,IAAIC,CAAAA,CAAW,IAAA,CAAK,IAAI,CAAA,CACpC,IAAA,CAAK,KAAA,CAAQ,IAAII,CAAAA,CAAY,IAAA,CAAK,IAAI,EACxC,CAEA,MAAM,MAAA,EAAuC,CAC3C,OAAO,KAAK,IAAA,CAAK,GAAA,CAAyB,YAAY,CACxD,CACF","file":"index.js","sourcesContent":["import type { ApiError } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.kookee.dev';\nconst API_KEY_HEADER = 'Kookee-API-Key';\nconst PROJECT_ID_HEADER = 'Kookee-Project-Id';\n\nexport class KookeeApiError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number\n ) {\n super(message);\n this.name = 'KookeeApiError';\n Object.setPrototypeOf(this, KookeeApiError.prototype);\n }\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n private readonly apiKey?: string;\n private readonly projectId?: string;\n\n constructor(options: { apiKey?: string; projectId?: string; baseUrl?: string }) {\n this.apiKey = options.apiKey;\n this.projectId = options.projectId;\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n }\n\n private getHeaders(): Record<string, string> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n };\n if (this.apiKey) {\n headers[API_KEY_HEADER] = this.apiKey;\n }\n if (this.projectId) {\n headers[PROJECT_ID_HEADER] = this.projectId;\n }\n return headers;\n }\n\n async get<T>(path: string, params?: object): Promise<T> {\n const url = new URL(`${this.baseUrl}${path}`);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, String(item));\n }\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers: this.getHeaders(),\n });\n\n return this.handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: this.getHeaders(),\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return this.handleResponse<T>(response);\n }\n\n async *streamPost<T>(path: string, body?: unknown): AsyncIterable<T> {\n const response = await fetch(`${this.baseUrl}${path}`, {\n method: 'POST',\n headers: {\n ...this.getHeaders(),\n Accept: 'text/event-stream',\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n let errorData: ApiError | null = null;\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n if (!response.body) {\n return;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(':')) continue;\n if (trimmed.startsWith('data: ')) {\n const data = trimmed.slice(6);\n if (data === '[DONE]') return;\n yield JSON.parse(data) as T;\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n\n private async handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n let errorData: ApiError | null = null;\n\n try {\n errorData = (await response.json()) as ApiError;\n } catch {\n // Response body is not JSON\n }\n\n throw new KookeeApiError(\n errorData?.code ?? 'UNKNOWN_ERROR',\n errorData?.message ?? `Request failed with status ${response.status}`,\n response.status\n );\n }\n\n return response.json() as Promise<T>;\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n Announcement,\n AnnouncementListItem,\n AnnouncementOrderBy,\n AnnouncementType,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface AnnouncementListParams extends PaginationParams, LocaleOptions {\n type?: AnnouncementType;\n excludeIds?: string[];\n orderBy?: AnnouncementOrderBy;\n order?: OrderDirection;\n}\n\nexport interface AnnouncementGetByIdParams extends LocaleOptions {}\n\nexport class AnnouncementModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: AnnouncementListParams): Promise<PaginatedResponse<AnnouncementListItem>> {\n const { excludeIds, ...rest } = params ?? {};\n const queryParams = excludeIds?.length ? { ...rest, excludeIds: excludeIds.join(',') } : rest;\n return this.http.get<PaginatedResponse<AnnouncementListItem>>('/v1/announcements', queryParams);\n }\n\n async getById(id: string, params?: AnnouncementGetByIdParams): Promise<Announcement> {\n return this.http.get<Announcement>(`/v1/announcements/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, Announcement>> {\n return this.http.get<Record<string, Announcement>>(\n `/v1/announcements/${encodeURIComponent(id)}/translations`\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n BlogPost,\n BlogPostListItem,\n BlogTagWithCount,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface BlogListParams extends PaginationParams, LocaleOptions {\n tags?: string[];\n search?: string;\n}\n\nexport interface BlogGetBySlugParams extends LocaleOptions {}\n\nexport interface BlogGetByIdParams extends LocaleOptions {}\n\nexport class BlogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: BlogListParams): Promise<PaginatedResponse<BlogPostListItem>> {\n return this.http.get<PaginatedResponse<BlogPostListItem>>('/v1/blog/posts', params);\n }\n\n async getBySlug(slug: string, params?: BlogGetBySlugParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: BlogGetByIdParams): Promise<BlogPost> {\n return this.http.get<BlogPost>(`/v1/blog/posts/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTags(): Promise<BlogTagWithCount[]> {\n return this.http.get<BlogTagWithCount[]>('/v1/blog/tags');\n }\n\n async getTranslationsById(postId: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/by-id/${encodeURIComponent(postId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, BlogPost>> {\n return this.http.get<Record<string, BlogPost>>(\n `/v1/blog/posts/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(postId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/blog/posts/${encodeURIComponent(postId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n ChangelogEntry,\n ChangelogEntryListItem,\n ChangelogOrderBy,\n LocaleOptions,\n OrderDirection,\n PaginatedResponse,\n PaginationParams,\n ReactParams,\n ReactResponse,\n} from '../types';\n\nexport interface ChangelogListParams extends PaginationParams, LocaleOptions {\n type?: string;\n search?: string;\n orderBy?: ChangelogOrderBy;\n order?: OrderDirection;\n}\n\nexport interface ChangelogGetBySlugParams extends LocaleOptions {}\n\nexport interface ChangelogGetByIdParams extends LocaleOptions {}\n\nexport class ChangelogModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: ChangelogListParams): Promise<PaginatedResponse<ChangelogEntryListItem>> {\n return this.http.get<PaginatedResponse<ChangelogEntryListItem>>('/v1/changelog', params);\n }\n\n async getBySlug(slug: string, params?: ChangelogGetBySlugParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: ChangelogGetByIdParams): Promise<ChangelogEntry> {\n return this.http.get<ChangelogEntry>(`/v1/changelog/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(id: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/by-id/${encodeURIComponent(id)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, ChangelogEntry>> {\n return this.http.get<Record<string, ChangelogEntry>>(\n `/v1/changelog/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async react(changelogId: string, params: ReactParams): Promise<ReactResponse> {\n return this.http.post<ReactResponse>(\n `/v1/changelog/${encodeURIComponent(changelogId)}/reactions`,\n params\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { PublicConfig } from '../types';\n\nexport interface ConfigListParams {\n keys?: string[];\n}\n\nexport class ConfigModule {\n constructor(private readonly http: HttpClient) {}\n\n async getByKey(key: string): Promise<PublicConfig> {\n return this.http.get<PublicConfig>(`/v1/config/${encodeURIComponent(key)}`);\n }\n\n async list(params?: ConfigListParams): Promise<PublicConfig[]> {\n return this.http.get<PublicConfig[]>('/v1/config', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n FeedbackPost,\n FeedbackPostCategory,\n FeedbackPostListItem,\n FeedbackPostStatus,\n FeedbackSortOption,\n FeedbackTopContributor,\n FeedbackVoteResponse,\n PaginatedResponse,\n PaginationParams,\n} from '../types';\n\nexport interface FeedbackListParams extends PaginationParams {\n status?: FeedbackPostStatus;\n category?: FeedbackPostCategory;\n search?: string;\n sort?: FeedbackSortOption;\n}\n\nexport interface FeedbackVoteParams {\n action: 'upvote' | 'downvote';\n}\n\nexport interface FeedbackTopContributorsParams {\n limit?: number;\n}\n\nexport class FeedbackModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>> {\n return this.http.get<PaginatedResponse<FeedbackPostListItem>>('/v1/feedback', params);\n }\n\n async getById(id: string): Promise<FeedbackPost> {\n return this.http.get<FeedbackPost>(`/v1/feedback/by-id/${encodeURIComponent(id)}`);\n }\n\n async vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse> {\n return this.http.post<FeedbackVoteResponse>(\n `/v1/feedback/${encodeURIComponent(postId)}/vote`,\n params\n );\n }\n\n async getTopContributors(params?: FeedbackTopContributorsParams): Promise<FeedbackTopContributor[]> {\n return this.http.get<FeedbackTopContributor[]>('/v1/feedback/top-contributors', params);\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type {\n HelpArticle,\n HelpArticleListItem,\n HelpCategory,\n HelpChatParams,\n HelpChatResponse,\n HelpChatStreamChunk,\n HelpSearchResult,\n LocaleOptions,\n PaginatedResponse,\n PaginationParams,\n VoteUsefulnessResponse,\n} from '../types';\n\nexport interface HelpCategoriesParams extends LocaleOptions {}\n\nexport interface HelpListParams extends PaginationParams, LocaleOptions {\n category?: string;\n search?: string;\n}\n\nexport interface HelpSearchParams extends LocaleOptions {\n query: string;\n limit?: number;\n}\n\nexport interface HelpGetBySlugParams extends LocaleOptions {}\n\nexport interface HelpGetByIdParams extends LocaleOptions {}\n\nexport class HelpModule {\n constructor(private readonly http: HttpClient) {}\n\n async categories(params?: HelpCategoriesParams): Promise<HelpCategory[]> {\n return this.http.get<HelpCategory[]>('/v1/help/categories', params);\n }\n\n async list(params?: HelpListParams): Promise<PaginatedResponse<HelpArticleListItem>> {\n return this.http.get<PaginatedResponse<HelpArticleListItem>>('/v1/help/articles', params);\n }\n\n async getBySlug(slug: string, params?: HelpGetBySlugParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: HelpGetByIdParams): Promise<HelpArticle> {\n return this.http.get<HelpArticle>(`/v1/help/articles/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async search(params: HelpSearchParams): Promise<HelpSearchResult[]> {\n return this.http.get<HelpSearchResult[]>('/v1/help/search', params);\n }\n\n async getTranslationsById(articleId: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, HelpArticle>> {\n return this.http.get<Record<string, HelpArticle>>(\n `/v1/help/articles/${encodeURIComponent(slug)}/translations`\n );\n }\n\n async chat(params: HelpChatParams): Promise<HelpChatResponse> {\n return this.http.post<HelpChatResponse>('/v1/help/chat', params);\n }\n\n chatStream(params: HelpChatParams): AsyncIterable<HelpChatStreamChunk> {\n return this.http.streamPost<HelpChatStreamChunk>('/v1/help/chat/stream', params);\n }\n\n async voteUsefulness(\n articleId: string,\n vote: 'yes' | 'no' | null,\n previousVote?: 'yes' | 'no' | null,\n ): Promise<VoteUsefulnessResponse> {\n return this.http.post<VoteUsefulnessResponse>(\n `/v1/help/articles/by-id/${encodeURIComponent(articleId)}/vote-usefulness`,\n { vote, previousVote }\n );\n }\n}\n","import type { HttpClient } from '../http-client';\nimport type { LocaleOptions, Page, PageListItem, PaginatedResponse, PaginationParams } from '../types';\n\nexport interface PagesListParams extends PaginationParams, LocaleOptions {\n search?: string;\n}\n\nexport interface PagesGetBySlugParams extends LocaleOptions {}\n\nexport interface PagesGetByIdParams extends LocaleOptions {}\n\nexport class PagesModule {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: PagesListParams): Promise<PaginatedResponse<PageListItem>> {\n return this.http.get<PaginatedResponse<PageListItem>>('/v1/pages', params);\n }\n\n async getBySlug(slug: string, params?: PagesGetBySlugParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/${encodeURIComponent(slug)}`, params);\n }\n\n async getById(id: string, params?: PagesGetByIdParams): Promise<Page> {\n return this.http.get<Page>(`/v1/pages/by-id/${encodeURIComponent(id)}`, params);\n }\n\n async getTranslationsById(pageId: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/by-id/${encodeURIComponent(pageId)}/translations`\n );\n }\n\n async getTranslationsBySlug(slug: string): Promise<Record<string, Page>> {\n return this.http.get<Record<string, Page>>(\n `/v1/pages/${encodeURIComponent(slug)}/translations`\n );\n }\n}\n","import { HttpClient } from './http-client';\nimport { AnnouncementModule } from './modules/announcement';\nimport { BlogModule } from './modules/blog';\nimport { ChangelogModule } from './modules/changelog';\nimport { ConfigModule } from './modules/config';\nimport { FeedbackModule } from './modules/feedback';\nimport { HelpModule } from './modules/help';\nimport { PagesModule } from './modules/pages';\nimport type { KookeeConfig, HealthCheckResponse } from './types';\n\nexport class Kookee {\n private readonly http: HttpClient;\n\n public readonly announcements: AnnouncementModule;\n public readonly blog: BlogModule;\n public readonly changelog: ChangelogModule;\n public readonly config: ConfigModule;\n public readonly feedback: FeedbackModule;\n public readonly help: HelpModule;\n public readonly pages: PagesModule;\n\n constructor(config: KookeeConfig) {\n if (!config.apiKey && !config.projectId) {\n throw new Error('Either apiKey or projectId is required');\n }\n\n this.http = new HttpClient({ apiKey: config.apiKey, projectId: config.projectId, baseUrl: config.baseUrl });\n\n this.announcements = new AnnouncementModule(this.http);\n this.blog = new BlogModule(this.http);\n this.changelog = new ChangelogModule(this.http);\n this.config = new ConfigModule(this.http);\n this.feedback = new FeedbackModule(this.http);\n this.help = new HelpModule(this.http);\n this.pages = new PagesModule(this.http);\n }\n\n async health(): Promise<HealthCheckResponse> {\n return this.http.get<HealthCheckResponse>('/v1/health');\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kookee/sdk",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "Official Kookee SDK - Access your blog, changelog, help center, and more",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -34,6 +34,9 @@
34
34
  "url": "https://github.com/kookee-dot-dev/kookee-ts-sdk"
35
35
  },
36
36
  "homepage": "https://kookee.dev",
37
+ "sideEffects": [
38
+ "./styles/code.css"
39
+ ],
37
40
  "devDependencies": {
38
41
  "@types/node": "^22.10.2",
39
42
  "eslint": "^9.17.0",