@kookee/sdk 0.0.35 → 0.0.36

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
@@ -251,6 +251,9 @@ const categories = await kookee.entries.getCategories('help_article');
251
251
  ### Reading feedback
252
252
 
253
253
  ```typescript
254
+ // Get kanban columns (for roadmap rendering)
255
+ const columns = await kookee.feedback.getColumns();
256
+
254
257
  // List feedback posts
255
258
  const posts = await kookee.feedback.list({ page: 1, limit: 10 });
256
259
 
@@ -453,6 +456,7 @@ import type {
453
456
  HelpChatStreamChunk,
454
457
 
455
458
  // Feedback
459
+ FeedbackKanbanColumn,
456
460
  FeedbackPost,
457
461
  FeedbackPostListItem,
458
462
  FeedbackColumnType,
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var B="https://api.kookee.dev",k="Kookee-API-Key",I="Kookee-Project-Id",i=class s extends Error{constructor(t,r,o){super(r);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,s.prototype);}},C=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[k]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)r.searchParams.append(h,String(a));else r.searchParams.set(h,String(n));}let o=await fetch(r.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async delete(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async*streamPost(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!r.ok){let a=null;try{a=await r.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${r.status}`,r.status)}if(!r.body)return;let o=r.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let E=n.split(`
2
- `);n=E.pop()??"";for(let x of E){let u=x.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e,t){this.http=e;this.getUserContext=t;}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)}async createPost(e){let t=e.externalUser??this.getUserContext();if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post("/v1/feedback",{...e,externalUser:t})}async createComment(e,t){let r=t.externalUser??this.getUserContext();if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,{...t,externalUser:r})}async listMyPosts(e){let t=e?.externalId??this.getUserContext()?.externalId;if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.get("/v1/feedback/mine",{...e,externalId:t})}async deletePost(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,{externalId:r})}async deleteComment(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,{externalId:r})}};var d=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}};var P=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var f=class{http;user=null;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http,()=>this.user),this.help=new d(this.http,this.entries),this.pages=new P(this.entries);}identify(e){this.user=e;}reset(){this.user=null;}getUser(){return this.user}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=m;exports.BlogModule=p;exports.ChangelogModule=c;exports.ConfigModule=g;exports.EntriesModule=l;exports.FeedbackModule=y;exports.HelpModule=d;exports.Kookee=f;exports.KookeeApiError=i;exports.PagesModule=P;
1
+ 'use strict';var k="https://api.kookee.dev",B="Kookee-API-Key",I="Kookee-Project-Id",i=class s extends Error{constructor(t,r,o){super(r);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,s.prototype);}},C=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[B]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)r.searchParams.append(h,String(a));else r.searchParams.set(h,String(n));}let o=await fetch(r.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async delete(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async*streamPost(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!r.ok){let a=null;try{a=await r.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${r.status}`,r.status)}if(!r.body)return;let o=r.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let E=n.split(`
2
+ `);n=E.pop()??"";for(let x of E){let u=x.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e,t){this.http=e;this.getUserContext=t;}async getColumns(){return this.http.get("/v1/feedback/columns")}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)}async createPost(e){let t=e.externalUser??this.getUserContext();if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post("/v1/feedback",{...e,externalUser:t})}async createComment(e,t){let r=t.externalUser??this.getUserContext();if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,{...t,externalUser:r})}async listMyPosts(e){let t=e?.externalId??this.getUserContext()?.externalId;if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.get("/v1/feedback/mine",{...e,externalId:t})}async deletePost(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,{externalId:r})}async deleteComment(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,{externalId:r})}};var d=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}};var P=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var f=class{http;user=null;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http,()=>this.user),this.help=new d(this.http,this.entries),this.pages=new P(this.entries);}identify(e){this.user=e;}reset(){this.user=null;}getUser(){return this.user}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=m;exports.BlogModule=p;exports.ChangelogModule=c;exports.ConfigModule=g;exports.EntriesModule=l;exports.FeedbackModule=y;exports.HelpModule=d;exports.Kookee=f;exports.KookeeApiError=i;exports.PagesModule=P;
package/dist/index.d.cts CHANGED
@@ -92,6 +92,14 @@ interface HelpSearchResult {
92
92
  matchedChunk?: string;
93
93
  }
94
94
  type FeedbackColumnType = 'open' | 'closed';
95
+ interface FeedbackKanbanColumn {
96
+ id: string;
97
+ name: string;
98
+ color: string | null;
99
+ position: number;
100
+ type: FeedbackColumnType;
101
+ isVisible: boolean;
102
+ }
95
103
  type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
96
104
  type FeedbackSortOption = 'newest' | 'top' | 'trending';
97
105
  interface FeedbackAuthor {
@@ -444,6 +452,7 @@ declare class FeedbackModule {
444
452
  private readonly http;
445
453
  private readonly getUserContext;
446
454
  constructor(http: HttpClient, getUserContext: () => KookeeUser | null);
455
+ getColumns(): Promise<FeedbackKanbanColumn[]>;
447
456
  list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
448
457
  getById(id: string): Promise<FeedbackPost>;
449
458
  vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
@@ -526,4 +535,4 @@ declare class Kookee {
526
535
  health(): Promise<HealthCheckResponse>;
527
536
  }
528
537
 
529
- export { type AnnouncementEntry, type AnnouncementGetByIdParams, type AnnouncementGetCommentsParams, type AnnouncementListParams, AnnouncementModule, type AnnouncementType, type AnnouncementTypeSpecific, type AnyEntry, type ApiError, type BaseEntry, type BlogEntry, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogGetCommentsParams, type BlogListParams, BlogModule, type BlogTypeSpecific, type ChangelogEntry, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogGetCommentsParams, type ChangelogListParams, ChangelogModule, type ChangelogType, type ChangelogTypeSpecific, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type EntriesGetByIdParams, type EntriesGetBySlugParams, type EntriesGetCategoriesParams, type EntriesGetCommentsParams, type EntriesListParams, EntriesModule, type EntryAuthor, type EntryCategory, type EntryComment, type EntryStatus, type EntryTag, type EntryTagWithCount, type EntryType, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackColumnType, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type GenericEntry, type HealthCheckResponse, type HelpArticleEntry, type HelpArticleTypeSpecific, type HelpArticleVisibility, type HelpCategoriesParams, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpGetCommentsParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type KookeeUser, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type PageEntry, type PageTypeSpecific, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesGetCommentsParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type TypeSpecific, type TypedEntry };
538
+ export { type AnnouncementEntry, type AnnouncementGetByIdParams, type AnnouncementGetCommentsParams, type AnnouncementListParams, AnnouncementModule, type AnnouncementType, type AnnouncementTypeSpecific, type AnyEntry, type ApiError, type BaseEntry, type BlogEntry, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogGetCommentsParams, type BlogListParams, BlogModule, type BlogTypeSpecific, type ChangelogEntry, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogGetCommentsParams, type ChangelogListParams, ChangelogModule, type ChangelogType, type ChangelogTypeSpecific, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type EntriesGetByIdParams, type EntriesGetBySlugParams, type EntriesGetCategoriesParams, type EntriesGetCommentsParams, type EntriesListParams, EntriesModule, type EntryAuthor, type EntryCategory, type EntryComment, type EntryStatus, type EntryTag, type EntryTagWithCount, type EntryType, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackColumnType, type FeedbackComment, type FeedbackKanbanColumn, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type GenericEntry, type HealthCheckResponse, type HelpArticleEntry, type HelpArticleTypeSpecific, type HelpArticleVisibility, type HelpCategoriesParams, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpGetCommentsParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type KookeeUser, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type PageEntry, type PageTypeSpecific, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesGetCommentsParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type TypeSpecific, type TypedEntry };
package/dist/index.d.ts CHANGED
@@ -92,6 +92,14 @@ interface HelpSearchResult {
92
92
  matchedChunk?: string;
93
93
  }
94
94
  type FeedbackColumnType = 'open' | 'closed';
95
+ interface FeedbackKanbanColumn {
96
+ id: string;
97
+ name: string;
98
+ color: string | null;
99
+ position: number;
100
+ type: FeedbackColumnType;
101
+ isVisible: boolean;
102
+ }
95
103
  type FeedbackPostCategory = 'feature' | 'improvement' | 'bug' | 'other';
96
104
  type FeedbackSortOption = 'newest' | 'top' | 'trending';
97
105
  interface FeedbackAuthor {
@@ -444,6 +452,7 @@ declare class FeedbackModule {
444
452
  private readonly http;
445
453
  private readonly getUserContext;
446
454
  constructor(http: HttpClient, getUserContext: () => KookeeUser | null);
455
+ getColumns(): Promise<FeedbackKanbanColumn[]>;
447
456
  list(params?: FeedbackListParams): Promise<PaginatedResponse<FeedbackPostListItem>>;
448
457
  getById(id: string): Promise<FeedbackPost>;
449
458
  vote(postId: string, params: FeedbackVoteParams): Promise<FeedbackVoteResponse>;
@@ -526,4 +535,4 @@ declare class Kookee {
526
535
  health(): Promise<HealthCheckResponse>;
527
536
  }
528
537
 
529
- export { type AnnouncementEntry, type AnnouncementGetByIdParams, type AnnouncementGetCommentsParams, type AnnouncementListParams, AnnouncementModule, type AnnouncementType, type AnnouncementTypeSpecific, type AnyEntry, type ApiError, type BaseEntry, type BlogEntry, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogGetCommentsParams, type BlogListParams, BlogModule, type BlogTypeSpecific, type ChangelogEntry, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogGetCommentsParams, type ChangelogListParams, ChangelogModule, type ChangelogType, type ChangelogTypeSpecific, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type EntriesGetByIdParams, type EntriesGetBySlugParams, type EntriesGetCategoriesParams, type EntriesGetCommentsParams, type EntriesListParams, EntriesModule, type EntryAuthor, type EntryCategory, type EntryComment, type EntryStatus, type EntryTag, type EntryTagWithCount, type EntryType, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackColumnType, type FeedbackComment, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type GenericEntry, type HealthCheckResponse, type HelpArticleEntry, type HelpArticleTypeSpecific, type HelpArticleVisibility, type HelpCategoriesParams, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpGetCommentsParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type KookeeUser, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type PageEntry, type PageTypeSpecific, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesGetCommentsParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type TypeSpecific, type TypedEntry };
538
+ export { type AnnouncementEntry, type AnnouncementGetByIdParams, type AnnouncementGetCommentsParams, type AnnouncementListParams, AnnouncementModule, type AnnouncementType, type AnnouncementTypeSpecific, type AnyEntry, type ApiError, type BaseEntry, type BlogEntry, type BlogGetByIdParams, type BlogGetBySlugParams, type BlogGetCommentsParams, type BlogListParams, BlogModule, type BlogTypeSpecific, type ChangelogEntry, type ChangelogGetByIdParams, type ChangelogGetBySlugParams, type ChangelogGetCommentsParams, type ChangelogListParams, ChangelogModule, type ChangelogType, type ChangelogTypeSpecific, type ConfigListParams, ConfigModule, type CreateFeedbackCommentParams, type CreateFeedbackPostParams, type CreatedFeedbackComment, type CreatedFeedbackPost, type DeleteFeedbackCommentParams, type DeleteFeedbackCommentResponse, type DeleteFeedbackPostParams, type DeleteFeedbackPostResponse, type EntriesGetByIdParams, type EntriesGetBySlugParams, type EntriesGetCategoriesParams, type EntriesGetCommentsParams, type EntriesListParams, EntriesModule, type EntryAuthor, type EntryCategory, type EntryComment, type EntryStatus, type EntryTag, type EntryTagWithCount, type EntryType, type ExternalUser, type FeedbackAssignee, type FeedbackAuthor, type FeedbackColumnType, type FeedbackComment, type FeedbackKanbanColumn, type FeedbackListParams, FeedbackModule, type FeedbackPost, type FeedbackPostCategory, type FeedbackPostListItem, type FeedbackSortOption, type FeedbackTopContributor, type FeedbackTopContributorsParams, type FeedbackVoteParams, type FeedbackVoteResponse, type GenericEntry, type HealthCheckResponse, type HelpArticleEntry, type HelpArticleTypeSpecific, type HelpArticleVisibility, type HelpCategoriesParams, type HelpChatMessage, type HelpChatParams, type HelpChatResponse, type HelpChatSource, type HelpChatSourceCategory, type HelpChatStreamChunk, type HelpGetByIdParams, type HelpGetBySlugParams, type HelpGetCommentsParams, type HelpListParams, HelpModule, type HelpSearchParams, type HelpSearchResult, Kookee, KookeeApiError, type KookeeConfig, type KookeeUser, type ListMyFeedbackPostsParams, type LocaleOptions, type OrderDirection, type PageEntry, type PageTypeSpecific, type PagesGetByIdParams, type PagesGetBySlugParams, type PagesGetCommentsParams, type PagesListParams, PagesModule, type PaginatedResponse, type PaginationParams, type PublicConfig, type ReactParams, type ReactResponse, type ReactionType, type TypeSpecific, type TypedEntry };
@@ -1,2 +1,2 @@
1
- (function(exports){'use strict';var B="https://api.kookee.dev",k="Kookee-API-Key",I="Kookee-Project-Id",i=class s extends Error{constructor(t,r,o){super(r);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,s.prototype);}},C=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[k]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)r.searchParams.append(h,String(a));else r.searchParams.set(h,String(n));}let o=await fetch(r.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async delete(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async*streamPost(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!r.ok){let a=null;try{a=await r.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${r.status}`,r.status)}if(!r.body)return;let o=r.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let E=n.split(`
2
- `);n=E.pop()??"";for(let x of E){let u=x.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e,t){this.http=e;this.getUserContext=t;}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)}async createPost(e){let t=e.externalUser??this.getUserContext();if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post("/v1/feedback",{...e,externalUser:t})}async createComment(e,t){let r=t.externalUser??this.getUserContext();if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,{...t,externalUser:r})}async listMyPosts(e){let t=e?.externalId??this.getUserContext()?.externalId;if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.get("/v1/feedback/mine",{...e,externalId:t})}async deletePost(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,{externalId:r})}async deleteComment(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,{externalId:r})}};var d=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}};var P=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var f=class{http;user=null;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http,()=>this.user),this.help=new d(this.http,this.entries),this.pages=new P(this.entries);}identify(e){this.user=e;}reset(){this.user=null;}getUser(){return this.user}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=m;exports.BlogModule=p;exports.ChangelogModule=c;exports.ConfigModule=g;exports.EntriesModule=l;exports.FeedbackModule=y;exports.HelpModule=d;exports.Kookee=f;exports.KookeeApiError=i;exports.PagesModule=P;return exports;})({});
1
+ (function(exports){'use strict';var k="https://api.kookee.dev",B="Kookee-API-Key",I="Kookee-Project-Id",i=class s extends Error{constructor(t,r,o){super(r);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,s.prototype);}},C=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[B]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)r.searchParams.append(h,String(a));else r.searchParams.set(h,String(n));}let o=await fetch(r.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async delete(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async*streamPost(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!r.ok){let a=null;try{a=await r.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${r.status}`,r.status)}if(!r.body)return;let o=r.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let E=n.split(`
2
+ `);n=E.pop()??"";for(let x of E){let u=x.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e,t){this.http=e;this.getUserContext=t;}async getColumns(){return this.http.get("/v1/feedback/columns")}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)}async createPost(e){let t=e.externalUser??this.getUserContext();if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post("/v1/feedback",{...e,externalUser:t})}async createComment(e,t){let r=t.externalUser??this.getUserContext();if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,{...t,externalUser:r})}async listMyPosts(e){let t=e?.externalId??this.getUserContext()?.externalId;if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.get("/v1/feedback/mine",{...e,externalId:t})}async deletePost(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,{externalId:r})}async deleteComment(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,{externalId:r})}};var d=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}};var P=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var f=class{http;user=null;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http,()=>this.user),this.help=new d(this.http,this.entries),this.pages=new P(this.entries);}identify(e){this.user=e;}reset(){this.user=null;}getUser(){return this.user}async health(){return this.http.get("/v1/health")}};exports.AnnouncementModule=m;exports.BlogModule=p;exports.ChangelogModule=c;exports.ConfigModule=g;exports.EntriesModule=l;exports.FeedbackModule=y;exports.HelpModule=d;exports.Kookee=f;exports.KookeeApiError=i;exports.PagesModule=P;return exports;})({});
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var B="https://api.kookee.dev",k="Kookee-API-Key",I="Kookee-Project-Id",i=class s extends Error{constructor(t,r,o){super(r);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,s.prototype);}},C=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[k]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)r.searchParams.append(h,String(a));else r.searchParams.set(h,String(n));}let o=await fetch(r.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async delete(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async*streamPost(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!r.ok){let a=null;try{a=await r.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${r.status}`,r.status)}if(!r.body)return;let o=r.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let E=n.split(`
2
- `);n=E.pop()??"";for(let x of E){let u=x.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e,t){this.http=e;this.getUserContext=t;}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)}async createPost(e){let t=e.externalUser??this.getUserContext();if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post("/v1/feedback",{...e,externalUser:t})}async createComment(e,t){let r=t.externalUser??this.getUserContext();if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,{...t,externalUser:r})}async listMyPosts(e){let t=e?.externalId??this.getUserContext()?.externalId;if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.get("/v1/feedback/mine",{...e,externalId:t})}async deletePost(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,{externalId:r})}async deleteComment(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,{externalId:r})}};var d=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}};var P=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var f=class{http;user=null;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http,()=>this.user),this.help=new d(this.http,this.entries),this.pages=new P(this.entries);}identify(e){this.user=e;}reset(){this.user=null;}getUser(){return this.user}async health(){return this.http.get("/v1/health")}};export{m as AnnouncementModule,p as BlogModule,c as ChangelogModule,g as ConfigModule,l as EntriesModule,y as FeedbackModule,d as HelpModule,f as Kookee,i as KookeeApiError,P as PagesModule};
1
+ var k="https://api.kookee.dev",B="Kookee-API-Key",I="Kookee-Project-Id",i=class s extends Error{constructor(t,r,o){super(r);this.code=t;this.status=o;this.name="KookeeApiError",Object.setPrototypeOf(this,s.prototype);}},C=class{baseUrl;apiKey;projectId;constructor(e){this.apiKey=e.apiKey,this.projectId=e.projectId,this.baseUrl=e.baseUrl??k;}getHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e[B]=this.apiKey),this.projectId&&(e[I]=this.projectId),e}async get(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t){for(let[h,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let a of n)r.searchParams.append(h,String(a));else r.searchParams.set(h,String(n));}let o=await fetch(r.toString(),{method:"GET",headers:this.getHeaders()});return this.handleResponse(o)}async post(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async delete(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"DELETE",headers:this.getHeaders(),body:t?JSON.stringify(t):void 0});return this.handleResponse(r)}async*streamPost(e,t){let r=await fetch(`${this.baseUrl}${e}`,{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:t?JSON.stringify(t):void 0});if(!r.ok){let a=null;try{a=await r.json();}catch{}throw new i(a?.code??"UNKNOWN_ERROR",a?.message??`Request failed with status ${r.status}`,r.status)}if(!r.body)return;let o=r.body.getReader(),h=new TextDecoder,n="";try{for(;;){let{done:a,value:b}=await o.read();if(a)break;n+=h.decode(b,{stream:!0});let E=n.split(`
2
+ `);n=E.pop()??"";for(let x of E){let u=x.trim();if(!(!u||u.startsWith(":"))&&u.startsWith("data: ")){let R=u.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 m=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"announcement",...e})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var p=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"blog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"blog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTags(){return this.entries.getTags("blog")}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}};var c=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"changelog",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"changelog",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,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 l=class{constructor(e){this.http=e;}async list(e){return this.http.get("/v1/entries",e)}async getById(e,t){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}`,t)}async getBySlug(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}`,t)}async getTranslationsById(e){return this.http.get(`/v1/entries/by-id/${encodeURIComponent(e)}/translations`)}async getTranslationsBySlug(e){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/translations`)}async getComments(e,t){return this.http.get(`/v1/entries/${encodeURIComponent(e)}/comments`,t)}async react(e,t){return this.http.post(`/v1/entries/${encodeURIComponent(e)}/reactions`,t)}async getTags(e){return this.http.get("/v1/tags",{type:e})}async getCategories(e,t){return this.http.get("/v1/categories",{type:e,...t})}};var y=class{constructor(e,t){this.http=e;this.getUserContext=t;}async getColumns(){return this.http.get("/v1/feedback/columns")}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)}async createPost(e){let t=e.externalUser??this.getUserContext();if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post("/v1/feedback",{...e,externalUser:t})}async createComment(e,t){let r=t.externalUser??this.getUserContext();if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalUser in params.");return this.http.post(`/v1/feedback/${encodeURIComponent(e)}/comments`,{...t,externalUser:r})}async listMyPosts(e){let t=e?.externalId??this.getUserContext()?.externalId;if(!t)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.get("/v1/feedback/mine",{...e,externalId:t})}async deletePost(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/${encodeURIComponent(e)}`,{externalId:r})}async deleteComment(e,t){let r=t?.externalId??this.getUserContext()?.externalId;if(!r)throw new Error("No user identified. Call kookee.identify() first or pass externalId in params.");return this.http.delete(`/v1/feedback/comments/${encodeURIComponent(e)}`,{externalId:r})}};var d=class{http;entries;constructor(e,t){this.http=e,this.entries=t;}async categories(e){return this.entries.getCategories("help_article",e)}async list(e){return this.entries.list({type:"help_article",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"help_article",...t})}async getById(e,t){return this.entries.getById(e,t)}async search(e){return this.http.get("/v1/help/search",e)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}async react(e,t){return this.entries.react(e,t)}async chat(e){return this.http.post("/v1/help/chat",e)}chatStream(e){return this.http.streamPost("/v1/help/chat/stream",e)}};var P=class{constructor(e){this.entries=e;}async list(e){return this.entries.list({type:"page",...e})}async getBySlug(e,t){return this.entries.getBySlug(e,{type:"page",...t})}async getById(e,t){return this.entries.getById(e,t)}async getTranslationsById(e){return this.entries.getTranslationsById(e)}async getTranslationsBySlug(e){return this.entries.getTranslationsBySlug(e)}async getComments(e,t){return this.entries.getComments(e,t)}};var f=class{http;user=null;entries;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 C({apiKey:e.apiKey,projectId:e.projectId,baseUrl:e.baseUrl}),this.entries=new l(this.http),this.announcements=new m(this.entries),this.blog=new p(this.entries),this.changelog=new c(this.entries),this.config=new g(this.http),this.feedback=new y(this.http,()=>this.user),this.help=new d(this.http,this.entries),this.pages=new P(this.entries);}identify(e){this.user=e;}reset(){this.user=null;}getUser(){return this.user}async health(){return this.http.get("/v1/health")}};export{m as AnnouncementModule,p as BlogModule,c as ChangelogModule,g as ConfigModule,l as EntriesModule,y as FeedbackModule,d as HelpModule,f as Kookee,i as KookeeApiError,P as PagesModule};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kookee/sdk",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
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",