@paroicms/public-server-lib 0.30.0 → 0.31.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/package.json +3 -3
- package/types/backend-plugin-types.d.ts +34 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/public-server-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Common utilitaries for paroicms plugins (backend side).",
|
|
5
5
|
"author": "Paroi Team",
|
|
6
6
|
"repository": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@paroi/data-formatters-lib": "~0.4.0",
|
|
24
|
-
"@paroicms/internal-anywhere-lib": "1.
|
|
25
|
-
"@paroicms/public-anywhere-lib": "0.
|
|
24
|
+
"@paroicms/internal-anywhere-lib": "1.27.0",
|
|
25
|
+
"@paroicms/public-anywhere-lib": "0.21.0",
|
|
26
26
|
"@types/express": "~4.17.21"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Obj } from "@paroi/data-formatters-lib";
|
|
2
2
|
import type {
|
|
3
|
-
FieldValue,
|
|
4
3
|
ImageSize,
|
|
4
|
+
JsonFieldValue,
|
|
5
5
|
ParsedNodelId,
|
|
6
|
+
ReadFieldValue,
|
|
6
7
|
ScFieldDataType,
|
|
7
8
|
ScSiteSchema,
|
|
8
9
|
SiteIds,
|
|
@@ -74,10 +75,11 @@ export interface BackendPluginInitService {
|
|
|
74
75
|
handler: PluginLiquidFilterHandler,
|
|
75
76
|
options?: { raw?: boolean },
|
|
76
77
|
): void;
|
|
77
|
-
registerFieldPreprocessor(
|
|
78
|
+
registerFieldPreprocessor(handler: FieldPreprocessor): void;
|
|
78
79
|
registerHook(hookName: string, handler: BackendHookHandler, options?: { unique?: boolean }): void;
|
|
79
80
|
setPublicApiHandler(handler: PublicApiHandler): void;
|
|
80
81
|
addHeadTag(...htmlTags: string[]): void;
|
|
82
|
+
registeredSite: RegisteredSite;
|
|
81
83
|
configuration: PluginConfiguration;
|
|
82
84
|
pluginAssetsUrl: string;
|
|
83
85
|
}
|
|
@@ -104,9 +106,9 @@ export type PublicApiHandler = (
|
|
|
104
106
|
|
|
105
107
|
export type FieldPreprocessor = (
|
|
106
108
|
service: BackendPluginRenderService,
|
|
107
|
-
value:
|
|
109
|
+
value: ReadFieldValue,
|
|
108
110
|
options: FieldPreprocessorOptions,
|
|
109
|
-
) =>
|
|
111
|
+
) => ReadFieldValue | undefined | Promise<ReadFieldValue | undefined>;
|
|
110
112
|
|
|
111
113
|
export interface BackendPluginService {
|
|
112
114
|
fqdn: string;
|
|
@@ -117,9 +119,9 @@ export interface BackendPluginService {
|
|
|
117
119
|
validateRecaptchaResponse: (gRecaptchaResponse: string | undefined) => Promise<boolean>;
|
|
118
120
|
sendMail: ({ subject, html, replyTo, to }: MailData) => Promise<void>;
|
|
119
121
|
executeHook<T = unknown>(hookName: string, params?: any): T[];
|
|
122
|
+
registeredSite: RegisteredSite;
|
|
120
123
|
configuration: PluginConfiguration;
|
|
121
124
|
pluginAssetsUrl: string;
|
|
122
|
-
registerNewSite: (options: NewSiteOptions) => Promise<Readonly<SiteConf>>;
|
|
123
125
|
/** This is the connector of the running instance of ParoiCMS. */
|
|
124
126
|
connector: RunningInstanceConnector;
|
|
125
127
|
}
|
|
@@ -135,13 +137,13 @@ export interface BackendPluginRenderService extends BackendPluginService {
|
|
|
135
137
|
getSiteFieldValue: (options: {
|
|
136
138
|
fieldName: string;
|
|
137
139
|
language?: string;
|
|
138
|
-
}) => Promise<
|
|
140
|
+
}) => Promise<ReadFieldValue | undefined>;
|
|
139
141
|
renderChildPartials(
|
|
140
142
|
ctx: PaHttpContext,
|
|
141
143
|
options: {
|
|
142
144
|
params: PartialsParamsInput;
|
|
143
145
|
parentDocumentId: ParsedNodelId;
|
|
144
|
-
|
|
146
|
+
labeledBy?: LabeledBy;
|
|
145
147
|
},
|
|
146
148
|
): Promise<void>;
|
|
147
149
|
renderSearchPartials(
|
|
@@ -158,6 +160,11 @@ export interface BackendPluginRenderService extends BackendPluginService {
|
|
|
158
160
|
getDocument: (documentId: string) => Promise<PublicDocument | undefined>;
|
|
159
161
|
}
|
|
160
162
|
|
|
163
|
+
export interface LabeledBy {
|
|
164
|
+
termNodeId: string;
|
|
165
|
+
fieldName: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
export interface PublicDocument {
|
|
162
169
|
id: string;
|
|
163
170
|
getUrl: (options?: { absoluteUrl?: boolean }) => Promise<string>;
|
|
@@ -217,26 +224,23 @@ export interface PartialsParamsInput {
|
|
|
217
224
|
offset: string;
|
|
218
225
|
limit: string;
|
|
219
226
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
loadedOnce: boolean;
|
|
233
|
-
redirectWww?: boolean;
|
|
234
|
-
trusted: boolean;
|
|
227
|
+
|
|
228
|
+
export interface RegisteredSite {
|
|
229
|
+
readonly fqdn: string;
|
|
230
|
+
readonly siteName: string;
|
|
231
|
+
readonly version?: string;
|
|
232
|
+
readonly siteDir: string;
|
|
233
|
+
readonly dataDir: string;
|
|
234
|
+
readonly cacheDir: string;
|
|
235
|
+
readonly backupDir: string;
|
|
236
|
+
readonly siteUrl: string;
|
|
237
|
+
readonly redirectWww?: boolean;
|
|
238
|
+
readonly trusted: boolean;
|
|
235
239
|
}
|
|
236
240
|
|
|
237
|
-
export type
|
|
241
|
+
export type SitePackConfiguration = FqdnSitePackConfiguration | SubDomainSitePackConfiguration;
|
|
238
242
|
|
|
239
|
-
export interface
|
|
243
|
+
export interface SitePackConfigurationBase {
|
|
240
244
|
packName: string;
|
|
241
245
|
sitesDir?: string;
|
|
242
246
|
dataDir: string;
|
|
@@ -246,17 +250,17 @@ export interface SitePackConfBase {
|
|
|
246
250
|
trusted: boolean;
|
|
247
251
|
}
|
|
248
252
|
|
|
249
|
-
export interface
|
|
253
|
+
export interface FqdnSitePackConfiguration extends SitePackConfigurationBase {
|
|
250
254
|
serveOn: "fqdn";
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
export interface
|
|
257
|
+
export interface SubDomainSitePackConfiguration extends SitePackConfigurationBase {
|
|
254
258
|
serveOn: "subDomain";
|
|
255
259
|
parentDomain: string;
|
|
256
260
|
}
|
|
257
261
|
|
|
258
262
|
export interface RunningInstanceConnector {
|
|
259
|
-
getSitePackConf(packName: string):
|
|
263
|
+
getSitePackConf(packName: string): SitePackConfiguration;
|
|
260
264
|
loadSiteSchemaAndIds(fqdn: string): Promise<SiteSchemaAndIds>;
|
|
261
265
|
createAccount(
|
|
262
266
|
fqdn: string,
|
|
@@ -285,6 +289,8 @@ export interface RunningInstanceConnector {
|
|
|
285
289
|
contents: RiPartContent[];
|
|
286
290
|
},
|
|
287
291
|
): Promise<void>;
|
|
292
|
+
registerNewSite: (options: NewSiteOptions) => Promise<RegisteredSite>;
|
|
293
|
+
removeSite: (fqdn: string) => Promise<void>;
|
|
288
294
|
}
|
|
289
295
|
|
|
290
296
|
export interface SiteSchemaAndIds {
|
|
@@ -339,7 +345,7 @@ export type RiFieldContent =
|
|
|
339
345
|
export type RiStringContent = RiFieldContentTemplate<"string", string>;
|
|
340
346
|
export type RiNumberContent = RiFieldContentTemplate<"number", number>;
|
|
341
347
|
export type RiBooleanContent = RiFieldContentTemplate<"boolean", boolean>;
|
|
342
|
-
export type RiQuillDeltaContent = RiFieldContentTemplate<"
|
|
348
|
+
export type RiQuillDeltaContent = RiFieldContentTemplate<"json", JsonFieldValue>;
|
|
343
349
|
export type RiMediaContent = RiFieldContentTemplate<"media", RiMediaValue>;
|
|
344
350
|
export type RiGalleryContent = RiFieldContentTemplate<"gallery", RiGalleryValue>;
|
|
345
351
|
|
|
@@ -368,8 +374,3 @@ export interface RiMediaValue {
|
|
|
368
374
|
export interface RiGalleryValue {
|
|
369
375
|
files: string[];
|
|
370
376
|
}
|
|
371
|
-
|
|
372
|
-
// TODO: replace with markdown content. The plugin should convert markdown to quill delta.
|
|
373
|
-
export interface QuillDeltaValue {
|
|
374
|
-
ops: any[];
|
|
375
|
-
}
|