@paroicms/public-server-lib 0.42.0 → 0.43.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/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export type * from "../types/backend-plugin-types.d.ts";
2
2
  export * from "./api-error-handler.js";
3
- export * from "./esm-module.helper.js";
4
3
  export * from "./html-helpers.js";
5
4
  export * from "./obfuscate.helper.js";
6
5
  export * from "./server-image-cache-engine.helper.js";
7
6
  export * from "./simple-i18n.js";
8
- export * from "./vite-config.helper.js";
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  export * from "./api-error-handler.js";
2
- export * from "./esm-module.helper.js";
3
2
  export * from "./html-helpers.js";
4
3
  export * from "./obfuscate.helper.js";
5
4
  export * from "./server-image-cache-engine.helper.js";
6
5
  export * from "./simple-i18n.js";
7
- export * from "./vite-config.helper.js";
8
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/public-server-lib",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "Common utilitaries for paroicms plugins (backend side).",
5
5
  "author": "Paroi Team",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "dev": "tsc --watch --preserveWatchOutput"
21
21
  },
22
22
  "dependencies": {
23
- "@paroicms/internal-anywhere-lib": "1.32.0",
24
- "@paroicms/public-anywhere-lib": "0.33.0",
23
+ "@paroicms/internal-anywhere-lib": "1.33.0",
24
+ "@paroicms/public-anywhere-lib": "0.34.0",
25
25
  "arktype": "~2.1.20"
26
26
  },
27
27
  "devDependencies": {
@@ -74,15 +74,10 @@ export interface PaHttpResponse {
74
74
 
75
75
  export interface ParoiCmsPlugin {
76
76
  version: string;
77
- /**
78
- * The slug of the plugin. It must be unique among all plugins. When it is not provided, then it
79
- * is generated from the plugin name.
80
- */
81
- slug?: string;
82
77
  siteInit?: (service: BackendPluginInitService) => void | Promise<void>;
83
78
  }
84
79
 
85
- export interface BackendPluginInitService {
80
+ export interface BackendPluginInitService extends PluginStaticConfiguration {
86
81
  logger: AppLogger;
87
82
  setPublicAssetsDirectory(directory: string): void;
88
83
  setAdminUiAssetsDirectory(directory: string): void;
@@ -119,13 +114,13 @@ export interface BackendPluginInitService {
119
114
  UpdateFieldValue
120
115
  >,
121
116
  ): void;
117
+ registerHook(hookName: "sendMail", handler: BackendHookHandler<MailData, undefined, void>): void;
122
118
  registerRenderingHook(hookName: "fieldPreprocessor", handler: RenderingHookHandler): void;
123
119
  setPublicApiHandler(handler: PublicApiHandler): void;
124
120
  /** @deprecated Use `registerHeadTags` instead. */
125
121
  addHeadTag(...htmlTags: string[]): void;
126
122
  registerHeadTags(handler: HeadTagsHandler): void;
127
123
  registeredSite: RegisteredSite;
128
- configuration: PluginConfiguration;
129
124
  pluginAssetsUrl: string;
130
125
  }
131
126
 
@@ -182,13 +177,12 @@ export type PublicApiHandler = (
182
177
  relativePath: string,
183
178
  ) => Promise<void> | void;
184
179
 
185
- export interface BackendPluginService {
180
+ export interface BackendPluginService extends PluginStaticConfiguration {
186
181
  fqdn: string;
187
182
  siteUrl: string;
188
183
  siteSchema: ScSiteSchema;
189
184
  themeConf: ThemeConf;
190
185
  logger: AppLogger;
191
- validateRecaptchaResponse: (gRecaptchaResponse: string | undefined) => Promise<boolean>;
192
186
  sendMail: ({ subject, html, replyTo, to }: MailData) => Promise<void>;
193
187
  executeHook(
194
188
  hookName: string,
@@ -198,7 +192,6 @@ export interface BackendPluginService {
198
192
  },
199
193
  ): Promise<unknown> | unknown;
200
194
  registeredSite: RegisteredSite;
201
- configuration: PluginConfiguration;
202
195
  pluginAssetsUrl: string;
203
196
  /** This is the connector of the running instance of ParoiCMS. */
204
197
  connector: RunningInstanceConnector;
@@ -293,14 +286,20 @@ export interface PublicDocument {
293
286
  publishDate: string;
294
287
  }
295
288
 
296
- export interface PluginConfigurations {
297
- [pluginName: string]: PluginConfiguration;
289
+ export interface PluginStaticConfigurations {
290
+ [pluginName: string]: PluginStaticConfiguration | undefined;
298
291
  }
299
292
 
300
- export interface PluginConfiguration {
301
- [key: string]: unknown;
302
- adminUi?: Obj;
303
- googleRecaptchaSiteKey?: string;
293
+ /**
294
+ * This is the configuration of a plugin that is statically defined in the app configuration, or in
295
+ * the site schema.
296
+ */
297
+ export interface PluginStaticConfiguration {
298
+ platform: boolean;
299
+ configuration: {
300
+ [key: string]: unknown;
301
+ adminUi?: Obj;
302
+ };
304
303
  }
305
304
 
306
305
  export interface MailData {
@@ -1,3 +0,0 @@
1
- export declare function resolveModuleDirectory(moduleUrl: string, { parent }?: {
2
- parent?: boolean | undefined;
3
- }): string;
@@ -1,7 +0,0 @@
1
- import { dirname, resolve } from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- export function resolveModuleDirectory(moduleUrl, { parent = false } = {}) {
4
- const dir = resolve(dirname(fileURLToPath(moduleUrl)));
5
- return parent ? dirname(dir) : dir;
6
- }
7
- //# sourceMappingURL=esm-module.helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"esm-module.helper.js","sourceRoot":"","sources":["../src/esm-module.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,EAAE;IAC/E,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACrC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function esmDirName(url: string): string;
2
- export declare function getSolidJsVersion(dirName: string): string;
@@ -1,18 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { dirname, resolve } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- export function esmDirName(url) {
5
- return dirname(fileURLToPath(url));
6
- }
7
- export function getSolidJsVersion(dirName) {
8
- const packageJsonPath = resolve(dirName, "package.json");
9
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
10
- const version = packageJson.devDependencies["solid-js"];
11
- if (!version)
12
- throw new Error("missing 'solid-js' dependency");
13
- if (!version.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)) {
14
- throw new Error(`invalid solid-js version: "${version}" (please use an exact x.x.x version)`);
15
- }
16
- return version;
17
- }
18
- //# sourceMappingURL=vite-config.helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-config.helper.js","sourceRoot":"","sources":["../src/vite-config.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,WAAW,CAAC,eAAe,CAAC,UAAU,CAAuB,CAAC;IAC9E,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC/D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,uCAAuC,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}