@cristian-israel/giganet_lib_conecta 1.0.65 → 1.0.67

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
@@ -37091,9 +37091,9 @@ interface NtfyAction {
37091
37091
  clear?: boolean;
37092
37092
  }
37093
37093
  interface NtfyPublishOptions {
37094
- sequence_id: string;
37095
37094
  message: string;
37096
37095
  title?: string;
37096
+ sequence_id?: string;
37097
37097
  priority?: NtfyPriority;
37098
37098
  tags?: string[];
37099
37099
  click?: string;
@@ -37125,7 +37125,7 @@ declare class NtfyPublishResource {
37125
37125
  * Envia uma notificação para um tópico do ntfy.
37126
37126
  * @param options Opções da notificação
37127
37127
  */
37128
- publish(options: NtfyPublishOptions): Promise<NtfyPublishResponse>;
37128
+ publish(options: NtfyPublishOptions): Promise<NtfyPublishResponse | null>;
37129
37129
  }
37130
37130
 
37131
37131
  declare class NtfyAPIClient extends APIClient {
package/dist/index.d.ts CHANGED
@@ -37091,9 +37091,9 @@ interface NtfyAction {
37091
37091
  clear?: boolean;
37092
37092
  }
37093
37093
  interface NtfyPublishOptions {
37094
- sequence_id: string;
37095
37094
  message: string;
37096
37095
  title?: string;
37096
+ sequence_id?: string;
37097
37097
  priority?: NtfyPriority;
37098
37098
  tags?: string[];
37099
37099
  click?: string;
@@ -37125,7 +37125,7 @@ declare class NtfyPublishResource {
37125
37125
  * Envia uma notificação para um tópico do ntfy.
37126
37126
  * @param options Opções da notificação
37127
37127
  */
37128
- publish(options: NtfyPublishOptions): Promise<NtfyPublishResponse>;
37128
+ publish(options: NtfyPublishOptions): Promise<NtfyPublishResponse | null>;
37129
37129
  }
37130
37130
 
37131
37131
  declare class NtfyAPIClient extends APIClient {
package/dist/index.js CHANGED
@@ -91488,46 +91488,58 @@ var NtfyPublishResource = class {
91488
91488
  * @param options Opções da notificação
91489
91489
  */
91490
91490
  async publish(options) {
91491
- const { sequence_id, message, title, priority, tags, click, actions } = options;
91492
- const headers = {
91493
- "Content-Type": "text/plain"
91494
- };
91495
- if (title) headers["Title"] = title;
91496
- if (priority) headers["Priority"] = priority;
91497
- if (tags && tags.length > 0) headers["Tags"] = tags.join(",");
91498
- if (click) headers["Click"] = click;
91499
- if (actions && actions.length > 0) {
91500
- headers["Actions"] = actions.map((a) => {
91501
- const parts = [a.action, `label="${a.label}"`];
91502
- if (a.action === "view" && a.url) parts.push(`url="${a.url}"`);
91503
- if (a.action === "broadcast" && a.intent)
91504
- parts.push(`intent="${a.intent}"`);
91505
- if (a.action === "http" && a.url) parts.push(`url="${a.url}"`);
91506
- if (a.action === "copy" && a.content)
91507
- parts.push(`content="${a.content}"`);
91508
- Object.entries(a).forEach(([key, value]) => {
91509
- if (![
91510
- "action",
91511
- "label",
91512
- "url",
91513
- "intent",
91514
- "content",
91515
- "headers"
91516
- ].includes(key) && value !== void 0) {
91517
- parts.push(`${key}="${value}"`);
91518
- }
91519
- });
91520
- if (a.action === "http" && a.headers) {
91521
- Object.entries(a.headers).forEach(([hKey, hValue]) => {
91522
- parts.push(`headers.${hKey}="${hValue}"`);
91491
+ try {
91492
+ const { sequence_id, message, title, priority, tags, click, actions } = options;
91493
+ const headers = {
91494
+ "Content-Type": "text/plain"
91495
+ };
91496
+ if (title) headers["Title"] = title;
91497
+ if (priority) headers["Priority"] = priority;
91498
+ if (tags && tags.length > 0) headers["Tags"] = tags.join(",");
91499
+ if (click) headers["Click"] = click;
91500
+ if (sequence_id) {
91501
+ headers["Sequence-ID"] = sequence_id;
91502
+ }
91503
+ if (actions && actions.length > 0) {
91504
+ headers["Actions"] = actions.map((a) => {
91505
+ const parts = [a.action, `label="${a.label}"`];
91506
+ if (a.action === "view" && a.url) parts.push(`url="${a.url}"`);
91507
+ if (a.action === "broadcast" && a.intent)
91508
+ parts.push(`intent="${a.intent}"`);
91509
+ if (a.action === "http" && a.url) parts.push(`url="${a.url}"`);
91510
+ if (a.action === "copy" && a.content)
91511
+ parts.push(`content="${a.content}"`);
91512
+ if (a.method) parts.push(`method=${a.method}`);
91513
+ if (a.body) parts.push(`body=${a.body}`);
91514
+ if (a.clear !== void 0) parts.push(`clear=${a.clear}`);
91515
+ Object.entries(a).forEach(([key, value]) => {
91516
+ if (![
91517
+ "action",
91518
+ "label",
91519
+ "url",
91520
+ "intent",
91521
+ "content",
91522
+ "headers",
91523
+ "method",
91524
+ "body",
91525
+ "clear"
91526
+ ].includes(key) && value !== void 0) {
91527
+ parts.push(`${key}="${value}"`);
91528
+ }
91523
91529
  });
91524
- }
91525
- return parts.join(", ");
91526
- }).join("; ");
91530
+ if (a.action === "http" && a.headers) {
91531
+ Object.entries(a.headers).forEach(([hKey, hValue]) => {
91532
+ parts.push(`headers.${hKey}="${hValue}"`);
91533
+ });
91534
+ }
91535
+ return parts.join(", ");
91536
+ }).join("; ");
91537
+ }
91538
+ return this.client.post("", message, { headers });
91539
+ } catch (err) {
91540
+ console.error("[Ntfy] Falha ao publicar:", err);
91541
+ return null;
91527
91542
  }
91528
- return this.client.post(`/${sequence_id}`, message, {
91529
- headers
91530
- });
91531
91543
  }
91532
91544
  };
91533
91545
 
package/dist/index.mjs CHANGED
@@ -91447,46 +91447,58 @@ var NtfyPublishResource = class {
91447
91447
  * @param options Opções da notificação
91448
91448
  */
91449
91449
  async publish(options) {
91450
- const { sequence_id, message, title, priority, tags, click, actions } = options;
91451
- const headers = {
91452
- "Content-Type": "text/plain"
91453
- };
91454
- if (title) headers["Title"] = title;
91455
- if (priority) headers["Priority"] = priority;
91456
- if (tags && tags.length > 0) headers["Tags"] = tags.join(",");
91457
- if (click) headers["Click"] = click;
91458
- if (actions && actions.length > 0) {
91459
- headers["Actions"] = actions.map((a) => {
91460
- const parts = [a.action, `label="${a.label}"`];
91461
- if (a.action === "view" && a.url) parts.push(`url="${a.url}"`);
91462
- if (a.action === "broadcast" && a.intent)
91463
- parts.push(`intent="${a.intent}"`);
91464
- if (a.action === "http" && a.url) parts.push(`url="${a.url}"`);
91465
- if (a.action === "copy" && a.content)
91466
- parts.push(`content="${a.content}"`);
91467
- Object.entries(a).forEach(([key, value]) => {
91468
- if (![
91469
- "action",
91470
- "label",
91471
- "url",
91472
- "intent",
91473
- "content",
91474
- "headers"
91475
- ].includes(key) && value !== void 0) {
91476
- parts.push(`${key}="${value}"`);
91477
- }
91478
- });
91479
- if (a.action === "http" && a.headers) {
91480
- Object.entries(a.headers).forEach(([hKey, hValue]) => {
91481
- parts.push(`headers.${hKey}="${hValue}"`);
91450
+ try {
91451
+ const { sequence_id, message, title, priority, tags, click, actions } = options;
91452
+ const headers = {
91453
+ "Content-Type": "text/plain"
91454
+ };
91455
+ if (title) headers["Title"] = title;
91456
+ if (priority) headers["Priority"] = priority;
91457
+ if (tags && tags.length > 0) headers["Tags"] = tags.join(",");
91458
+ if (click) headers["Click"] = click;
91459
+ if (sequence_id) {
91460
+ headers["Sequence-ID"] = sequence_id;
91461
+ }
91462
+ if (actions && actions.length > 0) {
91463
+ headers["Actions"] = actions.map((a) => {
91464
+ const parts = [a.action, `label="${a.label}"`];
91465
+ if (a.action === "view" && a.url) parts.push(`url="${a.url}"`);
91466
+ if (a.action === "broadcast" && a.intent)
91467
+ parts.push(`intent="${a.intent}"`);
91468
+ if (a.action === "http" && a.url) parts.push(`url="${a.url}"`);
91469
+ if (a.action === "copy" && a.content)
91470
+ parts.push(`content="${a.content}"`);
91471
+ if (a.method) parts.push(`method=${a.method}`);
91472
+ if (a.body) parts.push(`body=${a.body}`);
91473
+ if (a.clear !== void 0) parts.push(`clear=${a.clear}`);
91474
+ Object.entries(a).forEach(([key, value]) => {
91475
+ if (![
91476
+ "action",
91477
+ "label",
91478
+ "url",
91479
+ "intent",
91480
+ "content",
91481
+ "headers",
91482
+ "method",
91483
+ "body",
91484
+ "clear"
91485
+ ].includes(key) && value !== void 0) {
91486
+ parts.push(`${key}="${value}"`);
91487
+ }
91482
91488
  });
91483
- }
91484
- return parts.join(", ");
91485
- }).join("; ");
91489
+ if (a.action === "http" && a.headers) {
91490
+ Object.entries(a.headers).forEach(([hKey, hValue]) => {
91491
+ parts.push(`headers.${hKey}="${hValue}"`);
91492
+ });
91493
+ }
91494
+ return parts.join(", ");
91495
+ }).join("; ");
91496
+ }
91497
+ return this.client.post("", message, { headers });
91498
+ } catch (err) {
91499
+ console.error("[Ntfy] Falha ao publicar:", err);
91500
+ return null;
91486
91501
  }
91487
- return this.client.post(`/${sequence_id}`, message, {
91488
- headers
91489
- });
91490
91502
  }
91491
91503
  };
91492
91504
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cristian-israel/giganet_lib_conecta",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "Database Connector Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",