@hostwebhook/node 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -154,11 +154,18 @@ declare const FileEventType: {
154
154
  /** Union of all supported file event types. */
155
155
  type FileEventType = typeof FileEventType[keyof typeof FileEventType];
156
156
  /**
157
- * Payload for `sendWithFiles`. Enforces a valid `eventType` from `FileEventType`.
157
+ * Payload for `sendWithFiles`. The `FileEventType` constants (PDF_UPLOAD,
158
+ * CSV_UPLOAD, IMAGE_RESIZE, IMAGE_COMPRESS) are the canonical event types
159
+ * for built-in File Transform operations, but the ingress accepts any
160
+ * string so custom forms / pipelines with their own routing rules can
161
+ * upload files without squeezing into the enum. Use the constants when
162
+ * targeting a built-in File Transform node; use your own string for
163
+ * anything else (e.g. `'form_submission'`, `'contact_attachment'`).
158
164
  */
159
165
  interface FilePayload extends Record<string, unknown> {
160
- /** The file processing operation to perform. Must be a supported `FileEventType`. */
161
- eventType: FileEventType;
166
+ /** Event type for pipeline routing. Use `FileEventType.*` constants for
167
+ * built-in transforms, or any string for a custom event. */
168
+ eventType: FileEventType | string;
162
169
  /** Original file name (for logging and downstream nodes). */
163
170
  fileName?: string;
164
171
  /** File size in bytes (for logging). */
package/dist/index.d.ts CHANGED
@@ -154,11 +154,18 @@ declare const FileEventType: {
154
154
  /** Union of all supported file event types. */
155
155
  type FileEventType = typeof FileEventType[keyof typeof FileEventType];
156
156
  /**
157
- * Payload for `sendWithFiles`. Enforces a valid `eventType` from `FileEventType`.
157
+ * Payload for `sendWithFiles`. The `FileEventType` constants (PDF_UPLOAD,
158
+ * CSV_UPLOAD, IMAGE_RESIZE, IMAGE_COMPRESS) are the canonical event types
159
+ * for built-in File Transform operations, but the ingress accepts any
160
+ * string so custom forms / pipelines with their own routing rules can
161
+ * upload files without squeezing into the enum. Use the constants when
162
+ * targeting a built-in File Transform node; use your own string for
163
+ * anything else (e.g. `'form_submission'`, `'contact_attachment'`).
158
164
  */
159
165
  interface FilePayload extends Record<string, unknown> {
160
- /** The file processing operation to perform. Must be a supported `FileEventType`. */
161
- eventType: FileEventType;
166
+ /** Event type for pipeline routing. Use `FileEventType.*` constants for
167
+ * built-in transforms, or any string for a custom event. */
168
+ eventType: FileEventType | string;
162
169
  /** Original file name (for logging and downstream nodes). */
163
170
  fileName?: string;
164
171
  /** File size in bytes (for logging). */
package/dist/index.js CHANGED
@@ -339,7 +339,14 @@ var HostWebhook = class {
339
339
  if (!confirmRes.ok) throw new SendError(`Failed to confirm upload for ${fieldName}`, confirmRes.status, await confirmRes.text());
340
340
  const confirmed = await confirmRes.json();
341
341
  enrichedPayload[fieldName] = {
342
- _file: { id: confirmed.id, key, originalName: confirmed.originalName, mimeType: confirmed.mimeType, size: confirmed.size }
342
+ _file: {
343
+ id: confirmed.id,
344
+ key,
345
+ originalName: confirmed.originalName,
346
+ mimeType: confirmed.mimeType,
347
+ size: confirmed.size,
348
+ ...confirmed.downloadUrl && { downloadUrl: confirmed.downloadUrl }
349
+ }
343
350
  };
344
351
  }
345
352
  return __privateMethod(this, _HostWebhook_instances, doSend_fn).call(this, token, enrichedPayload, options);
@@ -403,7 +410,7 @@ doSend_fn = async function(token, payload, options) {
403
410
  }
404
411
  const headers = {
405
412
  "Content-Type": options?.contentType ?? "application/json",
406
- "User-Agent": `HostWebhook-SDK/${"1.4.2"}`,
413
+ "User-Agent": `HostWebhook-SDK/${"1.5.1"}`,
407
414
  "X-HostWebhook-Sent-At": (/* @__PURE__ */ new Date()).toISOString(),
408
415
  ...tz ? { "X-HostWebhook-Timezone": tz } : {},
409
416
  ...__privateGet(this, _defaultHeaders),
package/dist/index.mjs CHANGED
@@ -305,7 +305,14 @@ var HostWebhook = class {
305
305
  if (!confirmRes.ok) throw new SendError(`Failed to confirm upload for ${fieldName}`, confirmRes.status, await confirmRes.text());
306
306
  const confirmed = await confirmRes.json();
307
307
  enrichedPayload[fieldName] = {
308
- _file: { id: confirmed.id, key, originalName: confirmed.originalName, mimeType: confirmed.mimeType, size: confirmed.size }
308
+ _file: {
309
+ id: confirmed.id,
310
+ key,
311
+ originalName: confirmed.originalName,
312
+ mimeType: confirmed.mimeType,
313
+ size: confirmed.size,
314
+ ...confirmed.downloadUrl && { downloadUrl: confirmed.downloadUrl }
315
+ }
309
316
  };
310
317
  }
311
318
  return __privateMethod(this, _HostWebhook_instances, doSend_fn).call(this, token, enrichedPayload, options);
@@ -369,7 +376,7 @@ doSend_fn = async function(token, payload, options) {
369
376
  }
370
377
  const headers = {
371
378
  "Content-Type": options?.contentType ?? "application/json",
372
- "User-Agent": `HostWebhook-SDK/${"1.4.2"}`,
379
+ "User-Agent": `HostWebhook-SDK/${"1.5.1"}`,
373
380
  "X-HostWebhook-Sent-At": (/* @__PURE__ */ new Date()).toISOString(),
374
381
  ...tz ? { "X-HostWebhook-Timezone": tz } : {},
375
382
  ...__privateGet(this, _defaultHeaders),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostwebhook/node",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Official HostWebhook SDK — verify signatures, parse headers, and send webhooks",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",