@treeseed/core 0.6.21 → 0.6.23
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/dev.d.ts +2 -2
- package/dist/dev.js +6 -8
- package/dist/env.yaml +2 -0
- package/dist/scripts/build-dist.js +1 -0
- package/dist/site.js +0 -3
- package/dist/utils/forms/config.js +3 -14
- package/dist/utils/forms/runtime-core.js +1 -2
- package/dist/utils/forms/runtime.js +1 -3
- package/dist/utils/forms/service.d.ts +4 -0
- package/dist/worker/forms-worker.js +2 -8
- package/package.json +2 -2
package/dist/dev.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare const TREESEED_DEFAULT_WEB_PORT = 4321;
|
|
|
6
6
|
export declare const TREESEED_DEFAULT_API_HOST = "127.0.0.1";
|
|
7
7
|
export declare const TREESEED_DEFAULT_API_PORT = 3000;
|
|
8
8
|
export declare const TREESEED_DEFAULT_MANAGER_PORT = 3100;
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const TREESEED_DEFAULT_LOCAL_SMTP_HOST = "127.0.0.1";
|
|
10
|
+
export declare const TREESEED_DEFAULT_LOCAL_SMTP_PORT = 1025;
|
|
11
11
|
export declare const TREESEED_DEFAULT_MAILPIT_UI_PORT = 8025;
|
|
12
12
|
export type TreeseedIntegratedDevSurface = 'integrated' | 'services' | 'web' | 'api' | 'manager' | 'worker';
|
|
13
13
|
export type TreeseedIntegratedDevSetupMode = 'auto' | 'check' | 'off';
|
package/dist/dev.js
CHANGED
|
@@ -28,8 +28,8 @@ const TREESEED_DEFAULT_WEB_PORT = 4321;
|
|
|
28
28
|
const TREESEED_DEFAULT_API_HOST = "127.0.0.1";
|
|
29
29
|
const TREESEED_DEFAULT_API_PORT = 3e3;
|
|
30
30
|
const TREESEED_DEFAULT_MANAGER_PORT = 3100;
|
|
31
|
-
const
|
|
32
|
-
const
|
|
31
|
+
const TREESEED_DEFAULT_LOCAL_SMTP_HOST = "127.0.0.1";
|
|
32
|
+
const TREESEED_DEFAULT_LOCAL_SMTP_PORT = 1025;
|
|
33
33
|
const TREESEED_DEFAULT_MAILPIT_UI_PORT = 8025;
|
|
34
34
|
const DEV_RELOAD_FILE = "public/__treeseed/dev-reload.json";
|
|
35
35
|
const DEFAULT_READINESS_TIMEOUT_MS = 9e4;
|
|
@@ -449,10 +449,8 @@ function createTreeseedIntegratedDevPlan(options = {}) {
|
|
|
449
449
|
TREESEED_API_D1_LOCAL_PERSIST_TO: mergedEnv.TREESEED_API_D1_LOCAL_PERSIST_TO ?? (usesCloudflareWebRuntime ? resolve(tenantRoot, ".treeseed", "generated", "environments", "local", ".wrangler", "state", "v3", "d1") : resolve(tenantRoot, ".wrangler", "state", "v3", "d1")),
|
|
450
450
|
TREESEED_FORM_TOKEN_SECRET: mergedEnv.TREESEED_FORM_TOKEN_SECRET ?? "treeseed-local-form-token-secret",
|
|
451
451
|
TREESEED_BETTER_AUTH_SECRET: mergedEnv.TREESEED_BETTER_AUTH_SECRET ?? "treeseed-local-better-auth-secret-minimum-32-characters",
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
TREESEED_MAILPIT_SMTP_HOST: mergedEnv.TREESEED_MAILPIT_SMTP_HOST ?? TREESEED_DEFAULT_MAILPIT_SMTP_HOST,
|
|
455
|
-
TREESEED_MAILPIT_SMTP_PORT: mergedEnv.TREESEED_MAILPIT_SMTP_PORT ?? String(TREESEED_DEFAULT_MAILPIT_SMTP_PORT),
|
|
452
|
+
TREESEED_SMTP_HOST: mergedEnv.TREESEED_SMTP_HOST ?? TREESEED_DEFAULT_LOCAL_SMTP_HOST,
|
|
453
|
+
TREESEED_SMTP_PORT: mergedEnv.TREESEED_SMTP_PORT ?? String(TREESEED_DEFAULT_LOCAL_SMTP_PORT),
|
|
456
454
|
TREESEED_MAILPIT_UI_PORT: mergedEnv.TREESEED_MAILPIT_UI_PORT ?? String(TREESEED_DEFAULT_MAILPIT_UI_PORT),
|
|
457
455
|
TREESEED_AUTH_EMAIL_FROM: mergedEnv.TREESEED_AUTH_EMAIL_FROM ?? "Treeseed Market <auth@treeseed.local>"
|
|
458
456
|
};
|
|
@@ -1274,8 +1272,8 @@ async function runTreeseedIntegratedDev(options = {}, deps = {}) {
|
|
|
1274
1272
|
export {
|
|
1275
1273
|
TREESEED_DEFAULT_API_HOST,
|
|
1276
1274
|
TREESEED_DEFAULT_API_PORT,
|
|
1277
|
-
|
|
1278
|
-
|
|
1275
|
+
TREESEED_DEFAULT_LOCAL_SMTP_HOST,
|
|
1276
|
+
TREESEED_DEFAULT_LOCAL_SMTP_PORT,
|
|
1279
1277
|
TREESEED_DEFAULT_MAILPIT_UI_PORT,
|
|
1280
1278
|
TREESEED_DEFAULT_MANAGER_PORT,
|
|
1281
1279
|
TREESEED_DEFAULT_WEB_HOST,
|
package/dist/env.yaml
CHANGED
|
@@ -296,6 +296,7 @@ entries:
|
|
|
296
296
|
sourcePriority:
|
|
297
297
|
- machine-config
|
|
298
298
|
- process-env
|
|
299
|
+
localDefaultValueRef: localSmtpHostDefault
|
|
299
300
|
relevanceRef: smtpEnabled
|
|
300
301
|
requiredWhenRef: smtpNonLocal
|
|
301
302
|
TREESEED_SMTP_PORT:
|
|
@@ -325,6 +326,7 @@ entries:
|
|
|
325
326
|
sourcePriority:
|
|
326
327
|
- machine-config
|
|
327
328
|
- process-env
|
|
329
|
+
localDefaultValueRef: localSmtpPortDefault
|
|
328
330
|
relevanceRef: smtpEnabled
|
|
329
331
|
requiredWhenRef: smtpNonLocal
|
|
330
332
|
TREESEED_SMTP_USERNAME:
|
|
@@ -377,6 +377,7 @@ async function main() {
|
|
|
377
377
|
writeCompatibilityEntrypoint(resolve(distRoot, 'content.d.ts'), "export declare function createTreeseedCollections(tenantConfig: any, dependencies: any): Record<string, any>;");
|
|
378
378
|
writeCompatibilityEntrypoint(resolve(distRoot, 'content-config.js'), "import { loadTreeseedManifest } from '@treeseed/sdk/platform/tenant-config';\nimport { docsLoader } from './vendor/starlight/loaders.js';\nimport { docsSchema } from './vendor/starlight/schema.js';\nimport { createTreeseedCollections } from './content.js';\n\nexport function createTreeseedTenantCollections(manifestPath) {\n\tconst tenant = loadTreeseedManifest(manifestPath);\n\treturn createTreeseedCollections(tenant, { docsLoader, docsSchema });\n}");
|
|
379
379
|
writeCompatibilityEntrypoint(resolve(distRoot, 'content-config.d.ts'), "export declare function createTreeseedTenantCollections(manifestPath?: string): {\n\tpages: any;\n\tnotes: any;\n\tquestions: any;\n\tobjectives: any;\n\tpeople: any;\n\tagents: any;\n\tbooks: any;\n\tdocs: any;\n\tworkdays?: any;\n};");
|
|
380
|
+
writeCompatibilityEntrypoint(resolve(distRoot, 'utils/forms/service.d.ts'), "import type { APIContext } from 'astro';\nimport type { SubmitResult } from '../../types/forms.js';\nexport declare function handleTokenRequest(context: APIContext): Promise<Response>;\nexport declare function handleFormSubmission(context: APIContext): Promise<SubmitResult>;");
|
|
380
381
|
rmSync(resolve(distRoot, 'config.d.js'), { force: true });
|
|
381
382
|
rmSync(resolve(distRoot, 'content-config.d.js'), { force: true });
|
|
382
383
|
writeCompatibilityEntrypoint(resolve(vendoredStarlightRoot, 'utils', 'routing.js'), "export * from './routing/index.js';");
|
package/dist/site.js
CHANGED
|
@@ -294,9 +294,6 @@ function createTreeseedSite(tenantConfig, { starlight }) {
|
|
|
294
294
|
TREESEED_CONTENT_PREVIEW_ROOT_TEMPLATE: envField.string({ context: "server", access: "secret", optional: true }),
|
|
295
295
|
TREESEED_LOCAL_DEV_MODE: envField.enum({ values: ["cloudflare"], context: "server", access: "secret", optional: true }),
|
|
296
296
|
TREESEED_FORMS_LOCAL_BYPASS_CLOUDFLARE_GUARDS: envField.boolean({ context: "server", access: "secret", optional: true }),
|
|
297
|
-
TREESEED_FORMS_LOCAL_USE_MAILPIT: envField.boolean({ context: "server", access: "secret", optional: true }),
|
|
298
|
-
TREESEED_MAILPIT_SMTP_HOST: envField.string({ context: "server", access: "secret", optional: true }),
|
|
299
|
-
TREESEED_MAILPIT_SMTP_PORT: envField.number({ context: "server", access: "secret", optional: true }),
|
|
300
297
|
...siteExtensions.envSchema
|
|
301
298
|
}
|
|
302
299
|
},
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TREESEED_FORM_TOKEN_SECRET,
|
|
3
3
|
TREESEED_FORMS_LOCAL_BYPASS_CLOUDFLARE_GUARDS,
|
|
4
|
-
TREESEED_FORMS_LOCAL_USE_MAILPIT,
|
|
5
4
|
TREESEED_LOCAL_DEV_MODE,
|
|
6
|
-
TREESEED_MAILPIT_SMTP_HOST,
|
|
7
|
-
TREESEED_MAILPIT_SMTP_PORT,
|
|
8
5
|
TREESEED_SMTP_FROM,
|
|
9
6
|
TREESEED_SMTP_HOST,
|
|
10
7
|
TREESEED_SMTP_PASSWORD,
|
|
@@ -32,10 +29,9 @@ function getSubscribeRecipients() {
|
|
|
32
29
|
return SITE_EMAIL_NOTIFICATIONS.subscribeRecipients;
|
|
33
30
|
}
|
|
34
31
|
function getSmtpConfig() {
|
|
35
|
-
const useMailpit = TREESEED_FORMS_LOCAL_USE_MAILPIT ?? false;
|
|
36
32
|
return {
|
|
37
|
-
host:
|
|
38
|
-
port:
|
|
33
|
+
host: TREESEED_SMTP_HOST ?? "",
|
|
34
|
+
port: TREESEED_SMTP_PORT ?? 465,
|
|
39
35
|
username: TREESEED_SMTP_USERNAME ?? "",
|
|
40
36
|
password: TREESEED_SMTP_PASSWORD ?? "",
|
|
41
37
|
from: TREESEED_SMTP_FROM ?? "",
|
|
@@ -54,17 +50,11 @@ function getLocalDevMode() {
|
|
|
54
50
|
function shouldBypassCloudflareGuardsByEnv() {
|
|
55
51
|
return TREESEED_FORMS_LOCAL_BYPASS_CLOUDFLARE_GUARDS;
|
|
56
52
|
}
|
|
57
|
-
function shouldUseMailpit() {
|
|
58
|
-
return TREESEED_FORMS_LOCAL_USE_MAILPIT ?? false;
|
|
59
|
-
}
|
|
60
53
|
function isSmtpConfigured() {
|
|
61
54
|
const smtp = getSmtpConfig();
|
|
62
55
|
return Boolean(smtp.host && smtp.port && smtp.from);
|
|
63
56
|
}
|
|
64
57
|
function isSmtpEnabled() {
|
|
65
|
-
if (shouldUseMailpit()) {
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
58
|
return isTreeseedSmtpEnabled() && isSmtpConfigured();
|
|
69
59
|
}
|
|
70
60
|
function isTurnstileEnabled() {
|
|
@@ -81,6 +71,5 @@ export {
|
|
|
81
71
|
isSmtpConfigured,
|
|
82
72
|
isSmtpEnabled,
|
|
83
73
|
isTurnstileEnabled,
|
|
84
|
-
shouldBypassCloudflareGuardsByEnv
|
|
85
|
-
shouldUseMailpit
|
|
74
|
+
shouldBypassCloudflareGuardsByEnv
|
|
86
75
|
};
|
|
@@ -6,9 +6,8 @@ function deriveFormRuntimeCapabilities(input) {
|
|
|
6
6
|
localDevMode: input.localDevMode ?? "production",
|
|
7
7
|
bypassTurnstile: isLocalMode ? true : false,
|
|
8
8
|
bypassCloudflareGuards: isLocalMode ? input.bypassCloudflareGuards ?? false : false,
|
|
9
|
-
useMailpit: isLocalMode ? input.useMailpit : false,
|
|
10
9
|
formsMode: input.formsMode,
|
|
11
|
-
smtpEnabled: input.smtpEnabled
|
|
10
|
+
smtpEnabled: input.smtpEnabled,
|
|
12
11
|
turnstileEnabled: isLocalMode ? false : input.turnstileEnabled
|
|
13
12
|
};
|
|
14
13
|
}
|
|
@@ -3,8 +3,7 @@ import {
|
|
|
3
3
|
getLocalDevMode,
|
|
4
4
|
isSmtpEnabled,
|
|
5
5
|
isTurnstileEnabled,
|
|
6
|
-
shouldBypassCloudflareGuardsByEnv
|
|
7
|
-
shouldUseMailpit
|
|
6
|
+
shouldBypassCloudflareGuardsByEnv
|
|
8
7
|
} from "./config.js";
|
|
9
8
|
import { deriveFormRuntimeCapabilities } from "./runtime-core.js";
|
|
10
9
|
function resolveFormRuntimeCapabilities(locals) {
|
|
@@ -14,7 +13,6 @@ function resolveFormRuntimeCapabilities(locals) {
|
|
|
14
13
|
localDevMode: getLocalDevMode(),
|
|
15
14
|
isDevServer: import.meta.env.DEV,
|
|
16
15
|
bypassCloudflareGuards: shouldBypassCloudflareGuardsByEnv(),
|
|
17
|
-
useMailpit: shouldUseMailpit(),
|
|
18
16
|
formsMode: getFormsMode(),
|
|
19
17
|
smtpEnabled: isSmtpEnabled(),
|
|
20
18
|
turnstileEnabled: isTurnstileEnabled()
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { APIContext } from 'astro';
|
|
2
|
+
import type { SubmitResult } from '../../types/forms';
|
|
3
|
+
export declare function handleTokenRequest(context: APIContext): Promise<Response>;
|
|
4
|
+
export declare function handleFormSubmission(context: APIContext): Promise<SubmitResult>;
|
|
@@ -41,10 +41,9 @@ function serializeCookie(cookie) {
|
|
|
41
41
|
return parts.join("; ");
|
|
42
42
|
}
|
|
43
43
|
function buildSmtpConfig(env) {
|
|
44
|
-
const useMailpit = envBoolean(env.TREESEED_FORMS_LOCAL_USE_MAILPIT);
|
|
45
44
|
return {
|
|
46
|
-
host:
|
|
47
|
-
port: Number(
|
|
45
|
+
host: env.TREESEED_SMTP_HOST ?? "",
|
|
46
|
+
port: Number(env.TREESEED_SMTP_PORT ?? "465"),
|
|
48
47
|
username: env.TREESEED_SMTP_USERNAME ?? "",
|
|
49
48
|
password: env.TREESEED_SMTP_PASSWORD ?? "",
|
|
50
49
|
from: env.TREESEED_SMTP_FROM ?? "",
|
|
@@ -53,10 +52,6 @@ function buildSmtpConfig(env) {
|
|
|
53
52
|
}
|
|
54
53
|
function isSmtpEnabled(env) {
|
|
55
54
|
const smtp = buildSmtpConfig(env);
|
|
56
|
-
const useMailpit = envBoolean(env.TREESEED_FORMS_LOCAL_USE_MAILPIT);
|
|
57
|
-
if (useMailpit) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
55
|
return Boolean(__TREESEED_DEPLOY_CONFIG__.smtp?.enabled && smtp.host && smtp.port && smtp.from);
|
|
61
56
|
}
|
|
62
57
|
function isTurnstileEnabled(env) {
|
|
@@ -68,7 +63,6 @@ function buildRuntime(env) {
|
|
|
68
63
|
localDevMode: env.TREESEED_LOCAL_DEV_MODE === "cloudflare" ? "cloudflare" : null,
|
|
69
64
|
isDevServer: false,
|
|
70
65
|
bypassCloudflareGuards: envBoolean(env.TREESEED_FORMS_LOCAL_BYPASS_CLOUDFLARE_GUARDS),
|
|
71
|
-
useMailpit: envBoolean(env.TREESEED_FORMS_LOCAL_USE_MAILPIT),
|
|
72
66
|
formsMode: __TREESEED_DEPLOY_CONFIG__.providers?.forms ?? "store_only",
|
|
73
67
|
smtpEnabled: isSmtpEnabled(env),
|
|
74
68
|
turnstileEnabled: isTurnstileEnabled(env)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.23",
|
|
4
4
|
"description": "Treeseed integrated platform starter for Astro/Starlight web runtimes and Hono API runtimes.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@astrojs/sitemap": "3.7.0",
|
|
77
77
|
"@astrojs/starlight": "0.37.6",
|
|
78
78
|
"@tailwindcss/vite": "^4.1.4",
|
|
79
|
-
"@treeseed/sdk": "0.6.
|
|
79
|
+
"@treeseed/sdk": "0.6.22",
|
|
80
80
|
"astro": "^5.6.1",
|
|
81
81
|
"esbuild": "^0.28.0",
|
|
82
82
|
"hono": "^4.8.2",
|