@paroicms/public-server-lib 0.43.0 → 0.45.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,6 +1,11 @@
1
+ export type * from "../typeonly/common-schema-json-types.d.ts";
2
+ export type * from "../typeonly/configuration-types.d.ts";
3
+ export type * from "../typeonly/site-schema-json-types.d.ts";
4
+ export type * from "../typeonly/theme-json-types.d.ts";
1
5
  export type * from "../types/backend-plugin-types.d.ts";
2
6
  export * from "./api-error-handler.js";
3
7
  export * from "./html-helpers.js";
4
8
  export * from "./obfuscate.helper.js";
5
9
  export * from "./server-image-cache-engine.helper.js";
6
10
  export * from "./simple-i18n.js";
11
+ export * from "./typeonly-validator.js";
package/dist/index.js CHANGED
@@ -3,4 +3,5 @@ export * from "./html-helpers.js";
3
3
  export * from "./obfuscate.helper.js";
4
4
  export * from "./server-image-cache-engine.helper.js";
5
5
  export * from "./simple-i18n.js";
6
+ export * from "./typeonly-validator.js";
6
7
  //# 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,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const siteSchemaFormatVersion = "9";
2
+ /**
3
+ * JSON types directory.
4
+ */
5
+ export declare const jtDir: string;
6
+ export declare const jsonTypeValidator: import("@typeonly/validator").TypeOnlyValidator;
@@ -0,0 +1,14 @@
1
+ import { esmDirName } from "@paroicms/script-lib";
2
+ import { createValidator } from "@typeonly/validator";
3
+ import { readFileSync } from "node:fs";
4
+ import { dirname, join } from "node:path";
5
+ const packageDir = dirname(esmDirName(import.meta.url));
6
+ export const siteSchemaFormatVersion = "9";
7
+ /**
8
+ * JSON types directory.
9
+ */
10
+ export const jtDir = join(packageDir, "typeonly");
11
+ export const jsonTypeValidator = createValidator({
12
+ bundle: JSON.parse(readFileSync(join(packageDir, "dist", "types.to.json"), "utf-8")),
13
+ });
14
+ //# sourceMappingURL=typeonly-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeonly-validator.js","sourceRoot":"","sources":["../src/typeonly-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;IAC/C,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;CACrF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"./common-schema-json-types":{"imports":[{"from":"./site-schema-json-types","namedMembers":[{"name":"JtFieldType"},{"name":"JtLabelLocales"}]}],"namedTypes":[{"name":"JtInternalCommonSchema","exported":true,"docComment":"The common schema is currently an internal file. Here is its typing.","kind":"interface","properties":[{"name":"ParoiCMSSiteSchemaFormatVersion","type":{"kind":"name","group":"primitive","refName":"string"},"docComment":"This is the version of the schema engine."},{"name":"languages","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}},"docComment":"Specify the list of 2-letters language codes that can be used in the websites.\n\n@example [\"en\", \"fr\"]`"},{"name":"siteFields","type":{"kind":"array","itemType":{"kind":"importedRef","refName":"JtFieldType"}},"docComment":"The common fields of any websites. They are currently: `[\"title\", \"contactEmail\", \"favicon\", \"ogImage\"]`."}]},{"name":"JtInternalCommonSchemaTranslations","exported":true,"kind":"interface","properties":[{"name":"languageLabel","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"siteFields","type":{"kind":"interface","indexSignature":{"keyName":"fieldName","keyType":"string","type":{"kind":"importedRef","refName":"JtLabelLocales"}}},"optional":true}]}]},"./configuration-types":{"namedTypes":[{"name":"JtConfiguration","exported":true,"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtSingleSiteConfiguration"},{"kind":"localRef","refName":"JtMultisiteConfiguration"}]},{"name":"JtConfigurationBase","exported":true,"kind":"interface","properties":[{"name":"thisServer","type":{"kind":"localRef","refName":"JtDeprecatedThisServerConf"},"optional":true,"docComment":"@deprecated Move the sub-properties in the parent."},{"name":"port","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"It is required except if the legacy `thisServer` is still used."},{"name":"hostname","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true},{"name":"publicProtocol","type":{"kind":"composite","op":"union","types":[{"kind":"literal","literal":"http"},{"kind":"literal","literal":"https"}]},"optional":true,"docComment":"Default is `\"http\"`."},{"name":"publicPort","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"boPort","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"@deprecated Use adminUiPort instead."},{"name":"adminUiPort","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"allowRobots","type":{"kind":"name","group":"primitive","refName":"boolean"}},{"name":"enableCache","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"immutableAssets","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"cacheTimeToIdle","type":{"kind":"composite","op":"union","types":[{"kind":"name","group":"primitive","refName":"string"},{"kind":"literal","literal":"disabled"},{"kind":"literal","literal":"infinite"}]},"optional":true,"docComment":"For example: `\"14d\"`."},{"name":"clearCacheAfterStart","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"clearImageCacheAfterStart","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"log","type":{"kind":"localRef","refName":"JtLogConf"},"optional":true,"docComment":"@deprecated Replace `log.level` by `logLevel`, and `log.file` by `logFile`."},{"name":"logLevel","type":{"kind":"composite","op":"union","types":[{"kind":"literal","literal":"silent"},{"kind":"literal","literal":"error"},{"kind":"literal","literal":"warn"},{"kind":"literal","literal":"info"},{"kind":"literal","literal":"stats"},{"kind":"literal","literal":"debug"},{"kind":"literal","literal":"trace"}]},"optional":true},{"name":"logFile","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true,"docComment":"Omit for stdout."},{"name":"graphqlDevTools","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"generateMissingDatabases","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"googleAuth","type":{"kind":"localRef","refName":"JtGoogleAuthConf"},"optional":true},{"name":"awsSesMail","type":{"kind":"localRef","refName":"JtDeprecatedAwsSesMailConf"},"optional":true,"docComment":"@deprecated Use \"@paroicms/send-mail-aws-ses-plugin\" configuration instead"},{"name":"googleRecaptcha","type":{"kind":"localRef","refName":"JtDeprecatedGoogleRecaptchaConf"},"optional":true,"docComment":"@deprecated Use \"@paroicms/contact-form-plugin\" configuration instead"},{"name":"imageProcessor","type":{"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtImageProcessorConf"},{"kind":"localRef","refName":"JtLegacyImageProcessorConf"}]},"optional":true},{"name":"devAccount","type":{"kind":"localRef","refName":"JtDevAccountConf"},"optional":true},{"name":"platformAdminAccounts","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtPlatformAdminAccountConf"}},"optional":true},{"name":"plugins","type":{"kind":"composite","op":"union","types":[{"kind":"array","itemType":{"kind":"localRef","refName":"JtPluginStaticConfiguration"}},{"kind":"localRef","refName":"JtDeprecatedPluginConfigurations"}]},"optional":true},{"name":"httpRedirections","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtHttpRedirection"}},"optional":true}]},{"name":"JtHttpRedirection","exported":true,"kind":"interface","properties":[{"name":"fromFqdn","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"to","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"mapPaths","type":{"kind":"interface","indexSignature":{"keyName":"fromRegex","keyType":"string","type":{"kind":"name","group":"primitive","refName":"string"}}},"optional":true},{"name":"preservePath","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true}]},{"name":"JtSingleSiteConfiguration","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtConfigurationBase"},{"kind":"interface","properties":[{"name":"singleSite","type":{"kind":"localRef","refName":"JtSingleSiteConf"}}]}]},{"name":"JtMultisiteConfiguration","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtConfigurationBase"},{"kind":"interface","properties":[{"name":"platform","type":{"kind":"interface","properties":[{"name":"dataDir","type":{"kind":"name","group":"primitive","refName":"string"}}]}},{"name":"sitePacks","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtSitePackOrLegacyConf"}}}]}]},{"name":"JtDeprecatedThisServerConf","exported":true,"kind":"interface","properties":[{"name":"port","type":{"kind":"name","group":"primitive","refName":"number"}},{"name":"publicPort","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"boPublicPort","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"hostName","type":{"kind":"composite","op":"union","types":[{"kind":"name","group":"primitive","refName":"string"},{"kind":"name","group":"primitive","refName":"null"}]},"optional":true},{"name":"https","type":{"kind":"name","group":"primitive","refName":"boolean"}}]},{"name":"JtLogConf","exported":true,"kind":"interface","properties":[{"name":"level","type":{"kind":"composite","op":"union","types":[{"kind":"literal","literal":"silent"},{"kind":"literal","literal":"error"},{"kind":"literal","literal":"warn"},{"kind":"literal","literal":"info"},{"kind":"literal","literal":"stats"},{"kind":"literal","literal":"debug"},{"kind":"literal","literal":"trace"}]}},{"name":"file","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true,"docComment":"Omit for stdout."}]},{"name":"JtSingleSiteConf","exported":true,"kind":"interface","properties":[{"name":"siteDir","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"dataDir","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"cacheDir","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"backupDir","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"fqdn","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"redirectWww","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"trusted","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true}]},{"name":"JtSitePackOrLegacyConf","exported":true,"kind":"composite","op":"union","types":[{"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtSitePackConf"},{"kind":"localRef","refName":"JtLegacyFqdnSitePackConf"},{"kind":"localRef","refName":"JtLegacySubDomainSitePackConf"}]}]},{"name":"JtSitePackConf","exported":true,"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtFqdnSitePackConf"},{"kind":"localRef","refName":"JtSubDomainSitePackConf"}]},{"name":"JtSitePackConfBase","exported":true,"kind":"interface","properties":[{"name":"packName","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"sitesDir","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true},{"name":"dataDir","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"cacheDir","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"backupDir","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"redirectWww","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"trusted","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true}]},{"name":"JtFqdnSitePackConf","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtSitePackConfBase"},{"kind":"interface","properties":[{"name":"serveOn","type":{"kind":"literal","literal":"fqdn"}}]}]},{"name":"JtSubDomainSitePackConf","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtSitePackConfBase"},{"kind":"interface","properties":[{"name":"serveOn","type":{"kind":"literal","literal":"subDomain"}},{"name":"parentDomain","type":{"kind":"name","group":"primitive","refName":"string"}}]}]},{"name":"JtLegacyFqdnSitePackConf","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtSitePackConfBase"},{"kind":"interface","properties":[{"name":"serveAs","type":{"kind":"literal","literal":"fqdn"},"docComment":"@deprecated Renamed to `serveOn`"}]}]},{"name":"JtLegacySubDomainSitePackConf","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtSitePackConfBase"},{"kind":"interface","properties":[{"name":"serveAs","type":{"kind":"literal","literal":"subDomain"},"docComment":"@deprecated Renamed to `serveOn`"},{"name":"parentDomain","type":{"kind":"name","group":"primitive","refName":"string"}}]}]},{"name":"JtGoogleAuthConf","exported":true,"kind":"interface","properties":[{"name":"disabled","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"fqdn","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"clientId","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"clientSecret","type":{"kind":"name","group":"primitive","refName":"string"}}]},{"name":"JtDeprecatedAwsSesMailConf","exported":true,"docComment":"@deprecated Use \"@paroicms/send-mail-aws-ses-plugin\" configuration instead","kind":"interface","properties":[{"name":"disabled","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"from","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"accessKeyId","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"secretAccessKey","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"region","type":{"kind":"name","group":"primitive","refName":"string"}}]},{"name":"JtDeprecatedGoogleRecaptchaConf","exported":true,"docComment":"@deprecated Use \"@paroicms/contact-form-plugin\" configuration instead","kind":"interface","properties":[{"name":"disabled","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"siteKey","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"secretKey","type":{"kind":"name","group":"primitive","refName":"string"}}]},{"name":"JtImageProcessorConf","exported":true,"kind":"interface","properties":[{"name":"cpuCoresPerFile","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"allowConcurrency","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true}]},{"name":"JtLegacyImageProcessorConf","exported":true,"kind":"interface","properties":[{"name":"cpuCoresPerFile","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"oneSharpAtATime","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true}]},{"name":"JtDevAccountConf","exported":true,"kind":"interface","properties":[{"name":"email","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"name","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"password","type":{"kind":"name","group":"primitive","refName":"string"}}]},{"name":"JtPlatformAdminAccountConf","exported":true,"kind":"interface","properties":[{"name":"email","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"name","type":{"kind":"name","group":"primitive","refName":"string"}}]},{"name":"JtPluginStaticConfiguration","exported":true,"kind":"interface","properties":[{"name":"name","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"disabled","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"platform","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"configuration","type":{"kind":"interface","indexSignature":{"keyName":"key","keyType":"string","type":{"kind":"name","group":"ts","refName":"unknown"}}},"optional":true}]},{"name":"JtDeprecatedPluginConfigurations","exported":true,"docComment":"@deprecated Use JtPluginConfiguration[] instead","kind":"interface","indexSignature":{"keyName":"pluginName","keyType":"string","type":{"kind":"interface","indexSignature":{"keyName":"key","keyType":"string","type":{"kind":"name","group":"ts","refName":"unknown"}}}}}]},"./site-schema-json-types":{"namedTypes":[{"name":"JtSiteSchema","exported":true,"docComment":"This properties are part of a site schema, and part of the internal library as well.","kind":"interface","properties":[{"name":"ParoiCMSSiteSchemaFormatVersion","type":{"kind":"literal","literal":"9"},"docComment":"This is the version of the schema engine."},{"name":"languages","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}},"docComment":"Specify the list of 2-letters language codes (ISO 639-1) of the website. Use 3-letters codes (ISO 639-3) for languages that doesn't have a 2-letters code (\"qya\", etc.). It's possible but not recommanded to use 5-letters codes with regions (IETF BCP 47, for example \"fr-FR\"). Every language is allowed. The first language is the primary language of the website.\n@example `[\"en\", \"fr\"]`"},{"name":"languageRoutingMode","type":{"kind":"composite","op":"union","types":[{"kind":"literal","literal":"prefixSecondary"},{"kind":"literal","literal":"prefixAll"},{"kind":"literal","literal":"auto"}]},"optional":true,"docComment":"Routing mode for multilingual sites. Default is \"auto\".\n- \"auto\": behaves like \"prefixSecondary\" for unilingual sites, \"prefixAll\" for multilingual sites\n- \"prefixAll\": all languages are prefixed in URLs\n- \"prefixSecondary\": all languages but the first are prefixed in URLs"},{"name":"plugins","type":{"kind":"array","itemType":{"kind":"composite","op":"union","types":[{"kind":"name","group":"primitive","refName":"string"},{"kind":"localRef","refName":"JtPluginRef"}]}},"optional":true,"docComment":"List of plugins that are used in the schema.\n@example [\"@paroicms/quill-editor-plugin\"]"},{"name":"configuration","type":{"kind":"localRef","refName":"JtSiteConfiguration"},"optional":true},{"name":"nodeTypes","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtNodeType"}},"optional":true,"docComment":"Types of documents, parts that will be handled on the site."},{"name":"fieldTypes","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtFieldType"}},"optional":true,"docComment":"A library of fields."},{"name":"mediaPolicies","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtMediaPolicy"}},"optional":true,"docComment":"Media policies"},{"name":"imageQualityPolicy","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtImageCompressionQualityPolicyStep"}},"optional":true,"docComment":"We can set the image compression quality here. The list must be ordered from the lowest area\nto the highest."}]},{"name":"JtPluginRef","exported":true,"kind":"interface","properties":[{"name":"name","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"disabled","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"configuration","type":{"kind":"localRef","refName":"JtPluginConfFromSchema"},"optional":true}]},{"name":"JtPluginConfFromSchema","exported":true,"kind":"interface","indexSignature":{"keyName":"key","keyType":"string","type":{"kind":"name","group":"ts","refName":"unknown"}}},{"name":"JtSiteConfiguration","exported":true,"kind":"interface","properties":[{"name":"adminUi","type":{"kind":"interface","properties":[{"name":"enableMetaKeywords","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true}]},"optional":true}]},{"name":"JtNodeType","exported":true,"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtSiteType"},{"kind":"localRef","refName":"JtDocumentType"},{"kind":"localRef","refName":"JtPartType"}]},{"name":"JtSiteType","exported":true,"kind":"interface","properties":[{"name":"typeName","type":{"kind":"literal","literal":"_site"},"optional":true,"docComment":"Can be omitted. Its default value is `\"_site\"`."},{"name":"kind","type":{"kind":"literal","literal":"site"}},{"name":"fields","type":{"kind":"array","itemType":{"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtFieldType"},{"kind":"name","group":"primitive","refName":"string"}]}},"optional":true,"docComment":"The site fields. They will be appended to the required fields: `[\"access\", \"title\", \"contactEmail\", \"favicon\", \"ogImage\"]`.\n\n@example `[\"logo\", \"slogan\", \"phone\"]`"}]},{"name":"JtDocumentType","exported":true,"docComment":"A document is another name for a web page, with a path in the URL.","kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtRoutingDocumentType"},{"kind":"localRef","refName":"JtRegularDocumentType"}]},{"name":"JtDocumentTypeBase","exported":true,"kind":"interface","properties":[{"name":"typeName","type":{"kind":"name","group":"primitive","refName":"string"},"docComment":"The type name is the identifier of the document type."},{"name":"kind","type":{"kind":"literal","literal":"document"}},{"name":"ogType","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true,"docComment":"@see [Open Graph Protocol](https://ogp.me/)\n@example `\"article\"`"},{"name":"withFeaturedImage","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true,"docComment":"If `true`, the document will have a featured image. Most of the time, documents like\nsearch-page, contact-page, the home page, don't need a featured image. But other documents\ndoes."},{"name":"fields","type":{"kind":"array","itemType":{"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtFieldType"},{"kind":"name","group":"primitive","refName":"string"}]}},"optional":true,"docComment":"The fields in the document. Items in this list can be either field types or predefined field\ntype names."},{"name":"mediaPolicy","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true,"docComment":"The name of the media policy."},{"name":"lists","type":{"kind":"array","itemType":{"kind":"localRef","refName":"JtListType"}},"optional":true,"docComment":"Lists of parts in the document."},{"name":"routingChildren","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}},"optional":true,"docComment":"Type names of child routing documents."},{"name":"regularChildren","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}},"optional":true,"docComment":"Type names of child regular documents."},{"name":"regularChildrenSorting","type":{"kind":"localRef","refName":"JtSorting"},"optional":true,"docComment":"The sorting order of regular children. It is required when `children` is defined.\nExamples: `\"title asc\"`, `\"publishDate desc\"`, `\"manual\"`."},{"name":"childLimit","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"The maximum number of children."},{"name":"hasFrontendApp","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true,"docComment":"If `true`, the document will serve a SPA. It means that all the child routes will be handled by\nthe document.\n\nThis property is not compatible with `routingChildren`, `regularChildren`, `redirectTo`\nproperties. Also, if the document type is regular, then sibling regular document types must not\nhave routing or regular children."},{"name":"useUrlQuery","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true,"docComment":"If `true`, then the url query will be exposed to the liquid templates. By default it's better\nto not enable it, then the same content will be served from the cache for all the URL query\nvalues."},{"name":"cluster","type":{"kind":"localRef","refName":"JtClusterType"},"optional":true,"docComment":"Cluster configuration for this document type."},{"name":"adminUi","type":{"kind":"localRef","refName":"JtDocumentAdminUiSettings"},"optional":true}]},{"name":"JtClusterType","exported":true,"kind":"interface","properties":[{"name":"autoCreate","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true,"docComment":"Determine if the routing documents of the cluster should be automatically created when the root\ndocument is created."}]},{"name":"JtSorting","exported":true,"kind":"composite","op":"union","types":[{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}},{"kind":"literal","literal":"manual"},{"kind":"name","group":"primitive","refName":"string"}]},{"name":"JtRoutingDocumentType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtDocumentTypeBase"},{"kind":"interface","properties":[{"name":"documentKind","type":{"kind":"literal","literal":"routing"}},{"name":"redirectTo","type":{"kind":"literal","literal":"parent"},"optional":true,"docComment":"Value `\"parent\"` means that the document is just a hierarchy parent for other documents. But it\nhas no content itself.\n\nThis value is ignored in the home page type."},{"name":"route","type":{"kind":"composite","op":"union","types":[{"kind":"name","group":"primitive","refName":"string"},{"kind":"localRef","refName":"JtTranslatedStrings"}]},"optional":true,"docComment":"The `route` of a routing document contains a kind of _directory name_ (one per language) that\nwill be the last part of the document URL path.\n\nThis value is ignored in the home page type."}]}]},{"name":"JtTranslatedStrings","exported":true,"kind":"interface","indexSignature":{"keyName":"language","keyType":"string","type":{"kind":"name","group":"primitive","refName":"string"}}},{"name":"JtDocumentAdminUiSettings","exported":true,"kind":"interface","properties":[{"name":"defaultTab","type":{"kind":"localRef","refName":"JtDocumentTabName"},"optional":true,"docComment":"Default value is `\"auto\"`."},{"name":"menuPlacement","type":{"kind":"composite","op":"union","types":[{"kind":"literal","literal":"default"},{"kind":"literal","literal":"popup"}]},"optional":true,"docComment":"Used by routing documents only. Default value is `\"default\"`."}]},{"name":"JtDocumentTabName","exported":true,"kind":"composite","op":"union","types":[{"kind":"literal","literal":"auto"},{"kind":"literal","literal":"edit"},{"kind":"literal","literal":"childDocuments"},{"kind":"literal","literal":"parts"}]},{"name":"JtRegularDocumentType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtDocumentTypeBase"},{"kind":"interface","properties":[{"name":"documentKind","type":{"kind":"literal","literal":"regular"}},{"name":"route","type":{"kind":"name","group":"primitive","refName":"string"},"docComment":"Available values are: `\":relativeId-:slug\"` and `\":yyyy/:mm/:dd/:relativeId-:slug\"`."},{"name":"relativeIdGenerator","type":{"kind":"localRef","refName":"JtRelativeIdGeneratorType"},"optional":true},{"name":"autoPublish","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true,"docComment":"Value `true` means that the document will be automatically published without being a\ndraft before. Useful for taxonomy terms, like tags or categories."}]}]},{"name":"JtRelativeIdGeneratorType","exported":true,"kind":"array","itemType":{"kind":"name","group":"ts","refName":"any"}},{"name":"JtSubListType","exported":true,"kind":"interface","properties":[{"name":"parts","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}},"docComment":"Type names of the parts in the list."},{"name":"sorting","type":{"kind":"localRef","refName":"JtSorting"},"docComment":"How to sort the list. Example: `\"manual\"`."},{"name":"limit","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"The maximum number of parts in the list."}]},{"name":"JtListType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtSubListType"},{"kind":"interface","properties":[{"name":"listName","type":{"kind":"name","group":"primitive","refName":"string"}}]}]},{"name":"JtPartType","exported":true,"kind":"interface","properties":[{"name":"typeName","type":{"kind":"name","group":"primitive","refName":"string"},"docComment":"The type name is the identifier of the part type."},{"name":"kind","type":{"kind":"literal","literal":"part"}},{"name":"fields","type":{"kind":"array","itemType":{"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtFieldType"},{"kind":"name","group":"primitive","refName":"string"}]}},"optional":true},{"name":"list","type":{"kind":"localRef","refName":"JtSubListType"},"optional":true,"docComment":"If the part type can have children parts, then it's a sub-list."},{"name":"mediaPolicy","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true}]},{"name":"JtFieldType","exported":true,"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtMainDbFieldType"},{"kind":"localRef","refName":"JtMediaDbFieldType"},{"kind":"localRef","refName":"JtLabelingFieldType"}]},{"name":"JtFieldTypeBase","exported":true,"kind":"interface","properties":[{"name":"name","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"withGallery","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"useAsDefaultImage","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"renderAs","type":{"kind":"literal","literal":"html"},"optional":true},{"name":"useAsExcerpt","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true},{"name":"plugin","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true,"docComment":"A plugin name. For example: `@paroicms/quill-editor-plugin`."},{"name":"adminUi","type":{"kind":"localRef","refName":"JtFieldAdminUiSettings"},"optional":true,"docComment":"UI settings in the admin-ui."}]},{"name":"JtFieldAdminUiSettings","exported":true,"kind":"interface","properties":[{"name":"showInCard","type":{"kind":"composite","op":"union","types":[{"kind":"name","group":"primitive","refName":"boolean"},{"kind":"literal","literal":"auto"}]},"optional":true,"docComment":"Default is `\"auto\"`."}],"indexSignature":{"keyName":"key","keyType":"string","type":{"kind":"name","group":"ts","refName":"any"}}},{"name":"JtLocalizableFieldTypeBase","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtFieldTypeBase"},{"kind":"interface","properties":[{"name":"localized","type":{"kind":"name","group":"primitive","refName":"boolean"},"docComment":"If `true`, then each translation will have its own value. Otherwise, the value is shared\nbetween all translations."},{"name":"normalizeTypography","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true,"docComment":"This property should be set to `true` for real textual field types, like an html body or a\nlabel.\n\nNote: Its value has no effect when `localized` is `false`."}]}]},{"name":"JtLabelingFieldType","exported":true,"docComment":"The field type represents a labeling link between the current node, and a term from a taxonomy.","kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtFieldTypeBase"},{"kind":"interface","properties":[{"name":"localized","type":{"kind":"literal","literal":false}},{"name":"storedAs","type":{"kind":"literal","literal":"labeling"}},{"name":"taxonomy","type":{"kind":"name","group":"primitive","refName":"string"},"docComment":"It's the type name of a routing document. Regular documents that are child of this routing\ndocument will be the terms of the taxonomy.\n\nNotice: Any routing point can be used as a taxonomy. Terms are always regular documents."},{"name":"multiple","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true,"docComment":"If `true`, multiple terms can be selected. Otherwise, only one term can be selected."}]}]},{"name":"JtMainDbFieldType","exported":true,"kind":"composite","op":"union","types":[{"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtNumberFieldType"},{"kind":"localRef","refName":"JtBooleanFieldType"},{"kind":"localRef","refName":"JtDateFieldType"},{"kind":"localRef","refName":"JtDateTimeFieldType"},{"kind":"localRef","refName":"JtTimeFieldType"},{"kind":"localRef","refName":"JtStringFieldType"},{"kind":"localRef","refName":"JtJsonFieldType"}]}]},{"name":"JtNumberFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"literal","literal":"varchar"}},{"name":"dataType","type":{"kind":"literal","literal":"number"}},{"name":"currency","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true},{"name":"enum","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"number"}},"optional":true}]}]},{"name":"JtBooleanFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"literal","literal":"varchar"}},{"name":"dataType","type":{"kind":"literal","literal":"boolean"}}]}]},{"name":"JtDateFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"literal","literal":"varchar"}},{"name":"dataType","type":{"kind":"literal","literal":"date"}}]}]},{"name":"JtDateTimeFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"literal","literal":"varchar"}},{"name":"dataType","type":{"kind":"literal","literal":"dateTime"}}]}]},{"name":"JtTimeFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"literal","literal":"varchar"}},{"name":"dataType","type":{"kind":"literal","literal":"time"}}]}]},{"name":"JtStringFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"composite","op":"union","types":[{"kind":"literal","literal":"text"},{"kind":"literal","literal":"varchar"}]}},{"name":"dataType","type":{"kind":"literal","literal":"string"}},{"name":"multiline","type":{"kind":"name","group":"primitive","refName":"boolean"},"optional":true},{"name":"enum","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}},"optional":true}]}]},{"name":"JtJsonFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"composite","op":"union","types":[{"kind":"literal","literal":"text"},{"kind":"literal","literal":"varchar"}]}},{"name":"dataType","type":{"kind":"literal","literal":"json"}}]}]},{"name":"JtMediaDbFieldType","exported":true,"kind":"composite","op":"union","types":[{"kind":"localRef","refName":"JtGalleryFieldType"},{"kind":"localRef","refName":"JtMediaFieldType"}]},{"name":"JtGalleryFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"literal","literal":"mediaHandle"}},{"name":"dataType","type":{"kind":"literal","literal":"gallery"}},{"name":"accept","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"refuse","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true}]}]},{"name":"JtMediaFieldType","exported":true,"kind":"composite","op":"intersection","types":[{"kind":"localRef","refName":"JtLocalizableFieldTypeBase"},{"kind":"interface","properties":[{"name":"storedAs","type":{"kind":"literal","literal":"mediaHandle"}},{"name":"dataType","type":{"kind":"literal","literal":"media"}},{"name":"accept","type":{"kind":"name","group":"primitive","refName":"string"}},{"name":"refuse","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true}]}]},{"name":"JtMediaPolicy","exported":true,"docComment":"These properties define the rules that are applied to medias.","kind":"interface","properties":[{"name":"policyName","type":{"kind":"name","group":"primitive","refName":"string"},"docComment":"The internal name of the policy.\n@example `\"myPolicyName\"`"},{"name":"mediaLimitPerDocument","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"Max media limit uploaded in a document.\n@example `10`"},{"name":"mediaLimitPerPart","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"Max media limit uploaded in a part.\n@example `10`"},{"name":"attachedDocument","type":{"kind":"localRef","refName":"JtAttachedDocumentPolicy"},"optional":true,"docComment":"Rules about non-image medias (like PDF files)."},{"name":"image","type":{"kind":"localRef","refName":"JtImagePolicy"},"optional":true,"docComment":"Rules about images."}]},{"name":"JtAttachedDocumentPolicy","exported":true,"docComment":"These properties define the rules that are applied to\ndocument uploaded in document and document part","kind":"interface","properties":[{"name":"siteWeightLimitB","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"Size limit in bytes.\n@example `2000000`"}]},{"name":"JtImagePolicy","exported":true,"docComment":"These properties define the rules that are applied to\nimages contained in document and document part","kind":"interface","properties":[{"name":"weightLimitB","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"Size limit in bytes.\n@example `2000000`"},{"name":"areaLimitPx","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"Maximum area (width × height, in pixels) of an image.\n@example `2000000`"}]},{"name":"JtImageCompressionQualityPolicyStep","exported":true,"docComment":"These properties define the rules applied to image\ncompression across all sites","kind":"interface","properties":[{"name":"areaLimitPx","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"The quality will apply for image with area smaller than this value.\n@example `600000`"},{"name":"quality","type":{"kind":"name","group":"primitive","refName":"number"},"docComment":"Webp quality loss, in percents.\n@example `80`"}]},{"name":"JtSiteSchemaTranslations","exported":true,"kind":"interface","properties":[{"name":"siteTheme","type":{"kind":"name","group":"primitive","refName":"string"},"optional":true},{"name":"nodeTypes","type":{"kind":"interface","indexSignature":{"keyName":"typeName","keyType":"string","type":{"kind":"localRef","refName":"JtLabelLocales"}}},"optional":true},{"name":"fieldTypes","type":{"kind":"interface","indexSignature":{"keyName":"fieldName","keyType":"string","type":{"kind":"localRef","refName":"JtLabelLocales"}}},"optional":true}]},{"name":"JtLabelLocales","exported":true,"kind":"interface","indexSignature":{"keyName":"key","keyType":"string","type":{"kind":"composite","op":"union","types":[{"kind":"name","group":"primitive","refName":"string"},{"kind":"localRef","refName":"JtLabelLocales"}]}}}]},"./theme-json-types":{"namedTypes":[{"name":"JtThemeConf","exported":true,"kind":"interface","properties":[{"name":"pixelRatio","type":{"kind":"name","group":"primitive","refName":"number"},"optional":true,"docComment":"Default value is `1`."},{"name":"fTextImages","type":{"kind":"array","itemType":{"kind":"name","group":"primitive","refName":"string"}}}]}]}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/public-server-lib",
3
- "version": "0.43.0",
3
+ "version": "0.45.0",
4
4
  "description": "Common utilitaries for paroicms plugins (backend side).",
5
5
  "author": "Paroi Team",
6
6
  "repository": {
@@ -13,25 +13,31 @@
13
13
  "main": "dist/index.js",
14
14
  "types": "dist/index.d.ts",
15
15
  "scripts": {
16
- "build": "tsc",
16
+ "build": "npm run typeonly && npm run tsc",
17
+ "tsc": "tsc",
18
+ "typeonly": "typeonly --bundle dist/types.to.json -s ./typeonly",
17
19
  "test:watch": "vitest",
18
20
  "test": "vitest run",
19
21
  "clear": "rimraf dist/*",
20
22
  "dev": "tsc --watch --preserveWatchOutput"
21
23
  },
22
24
  "dependencies": {
23
- "@paroicms/internal-anywhere-lib": "1.33.0",
24
- "@paroicms/public-anywhere-lib": "0.34.0",
25
+ "@paroicms/internal-anywhere-lib": "1.34.0",
26
+ "@paroicms/public-anywhere-lib": "0.35.0",
27
+ "@paroicms/script-lib": "0.2.1",
28
+ "@typeonly/validator": "~1.1.2",
25
29
  "arktype": "~2.1.20"
26
30
  },
27
31
  "devDependencies": {
28
32
  "@types/node": "~24.0.1",
29
33
  "rimraf": "~6.0.1",
34
+ "typeonly": "~1.1.3",
30
35
  "typescript": "~5.8.3",
31
36
  "vitest": "~3.2.3"
32
37
  },
33
38
  "files": [
34
39
  "dist",
35
- "types"
40
+ "types",
41
+ "typeonly"
36
42
  ]
37
43
  }
@@ -0,0 +1,26 @@
1
+ import type { JtFieldType, JtLabelLocales } from "./site-schema-json-types.d.ts";
2
+
3
+ /**
4
+ * The common schema is currently an internal file. Here is its typing.
5
+ */
6
+ export interface JtInternalCommonSchema {
7
+ /**
8
+ * This is the version of the schema engine.
9
+ */
10
+ ParoiCMSSiteSchemaFormatVersion: string;
11
+ /**
12
+ * Specify the list of 2-letters language codes that can be used in the websites.
13
+ *
14
+ * @example ["en", "fr"]`
15
+ */
16
+ languages: string[];
17
+ /**
18
+ * The common fields of any websites. They are currently: `["title", "contactEmail", "favicon", "ogImage"]`.
19
+ */
20
+ siteFields: JtFieldType[];
21
+ }
22
+
23
+ export interface JtInternalCommonSchemaTranslations {
24
+ languageLabel: string;
25
+ siteFields?: { [fieldName: string]: JtLabelLocales };
26
+ }
@@ -0,0 +1,199 @@
1
+ export type JtConfiguration = JtSingleSiteConfiguration | JtMultisiteConfiguration;
2
+
3
+ export interface JtConfigurationBase {
4
+ /**
5
+ * @deprecated Move the sub-properties in the parent.
6
+ */
7
+ thisServer?: JtDeprecatedThisServerConf;
8
+ /**
9
+ * It is required except if the legacy `thisServer` is still used.
10
+ */
11
+ port?: number;
12
+ hostname?: string;
13
+ /**
14
+ * Default is `"http"`.
15
+ */
16
+ publicProtocol?: "http" | "https";
17
+ publicPort?: number;
18
+ /**
19
+ * @deprecated Use adminUiPort instead.
20
+ */
21
+ boPort?: number;
22
+ adminUiPort?: number;
23
+
24
+ allowRobots: boolean;
25
+ enableCache?: boolean;
26
+ immutableAssets?: boolean;
27
+ /**
28
+ * For example: `"14d"`.
29
+ */
30
+ cacheTimeToIdle?: string | "disabled" | "infinite";
31
+ clearCacheAfterStart?: boolean;
32
+ clearImageCacheAfterStart?: boolean;
33
+ /**
34
+ * @deprecated Replace `log.level` by `logLevel`, and `log.file` by `logFile`.
35
+ */
36
+ log?: JtLogConf;
37
+ logLevel?: "silent" | "error" | "warn" | "info" | "stats" | "debug" | "trace";
38
+ /**
39
+ * Omit for stdout.
40
+ */
41
+ logFile?: string;
42
+ graphqlDevTools?: boolean;
43
+ generateMissingDatabases?: boolean;
44
+ googleAuth?: JtGoogleAuthConf;
45
+ /** @deprecated Use "@paroicms/send-mail-aws-ses-plugin" configuration instead */
46
+ awsSesMail?: JtDeprecatedAwsSesMailConf;
47
+ /** @deprecated Use "@paroicms/contact-form-plugin" configuration instead */
48
+ googleRecaptcha?: JtDeprecatedGoogleRecaptchaConf;
49
+ imageProcessor?: JtImageProcessorConf | JtLegacyImageProcessorConf;
50
+ devAccount?: JtDevAccountConf;
51
+ platformAdminAccounts?: JtPlatformAdminAccountConf[];
52
+ plugins?: JtPluginStaticConfiguration[] | JtDeprecatedPluginConfigurations;
53
+ httpRedirections?: JtHttpRedirection[];
54
+ }
55
+
56
+ export interface JtHttpRedirection {
57
+ fromFqdn: string;
58
+ to: string;
59
+ mapPaths?: {
60
+ [fromRegex: string]: string;
61
+ };
62
+ preservePath?: boolean;
63
+ }
64
+
65
+ export interface JtSingleSiteConfiguration extends JtConfigurationBase {
66
+ singleSite: JtSingleSiteConf;
67
+ }
68
+
69
+ export interface JtMultisiteConfiguration extends JtConfigurationBase {
70
+ platform: {
71
+ dataDir: string;
72
+ };
73
+ sitePacks: JtSitePackOrLegacyConf[];
74
+ }
75
+
76
+ export interface JtDeprecatedThisServerConf {
77
+ port: number;
78
+ publicPort?: number;
79
+ boPublicPort?: number;
80
+ hostName?: string | null;
81
+ https: boolean;
82
+ }
83
+
84
+ export interface JtLogConf {
85
+ level: "silent" | "error" | "warn" | "info" | "stats" | "debug" | "trace";
86
+ /**
87
+ * Omit for stdout.
88
+ */
89
+ file?: string;
90
+ }
91
+
92
+ export interface JtSingleSiteConf {
93
+ siteDir: string;
94
+ dataDir: string;
95
+ cacheDir: string;
96
+ backupDir: string;
97
+ fqdn: string;
98
+ redirectWww?: boolean;
99
+ /* Default value is `true`. */
100
+ trusted?: boolean;
101
+ }
102
+
103
+ export type JtSitePackOrLegacyConf =
104
+ | JtSitePackConf
105
+ | JtLegacyFqdnSitePackConf
106
+ | JtLegacySubDomainSitePackConf;
107
+
108
+ export type JtSitePackConf = JtFqdnSitePackConf | JtSubDomainSitePackConf;
109
+
110
+ export interface JtSitePackConfBase {
111
+ packName: string;
112
+ sitesDir?: string;
113
+ dataDir: string;
114
+ cacheDir: string;
115
+ backupDir: string;
116
+ redirectWww?: boolean;
117
+ /* Default value is `true`. */
118
+ trusted?: boolean;
119
+ }
120
+
121
+ export interface JtFqdnSitePackConf extends JtSitePackConfBase {
122
+ serveOn: "fqdn";
123
+ }
124
+
125
+ export interface JtSubDomainSitePackConf extends JtSitePackConfBase {
126
+ serveOn: "subDomain";
127
+ parentDomain: string;
128
+ }
129
+
130
+ export interface JtLegacyFqdnSitePackConf extends JtSitePackConfBase {
131
+ /** @deprecated Renamed to `serveOn` */
132
+ serveAs: "fqdn";
133
+ }
134
+
135
+ export interface JtLegacySubDomainSitePackConf extends JtSitePackConfBase {
136
+ /** @deprecated Renamed to `serveOn` */
137
+ serveAs: "subDomain";
138
+ parentDomain: string;
139
+ }
140
+
141
+ export interface JtGoogleAuthConf {
142
+ disabled?: boolean;
143
+ fqdn: string;
144
+ clientId: string;
145
+ clientSecret: string;
146
+ }
147
+
148
+ /** @deprecated Use "@paroicms/send-mail-aws-ses-plugin" configuration instead */
149
+ export interface JtDeprecatedAwsSesMailConf {
150
+ disabled?: boolean;
151
+ from: string;
152
+ accessKeyId: string;
153
+ secretAccessKey: string;
154
+ region: string;
155
+ }
156
+
157
+ /** @deprecated Use "@paroicms/contact-form-plugin" configuration instead */
158
+ export interface JtDeprecatedGoogleRecaptchaConf {
159
+ disabled?: boolean;
160
+ siteKey: string;
161
+ secretKey: string;
162
+ }
163
+
164
+ export interface JtImageProcessorConf {
165
+ cpuCoresPerFile?: number;
166
+ allowConcurrency?: boolean;
167
+ }
168
+
169
+ export interface JtLegacyImageProcessorConf {
170
+ cpuCoresPerFile?: number;
171
+ oneSharpAtATime?: boolean;
172
+ }
173
+
174
+ export interface JtDevAccountConf {
175
+ email: string;
176
+ name: string;
177
+ password: string;
178
+ }
179
+
180
+ export interface JtPlatformAdminAccountConf {
181
+ email: string;
182
+ name: string;
183
+ }
184
+
185
+ export interface JtPluginStaticConfiguration {
186
+ name: string;
187
+ disabled?: boolean;
188
+ platform?: boolean;
189
+ configuration?: {
190
+ [key: string]: unknown;
191
+ };
192
+ }
193
+
194
+ /** @deprecated Use JtPluginConfiguration[] instead */
195
+ export interface JtDeprecatedPluginConfigurations {
196
+ [pluginName: string]: {
197
+ [key: string]: unknown;
198
+ };
199
+ }
@@ -0,0 +1,449 @@
1
+ // ----- SITE SCHEMA -----
2
+
3
+ /**
4
+ * This properties are part of a site schema, and part of the internal library as well.
5
+ */
6
+ export interface JtSiteSchema {
7
+ /**
8
+ * This is the version of the schema engine.
9
+ */
10
+ ParoiCMSSiteSchemaFormatVersion: "9";
11
+ /**
12
+ * Specify the list of 2-letters language codes (ISO 639-1) of the website. Use 3-letters codes (ISO 639-3) for languages that doesn't have a 2-letters code ("qya", etc.). It's possible but not recommanded to use 5-letters codes with regions (IETF BCP 47, for example "fr-FR"). Every language is allowed. The first language is the primary language of the website.
13
+ * @example `["en", "fr"]`
14
+ */
15
+ languages: string[];
16
+ /**
17
+ * Routing mode for multilingual sites. Default is "auto".
18
+ * - "auto": behaves like "prefixSecondary" for unilingual sites, "prefixAll" for multilingual sites
19
+ * - "prefixAll": all languages are prefixed in URLs
20
+ * - "prefixSecondary": all languages but the first are prefixed in URLs
21
+ */
22
+ languageRoutingMode?: "prefixSecondary" | "prefixAll" | "auto";
23
+ /**
24
+ * List of plugins that are used in the schema.
25
+ * @example ["@paroicms/quill-editor-plugin"]
26
+ */
27
+ plugins?: (string | JtPluginRef)[];
28
+ configuration?: JtSiteConfiguration;
29
+ /**
30
+ * Types of documents, parts that will be handled on the site.
31
+ */
32
+ nodeTypes?: JtNodeType[];
33
+ /**
34
+ * A library of fields.
35
+ */
36
+ fieldTypes?: JtFieldType[];
37
+ /**
38
+ * Media policies
39
+ */
40
+ mediaPolicies?: JtMediaPolicy[];
41
+ /**
42
+ * We can set the image compression quality here. The list must be ordered from the lowest area
43
+ * to the highest.
44
+ */
45
+ imageQualityPolicy?: JtImageCompressionQualityPolicyStep[];
46
+ }
47
+
48
+ export interface JtPluginRef {
49
+ name: string;
50
+ disabled?: boolean;
51
+ configuration?: JtPluginConfFromSchema;
52
+ }
53
+
54
+ export interface JtPluginConfFromSchema {
55
+ [key: string]: unknown;
56
+ }
57
+
58
+ export interface JtSiteConfiguration {
59
+ adminUi?: {
60
+ enableMetaKeywords?: boolean;
61
+ };
62
+ }
63
+
64
+ // ----- NODE TYPES -----
65
+
66
+ export type JtNodeType = JtSiteType | JtDocumentType | JtPartType;
67
+
68
+ export interface JtSiteType {
69
+ /**
70
+ * Can be omitted. Its default value is `"_site"`.
71
+ */
72
+ typeName?: "_site";
73
+ kind: "site";
74
+ /**
75
+ * The site fields. They will be appended to the required fields: `["access", "title", "contactEmail", "favicon", "ogImage"]`.
76
+ *
77
+ * @example `["logo", "slogan", "phone"]`
78
+ */
79
+ fields?: (JtFieldType | string)[];
80
+ }
81
+
82
+ /**
83
+ * A document is another name for a web page, with a path in the URL.
84
+ */
85
+ export type JtDocumentType = JtRoutingDocumentType | JtRegularDocumentType;
86
+
87
+ export interface JtDocumentTypeBase {
88
+ /**
89
+ * The type name is the identifier of the document type.
90
+ */
91
+ typeName: string;
92
+ kind: "document";
93
+ /**
94
+ * @see [Open Graph Protocol](https://ogp.me/)
95
+ * @example `"article"`
96
+ */
97
+ ogType?: string;
98
+ /**
99
+ * If `true`, the document will have a featured image. Most of the time, documents like
100
+ * search-page, contact-page, the home page, don't need a featured image. But other documents
101
+ * does.
102
+ */
103
+ withFeaturedImage?: boolean;
104
+ /**
105
+ * The fields in the document. Items in this list can be either field types or predefined field
106
+ * type names.
107
+ */
108
+ fields?: (JtFieldType | string)[];
109
+ /**
110
+ * The name of the media policy.
111
+ */
112
+ mediaPolicy?: string;
113
+ /**
114
+ * Lists of parts in the document.
115
+ */
116
+ lists?: JtListType[];
117
+ /**
118
+ * Type names of child routing documents.
119
+ */
120
+ routingChildren?: string[];
121
+ /**
122
+ * Type names of child regular documents.
123
+ */
124
+ regularChildren?: string[];
125
+ /**
126
+ * The sorting order of regular children. It is required when `children` is defined.
127
+ * Examples: `"title asc"`, `"publishDate desc"`, `"manual"`.
128
+ */
129
+ regularChildrenSorting?: JtSorting;
130
+ /**
131
+ * The maximum number of children.
132
+ */
133
+ childLimit?: number;
134
+ /**
135
+ * If `true`, the document will serve a SPA. It means that all the child routes will be handled by
136
+ * the document.
137
+ *
138
+ * This property is not compatible with `routingChildren`, `regularChildren`, `redirectTo`
139
+ * properties. Also, if the document type is regular, then sibling regular document types must not
140
+ * have routing or regular children.
141
+ */
142
+ hasFrontendApp?: boolean;
143
+ /**
144
+ * If `true`, then the url query will be exposed to the liquid templates. By default it's better
145
+ * to not enable it, then the same content will be served from the cache for all the URL query
146
+ * values.
147
+ */
148
+ useUrlQuery?: boolean;
149
+ /**
150
+ * Cluster configuration for this document type.
151
+ */
152
+ cluster?: JtClusterType;
153
+ adminUi?: JtDocumentAdminUiSettings;
154
+ }
155
+
156
+ export interface JtClusterType {
157
+ /**
158
+ * Determine if the routing documents of the cluster should be automatically created when the root
159
+ * document is created.
160
+ */
161
+ autoCreate?: boolean;
162
+ }
163
+
164
+ export type JtSorting = string[] | "manual" | string;
165
+
166
+ export interface JtRoutingDocumentType extends JtDocumentTypeBase {
167
+ documentKind: "routing";
168
+ /**
169
+ * Value `"parent"` means that the document is just a hierarchy parent for other documents. But it
170
+ * has no content itself.
171
+ *
172
+ * This value is ignored in the home page type.
173
+ */
174
+ redirectTo?: "parent";
175
+ /**
176
+ * The `route` of a routing document contains a kind of _directory name_ (one per language) that
177
+ * will be the last part of the document URL path.
178
+ *
179
+ * This value is ignored in the home page type.
180
+ */
181
+ route?: string | JtTranslatedStrings;
182
+ }
183
+
184
+ export interface JtTranslatedStrings {
185
+ [language: string]: string;
186
+ }
187
+
188
+ export interface JtDocumentAdminUiSettings {
189
+ /** Default value is `"auto"`. */
190
+ defaultTab?: JtDocumentTabName;
191
+ /** Used by routing documents only. Default value is `"default"`. */
192
+ menuPlacement?: "default" | "popup";
193
+ }
194
+
195
+ export type JtDocumentTabName = "auto" | "edit" | "childDocuments" | "parts";
196
+
197
+ export interface JtRegularDocumentType extends JtDocumentTypeBase {
198
+ documentKind: "regular";
199
+ /**
200
+ * Available values are: `":relativeId-:slug"` and `":yyyy/:mm/:dd/:relativeId-:slug"`.
201
+ */
202
+ route: string;
203
+ relativeIdGenerator?: JtRelativeIdGeneratorType;
204
+ /**
205
+ * Value `true` means that the document will be automatically published without being a
206
+ * draft before. Useful for taxonomy terms, like tags or categories.
207
+ */
208
+ autoPublish?: boolean;
209
+ }
210
+
211
+ export type JtRelativeIdGeneratorType = any[]; // [makerName: string, ...args: any[]]
212
+
213
+ // ----- PART TYPES -----
214
+
215
+ export interface JtSubListType {
216
+ /** Type names of the parts in the list. */
217
+ parts: string[];
218
+ /** How to sort the list. Example: `"manual"`. */
219
+ sorting: JtSorting;
220
+ /**
221
+ * The maximum number of parts in the list.
222
+ */
223
+ limit?: number;
224
+ }
225
+
226
+ export interface JtListType extends JtSubListType {
227
+ listName: string;
228
+ }
229
+
230
+ export interface JtPartType {
231
+ /** The type name is the identifier of the part type. */
232
+ typeName: string;
233
+ kind: "part";
234
+ fields?: (JtFieldType | string)[];
235
+ /** If the part type can have children parts, then it's a sub-list. */
236
+ list?: JtSubListType;
237
+ mediaPolicy?: string;
238
+ }
239
+
240
+ // ----- FIELD TYPES -----
241
+
242
+ export type JtFieldType = JtMainDbFieldType | JtMediaDbFieldType | JtLabelingFieldType;
243
+
244
+ export interface JtFieldTypeBase {
245
+ name: string;
246
+ withGallery?: boolean;
247
+ useAsDefaultImage?: number;
248
+ renderAs?: "html";
249
+ useAsExcerpt?: number;
250
+ /** A plugin name. For example: `@paroicms/quill-editor-plugin`. */
251
+ plugin?: string;
252
+ /**
253
+ * UI settings in the admin-ui.
254
+ */
255
+ adminUi?: JtFieldAdminUiSettings;
256
+ }
257
+
258
+ export interface JtFieldAdminUiSettings {
259
+ /** Default is `"auto"`. */
260
+ showInCard?: boolean | "auto";
261
+ [key: string]: any;
262
+ }
263
+
264
+ export interface JtLocalizableFieldTypeBase extends JtFieldTypeBase {
265
+ /**
266
+ * If `true`, then each translation will have its own value. Otherwise, the value is shared
267
+ * between all translations.
268
+ */
269
+ localized: boolean;
270
+ /**
271
+ * This property should be set to `true` for real textual field types, like an html body or a
272
+ * label.
273
+ *
274
+ * Note: Its value has no effect when `localized` is `false`.
275
+ */
276
+ normalizeTypography?: boolean;
277
+ }
278
+
279
+ /**
280
+ * The field type represents a labeling link between the current node, and a term from a taxonomy.
281
+ */
282
+ export interface JtLabelingFieldType extends JtFieldTypeBase {
283
+ localized: false;
284
+ storedAs: "labeling";
285
+ /**
286
+ * It's the type name of a routing document. Regular documents that are child of this routing
287
+ * document will be the terms of the taxonomy.
288
+ *
289
+ * Notice: Any routing point can be used as a taxonomy. Terms are always regular documents.
290
+ */
291
+ taxonomy: string;
292
+ /**
293
+ * If `true`, multiple terms can be selected. Otherwise, only one term can be selected.
294
+ */
295
+ multiple?: boolean;
296
+ }
297
+
298
+ export type JtMainDbFieldType =
299
+ | JtNumberFieldType
300
+ | JtBooleanFieldType
301
+ | JtDateFieldType
302
+ | JtDateTimeFieldType
303
+ | JtTimeFieldType
304
+ | JtStringFieldType
305
+ | JtJsonFieldType;
306
+
307
+ export interface JtNumberFieldType extends JtLocalizableFieldTypeBase {
308
+ storedAs: "varchar";
309
+ dataType: "number";
310
+ currency?: string;
311
+ enum?: number[];
312
+ }
313
+
314
+ export interface JtBooleanFieldType extends JtLocalizableFieldTypeBase {
315
+ storedAs: "varchar";
316
+ dataType: "boolean";
317
+ }
318
+
319
+ export interface JtDateFieldType extends JtLocalizableFieldTypeBase {
320
+ storedAs: "varchar";
321
+ dataType: "date";
322
+ }
323
+
324
+ export interface JtDateTimeFieldType extends JtLocalizableFieldTypeBase {
325
+ storedAs: "varchar";
326
+ dataType: "dateTime";
327
+ }
328
+
329
+ export interface JtTimeFieldType extends JtLocalizableFieldTypeBase {
330
+ storedAs: "varchar";
331
+ dataType: "time";
332
+ }
333
+
334
+ export interface JtStringFieldType extends JtLocalizableFieldTypeBase {
335
+ storedAs: "text" | "varchar";
336
+ dataType: "string";
337
+ multiline?: boolean;
338
+ enum?: string[];
339
+ }
340
+
341
+ export interface JtJsonFieldType extends JtLocalizableFieldTypeBase {
342
+ storedAs: "text" | "varchar";
343
+ dataType: "json";
344
+ }
345
+
346
+ export type JtMediaDbFieldType = JtGalleryFieldType | JtMediaFieldType;
347
+
348
+ export interface JtGalleryFieldType extends JtLocalizableFieldTypeBase {
349
+ storedAs: "mediaHandle";
350
+ dataType: "gallery";
351
+ accept: string;
352
+ refuse?: string;
353
+ }
354
+
355
+ export interface JtMediaFieldType extends JtLocalizableFieldTypeBase {
356
+ storedAs: "mediaHandle";
357
+ dataType: "media";
358
+ accept: string;
359
+ refuse?: string;
360
+ }
361
+
362
+ // ----- MEDIA POLICIES -----
363
+
364
+ /**
365
+ * These properties define the rules that are applied to medias.
366
+ */
367
+ export interface JtMediaPolicy {
368
+ /**
369
+ * The internal name of the policy.
370
+ * @example `"myPolicyName"`
371
+ */
372
+ policyName: string;
373
+ /**
374
+ * Max media limit uploaded in a document.
375
+ * @example `10`
376
+ */
377
+ mediaLimitPerDocument?: number;
378
+ /**
379
+ * Max media limit uploaded in a part.
380
+ * @example `10`
381
+ */
382
+ mediaLimitPerPart?: number;
383
+ /**
384
+ * Rules about non-image medias (like PDF files).
385
+ */
386
+ attachedDocument?: JtAttachedDocumentPolicy;
387
+ /**
388
+ * Rules about images.
389
+ */
390
+ image?: JtImagePolicy;
391
+ }
392
+
393
+ /**
394
+ * These properties define the rules that are applied to
395
+ * document uploaded in document and document part
396
+ */
397
+ export interface JtAttachedDocumentPolicy {
398
+ /**
399
+ * Size limit in bytes.
400
+ * @example `2000000`
401
+ */
402
+ siteWeightLimitB?: number;
403
+ }
404
+
405
+ /**
406
+ * These properties define the rules that are applied to
407
+ * images contained in document and document part
408
+ */
409
+ export interface JtImagePolicy {
410
+ /**
411
+ * Size limit in bytes.
412
+ * @example `2000000`
413
+ */
414
+ weightLimitB?: number;
415
+ /**
416
+ * Maximum area (width × height, in pixels) of an image.
417
+ * @example `2000000`
418
+ */
419
+ areaLimitPx?: number;
420
+ }
421
+
422
+ /**
423
+ * These properties define the rules applied to image
424
+ * compression across all sites
425
+ */
426
+ export interface JtImageCompressionQualityPolicyStep {
427
+ /**
428
+ * The quality will apply for image with area smaller than this value.
429
+ * @example `600000`
430
+ */
431
+ areaLimitPx?: number;
432
+ /**
433
+ * Webp quality loss, in percents.
434
+ * @example `80`
435
+ */
436
+ quality: number;
437
+ }
438
+
439
+ // ----- LOCALIZATION -----
440
+
441
+ export interface JtSiteSchemaTranslations {
442
+ siteTheme?: string;
443
+ nodeTypes?: { [typeName: string]: JtLabelLocales };
444
+ fieldTypes?: { [fieldName: string]: JtLabelLocales };
445
+ }
446
+
447
+ export interface JtLabelLocales {
448
+ [key: string]: string | JtLabelLocales;
449
+ }
@@ -0,0 +1,7 @@
1
+ export interface JtThemeConf {
2
+ /**
3
+ * Default value is `1`.
4
+ */
5
+ pixelRatio?: number;
6
+ fTextImages: string[];
7
+ }
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ HomeRoutingCluster,
2
3
  JsonFieldValue,
3
4
  MImageVariant,
4
5
  MSourceImage,
@@ -10,7 +11,6 @@ import type {
10
11
  ScFieldDataType,
11
12
  ScFieldType,
12
13
  ScSiteSchema,
13
- SiteIds,
14
14
  ThemeConf,
15
15
  UpdateFieldValue,
16
16
  UpdateLabelingFieldValue,
@@ -194,7 +194,7 @@ export interface BackendPluginService extends PluginStaticConfiguration {
194
194
  registeredSite: RegisteredSite;
195
195
  pluginAssetsUrl: string;
196
196
  /** This is the connector of the running instance of ParoiCMS. */
197
- connector: RunningInstanceConnector;
197
+ connector: RunningServerConnector;
198
198
  getSiteFieldValue: (options: {
199
199
  fieldName: string;
200
200
  language?: string;
@@ -363,7 +363,7 @@ export interface SubDomainSitePackConfiguration extends SitePackConfigurationBas
363
363
 
364
364
  /* Running instance types */
365
365
 
366
- export interface RunningInstanceConnector {
366
+ export interface RunningServerConnector {
367
367
  getSitePackConf(packName: string): SitePackConfiguration;
368
368
  loadSiteSchemaAndIds(fqdn: string): Promise<RiSiteSchemaAndIds>;
369
369
  createAccount(
@@ -395,11 +395,18 @@ export interface RunningInstanceConnector {
395
395
  ): Promise<ParsedLNodeId[]>;
396
396
  registerNewSite: (options: NewSiteOptions) => Promise<RegisteredSite>;
397
397
  removeSite: (fqdn: string) => Promise<void>;
398
+ migrateSiteSchemas(): Promise<void>;
399
+ createBlankSiteFromExisting(options: CreateBlankSiteOptions): Promise<void>;
400
+ }
401
+
402
+ export interface CreateBlankSiteOptions {
403
+ siteDir: string;
404
+ languages: string[];
398
405
  }
399
406
 
400
407
  export interface RiSiteSchemaAndIds {
401
408
  siteSchema: ScSiteSchema;
402
- siteIds: SiteIds;
409
+ homeRoutingCluster: HomeRoutingCluster;
403
410
  }
404
411
 
405
412
  export type RiNewAccount = RiLocalNewAccount | RiExternalNewAccount;