@caelo-cms/shared 0.10.57 → 0.10.59
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/ai-tools.d.ts +30 -0
- package/dist/ai-tools.d.ts.map +1 -1
- package/dist/ai-tools.js +26 -9
- package/dist/ai-tools.js.map +1 -1
- package/dist/bug-intake.d.ts +176 -0
- package/dist/bug-intake.d.ts.map +1 -0
- package/dist/bug-intake.js +200 -0
- package/dist/bug-intake.js.map +1 -0
- package/dist/content.js +7 -7
- package/dist/edit-markers.d.ts +49 -0
- package/dist/edit-markers.d.ts.map +1 -0
- package/dist/edit-markers.js +225 -0
- package/dist/edit-markers.js.map +1 -0
- package/dist/google-oauth.d.ts +22 -0
- package/dist/google-oauth.d.ts.map +1 -0
- package/dist/google-oauth.js +25 -0
- package/dist/google-oauth.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/link-canonicalise.d.ts +109 -0
- package/dist/link-canonicalise.d.ts.map +1 -0
- package/dist/link-canonicalise.js +471 -0
- package/dist/link-canonicalise.js.map +1 -0
- package/dist/link-refs.d.ts +63 -8
- package/dist/link-refs.d.ts.map +1 -1
- package/dist/link-refs.js +80 -14
- package/dist/link-refs.js.map +1 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +15 -0
- package/dist/media.js.map +1 -1
- package/dist/nested-module-render.d.ts +17 -0
- package/dist/nested-module-render.d.ts.map +1 -1
- package/dist/nested-module-render.js +45 -6
- package/dist/nested-module-render.js.map +1 -1
- package/dist/page-log.d.ts +1 -1
- package/dist/preview-compose.d.ts.map +1 -1
- package/dist/preview-compose.js +12 -2
- package/dist/preview-compose.js.map +1 -1
- package/dist/theme-normalize.d.ts.map +1 -1
- package/dist/theme-normalize.js +17 -2
- package/dist/theme-normalize.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/ai-tools.ts +29 -11
- package/src/bug-intake.test.ts +154 -0
- package/src/bug-intake.ts +256 -0
- package/src/content.ts +7 -7
- package/src/edit-markers.test.ts +111 -0
- package/src/edit-markers.ts +244 -0
- package/src/google-oauth.ts +27 -0
- package/src/index.ts +4 -0
- package/src/link-canonicalise.test.ts +387 -0
- package/src/link-canonicalise.ts +598 -0
- package/src/link-refs.test.ts +206 -0
- package/src/link-refs.ts +119 -21
- package/src/media.ts +16 -0
- package/src/nested-module-render.ts +59 -4
- package/src/preview-compose.ts +11 -2
- package/src/theme-normalize-typography-subfields.test.ts +54 -0
- package/src/theme-normalize.ts +19 -2
- package/src/version.ts +1 -1
package/dist/content.js
CHANGED
|
@@ -544,14 +544,14 @@ export const pageUpdateSchema = z
|
|
|
544
544
|
templateId: z.string().uuid().optional(),
|
|
545
545
|
status: pageStatusSchema.optional(),
|
|
546
546
|
/**
|
|
547
|
-
* Only meaningful together with `slug`. A slug change
|
|
548
|
-
* public URL, so the op creates a 301 from the old path by default
|
|
549
|
-
*
|
|
550
|
-
*
|
|
547
|
+
* Only meaningful together with `slug`. A slug change moves the page's
|
|
548
|
+
* public URL, so the op creates a 301 from the old path by default,
|
|
549
|
+
* inside the same transaction as the slug write. Links on the site are
|
|
550
|
+
* page references (epic #724) and follow the page without a rewrite;
|
|
551
|
+
* the 301 is for links from outside the site.
|
|
551
552
|
*
|
|
552
|
-
* `'skip'` suppresses
|
|
553
|
-
*
|
|
554
|
-
* should 404. Defaults to `'auto'`: silently dropping the 301 would strand
|
|
553
|
+
* `'skip'` suppresses the redirect and is for the rare case where the
|
|
554
|
+
* operator explicitly says the old URL should 404. Defaults to `'auto'`: silently dropping the 301 would strand
|
|
555
555
|
* every inbound link, which is never a safe default (CLAUDE.md §2).
|
|
556
556
|
*/
|
|
557
557
|
redirectFromOld: z.enum(["auto", "skip"]).optional(),
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Comment prefix of an opening marker; the closing marker is `/caelo:f`. */
|
|
2
|
+
export declare const EDIT_MARKER_PREFIX = "caelo:f";
|
|
3
|
+
/** Field shape {@link wrapEditableValues} needs: name + kind. */
|
|
4
|
+
export interface EditableFieldDef {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly kind?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Wrap the editable text of a content instance's values in sentinels.
|
|
10
|
+
* Returns a new object; non-editable values pass through untouched.
|
|
11
|
+
*
|
|
12
|
+
* Paths: `<field>` for a `text` / `url` / `image` field, `<field>.<i>`
|
|
13
|
+
* for a `text-list` item, `<field>.<i>.label` / `<field>.<i>.href` for a
|
|
14
|
+
* `link-list` item's label / target.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* wrapEditableValues({ hero_title: "Hi" }, [{ name: "hero_title", kind: "text" }]);
|
|
18
|
+
* // → { hero_title: "\uE000hero_title\uE001Hi\uE002" }
|
|
19
|
+
*/
|
|
20
|
+
export declare function wrapEditableValues(values: Readonly<Record<string, unknown>>, fields: readonly EditableFieldDef[]): Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Turn sentinels in rendered module HTML into marker comments (text
|
|
23
|
+
* content) or drop them (everywhere else). See the file header.
|
|
24
|
+
*
|
|
25
|
+
* A tag whose `href` / `src` / `alt` value is exactly one marked value
|
|
26
|
+
* gets `data-caelo-fields="href=<path> …"` plus the placement
|
|
27
|
+
* (`data-caelo-placement`, `data-caelo-shared`), so the editor can offer
|
|
28
|
+
* "Edit link" / "Replace image" (#918). A value assembled from several
|
|
29
|
+
* parts (`href="/blog/{{slug}}"`) is not editable and is not marked.
|
|
30
|
+
*
|
|
31
|
+
* @param placement The placement key, `<blockName>#<position>`.
|
|
32
|
+
* @param sharedPages 0 for a placement with its own content; for a synced
|
|
33
|
+
* (shared) one, the number of pages that show the same content.
|
|
34
|
+
*/
|
|
35
|
+
export declare function finalizeEditMarkers(html: string, placement: string, sharedPages: number): string;
|
|
36
|
+
/** A parsed opening marker. */
|
|
37
|
+
export interface EditMarker {
|
|
38
|
+
readonly blockName: string;
|
|
39
|
+
readonly position: number;
|
|
40
|
+
readonly synced: boolean;
|
|
41
|
+
readonly field: string;
|
|
42
|
+
readonly index?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse an opening marker's comment text (without `<!--`/`-->`), or null.
|
|
46
|
+
* Mirrors what the preview runtime does in the browser.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseEditMarker(comment: string): EditMarker | null;
|
|
49
|
+
//# sourceMappingURL=edit-markers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-markers.d.ts","sourceRoot":"","sources":["../src/edit-markers.ts"],"names":[],"mappings":"AAoCA,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAY5C,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAUD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAClC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AAyBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CA2ChG;AA+BD,+BAA+B;AAC/B,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAgBlE"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* #917 — field markers for the Live Edit preview. They let the preview
|
|
4
|
+
* iframe tell which placement + field a piece of visible text came from,
|
|
5
|
+
* so the operator can edit that text in place.
|
|
6
|
+
*
|
|
7
|
+
* Two steps around the normal module render:
|
|
8
|
+
*
|
|
9
|
+
* 1. {@link wrapEditableValues} wraps every plain-text value of a
|
|
10
|
+
* placement's content instance in private-use sentinels that carry
|
|
11
|
+
* the field path. The template engine substitutes the wrapped value
|
|
12
|
+
* like any other string (its escape is the identity), so the
|
|
13
|
+
* sentinels land wherever the module author put `{{field}}`.
|
|
14
|
+
* 2. {@link finalizeEditMarkers} scans the rendered HTML. A sentinel in
|
|
15
|
+
* text content becomes a pair of HTML comments around the value:
|
|
16
|
+
* `<!--caelo:f p=<placement> s=<0|1> f=<path>-->value<!--/caelo:f-->`.
|
|
17
|
+
* Comments do not affect layout or CSS selectors. A sentinel in a
|
|
18
|
+
* comment or a raw-text element (`<script>`, `<style>`, `<title>`,
|
|
19
|
+
* `<textarea>`) is removed and the value stays as it was. In a tag
|
|
20
|
+
* it is removed too; an `href` / `src` / `alt` that is exactly one
|
|
21
|
+
* marked value also gets `data-caelo-fields` on its tag (#918).
|
|
22
|
+
*
|
|
23
|
+
* Only the editor preview runs this. Published output never carries
|
|
24
|
+
* markers: the static generator and every other caller of
|
|
25
|
+
* `pages.render_preview` leave `editMarkers` off.
|
|
26
|
+
*
|
|
27
|
+
* Only values without `<` are wrapped: a value that carries markup cannot
|
|
28
|
+
* be edited as plain text without destroying that markup.
|
|
29
|
+
*/
|
|
30
|
+
const START = "\uE000";
|
|
31
|
+
const SEP = "\uE001";
|
|
32
|
+
const END = "\uE002";
|
|
33
|
+
const SENTINELS = /[\uE000-\uE002]/g;
|
|
34
|
+
/** Comment prefix of an opening marker; the closing marker is `/caelo:f`. */
|
|
35
|
+
export const EDIT_MARKER_PREFIX = "caelo:f";
|
|
36
|
+
/**
|
|
37
|
+
* Field kinds the preview marks: text (`text`, `text-list` items,
|
|
38
|
+
* `link-list` labels) and link / image targets (`url`, `image`,
|
|
39
|
+
* `link-list` hrefs, #918) — the latter usually land in `href` / `src`.
|
|
40
|
+
*/
|
|
41
|
+
const EDITABLE_KINDS = new Set(["text", "text-list", "link-list", "url", "image"]);
|
|
42
|
+
/** Attributes whose marked value the editor can change (link target, image, alt text). */
|
|
43
|
+
const MARKABLE_ATTRIBUTES = new Set(["href", "src", "alt"]);
|
|
44
|
+
function editable(value) {
|
|
45
|
+
return typeof value === "string" && value.trim().length > 0 && !value.includes("<");
|
|
46
|
+
}
|
|
47
|
+
function wrap(path, value) {
|
|
48
|
+
return `${START}${path}${SEP}${value.replace(SENTINELS, "")}${END}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Wrap the editable text of a content instance's values in sentinels.
|
|
52
|
+
* Returns a new object; non-editable values pass through untouched.
|
|
53
|
+
*
|
|
54
|
+
* Paths: `<field>` for a `text` / `url` / `image` field, `<field>.<i>`
|
|
55
|
+
* for a `text-list` item, `<field>.<i>.label` / `<field>.<i>.href` for a
|
|
56
|
+
* `link-list` item's label / target.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* wrapEditableValues({ hero_title: "Hi" }, [{ name: "hero_title", kind: "text" }]);
|
|
60
|
+
* // → { hero_title: "\uE000hero_title\uE001Hi\uE002" }
|
|
61
|
+
*/
|
|
62
|
+
export function wrapEditableValues(values, fields) {
|
|
63
|
+
const out = { ...values };
|
|
64
|
+
for (const f of fields) {
|
|
65
|
+
const kind = f.kind ?? "text";
|
|
66
|
+
if (!EDITABLE_KINDS.has(kind))
|
|
67
|
+
continue;
|
|
68
|
+
const v = values[f.name];
|
|
69
|
+
if (kind === "text" || kind === "url" || kind === "image") {
|
|
70
|
+
if (editable(v))
|
|
71
|
+
out[f.name] = wrap(f.name, v);
|
|
72
|
+
}
|
|
73
|
+
else if (kind === "text-list" && Array.isArray(v)) {
|
|
74
|
+
out[f.name] = v.map((item, i) => (editable(item) ? wrap(`${f.name}.${i}`, item) : item));
|
|
75
|
+
}
|
|
76
|
+
else if (kind === "link-list" && Array.isArray(v)) {
|
|
77
|
+
out[f.name] = v.map((item, i) => {
|
|
78
|
+
if (typeof item !== "object" || item === null)
|
|
79
|
+
return item;
|
|
80
|
+
const { label, href } = item;
|
|
81
|
+
return {
|
|
82
|
+
...item,
|
|
83
|
+
...(editable(label) ? { label: wrap(`${f.name}.${i}.label`, label) } : {}),
|
|
84
|
+
...(editable(href) ? { href: wrap(`${f.name}.${i}.href`, href) } : {}),
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
/** Comment-safe encoding: no `--`, no `>`, no whitespace. */
|
|
92
|
+
function attr(value) {
|
|
93
|
+
return encodeURIComponent(value).replace(/-/g, "%2D");
|
|
94
|
+
}
|
|
95
|
+
const RAW_TEXT_ELEMENTS = new Set(["script", "style", "title", "textarea"]);
|
|
96
|
+
/** End index (exclusive) of the tag starting at `i`, honouring quoted attribute values. */
|
|
97
|
+
function tagEnd(html, i) {
|
|
98
|
+
let quote = null;
|
|
99
|
+
for (let j = i + 1; j < html.length; j += 1) {
|
|
100
|
+
const c = html[j];
|
|
101
|
+
if (quote) {
|
|
102
|
+
if (c === quote)
|
|
103
|
+
quote = null;
|
|
104
|
+
}
|
|
105
|
+
else if (c === '"' || c === "'") {
|
|
106
|
+
quote = c;
|
|
107
|
+
}
|
|
108
|
+
else if (c === ">") {
|
|
109
|
+
return j + 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return html.length;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Turn sentinels in rendered module HTML into marker comments (text
|
|
116
|
+
* content) or drop them (everywhere else). See the file header.
|
|
117
|
+
*
|
|
118
|
+
* A tag whose `href` / `src` / `alt` value is exactly one marked value
|
|
119
|
+
* gets `data-caelo-fields="href=<path> …"` plus the placement
|
|
120
|
+
* (`data-caelo-placement`, `data-caelo-shared`), so the editor can offer
|
|
121
|
+
* "Edit link" / "Replace image" (#918). A value assembled from several
|
|
122
|
+
* parts (`href="/blog/{{slug}}"`) is not editable and is not marked.
|
|
123
|
+
*
|
|
124
|
+
* @param placement The placement key, `<blockName>#<position>`.
|
|
125
|
+
* @param sharedPages 0 for a placement with its own content; for a synced
|
|
126
|
+
* (shared) one, the number of pages that show the same content.
|
|
127
|
+
*/
|
|
128
|
+
export function finalizeEditMarkers(html, placement, sharedPages) {
|
|
129
|
+
if (!html.includes(START))
|
|
130
|
+
return html;
|
|
131
|
+
const open = (path) => `<!--${EDIT_MARKER_PREFIX} p=${attr(placement)} s=${sharedPages} f=${attr(path)}-->`;
|
|
132
|
+
const close = `<!--/${EDIT_MARKER_PREFIX}-->`;
|
|
133
|
+
let out = "";
|
|
134
|
+
let i = 0;
|
|
135
|
+
while (i < html.length) {
|
|
136
|
+
const c = html[i];
|
|
137
|
+
if (c === "<" && html.startsWith("<!--", i)) {
|
|
138
|
+
const end = html.indexOf("-->", i + 4);
|
|
139
|
+
const stop = end === -1 ? html.length : end + 3;
|
|
140
|
+
out += stripSentinels(html.slice(i, stop));
|
|
141
|
+
i = stop;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (c === "<" && /[a-zA-Z/!?]/.test(html[i + 1] ?? "")) {
|
|
145
|
+
const stop = tagEnd(html, i);
|
|
146
|
+
const tag = html.slice(i, stop);
|
|
147
|
+
out += markTag(tag, placement, sharedPages);
|
|
148
|
+
i = stop;
|
|
149
|
+
const name = /^<([a-zA-Z][a-zA-Z0-9-]*)/.exec(tag)?.[1]?.toLowerCase();
|
|
150
|
+
if (name && RAW_TEXT_ELEMENTS.has(name) && !tag.endsWith("/>")) {
|
|
151
|
+
const closeAt = html.toLowerCase().indexOf(`</${name}`, i);
|
|
152
|
+
const rawStop = closeAt === -1 ? html.length : closeAt;
|
|
153
|
+
out += stripSentinels(html.slice(i, rawStop));
|
|
154
|
+
i = rawStop;
|
|
155
|
+
}
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (c === START) {
|
|
159
|
+
const sep = html.indexOf(SEP, i);
|
|
160
|
+
const end = html.indexOf(END, i);
|
|
161
|
+
if (sep !== -1 && end !== -1 && sep < end) {
|
|
162
|
+
out += `${open(html.slice(i + 1, sep))}${html.slice(sep + 1, end)}${close}`;
|
|
163
|
+
i = end + 1;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (c !== SEP && c !== END && c !== START)
|
|
168
|
+
out += c;
|
|
169
|
+
i += 1;
|
|
170
|
+
}
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
const ATTRIBUTE = /([^\s"'=<>/]+)(\s*=\s*)(?:"([^"]*)"|'([^']*)')/g;
|
|
174
|
+
const WHOLE_VALUE = /^\uE000([^\uE001]*)\uE001[^\uE002]*\uE002$/;
|
|
175
|
+
/** Strip sentinels from a tag and mark its editable attributes (see finalizeEditMarkers). */
|
|
176
|
+
function markTag(tag, placement, sharedPages) {
|
|
177
|
+
if (!tag.includes(START))
|
|
178
|
+
return tag;
|
|
179
|
+
const marks = [];
|
|
180
|
+
const cleaned = stripSentinels(tag.replace(ATTRIBUTE, (m, name, eq, dq, sq) => {
|
|
181
|
+
const value = dq ?? sq ?? "";
|
|
182
|
+
if (!value.includes(START))
|
|
183
|
+
return m;
|
|
184
|
+
const whole = WHOLE_VALUE.exec(value);
|
|
185
|
+
const lower = name.toLowerCase();
|
|
186
|
+
if (whole?.[1] && MARKABLE_ATTRIBUTES.has(lower))
|
|
187
|
+
marks.push(`${lower}=${attr(whole[1])}`);
|
|
188
|
+
const quote = dq !== undefined ? '"' : "'";
|
|
189
|
+
return `${name}${eq}${quote}${stripSentinels(value)}${quote}`;
|
|
190
|
+
}));
|
|
191
|
+
if (marks.length === 0)
|
|
192
|
+
return cleaned;
|
|
193
|
+
const extra = ` data-caelo-fields="${marks.join(" ")}" data-caelo-placement="${attr(placement)}" data-caelo-shared="${sharedPages}"`;
|
|
194
|
+
const at = cleaned.endsWith("/>") ? cleaned.length - 2 : cleaned.length - 1;
|
|
195
|
+
return `${cleaned.slice(0, at)}${extra}${cleaned.slice(at)}`;
|
|
196
|
+
}
|
|
197
|
+
/** Drop sentinels and the path they carry, keeping the wrapped value. */
|
|
198
|
+
function stripSentinels(s) {
|
|
199
|
+
return s.replace(/\uE000[^\uE001]*\uE001/g, "").replace(SENTINELS, "");
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Parse an opening marker's comment text (without `<!--`/`-->`), or null.
|
|
203
|
+
* Mirrors what the preview runtime does in the browser.
|
|
204
|
+
*/
|
|
205
|
+
export function parseEditMarker(comment) {
|
|
206
|
+
const m = /^caelo:f p=(\S+) s=([01]) f=(\S+)$/.exec(comment.trim());
|
|
207
|
+
if (!m?.[1] || !m[2] || !m[3])
|
|
208
|
+
return null;
|
|
209
|
+
const placement = decodeURIComponent(m[1]);
|
|
210
|
+
const hash = placement.lastIndexOf("#");
|
|
211
|
+
const position = Number(placement.slice(hash + 1));
|
|
212
|
+
if (hash <= 0 || !Number.isInteger(position))
|
|
213
|
+
return null;
|
|
214
|
+
const [field, index] = decodeURIComponent(m[3]).split(".");
|
|
215
|
+
if (!field)
|
|
216
|
+
return null;
|
|
217
|
+
return {
|
|
218
|
+
blockName: placement.slice(0, hash),
|
|
219
|
+
position,
|
|
220
|
+
synced: m[2] === "1",
|
|
221
|
+
field,
|
|
222
|
+
...(index !== undefined ? { index: Number(index) } : {}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|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C,CAAC,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACnD,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,OAAO;QACL,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;QACnC,QAAQ;QACR,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;QACpB,KAAK;QACL,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue #914 — the shape of a Google OAuth client and the redirect URI IAP
|
|
3
|
+
* needs on it. Shared so the admin's server-side validation and the setup
|
|
4
|
+
* page (which shows IAP's redirect URI as the Owner types the client ID)
|
|
5
|
+
* use one definition.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A Google OAuth 2.0 client ID (`<project number>-<random>.apps.googleusercontent.com`).
|
|
9
|
+
* Same pattern as the `operator_oauth_client` CHECK constraint (migration 0323).
|
|
10
|
+
*/
|
|
11
|
+
export declare const GOOGLE_OAUTH_CLIENT_ID: RegExp;
|
|
12
|
+
/**
|
|
13
|
+
* IAP's redirect URI for a custom OAuth client: Google sends a signed-in
|
|
14
|
+
* visitor back to IAP here, so the client must list it among its authorized
|
|
15
|
+
* redirect URIs (cloud.google.com/iap/docs/custom-oauth-configuration).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* iapRedirectUri("123-abc.apps.googleusercontent.com")
|
|
19
|
+
* // → "https://iap.googleapis.com/v1/oauth/clientIds/123-abc.apps.googleusercontent.com:handleRedirect"
|
|
20
|
+
*/
|
|
21
|
+
export declare function iapRedirectUri(clientId: string): string;
|
|
22
|
+
//# sourceMappingURL=google-oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-oauth.d.ts","sourceRoot":"","sources":["../src/google-oauth.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAqD,CAAC;AAEzF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Issue #914 — the shape of a Google OAuth client and the redirect URI IAP
|
|
4
|
+
* needs on it. Shared so the admin's server-side validation and the setup
|
|
5
|
+
* page (which shows IAP's redirect URI as the Owner types the client ID)
|
|
6
|
+
* use one definition.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A Google OAuth 2.0 client ID (`<project number>-<random>.apps.googleusercontent.com`).
|
|
10
|
+
* Same pattern as the `operator_oauth_client` CHECK constraint (migration 0323).
|
|
11
|
+
*/
|
|
12
|
+
export const GOOGLE_OAUTH_CLIENT_ID = /^[0-9]+-[a-z0-9]+\.apps\.googleusercontent\.com$/;
|
|
13
|
+
/**
|
|
14
|
+
* IAP's redirect URI for a custom OAuth client: Google sends a signed-in
|
|
15
|
+
* visitor back to IAP here, so the client must list it among its authorized
|
|
16
|
+
* redirect URIs (cloud.google.com/iap/docs/custom-oauth-configuration).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* iapRedirectUri("123-abc.apps.googleusercontent.com")
|
|
20
|
+
* // → "https://iap.googleapis.com/v1/oauth/clientIds/123-abc.apps.googleusercontent.com:handleRedirect"
|
|
21
|
+
*/
|
|
22
|
+
export function iapRedirectUri(clientId) {
|
|
23
|
+
return `https://iap.googleapis.com/v1/oauth/clientIds/${clientId}:handleRedirect`;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=google-oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-oauth.js","sourceRoot":"","sources":["../src/google-oauth.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,kDAAkD,CAAC;AAEzF;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,iDAAiD,QAAQ,iBAAiB,CAAC;AACpF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./ai-tools.js";
|
|
|
3
3
|
export * from "./auth-forms.js";
|
|
4
4
|
export * from "./auto-update.js";
|
|
5
5
|
export * from "./base-css.js";
|
|
6
|
+
export * from "./bug-intake.js";
|
|
6
7
|
export * from "./build-page.js";
|
|
7
8
|
export * from "./cap-failures.js";
|
|
8
9
|
export * from "./cloud-shell-install.js";
|
|
@@ -13,6 +14,7 @@ export * from "./css-var-scan.js";
|
|
|
13
14
|
export * from "./database-url.js";
|
|
14
15
|
export * from "./design-draft-shell.js";
|
|
15
16
|
export * from "./document-language.js";
|
|
17
|
+
export * from "./edit-markers.js";
|
|
16
18
|
export * from "./font-assets.js";
|
|
17
19
|
export * from "./font-axis-policy.js";
|
|
18
20
|
export * from "./font-usage.js";
|
|
@@ -20,8 +22,10 @@ export * from "./fonts.js";
|
|
|
20
22
|
export * from "./genesis.js";
|
|
21
23
|
export * from "./genesis-inventory.js";
|
|
22
24
|
export * from "./google-models.js";
|
|
25
|
+
export * from "./google-oauth.js";
|
|
23
26
|
export * from "./image-capabilities.js";
|
|
24
27
|
export * from "./interactions.js";
|
|
28
|
+
export * from "./link-canonicalise.js";
|
|
25
29
|
export * from "./link-refs.js";
|
|
26
30
|
export { type LogContext, type Logger, type LoggerOptions, type LogLevel, makeLogger, mintRequestId, redact, type ServiceName, type StructuredLogEntry, } from "./logger.js";
|
|
27
31
|
export * from "./markup-structure.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,cAAc,CAAC;AAExC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,UAAU,EACV,aAAa,EACb,MAAM,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-4,6 +4,7 @@ export * from "./ai-tools.js";
|
|
|
4
4
|
export * from "./auth-forms.js";
|
|
5
5
|
export * from "./auto-update.js";
|
|
6
6
|
export * from "./base-css.js";
|
|
7
|
+
export * from "./bug-intake.js";
|
|
7
8
|
export * from "./build-page.js";
|
|
8
9
|
export * from "./cap-failures.js";
|
|
9
10
|
export * from "./cloud-shell-install.js";
|
|
@@ -14,6 +15,7 @@ export * from "./css-var-scan.js";
|
|
|
14
15
|
export * from "./database-url.js";
|
|
15
16
|
export * from "./design-draft-shell.js";
|
|
16
17
|
export * from "./document-language.js";
|
|
18
|
+
export * from "./edit-markers.js";
|
|
17
19
|
export * from "./font-assets.js";
|
|
18
20
|
export * from "./font-axis-policy.js";
|
|
19
21
|
export * from "./font-usage.js";
|
|
@@ -21,8 +23,10 @@ export * from "./fonts.js";
|
|
|
21
23
|
export * from "./genesis.js";
|
|
22
24
|
export * from "./genesis-inventory.js";
|
|
23
25
|
export * from "./google-models.js";
|
|
26
|
+
export * from "./google-oauth.js";
|
|
24
27
|
export * from "./image-capabilities.js";
|
|
25
28
|
export * from "./interactions.js";
|
|
29
|
+
export * from "./link-canonicalise.js";
|
|
26
30
|
export * from "./link-refs.js";
|
|
27
31
|
export { makeLogger, mintRequestId, redact, } from "./logger.js";
|
|
28
32
|
export * from "./markup-structure.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AAExC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AA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C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,aAAa,EACb,aAAa,EAEb,cAAc,EACd,YAAY,GACb,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/** What the canonicaliser needs to know about the site. */
|
|
2
|
+
export interface LinkTargetLookup {
|
|
3
|
+
/**
|
|
4
|
+
* The page served at `path` (leading slash, no trailing slash except
|
|
5
|
+
* the root "/"), following one redirect hop when the path is an old
|
|
6
|
+
* URL whose redirect lands on a page. Null when no page answers it.
|
|
7
|
+
*/
|
|
8
|
+
pageIdForPath(path: string): string | null;
|
|
9
|
+
/** The live media asset with this slug, or null. */
|
|
10
|
+
mediaIdForSlug(slug: string): string | null;
|
|
11
|
+
pageExists(pageId: string): boolean;
|
|
12
|
+
mediaExists(mediaId: string): boolean;
|
|
13
|
+
/** True when `host` (lowercase, may carry a port) is the site's own. */
|
|
14
|
+
isOwnHost(host: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* True when `path` names a page that does not exist YET but is planned:
|
|
17
|
+
* a page of the site import the writing chat is rebuilding, not built
|
|
18
|
+
* so far (#724 rollout C, maintainer decision on open point 1). Such a
|
|
19
|
+
* link keeps its literal path and lands in
|
|
20
|
+
* {@link LinkCanonicaliseRun.pending} instead of being an issue; the
|
|
21
|
+
* import converts it once the page exists. Absent = nothing is pending
|
|
22
|
+
* (every write outside an import run).
|
|
23
|
+
*/
|
|
24
|
+
isPendingPagePath?(path: string): boolean;
|
|
25
|
+
}
|
|
26
|
+
/** A link to a planned (not yet built) page, kept literal for now. */
|
|
27
|
+
export interface PendingLinkTarget {
|
|
28
|
+
/** The link exactly as written (trimmed). */
|
|
29
|
+
readonly value: string;
|
|
30
|
+
/** Its normalised path: the planned page's path. */
|
|
31
|
+
readonly path: string;
|
|
32
|
+
readonly where: string;
|
|
33
|
+
}
|
|
34
|
+
/** One link the canonicaliser could not turn into a reference. */
|
|
35
|
+
export interface LinkCanonicaliseIssue {
|
|
36
|
+
readonly kind: "unknown-page-path" | "unknown-media" | "dangling-page-ref" | "dangling-media-ref" | "unknown-file" | "unsupported-link-form" | "malformed-link-ref";
|
|
37
|
+
/** The link exactly as written. */
|
|
38
|
+
readonly value: string;
|
|
39
|
+
/** Where it was found: `values.cta_href`, `html`, `fields.nav.default[2].href`, `items[0].href`. */
|
|
40
|
+
readonly where: string;
|
|
41
|
+
}
|
|
42
|
+
/** A canonicalisation run over one write. */
|
|
43
|
+
export interface LinkCanonicaliseRun {
|
|
44
|
+
readonly lookup: LinkTargetLookup;
|
|
45
|
+
/**
|
|
46
|
+
* `strict` (actor writes): unknown targets are issues the op refuses.
|
|
47
|
+
* `report` (imports): unknown targets stay literal and are reported.
|
|
48
|
+
* Either way they land in {@link issues}.
|
|
49
|
+
*/
|
|
50
|
+
readonly mode: "strict" | "report";
|
|
51
|
+
/** Link literals already present in the stored state; see file header. */
|
|
52
|
+
readonly grandfathered: ReadonlySet<string>;
|
|
53
|
+
readonly issues: LinkCanonicaliseIssue[];
|
|
54
|
+
/** Links to planned pages (see {@link LinkTargetLookup.isPendingPagePath}). */
|
|
55
|
+
readonly pending: PendingLinkTarget[];
|
|
56
|
+
}
|
|
57
|
+
/** Start a run. */
|
|
58
|
+
export declare function linkCanonicaliseRun(lookup: LinkTargetLookup, opts?: {
|
|
59
|
+
mode?: "strict" | "report";
|
|
60
|
+
grandfathered?: ReadonlySet<string>;
|
|
61
|
+
}): LinkCanonicaliseRun;
|
|
62
|
+
/** Key / field names whose whole value is a URL. */
|
|
63
|
+
export declare function isLinkKeyName(name: string): boolean;
|
|
64
|
+
/** `/a/b/` → `/a/b`; `/` stays `/`. Linear, no regex backtracking. */
|
|
65
|
+
export declare function normaliseLinkPath(path: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Canonicalise one URL value. Returns the stored form: a reference, or
|
|
68
|
+
* the value unchanged (external, non-page, or an issue was recorded).
|
|
69
|
+
*
|
|
70
|
+
* @param scope `pages+media` for link positions (`href`, link fields);
|
|
71
|
+
* `media` for image positions (`src`, `srcset`, `poster`).
|
|
72
|
+
*/
|
|
73
|
+
export declare function canonicaliseUrl(value: string, run: LinkCanonicaliseRun, where: string, scope?: "pages+media" | "media"): string;
|
|
74
|
+
/** Canonicalise the link-bearing attributes of an HTML fragment. */
|
|
75
|
+
export declare function canonicaliseHtmlLinks(html: string, run: LinkCanonicaliseRun, where: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Canonicalise any JSON value: whole-value URLs where the key says so
|
|
78
|
+
* (`asUrl`), HTML attributes in every string, recursing through arrays
|
|
79
|
+
* and objects (object keys decide per {@link isLinkKeyName}).
|
|
80
|
+
*/
|
|
81
|
+
export declare function canonicaliseJsonLinks(value: unknown, run: LinkCanonicaliseRun, where: string, asUrl?: boolean): unknown;
|
|
82
|
+
/** A module field as canonicalisation needs it. */
|
|
83
|
+
export interface CanonicaliseField {
|
|
84
|
+
readonly name: string;
|
|
85
|
+
readonly kind: string;
|
|
86
|
+
readonly default?: unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Canonicalise a content instance's values against its module's fields.
|
|
90
|
+
* Values without a declared field are still scanned (key-name rule +
|
|
91
|
+
* HTML) — a stale value renders nowhere today but may again tomorrow.
|
|
92
|
+
*/
|
|
93
|
+
export declare function canonicaliseContentValues(fields: readonly CanonicaliseField[], values: Readonly<Record<string, unknown>>, run: LinkCanonicaliseRun): Record<string, unknown>;
|
|
94
|
+
/** Canonicalise every field's `default` (layout chrome content lives there). */
|
|
95
|
+
export declare function canonicaliseFieldDefaults<F extends CanonicaliseField>(fields: readonly F[], run: LinkCanonicaliseRun): F[];
|
|
96
|
+
/**
|
|
97
|
+
* Every link literal inside a stored state (values, defaults, set items,
|
|
98
|
+
* module HTML) — the {@link LinkCanonicaliseRun.grandfathered} set of the
|
|
99
|
+
* next write. Collected with a lookup that knows nothing, so every
|
|
100
|
+
* candidate surfaces as an "issue" carrying its raw value.
|
|
101
|
+
*/
|
|
102
|
+
export declare function collectLinkLiterals(state: unknown): Set<string>;
|
|
103
|
+
/**
|
|
104
|
+
* One AI-actionable message for a refused write (CLAUDE.md §11): what is
|
|
105
|
+
* wrong with each link and the next step. Paths only — the author never
|
|
106
|
+
* sees reference ids except for a reference that is already broken.
|
|
107
|
+
*/
|
|
108
|
+
export declare function describeLinkIssues(issues: readonly LinkCanonicaliseIssue[]): string;
|
|
109
|
+
//# sourceMappingURL=link-canonicalise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-canonicalise.d.ts","sourceRoot":"","sources":["../src/link-canonicalise.ts"],"names":[],"mappings":"AAoDA,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3C,oDAAoD;IACpD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,wEAAwE;IACxE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3C;AAED,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,kEAA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