@glw907/cairn-cms 0.60.1 → 0.62.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/CHANGELOG.md +69 -0
- package/dist/components/AdminLayout.svelte +22 -0
- package/dist/components/CairnAdmin.svelte +3 -0
- package/dist/components/CairnTidySettings.svelte +2 -2
- package/dist/components/CairnTidySettings.svelte.d.ts +1 -1
- package/dist/components/EditPage.svelte +116 -39
- package/dist/components/HelpHome.svelte +824 -0
- package/dist/components/HelpHome.svelte.d.ts +22 -0
- package/dist/components/MarkdownHelpDialog.svelte +4 -15
- package/dist/components/client-ingest.d.ts +16 -8
- package/dist/components/client-ingest.js +12 -6
- package/dist/components/editor-media.js +16 -8
- package/dist/components/editor-placeholder.d.ts +4 -2
- package/dist/components/editor-tidy.d.ts +24 -12
- package/dist/components/editor-tidy.js +8 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/link-completion.d.ts +12 -6
- package/dist/components/link-completion.js +12 -6
- package/dist/components/markdown-directives.d.ts +9 -6
- package/dist/components/markdown-directives.js +9 -6
- package/dist/components/markdown-format.d.ts +7 -2
- package/dist/components/markdown-format.js +59 -28
- package/dist/components/markdown-reference.d.ts +8 -0
- package/dist/components/markdown-reference.js +22 -0
- package/dist/components/media-upload-outcome.d.ts +12 -6
- package/dist/components/objective-errors.d.ts +8 -4
- package/dist/components/objective-errors.js +8 -4
- package/dist/components/preview-doc.d.ts +4 -2
- package/dist/components/preview-doc.js +4 -2
- package/dist/components/spellcheck.d.ts +55 -29
- package/dist/components/spellcheck.js +39 -21
- package/dist/components/tidy-categorize.d.ts +20 -10
- package/dist/components/tidy-categorize.js +16 -8
- package/dist/components/tidy-validate.d.ts +12 -6
- package/dist/components/tidy-validate.js +20 -10
- package/dist/components/topbar-context.d.ts +4 -2
- package/dist/content/advisories.d.ts +51 -0
- package/dist/content/advisories.js +79 -0
- package/dist/content/compose.d.ts +4 -2
- package/dist/content/compose.js +1 -0
- package/dist/content/excerpt.js +4 -2
- package/dist/content/getting-started.d.ts +18 -0
- package/dist/content/getting-started.js +12 -0
- package/dist/content/links.d.ts +16 -8
- package/dist/content/links.js +12 -6
- package/dist/content/manifest.d.ts +36 -18
- package/dist/content/manifest.js +32 -16
- package/dist/content/media-refs.d.ts +4 -2
- package/dist/content/media-refs.js +4 -2
- package/dist/content/media-rewrite.d.ts +8 -4
- package/dist/content/media-rewrite.js +76 -38
- package/dist/content/schema.d.ts +20 -10
- package/dist/content/site-dictionary.d.ts +4 -2
- package/dist/content/site-dictionary.js +8 -4
- package/dist/content/types.d.ts +97 -42
- package/dist/delivery/content-index.d.ts +16 -8
- package/dist/delivery/feeds.js +4 -2
- package/dist/delivery/json-ld.d.ts +3 -0
- package/dist/delivery/json-ld.js +3 -0
- package/dist/delivery/manifest.d.ts +4 -2
- package/dist/delivery/manifest.js +4 -2
- package/dist/delivery/public-routes.d.ts +12 -6
- package/dist/delivery/public-routes.js +4 -2
- package/dist/delivery/seo-fields.d.ts +12 -6
- package/dist/delivery/seo-fields.js +8 -4
- package/dist/delivery/site-indexes.d.ts +4 -2
- package/dist/delivery/site-resolver.d.ts +4 -2
- package/dist/delivery/site-resolver.js +4 -2
- package/dist/doctor/cloudflare-api.d.ts +6 -0
- package/dist/doctor/cloudflare-api.js +6 -0
- package/dist/doctor/index.d.ts +12 -6
- package/dist/doctor/report.d.ts +3 -0
- package/dist/doctor/report.js +3 -0
- package/dist/doctor/run.d.ts +3 -0
- package/dist/doctor/run.js +3 -0
- package/dist/doctor/types.d.ts +10 -2
- package/dist/doctor/types.js +6 -0
- package/dist/doctor/wrangler-config.d.ts +7 -2
- package/dist/doctor/wrangler-config.js +3 -0
- package/dist/email.d.ts +4 -2
- package/dist/env.d.ts +0 -3
- package/dist/env.js +0 -3
- package/dist/github/branches.d.ts +4 -2
- package/dist/github/branches.js +4 -2
- package/dist/github/signing.d.ts +1 -1
- package/dist/github/signing.js +2 -2
- package/dist/log/events.d.ts +1 -1
- package/dist/media/bulk-delete-plan.d.ts +8 -4
- package/dist/media/config.d.ts +12 -6
- package/dist/media/config.js +16 -8
- package/dist/media/delivery-bucket.d.ts +4 -2
- package/dist/media/library-entry.d.ts +4 -2
- package/dist/media/library-entry.js +4 -2
- package/dist/media/manifest.d.ts +29 -15
- package/dist/media/manifest.js +29 -16
- package/dist/media/naming.d.ts +12 -6
- package/dist/media/naming.js +24 -12
- package/dist/media/orphan-scan.d.ts +4 -2
- package/dist/media/reconcile.d.ts +21 -11
- package/dist/media/reconcile.js +12 -6
- package/dist/media/reference.d.ts +8 -4
- package/dist/media/reference.js +12 -6
- package/dist/media/rewrite-plan.d.ts +12 -6
- package/dist/media/sniff.d.ts +4 -2
- package/dist/media/sniff.js +28 -14
- package/dist/media/store.d.ts +16 -8
- package/dist/media/store.js +4 -2
- package/dist/media/transform-url.d.ts +12 -6
- package/dist/media/transform-url.js +8 -4
- package/dist/media/usage.d.ts +8 -4
- package/dist/nav/site-config.d.ts +16 -8
- package/dist/render/component-grammar.d.ts +23 -10
- package/dist/render/component-grammar.js +19 -8
- package/dist/render/component-insert.d.ts +8 -4
- package/dist/render/component-insert.js +4 -2
- package/dist/render/component-reference.d.ts +4 -2
- package/dist/render/component-reference.js +4 -2
- package/dist/render/component-validate.d.ts +3 -0
- package/dist/render/component-validate.js +3 -0
- package/dist/render/glyph.d.ts +4 -2
- package/dist/render/glyph.js +4 -2
- package/dist/render/pipeline.d.ts +20 -10
- package/dist/render/pipeline.js +4 -2
- package/dist/render/registry.d.ts +40 -20
- package/dist/render/registry.js +16 -8
- package/dist/render/rehype-dispatch.d.ts +22 -8
- package/dist/render/rehype-dispatch.js +22 -8
- package/dist/render/remark-directives.d.ts +3 -0
- package/dist/render/remark-directives.js +3 -0
- package/dist/render/remark-figure.d.ts +4 -2
- package/dist/render/remark-figure.js +4 -2
- package/dist/render/resolve-links.d.ts +4 -2
- package/dist/render/resolve-links.js +4 -2
- package/dist/render/resolve-media.d.ts +16 -8
- package/dist/render/resolve-media.js +12 -6
- package/dist/sveltekit/admin-dispatch.d.ts +2 -0
- package/dist/sveltekit/admin-dispatch.js +9 -3
- package/dist/sveltekit/auth-routes.d.ts +3 -0
- package/dist/sveltekit/auth-routes.js +3 -0
- package/dist/sveltekit/cairn-admin.d.ts +16 -5
- package/dist/sveltekit/cairn-admin.js +26 -10
- package/dist/sveltekit/content-routes.d.ts +191 -86
- package/dist/sveltekit/content-routes.js +295 -107
- package/dist/sveltekit/editors-routes.d.ts +3 -0
- package/dist/sveltekit/editors-routes.js +3 -0
- package/dist/sveltekit/guard.d.ts +4 -2
- package/dist/sveltekit/guard.js +4 -2
- package/dist/sveltekit/https-required-page.d.ts +1 -1
- package/dist/sveltekit/https-required-page.js +1 -1
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/sveltekit/media-route.d.ts +1 -2
- package/dist/sveltekit/media-route.js +13 -8
- package/dist/sveltekit/nav-routes.d.ts +7 -2
- package/dist/sveltekit/nav-routes.js +3 -0
- package/dist/sveltekit/types.d.ts +4 -2
- package/dist/vite/index.d.ts +32 -16
- package/dist/vite/index.js +52 -26
- package/dist/vite/resolve-root.d.ts +8 -4
- package/dist/vite/resolve-root.js +4 -2
- package/package.json +7 -1
- package/src/lib/components/AdminLayout.svelte +22 -0
- package/src/lib/components/CairnAdmin.svelte +3 -0
- package/src/lib/components/CairnTidySettings.svelte +2 -2
- package/src/lib/components/ComponentForm.svelte +0 -1
- package/src/lib/components/EditPage.svelte +133 -41
- package/src/lib/components/HelpHome.svelte +850 -0
- package/src/lib/components/MarkdownHelpDialog.svelte +4 -15
- package/src/lib/components/client-ingest.ts +20 -10
- package/src/lib/components/editor-media.ts +20 -10
- package/src/lib/components/editor-placeholder.ts +12 -6
- package/src/lib/components/editor-tidy.ts +28 -14
- package/src/lib/components/index.ts +1 -0
- package/src/lib/components/link-completion.ts +12 -6
- package/src/lib/components/markdown-directives.ts +13 -8
- package/src/lib/components/markdown-format.ts +63 -30
- package/src/lib/components/markdown-reference.ts +30 -0
- package/src/lib/components/media-upload-outcome.ts +12 -6
- package/src/lib/components/objective-errors.ts +16 -8
- package/src/lib/components/preview-doc.ts +4 -2
- package/src/lib/components/spellcheck.ts +79 -41
- package/src/lib/components/tidy-categorize.ts +28 -14
- package/src/lib/components/tidy-validate.ts +28 -14
- package/src/lib/components/topbar-context.ts +4 -2
- package/src/lib/content/advisories.ts +141 -0
- package/src/lib/content/compose.ts +5 -2
- package/src/lib/content/excerpt.ts +4 -2
- package/src/lib/content/getting-started.ts +31 -0
- package/src/lib/content/links.ts +16 -8
- package/src/lib/content/manifest.ts +36 -18
- package/src/lib/content/media-refs.ts +4 -2
- package/src/lib/content/media-rewrite.ts +100 -50
- package/src/lib/content/schema.ts +20 -10
- package/src/lib/content/site-dictionary.ts +8 -4
- package/src/lib/content/types.ts +97 -42
- package/src/lib/delivery/content-index.ts +16 -8
- package/src/lib/delivery/feeds.ts +4 -2
- package/src/lib/delivery/json-ld.ts +3 -0
- package/src/lib/delivery/manifest.ts +4 -2
- package/src/lib/delivery/public-routes.ts +16 -8
- package/src/lib/delivery/seo-fields.ts +12 -6
- package/src/lib/delivery/site-indexes.ts +4 -2
- package/src/lib/delivery/site-resolver.ts +4 -2
- package/src/lib/doctor/cloudflare-api.ts +6 -0
- package/src/lib/doctor/index.ts +12 -6
- package/src/lib/doctor/report.ts +3 -0
- package/src/lib/doctor/run.ts +3 -0
- package/src/lib/doctor/types.ts +10 -2
- package/src/lib/doctor/wrangler-config.ts +7 -2
- package/src/lib/email.ts +4 -2
- package/src/lib/env.ts +0 -3
- package/src/lib/github/branches.ts +4 -2
- package/src/lib/github/signing.ts +2 -2
- package/src/lib/log/events.ts +1 -0
- package/src/lib/media/bulk-delete-plan.ts +8 -4
- package/src/lib/media/config.ts +24 -12
- package/src/lib/media/delivery-bucket.ts +4 -2
- package/src/lib/media/library-entry.ts +4 -2
- package/src/lib/media/manifest.ts +33 -18
- package/src/lib/media/naming.ts +24 -12
- package/src/lib/media/orphan-scan.ts +4 -2
- package/src/lib/media/reconcile.ts +21 -11
- package/src/lib/media/reference.ts +12 -6
- package/src/lib/media/rewrite-plan.ts +12 -6
- package/src/lib/media/sniff.ts +28 -14
- package/src/lib/media/store.ts +16 -8
- package/src/lib/media/transform-url.ts +12 -6
- package/src/lib/media/usage.ts +8 -4
- package/src/lib/nav/site-config.ts +16 -8
- package/src/lib/render/component-grammar.ts +23 -10
- package/src/lib/render/component-insert.ts +8 -4
- package/src/lib/render/component-reference.ts +4 -2
- package/src/lib/render/component-validate.ts +3 -0
- package/src/lib/render/glyph.ts +4 -2
- package/src/lib/render/pipeline.ts +20 -10
- package/src/lib/render/registry.ts +44 -22
- package/src/lib/render/rehype-dispatch.ts +22 -8
- package/src/lib/render/remark-directives.ts +3 -0
- package/src/lib/render/remark-figure.ts +4 -2
- package/src/lib/render/resolve-links.ts +4 -2
- package/src/lib/render/resolve-media.ts +16 -8
- package/src/lib/sveltekit/admin-dispatch.ts +10 -4
- package/src/lib/sveltekit/auth-routes.ts +3 -0
- package/src/lib/sveltekit/cairn-admin.ts +37 -15
- package/src/lib/sveltekit/content-routes.ts +492 -197
- package/src/lib/sveltekit/editors-routes.ts +3 -0
- package/src/lib/sveltekit/guard.ts +4 -2
- package/src/lib/sveltekit/https-required-page.ts +1 -1
- package/src/lib/sveltekit/index.ts +3 -0
- package/src/lib/sveltekit/media-route.ts +13 -8
- package/src/lib/sveltekit/nav-routes.ts +7 -2
- package/src/lib/sveltekit/types.ts +4 -2
- package/src/lib/vite/index.ts +60 -30
- package/src/lib/vite/resolve-root.ts +8 -4
|
@@ -16,11 +16,13 @@ const HEADER = '# cairn personal dictionary: one word per line, sorted, kept in
|
|
|
16
16
|
// the test is for whitespace and control bytes rather than an allow-list of letters. The action runs
|
|
17
17
|
// inbound words through this before a merge.
|
|
18
18
|
const WORD_RE = /^[^\s\p{Cc}]+$/u;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* True when a word is a single valid dictionary line (no whitespace, no control characters, non-empty
|
|
20
21
|
* and within the length bound). A leading "#" is rejected: parseDictionary re-reads such a line as a
|
|
21
22
|
* comment, so committing it would silently drop the word on the next read. The action uses this to
|
|
22
23
|
* reject untrusted input before the merge, so a newline or a control byte can never inject an extra
|
|
23
|
-
* line into the committed file.
|
|
24
|
+
* line into the committed file.
|
|
25
|
+
*/
|
|
24
26
|
export function isValidDictionaryWord(word, maxLength = 64) {
|
|
25
27
|
if (word.startsWith('#'))
|
|
26
28
|
return false;
|
|
@@ -45,8 +47,10 @@ export function parseDictionary(text) {
|
|
|
45
47
|
}
|
|
46
48
|
return words;
|
|
47
49
|
}
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
+
/**
|
|
51
|
+
* Case-insensitive, locale-stable comparator for the canonical sort. Words are compared lowercased
|
|
52
|
+
* so "Cairn" and "cairn" collapse to one entry, the same case-folding the Worker's merged set uses.
|
|
53
|
+
*/
|
|
50
54
|
function byWord(a, b) {
|
|
51
55
|
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
52
56
|
}
|
package/dist/content/types.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ interface FieldBase {
|
|
|
12
12
|
label: string;
|
|
13
13
|
/** A required field fails validation when empty (spec §7.4). */
|
|
14
14
|
required?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* One author-facing sentence shown under the field in the editor, in plain end-user language.
|
|
17
|
+
* Optional; render nothing when absent. Not a validation rule.
|
|
18
|
+
*/
|
|
19
|
+
description?: string;
|
|
15
20
|
}
|
|
16
21
|
/** A single-line text input. */
|
|
17
22
|
export interface TextField extends FieldBase {
|
|
@@ -22,8 +27,10 @@ export interface TextField extends FieldBase {
|
|
|
22
27
|
max?: number;
|
|
23
28
|
/** Exact required character length. */
|
|
24
29
|
length?: number;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
30
|
+
/**
|
|
31
|
+
* A regular-expression source string the value must match. Stored as a string so the field
|
|
32
|
+
* list stays plain serializable data; the validator compiles it.
|
|
33
|
+
*/
|
|
27
34
|
pattern?: string;
|
|
28
35
|
}
|
|
29
36
|
/** A multi-line text input. */
|
|
@@ -83,8 +90,10 @@ export interface ImageField extends FieldBase {
|
|
|
83
90
|
* arm in `schema.ts`, since its value is a nested object rather than a single string.
|
|
84
91
|
*/
|
|
85
92
|
export type FrontmatterField = TextField | TextareaField | DateField | BooleanField | TagsField | FreeTagsField | ImageField;
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
93
|
+
/**
|
|
94
|
+
* The stored value of an `image` field: a `media:` reference, a screen-reader description, and an
|
|
95
|
+
* optional caption.
|
|
96
|
+
*/
|
|
88
97
|
export interface ImageValue {
|
|
89
98
|
src: string;
|
|
90
99
|
alt: string;
|
|
@@ -120,8 +129,10 @@ export interface ConceptConfig<S extends ConceptSchema = ConceptSchema> {
|
|
|
120
129
|
singular?: string;
|
|
121
130
|
/** The concept's schema: the form projection, the generated validator, and the inferred type. */
|
|
122
131
|
schema: S;
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
132
|
+
/**
|
|
133
|
+
* Frontmatter keys to surface on each `ContentSummary.fields`, so a list card reads an authored
|
|
134
|
+
* field without a per-entry detail read. Each key should also be declared in `schema`.
|
|
135
|
+
*/
|
|
125
136
|
summaryFields?: string[];
|
|
126
137
|
}
|
|
127
138
|
/**
|
|
@@ -168,29 +179,39 @@ export interface NavMenuConfig {
|
|
|
168
179
|
* stylesheet.
|
|
169
180
|
*/
|
|
170
181
|
export interface PreviewConfig {
|
|
171
|
-
/**
|
|
172
|
-
*
|
|
182
|
+
/**
|
|
183
|
+
* Absolute or root-relative URLs of the site's compiled stylesheets, linked inside the
|
|
184
|
+
* preview document. A Vite `?url` import of the site's CSS resolves the hashed asset URL.
|
|
185
|
+
*/
|
|
173
186
|
stylesheets: string[];
|
|
174
187
|
/** Class list applied to the preview document's body, for theme or typography roots. */
|
|
175
188
|
bodyClass?: string;
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
189
|
+
/**
|
|
190
|
+
* Class list for a wrapper element around the rendered content, reproducing the site's
|
|
191
|
+
* content container (a prose or measure class). Omitted renders the content bare.
|
|
192
|
+
*/
|
|
178
193
|
containerClass?: string;
|
|
179
|
-
/**
|
|
194
|
+
/**
|
|
195
|
+
* Per-concept overrides of bodyClass and containerClass, keyed by concept id. An entry's
|
|
180
196
|
* preview resolves the override for its concept over the top-level values; stylesheets are
|
|
181
|
-
* always shared.
|
|
197
|
+
* always shared.
|
|
198
|
+
*/
|
|
182
199
|
byConcept?: Record<string, {
|
|
183
200
|
bodyClass?: string;
|
|
184
201
|
containerClass?: string;
|
|
185
202
|
}>;
|
|
186
203
|
}
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
204
|
+
/**
|
|
205
|
+
* The flat preview shape `editLoad` ships to the edit page: the top-level `PreviewConfig`
|
|
206
|
+
* values with the entry's concept override applied, and no `byConcept` map.
|
|
207
|
+
*/
|
|
189
208
|
export type ResolvedPreview = Omit<PreviewConfig, 'byConcept'>;
|
|
190
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* A site's media configuration (seam 4). A site sets this to turn on R2-backed media: uploads,
|
|
191
211
|
* content-addressed storage, and Cloudflare Images variants. Omitting it leaves media off. The
|
|
192
212
|
* engine normalizes this into a `ResolvedAssetConfig` and merges the named variants over the
|
|
193
|
-
* built-in thumb, inline, card, and hero presets.
|
|
213
|
+
* built-in thumb, inline, card, and hero presets.
|
|
214
|
+
*/
|
|
194
215
|
export interface AssetConfig {
|
|
195
216
|
/** The R2 bucket binding name on the Worker, e.g. "MEDIA_BUCKET". Required when a site declares media. */
|
|
196
217
|
bucketBinding: string;
|
|
@@ -204,10 +225,12 @@ export interface AssetConfig {
|
|
|
204
225
|
allowedTypes?: string[];
|
|
205
226
|
/** Named transform presets, merged over the built-in thumb/inline/card/hero presets. */
|
|
206
227
|
variants?: Record<string, VariantSpec>;
|
|
207
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* Whether Cloudflare Image Transformations are enabled for the zone (default false). The feature
|
|
208
230
|
* is a per-zone setting that the dashboard or API turns on; it cannot be flipped from a Worker. With
|
|
209
231
|
* it off, the media resolver serves the bare full-size delivery path and ignores any preset, so
|
|
210
|
-
* thumbnails stay correct (full-size-but-correct) rather than pointing at a dead /cdn-cgi/image URL.
|
|
232
|
+
* thumbnails stay correct (full-size-but-correct) rather than pointing at a dead /cdn-cgi/image URL.
|
|
233
|
+
*/
|
|
211
234
|
transformations?: boolean;
|
|
212
235
|
}
|
|
213
236
|
/** The single seam the engine consumes. A site implements this at `src/lib/cairn.config.ts`. */
|
|
@@ -223,33 +246,49 @@ export interface CairnAdapter {
|
|
|
223
246
|
};
|
|
224
247
|
backend: BackendConfig;
|
|
225
248
|
sender: SenderConfig;
|
|
226
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* Optional contact a stuck editor is pointed to from the in-admin help (an email address, a URL,
|
|
251
|
+
* or a name and instruction). The help renders the hand-off only when this is set. Plain string,
|
|
252
|
+
* passed through verbatim.
|
|
253
|
+
*/
|
|
254
|
+
supportContact?: string;
|
|
255
|
+
/**
|
|
256
|
+
* The site's one renderer: the editor preview and every public page call it (design decision 4).
|
|
227
257
|
* `resolve` rewrites cairn: links to live permalinks; the build passes a site-resolver-backed
|
|
228
258
|
* one, the preview a manifest one. The trailing `resolveMedia` is additive and optional: the build
|
|
229
|
-
* passes a site-resolver-backed media resolver, the preview a manifest-backed one.
|
|
259
|
+
* passes a site-resolver-backed media resolver, the preview a manifest-backed one.
|
|
260
|
+
*/
|
|
230
261
|
render(md: string, opts?: {
|
|
231
262
|
stagger?: boolean;
|
|
232
263
|
resolve?: LinkResolve;
|
|
233
264
|
resolveMedia?: import('../render/resolve-media.js').MediaResolve;
|
|
234
265
|
}): string | Promise<string>;
|
|
235
|
-
/**
|
|
236
|
-
*
|
|
266
|
+
/**
|
|
267
|
+
* Repo-relative path to the committed content manifest. Defaults to src/content/.cairn/index.json
|
|
268
|
+
* in composeRuntime. It sits outside any concept directory, so content enumeration never globs it.
|
|
269
|
+
*/
|
|
237
270
|
manifestPath?: string;
|
|
238
|
-
/**
|
|
239
|
-
*
|
|
271
|
+
/**
|
|
272
|
+
* Repo-relative path to the committed media manifest. Defaults to src/content/.cairn/media.json,
|
|
273
|
+
* applied in composeRuntime. Sits outside any concept directory, like the content manifest.
|
|
274
|
+
*/
|
|
240
275
|
mediaManifestPath?: string;
|
|
241
|
-
/**
|
|
276
|
+
/**
|
|
277
|
+
* Repo-relative path to the committed personal dictionary file. Defaults to
|
|
242
278
|
* src/content/.cairn/dictionary.txt, applied in composeRuntime: the same `.cairn/` content root the
|
|
243
279
|
* manifests use, so the spec's `content/.cairn/dictionary.txt` resolves the same configurable way the
|
|
244
|
-
* manifest paths do. One word per line, sorted, comment lines allowed (see site-dictionary.ts).
|
|
280
|
+
* manifest paths do. One word per line, sorted, comment lines allowed (see site-dictionary.ts).
|
|
281
|
+
*/
|
|
245
282
|
dictionaryPath?: string;
|
|
246
283
|
/** Directive component registry; the renderer and the future palette derive from it (seam 3). */
|
|
247
284
|
registry?: ComponentRegistry;
|
|
248
285
|
/** The site's glyph name to SVG path-data map, for the admin icon picker and the renderer. */
|
|
249
286
|
icons?: IconSet;
|
|
250
287
|
navMenu?: NavMenuConfig;
|
|
251
|
-
/**
|
|
252
|
-
*
|
|
288
|
+
/**
|
|
289
|
+
* The live site's content styling for the preview frame. The admin's chrome isolation keeps
|
|
290
|
+
* the site's CSS out of the admin document, so the preview frame links these instead.
|
|
291
|
+
*/
|
|
253
292
|
preview?: PreviewConfig;
|
|
254
293
|
assets?: AssetConfig;
|
|
255
294
|
}
|
|
@@ -273,8 +312,10 @@ export interface ConceptDescriptor {
|
|
|
273
312
|
/** Concept id, the key under `content`, e.g. "posts". */
|
|
274
313
|
id: string;
|
|
275
314
|
label: string;
|
|
276
|
-
/**
|
|
277
|
-
*
|
|
315
|
+
/**
|
|
316
|
+
* The singular noun for the create affordances ("New post"); resolved from `ConceptConfig.singular`,
|
|
317
|
+
* defaulting to `label` when the config omits it.
|
|
318
|
+
*/
|
|
278
319
|
singular: string;
|
|
279
320
|
dir: string;
|
|
280
321
|
routing: RoutingRule;
|
|
@@ -283,8 +324,10 @@ export interface ConceptDescriptor {
|
|
|
283
324
|
/** Filename date-prefix granularity for a dated concept; resolved by `normalizeConcepts`. */
|
|
284
325
|
datePrefix: DatePrefix;
|
|
285
326
|
fields: FrontmatterField[];
|
|
286
|
-
/**
|
|
287
|
-
*
|
|
327
|
+
/**
|
|
328
|
+
* Frontmatter keys the index copies onto each summary's `fields` record. `normalizeConcepts`
|
|
329
|
+
* resolves it to `[]` when a concept omits `summaryFields`.
|
|
330
|
+
*/
|
|
288
331
|
summaryFields: string[];
|
|
289
332
|
validate(frontmatter: Record<string, unknown>, body: string): ValidationResult;
|
|
290
333
|
}
|
|
@@ -339,9 +382,13 @@ export interface CairnRuntime {
|
|
|
339
382
|
concepts: ConceptDescriptor[];
|
|
340
383
|
backend: BackendConfig;
|
|
341
384
|
sender: SenderConfig;
|
|
342
|
-
/** The
|
|
385
|
+
/** The support contact passed through from the adapter; the in-admin help reads it. Optional. */
|
|
386
|
+
supportContact?: string;
|
|
387
|
+
/**
|
|
388
|
+
* The site's one renderer: the editor preview and every public page call it (design decision 4).
|
|
343
389
|
* The trailing `resolveMedia` is additive and optional: the build passes a site-resolver-backed
|
|
344
|
-
* media resolver, the preview a manifest-backed one.
|
|
390
|
+
* media resolver, the preview a manifest-backed one.
|
|
391
|
+
*/
|
|
345
392
|
render(md: string, opts?: {
|
|
346
393
|
stagger?: boolean;
|
|
347
394
|
resolve?: LinkResolve;
|
|
@@ -350,15 +397,19 @@ export interface CairnRuntime {
|
|
|
350
397
|
manifestPath: string;
|
|
351
398
|
/** The repo-relative path to the committed media manifest, defaulted in composeRuntime. */
|
|
352
399
|
mediaManifestPath: string;
|
|
353
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* The repo-relative path to the committed personal dictionary file (one word per line, sorted),
|
|
354
402
|
* defaulted in composeRuntime to src/content/.cairn/dictionary.txt: the same `.cairn/` content root
|
|
355
403
|
* the manifests use. The edit load reads it and threads its words onto EditData; the
|
|
356
404
|
* addDictionaryWord action reads, merges, and commits it. Optional on the runtime so a hand-built
|
|
357
405
|
* runtime need not set it; composeRuntime always fills it, and the edit load and the action default
|
|
358
|
-
* a missing value to the same content-root path.
|
|
406
|
+
* a missing value to the same content-root path.
|
|
407
|
+
*/
|
|
359
408
|
dictionaryPath?: string;
|
|
360
|
-
/**
|
|
361
|
-
*
|
|
409
|
+
/**
|
|
410
|
+
* The adapter's asset config resolved once at compose: `{ enabled: false }` for a no-media site,
|
|
411
|
+
* otherwise the filled config the upload, storage, delivery, and resolver paths read.
|
|
412
|
+
*/
|
|
362
413
|
resolvedAssets: import('../media/config.js').ResolvedAssetConfig;
|
|
363
414
|
registry?: ComponentRegistry;
|
|
364
415
|
/** The site's glyph name to SVG path-data map, for the admin icon picker and the renderer. */
|
|
@@ -367,18 +418,22 @@ export interface CairnRuntime {
|
|
|
367
418
|
/** The live site's content styling for the preview frame; passed through from the adapter. */
|
|
368
419
|
preview?: PreviewConfig;
|
|
369
420
|
assets?: AssetConfig;
|
|
370
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* The editor's spellcheck dictionary file, resolved once at compose from the site config's
|
|
371
423
|
* `spellcheck.dialect` (defaulting to US English). The edit load threads it onto EditData and the
|
|
372
424
|
* editor resolves it to a real asset URL on the main thread, so the Worker receives the URL and
|
|
373
425
|
* never reads config. Just the filename, e.g. "dictionary-en-us.txt". Optional on the runtime so a
|
|
374
426
|
* hand-built runtime need not set it; composeRuntime always fills it, and the edit load defaults a
|
|
375
|
-
* missing value to the US English dictionary.
|
|
427
|
+
* missing value to the US English dictionary.
|
|
428
|
+
*/
|
|
376
429
|
spellcheckDictionary?: string;
|
|
377
|
-
/**
|
|
430
|
+
/**
|
|
431
|
+
* The editor tidy (LLM copy-edit) settings, passed through from the site config. Optional on the
|
|
378
432
|
* runtime so a hand-built runtime need not set it; composeRuntime threads it from
|
|
379
433
|
* `siteConfig.tidy`. The tidy action reads `enabled` and `model` at call time, and builds its prompt
|
|
380
434
|
* from `conventions`. Absent (or `enabled` false) means tidy is off, and the action refuses with a
|
|
381
|
-
* fail(503) before any model call.
|
|
435
|
+
* fail(503) before any model call.
|
|
436
|
+
*/
|
|
382
437
|
tidy?: import('../nav/site-config.js').TidyConfig;
|
|
383
438
|
/** Admin panels contributed by extensions (Mode 2). Empty until Plan 09 wires the dispatch route. */
|
|
384
439
|
adminPanels?: AdminPanel[];
|
|
@@ -6,8 +6,10 @@ export interface RawFile {
|
|
|
6
6
|
}
|
|
7
7
|
/** The cheap, plain-data view of one entry, for lists, feeds, and the sitemap. */
|
|
8
8
|
export interface ContentSummary {
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
9
|
+
/**
|
|
10
|
+
* The descriptor id this entry belongs to, e.g. "posts". Lets a list or page branch per
|
|
11
|
+
* concept without re-deriving it from a proxy like `entry.date`.
|
|
12
|
+
*/
|
|
11
13
|
concept: string;
|
|
12
14
|
id: string;
|
|
13
15
|
slug: string;
|
|
@@ -15,22 +17,28 @@ export interface ContentSummary {
|
|
|
15
17
|
title: string;
|
|
16
18
|
date?: string;
|
|
17
19
|
updated?: string;
|
|
18
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The entry's tags, always present as an array and empty when the file declares none. This is the
|
|
19
22
|
* read-model normalization. It differs on purpose from the validated `frontmatter.tags`, which the
|
|
20
23
|
* validator omits when empty, so a published file carries no `tags: []` noise. Read `tags` here for
|
|
21
|
-
* a list; read `frontmatter.tags` only when you need the validated, possibly-absent value.
|
|
24
|
+
* a list; read `frontmatter.tags` only when you need the validated, possibly-absent value.
|
|
25
|
+
*/
|
|
22
26
|
tags: string[];
|
|
23
27
|
excerpt: string;
|
|
24
28
|
wordCount: number;
|
|
25
29
|
draft: boolean;
|
|
26
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The frontmatter keys the descriptor nominated via `summaryFields`, read off the validated,
|
|
27
32
|
* normalized frontmatter. Held in a separate record so a nominated key cannot collide with a
|
|
28
|
-
* typed summary field. Empty when the concept declares no `summaryFields`.
|
|
33
|
+
* typed summary field. Empty when the concept declares no `summaryFields`.
|
|
34
|
+
*/
|
|
29
35
|
fields: Record<string, unknown>;
|
|
30
36
|
}
|
|
31
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The detail view: a summary plus the frontmatter and the body to render. The frontmatter
|
|
32
39
|
* type defaults to `Record<string, unknown>`; the typed-reads pass infers it from the concept
|
|
33
|
-
* fields. Generic now so that change does not break this signature.
|
|
40
|
+
* fields. Generic now so that change does not break this signature.
|
|
41
|
+
*/
|
|
34
42
|
export interface ContentEntry<F = Record<string, unknown>> extends ContentSummary {
|
|
35
43
|
frontmatter: F;
|
|
36
44
|
body: string;
|
package/dist/delivery/feeds.js
CHANGED
|
@@ -7,8 +7,10 @@ import { escapeXml } from './xml.js';
|
|
|
7
7
|
function cdataSafe(value) {
|
|
8
8
|
return value.replace(/]]>/g, ']]]]><![CDATA[>');
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
10
|
+
/**
|
|
11
|
+
* Parse a YYYY-MM-DD (or ISO) string as a UTC instant. Returns undefined for an absent or
|
|
12
|
+
* unparseable date, so a feed omits the date field rather than emit Invalid Date or throw.
|
|
13
|
+
*/
|
|
12
14
|
function parseFeedDate(date) {
|
|
13
15
|
if (!date)
|
|
14
16
|
return undefined;
|
package/dist/delivery/json-ld.js
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
// The line separator U+2028 and paragraph separator U+2029 get the same treatment: they are
|
|
6
6
|
// legal inside a JSON string but unsafe in inline script text, where some parsers read them as
|
|
7
7
|
// line terminators, so an author pasting one into frontmatter would corrupt the JSON-LD block.
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
8
11
|
export function jsonLdScript(data) {
|
|
9
12
|
const json = JSON.stringify(data)
|
|
10
13
|
.replace(/</g, '\\u003c')
|
|
@@ -2,6 +2,8 @@ import type { Manifest } from '../content/manifest.js';
|
|
|
2
2
|
import type { SiteConfig } from '../nav/site-config.js';
|
|
3
3
|
import type { CairnAdapter } from '../content/types.js';
|
|
4
4
|
import type { SiteGlobs } from './site-indexes.js';
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
5
|
+
/**
|
|
6
|
+
* Build the whole-corpus manifest from a site's adapter, config, and per-concept globs. Drafts are
|
|
7
|
+
* included and flagged, so the admin picker and the guards see the full graph.
|
|
8
|
+
*/
|
|
7
9
|
export declare function buildSiteManifest<A extends CairnAdapter>(adapter: A, config: SiteConfig, globs: SiteGlobs<A>): Manifest;
|
|
@@ -6,8 +6,10 @@ import { siteDescriptors } from './site-descriptors.js';
|
|
|
6
6
|
import { fromGlob } from './content-index.js';
|
|
7
7
|
import { parseMarkdown } from '../content/frontmatter.js';
|
|
8
8
|
import { emptyManifest, manifestEntryFromFile } from '../content/manifest.js';
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
9
|
+
/**
|
|
10
|
+
* Build the whole-corpus manifest from a site's adapter, config, and per-concept globs. Drafts are
|
|
11
|
+
* included and flagged, so the admin picker and the guards see the full graph.
|
|
12
|
+
*/
|
|
11
13
|
export function buildSiteManifest(adapter, config, globs) {
|
|
12
14
|
const globRecord = globs;
|
|
13
15
|
const manifest = emptyManifest();
|
|
@@ -20,12 +20,16 @@ export interface PublicRoutesDeps {
|
|
|
20
20
|
rss?: string;
|
|
21
21
|
json?: string;
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
23
|
+
/**
|
|
24
|
+
* A site-wide default OG image, used when an entry declares none. Resolved to absolute like the
|
|
25
|
+
* canonical URL, so a relative path such as "/og/default.png" works.
|
|
26
|
+
*/
|
|
25
27
|
defaultImage?: string;
|
|
26
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a frontmatter `media:` hero reference to its delivery path. The site builds this from its
|
|
27
30
|
* committed `media.json` exactly as it builds the body resolver (`makeMediaResolver`). When absent,
|
|
28
|
-
* media is off and no `heroImage` projection is derived.
|
|
31
|
+
* media is off and no `heroImage` projection is derived.
|
|
32
|
+
*/
|
|
29
33
|
resolveMedia?: MediaResolve;
|
|
30
34
|
}
|
|
31
35
|
/** The archive and tag list data: summaries the template renders. */
|
|
@@ -52,11 +56,13 @@ export interface EntryData {
|
|
|
52
56
|
seo: SeoMeta;
|
|
53
57
|
newer?: ContentSummary;
|
|
54
58
|
older?: ContentSummary;
|
|
55
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* The resolved hero image, a derived projection of the frontmatter `image` field. `url` is the
|
|
56
61
|
* root-relative delivery path for an `<img>`, `absoluteUrl` the origin-anchored form for the
|
|
57
62
|
* og:image, and `alt`/`caption` carry from the stored object. The canonical token is untouched:
|
|
58
63
|
* `entry.frontmatter.image.src` stays the `media:` token. Undefined when no hero is set, media is
|
|
59
|
-
* off, the reference does not parse, or the resolver finds no asset.
|
|
64
|
+
* off, the reference does not parse, or the resolver finds no asset.
|
|
65
|
+
*/
|
|
60
66
|
heroImage?: {
|
|
61
67
|
url: string;
|
|
62
68
|
absoluteUrl?: string;
|
|
@@ -11,7 +11,8 @@ import { parseMediaToken } from '../media/reference.js';
|
|
|
11
11
|
/** Build the public loaders for a site's unified index. */
|
|
12
12
|
export function createPublicRoutes(deps) {
|
|
13
13
|
const { site, render, origin, siteName, description, feeds, defaultImage, resolveMedia } = deps;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Derive the hero projection from an entry's frontmatter, without mutating it (locked decision 5).
|
|
15
16
|
* The hero lives at the conventional `image` key as the validated nested object `{ src, alt, caption }`;
|
|
16
17
|
* only an image field's validate arm produces an object-with-string-`src` shape, so detecting that
|
|
17
18
|
* structure is enough (a text field stores a string, a tags field an array). Returns undefined when
|
|
@@ -22,7 +23,8 @@ export function createPublicRoutes(deps) {
|
|
|
22
23
|
* and renders in the editor, but its delivery resolution is not wired here yet, since the field
|
|
23
24
|
* declarations are not reachable in the delivery read path. Honoring a renamed `seo`-flagged field
|
|
24
25
|
* (and a second image field per concept) at delivery is a carried follow-up; every consumer today
|
|
25
|
-
* uses `image`.
|
|
26
|
+
* uses `image`.
|
|
27
|
+
*/
|
|
26
28
|
function deriveHeroImage(frontmatter) {
|
|
27
29
|
if (!resolveMedia)
|
|
28
30
|
return undefined;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The head fields a concept can carry in frontmatter. Each is optional and omitted when absent.
|
|
2
3
|
* `author` is article-scoped downstream: the head builder emits `article:author` only for a dated
|
|
3
|
-
* entry, so an `author` on an undated Page is read here but not rendered.
|
|
4
|
+
* entry, so an `author` on an undated Page is read here but not rendered.
|
|
5
|
+
*/
|
|
4
6
|
export interface SeoFields {
|
|
5
7
|
description?: string;
|
|
6
8
|
image?: string;
|
|
7
9
|
robots?: string;
|
|
8
10
|
author?: string;
|
|
9
11
|
}
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Read the known SEO head fields off an entry's normalized frontmatter. Keeps a present string,
|
|
11
14
|
* trimmed, and omits an absent, empty, or non-string value. Trimming the stored value keeps a stray
|
|
12
15
|
* `robots: " noindex "` from reaching the head tag with surrounding whitespace. The field must be
|
|
13
16
|
* declared in the concept's schema to survive the validate-once read; an undeclared key is not on the
|
|
14
|
-
* normalized frontmatter.
|
|
17
|
+
* normalized frontmatter.
|
|
18
|
+
*/
|
|
15
19
|
export declare function readSeoFields(frontmatter: Record<string, unknown>): SeoFields;
|
|
16
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Resolve an author-supplied image path to an absolute URL against the site origin. An absolute or
|
|
17
22
|
* protocol-relative URL passes through; a root-relative path anchors to the origin; a malformed
|
|
18
23
|
* string returns undefined rather than throwing at build. The sites use a bare-domain origin, so a
|
|
19
24
|
* bare path also anchors to the origin root; against a sub-path origin it would resolve relative to
|
|
20
|
-
* that path, per the WHATWG URL rules.
|
|
25
|
+
* that path, per the WHATWG URL rules.
|
|
26
|
+
*/
|
|
21
27
|
export declare function resolveImageUrl(image: string, origin: string): string | undefined;
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
// typed Record<string, unknown>; this reads the known head fields by name and coerces. Kept apart
|
|
4
4
|
// from seo.ts (the head builder) so reading frontmatter and building the head stay distinct concerns.
|
|
5
5
|
const KEYS = ['description', 'image', 'robots', 'author'];
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Read the known SEO head fields off an entry's normalized frontmatter. Keeps a present string,
|
|
7
8
|
* trimmed, and omits an absent, empty, or non-string value. Trimming the stored value keeps a stray
|
|
8
9
|
* `robots: " noindex "` from reaching the head tag with surrounding whitespace. The field must be
|
|
9
10
|
* declared in the concept's schema to survive the validate-once read; an undeclared key is not on the
|
|
10
|
-
* normalized frontmatter.
|
|
11
|
+
* normalized frontmatter.
|
|
12
|
+
*/
|
|
11
13
|
export function readSeoFields(frontmatter) {
|
|
12
14
|
const fields = {};
|
|
13
15
|
for (const key of KEYS) {
|
|
@@ -17,11 +19,13 @@ export function readSeoFields(frontmatter) {
|
|
|
17
19
|
}
|
|
18
20
|
return fields;
|
|
19
21
|
}
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Resolve an author-supplied image path to an absolute URL against the site origin. An absolute or
|
|
21
24
|
* protocol-relative URL passes through; a root-relative path anchors to the origin; a malformed
|
|
22
25
|
* string returns undefined rather than throwing at build. The sites use a bare-domain origin, so a
|
|
23
26
|
* bare path also anchors to the origin root; against a sub-path origin it would resolve relative to
|
|
24
|
-
* that path, per the WHATWG URL rules.
|
|
27
|
+
* that path, per the WHATWG URL rules.
|
|
28
|
+
*/
|
|
25
29
|
export function resolveImageUrl(image, origin) {
|
|
26
30
|
try {
|
|
27
31
|
const url = new URL(image, origin);
|
|
@@ -7,8 +7,10 @@ import type { SiteResolver } from './site-resolver.js';
|
|
|
7
7
|
export type SiteGlobs<A extends CairnAdapter> = {
|
|
8
8
|
[K in keyof A['content']]?: Record<string, string>;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
10
|
+
/**
|
|
11
|
+
* The typed per-concept indexes plus the cross-concept `site` resolver. A concept literally named
|
|
12
|
+
* `site` is not supported, since `site` is the reserved resolver key.
|
|
13
|
+
*/
|
|
12
14
|
export type SiteIndexes<A extends CairnAdapter> = {
|
|
13
15
|
[K in keyof A['content']]: ContentIndex<NonNullable<A['content'][K]> extends ConceptConfig<infer S> ? Infer<S> : Record<string, unknown>>;
|
|
14
16
|
} & {
|
|
@@ -32,6 +32,8 @@ export interface SiteResolver {
|
|
|
32
32
|
export declare function createSiteResolver(concepts: ConceptIndex[], opts?: {
|
|
33
33
|
validate?: boolean;
|
|
34
34
|
}): SiteResolver;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
35
|
+
/**
|
|
36
|
+
* A resolver backed by the site resolver, for the build. A miss throws, so a dangling cairn: token
|
|
37
|
+
* fails the prerender (the build backstop). The preview uses manifestLinkResolver, which marks.
|
|
38
|
+
*/
|
|
37
39
|
export declare function buildLinkResolver(site: SiteResolver): LinkResolve;
|
|
@@ -60,8 +60,10 @@ export function createSiteResolver(concepts, opts = {}) {
|
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
63
|
+
/**
|
|
64
|
+
* A resolver backed by the site resolver, for the build. A miss throws, so a dangling cairn: token
|
|
65
|
+
* fails the prerender (the build backstop). The preview uses manifestLinkResolver, which marks.
|
|
66
|
+
*/
|
|
65
67
|
export function buildLinkResolver(site) {
|
|
66
68
|
return (ref) => {
|
|
67
69
|
const url = site.concept(ref.concept)?.byId(ref.id)?.permalink;
|
|
@@ -3,5 +3,11 @@ export declare const CF_API = "https://api.cloudflare.com/client/v4";
|
|
|
3
3
|
export declare const NO_TOKEN: CheckResult;
|
|
4
4
|
export declare const NO_FROM: CheckResult;
|
|
5
5
|
export declare const NO_ACCOUNT: CheckResult;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
6
9
|
export declare function cfGet(ctx: DoctorContext, path: string): Promise<Response>;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
7
13
|
export declare function cfPost(ctx: DoctorContext, path: string, body: unknown): Promise<Response>;
|
|
@@ -7,11 +7,17 @@ export const CF_API = 'https://api.cloudflare.com/client/v4';
|
|
|
7
7
|
export const NO_TOKEN = skip('set CLOUDFLARE_API_TOKEN to run this check');
|
|
8
8
|
export const NO_FROM = skip('pass --from, set CAIRN_FROM, or configure the cairnManifest plugin so the doctor can read the adapter');
|
|
9
9
|
export const NO_ACCOUNT = skip('set CLOUDFLARE_API_TOKEN, and CLOUDFLARE_ACCOUNT_ID or a wrangler account_id, to run this check');
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
10
13
|
export function cfGet(ctx, path) {
|
|
11
14
|
return ctx.fetch(`${CF_API}${path}`, {
|
|
12
15
|
headers: { authorization: `Bearer ${ctx.cfToken}` },
|
|
13
16
|
});
|
|
14
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
15
21
|
export function cfPost(ctx, path, body) {
|
|
16
22
|
return ctx.fetch(`${CF_API}${path}`, {
|
|
17
23
|
method: 'POST',
|