@helmdesk/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/dist/client.d.ts +73 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +184 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/types/articles.d.ts +20 -0
- package/dist/types/articles.d.ts.map +1 -0
- package/dist/types/articles.js +2 -0
- package/dist/types/articles.js.map +1 -0
- package/dist/types/emails.d.ts +64 -0
- package/dist/types/emails.d.ts.map +1 -0
- package/dist/types/emails.js +2 -0
- package/dist/types/emails.js.map +1 -0
- package/dist/types/errors.d.ts +12 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +13 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/tickets.d.ts +71 -0
- package/dist/types/tickets.d.ts.map +1 -0
- package/dist/types/tickets.js +2 -0
- package/dist/types/tickets.js.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @helmdesk/sdk
|
|
2
|
+
|
|
3
|
+
Official Node.js SDK for the [Helmdesk](https://helmdesk.dev) API — helpdesk, transactional email, and knowledge base for developers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @helmdesk/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { HelmdeskClient } from '@helmdesk/sdk'
|
|
15
|
+
|
|
16
|
+
const helmdesk = new HelmdeskClient({
|
|
17
|
+
apiKey: process.env.HELMDESK_API_KEY!,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// Send a transactional email
|
|
21
|
+
await helmdesk.emails.send({
|
|
22
|
+
templateKey: 'welcome',
|
|
23
|
+
to: { email: 'user@example.com', name: 'Jane' },
|
|
24
|
+
variables: { activationUrl: 'https://...' },
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Create a support ticket
|
|
28
|
+
const ticket = await helmdesk.tickets.create({
|
|
29
|
+
subject: 'Cannot login',
|
|
30
|
+
body: 'Getting a 403 error...',
|
|
31
|
+
customerEmail: 'user@example.com',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// Search knowledge base articles
|
|
35
|
+
const results = await helmdesk.articles.search({ q: 'reset password' })
|
|
36
|
+
|
|
37
|
+
// Import a Handlebars template
|
|
38
|
+
await helmdesk.emails.templates.import(
|
|
39
|
+
'<h1>Hello {{name}}</h1>',
|
|
40
|
+
'welcome.hbs',
|
|
41
|
+
{ type: 'template' }
|
|
42
|
+
)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Resources
|
|
46
|
+
|
|
47
|
+
- `helmdesk.tickets` — create, list, get, update, addMessage
|
|
48
|
+
- `helmdesk.emails` — send, preview, getTemplateSchema
|
|
49
|
+
- `helmdesk.emails.templates` — import (project or account scope)
|
|
50
|
+
- `helmdesk.articles` — search
|
|
51
|
+
|
|
52
|
+
## Requirements
|
|
53
|
+
|
|
54
|
+
- Node.js 18+ (uses native `fetch`)
|
|
55
|
+
- Works in Deno, Bun, and Cloudflare Workers
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
Full API docs at [helmdesk.dev/docs](https://helmdesk.dev/docs)
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Ticket, TicketDetail, TicketListResult, TicketListFilters, CreateTicketInput, UpdateTicketInput, CreateMessageInput, TicketMessage } from './types/tickets';
|
|
2
|
+
import type { SendEmailInput, SendEmailResult, PreviewEmailInput, PreviewEmailResult, TemplateSchema, ImportResult, ImportOptions } from './types/emails';
|
|
3
|
+
import type { ArticleSearchResult, ArticleSearchFilters } from './types/articles';
|
|
4
|
+
export interface HelmdeskClientOptions {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class HelmdeskClient {
|
|
9
|
+
private readonly apiKey;
|
|
10
|
+
private readonly baseUrl;
|
|
11
|
+
readonly tickets: TicketsResource;
|
|
12
|
+
readonly emails: EmailsResource;
|
|
13
|
+
readonly articles: ArticlesResource;
|
|
14
|
+
constructor(options: HelmdeskClientOptions);
|
|
15
|
+
/** Make a JSON API request. Used internally by resource classes. */
|
|
16
|
+
request<T>(method: string, path: string, options?: {
|
|
17
|
+
body?: unknown;
|
|
18
|
+
params?: Record<string, string | undefined>;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
}): Promise<T>;
|
|
21
|
+
/** Make a multipart form data request (for file uploads). */
|
|
22
|
+
upload<T>(path: string, formData: FormData): Promise<T>;
|
|
23
|
+
}
|
|
24
|
+
declare class TicketsResource {
|
|
25
|
+
private client;
|
|
26
|
+
constructor(client: HelmdeskClient);
|
|
27
|
+
list(filters?: TicketListFilters): Promise<TicketListResult>;
|
|
28
|
+
get(ticketId: string): Promise<TicketDetail>;
|
|
29
|
+
create(input: CreateTicketInput): Promise<Ticket>;
|
|
30
|
+
update(ticketId: string, input: UpdateTicketInput): Promise<TicketDetail>;
|
|
31
|
+
addMessage(ticketId: string, input: CreateMessageInput): Promise<TicketMessage>;
|
|
32
|
+
}
|
|
33
|
+
declare class EmailsResource {
|
|
34
|
+
private client;
|
|
35
|
+
readonly templates: TemplatesResource;
|
|
36
|
+
constructor(client: HelmdeskClient);
|
|
37
|
+
/** Send a transactional email using a template key. Use @account/ prefix for shared templates. */
|
|
38
|
+
send(input: SendEmailInput, options?: {
|
|
39
|
+
idempotencyKey?: string;
|
|
40
|
+
}): Promise<SendEmailResult>;
|
|
41
|
+
/** Preview a rendered email template. Use @account/ prefix for shared templates. */
|
|
42
|
+
preview(input: PreviewEmailInput): Promise<PreviewEmailResult>;
|
|
43
|
+
/** Get the variable schema for a template. */
|
|
44
|
+
getTemplateSchema(templateKey: string): Promise<TemplateSchema>;
|
|
45
|
+
}
|
|
46
|
+
declare class TemplatesResource {
|
|
47
|
+
private client;
|
|
48
|
+
constructor(client: HelmdeskClient);
|
|
49
|
+
/**
|
|
50
|
+
* Import a .hbs file as a template, layout, or partial.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // Import to project
|
|
54
|
+
* await client.emails.templates.import(fileContent, 'welcome.hbs', {
|
|
55
|
+
* type: 'template',
|
|
56
|
+
* subject: 'Welcome to {{brandName}}!',
|
|
57
|
+
* })
|
|
58
|
+
*
|
|
59
|
+
* // Import to account (shared across all projects)
|
|
60
|
+
* await client.emails.templates.import(fileContent, 'footer.hbs', {
|
|
61
|
+
* type: 'partial',
|
|
62
|
+
* scope: 'account',
|
|
63
|
+
* })
|
|
64
|
+
*/
|
|
65
|
+
import(fileContent: string | Blob, fileName: string, options?: ImportOptions): Promise<ImportResult>;
|
|
66
|
+
}
|
|
67
|
+
declare class ArticlesResource {
|
|
68
|
+
private client;
|
|
69
|
+
constructor(client: HelmdeskClient);
|
|
70
|
+
search(filters?: ArticleSearchFilters): Promise<ArticleSearchResult>;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,aAAa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AAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIzE,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;CAGtF;AAED,cAAM,cAAc;IAGN,OAAO,CAAC,MAAM;IAF1B,SAAgB,SAAS,EAAE,iBAAiB,CAAA;gBAExB,MAAM,EAAE,cAAc;IAI1C,kGAAkG;IAC5F,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAWlG,oFAAoF;IAC9E,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIpE,8CAA8C;IACxC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAGtE;AAED,cAAM,iBAAiB;IACT,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAE1C;;;;;;;;;;;;;;;OAeG;IACG,MAAM,CACV,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;CAoBzB;AAED,cAAM,gBAAgB;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAEpC,MAAM,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAU3E"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { HelmdeskError } from './types/errors';
|
|
2
|
+
export class HelmdeskClient {
|
|
3
|
+
apiKey;
|
|
4
|
+
baseUrl;
|
|
5
|
+
tickets;
|
|
6
|
+
emails;
|
|
7
|
+
articles;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
if (!options.apiKey)
|
|
10
|
+
throw new Error('apiKey is required');
|
|
11
|
+
this.apiKey = options.apiKey;
|
|
12
|
+
this.baseUrl = (options.baseUrl ?? 'https://helmdesk.dev').replace(/\/$/, '');
|
|
13
|
+
this.tickets = new TicketsResource(this);
|
|
14
|
+
this.emails = new EmailsResource(this);
|
|
15
|
+
this.articles = new ArticlesResource(this);
|
|
16
|
+
}
|
|
17
|
+
/** Make a JSON API request. Used internally by resource classes. */
|
|
18
|
+
async request(method, path, options) {
|
|
19
|
+
const url = new URL(`/api/v1${path}`, this.baseUrl);
|
|
20
|
+
if (options?.params) {
|
|
21
|
+
for (const [key, value] of Object.entries(options.params)) {
|
|
22
|
+
if (value !== undefined)
|
|
23
|
+
url.searchParams.set(key, value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const headers = {
|
|
27
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
28
|
+
...options?.headers,
|
|
29
|
+
};
|
|
30
|
+
if (options?.body !== undefined) {
|
|
31
|
+
headers['Content-Type'] = 'application/json';
|
|
32
|
+
}
|
|
33
|
+
const response = await fetch(url.toString(), {
|
|
34
|
+
method,
|
|
35
|
+
headers,
|
|
36
|
+
body: options?.body !== undefined ? JSON.stringify(options.body) : undefined,
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
const body = await response.json().catch(() => ({
|
|
40
|
+
error: { code: 'unknown', message: response.statusText },
|
|
41
|
+
}));
|
|
42
|
+
throw new HelmdeskError(response.status, body.error ?? {
|
|
43
|
+
code: 'unknown',
|
|
44
|
+
message: response.statusText,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return response.json();
|
|
48
|
+
}
|
|
49
|
+
/** Make a multipart form data request (for file uploads). */
|
|
50
|
+
async upload(path, formData) {
|
|
51
|
+
const url = new URL(`/api/v1${path}`, this.baseUrl);
|
|
52
|
+
const response = await fetch(url.toString(), {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: { 'Authorization': `Bearer ${this.apiKey}` },
|
|
55
|
+
body: formData,
|
|
56
|
+
});
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
const body = await response.json().catch(() => ({
|
|
59
|
+
error: { code: 'unknown', message: response.statusText },
|
|
60
|
+
}));
|
|
61
|
+
throw new HelmdeskError(response.status, body.error ?? {
|
|
62
|
+
code: 'unknown',
|
|
63
|
+
message: response.statusText,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return response.json();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
class TicketsResource {
|
|
70
|
+
client;
|
|
71
|
+
constructor(client) {
|
|
72
|
+
this.client = client;
|
|
73
|
+
}
|
|
74
|
+
async list(filters) {
|
|
75
|
+
return this.client.request('GET', '/tickets', {
|
|
76
|
+
params: {
|
|
77
|
+
status: filters?.status,
|
|
78
|
+
priority: filters?.priority,
|
|
79
|
+
search: filters?.search,
|
|
80
|
+
page: filters?.page?.toString(),
|
|
81
|
+
limit: filters?.limit?.toString(),
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async get(ticketId) {
|
|
86
|
+
return this.client.request('GET', `/tickets/${ticketId}`);
|
|
87
|
+
}
|
|
88
|
+
async create(input) {
|
|
89
|
+
return this.client.request('POST', '/tickets', { body: input });
|
|
90
|
+
}
|
|
91
|
+
async update(ticketId, input) {
|
|
92
|
+
return this.client.request('PATCH', `/tickets/${ticketId}`, { body: input });
|
|
93
|
+
}
|
|
94
|
+
async addMessage(ticketId, input) {
|
|
95
|
+
return this.client.request('POST', `/tickets/${ticketId}/messages`, { body: input });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
class EmailsResource {
|
|
99
|
+
client;
|
|
100
|
+
templates;
|
|
101
|
+
constructor(client) {
|
|
102
|
+
this.client = client;
|
|
103
|
+
this.templates = new TemplatesResource(client);
|
|
104
|
+
}
|
|
105
|
+
/** Send a transactional email using a template key. Use @account/ prefix for shared templates. */
|
|
106
|
+
async send(input, options) {
|
|
107
|
+
const headers = {};
|
|
108
|
+
if (options?.idempotencyKey) {
|
|
109
|
+
headers['Idempotency-Key'] = options.idempotencyKey;
|
|
110
|
+
}
|
|
111
|
+
return this.client.request('POST', '/emails/send', {
|
|
112
|
+
body: input,
|
|
113
|
+
headers,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/** Preview a rendered email template. Use @account/ prefix for shared templates. */
|
|
117
|
+
async preview(input) {
|
|
118
|
+
return this.client.request('POST', '/emails/preview', { body: input });
|
|
119
|
+
}
|
|
120
|
+
/** Get the variable schema for a template. */
|
|
121
|
+
async getTemplateSchema(templateKey) {
|
|
122
|
+
return this.client.request('GET', `/email-templates/${templateKey}/schema`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
class TemplatesResource {
|
|
126
|
+
client;
|
|
127
|
+
constructor(client) {
|
|
128
|
+
this.client = client;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Import a .hbs file as a template, layout, or partial.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* // Import to project
|
|
135
|
+
* await client.emails.templates.import(fileContent, 'welcome.hbs', {
|
|
136
|
+
* type: 'template',
|
|
137
|
+
* subject: 'Welcome to {{brandName}}!',
|
|
138
|
+
* })
|
|
139
|
+
*
|
|
140
|
+
* // Import to account (shared across all projects)
|
|
141
|
+
* await client.emails.templates.import(fileContent, 'footer.hbs', {
|
|
142
|
+
* type: 'partial',
|
|
143
|
+
* scope: 'account',
|
|
144
|
+
* })
|
|
145
|
+
*/
|
|
146
|
+
async import(fileContent, fileName, options) {
|
|
147
|
+
const formData = new FormData();
|
|
148
|
+
if (typeof fileContent === 'string') {
|
|
149
|
+
formData.append('file', new Blob([fileContent], { type: 'text/plain' }), fileName);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
formData.append('file', fileContent, fileName);
|
|
153
|
+
}
|
|
154
|
+
if (options?.type)
|
|
155
|
+
formData.append('type', options.type);
|
|
156
|
+
if (options?.key)
|
|
157
|
+
formData.append('key', options.key);
|
|
158
|
+
if (options?.name)
|
|
159
|
+
formData.append('name', options.name);
|
|
160
|
+
if (options?.subject)
|
|
161
|
+
formData.append('subject', options.subject);
|
|
162
|
+
const path = options?.scope === 'account'
|
|
163
|
+
? '/account/email-templates/import'
|
|
164
|
+
: '/email-templates/import';
|
|
165
|
+
return this.client.upload(path, formData);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
class ArticlesResource {
|
|
169
|
+
client;
|
|
170
|
+
constructor(client) {
|
|
171
|
+
this.client = client;
|
|
172
|
+
}
|
|
173
|
+
async search(filters) {
|
|
174
|
+
return this.client.request('GET', '/articles/search', {
|
|
175
|
+
params: {
|
|
176
|
+
q: filters?.q,
|
|
177
|
+
category: filters?.category,
|
|
178
|
+
page: filters?.page?.toString(),
|
|
179
|
+
limit: filters?.limit?.toString(),
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AA2B9C,MAAM,OAAO,cAAc;IACR,MAAM,CAAQ;IACd,OAAO,CAAQ;IAEhB,OAAO,CAAiB;IACxB,MAAM,CAAgB;IACtB,QAAQ,CAAkB;IAE1C,YAAY,OAA8B;QACxC,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAC1D,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,sBAAsB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAC7E,IAAI,CAAC,OAAO,GAAG,IAAI,eA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ED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { HelmdeskClient } from './client';
|
|
2
|
+
export type { HelmdeskClientOptions } from './client';
|
|
3
|
+
export type { Ticket, TicketDetail, TicketMessage, TicketListResult, TicketListFilters, CreateTicketInput, UpdateTicketInput, CreateMessageInput, } from './types/tickets';
|
|
4
|
+
export type { SendEmailInput, SendEmailResult, PreviewEmailInput, PreviewEmailResult, TemplateSchema, TemplateVariable, ImportOptions, ImportResult, } from './types/emails';
|
|
5
|
+
export type { ArticleSearchResult, ArticleSearchFilters, } from './types/articles';
|
|
6
|
+
export type { HelmdeskError } from './types/errors';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EACV,MAAM,EACN,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACV,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ArticleSearchResult {
|
|
2
|
+
articles: {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
excerpt?: string | null;
|
|
7
|
+
categoryName?: string | null;
|
|
8
|
+
publishedAt: string;
|
|
9
|
+
}[];
|
|
10
|
+
total: number;
|
|
11
|
+
page: number;
|
|
12
|
+
limit: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ArticleSearchFilters {
|
|
15
|
+
q?: string;
|
|
16
|
+
category?: string;
|
|
17
|
+
page?: number;
|
|
18
|
+
limit?: number;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=articles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articles.d.ts","sourceRoot":"","sources":["../../src/types/articles.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE;QACR,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACvB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC5B,WAAW,EAAE,MAAM,CAAA;KACpB,EAAE,CAAA;IACH,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articles.js","sourceRoot":"","sources":["../../src/types/articles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface SendEmailInput {
|
|
2
|
+
templateKey: string;
|
|
3
|
+
to: {
|
|
4
|
+
email: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
};
|
|
7
|
+
variables?: Record<string, unknown>;
|
|
8
|
+
environment?: 'production' | 'staging' | 'development';
|
|
9
|
+
}
|
|
10
|
+
export interface SendEmailResult {
|
|
11
|
+
id: string;
|
|
12
|
+
status: string;
|
|
13
|
+
to: string;
|
|
14
|
+
subject: string;
|
|
15
|
+
deduplicated: boolean;
|
|
16
|
+
blocked: boolean;
|
|
17
|
+
blockReason?: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PreviewEmailInput {
|
|
21
|
+
templateKey: string;
|
|
22
|
+
variables?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface PreviewEmailResult {
|
|
25
|
+
subject: string;
|
|
26
|
+
html: string;
|
|
27
|
+
}
|
|
28
|
+
export interface TemplateVariable {
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
description?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TemplateSchema {
|
|
35
|
+
key: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
variables: TemplateVariable[];
|
|
39
|
+
}
|
|
40
|
+
export interface ImportOptions {
|
|
41
|
+
/** Type of HBS file: template, layout, or partial. Defaults to 'template'. */
|
|
42
|
+
type?: 'template' | 'layout' | 'partial';
|
|
43
|
+
/** Override the key (defaults to filename without .hbs extension). */
|
|
44
|
+
key?: string;
|
|
45
|
+
/** Override the display name. */
|
|
46
|
+
name?: string;
|
|
47
|
+
/** Subject line for templates. Auto-detected from {{!-- subject: ... --}} comment if not specified. */
|
|
48
|
+
subject?: string;
|
|
49
|
+
/** Import to 'account' (shared) or 'project' (default). */
|
|
50
|
+
scope?: 'project' | 'account';
|
|
51
|
+
}
|
|
52
|
+
export interface ImportResult {
|
|
53
|
+
id: string;
|
|
54
|
+
key: string;
|
|
55
|
+
name: string;
|
|
56
|
+
type: 'template' | 'layout' | 'partial';
|
|
57
|
+
scope?: 'account';
|
|
58
|
+
subject?: string;
|
|
59
|
+
variables?: string[];
|
|
60
|
+
referencedPartials?: string[];
|
|
61
|
+
layoutKey?: string | null;
|
|
62
|
+
warnings?: string[];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=emails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../src/types/emails.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,EAAE,EAAE;QACF,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;CACvD;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,OAAO,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,gBAAgB,EAAE,CAAA;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAA;IACxC,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uGAAuG;IACvG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAA;IACvC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emails.js","sourceRoot":"","sources":["../../src/types/emails.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface HelmdeskErrorDetail {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
details?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare class HelmdeskError extends Error {
|
|
7
|
+
readonly code: string;
|
|
8
|
+
readonly status: number;
|
|
9
|
+
readonly details?: Record<string, unknown>;
|
|
10
|
+
constructor(status: number, body: HelmdeskErrorDetail);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,MAAM,EAAE,MAAM,CAAA;IAC9B,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAErC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB;CAOtD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class HelmdeskError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
status;
|
|
4
|
+
details;
|
|
5
|
+
constructor(status, body) {
|
|
6
|
+
super(body.message);
|
|
7
|
+
this.name = 'HelmdeskError';
|
|
8
|
+
this.code = body.code;
|
|
9
|
+
this.status = status;
|
|
10
|
+
this.details = body.details;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtB,IAAI,CAAQ;IACZ,MAAM,CAAQ;IACd,OAAO,CAA0B;IAEjD,YAAY,MAAc,EAAE,IAAyB;QACnD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type TicketStatus = 'new' | 'open' | 'pending' | 'resolved' | 'closed';
|
|
2
|
+
export type TicketPriority = 'low' | 'medium' | 'high' | 'urgent';
|
|
3
|
+
export type TicketCategory = 'bug' | 'feature_request' | 'billing' | 'howto' | 'other';
|
|
4
|
+
export interface Ticket {
|
|
5
|
+
id: string;
|
|
6
|
+
number: number;
|
|
7
|
+
subject: string;
|
|
8
|
+
status: TicketStatus;
|
|
9
|
+
priority: TicketPriority;
|
|
10
|
+
category?: TicketCategory | null;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
customerEmail: string;
|
|
14
|
+
customerName?: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface TicketMessage {
|
|
17
|
+
id: string;
|
|
18
|
+
ticketId: string;
|
|
19
|
+
senderType: 'customer' | 'staff';
|
|
20
|
+
body: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TicketDetail {
|
|
24
|
+
id: string;
|
|
25
|
+
number: number;
|
|
26
|
+
subject: string;
|
|
27
|
+
status: TicketStatus;
|
|
28
|
+
priority: TicketPriority;
|
|
29
|
+
category?: TicketCategory | null;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
closedAt?: string | null;
|
|
33
|
+
customer: {
|
|
34
|
+
id: string;
|
|
35
|
+
email: string;
|
|
36
|
+
name?: string | null;
|
|
37
|
+
};
|
|
38
|
+
messages: TicketMessage[];
|
|
39
|
+
tags: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface TicketListResult {
|
|
42
|
+
tickets: Ticket[];
|
|
43
|
+
total: number;
|
|
44
|
+
page: number;
|
|
45
|
+
limit: number;
|
|
46
|
+
}
|
|
47
|
+
export interface TicketListFilters {
|
|
48
|
+
status?: TicketStatus;
|
|
49
|
+
priority?: TicketPriority;
|
|
50
|
+
search?: string;
|
|
51
|
+
page?: number;
|
|
52
|
+
limit?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface CreateTicketInput {
|
|
55
|
+
subject: string;
|
|
56
|
+
body: string;
|
|
57
|
+
customerEmail: string;
|
|
58
|
+
customerName?: string;
|
|
59
|
+
priority?: TicketPriority;
|
|
60
|
+
category?: TicketCategory;
|
|
61
|
+
}
|
|
62
|
+
export interface UpdateTicketInput {
|
|
63
|
+
status?: TicketStatus;
|
|
64
|
+
priority?: TicketPriority;
|
|
65
|
+
category?: TicketCategory;
|
|
66
|
+
assignedTo?: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface CreateMessageInput {
|
|
69
|
+
body: string;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=tickets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tickets.d.ts","sourceRoot":"","sources":["../../src/types/tickets.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAA;AAC7E,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAEtF,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,YAAY,CAAA;IACpB,QAAQ,EAAE,cAAc,CAAA;IACxB,QAAQ,CAAC,EAAE,cAAc,GAA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,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tickets.js","sourceRoot":"","sources":["../../src/types/tickets.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@helmdesk/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official Node.js SDK for the Helmdesk API",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.build.json",
|
|
20
|
+
"prepublishOnly": "pnpm run build",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"lint": "eslint",
|
|
23
|
+
"test": "vitest run"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"typescript": "^5.8.3",
|
|
27
|
+
"vitest": "^4.1.6"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"helmdesk",
|
|
31
|
+
"helpdesk",
|
|
32
|
+
"email",
|
|
33
|
+
"sdk",
|
|
34
|
+
"api",
|
|
35
|
+
"transactional-email",
|
|
36
|
+
"knowledge-base"
|
|
37
|
+
],
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/MoloksInc/helmdesk",
|
|
42
|
+
"directory": "packages/sdk"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://helmdesk.dev/docs",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
}
|
|
51
|
+
}
|