@paroicms/internal-anywhere-lib 1.19.0 → 1.20.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-cjs/constants.d.ts +1 -1
- package/dist-cjs/constants.js +1 -1
- package/dist-cjs/constants.js.map +1 -1
- package/dist-cjs/parts.helper.d.ts +2 -2
- package/dist-cjs/parts.helper.js +2 -2
- package/dist-cjs/site-schema-helpers.d.ts +4 -4
- package/dist-cjs/site-schema-helpers.js +17 -17
- package/dist-mjs/constants.d.ts +1 -1
- package/dist-mjs/constants.js +1 -1
- package/dist-mjs/constants.js.map +1 -1
- package/dist-mjs/parts.helper.d.ts +2 -2
- package/dist-mjs/parts.helper.js +2 -2
- package/dist-mjs/site-schema-helpers.d.ts +4 -4
- package/dist-mjs/site-schema-helpers.js +15 -15
- package/package.json +2 -2
package/dist-cjs/constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PART_DEFAULT_LIST_NAME = "
|
|
1
|
+
export declare const PART_DEFAULT_LIST_NAME = "_subParts";
|
package/dist-cjs/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,WAAW,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ScListType } from "@paroicms/public-anywhere-lib";
|
|
2
2
|
export declare function sortParts(listType: ScListType, parts: {
|
|
3
|
-
|
|
3
|
+
nodeId: string;
|
|
4
4
|
publishDate: string | null;
|
|
5
5
|
orderNum: number | null;
|
|
6
6
|
}[]): void;
|
|
7
7
|
export declare function sortParts(listType: ScListType, parts: {
|
|
8
|
-
|
|
8
|
+
nodeId: string;
|
|
9
9
|
publishDate?: string;
|
|
10
10
|
orderNum?: number;
|
|
11
11
|
}[]): void;
|
package/dist-cjs/parts.helper.js
CHANGED
|
@@ -18,7 +18,7 @@ function sortParts(listType, parts) {
|
|
|
18
18
|
parts.sort((a, b) => {
|
|
19
19
|
if (a.publishDate && b.publishDate) {
|
|
20
20
|
if (a.publishDate === b.publishDate) {
|
|
21
|
-
if ((0, data_formatters_lib_1.nbVal)(a.
|
|
21
|
+
if ((0, data_formatters_lib_1.nbVal)(a.nodeId) > (0, data_formatters_lib_1.nbVal)(b.nodeId))
|
|
22
22
|
return -1;
|
|
23
23
|
return 1;
|
|
24
24
|
}
|
|
@@ -31,7 +31,7 @@ function sortParts(listType, parts) {
|
|
|
31
31
|
parts.sort((a, b) => {
|
|
32
32
|
if (a.publishDate && b.publishDate) {
|
|
33
33
|
if (a.publishDate === b.publishDate) {
|
|
34
|
-
if ((0, data_formatters_lib_1.nbVal)(a.
|
|
34
|
+
if ((0, data_formatters_lib_1.nbVal)(a.nodeId) > (0, data_formatters_lib_1.nbVal)(b.nodeId))
|
|
35
35
|
return -1;
|
|
36
36
|
return 1;
|
|
37
37
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ScDocumentType, ScFTextFieldType, ScFieldType,
|
|
2
|
-
export declare function
|
|
1
|
+
import type { ScDocumentType, ScFTextFieldType, ScFieldType, ScNodeType, ScPartType, ScRegularDocumentType, ScRoutingPointDocumentType, ScSiteSchema } from "@paroicms/public-anywhere-lib";
|
|
2
|
+
export declare function getNodeTypeByName(siteSchema: ScSiteSchema, typeName: string): ScNodeType;
|
|
3
3
|
export declare function getDocumentTypeByName(siteSchema: ScSiteSchema, typeName: string): ScDocumentType;
|
|
4
4
|
export declare function getPartTypeByName(siteSchema: ScSiteSchema, typeName: string): ScPartType;
|
|
5
5
|
export declare function getRoutingPointDocumentTypes(siteSchema: ScSiteSchema): ScRoutingPointDocumentType[];
|
|
6
6
|
export declare function regularChildDocumentTypesOf(siteSchema: ScSiteSchema, parentTypeName: string): ScRegularDocumentType[];
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
7
|
+
export declare function getNodeTypeByDashedName(siteSchema: ScSiteSchema, dashedName: string, kind: "document"): ScDocumentType | undefined;
|
|
8
|
+
export declare function getNodeTypeByDashedName(siteSchema: ScSiteSchema, dashedName: string, kind: "part"): ScPartType | undefined;
|
|
9
9
|
export declare function getMediaLimitPerDocument(siteSchema: ScSiteSchema, documentType: ScDocumentType): number | undefined;
|
|
10
10
|
export declare function getMediaLimitPerPart(siteSchema: ScSiteSchema, partType: ScPartType): number | undefined;
|
|
11
11
|
export declare function isFTextFieldType(fieldType: ScFieldType): fieldType is ScFTextFieldType;
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getNodeTypeByName = getNodeTypeByName;
|
|
4
4
|
exports.getDocumentTypeByName = getDocumentTypeByName;
|
|
5
5
|
exports.getPartTypeByName = getPartTypeByName;
|
|
6
6
|
exports.getRoutingPointDocumentTypes = getRoutingPointDocumentTypes;
|
|
7
7
|
exports.regularChildDocumentTypesOf = regularChildDocumentTypesOf;
|
|
8
|
-
exports.
|
|
8
|
+
exports.getNodeTypeByDashedName = getNodeTypeByDashedName;
|
|
9
9
|
exports.getMediaLimitPerDocument = getMediaLimitPerDocument;
|
|
10
10
|
exports.getMediaLimitPerPart = getMediaLimitPerPart;
|
|
11
11
|
exports.isFTextFieldType = isFTextFieldType;
|
|
12
12
|
exports.documentTypeHasData = documentTypeHasData;
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
throw new Error(`unknown
|
|
17
|
-
return
|
|
13
|
+
function getNodeTypeByName(siteSchema, typeName) {
|
|
14
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
15
|
+
if (!nodeType)
|
|
16
|
+
throw new Error(`unknown node type '${typeName}'`);
|
|
17
|
+
return nodeType;
|
|
18
18
|
}
|
|
19
19
|
function getDocumentTypeByName(siteSchema, typeName) {
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
20
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
21
|
+
if (!nodeType || nodeType.kind !== "document") {
|
|
22
22
|
throw new Error(`Unknown document type '${typeName}'`);
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return nodeType;
|
|
25
25
|
}
|
|
26
26
|
function getPartTypeByName(siteSchema, typeName) {
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
27
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
28
|
+
if (!nodeType || nodeType.kind !== "part") {
|
|
29
29
|
throw new Error(`Unknown part type '${typeName}'`);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return nodeType;
|
|
32
32
|
}
|
|
33
33
|
function getRoutingPointDocumentTypes(siteSchema) {
|
|
34
|
-
return Object.values(siteSchema.
|
|
34
|
+
return Object.values(siteSchema.nodeTypes).filter((item) => item.kind === "document" && item.isRoutingPoint);
|
|
35
35
|
}
|
|
36
36
|
function regularChildDocumentTypesOf(siteSchema, parentTypeName) {
|
|
37
37
|
return (getDocumentTypeByName(siteSchema, parentTypeName)
|
|
38
38
|
.children?.map((typeName) => getDocumentTypeByName(siteSchema, typeName))
|
|
39
|
-
.filter((
|
|
39
|
+
.filter((nodeType) => !nodeType.isRoutingPoint) ?? []);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return Object.values(siteSchema.
|
|
41
|
+
function getNodeTypeByDashedName(siteSchema, dashedName, kind) {
|
|
42
|
+
return Object.values(siteSchema.nodeTypes).find((item) => item.kind === kind && item.dashedName === dashedName);
|
|
43
43
|
}
|
|
44
44
|
function getMediaLimitPerDocument(siteSchema, documentType) {
|
|
45
45
|
const policyName = documentType.mediaPolicy;
|
package/dist-mjs/constants.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PART_DEFAULT_LIST_NAME = "
|
|
1
|
+
export declare const PART_DEFAULT_LIST_NAME = "_subParts";
|
package/dist-mjs/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const PART_DEFAULT_LIST_NAME = "
|
|
1
|
+
export const PART_DEFAULT_LIST_NAME = "_subParts";
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ScListType } from "@paroicms/public-anywhere-lib";
|
|
2
2
|
export declare function sortParts(listType: ScListType, parts: {
|
|
3
|
-
|
|
3
|
+
nodeId: string;
|
|
4
4
|
publishDate: string | null;
|
|
5
5
|
orderNum: number | null;
|
|
6
6
|
}[]): void;
|
|
7
7
|
export declare function sortParts(listType: ScListType, parts: {
|
|
8
|
-
|
|
8
|
+
nodeId: string;
|
|
9
9
|
publishDate?: string;
|
|
10
10
|
orderNum?: number;
|
|
11
11
|
}[]): void;
|
package/dist-mjs/parts.helper.js
CHANGED
|
@@ -15,7 +15,7 @@ export function sortParts(listType, parts) {
|
|
|
15
15
|
parts.sort((a, b) => {
|
|
16
16
|
if (a.publishDate && b.publishDate) {
|
|
17
17
|
if (a.publishDate === b.publishDate) {
|
|
18
|
-
if (nbVal(a.
|
|
18
|
+
if (nbVal(a.nodeId) > nbVal(b.nodeId))
|
|
19
19
|
return -1;
|
|
20
20
|
return 1;
|
|
21
21
|
}
|
|
@@ -28,7 +28,7 @@ export function sortParts(listType, parts) {
|
|
|
28
28
|
parts.sort((a, b) => {
|
|
29
29
|
if (a.publishDate && b.publishDate) {
|
|
30
30
|
if (a.publishDate === b.publishDate) {
|
|
31
|
-
if (nbVal(a.
|
|
31
|
+
if (nbVal(a.nodeId) > nbVal(b.nodeId))
|
|
32
32
|
return -1;
|
|
33
33
|
return 1;
|
|
34
34
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ScDocumentType, ScFTextFieldType, ScFieldType,
|
|
2
|
-
export declare function
|
|
1
|
+
import type { ScDocumentType, ScFTextFieldType, ScFieldType, ScNodeType, ScPartType, ScRegularDocumentType, ScRoutingPointDocumentType, ScSiteSchema } from "@paroicms/public-anywhere-lib";
|
|
2
|
+
export declare function getNodeTypeByName(siteSchema: ScSiteSchema, typeName: string): ScNodeType;
|
|
3
3
|
export declare function getDocumentTypeByName(siteSchema: ScSiteSchema, typeName: string): ScDocumentType;
|
|
4
4
|
export declare function getPartTypeByName(siteSchema: ScSiteSchema, typeName: string): ScPartType;
|
|
5
5
|
export declare function getRoutingPointDocumentTypes(siteSchema: ScSiteSchema): ScRoutingPointDocumentType[];
|
|
6
6
|
export declare function regularChildDocumentTypesOf(siteSchema: ScSiteSchema, parentTypeName: string): ScRegularDocumentType[];
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
7
|
+
export declare function getNodeTypeByDashedName(siteSchema: ScSiteSchema, dashedName: string, kind: "document"): ScDocumentType | undefined;
|
|
8
|
+
export declare function getNodeTypeByDashedName(siteSchema: ScSiteSchema, dashedName: string, kind: "part"): ScPartType | undefined;
|
|
9
9
|
export declare function getMediaLimitPerDocument(siteSchema: ScSiteSchema, documentType: ScDocumentType): number | undefined;
|
|
10
10
|
export declare function getMediaLimitPerPart(siteSchema: ScSiteSchema, partType: ScPartType): number | undefined;
|
|
11
11
|
export declare function isFTextFieldType(fieldType: ScFieldType): fieldType is ScFTextFieldType;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export function
|
|
2
|
-
const
|
|
3
|
-
if (!
|
|
4
|
-
throw new Error(`unknown
|
|
5
|
-
return
|
|
1
|
+
export function getNodeTypeByName(siteSchema, typeName) {
|
|
2
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
3
|
+
if (!nodeType)
|
|
4
|
+
throw new Error(`unknown node type '${typeName}'`);
|
|
5
|
+
return nodeType;
|
|
6
6
|
}
|
|
7
7
|
export function getDocumentTypeByName(siteSchema, typeName) {
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
8
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
9
|
+
if (!nodeType || nodeType.kind !== "document") {
|
|
10
10
|
throw new Error(`Unknown document type '${typeName}'`);
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return nodeType;
|
|
13
13
|
}
|
|
14
14
|
export function getPartTypeByName(siteSchema, typeName) {
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
15
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
16
|
+
if (!nodeType || nodeType.kind !== "part") {
|
|
17
17
|
throw new Error(`Unknown part type '${typeName}'`);
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return nodeType;
|
|
20
20
|
}
|
|
21
21
|
export function getRoutingPointDocumentTypes(siteSchema) {
|
|
22
|
-
return Object.values(siteSchema.
|
|
22
|
+
return Object.values(siteSchema.nodeTypes).filter((item) => item.kind === "document" && item.isRoutingPoint);
|
|
23
23
|
}
|
|
24
24
|
export function regularChildDocumentTypesOf(siteSchema, parentTypeName) {
|
|
25
25
|
return (getDocumentTypeByName(siteSchema, parentTypeName)
|
|
26
26
|
.children?.map((typeName) => getDocumentTypeByName(siteSchema, typeName))
|
|
27
|
-
.filter((
|
|
27
|
+
.filter((nodeType) => !nodeType.isRoutingPoint) ?? []);
|
|
28
28
|
}
|
|
29
|
-
export function
|
|
30
|
-
return Object.values(siteSchema.
|
|
29
|
+
export function getNodeTypeByDashedName(siteSchema, dashedName, kind) {
|
|
30
|
+
return Object.values(siteSchema.nodeTypes).find((item) => item.kind === kind && item.dashedName === dashedName);
|
|
31
31
|
}
|
|
32
32
|
export function getMediaLimitPerDocument(siteSchema, documentType) {
|
|
33
33
|
const policyName = documentType.mediaPolicy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/internal-anywhere-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "Front lib for Paroi CMS.",
|
|
5
5
|
"author": "Paroi Team",
|
|
6
6
|
"keywords": [
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@paroi/data-formatters-lib": "~0.4.0",
|
|
31
|
-
"@paroicms/public-anywhere-lib": "0.
|
|
31
|
+
"@paroicms/public-anywhere-lib": "0.12.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"rimraf": "~6.0.1",
|