@paroicms/public-server-lib 0.30.0 → 0.31.0
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 +13 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/public-server-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
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,7 +75,7 @@ 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;
|
|
@@ -104,9 +105,9 @@ export type PublicApiHandler = (
|
|
|
104
105
|
|
|
105
106
|
export type FieldPreprocessor = (
|
|
106
107
|
service: BackendPluginRenderService,
|
|
107
|
-
value:
|
|
108
|
+
value: ReadFieldValue,
|
|
108
109
|
options: FieldPreprocessorOptions,
|
|
109
|
-
) =>
|
|
110
|
+
) => ReadFieldValue | undefined | Promise<ReadFieldValue | undefined>;
|
|
110
111
|
|
|
111
112
|
export interface BackendPluginService {
|
|
112
113
|
fqdn: string;
|
|
@@ -135,13 +136,13 @@ export interface BackendPluginRenderService extends BackendPluginService {
|
|
|
135
136
|
getSiteFieldValue: (options: {
|
|
136
137
|
fieldName: string;
|
|
137
138
|
language?: string;
|
|
138
|
-
}) => Promise<
|
|
139
|
+
}) => Promise<ReadFieldValue | undefined>;
|
|
139
140
|
renderChildPartials(
|
|
140
141
|
ctx: PaHttpContext,
|
|
141
142
|
options: {
|
|
142
143
|
params: PartialsParamsInput;
|
|
143
144
|
parentDocumentId: ParsedNodelId;
|
|
144
|
-
|
|
145
|
+
labeledBy?: LabeledBy;
|
|
145
146
|
},
|
|
146
147
|
): Promise<void>;
|
|
147
148
|
renderSearchPartials(
|
|
@@ -158,6 +159,11 @@ export interface BackendPluginRenderService extends BackendPluginService {
|
|
|
158
159
|
getDocument: (documentId: string) => Promise<PublicDocument | undefined>;
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
export interface LabeledBy {
|
|
163
|
+
termNodeId: string;
|
|
164
|
+
fieldName: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
161
167
|
export interface PublicDocument {
|
|
162
168
|
id: string;
|
|
163
169
|
getUrl: (options?: { absoluteUrl?: boolean }) => Promise<string>;
|
|
@@ -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
|
-
}
|