@velocity-astro/cms-astro 0.0.0-stage → 0.1.0-beta.1
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 +21 -0
- package/README.md +12 -2
- package/bin/velocity-cms.mjs +6 -0
- package/dist/admin-files.d.ts +21 -0
- package/dist/admin-files.d.ts.map +1 -0
- package/dist/admin-files.js +77 -0
- package/dist/admin-files.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +75 -0
- package/dist/cli.js.map +1 -0
- package/dist/connection.d.ts +25 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +62 -0
- package/dist/connection.js.map +1 -0
- package/dist/editor.d.ts +65 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +186 -0
- package/dist/editor.js.map +1 -0
- package/dist/entry-page.d.ts +37 -0
- package/dist/entry-page.d.ts.map +1 -0
- package/dist/entry-page.js +56 -0
- package/dist/entry-page.js.map +1 -0
- package/dist/form-post.d.ts +106 -0
- package/dist/form-post.d.ts.map +1 -0
- package/dist/form-post.js +291 -0
- package/dist/form-post.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +33 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +125 -0
- package/dist/init.js.map +1 -0
- package/dist/integration.d.ts +63 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +129 -0
- package/dist/integration.js.map +1 -0
- package/dist/link.d.ts +32 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +76 -0
- package/dist/link.js.map +1 -0
- package/dist/live-loader.d.ts +40 -0
- package/dist/live-loader.d.ts.map +1 -0
- package/dist/live-loader.js +92 -0
- package/dist/live-loader.js.map +1 -0
- package/dist/live-pages.d.ts +69 -0
- package/dist/live-pages.d.ts.map +1 -0
- package/dist/live-pages.js +94 -0
- package/dist/live-pages.js.map +1 -0
- package/dist/loader.d.ts +22 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +62 -0
- package/dist/loader.js.map +1 -0
- package/dist/media-store.d.ts +46 -0
- package/dist/media-store.d.ts.map +1 -0
- package/dist/media-store.js +154 -0
- package/dist/media-store.js.map +1 -0
- package/dist/menu.d.ts +51 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +81 -0
- package/dist/menu.js.map +1 -0
- package/dist/page-head.d.ts +23 -0
- package/dist/page-head.d.ts.map +1 -0
- package/dist/page-head.js +66 -0
- package/dist/page-head.js.map +1 -0
- package/dist/preview.d.ts +60 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +126 -0
- package/dist/preview.js.map +1 -0
- package/dist/resend-mailer.d.ts +46 -0
- package/dist/resend-mailer.d.ts.map +1 -0
- package/dist/resend-mailer.js +95 -0
- package/dist/resend-mailer.js.map +1 -0
- package/dist/secret.d.ts +8 -0
- package/dist/secret.d.ts.map +1 -0
- package/dist/secret.js +16 -0
- package/dist/secret.js.map +1 -0
- package/dist/site-editor.d.ts +41 -0
- package/dist/site-editor.d.ts.map +1 -0
- package/dist/site-editor.js +110 -0
- package/dist/site-editor.js.map +1 -0
- package/dist/site-forms.d.ts +43 -0
- package/dist/site-forms.d.ts.map +1 -0
- package/dist/site-forms.js +82 -0
- package/dist/site-forms.js.map +1 -0
- package/dist/site-images.d.ts +17 -0
- package/dist/site-images.d.ts.map +1 -0
- package/dist/site-images.js +22 -0
- package/dist/site-images.js.map +1 -0
- package/dist/site-media.d.ts +18 -0
- package/dist/site-media.d.ts.map +1 -0
- package/dist/site-media.js +43 -0
- package/dist/site-media.js.map +1 -0
- package/dist/site-plugins.d.ts +10 -0
- package/dist/site-plugins.d.ts.map +1 -0
- package/dist/site-plugins.js +23 -0
- package/dist/site-plugins.js.map +1 -0
- package/dist/site-search.d.ts +12 -0
- package/dist/site-search.d.ts.map +1 -0
- package/dist/site-search.js +79 -0
- package/dist/site-search.js.map +1 -0
- package/package.json +53 -3
- package/routes/admin.ts +10 -0
- package/routes/api.ts +15 -0
- package/routes/auth.ts +10 -0
- package/routes/due.ts +12 -0
- package/routes/editor.ts +48 -0
- package/routes/form-client.js.ts +105 -0
- package/routes/media.ts +10 -0
- package/routes/pages.ts +13 -0
- package/routes/plugins.ts +10 -0
- package/routes/preview-client.js.ts +63 -0
- package/routes/published.ts +29 -0
- package/routes/schedule.ts +20 -0
- package/routes/search-client.js.ts +33 -0
- package/routes/search.json.ts +10 -0
- package/routes/share-image.png.ts +33 -0
- package/routes/sitemap-live.xml.ts +13 -0
- package/routes/submit.ts +22 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Cms, type PublicEntry } from '@velocity-astro/cms-core';
|
|
2
|
+
import { type DrawnPage } from './page-head.js';
|
|
3
|
+
/** An entry found by the address of its own page. */
|
|
4
|
+
export interface EntryPage {
|
|
5
|
+
/** The key of its content type, e.g. `pages`. */
|
|
6
|
+
readonly type: string;
|
|
7
|
+
readonly locale: string;
|
|
8
|
+
/** The entry as the site reads it: values by field key, and each section of a page with its block's key. */
|
|
9
|
+
readonly entry: PublicEntry;
|
|
10
|
+
}
|
|
11
|
+
export interface EntryPageOptions {
|
|
12
|
+
/** The content types to look in, by key. Left out, every type with a page of its own. */
|
|
13
|
+
readonly types?: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The entry whose own page is at the address being drawn, or nothing when there is none. It is
|
|
17
|
+
* how one route draws every page people make in the editor:
|
|
18
|
+
*
|
|
19
|
+
* ```astro
|
|
20
|
+
* const page = await entryPage(Astro, { types: ['pages'] });
|
|
21
|
+
* if (!page) return new Response(null, { status: 404 });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Visitors get the published version; a preview gets the one being worked on. A fault is thrown,
|
|
25
|
+
* not answered as "no page": a page that exists must never look like one that does not.
|
|
26
|
+
*/
|
|
27
|
+
export declare function entryPage(page: DrawnPage, options?: EntryPageOptions): Promise<EntryPage | undefined>;
|
|
28
|
+
/** `entryPage` for a CMS already at hand. */
|
|
29
|
+
export declare function entryPageAt(cms: Cms, path: string, types?: readonly string[]): Promise<EntryPage | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* The address of every published page of the content types named, for the sitemap, search and
|
|
32
|
+
* share images. Pages made in the editor have no file the site could have listed them from.
|
|
33
|
+
*/
|
|
34
|
+
export declare function entryPageAddresses(types: readonly string[]): Promise<string[]>;
|
|
35
|
+
/** `entryPageAddresses` for a CMS already at hand. */
|
|
36
|
+
export declare function publishedAddresses(cms: Cms, types: readonly string[]): Promise<string[]>;
|
|
37
|
+
//# sourceMappingURL=entry-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-page.d.ts","sourceRoot":"","sources":["../src/entry-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,GAAG,EAAuB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAExG,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMxD,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4GAA4G;IAC5G,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAID;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAG/G;AAED,6CAA6C;AAC7C,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAGnH;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIpF;AAED,sDAAsD;AACtD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa9F"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { pageAddress } from '@velocity-astro/cms-core';
|
|
2
|
+
import { sharedConnection, SITE } from './connection.js';
|
|
3
|
+
import { pageAt } from './page-head.js';
|
|
4
|
+
/** The language of the pages at a type's `urlPattern`. */
|
|
5
|
+
const DEFAULT_LOCALE = 'en';
|
|
6
|
+
const PAGE_SIZE = 500;
|
|
7
|
+
const among = (types, keys) => (keys ? types.filter((type) => keys.includes(type.key)) : types);
|
|
8
|
+
/**
|
|
9
|
+
* The entry whose own page is at the address being drawn, or nothing when there is none. It is
|
|
10
|
+
* how one route draws every page people make in the editor:
|
|
11
|
+
*
|
|
12
|
+
* ```astro
|
|
13
|
+
* const page = await entryPage(Astro, { types: ['pages'] });
|
|
14
|
+
* if (!page) return new Response(null, { status: 404 });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Visitors get the published version; a preview gets the one being worked on. A fault is thrown,
|
|
18
|
+
* not answered as "no page": a page that exists must never look like one that does not.
|
|
19
|
+
*/
|
|
20
|
+
export async function entryPage(page, options = {}) {
|
|
21
|
+
const { cms } = await sharedConnection({});
|
|
22
|
+
return entryPageAt(cms, page.url.pathname, options.types);
|
|
23
|
+
}
|
|
24
|
+
/** `entryPage` for a CMS already at hand. */
|
|
25
|
+
export async function entryPageAt(cms, path, types) {
|
|
26
|
+
const found = await pageAt(cms, among(await cms.schema.list(), types), path);
|
|
27
|
+
return found.entry && found.type && found.locale !== undefined ? { type: found.type.key, locale: found.locale, entry: found.entry } : undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The address of every published page of the content types named, for the sitemap, search and
|
|
31
|
+
* share images. Pages made in the editor have no file the site could have listed them from.
|
|
32
|
+
*/
|
|
33
|
+
export async function entryPageAddresses(types) {
|
|
34
|
+
if (types.length === 0)
|
|
35
|
+
return [];
|
|
36
|
+
const { cms } = await sharedConnection({});
|
|
37
|
+
return publishedAddresses(cms, types);
|
|
38
|
+
}
|
|
39
|
+
/** `entryPageAddresses` for a CMS already at hand. */
|
|
40
|
+
export async function publishedAddresses(cms, types) {
|
|
41
|
+
const paths = [];
|
|
42
|
+
for (const type of among(await cms.schema.list(), types)) {
|
|
43
|
+
for (let offset = 0;; offset += PAGE_SIZE) {
|
|
44
|
+
const page = await cms.content.find(SITE, { typeId: type.id, status: 'published', limit: PAGE_SIZE, offset });
|
|
45
|
+
for (const entry of page.items) {
|
|
46
|
+
const address = entry.published && pageAddress(type, { locale: entry.locale, slug: entry.published.slug, data: entry.published.data }, DEFAULT_LOCALE);
|
|
47
|
+
if (address)
|
|
48
|
+
paths.push(address);
|
|
49
|
+
}
|
|
50
|
+
if (offset + page.items.length >= page.total || page.items.length === 0)
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return paths;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=entry-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-page.js","sourceRoot":"","sources":["../src/entry-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmD,MAAM,0BAA0B,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAkB,MAAM,gBAAgB,CAAC;AAExD,0DAA0D;AAC1D,MAAM,cAAc,G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,0 +1,106 @@
|
|
|
1
|
+
import { type Cms, type DealSubject } from '@velocity-astro/cms-core';
|
|
2
|
+
/** The names a form's page sends beside its own fields. A field's key never starts with `_`. */
|
|
3
|
+
export declare const FORM_TRAP_FIELD = "_hp";
|
|
4
|
+
export declare const FORM_TOKEN_FIELD = "_t";
|
|
5
|
+
export declare const FORM_PAGE_FIELD = "_page";
|
|
6
|
+
export declare const FORM_LOCALE_FIELD = "_locale";
|
|
7
|
+
export declare const FORM_ABOUT_FIELD = "_about";
|
|
8
|
+
/** The largest post a form may send: plenty for words, far too little to fill a disk. */
|
|
9
|
+
export declare const MAX_FORM_POST_BYTES: number;
|
|
10
|
+
/** Says whether one more post may be taken from an address. A host with many servers supplies a shared one. */
|
|
11
|
+
export interface RateLimiter {
|
|
12
|
+
/** True when the post may go ahead, which counts it. */
|
|
13
|
+
take(address: string): boolean | Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
/** Counts posts per address in this server's memory: `limit` in any stretch of `windowMs`. */
|
|
16
|
+
export declare class MemoryRateLimiter implements RateLimiter {
|
|
17
|
+
#private;
|
|
18
|
+
private readonly limit;
|
|
19
|
+
private readonly windowMs;
|
|
20
|
+
private readonly now;
|
|
21
|
+
constructor(limit?: number, windowMs?: number, now?: () => number);
|
|
22
|
+
take(address: string): boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Word to one of a form's people that it was filled in. */
|
|
25
|
+
export interface SubmissionNotice {
|
|
26
|
+
readonly to: string;
|
|
27
|
+
readonly siteName: string;
|
|
28
|
+
/** What the form is called. */
|
|
29
|
+
readonly formName: string;
|
|
30
|
+
/** Each answer, under its field's label, in the form's order. */
|
|
31
|
+
readonly answers: readonly {
|
|
32
|
+
readonly label: string;
|
|
33
|
+
readonly value: string;
|
|
34
|
+
}[];
|
|
35
|
+
/** The whole address of the page it was sent from. */
|
|
36
|
+
readonly page?: string;
|
|
37
|
+
/** The sender's email, so that a reply to the notice goes to them. */
|
|
38
|
+
readonly replyTo?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Delivers notices of submissions. A site's mailer that has this method is used for them. */
|
|
41
|
+
export interface NoticeMailer {
|
|
42
|
+
sendSubmissionNotice(mail: SubmissionNotice): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
/** The words of the pages a visitor without scripts is shown. Give your own for another language. */
|
|
45
|
+
export interface FormPostWords {
|
|
46
|
+
readonly sentTitle: string;
|
|
47
|
+
readonly sentMessage: string;
|
|
48
|
+
readonly problemsTitle: string;
|
|
49
|
+
readonly problemsHelp: string;
|
|
50
|
+
readonly back: string;
|
|
51
|
+
readonly tooMany: string;
|
|
52
|
+
readonly tooLarge: string;
|
|
53
|
+
readonly notAForm: string;
|
|
54
|
+
readonly elsewhere: string;
|
|
55
|
+
}
|
|
56
|
+
export declare const englishFormPostWords: FormPostWords;
|
|
57
|
+
export interface FormPostsOptions {
|
|
58
|
+
readonly cms: Cms;
|
|
59
|
+
/**
|
|
60
|
+
* The site's own address, which a post must come from when it says where it comes from. A
|
|
61
|
+
* function is asked for each post, for a site in development that has no fixed address yet.
|
|
62
|
+
*/
|
|
63
|
+
readonly origin: string | ((request: Request) => string);
|
|
64
|
+
readonly siteName: string;
|
|
65
|
+
/** The site's secret. It signs the mark that says when a form was drawn. Without it that check is off. */
|
|
66
|
+
readonly secret?: string | undefined;
|
|
67
|
+
/** Who delivers notices. Without one nobody is emailed; submissions are kept all the same. */
|
|
68
|
+
readonly mailer?: NoticeMailer | undefined;
|
|
69
|
+
readonly limiter?: RateLimiter;
|
|
70
|
+
/**
|
|
71
|
+
* The entry whose own page is at a path of the site, if any, so that what is sent from a
|
|
72
|
+
* listing's page is known to be about that listing. Asked only when the form's page did not
|
|
73
|
+
* say, with a signed mark, which entry it is about.
|
|
74
|
+
*/
|
|
75
|
+
readonly entryAt?: (path: string) => Promise<DealSubject | undefined>;
|
|
76
|
+
readonly words?: FormPostWords;
|
|
77
|
+
readonly now?: () => number;
|
|
78
|
+
/** Told what went wrong when a notice could not be sent. Never given what a visitor wrote. */
|
|
79
|
+
readonly onFault?: (error: unknown) => void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Takes what visitors send through the site's forms. It is the one address of the CMS that
|
|
83
|
+
* anyone may post to, so it is narrow: a small body, only from the site's own pages, only so
|
|
84
|
+
* many from one address, and nothing that was sent is ever written back into a page.
|
|
85
|
+
*/
|
|
86
|
+
export declare class FormPosts {
|
|
87
|
+
#private;
|
|
88
|
+
constructor(options: FormPostsOptions);
|
|
89
|
+
/**
|
|
90
|
+
* The mark a form's page sends back with a post: when the form was drawn, signed. A post
|
|
91
|
+
* without a true one, or one that follows it too closely, did not come from a person filling
|
|
92
|
+
* in the page. `undefined` when the site has no secret to sign with.
|
|
93
|
+
*/
|
|
94
|
+
token(formKey: string): Promise<string | undefined>;
|
|
95
|
+
/** Answers a post to a form's address. `address` is where it came from, when the server knows. */
|
|
96
|
+
handle(request: Request, formKey: string, address?: string): Promise<Response>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The mark a form's page sends along to say which entry it is about, signed with the site's
|
|
100
|
+
* secret so that only the site's own pages can say it. `undefined` without a secret, or for ids
|
|
101
|
+
* a mark cannot carry.
|
|
102
|
+
*/
|
|
103
|
+
export declare function aboutMark(secret: string | undefined, formKey: string, about: DealSubject): Promise<string | undefined>;
|
|
104
|
+
/** The mark for a form drawn at `drawn`, signed with the site's secret. `undefined` without a secret. */
|
|
105
|
+
export declare function formToken(secret: string | undefined, formKey: string, drawn?: number): Promise<string | undefined>;
|
|
106
|
+
//# sourceMappingURL=form-post.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-post.d.ts","sourceRoot":"","sources":["../src/form-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,GAAG,EAAE,KAAK,WAAW,EAAqD,MAAM,0BAA0B,CAAC;AAErK,gGAAgG;AAChG,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM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KAAK,IAAI,CAAC;CAC7C;AASD;;;;GAIG;AACH,qBAAa,SAAS;;gBAMR,OAAO,EAAE,gBAAgB;IAOrC;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAInD,kGAAkG;IAC5F,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAkHrF;AAWD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG5H;AAED,yGAAyG;AACzG,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAmB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEpI"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { NotFoundError, ValidationError, liveFields } from '@velocity-astro/cms-core';
|
|
2
|
+
/** The names a form's page sends beside its own fields. A field's key never starts with `_`. */
|
|
3
|
+
export const FORM_TRAP_FIELD = '_hp';
|
|
4
|
+
export const FORM_TOKEN_FIELD = '_t';
|
|
5
|
+
export const FORM_PAGE_FIELD = '_page';
|
|
6
|
+
export const FORM_LOCALE_FIELD = '_locale';
|
|
7
|
+
export const FORM_ABOUT_FIELD = '_about';
|
|
8
|
+
/** The largest post a form may send: plenty for words, far too little to fill a disk. */
|
|
9
|
+
export const MAX_FORM_POST_BYTES = 64 * 1024;
|
|
10
|
+
/** A person takes at least this long to fill in a form. What arrives sooner is suspected. */
|
|
11
|
+
const TOO_FAST_MS = 1500;
|
|
12
|
+
/** Counts posts per address in this server's memory: `limit` in any stretch of `windowMs`. */
|
|
13
|
+
export class MemoryRateLimiter {
|
|
14
|
+
limit;
|
|
15
|
+
windowMs;
|
|
16
|
+
now;
|
|
17
|
+
#taken = new Map();
|
|
18
|
+
constructor(limit = 8, windowMs = 10 * 60_000, now = Date.now) {
|
|
19
|
+
this.limit = limit;
|
|
20
|
+
this.windowMs = windowMs;
|
|
21
|
+
this.now = now;
|
|
22
|
+
}
|
|
23
|
+
take(address) {
|
|
24
|
+
const since = this.now() - this.windowMs;
|
|
25
|
+
// Forgets addresses that have gone quiet, so the list cannot grow without end.
|
|
26
|
+
if (this.#taken.size > 5000) {
|
|
27
|
+
for (const [known, times] of this.#taken)
|
|
28
|
+
if ((times.at(-1) ?? 0) <= since)
|
|
29
|
+
this.#taken.delete(known);
|
|
30
|
+
}
|
|
31
|
+
const times = (this.#taken.get(address) ?? []).filter((time) => time > since);
|
|
32
|
+
if (times.length >= this.limit) {
|
|
33
|
+
this.#taken.set(address, times);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
this.#taken.set(address, [...times, this.now()]);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const englishFormPostWords = {
|
|
41
|
+
sentTitle: 'Thank you',
|
|
42
|
+
sentMessage: 'Your message was sent.',
|
|
43
|
+
problemsTitle: 'A few answers need another look',
|
|
44
|
+
problemsHelp: 'Use your browser\'s Back button to return to the form. What you typed is still there.',
|
|
45
|
+
back: 'Back to the page',
|
|
46
|
+
tooMany: 'Too many messages were sent from here in a short time. Wait a few minutes and try again.',
|
|
47
|
+
tooLarge: 'That is more than this form can take. Shorten your message and try again.',
|
|
48
|
+
notAForm: 'This form is not taking messages.',
|
|
49
|
+
elsewhere: 'This form can only be sent from the site it is on.',
|
|
50
|
+
};
|
|
51
|
+
const encoder = new TextEncoder();
|
|
52
|
+
const hex = (bytes) => [...new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
53
|
+
const escaped = (text) => text.replace(/[&<>"']/g, (character) => `&#${character.charCodeAt(0)};`);
|
|
54
|
+
const isOwnPath = (page) => typeof page === 'string' && page.length <= 300 && /^\/(?!\/)[^\s\\]*$/.test(page);
|
|
55
|
+
const inLanguage = (text, locale) => text === undefined ? undefined : ((locale !== undefined ? text[locale] : undefined) ?? text['en'] ?? Object.values(text)[0]);
|
|
56
|
+
/**
|
|
57
|
+
* Takes what visitors send through the site's forms. It is the one address of the CMS that
|
|
58
|
+
* anyone may post to, so it is narrow: a small body, only from the site's own pages, only so
|
|
59
|
+
* many from one address, and nothing that was sent is ever written back into a page.
|
|
60
|
+
*/
|
|
61
|
+
export class FormPosts {
|
|
62
|
+
#options;
|
|
63
|
+
#limiter;
|
|
64
|
+
#words;
|
|
65
|
+
#now;
|
|
66
|
+
constructor(options) {
|
|
67
|
+
this.#options = options;
|
|
68
|
+
this.#limiter = options.limiter ?? new MemoryRateLimiter();
|
|
69
|
+
this.#words = options.words ?? englishFormPostWords;
|
|
70
|
+
this.#now = options.now ?? Date.now;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The mark a form's page sends back with a post: when the form was drawn, signed. A post
|
|
74
|
+
* without a true one, or one that follows it too closely, did not come from a person filling
|
|
75
|
+
* in the page. `undefined` when the site has no secret to sign with.
|
|
76
|
+
*/
|
|
77
|
+
token(formKey) {
|
|
78
|
+
return formToken(this.#options.secret, formKey, this.#now());
|
|
79
|
+
}
|
|
80
|
+
/** Answers a post to a form's address. `address` is where it came from, when the server knows. */
|
|
81
|
+
async handle(request, formKey, address) {
|
|
82
|
+
const wantsJson = (request.headers.get('accept') ?? '').includes('application/json') || (request.headers.get('content-type') ?? '').includes('application/json');
|
|
83
|
+
const refuse = (status, code, message, extra = {}) => wantsJson
|
|
84
|
+
? Response.json({ error: { code, message } }, { status, headers: { 'cache-control': 'no-store', ...extra } })
|
|
85
|
+
: this.#page(status, this.#words.problemsTitle, [message], undefined, extra);
|
|
86
|
+
if (request.method !== 'POST')
|
|
87
|
+
return refuse(405, 'method_not_allowed', this.#words.notAForm, { allow: 'POST' });
|
|
88
|
+
// A browser says where a post comes from. One that names another site is not from a page of this one.
|
|
89
|
+
const origin = typeof this.#options.origin === 'string' ? this.#options.origin : this.#options.origin(request);
|
|
90
|
+
const from = request.headers.get('origin');
|
|
91
|
+
if (from !== null && from !== origin)
|
|
92
|
+
return refuse(403, 'forbidden', this.#words.elsewhere);
|
|
93
|
+
if (address !== undefined && !(await this.#limiter.take(address)))
|
|
94
|
+
return refuse(429, 'too_many', this.#words.tooMany, { 'retry-after': '600' });
|
|
95
|
+
const sent = await readPost(request);
|
|
96
|
+
if (sent === 'too-large')
|
|
97
|
+
return refuse(413, 'too_large', this.#words.tooLarge);
|
|
98
|
+
if (sent === null)
|
|
99
|
+
return refuse(415, 'unsupported', this.#words.notAForm);
|
|
100
|
+
const page = isOwnPath(sent[FORM_PAGE_FIELD]) ? sent[FORM_PAGE_FIELD] : undefined;
|
|
101
|
+
const locale = typeof sent[FORM_LOCALE_FIELD] === 'string' ? sent[FORM_LOCALE_FIELD] : undefined;
|
|
102
|
+
const suspected = (typeof sent[FORM_TRAP_FIELD] === 'string' && sent[FORM_TRAP_FIELD] !== '') || !(await this.#drawnForAPerson(formKey, sent[FORM_TOKEN_FIELD]));
|
|
103
|
+
// A page that cannot be looked up costs the submission nothing but its subject.
|
|
104
|
+
const about = (await this.#marked(formKey, sent[FORM_ABOUT_FIELD])) ?? (page === undefined ? undefined : await this.#options.entryAt?.(page).catch(() => undefined));
|
|
105
|
+
try {
|
|
106
|
+
const { submission, form } = await this.#options.cms.submissions.receive(formKey, sent, { suspected, ...(page !== undefined && { page }), ...(locale !== undefined && { locale }), ...(about !== undefined && { about }) });
|
|
107
|
+
// Whoever the form names is told. A notice that cannot be sent never loses the submission.
|
|
108
|
+
if (submission.status === 'new')
|
|
109
|
+
await this.#notify(form, submission, origin);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (error instanceof NotFoundError)
|
|
113
|
+
return refuse(404, 'not_found', this.#words.notAForm);
|
|
114
|
+
if (!(error instanceof ValidationError))
|
|
115
|
+
throw error;
|
|
116
|
+
if (wantsJson) {
|
|
117
|
+
return Response.json({ error: { code: error.code, message: error.message, issues: error.issues } }, { status: 422, headers: { 'cache-control': 'no-store' } });
|
|
118
|
+
}
|
|
119
|
+
// The form's own labels and the checks' own words: nothing the visitor typed.
|
|
120
|
+
const form = await this.#options.cms.forms.forSite(formKey);
|
|
121
|
+
const lines = error.issues.map((issue) => {
|
|
122
|
+
const field = form?.fields.find((candidate) => candidate.key === issue.path[0]);
|
|
123
|
+
return `${inLanguage(field?.label, locale) ?? String(issue.path[0] ?? '')}: ${issue.message}`;
|
|
124
|
+
});
|
|
125
|
+
return this.#page(422, this.#words.problemsTitle, [...lines, this.#words.problemsHelp], page);
|
|
126
|
+
}
|
|
127
|
+
const form = await this.#options.cms.forms.forSite(formKey);
|
|
128
|
+
const message = inLanguage(form?.success, locale) ?? this.#words.sentMessage;
|
|
129
|
+
return wantsJson
|
|
130
|
+
? Response.json({ ok: true, message }, { headers: { 'cache-control': 'no-store' } })
|
|
131
|
+
: this.#page(200, this.#words.sentTitle, [message], page ?? '/');
|
|
132
|
+
}
|
|
133
|
+
async #notify(form, submission, origin) {
|
|
134
|
+
const { mailer, siteName, onFault } = this.#options;
|
|
135
|
+
if (form.notify.length === 0)
|
|
136
|
+
return;
|
|
137
|
+
if (!mailer) {
|
|
138
|
+
onFault?.(new Error(`The form "${form.key}" was sent, and nobody was emailed: no email provider is set up. The submission is kept in the CMS.`));
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const answers = liveFields(form.fields).flatMap((field) => {
|
|
142
|
+
const value = submission.data[field.id];
|
|
143
|
+
if (value === undefined)
|
|
144
|
+
return [];
|
|
145
|
+
return [{ label: inLanguage(field.label, submission.locale) ?? field.key, value: value === true ? '✓' : String(value) }];
|
|
146
|
+
});
|
|
147
|
+
const notice = {
|
|
148
|
+
siteName,
|
|
149
|
+
formName: inLanguage(form.label, submission.locale) ?? form.key,
|
|
150
|
+
answers,
|
|
151
|
+
...(submission.page !== undefined && { page: `${origin}${submission.page}` }),
|
|
152
|
+
...(submission.email !== undefined && { replyTo: submission.email }),
|
|
153
|
+
};
|
|
154
|
+
for (const to of form.notify) {
|
|
155
|
+
// The fault is told without the notice: a log is not the place for what a visitor wrote.
|
|
156
|
+
await mailer.sendSubmissionNotice({ ...notice, to }).catch((error) => onFault?.(new Error(`A notice for the form "${form.key}" could not be sent. ${error instanceof Error ? error.message : ''}`)));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Whether the post carries a true mark of when its form was drawn, from long enough ago. */
|
|
160
|
+
async #drawnForAPerson(formKey, token) {
|
|
161
|
+
if (this.#options.secret === undefined)
|
|
162
|
+
return true;
|
|
163
|
+
if (typeof token !== 'string')
|
|
164
|
+
return false;
|
|
165
|
+
const [drawn = '', signature = ''] = token.split('.');
|
|
166
|
+
if (!/^\d{1,16}$/.test(drawn) || !/^[0-9a-f]{64}$/.test(signature))
|
|
167
|
+
return false;
|
|
168
|
+
const expected = await this.#sign(formKey, drawn);
|
|
169
|
+
if (expected === undefined || !sameText(expected, signature))
|
|
170
|
+
return false;
|
|
171
|
+
return this.#now() - Number(drawn) >= TOO_FAST_MS;
|
|
172
|
+
}
|
|
173
|
+
async #sign(formKey, drawn) {
|
|
174
|
+
const { secret } = this.#options;
|
|
175
|
+
return secret === undefined ? undefined : sign(secret, `form:${formKey}:${drawn}`);
|
|
176
|
+
}
|
|
177
|
+
/** The entry a form's page said it is about, when the mark is one this site signed for this form. */
|
|
178
|
+
async #marked(formKey, mark) {
|
|
179
|
+
const { secret } = this.#options;
|
|
180
|
+
if (secret === undefined || typeof mark !== 'string' || mark.length > 400)
|
|
181
|
+
return undefined;
|
|
182
|
+
const [typeId = '', entry = '', signature = ''] = mark.split('.');
|
|
183
|
+
if (!ID.test(typeId) || !ID.test(entry) || !/^[0-9a-f]{64}$/.test(signature))
|
|
184
|
+
return undefined;
|
|
185
|
+
return sameText(await sign(secret, aboutText(formKey, typeId, entry)), signature) ? { typeId, entry } : undefined;
|
|
186
|
+
}
|
|
187
|
+
/** A plain page for a visitor whose browser runs no scripts. Every word in it is the site's own, escaped. */
|
|
188
|
+
#page(status, title, lines, back, headers = {}) {
|
|
189
|
+
const html = [
|
|
190
|
+
'<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex">',
|
|
191
|
+
`<title>${escaped(title)} · ${escaped(this.#options.siteName)}</title>`,
|
|
192
|
+
'<style>body{margin:0;font:1rem/1.6 system-ui,sans-serif;color:#1a1a1a;background:#fafafa}main{max-width:32rem;margin:15vh auto;padding:0 1.5rem}h1{font-size:1.5rem;margin:0 0 1rem}p{margin:0 0 .75rem}a{color:inherit}@media(prefers-color-scheme:dark){body{color:#eee;background:#111}}</style>',
|
|
193
|
+
`</head><body><main><h1>${escaped(title)}</h1>`,
|
|
194
|
+
...lines.map((line) => `<p>${escaped(line)}</p>`),
|
|
195
|
+
back === undefined ? '' : `<p><a href="${escaped(back)}">${escaped(this.#words.back)}</a></p>`,
|
|
196
|
+
'</main></body></html>',
|
|
197
|
+
].join('');
|
|
198
|
+
return new Response(html, { status, headers: { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-store', 'content-security-policy': "default-src 'none'; style-src 'unsafe-inline'", ...headers } });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async function sign(secret, text) {
|
|
202
|
+
const key = await globalThis.crypto.subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
|
|
203
|
+
return hex(await globalThis.crypto.subtle.sign('HMAC', key, encoder.encode(text)));
|
|
204
|
+
}
|
|
205
|
+
/** What an id may be made of, so a mark splits into its parts one way only. */
|
|
206
|
+
const ID = /^[A-Za-z0-9_-]{1,100}$/;
|
|
207
|
+
const aboutText = (formKey, typeId, entry) => `about:${formKey}:${typeId}:${entry}`;
|
|
208
|
+
/**
|
|
209
|
+
* The mark a form's page sends along to say which entry it is about, signed with the site's
|
|
210
|
+
* secret so that only the site's own pages can say it. `undefined` without a secret, or for ids
|
|
211
|
+
* a mark cannot carry.
|
|
212
|
+
*/
|
|
213
|
+
export async function aboutMark(secret, formKey, about) {
|
|
214
|
+
if (secret === undefined || !ID.test(about.typeId) || !ID.test(about.entry))
|
|
215
|
+
return undefined;
|
|
216
|
+
return `${about.typeId}.${about.entry}.${await sign(secret, aboutText(formKey, about.typeId, about.entry))}`;
|
|
217
|
+
}
|
|
218
|
+
/** The mark for a form drawn at `drawn`, signed with the site's secret. `undefined` without a secret. */
|
|
219
|
+
export async function formToken(secret, formKey, drawn = Date.now()) {
|
|
220
|
+
return secret === undefined ? undefined : `${drawn}.${await sign(secret, `form:${formKey}:${drawn}`)}`;
|
|
221
|
+
}
|
|
222
|
+
/** Compares two texts of the same length without stopping at the first difference. */
|
|
223
|
+
function sameText(a, b) {
|
|
224
|
+
if (a.length !== b.length)
|
|
225
|
+
return false;
|
|
226
|
+
let difference = 0;
|
|
227
|
+
for (let index = 0; index < a.length; index += 1)
|
|
228
|
+
difference |= a.charCodeAt(index) ^ b.charCodeAt(index);
|
|
229
|
+
return difference === 0;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* What a post holds, by name: a plain form's fields or a script's JSON. `null` for a body that
|
|
233
|
+
* is neither, `too-large` for one over the limit. Files are left out: forms take none yet.
|
|
234
|
+
*/
|
|
235
|
+
async function readPost(request) {
|
|
236
|
+
const type = request.headers.get('content-type') ?? '';
|
|
237
|
+
if (Number(request.headers.get('content-length') ?? 0) > MAX_FORM_POST_BYTES)
|
|
238
|
+
return 'too-large';
|
|
239
|
+
const bytes = await readLimited(request);
|
|
240
|
+
if (bytes === null)
|
|
241
|
+
return 'too-large';
|
|
242
|
+
if (type.includes('application/json')) {
|
|
243
|
+
try {
|
|
244
|
+
const body = JSON.parse(new TextDecoder().decode(bytes));
|
|
245
|
+
return typeof body === 'object' && body !== null && !Array.isArray(body) ? { ...body } : null;
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (!type.includes('application/x-www-form-urlencoded') && !type.includes('multipart/form-data'))
|
|
252
|
+
return null;
|
|
253
|
+
try {
|
|
254
|
+
const data = await new Response(bytes, { headers: { 'content-type': type } }).formData();
|
|
255
|
+
const sent = {};
|
|
256
|
+
for (const [name, value] of data)
|
|
257
|
+
if (typeof value === 'string')
|
|
258
|
+
sent[name] = value;
|
|
259
|
+
return sent;
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/** The body, or `null` once it has passed the limit, however long it said it was. */
|
|
266
|
+
async function readLimited(request) {
|
|
267
|
+
if (!request.body)
|
|
268
|
+
return new Uint8Array();
|
|
269
|
+
const reader = request.body.getReader();
|
|
270
|
+
const chunks = [];
|
|
271
|
+
let size = 0;
|
|
272
|
+
for (;;) {
|
|
273
|
+
const { done, value } = await reader.read();
|
|
274
|
+
if (done)
|
|
275
|
+
break;
|
|
276
|
+
size += value.byteLength;
|
|
277
|
+
if (size > MAX_FORM_POST_BYTES) {
|
|
278
|
+
await reader.cancel();
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
chunks.push(value);
|
|
282
|
+
}
|
|
283
|
+
const bytes = new Uint8Array(size);
|
|
284
|
+
let offset = 0;
|
|
285
|
+
for (const chunk of chunks) {
|
|
286
|
+
bytes.set(chunk, offset);
|
|
287
|
+
offset += chunk.byteLength;
|
|
288
|
+
}
|
|
289
|
+
return bytes;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=form-post.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-post.js","sourceRoot":"","sources":["../src/form-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe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AAQ;gBAAE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACpF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,qFAAqF;AACrF,KAAK,UAAU,WAAW,CAAC,OAAgB;IACzC,IAAI,CAAC,OAAO,CAAC,IAAI;QAAE,OAAO,IAAI,UAAU,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACxC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,SAAS,CAAC;QACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI;YAAE,MAAM;QAChB,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC;QACzB,IAAI,IAAI,GAAG,mBAAmB,EAAE,CAAC;YAC/B,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC;IAC7B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { sharedConnection, type Connection, type ConnectionOptions } from './connection.js';
|
|
2
|
+
export { AdminFiles, type EditorPageConfig } from './admin-files.js';
|
|
3
|
+
export { EditorHost, LogMailer, type EditorHostOptions } from './editor.js';
|
|
4
|
+
export { default, type VelocityCmsOptions } from './integration.js';
|
|
5
|
+
export { ResendMailer, englishMailWords, mailerFromEnv, type MailWords, type ResendMailerOptions } from './resend-mailer.js';
|
|
6
|
+
export { definePlugin, type PluginContext, type PluginDefinition } from '@velocity-astro/cms-core';
|
|
7
|
+
export { registerSitePlugins } from './site-plugins.js';
|
|
8
|
+
export { EditorNotSetUpError, editorOrigin, pagesOrigin, siteEditorHost, withEditor, type SiteEditorSettings } from './site-editor.js';
|
|
9
|
+
export { cmsLiveLoader, entryTag, invalidateLiveContent, liveContentVersion, typeTag, type CmsCollectionFilter, type CmsEntryFilter, type CmsLiveLoaderOptions, } from './live-loader.js';
|
|
10
|
+
export { isEditorPreview, isPreview } from './preview.js';
|
|
11
|
+
export { pageHead, type DrawnPage } from './page-head.js';
|
|
12
|
+
export { entryPage, entryPageAddresses, type EntryPage, type EntryPageOptions } from './entry-page.js';
|
|
13
|
+
export { linkTo, type LinkTarget } from './link.js';
|
|
14
|
+
export { FORM_ABOUT_FIELD, FORM_LOCALE_FIELD, FORM_PAGE_FIELD, FORM_TOKEN_FIELD, FORM_TRAP_FIELD, FormPosts, MemoryRateLimiter, aboutMark, englishFormPostWords, type FormPostWords, type FormPostsOptions, type NoticeMailer, type RateLimiter, type SubmissionNotice, } from './form-post.js';
|
|
15
|
+
export { FORM_SCRIPT, siteForm, siteFormPosts, type FormChoice, type SiteForm, type SiteFormOptions } from './site-forms.js';
|
|
16
|
+
export { menuLinks, type MenuColumn, type MenuLink, type MenuOptions } from './menu.js';
|
|
17
|
+
export type { PageHead } from '@velocity-astro/cms-core';
|
|
18
|
+
export { cmsLoader, type CmsLoaderOptions } from './loader.js';
|
|
19
|
+
export { liveAddresses, liveCollections, matchLocalizedPage, matchParams, type LiveAddress, type PageModule, type PageSources, type StaticPath, } from './live-pages.js';
|
|
20
|
+
export { FolderMediaStore, S3MediaStore, mediaStoreFromEnv, type S3MediaStoreOptions } from './media-store.js';
|
|
21
|
+
export { hasSiteSecret } from './secret.js';
|
|
22
|
+
export { refreshUploadedImages, uploadedFile, uploadedImage } from './site-media.js';
|
|
23
|
+
export { folderImages, type ImageFile } from './site-images.js';
|
|
24
|
+
export { indexPages, indexSite, searchSite, toSearchDocument } from './site-search.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE7H,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvI,OAAO,EACL,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cA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,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { sharedConnection } from './connection.js';
|
|
2
|
+
export { AdminFiles } from './admin-files.js';
|
|
3
|
+
export { EditorHost, LogMailer } from './editor.js';
|
|
4
|
+
export { default } from './integration.js';
|
|
5
|
+
export { ResendMailer, englishMailWords, mailerFromEnv } from './resend-mailer.js';
|
|
6
|
+
// What a site's own plugin file needs, so it imports from the one package the site installed.
|
|
7
|
+
export { definePlugin } from '@velocity-astro/cms-core';
|
|
8
|
+
export { registerSitePlugins } from './site-plugins.js';
|
|
9
|
+
export { EditorNotSetUpError, editorOrigin, pagesOrigin, siteEditorHost, withEditor } from './site-editor.js';
|
|
10
|
+
export { cmsLiveLoader, entryTag, invalidateLiveContent, liveContentVersion, typeTag, } from './live-loader.js';
|
|
11
|
+
export { isEditorPreview, isPreview } from './preview.js';
|
|
12
|
+
export { pageHead } from './page-head.js';
|
|
13
|
+
export { entryPage, entryPageAddresses } from './entry-page.js';
|
|
14
|
+
export { linkTo } from './link.js';
|
|
15
|
+
export { FORM_ABOUT_FIELD, FORM_LOCALE_FIELD, FORM_PAGE_FIELD, FORM_TOKEN_FIELD, FORM_TRAP_FIELD, FormPosts, MemoryRateLimiter, aboutMark, englishFormPostWords, } from './form-post.js';
|
|
16
|
+
export { FORM_SCRIPT, siteForm, siteFormPosts } from './site-forms.js';
|
|
17
|
+
export { menuLinks } from './menu.js';
|
|
18
|
+
export { cmsLoader } from './loader.js';
|
|
19
|
+
export { liveAddresses, liveCollections, matchLocalizedPage, matchParams, } from './live-pages.js';
|
|
20
|
+
export { FolderMediaStore, S3MediaStore, mediaStoreFromEnv } from './media-store.js';
|
|
21
|
+
export { hasSiteSecret } from './secret.js';
|
|
22
|
+
export { refreshUploadedImages, uploadedFile, uploadedImage } from './site-media.js';
|
|
23
|
+
export { folderImages } from './site-images.js';
|
|
24
|
+
export { indexPages, indexSite, searchSite, toSearchDocument } from './site-search.js';
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA2C,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,SAAS,EAA0B,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,OAAO,EAA2B,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAA4C,MAAM,oBAAoB,CAAC;AAC7H,8FAA8F;AAC9F,OAAO,EAAE,YAAY,EAA6C,MAAM,0BAA0B,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAA2B,MAAM,kBAAkB,CAAC;AACvI,OAAO,EACL,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,GAIR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAyC,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,MAAM,EAAmB,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,iBAAiB,E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