@astro-minimax/notify 0.1.0 → 0.5.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Souloss
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/providers/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAElF,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACpD;AAoBD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,aAAa,CA8Ef"}
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/providers/email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAElF,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACpD;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,aAAa,CA4Ef"}
@@ -1,19 +1,3 @@
1
- let proxyConfigured = false;
2
- async function configureProxy() {
3
- if (proxyConfigured)
4
- return;
5
- const proxyUrl = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
6
- if (proxyUrl) {
7
- try {
8
- const { setGlobalDispatcher, ProxyAgent } = await import('undici');
9
- setGlobalDispatcher(new ProxyAgent(proxyUrl));
10
- proxyConfigured = true;
11
- }
12
- catch {
13
- // ProxyAgent not available, continue without proxy
14
- }
15
- }
16
- }
17
1
  export function createEmailProvider(config, logger) {
18
2
  const { provider, apiKey, from, to } = config;
19
3
  return {
@@ -28,7 +12,6 @@ export function createEmailProvider(config, logger) {
28
12
  };
29
13
  }
30
14
  try {
31
- await configureProxy();
32
15
  const response = await fetch('https://api.resend.com/emails', {
33
16
  method: 'POST',
34
17
  headers: {
@@ -1 +1 @@
1
- {"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../../src/providers/telegram.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAExF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD;AAoBD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,gBAAgB,CAmElB"}
1
+ {"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../../src/providers/telegram.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAExF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,gBAAgB,CAqElB"}
@@ -1,26 +1,12 @@
1
- let proxyConfigured = false;
2
- async function configureProxy() {
3
- if (proxyConfigured)
4
- return;
5
- const proxyUrl = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
6
- if (proxyUrl) {
7
- try {
8
- const { setGlobalDispatcher, ProxyAgent } = await import('undici');
9
- setGlobalDispatcher(new ProxyAgent(proxyUrl));
10
- proxyConfigured = true;
11
- }
12
- catch {
13
- // ProxyAgent not available, continue without proxy
14
- }
15
- }
16
- }
17
1
  export function createTelegramProvider(config, logger) {
18
2
  const { botToken, chatId } = config;
19
3
  return {
20
4
  async send(template) {
21
5
  const start = Date.now();
22
6
  try {
23
- await configureProxy();
7
+ // Note: Proxy configuration is not supported in Cloudflare Edge Runtime.
8
+ // If you need proxy support, consider using a dedicated proxy service
9
+ // or running the notification service in a Node.js environment.
24
10
  const url = `https://api.telegram.org/bot${botToken}/sendMessage`;
25
11
  const response = await fetch(url, {
26
12
  method: 'POST',
package/package.json CHANGED
@@ -1,10 +1,27 @@
1
1
  {
2
2
  "name": "@astro-minimax/notify",
3
- "version": "0.1.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
- "description": "Multi-channel notification package for astro-minimax blogs",
5
+ "description": "Multi-channel notification package for astro-minimax blogs — supports Telegram, Email (Resend), and more.",
6
6
  "author": "Souloss",
7
7
  "license": "MIT",
8
+ "keywords": [
9
+ "astro",
10
+ "notification",
11
+ "telegram",
12
+ "email",
13
+ "resend",
14
+ "webhook"
15
+ ],
16
+ "homepage": "https://github.com/souloss/astro-minimax#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/souloss/astro-minimax/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/souloss/astro-minimax",
23
+ "directory": "packages/notify"
24
+ },
8
25
  "main": "./dist/index.js",
9
26
  "types": "./dist/index.d.ts",
10
27
  "exports": {
@@ -18,15 +35,10 @@
18
35
  "dist/"
19
36
  ],
20
37
  "sideEffects": false,
21
- "scripts": {
22
- "build": "tsc -p tsconfig.build.json",
23
- "build:watch": "tsc -p tsconfig.build.json --watch",
24
- "clean": "rm -rf dist",
25
- "prepublishOnly": "pnpm run clean && pnpm run build",
26
- "publish": "npm publish --access public"
27
- },
28
38
  "dependencies": {
29
- "grammy": "^1.41.1",
39
+ "grammy": "^1.41.1"
40
+ },
41
+ "optionalDependencies": {
30
42
  "undici": "^6.0.0"
31
43
  },
32
44
  "peerDependencies": {
@@ -43,6 +55,13 @@
43
55
  "typescript": "^5.9.3"
44
56
  },
45
57
  "engines": {
46
- "node": ">=22.12.0"
58
+ "node": ">=22.12.0",
59
+ "pnpm": ">=9.0.0"
60
+ },
61
+ "scripts": {
62
+ "build": "tsc -p tsconfig.build.json",
63
+ "build:watch": "tsc -p tsconfig.build.json --watch",
64
+ "typecheck": "tsc --noEmit",
65
+ "clean": "rm -rf dist"
47
66
  }
48
- }
67
+ }