@html-css-to-image/client 0.0.1

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 ADDED
@@ -0,0 +1,203 @@
1
+ # HTML/CSS to Image TypeScript Client
2
+
3
+ A lightweight TypeScript client for the [HTML/CSS to Image API](https://htmlcsstoimage.com). Easily generate images from HTML/CSS, URLs, or templates in your TypeScript or JavaScript projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @html-css-to-image/client
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Initialize the Client
14
+
15
+ You can initialize the client with your API ID and API Key. You can find these in your [HTML/CSS to Image dashboard](https://htmlcsstoimage.com/dashboard).
16
+
17
+ ```typescript
18
+ import { HtmlCssToImageClient } from '@html-css-to-image/client';
19
+
20
+ const client = new HtmlCssToImageClient('your_user_id', 'your_api_key');
21
+ ```
22
+
23
+ Alternatively, you can use environment variables (`HCTI_API_ID` and `HCTI_API_KEY`) and initialize the client like this:
24
+
25
+ ```typescript
26
+ const client = HtmlCssToImageClient.fromEnv();
27
+ ```
28
+
29
+ > [!CAUTION]
30
+ > **Security Warning:** Your API Key should always be kept secret. Never use this client directly in frontend code (browsers, mobile apps). If you need to generate images or signed URLs for the frontend, always do so from a secure backend server.
31
+
32
+ ### Create an Image from HTML/CSS
33
+
34
+ ```typescript
35
+ import { CreateHtmlCssImageRequest } from '@html-css-to-image/client';
36
+
37
+ const request = new CreateHtmlCssImageRequest({
38
+ html: '<h1>Hello World</h1>',
39
+ css: 'h1 { color: blue; }',
40
+ google_fonts: ['Roboto']
41
+ });
42
+
43
+ const result = await client.createImage(request);
44
+
45
+ if (result.success) {
46
+ console.log('Image URL:', result.url);
47
+ } else {
48
+ console.error('Error:', result.error);
49
+ }
50
+ ```
51
+
52
+ ### Create an Image from a URL
53
+
54
+ ```typescript
55
+ import { CreateUrlImageRequest } from '@html-css-to-image/client';
56
+
57
+ const request = new CreateUrlImageRequest({
58
+ url: 'https://example.com',
59
+ full_screen: true
60
+ });
61
+
62
+ const result = await client.createImage(request);
63
+
64
+ if (result.success) {
65
+ console.log('Image URL:', result.url);
66
+ }
67
+ ```
68
+
69
+ ## Creating Image URLs
70
+
71
+ For use cases where you want to generate a URL on the server and use it safely on the client (without exposing your API key), you can generate a signed URL.
72
+
73
+ You can generate signed URLs for images without actually calling the API by calling `generateCreateAndRenderUrl` or `generateTemplatedImageUrl`.
74
+
75
+ These methods are synchronous because they don't make any network calls and have been designed to be very high-performance.
76
+
77
+ Read more about signed URLs in the [create-and-render docs](https://docs.htmlcsstoimage.com/getting-started/create-and-render/).
78
+
79
+ These URLs are tied to the API Key & API ID you provide when creating the client. If you change them or disable the keys, you'll need to generate new URLs.
80
+
81
+ These methods are handy when you have a lot of content that may never be rendered and want to render on-demand, as to not waste your image credits.
82
+
83
+ ### Signed Template URLs
84
+
85
+ ```typescript
86
+ const signedUrl = client.createTemplatedImageUrl('your_template_id', {
87
+ title: 'Dynamic Title'
88
+ });
89
+
90
+ console.log('Signed URL:', signedUrl);
91
+ ```
92
+
93
+ > [!TIP]
94
+ > You can also pass in a `CreateTemplatedImageRequest` object to generate a signed URL for a template.
95
+
96
+ ### Signed Screenshot URLs
97
+ Sometimes you want to maintain an endpoint for your images, and just take a screenshot of it. This is where the `generateCreateAndRenderUrl` method is handy.
98
+
99
+ ```typescript
100
+ import {CreateUrlImageRequest} from '@html-css-to-image/client';
101
+ const this_item = {
102
+ id: 123,
103
+ updated_at: new Date(2025, 7, 15)
104
+ };
105
+ const url_request = new CreateUrlImageRequest({
106
+ url: `https://website.com/_social/${this_tem_id}?updated_at=${updated_at.valueOf()}`,
107
+ viewport_width: 600,
108
+ viewport_height: 200});
109
+ const signedUrl = client.generateCreateAndRenderUr(url_request);
110
+
111
+ // now it's safe to use signedUrl on the frontend in a meta or img tag, without exposing your API key, and it will be kept updated as the updated_at changes.
112
+ ```
113
+
114
+ ### Using Templates
115
+
116
+ If you have created a template for your account, you can generate an image by passing your template ID and the data for your variables.
117
+
118
+ ```typescript
119
+ const result = await client.createImage({
120
+ template_id: 'your_template_id',
121
+ template_values: {
122
+ title: 'Hello from Template',
123
+ subtitle: 'This is a dynamic value'
124
+ }
125
+ });
126
+ ```
127
+
128
+ ### PDF Generation
129
+
130
+ You can generate PDF documents by providing `pdf_options`.
131
+
132
+ ```typescript
133
+ import { CreateHtmlCssImageRequest, PDFOptions } from '@html-css-to-image/client';
134
+
135
+ const request = new CreateHtmlCssImageRequest({
136
+ html: '<h1>This will be a PDF</h1>',
137
+ pdf_options: new PDFOptions({
138
+ // Use numbers for pixels (default)
139
+ // Or use an object for specific units (in, cm, mm, px)
140
+ margins: {
141
+ top: { value: 10, unit: 'mm' },
142
+ right: { value: 10, unit: 'mm' },
143
+ bottom: 20, // defaults to 20px
144
+ left: { value: 1, unit: 'in' }
145
+ }
146
+ })
147
+ });
148
+
149
+ const result = await client.createImage(request);
150
+ ```
151
+
152
+ ### Batch Image Creation
153
+
154
+ Generate multiple images in a single request for better performance.
155
+
156
+ The number of images allowed in a batch depends on your plan, most plans allow up to 25 images per request.
157
+
158
+ ```typescript
159
+ const variations = [
160
+ new CreateHtmlCssImageRequest({ html: '<h1>Image 1</h1>' }),
161
+ new CreateHtmlCssImageRequest({ html: '<h1>Image 2</h1>' })
162
+ ];
163
+
164
+ const defaults = new CreateHtmlCssImageRequest({
165
+ css: 'h1 { color: red; }'
166
+ });
167
+
168
+ const result = await client.createImageBatch(variations, defaults);
169
+
170
+ if (result.success) {
171
+ result.images.forEach(img => console.log(img.url));
172
+ }
173
+ ```
174
+
175
+ ## Custom Fetch
176
+
177
+ By default, the client uses the global `fetch`.
178
+
179
+ If you are in an environment without a global fetch or want to use a custom implementation (like `node-fetch` or `undici`), you can pass it to the constructor.
180
+
181
+ ```typescript
182
+ import fetch from 'node-fetch';
183
+
184
+ const client = new HtmlCssToImageClient(apiId, apiKey, fetch);
185
+ ```
186
+
187
+ ## Features
188
+
189
+ - **Full TypeScript support**: Strongly typed requests and responses.
190
+ - **HTML/CSS & URL Support**: Generate images from raw content or live websites.
191
+ - **Templates**: Use your HCTI templates with dynamic data.
192
+ - **Signed URLs**: Securely generate image URLs with HMAC authentication.
193
+ - **PDF Support**: Comprehensive PDF generation options.
194
+ - **Batching**: Efficiently generate multiple images in one go.
195
+ - **Zero Dependencies**: Lightweight and uses native fetch by default.
196
+
197
+ ---
198
+
199
+ > [!IMPORTANT]
200
+ > Check out the [HTML/CSS To Image Docs](https://docs.htmlcsstoimage.com) for more details on the API's capabilities.
201
+
202
+ > [!TIP]
203
+ > Get started for free at [htmlcsstoimage.com](https://htmlcsstoimage.com).
@@ -0,0 +1,25 @@
1
+ import { IHtmlCssToImageClient } from "./IHtmlCssToImageClient.js";
2
+ import { CreateHtmlCssImageRequest, CreateTemplatedImageRequest, CreateUrlImageRequest } from "./types/request.js";
3
+ import { CreateImageBatchResponse, CreateImageResponse } from "./types/response.js";
4
+ export type FetchFunction = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
5
+ export declare class HtmlCssToImageClient implements IHtmlCssToImageClient {
6
+ private readonly apiId;
7
+ private readonly apiKey;
8
+ private readonly baseUrl;
9
+ private readonly authHeader;
10
+ private readonly fetch;
11
+ constructor(apiId: string, apiKey: string, customFetch?: FetchFunction);
12
+ static fromEnv(): HtmlCssToImageClient;
13
+ createImage(request: CreateHtmlCssImageRequest | CreateUrlImageRequest | CreateTemplatedImageRequest): Promise<CreateImageResponse>;
14
+ private mapToInternal;
15
+ createImageBatch<T extends CreateHtmlCssImageRequest | CreateUrlImageRequest>(variations: T[], default_options?: T): Promise<CreateImageBatchResponse>;
16
+ generateTemplatedImageUrl<T extends Record<string, any>>(templateIdOrRequest: string | CreateTemplatedImageRequest<T>, templateValues?: T, templateVersion?: number): string;
17
+ generateCreateAndRenderUrl(request: CreateUrlImageRequest): string;
18
+ private responseToType;
19
+ private mapHtmlCssToInternalRequest;
20
+ private mapUrlToInternalRequest;
21
+ private mapPDFOptionsToInternal;
22
+ private pdfValueWithUnitsToString;
23
+ private generateHmacToken;
24
+ }
25
+ //# sourceMappingURL=HtmlCssToImageClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HtmlCssToImageClient.d.ts","sourceRoot":"","sources":["../src/HtmlCssToImageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAC,yBAAyB,EAAE,2BAA2B,EAAE,qBAAqB,EAA4B,MAAM,oBAAoB,CAAC;AAC5I,OAAO,EAAC,wBAAwB,EAAmC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAInH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErG,qBAAa,oBAAqB,YAAW,qBAAqB;IAE9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IAEpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;gBAE1B,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,aAAa;IAetE,MAAM,CAAC,OAAO,IAAI,oBAAoB;IAYhC,WAAW,CAAC,OAAO,EAAE,yBAAyB,GAAG,qBAAqB,GAAG,2BAA2B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAgBzI,OAAO,CAAC,aAAa;IAaf,gBAAgB,CAAC,CAAC,SAAS,yBAAyB,GAAG,qBAAqB,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA2B5J,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,mBAAmB,EAAE,MAAM,GAAG,2BAA2B,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;IAmC5K,0BAA0B,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;YAgBpD,cAAc;IAoB5B,OAAO,CAAC,2BAA2B;IAuBnC,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,uBAAuB;IA2B/B,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,iBAAiB;CAQ5B"}
@@ -0,0 +1,216 @@
1
+ import { CreateTemplatedImageRequest } from "./types/request.js";
2
+ import * as crypto from 'node:crypto';
3
+ export class HtmlCssToImageClient {
4
+ apiId;
5
+ apiKey;
6
+ baseUrl = 'https://hcti.io';
7
+ authHeader;
8
+ fetch;
9
+ constructor(apiId, apiKey, customFetch) {
10
+ const fetchImpl = customFetch || (typeof fetch !== 'undefined' ? fetch : undefined);
11
+ if (!fetchImpl) {
12
+ throw new Error("The 'fetch' API is not available in this environment. " +
13
+ "Please provide a fetch implementation (like node-fetch or undici) in the constructor.");
14
+ }
15
+ this.fetch = fetchImpl;
16
+ this.apiId = apiId;
17
+ this.apiKey = apiKey;
18
+ const auth = Buffer.from(`${this.apiId}:${this.apiKey}`).toString('base64');
19
+ this.authHeader = `Basic ${auth}`;
20
+ }
21
+ static fromEnv() {
22
+ const id = process.env.HCTI_API_ID;
23
+ const key = process.env.HCTI_API_KEY;
24
+ if (!id || !key) {
25
+ throw new Error("Missing environment variables HCTI_API_ID or HCTI_API_KEY");
26
+ }
27
+ return new HtmlCssToImageClient(id, key);
28
+ }
29
+ async createImage(request) {
30
+ const internal_request = this.mapToInternal(request, false);
31
+ const response = await this.fetch(`${this.baseUrl}/v1/image`, {
32
+ method: 'POST',
33
+ headers: {
34
+ 'Authorization': this.authHeader,
35
+ 'Content-Type': 'application/json',
36
+ },
37
+ body: JSON.stringify(internal_request),
38
+ });
39
+ return await this.responseToType(response);
40
+ }
41
+ mapToInternal(request, in_batch) {
42
+ switch (request.__type) {
43
+ case 'html_css':
44
+ return this.mapHtmlCssToInternalRequest(request, in_batch);
45
+ case 'url':
46
+ return this.mapUrlToInternalRequest(request, in_batch);
47
+ case 'templated':
48
+ return request;
49
+ default:
50
+ throw new Error("Unsupported request type");
51
+ }
52
+ }
53
+ async createImageBatch(variations, default_options) {
54
+ if (variations.length === 0) {
55
+ return Promise.resolve({ images: [] });
56
+ }
57
+ const internal_variations = variations.map(variation => this.mapToInternal(variation, true));
58
+ let internal_default_option = default_options ? this.mapToInternal(default_options, true) : undefined;
59
+ const batch_request = {
60
+ variations: internal_variations,
61
+ default_options: internal_default_option
62
+ };
63
+ const response = await this.fetch(`${this.baseUrl}/v1/image/batch`, {
64
+ method: 'POST',
65
+ headers: {
66
+ 'Authorization': this.authHeader,
67
+ 'Content-Type': 'application/json',
68
+ },
69
+ body: JSON.stringify(batch_request),
70
+ });
71
+ return await this.responseToType(response);
72
+ }
73
+ generateTemplatedImageUrl(templateIdOrRequest, templateValues, templateVersion) {
74
+ let request;
75
+ if (typeof templateIdOrRequest === 'string') {
76
+ request = new CreateTemplatedImageRequest({
77
+ template_id: templateIdOrRequest,
78
+ template_values: templateValues || {},
79
+ template_version: templateVersion
80
+ });
81
+ }
82
+ else {
83
+ request = templateIdOrRequest;
84
+ }
85
+ const params = new URLSearchParams();
86
+ if (request.template_version) {
87
+ params.append('template_version', request.template_version.toString());
88
+ }
89
+ const sortedKeys = Object.keys(request.template_values).sort();
90
+ for (const key of sortedKeys) {
91
+ const value = request.template_values[key];
92
+ if (value !== null && value !== undefined) {
93
+ if (typeof value === 'object') {
94
+ // Serialize objects and arrays to JSON
95
+ params.append(key, JSON.stringify(value));
96
+ }
97
+ else {
98
+ // Primitive values (string, number, boolean) are appended directly
99
+ params.append(key, value.toString());
100
+ }
101
+ }
102
+ }
103
+ const queryString = params.toString();
104
+ const token = this.generateHmacToken(queryString);
105
+ return `${this.baseUrl}/v1/image/${request.template_id}/${token}${queryString ? '?' : ''}${queryString}`;
106
+ }
107
+ generateCreateAndRenderUrl(request) {
108
+ const params = new URLSearchParams();
109
+ params.append('url', request.url);
110
+ Object.entries(request)
111
+ .filter(([key, _]) => key !== 'url' && key != 'pdf_options' && key !== '__type')
112
+ .sort((a, b) => a[0].localeCompare(b[0]))
113
+ .forEach(([key, value]) => {
114
+ if (value !== undefined && value !== null && value !== false) {
115
+ params.append(key, value.toString());
116
+ }
117
+ });
118
+ const queryString = params.toString();
119
+ const token = this.generateHmacToken(queryString);
120
+ return `${this.baseUrl}/v1/image/create-and-render/${this.apiId}/${token}?${queryString}`;
121
+ }
122
+ async responseToType(response) {
123
+ let response_json;
124
+ try {
125
+ response_json = await response.json();
126
+ }
127
+ catch (e) {
128
+ // Fallback for cases where the body is not JSON (e.g. 500 edge error)
129
+ response_json = {
130
+ error: 'Internal Server Error',
131
+ message: `The server returned an unexpected response (Status: ${response.status}).`
132
+ };
133
+ }
134
+ if (response.ok) {
135
+ return { success: true, ...response_json };
136
+ }
137
+ else {
138
+ return { success: false, ...response_json };
139
+ }
140
+ }
141
+ mapHtmlCssToInternalRequest(request, in_batch) {
142
+ const { pdf_options, google_fonts, __type, ...shared_request } = request;
143
+ let new_request;
144
+ if (in_batch) {
145
+ new_request = { ...shared_request };
146
+ if (new_request.html === '') {
147
+ new_request.html = undefined;
148
+ }
149
+ }
150
+ else {
151
+ new_request = { ...shared_request };
152
+ }
153
+ new_request.pdf_options = this.mapPDFOptionsToInternal(pdf_options);
154
+ if (google_fonts && google_fonts.length > 0) {
155
+ const processed_fonts = google_fonts
156
+ .map(font => font.trim().replace(/ /g, '+'))
157
+ .filter(font => font.length > 0);
158
+ const unique_fonts = [...new Set(processed_fonts)];
159
+ new_request.google_fonts = unique_fonts.join('|');
160
+ }
161
+ return new_request;
162
+ }
163
+ mapUrlToInternalRequest(request, in_batch) {
164
+ const { pdf_options, __type, ...shared_request } = request;
165
+ let new_request;
166
+ if (in_batch) {
167
+ new_request = { ...shared_request };
168
+ if (new_request.url === '') {
169
+ new_request.url = undefined;
170
+ }
171
+ }
172
+ else {
173
+ new_request = { ...shared_request };
174
+ }
175
+ new_request.pdf_options = this.mapPDFOptionsToInternal(pdf_options);
176
+ return new_request;
177
+ }
178
+ mapPDFOptionsToInternal(pdf_options) {
179
+ if (pdf_options) {
180
+ const { margins, page_height, page_width, ...shared_pdf_options } = pdf_options;
181
+ const new_pdf_options = {
182
+ ...shared_pdf_options
183
+ };
184
+ if (margins) {
185
+ new_pdf_options.margins = [
186
+ this.pdfValueWithUnitsToString(margins.top),
187
+ this.pdfValueWithUnitsToString(margins.right),
188
+ this.pdfValueWithUnitsToString(margins.bottom),
189
+ this.pdfValueWithUnitsToString(margins.left)
190
+ ];
191
+ }
192
+ if (page_height) {
193
+ new_pdf_options.page_height = this.pdfValueWithUnitsToString(page_height);
194
+ }
195
+ if (page_width) {
196
+ new_pdf_options.page_width = this.pdfValueWithUnitsToString(page_width);
197
+ }
198
+ return new_pdf_options;
199
+ }
200
+ }
201
+ pdfValueWithUnitsToString(item) {
202
+ if (typeof item === "number") {
203
+ return `${item}px`;
204
+ }
205
+ else {
206
+ return `${item.value}${item.unit}`;
207
+ }
208
+ }
209
+ generateHmacToken(queryString) {
210
+ return crypto
211
+ .createHmac('sha256', this.apiKey)
212
+ .update(queryString)
213
+ .digest('hex');
214
+ }
215
+ }
216
+ //# sourceMappingURL=HtmlCssToImageClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HtmlCssToImageClient.js","sourceRoot":"","sources":["../src/HtmlCssToImageClient.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,2BAA2B,EAAmD,MAAM,oBAAoB,CAAC;AAG5I,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAItC,MAAM,OAAO,oBAAoB;IAEZ,KAAK,CAAS;IACd,MAAM,CAAS;IACf,OAAO,GA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AAC,GAAG,WAAW,CAAC;YAC9E,MAAM,eAAe,GAAuB;gBACxC,GAAG,kBAAkB;aACxB,CAAC;YAEF,IAAI,OAAO,EAAE,CAAC;gBAEV,eAAe,CAAC,OAAO,GAAG;oBACtB,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC;oBAC3C,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,KAAK,CAAC;oBAC7C,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,MAAM,CAAC;oBAC9C,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,IAAI,CAAC;iBAC/C,CAAA;YACL,CAAC;YACD,IAAI,WAAW,EAAE,CAAC;gBACd,eAAe,CAAC,WAAW,GAAG,IAAI,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;YAC9E,CAAC;YACD,IAAI,UAAU,EAAE,CAAC;gBACb,eAAe,CAAC,UAAU,GAAG,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;YAC5E,CAAC;YACD,OAAO,eAAe,CAAC;QAC3B,CAAC;IACL,CAAC;IAGO,yBAAyB,CAAC,IAAmB;QACjD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,OAAO,GAAG,IAAI,IAAI,CAAC;QACvB,CAAC;aAAM,CAAC;YACJ,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACvC,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,WAAmB;QACzC,OAAO,MAAM;aACR,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;aACjC,MAAM,CAAC,WAAW,CAAC;aACnB,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CAGJ"}
@@ -0,0 +1,10 @@
1
+ import { CreateHtmlCssImageRequest, CreateTemplatedImageRequest, CreateUrlImageRequest } from "./types/request.js";
2
+ import { CreateImageBatchResponse, CreateImageResponse } from "./types/response.js";
3
+ export interface IHtmlCssToImageClient {
4
+ createImage(request: CreateHtmlCssImageRequest | CreateUrlImageRequest | CreateTemplatedImageRequest): Promise<CreateImageResponse>;
5
+ createImageBatch<T extends CreateHtmlCssImageRequest | CreateUrlImageRequest>(variations: T[], default_options?: T): Promise<CreateImageBatchResponse>;
6
+ generateCreateAndRenderUrl(request: CreateUrlImageRequest): string;
7
+ generateTemplatedImageUrl<T extends Record<string, any>>(template_id: string, template_values: T, template_version?: number): string;
8
+ generateTemplatedImageUrl(request: CreateTemplatedImageRequest): string;
9
+ }
10
+ //# sourceMappingURL=IHtmlCssToImageClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHtmlCssToImageClient.d.ts","sourceRoot":"","sources":["../src/IHtmlCssToImageClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAE,2BAA2B,EAAE,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAC,wBAAwB,EAA4B,mBAAmB,EAA6B,MAAM,qBAAqB,CAAC;AAExI,MAAM,WAAW,qBAAqB;IAClC,WAAW,CAAC,OAAO,EAAE,yBAAyB,GAAC,qBAAqB,GAAC,2BAA2B,GAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACjI,gBAAgB,CAAC,CAAC,SAAS,yBAAyB,GAAC,qBAAqB,EAAE,UAAU,EAAE,CAAC,EAAE,EAAC,eAAe,CAAC,EAAC,CAAC,GAAI,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACpJ,0BAA0B,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAAC;IACnE,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAE,MAAM,CAAC;IACnI,yBAAyB,CAAC,OAAO,EAAE,2BAA2B,GAAE,MAAM,CAAC;CAC1E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IHtmlCssToImageClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHtmlCssToImageClient.js","sourceRoot":"","sources":["../src/IHtmlCssToImageClient.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export { BaseCreateImageRequest, CreateHtmlCssImageRequest, CreateUrlImageRequest, PDFOptions, PdfMargins, PdfValueWithUnits, PdfUnit } from './types/request.js';
2
+ export { CreateImageResponse, CreateImageBatchResponse } from './types/response.js';
3
+ export { HtmlCssToImageClient } from './HtmlCssToImageClient.js';
4
+ export { IHtmlCssToImageClient } from './IHtmlCssToImageClient.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,OAAO,EACV,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACH,mBAAmB,EACnB,wBAAwB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { BaseCreateImageRequest, CreateHtmlCssImageRequest, CreateUrlImageRequest, PDFOptions } from './types/request.js';
2
+ export { HtmlCssToImageClient } from './HtmlCssToImageClient.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,UAAU,EAIb,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { ColorSchemeType } from "./request.js";
2
+ export declare abstract class BaseCreateRequestWithoutVariableOptions {
3
+ /**
4
+ * A CSS selector to target a specific element on the page.
5
+ * The API will crop the image to the dimensions of this element.
6
+ */
7
+ selector?: string;
8
+ /**
9
+ * Adjusts the pixel ratio for the screenshot.
10
+ * The default is 2 which is equivalent to a 4K monitor.
11
+ */
12
+ device_scale?: number;
13
+ /**
14
+ * Set the height of Chrome's viewport. This will disable automatic cropping.
15
+ */
16
+ viewport_height?: number;
17
+ /**
18
+ * Set the width of Chrome's viewport. This will disable automatic cropping.
19
+ */
20
+ viewport_width?: number;
21
+ /**
22
+ * Sets a limit on time to wait until the screenshot is taken.
23
+ * Use this if your page loads a lot of extra irrelevant content.
24
+ */
25
+ max_wait_ms?: number;
26
+ /**
27
+ * Adds extra time before taking the screenshot,
28
+ * like if you need to wait for Javascript to execute.
29
+ */
30
+ ms_delay?: number;
31
+ /**
32
+ * This will wait until 'ScreenshotReady()' is called from Javascript to take the screenshot.
33
+ */
34
+ render_when_ready?: boolean;
35
+ /**
36
+ * Ensure the image is only ever rendered and saved one time.
37
+ * This is an advanced option not applicable to most scenarios.
38
+ */
39
+ max_render_once?: boolean;
40
+ /**
41
+ * Twemoji is used to render emoji as a fallback for native emoji fonts.
42
+ * This option will disable that behavior.
43
+ */
44
+ disable_twemoji?: boolean;
45
+ /**
46
+ * Set Chrome to render assuming the user has explicitly set their browser to Light or Dark mode.
47
+ */
48
+ color_scheme?: ColorSchemeType;
49
+ /**
50
+ * Sets the timezone for the browser instance. Use IANA timezone format (e.g. 'America/New_York').
51
+ */
52
+ timezone?: string;
53
+ constructor(init?: Partial<BaseCreateRequestWithoutVariableOptions>);
54
+ }
55
+ export declare abstract class BasePDFOptions {
56
+ /**
57
+ * Whether the background graphics should be printed in the PDF output.
58
+ */
59
+ print_background?: boolean;
60
+ /**
61
+ * The scale factor to be applied when generating the PDF output (e.g., 1.0).
62
+ */
63
+ scale?: number;
64
+ constructor(init?: Partial<BasePDFOptions>);
65
+ }
66
+ /**
67
+ * Internal interface representing how PDFOptions looks over the wire.
68
+ * All units are flattened to strings (e.g., "10in").
69
+ * @internal
70
+ */
71
+ export interface InternalPDFOptions extends BasePDFOptions {
72
+ margins?: string[];
73
+ page_height?: string;
74
+ page_width?: string;
75
+ }
76
+ export interface InternalBaseCreateRequest extends BaseCreateRequestWithoutVariableOptions {
77
+ pdf_options?: InternalPDFOptions;
78
+ }
79
+ export interface InternalCreateHtmlCssImageRequest extends InternalBaseCreateRequest {
80
+ html: string;
81
+ css?: string;
82
+ google_fonts?: string;
83
+ }
84
+ export interface InternalCreateHtmlCssImageRequestWithOptionalHtml extends InternalBaseCreateRequest {
85
+ html?: string;
86
+ css?: string;
87
+ google_fonts?: string;
88
+ }
89
+ export interface InternalCreateUrlImageRequest extends InternalBaseCreateRequest {
90
+ url: string;
91
+ full_screen?: boolean;
92
+ block_consent_banners?: boolean;
93
+ }
94
+ export interface InternalCreateUrlImageRequestWithOptionalUrl extends InternalBaseCreateRequest {
95
+ url?: string;
96
+ full_screen?: boolean;
97
+ block_consent_banners?: boolean;
98
+ }
99
+ //# sourceMappingURL=internals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../../src/types/internals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7C,8BAAsB,uCAAuC;IACzD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAE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F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACnC"}
@@ -0,0 +1,69 @@
1
+ export class BaseCreateRequestWithoutVariableOptions {
2
+ /**
3
+ * A CSS selector to target a specific element on the page.
4
+ * The API will crop the image to the dimensions of this element.
5
+ */
6
+ selector;
7
+ /**
8
+ * Adjusts the pixel ratio for the screenshot.
9
+ * The default is 2 which is equivalent to a 4K monitor.
10
+ */
11
+ device_scale;
12
+ /**
13
+ * Set the height of Chrome's viewport. This will disable automatic cropping.
14
+ */
15
+ viewport_height;
16
+ /**
17
+ * Set the width of Chrome's viewport. This will disable automatic cropping.
18
+ */
19
+ viewport_width;
20
+ /**
21
+ * Sets a limit on time to wait until the screenshot is taken.
22
+ * Use this if your page loads a lot of extra irrelevant content.
23
+ */
24
+ max_wait_ms;
25
+ /**
26
+ * Adds extra time before taking the screenshot,
27
+ * like if you need to wait for Javascript to execute.
28
+ */
29
+ ms_delay;
30
+ /**
31
+ * This will wait until 'ScreenshotReady()' is called from Javascript to take the screenshot.
32
+ */
33
+ render_when_ready;
34
+ /**
35
+ * Ensure the image is only ever rendered and saved one time.
36
+ * This is an advanced option not applicable to most scenarios.
37
+ */
38
+ max_render_once;
39
+ /**
40
+ * Twemoji is used to render emoji as a fallback for native emoji fonts.
41
+ * This option will disable that behavior.
42
+ */
43
+ disable_twemoji;
44
+ /**
45
+ * Set Chrome to render assuming the user has explicitly set their browser to Light or Dark mode.
46
+ */
47
+ color_scheme;
48
+ /**
49
+ * Sets the timezone for the browser instance. Use IANA timezone format (e.g. 'America/New_York').
50
+ */
51
+ timezone;
52
+ constructor(init) {
53
+ Object.assign(this, init);
54
+ }
55
+ }
56
+ export class BasePDFOptions {
57
+ /**
58
+ * Whether the background graphics should be printed in the PDF output.
59
+ */
60
+ print_background;
61
+ /**
62
+ * The scale factor to be applied when generating the PDF output (e.g., 1.0).
63
+ */
64
+ scale;
65
+ constructor(init) {
66
+ Object.assign(this, init);
67
+ }
68
+ }
69
+ //# sourceMappingURL=internals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals.js","sourceRoot":"","sources":["../../src/types/internals.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,uCAAuC;IACzD;;;OAGG;IACH,QAAQ,CAAU;IAElB;;;OAGG;IACH,YAAY,CAAU;IAEtB;;OAEG;IACH,eAAe,CAAU;IAEzB;;OAEG;IACH,cAAc,CAAU;IAExB;;;OAGG;IACH,WAAW,CAAU;IAErB;;;OAGG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,iBAAiB,CAAW;IAE5B;;;OAGG;IACH,eAAe,CAAW;IAE1B;;;OAGG;IACH,eAAe,CAAW;IAC1B;;OAEG;IACH,YAAY,CAAmB;IAE/B;;OAEG;IACH,QAAQ,CAAU;IAElB,YAAY,IAAuD;QAC/D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAED,MAAM,OAAgB,cAAc;IAChC;;OAEG;IACH,gBAAgB,CAAW;IAC3B;;OAEG;IACH,KAAK,CAAU;IAEf,YAAY,IAA8B;QACtC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ"}
@@ -0,0 +1,105 @@
1
+ import { BaseCreateRequestWithoutVariableOptions, BasePDFOptions } from "./internals.js";
2
+ export type ColorSchemeType = 'light' | 'dark';
3
+ export type PdfUnit = 'px' | 'in' | 'cm' | 'mm';
4
+ export interface PdfValueWithUnits {
5
+ value: number;
6
+ unit: PdfUnit;
7
+ }
8
+ export type PdfValueInput = number | PdfValueWithUnits;
9
+ /**
10
+ * Represents the margins of a PDF document.
11
+ *
12
+ * This interface defines the margin values for a PDF, allowing
13
+ * customization of the top, right, bottom, and left spacing in the document.
14
+ * Each margin value is expected to be provided using the `PdfValueInput` type.
15
+ */
16
+ export interface PdfMargins {
17
+ top: PdfValueInput;
18
+ right: PdfValueInput;
19
+ bottom: PdfValueInput;
20
+ left: PdfValueInput;
21
+ }
22
+ export declare class PDFOptions extends BasePDFOptions {
23
+ /**
24
+ * Gets or sets the margins to be applied to the PDF output.
25
+ * Specifies the top, right, bottom, and left margins.
26
+ */
27
+ margins?: PdfMargins;
28
+ /**
29
+ * The height of the PDF page (e.g., 8.5, '11in', '297mm').
30
+ */
31
+ page_height?: PdfValueInput;
32
+ /**
33
+ * The width of the PDF page (e.g., 11, '8.5in', '210mm').
34
+ */
35
+ page_width?: PdfValueInput;
36
+ constructor(init?: Partial<PDFOptions>);
37
+ }
38
+ export declare abstract class BaseCreateImageRequest extends BaseCreateRequestWithoutVariableOptions {
39
+ /**
40
+ * Options for generating a PDF from the HTML/CSS or Url.
41
+ */
42
+ pdf_options?: PDFOptions;
43
+ protected constructor(init?: Partial<BaseCreateImageRequest>);
44
+ }
45
+ export declare class CreateHtmlCssImageRequest extends BaseCreateImageRequest {
46
+ readonly __type: "html_css";
47
+ /**
48
+ * Represents an HTML string value that should contain raw HTML content.
49
+ */
50
+ html: string;
51
+ /**
52
+ * A variable representing optional CSS styles.
53
+ * This can be used to define custom styling rules that are applied to a component or element.
54
+ * The value should be a valid CSS string or undefined.
55
+ */
56
+ css?: string;
57
+ /**
58
+ * An optional array of strings representing the names of Google Fonts to be used in the application.
59
+ *
60
+ * This variable allows specifying one or more Google Fonts that can be dynamically loaded for styling purposes.
61
+ * Each entry in the array should be the name of a valid font available from Google Fonts.
62
+ *
63
+ * If undefined or empty, no Google Fonts will be loaded.
64
+ */
65
+ google_fonts?: string[];
66
+ constructor(init?: Partial<CreateHtmlCssImageRequest>);
67
+ }
68
+ export declare class CreateUrlImageRequest extends BaseCreateImageRequest {
69
+ readonly __type: "url";
70
+ /**
71
+ * Represents a web address or resource location.
72
+ * This variable is expected to contain a valid URL string.
73
+ */
74
+ url: string;
75
+ /**
76
+ * Indicates whether the screenshot should capture the entire webpage in full height.
77
+ *
78
+ * When set to true, this property ensures that the screenshot includes the full vertical content of the webpage,
79
+ * scrolling beyond the visible portion of the viewport if necessary. If set to false or null, only the visible
80
+ * portion of the webpage within the configured viewport dimensions will be captured.
81
+ */
82
+ full_screen?: boolean;
83
+ /**
84
+ * Attempt to block cookie/consent banners from displaying.
85
+ */
86
+ block_consent_banners?: boolean;
87
+ constructor(init?: Partial<CreateUrlImageRequest>);
88
+ }
89
+ export declare class CreateTemplatedImageRequest<T = Record<string, any>> {
90
+ readonly __type: "templated";
91
+ /**
92
+ * Identifies the specific template to be used.
93
+ */
94
+ template_id: string;
95
+ /**
96
+ * The optional version of the template to be used. If not provided, the most recent version is used.
97
+ */
98
+ template_version?: number;
99
+ /**
100
+ * Dynamic data to be injected into the template.
101
+ */
102
+ template_values: T;
103
+ constructor(init?: Partial<CreateTemplatedImageRequest<T>>);
104
+ }
105
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/types/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uCAAuC,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAEvF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAC/C,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,iBAAiB,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,aAAa,CAAC;CACvB;AAED,qBAAa,UAAW,SAAQ,cAAc;IAC1C;;;OAGG;IACH,OAAO,CAAC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;CAG7D"}
@@ -0,0 +1,99 @@
1
+ import { BaseCreateRequestWithoutVariableOptions, BasePDFOptions } from "./internals.js";
2
+ export class PDFOptions extends BasePDFOptions {
3
+ /**
4
+ * Gets or sets the margins to be applied to the PDF output.
5
+ * Specifies the top, right, bottom, and left margins.
6
+ */
7
+ margins;
8
+ /**
9
+ * The height of the PDF page (e.g., 8.5, '11in', '297mm').
10
+ */
11
+ page_height;
12
+ /**
13
+ * The width of the PDF page (e.g., 11, '8.5in', '210mm').
14
+ */
15
+ page_width;
16
+ constructor(init) {
17
+ super();
18
+ Object.assign(this, init);
19
+ }
20
+ }
21
+ export class BaseCreateImageRequest extends BaseCreateRequestWithoutVariableOptions {
22
+ /**
23
+ * Options for generating a PDF from the HTML/CSS or Url.
24
+ */
25
+ pdf_options;
26
+ constructor(init) {
27
+ super();
28
+ Object.assign(this, init);
29
+ }
30
+ }
31
+ export class CreateHtmlCssImageRequest extends BaseCreateImageRequest {
32
+ __type = 'html_css';
33
+ /**
34
+ * Represents an HTML string value that should contain raw HTML content.
35
+ */
36
+ html;
37
+ /**
38
+ * A variable representing optional CSS styles.
39
+ * This can be used to define custom styling rules that are applied to a component or element.
40
+ * The value should be a valid CSS string or undefined.
41
+ */
42
+ css;
43
+ /**
44
+ * An optional array of strings representing the names of Google Fonts to be used in the application.
45
+ *
46
+ * This variable allows specifying one or more Google Fonts that can be dynamically loaded for styling purposes.
47
+ * Each entry in the array should be the name of a valid font available from Google Fonts.
48
+ *
49
+ * If undefined or empty, no Google Fonts will be loaded.
50
+ */
51
+ google_fonts;
52
+ constructor(init) {
53
+ super();
54
+ Object.assign(this, init);
55
+ }
56
+ }
57
+ export class CreateUrlImageRequest extends BaseCreateImageRequest {
58
+ __type = 'url';
59
+ /**
60
+ * Represents a web address or resource location.
61
+ * This variable is expected to contain a valid URL string.
62
+ */
63
+ url;
64
+ /**
65
+ * Indicates whether the screenshot should capture the entire webpage in full height.
66
+ *
67
+ * When set to true, this property ensures that the screenshot includes the full vertical content of the webpage,
68
+ * scrolling beyond the visible portion of the viewport if necessary. If set to false or null, only the visible
69
+ * portion of the webpage within the configured viewport dimensions will be captured.
70
+ */
71
+ full_screen;
72
+ /**
73
+ * Attempt to block cookie/consent banners from displaying.
74
+ */
75
+ block_consent_banners;
76
+ constructor(init) {
77
+ super();
78
+ Object.assign(this, init);
79
+ }
80
+ }
81
+ export class CreateTemplatedImageRequest {
82
+ __type = 'templated';
83
+ /**
84
+ * Identifies the specific template to be used.
85
+ */
86
+ template_id;
87
+ /**
88
+ * The optional version of the template to be used. If not provided, the most recent version is used.
89
+ */
90
+ template_version;
91
+ /**
92
+ * Dynamic data to be injected into the template.
93
+ */
94
+ template_values;
95
+ constructor(init) {
96
+ Object.assign(this, init);
97
+ }
98
+ }
99
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/types/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uCAAuC,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AA2BvF,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC1C;;;OAGG;IACH,OAAO,CAAc;IAErB;;OAEG;IACH,WAAW,CAAiB;IAE5B;;OAEG;IACH,UAAU,CAAiB;IAE3B,YAAY,IAA0B;QAClC,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CAGJ;AAGD,MAAM,OAAgB,sBAAuB,SAAQ,uCAAuC;IACxF;;OAEG;IACH,WAAW,CAAc;IAEzB,YAAsB,IAAsC;QACxD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAGD,MAAM,OAAO,yBAA0B,SAAQ,sBAAsB;IACxD,MAAM,GAAG,UAAmB,CAAC;IACtC;;OAEG;IACH,IAAI,CAAU;IACd;;;;OAIG;IACH,GAAG,CAAU;IACb;;;;;;;OAOG;IACH,YAAY,CAAY;IAExB,YAAY,IAAyC;QACjD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAED,MAAM,OAAO,qBAAsB,SAAQ,sBAAsB;IACpD,MAAM,GAAG,KAAc,CAAC;IACjC;;;OAGG;IACH,GAAG,CAAU;IACb;;;;;;OAMG;IACH,WAAW,CAAW;IAEtB;;OAEG;IACH,qBAAqB,CAAW;IAEhC,YAAY,IAAqC;QAC7C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAED,MAAM,OAAO,2BAA2B;IAC3B,MAAM,GAAG,WAAoB,CAAC;IACvC;;OAEG;IACH,WAAW,CAAU;IAErB;;OAEG;IACH,gBAAgB,CAAU;IAE1B;;OAEG;IACH,eAAe,CAAK;IAEpB,YAAY,IAA8C;QACtD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ"}
@@ -0,0 +1,22 @@
1
+ export interface CreateImageSuccessResponse {
2
+ success: true;
3
+ id: string;
4
+ url: string;
5
+ }
6
+ export interface ValidationError {
7
+ path: string;
8
+ message: string;
9
+ }
10
+ export interface CreateImageErrorResponse {
11
+ success: false;
12
+ error: string;
13
+ validation_errors?: ValidationError[];
14
+ message?: string;
15
+ }
16
+ export interface CreateImageBatchSuccessResponse {
17
+ success: true;
18
+ images: CreateImageSuccessResponse[];
19
+ }
20
+ export type CreateImageBatchResponse = CreateImageBatchSuccessResponse | CreateImageErrorResponse;
21
+ export type CreateImageResponse = CreateImageSuccessResponse | CreateImageErrorResponse;
22
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/types/response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACvC,OAAO,EAAE,IAAI,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACrC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC5C,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACxC;AAED,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,GAAG,wBAAwB,CAAC;AAElG,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/types/response.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@html-css-to-image/client",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "Lightweight TypeScript client for the HTML/CSS to Image API. Generate images from HTML/CSS, URLs, or templates in your TypeScript or JavaScript projects.",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.ts",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/htmlcsstoimage/ts-client"
12
+ },
13
+ "homepage": "https://htmlcsstoimage.com",
14
+ "author": "HTML/CSS to Image API <support@htmlcsstoimage.com>",
15
+ "prettier": true,
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "test": "tsx --test tests/**/*.test.ts",
21
+ "build": "tsc",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "keywords": [
25
+ "html-to-image",
26
+ "screenshot",
27
+ "hcti",
28
+ "htmlcsstoimage"
29
+ ],
30
+ "license": "MIT",
31
+ "engines": {
32
+ "node": ">=18.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^25.0.3",
36
+ "tsx": "^4.21.0",
37
+ "typescript": "^5.0.0"
38
+ }
39
+ }