@constructive-io/send-email-link-fn 2.2.0 → 2.2.2

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.
Files changed (3) hide show
  1. package/esm/index.js +7 -11
  2. package/index.js +7 -11
  3. package/package.json +6 -6
package/esm/index.js CHANGED
@@ -144,8 +144,8 @@ export const sendEmailLink = async (params, context) => {
144
144
  const primary = theme.primary;
145
145
  // Check if this is a localhost-style domain before building hostname
146
146
  // TODO: Security consideration - this only affects localhost domains which
147
- // should not exist in production. The isLocalHost check combined with isDryRun
148
- // ensures special behavior (http, custom port) only applies in dev environments.
147
+ // should not exist in production. The isLocalHost check ensures special
148
+ // behavior (http, custom port) only applies in dev environments.
149
149
  const isLocalDomain = domain === 'localhost' ||
150
150
  domain.startsWith('localhost') ||
151
151
  domain === '0.0.0.0';
@@ -159,15 +159,11 @@ export const sendEmailLink = async (params, context) => {
159
159
  const isLocalHost = hostname.startsWith('localhost') ||
160
160
  hostname.startsWith('0.0.0.0') ||
161
161
  hostname.endsWith('.localhost');
162
- // Optional: LOCAL_APP_PORT lets you attach a port for local dashboards
163
- // e.g. LOCAL_APP_PORT=3000 -> http://localhost:3000
164
- // It is ignored for non-local hostnames. Only allow on DRY RUNs
165
- const localPort = isLocalHost && isDryRun && process.env.LOCAL_APP_PORT
166
- ? `:${process.env.LOCAL_APP_PORT}`
167
- : '';
168
- // Use http only for local dry-run to avoid browser TLS warnings
169
- // in dev; production stays https.
170
- const protocol = isLocalHost && isDryRun ? 'http' : 'https';
162
+ // When localhost + LOCAL_APP_PORT: use http://localhost:PORT (local dev)
163
+ // Otherwise: https (production)
164
+ const useLocalUrl = isLocalHost && process.env.LOCAL_APP_PORT;
165
+ const localPort = useLocalUrl ? `:${process.env.LOCAL_APP_PORT}` : '';
166
+ const protocol = useLocalUrl ? 'http' : 'https';
171
167
  const url = new URL(`${protocol}://${hostname}${localPort}`);
172
168
  let subject;
173
169
  let subMessage;
package/index.js CHANGED
@@ -150,8 +150,8 @@ const sendEmailLink = async (params, context) => {
150
150
  const primary = theme.primary;
151
151
  // Check if this is a localhost-style domain before building hostname
152
152
  // TODO: Security consideration - this only affects localhost domains which
153
- // should not exist in production. The isLocalHost check combined with isDryRun
154
- // ensures special behavior (http, custom port) only applies in dev environments.
153
+ // should not exist in production. The isLocalHost check ensures special
154
+ // behavior (http, custom port) only applies in dev environments.
155
155
  const isLocalDomain = domain === 'localhost' ||
156
156
  domain.startsWith('localhost') ||
157
157
  domain === '0.0.0.0';
@@ -165,15 +165,11 @@ const sendEmailLink = async (params, context) => {
165
165
  const isLocalHost = hostname.startsWith('localhost') ||
166
166
  hostname.startsWith('0.0.0.0') ||
167
167
  hostname.endsWith('.localhost');
168
- // Optional: LOCAL_APP_PORT lets you attach a port for local dashboards
169
- // e.g. LOCAL_APP_PORT=3000 -> http://localhost:3000
170
- // It is ignored for non-local hostnames. Only allow on DRY RUNs
171
- const localPort = isLocalHost && isDryRun && process.env.LOCAL_APP_PORT
172
- ? `:${process.env.LOCAL_APP_PORT}`
173
- : '';
174
- // Use http only for local dry-run to avoid browser TLS warnings
175
- // in dev; production stays https.
176
- const protocol = isLocalHost && isDryRun ? 'http' : 'https';
168
+ // When localhost + LOCAL_APP_PORT: use http://localhost:PORT (local dev)
169
+ // Otherwise: https (production)
170
+ const useLocalUrl = isLocalHost && process.env.LOCAL_APP_PORT;
171
+ const localPort = useLocalUrl ? `:${process.env.LOCAL_APP_PORT}` : '';
172
+ const protocol = useLocalUrl ? 'http' : 'https';
177
173
  const url = new URL(`${protocol}://${hostname}${localPort}`);
178
174
  let subject;
179
175
  let subMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/send-email-link-fn",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Knative function to send email links (invite, password reset, email verification) using Constructive jobs",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "homepage": "https://github.com/constructive-io/constructive",
@@ -33,15 +33,15 @@
33
33
  "makage": "^0.1.12"
34
34
  },
35
35
  "dependencies": {
36
- "@constructive-io/knative-job-fn": "^1.2.0",
37
- "@constructive-io/postmaster": "^1.3.0",
36
+ "@constructive-io/knative-job-fn": "^1.2.1",
37
+ "@constructive-io/postmaster": "^1.3.1",
38
38
  "@launchql/mjml": "0.1.1",
39
39
  "@launchql/styled-email": "0.1.0",
40
40
  "@pgpmjs/env": "^2.13.0",
41
- "@pgpmjs/logger": "^2.2.0",
41
+ "@pgpmjs/logger": "^2.2.1",
42
42
  "graphql-request": "^7.1.2",
43
43
  "graphql-tag": "^2.12.6",
44
- "simple-smtp-server": "^0.5.0"
44
+ "simple-smtp-server": "^0.5.1"
45
45
  },
46
- "gitHead": "b758178b808ce0bf451e86c0bd7e92079155db7c"
46
+ "gitHead": "d0d7d3916b70c8d960bc13e40ac85d73ea869224"
47
47
  }