@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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +50 -38
- package/dist/index.mjs +50 -38
- package/package.json +1 -1
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
|
-
|
|
91492
|
-
|
|
91493
|
-
|
|
91494
|
-
|
|
91495
|
-
|
|
91496
|
-
|
|
91497
|
-
|
|
91498
|
-
|
|
91499
|
-
|
|
91500
|
-
|
|
91501
|
-
|
|
91502
|
-
|
|
91503
|
-
|
|
91504
|
-
|
|
91505
|
-
|
|
91506
|
-
|
|
91507
|
-
|
|
91508
|
-
|
|
91509
|
-
if (
|
|
91510
|
-
|
|
91511
|
-
"
|
|
91512
|
-
|
|
91513
|
-
|
|
91514
|
-
|
|
91515
|
-
|
|
91516
|
-
|
|
91517
|
-
|
|
91518
|
-
|
|
91519
|
-
|
|
91520
|
-
|
|
91521
|
-
|
|
91522
|
-
|
|
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
|
-
|
|
91526
|
-
|
|
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
|
-
|
|
91451
|
-
|
|
91452
|
-
|
|
91453
|
-
|
|
91454
|
-
|
|
91455
|
-
|
|
91456
|
-
|
|
91457
|
-
|
|
91458
|
-
|
|
91459
|
-
|
|
91460
|
-
|
|
91461
|
-
|
|
91462
|
-
|
|
91463
|
-
|
|
91464
|
-
|
|
91465
|
-
|
|
91466
|
-
|
|
91467
|
-
|
|
91468
|
-
if (
|
|
91469
|
-
|
|
91470
|
-
"
|
|
91471
|
-
|
|
91472
|
-
|
|
91473
|
-
|
|
91474
|
-
|
|
91475
|
-
|
|
91476
|
-
|
|
91477
|
-
|
|
91478
|
-
|
|
91479
|
-
|
|
91480
|
-
|
|
91481
|
-
|
|
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
|
-
|
|
91485
|
-
|
|
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
|
|