@nakedcreativity/cee-ms-node 2.0.0-beta.0 → 2.0.0-beta.10
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/README.md +202 -10
- package/lib/draft.d.ts +7 -4
- package/lib/draft.js +48 -25
- package/lib/draft.js.map +1 -1
- package/lib/index.d.ts +31 -3
- package/lib/index.js +135 -23
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +295 -10
- package/lib/interfaces.js +1 -0
- package/lib/interfaces.js.map +1 -1
- package/lib/links.d.ts +90 -0
- package/lib/links.js +255 -0
- package/lib/links.js.map +1 -0
- package/lib/preview-token.d.ts +13 -4
- package/lib/preview-token.js +6 -2
- package/lib/preview-token.js.map +1 -1
- package/lib/social-meta.d.ts +15 -0
- package/lib/social-meta.js +74 -0
- package/lib/social-meta.js.map +1 -0
- package/lib/storage.d.ts +1 -0
- package/lib/storage.js +3 -1
- package/lib/storage.js.map +1 -1
- package/lib/structured-data.d.ts +35 -0
- package/lib/structured-data.js +591 -0
- package/lib/structured-data.js.map +1 -0
- package/lib/tags/blog.d.ts +3 -2
- package/lib/tags/blog.js +14 -5
- package/lib/tags/blog.js.map +1 -1
- package/lib/tags/index.d.ts +2 -0
- package/lib/tags/index.js +2 -0
- package/lib/tags/index.js.map +1 -1
- package/lib/tags/social-meta.d.ts +6 -0
- package/lib/tags/social-meta.js +19 -0
- package/lib/tags/social-meta.js.map +1 -0
- package/lib/tags/structured-data.d.ts +8 -0
- package/lib/tags/structured-data.js +36 -0
- package/lib/tags/structured-data.js.map +1 -0
- package/lib/views.d.ts +76 -0
- package/lib/views.js +426 -0
- package/lib/views.js.map +1 -0
- package/package.json +8 -1
package/lib/interfaces.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type express from 'express';
|
|
|
3
3
|
import type { Context, FilterImplOptions } from 'liquidjs';
|
|
4
4
|
export declare enum CacheSource {
|
|
5
5
|
Local = 0,
|
|
6
|
+
/** The bucket, read with the host's own AWS credentials (`cacheBucket`, `cacheRegion`). */
|
|
6
7
|
S3 = 1
|
|
7
8
|
}
|
|
8
9
|
export interface CeemsConfig {
|
|
@@ -17,6 +18,13 @@ export interface CeemsConfig {
|
|
|
17
18
|
/** Region of `cacheBucket`. Defaults to the `AWS_REGION` environment variable. */
|
|
18
19
|
cacheRegion?: string;
|
|
19
20
|
cacheFolder?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The environment this renderer serves: published files are read from `<environment>/` in the bucket or
|
|
23
|
+
* folder. Defaults to the `CEEMS_ENVIRONMENT` environment variable, then `development`.
|
|
24
|
+
*/
|
|
25
|
+
environment?: string;
|
|
26
|
+
/** Where published files are read from in the bucket or folder: `<environment>/` unless set. */
|
|
27
|
+
cachePrefix?: string;
|
|
20
28
|
whitelistedCookies?: Array<string>;
|
|
21
29
|
tags?: Array<LiquidTag>;
|
|
22
30
|
filters?: Array<LiquidFilter>;
|
|
@@ -26,21 +34,25 @@ export interface CeemsConfig {
|
|
|
26
34
|
* `ceems.engine.options.globals.metadata` (which still works).
|
|
27
35
|
*/
|
|
28
36
|
globals?: Record<string, unknown>;
|
|
29
|
-
/** Draft previews for the Cee.ms editor. Drafts are disabled unless
|
|
37
|
+
/** Draft previews for the Cee.ms editor. Drafts are disabled unless the preview secret is set. */
|
|
30
38
|
preview?: PreviewConfig;
|
|
31
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Only the secret is needed: each preview token names the API that serves its draft and the editor that frames
|
|
42
|
+
* it, and the bridge loads from that editor (`<editor>/bridge.js`). The rest are fallbacks and overrides.
|
|
43
|
+
*/
|
|
32
44
|
export interface PreviewConfig {
|
|
33
45
|
/** Per-site secret that signs preview tokens. Defaults to `CEEMS_PREVIEW_SECRET`. */
|
|
34
46
|
secret?: string;
|
|
35
|
-
/**
|
|
47
|
+
/** The Cee.ms API, for tokens that don't name one. Defaults to `CEEMS_API_URL`. */
|
|
36
48
|
apiUrl?: string;
|
|
37
|
-
/**
|
|
49
|
+
/** The editor's origin, for tokens that don't name one. Defaults to `CEEMS_EDITOR_ORIGIN`. */
|
|
38
50
|
editorOrigin?: string;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Loads the bridge from here instead of the editor, for testing a local build. Defaults to
|
|
53
|
+
* `CEEMS_BRIDGE_SRC`.
|
|
54
|
+
*/
|
|
55
|
+
bridgeSrc?: string;
|
|
44
56
|
}
|
|
45
57
|
/** Matches liquidjs's tag options, which liquidjs 10 no longer exports from its entry point. */
|
|
46
58
|
export interface TagImplOptions {
|
|
@@ -60,8 +72,247 @@ export interface CeemsSite {
|
|
|
60
72
|
navigation: any;
|
|
61
73
|
blogs: any;
|
|
62
74
|
pages: any;
|
|
63
|
-
site:
|
|
75
|
+
site: CeemsSiteInfo;
|
|
76
|
+
/**
|
|
77
|
+
* Site settings by field key (from Cee.ms 2), as published; drafts carry them as edited. Templates
|
|
78
|
+
* read them as `settings`, e.g. `{{ settings.phone }}`. Stored links read as their address.
|
|
79
|
+
*/
|
|
80
|
+
settings?: Record<string, any>;
|
|
64
81
|
collections?: any;
|
|
82
|
+
/**
|
|
83
|
+
* Every published page by id (absent for sites last published before it): page links read their address from here when the page
|
|
84
|
+
* renders, so a renamed or moved page is right everywhere once it is published. A link to a page that
|
|
85
|
+
* isn't here is broken.
|
|
86
|
+
*/
|
|
87
|
+
pageIndex?: Record<string, CeemsPageIndexEntry>;
|
|
88
|
+
/** The documents published content uses, by id, read by document links and values as the page renders. */
|
|
89
|
+
documents?: Record<string, CeemsPublishedDocument>;
|
|
90
|
+
/** The site's People by row id, for bylines, profile pages and row fields. */
|
|
91
|
+
people?: Record<string, CeemsPerson>;
|
|
92
|
+
}
|
|
93
|
+
/** A person from the site's People, in `site.json` `people`. Sites may add columns of their own. */
|
|
94
|
+
export interface CeemsPerson {
|
|
95
|
+
name: string;
|
|
96
|
+
jobTitle?: string;
|
|
97
|
+
photo?: CeemsImage;
|
|
98
|
+
/** Rich text. */
|
|
99
|
+
bio?: string;
|
|
100
|
+
links?: {
|
|
101
|
+
url: string;
|
|
102
|
+
}[];
|
|
103
|
+
/** `links` as addresses, for structured data. */
|
|
104
|
+
sameAs: string[];
|
|
105
|
+
email?: string;
|
|
106
|
+
telephone?: string;
|
|
107
|
+
/** Their profile page, if they have one. */
|
|
108
|
+
profile?: {
|
|
109
|
+
kind: 'page';
|
|
110
|
+
pageId: string;
|
|
111
|
+
url: string;
|
|
112
|
+
};
|
|
113
|
+
[column: string]: unknown;
|
|
114
|
+
}
|
|
115
|
+
/** A byline author, as published: a person from People, someone typed in, or the organisation. */
|
|
116
|
+
export type CeemsBylineAuthor = {
|
|
117
|
+
kind: 'person';
|
|
118
|
+
collectionId: string;
|
|
119
|
+
rowId: string;
|
|
120
|
+
} | {
|
|
121
|
+
kind: 'guest';
|
|
122
|
+
name: string;
|
|
123
|
+
url?: string;
|
|
124
|
+
jobTitle?: string;
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'organisation';
|
|
127
|
+
};
|
|
128
|
+
/** A published page, in `site.json` `pageIndex`. */
|
|
129
|
+
export interface CeemsPageIndexEntry {
|
|
130
|
+
/** Its address, e.g. `/about/team`, or `/` for the home page. */
|
|
131
|
+
path: string;
|
|
132
|
+
name: string;
|
|
133
|
+
}
|
|
134
|
+
export interface CeemsDocumentInfo {
|
|
135
|
+
numpages?: number;
|
|
136
|
+
dimensions?: {
|
|
137
|
+
width: number;
|
|
138
|
+
height: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** A library document, in `site.json` `documents`. */
|
|
142
|
+
export interface CeemsPublishedDocument {
|
|
143
|
+
url: string;
|
|
144
|
+
thumbnail?: string;
|
|
145
|
+
info?: CeemsDocumentInfo;
|
|
146
|
+
}
|
|
147
|
+
/** A published `data/<id>.json`. */
|
|
148
|
+
export interface CeemsDataFile {
|
|
149
|
+
_id: string;
|
|
150
|
+
name: string;
|
|
151
|
+
slug: string;
|
|
152
|
+
columns: any[];
|
|
153
|
+
/** Each row's values, in order: as Cee.ms 1 published them. */
|
|
154
|
+
data: Record<string, any>[];
|
|
155
|
+
/** The same rows with their ids, for row references. Absent for data last published before it. */
|
|
156
|
+
rows?: ({
|
|
157
|
+
_id: string;
|
|
158
|
+
} & Record<string, any>)[];
|
|
159
|
+
}
|
|
160
|
+
/** The published `site.json` `site`. */
|
|
161
|
+
export interface CeemsSiteInfo {
|
|
162
|
+
name: string;
|
|
163
|
+
cdn: string;
|
|
164
|
+
url: string;
|
|
165
|
+
/** The site's organisation, for templates (`{{ site.organisation.telephone }}`) and structured data. */
|
|
166
|
+
organisation?: CeemsOrganisation;
|
|
167
|
+
structuredData?: {
|
|
168
|
+
defaults?: StructuredDataDefaults;
|
|
169
|
+
/** For module types holding questions and answers: where they are, by module config type. */
|
|
170
|
+
faqModules?: Record<string, FaqModuleMapping>;
|
|
171
|
+
/** For module types holding reviews, which attach to a product or event page. */
|
|
172
|
+
reviewModules?: Record<string, ReviewsModuleMapping>;
|
|
173
|
+
/** For module types featuring people: their row field to People, by module config type. */
|
|
174
|
+
peopleModules?: Record<string, {
|
|
175
|
+
field: string;
|
|
176
|
+
}>;
|
|
177
|
+
};
|
|
178
|
+
[key: string]: any;
|
|
179
|
+
}
|
|
180
|
+
/** A schema.org type a page or the site's defaults can switch on for `{% structureddata %}`. */
|
|
181
|
+
export type StructuredDataType = 'WEBSITE' | 'WEBPAGE' | 'BREADCRUMB' | 'ORGANISATION' | 'ARTICLE' | 'FAQ';
|
|
182
|
+
/**
|
|
183
|
+
* What a page is about. Products, events, people and services output their own node when they have the data;
|
|
184
|
+
* `HOME` is the site's front page, which by default carries the site and organisation. Templates and modules
|
|
185
|
+
* can read it, e.g. `{% if page.entity == 'PRODUCT' %}`.
|
|
186
|
+
*/
|
|
187
|
+
export type PageEntity = 'HOME' | 'PAGE' | 'ARTICLE' | 'PRODUCT' | 'EVENT' | 'PERSON' | 'SERVICE';
|
|
188
|
+
/** The types each kind of page outputs unless it chooses its own. */
|
|
189
|
+
export interface StructuredDataDefaults {
|
|
190
|
+
home: StructuredDataType[];
|
|
191
|
+
page: StructuredDataType[];
|
|
192
|
+
blog: StructuredDataType[];
|
|
193
|
+
article: StructuredDataType[];
|
|
194
|
+
}
|
|
195
|
+
/** `itemsField` is a contributor field of the module; the others are fields of its items. */
|
|
196
|
+
export interface FaqModuleMapping {
|
|
197
|
+
itemsField: string;
|
|
198
|
+
questionField: string;
|
|
199
|
+
answerField: string;
|
|
200
|
+
}
|
|
201
|
+
/** `itemsField` is a contributor field of the module; the others are fields of its items. */
|
|
202
|
+
export interface ReviewsModuleMapping {
|
|
203
|
+
itemsField: string;
|
|
204
|
+
authorField: string;
|
|
205
|
+
/** A select of numbers, or text holding one. */
|
|
206
|
+
ratingField: string;
|
|
207
|
+
bodyField?: string;
|
|
208
|
+
dateField?: string;
|
|
209
|
+
bestRating: number;
|
|
210
|
+
worstRating: number;
|
|
211
|
+
}
|
|
212
|
+
/** An image value as published. */
|
|
213
|
+
export interface CeemsImage {
|
|
214
|
+
src: string;
|
|
215
|
+
variants?: Record<string, string>;
|
|
216
|
+
alt?: string;
|
|
217
|
+
width?: number;
|
|
218
|
+
height?: number;
|
|
219
|
+
}
|
|
220
|
+
export interface CeemsPostalAddress {
|
|
221
|
+
street?: string;
|
|
222
|
+
locality?: string;
|
|
223
|
+
region?: string;
|
|
224
|
+
postalCode?: string;
|
|
225
|
+
country?: string;
|
|
226
|
+
}
|
|
227
|
+
export interface CeemsOrganisation {
|
|
228
|
+
/** The schema.org type, from Cee.ms's business types: `Organization`, or one such as `RealEstateAgent`. */
|
|
229
|
+
type: string;
|
|
230
|
+
name: string;
|
|
231
|
+
legalName?: string;
|
|
232
|
+
logo?: CeemsImage;
|
|
233
|
+
url?: string;
|
|
234
|
+
email?: string;
|
|
235
|
+
telephone?: string;
|
|
236
|
+
address?: CeemsPostalAddress;
|
|
237
|
+
/** Its profiles by platform, e.g. `{{ site.organisation.socialProfiles.instagram }}`. */
|
|
238
|
+
socialProfiles?: CeemsSocialProfiles;
|
|
239
|
+
/** Every profile URL in `socialProfiles`, as structured data lists them. */
|
|
240
|
+
sameAs?: string[];
|
|
241
|
+
openingHours?: {
|
|
242
|
+
days: string[];
|
|
243
|
+
opens: string;
|
|
244
|
+
closes: string;
|
|
245
|
+
}[];
|
|
246
|
+
priceRange?: string;
|
|
247
|
+
}
|
|
248
|
+
/** Profile URLs on the platforms most sites link to, and any others by name. */
|
|
249
|
+
export interface CeemsSocialProfiles {
|
|
250
|
+
instagram?: string;
|
|
251
|
+
facebook?: string;
|
|
252
|
+
linkedin?: string;
|
|
253
|
+
x?: string;
|
|
254
|
+
youtube?: string;
|
|
255
|
+
tiktok?: string;
|
|
256
|
+
bluesky?: string;
|
|
257
|
+
/** A `wa.me` link. */
|
|
258
|
+
whatsapp?: string;
|
|
259
|
+
custom: {
|
|
260
|
+
name: string;
|
|
261
|
+
url: string;
|
|
262
|
+
}[];
|
|
263
|
+
}
|
|
264
|
+
export type CeemsAvailability = 'IN_STOCK' | 'OUT_OF_STOCK' | 'PRE_ORDER' | 'SOLD_OUT' | 'DISCONTINUED';
|
|
265
|
+
export interface CeemsOffer {
|
|
266
|
+
price: number;
|
|
267
|
+
currency: string;
|
|
268
|
+
url?: string;
|
|
269
|
+
availability?: CeemsAvailability;
|
|
270
|
+
}
|
|
271
|
+
/** A page's structured data choices, and the details of its entity. */
|
|
272
|
+
export interface CeemsPageStructuredData {
|
|
273
|
+
/** Absent: the site's defaults for the page's kind. */
|
|
274
|
+
types?: StructuredDataType[];
|
|
275
|
+
event?: {
|
|
276
|
+
name?: string;
|
|
277
|
+
description?: string;
|
|
278
|
+
startDate: string;
|
|
279
|
+
endDate?: string;
|
|
280
|
+
attendance?: 'OFFLINE' | 'ONLINE' | 'MIXED';
|
|
281
|
+
status?: 'SCHEDULED' | 'CANCELLED' | 'POSTPONED' | 'RESCHEDULED' | 'MOVED_ONLINE';
|
|
282
|
+
location?: {
|
|
283
|
+
name?: string;
|
|
284
|
+
address?: CeemsPostalAddress;
|
|
285
|
+
url?: string;
|
|
286
|
+
};
|
|
287
|
+
image?: CeemsImage;
|
|
288
|
+
offers?: CeemsOffer;
|
|
289
|
+
};
|
|
290
|
+
product?: {
|
|
291
|
+
name?: string;
|
|
292
|
+
description?: string;
|
|
293
|
+
brand?: string;
|
|
294
|
+
sku?: string;
|
|
295
|
+
image?: CeemsImage;
|
|
296
|
+
/** With `currency`; a product needs a price or reviews. */
|
|
297
|
+
price?: number;
|
|
298
|
+
currency?: string;
|
|
299
|
+
availability?: CeemsAvailability;
|
|
300
|
+
};
|
|
301
|
+
person?: {
|
|
302
|
+
name: string;
|
|
303
|
+
jobTitle?: string;
|
|
304
|
+
url?: string;
|
|
305
|
+
image?: CeemsImage;
|
|
306
|
+
sameAs?: string[];
|
|
307
|
+
};
|
|
308
|
+
service?: {
|
|
309
|
+
name?: string;
|
|
310
|
+
description?: string;
|
|
311
|
+
serviceType?: string;
|
|
312
|
+
areaServed?: string;
|
|
313
|
+
image?: CeemsImage;
|
|
314
|
+
offers?: CeemsOffer;
|
|
315
|
+
};
|
|
65
316
|
}
|
|
66
317
|
export interface CeemsRequest extends express.Request {
|
|
67
318
|
page: CeemsPage;
|
|
@@ -80,11 +331,43 @@ export interface CeemsPage {
|
|
|
80
331
|
modules: Record<string, CeemsModule | string>;
|
|
81
332
|
template: string;
|
|
82
333
|
path: Array<string>;
|
|
83
|
-
|
|
334
|
+
/** A stored link (read as its address), or a path on sites from before links; a published page redirects */
|
|
335
|
+
redirect?: string | {
|
|
336
|
+
url: string;
|
|
337
|
+
toString(): string;
|
|
338
|
+
} | null;
|
|
84
339
|
_id: string;
|
|
85
340
|
pagination: number;
|
|
86
341
|
fullpath: string;
|
|
87
342
|
handle: string;
|
|
343
|
+
/** The page's own name, for menus. */
|
|
344
|
+
name?: string;
|
|
345
|
+
/** SEO title. */
|
|
346
|
+
title?: string;
|
|
347
|
+
/** SEO description. */
|
|
348
|
+
description?: string;
|
|
349
|
+
/** Social sharing image. */
|
|
350
|
+
social?: CeemsImage;
|
|
351
|
+
type?: 'blog' | 'article';
|
|
352
|
+
/** Published from Cee.ms with the default resolved: `HOME` for the home page, else `PAGE`. */
|
|
353
|
+
entity?: PageEntity;
|
|
354
|
+
/** The site's own page type, such as `property`, by key. Its `entity` is the type's base. */
|
|
355
|
+
pageType?: string;
|
|
356
|
+
tags?: string[];
|
|
357
|
+
/** An article's date. */
|
|
358
|
+
date?: string;
|
|
359
|
+
publishedAt?: string;
|
|
360
|
+
updatedAt?: string;
|
|
361
|
+
structuredData?: CeemsPageStructuredData;
|
|
362
|
+
/** An article's byline, as published. Templates read `page.authors`. */
|
|
363
|
+
byline?: {
|
|
364
|
+
authors: CeemsBylineAuthor[];
|
|
365
|
+
reviewedBy?: unknown;
|
|
366
|
+
};
|
|
367
|
+
/** For entity `PERSON`: the person whose profile page it is, as a `RowDrop` once loaded. */
|
|
368
|
+
person?: unknown;
|
|
369
|
+
/** The byline, resolved (see `bylineAuthors`): people, guests and the organisation, in order. */
|
|
370
|
+
authors?: Record<string, unknown>[];
|
|
88
371
|
[key: string]: any;
|
|
89
372
|
}
|
|
90
373
|
export interface CeemsRegion {
|
|
@@ -106,6 +389,8 @@ export interface RenderState {
|
|
|
106
389
|
page: CeemsPage;
|
|
107
390
|
/** A verified editor draft: adds module markers and the editor bridge. */
|
|
108
391
|
edit: boolean;
|
|
392
|
+
/** In a draft, the editor framing it, which the bridge talks to. */
|
|
393
|
+
editorOrigin?: string;
|
|
109
394
|
}
|
|
110
395
|
export interface CeemsModuleContextGlobal {
|
|
111
396
|
site: Array<any>;
|
package/lib/interfaces.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.CacheSource = void 0;
|
|
|
4
4
|
var CacheSource;
|
|
5
5
|
(function (CacheSource) {
|
|
6
6
|
CacheSource[CacheSource["Local"] = 0] = "Local";
|
|
7
|
+
/** The bucket, read with the host's own AWS credentials (`cacheBucket`, `cacheRegion`). */
|
|
7
8
|
CacheSource[CacheSource["S3"] = 1] = "S3";
|
|
8
9
|
})(CacheSource || (exports.CacheSource = CacheSource = {}));
|
|
9
10
|
//# sourceMappingURL=interfaces.js.map
|
package/lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AAIA,IAAY,
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AAIA,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,+CAAK,CAAA;IACL,2FAA2F;IAC3F,yCAAE,CAAA;AACN,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB"}
|
package/lib/links.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Drop } from 'liquidjs';
|
|
2
|
+
import type { CeemsDataFile, CeemsDocumentInfo, CeemsPageIndexEntry, CeemsPublishedDocument, CeemsSite } from './interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* What references resolve against when a page renders: the published pages and documents from `site.json`,
|
|
5
|
+
* and the rows of the data collections the page points at. Each is published once, so a renamed page or an
|
|
6
|
+
* edited row is right everywhere as soon as that one change is published. A site published before Cee.ms
|
|
7
|
+
* sent these has none of them, and links read their stored address as before.
|
|
8
|
+
*/
|
|
9
|
+
export interface LinkContext {
|
|
10
|
+
pageIndex?: Record<string, CeemsPageIndexEntry>;
|
|
11
|
+
documents?: Record<string, CeemsPublishedDocument>;
|
|
12
|
+
/** A row by collection and row id, or undefined if it isn't published (or was deleted). */
|
|
13
|
+
row?: (collectionId: string, rowId: string) => Record<string, unknown> | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A stored link value in templates. It reads as its address, so a field that held a URL string and became a
|
|
17
|
+
* link field still works where templates print it (`{{ item.url }}`), filter it (`| escape`, `| append`),
|
|
18
|
+
* compare it (`== '/about'`, `!= blank`) or measure it (`| size`); and its parts are there too
|
|
19
|
+
* (`{{ item.url.kind }}`, `.pageId`, `.anchor`). `| json` shows the whole link.
|
|
20
|
+
*
|
|
21
|
+
* A page link whose page isn't published reads as `''`, with `broken` true, so `{% if link %}` leaves it out.
|
|
22
|
+
*/
|
|
23
|
+
export declare class LinkDrop extends Drop {
|
|
24
|
+
kind: string;
|
|
25
|
+
url: string;
|
|
26
|
+
pageId?: string;
|
|
27
|
+
documentId?: string;
|
|
28
|
+
anchor?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
broken?: boolean;
|
|
31
|
+
constructor(link: Record<string, unknown>);
|
|
32
|
+
valueOf(): string;
|
|
33
|
+
toString(): string;
|
|
34
|
+
/** For `| size`, which reads `.length`. */
|
|
35
|
+
get length(): number;
|
|
36
|
+
/** For `{{ item.url.size }}`. */
|
|
37
|
+
get size(): number;
|
|
38
|
+
toJSON(): Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A document value (`{ documentId, url, thumbnail, info }`) in templates, read from the published documents
|
|
42
|
+
* so a replaced file is right everywhere. It prints as its address, so `{{ download }}` and
|
|
43
|
+
* `{{ download.url }}` both work.
|
|
44
|
+
*/
|
|
45
|
+
export declare class DocumentDrop extends Drop {
|
|
46
|
+
documentId?: string;
|
|
47
|
+
url: string;
|
|
48
|
+
thumbnail?: string;
|
|
49
|
+
info?: CeemsDocumentInfo;
|
|
50
|
+
constructor(value: Record<string, unknown>);
|
|
51
|
+
valueOf(): string;
|
|
52
|
+
toString(): string;
|
|
53
|
+
toJSON(): Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A row of a data collection, from a `row` field: its columns by key (`{{ author.name }}`,
|
|
57
|
+
* `{% image person.photo 'square' %}`), plus `_id`. It prints as its `name`, else its first text value.
|
|
58
|
+
*/
|
|
59
|
+
export declare class RowDrop extends Drop {
|
|
60
|
+
_id: string;
|
|
61
|
+
[column: string]: unknown;
|
|
62
|
+
constructor(row: Record<string, unknown>);
|
|
63
|
+
toString(): string;
|
|
64
|
+
valueOf(): string;
|
|
65
|
+
toJSON(): Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Rich text links carry the page they point at (`data-page-id`); their `href` comes from the published page,
|
|
69
|
+
* keeping any `#anchor`, and is dropped when that page isn't published. Documents' come from `documents`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveRichText(html: string, context: LinkContext): string;
|
|
72
|
+
/**
|
|
73
|
+
* Wraps every stored link in a published page, data file or draft in a `LinkDrop`, every document value in a
|
|
74
|
+
* `DocumentDrop` and every row reference in a `RowDrop`, in place, resolving each against `context`. A row
|
|
75
|
+
* that isn't published reads as nothing, and is left out of lists.
|
|
76
|
+
*/
|
|
77
|
+
export declare function wrapLinks<T>(value: T, context?: LinkContext, depth?: number): T;
|
|
78
|
+
/** The rows a page's row references and byline authors point at, by collection id. */
|
|
79
|
+
export declare function referencedRows(value: unknown, found?: Map<string, Set<string>>): Map<string, Set<string>>;
|
|
80
|
+
/**
|
|
81
|
+
* The context for a site and the data files its page points at. People come from `site.json` `people` (with
|
|
82
|
+
* `sameAs`), so a person reads the same wherever they are referenced.
|
|
83
|
+
*/
|
|
84
|
+
export declare function linkContextFor(site: CeemsSite | undefined, files?: Iterable<CeemsDataFile | null>): LinkContext;
|
|
85
|
+
/**
|
|
86
|
+
* An article's byline as templates and structured data read it, in order: `page.authors`. A person is their
|
|
87
|
+
* People row (`{{ author.name }}`, `{{ author.profile }}`); a guest is what was typed; the organisation is the
|
|
88
|
+
* site's. Each has `kind`, `name` and `url` (a person's profile page, else their first profile link).
|
|
89
|
+
*/
|
|
90
|
+
export declare function bylineAuthors(page: Record<string, any>, site: CeemsSite | undefined, context: LinkContext): Record<string, unknown>[];
|