@pagefront/lint-commerce 0.11.0 → 0.12.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/README.md +33 -13
- package/dist/catalogue.js +4 -2
- package/dist/generated/release-manifest.d.ts +8 -0
- package/dist/generated/release-manifest.js +9 -0
- package/dist/generated/schema-ids.js +2 -0
- package/dist/generated/schemas.js +2450 -7
- package/dist/organization-catalogue.js +3 -2
- package/dist/rules/org-e-001.js +2 -0
- package/dist/rules/org-e-002.js +2 -0
- package/dist/rules/org-e-003.js +2 -0
- package/dist/rules/org-e-004.d.ts +11 -0
- package/dist/rules/org-e-004.js +18 -0
- package/dist/rules/org-w-001.js +2 -0
- package/dist/rules/org-w-002.js +2 -0
- package/dist/rules/org-w-003.js +2 -0
- package/dist/rules/org-w-004.js +2 -0
- package/dist/rules/org-w-005.js +2 -0
- package/dist/rules/org-w-006.js +2 -0
- package/dist/rules/pdp-e-001.js +2 -0
- package/dist/rules/pdp-e-002.js +2 -0
- package/dist/rules/pdp-e-003.js +2 -0
- package/dist/rules/pdp-e-004.js +2 -0
- package/dist/rules/pdp-e-005.js +2 -0
- package/dist/rules/pdp-e-006.js +2 -0
- package/dist/rules/pdp-e-007.js +2 -0
- package/dist/rules/pdp-e-008.js +2 -0
- package/dist/rules/pdp-e-009.js +2 -0
- package/dist/rules/pdp-e-010.js +2 -0
- package/dist/rules/pdp-e-011.js +2 -0
- package/dist/rules/pdp-e-012.js +2 -0
- package/dist/rules/pdp-e-013.js +2 -0
- package/dist/rules/pdp-e-014.js +2 -0
- package/dist/rules/pdp-e-015.js +2 -0
- package/dist/rules/pdp-e-016.js +2 -0
- package/dist/rules/pdp-e-017.d.ts +2 -0
- package/dist/rules/pdp-e-017.js +80 -0
- package/dist/rules/pdp-e-018.d.ts +11 -0
- package/dist/rules/pdp-e-018.js +18 -0
- package/dist/rules/pdp-i-001.js +2 -0
- package/dist/rules/pdp-w-001.js +2 -0
- package/dist/rules/pdp-w-002.js +2 -0
- package/dist/rules/pdp-w-003.js +2 -0
- package/dist/rules/pdp-w-004.js +2 -0
- package/dist/rules/pdp-w-005.js +2 -0
- package/dist/rules/pdp-w-006.js +2 -0
- package/dist/rules/pdp-w-007.js +2 -0
- package/dist/rules/pdp-w-008.js +2 -0
- package/dist/rules/pdp-w-009.js +2 -0
- package/dist/rules/pdp-w-010.js +2 -0
- package/dist/rules/pdp-w-011.js +2 -0
- package/dist/rules/pdp-w-012.js +2 -0
- package/dist/rules/pdp-w-013.js +2 -0
- package/dist/rules/pdp-w-014.js +2 -0
- package/dist/rules/pdp-w-015.js +2 -0
- package/dist/rules/pdp-w-016.js +2 -0
- package/dist/rules/pdp-w-017.js +2 -0
- package/dist/rules/pdp-w-018.js +2 -0
- package/dist/rules/pdp-w-019.js +2 -0
- package/dist/rules/pdp-w-020.js +2 -0
- package/dist/rules/pdp-w-021.js +2 -0
- package/dist/rules/pdp-w-022.js +2 -0
- package/dist/rules/pdp-w-023.js +2 -0
- package/dist/rules/pdp-w-024.js +2 -0
- package/dist/rules/pdp-w-025.js +2 -0
- package/dist/rules/pdp-w-026.js +2 -0
- package/dist/rules/pdp-w-027.js +2 -0
- package/dist/rules/pdp-w-028.js +2 -0
- package/dist/rules/pdp-w-029.js +2 -0
- package/dist/rules/pdp-w-030.js +2 -0
- package/dist/rules/pdp-w-031.js +2 -0
- package/dist/rules/pdp-w-032.js +2 -0
- package/dist/rules/pdp-w-033.js +2 -0
- package/dist/rules/pdp-w-034.js +2 -0
- package/dist/rules/pdp-w-035.js +2 -0
- package/dist/rules/pdp-w-036.js +2 -0
- package/dist/rules/pdp-w-037.js +2 -0
- package/dist/rules/pdp-w-038.js +2 -0
- package/dist/rules/pdp-w-039.js +2 -0
- package/dist/rules/release-schema.d.ts +18 -7
- package/dist/rules/release-schema.js +55 -15
- package/dist/schema-registry.d.ts +27 -14
- package/dist/schema-registry.js +29 -12
- package/dist/schema-validators.js +12 -4
- package/dist/validate-and-lint.d.ts +13 -9
- package/dist/validate-and-lint.js +23 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -25,12 +25,14 @@ export type ValidateAndLintResult = {
|
|
|
25
25
|
report: Report;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
* Layer 1 for one document: validate it against the frozen schema
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* when the document is valid. A
|
|
32
|
-
* Layer 1 failure of its own, reported at
|
|
33
|
-
*
|
|
28
|
+
* Layer 1 for one document: validate it against the frozen schema the
|
|
29
|
+
* release it declares resolves to (see schema-registry.ts); a legacy
|
|
30
|
+
* sheet is validated against the schema its `$schema` names. Returns
|
|
31
|
+
* the errors, empty when the document is valid. A `release` the
|
|
32
|
+
* manifest does not list is a Layer 1 failure of its own, reported at
|
|
33
|
+
* `/release` with the keyword `release`; a legacy `$schema` naming no
|
|
34
|
+
* bundled schema is reported at `/$schema`. In neither case is the
|
|
35
|
+
* document validated against some other version.
|
|
34
36
|
*/
|
|
35
37
|
export declare function schemaErrorsFor(input: unknown, sheetType?: SheetType): SchemaError[];
|
|
36
38
|
/**
|
|
@@ -43,9 +45,11 @@ export declare function schemaErrorsFor(input: unknown, sheetType?: SheetType):
|
|
|
43
45
|
*
|
|
44
46
|
* The package bundles every schema ever published, on both lines: the
|
|
45
47
|
* sheet-spec versions of each release, and the legacy draft line's
|
|
46
|
-
* format 0.9 schemas. A
|
|
47
|
-
*
|
|
48
|
-
*
|
|
48
|
+
* format 0.9 schemas. A sheet is judged by the release it declares: the
|
|
49
|
+
* schema is the one that release bundles for the sheet's type, and a
|
|
50
|
+
* `$schema` that names another one is a Layer 2 finding (PDP-E-002,
|
|
51
|
+
* ORG-E-003). A release the manifest does not list fails Layer 1 with a
|
|
52
|
+
* single error saying so.
|
|
49
53
|
*
|
|
50
54
|
* Layer 2 dispatches by page type (see sheet-type.ts): product sheets
|
|
51
55
|
* lint with the product catalogue, Commerce Organization Sheets with
|
|
@@ -6,17 +6,28 @@ import { VALIDATORS } from "./schema-validators.js";
|
|
|
6
6
|
// eval is unavailable, and consumers calling it in a loop pay no
|
|
7
7
|
// compilation cost.
|
|
8
8
|
/**
|
|
9
|
-
* Layer 1 for one document: validate it against the frozen schema
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* when the document is valid. A
|
|
13
|
-
* Layer 1 failure of its own, reported at
|
|
14
|
-
*
|
|
9
|
+
* Layer 1 for one document: validate it against the frozen schema the
|
|
10
|
+
* release it declares resolves to (see schema-registry.ts); a legacy
|
|
11
|
+
* sheet is validated against the schema its `$schema` names. Returns
|
|
12
|
+
* the errors, empty when the document is valid. A `release` the
|
|
13
|
+
* manifest does not list is a Layer 1 failure of its own, reported at
|
|
14
|
+
* `/release` with the keyword `release`; a legacy `$schema` naming no
|
|
15
|
+
* bundled schema is reported at `/$schema`. In neither case is the
|
|
16
|
+
* document validated against some other version.
|
|
15
17
|
*/
|
|
16
18
|
export function schemaErrorsFor(input, sheetType) {
|
|
17
19
|
const envelope = (typeof input === "object" && input !== null ? input : {});
|
|
18
20
|
const resolution = resolveSchema(envelope, sheetType);
|
|
19
|
-
if (resolution.kind === "unknown") {
|
|
21
|
+
if (resolution.kind === "unknown-release") {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
instancePath: "/release",
|
|
25
|
+
message: `names no release this linter knows: ${resolution.declared}`,
|
|
26
|
+
keyword: "release",
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
if (resolution.kind === "unknown-schema") {
|
|
20
31
|
return [
|
|
21
32
|
{
|
|
22
33
|
instancePath: "/$schema",
|
|
@@ -44,9 +55,11 @@ export function schemaErrorsFor(input, sheetType) {
|
|
|
44
55
|
*
|
|
45
56
|
* The package bundles every schema ever published, on both lines: the
|
|
46
57
|
* sheet-spec versions of each release, and the legacy draft line's
|
|
47
|
-
* format 0.9 schemas. A
|
|
48
|
-
*
|
|
49
|
-
*
|
|
58
|
+
* format 0.9 schemas. A sheet is judged by the release it declares: the
|
|
59
|
+
* schema is the one that release bundles for the sheet's type, and a
|
|
60
|
+
* `$schema` that names another one is a Layer 2 finding (PDP-E-002,
|
|
61
|
+
* ORG-E-003). A release the manifest does not list fails Layer 1 with a
|
|
62
|
+
* single error saying so.
|
|
50
63
|
*
|
|
51
64
|
* Layer 2 dispatches by page type (see sheet-type.ts): product sheets
|
|
52
65
|
* lint with the product catalogue, Commerce Organization Sheets with
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagefront/lint-commerce",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Pagefront commerce linter: the commerce rule catalogue and CLI, on the @pagefront/lint-core engine.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"prepublishOnly": "npm test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@pagefront/lint-core": "^0.
|
|
42
|
+
"@pagefront/lint-core": "^0.3.0",
|
|
43
43
|
"ajv": "^8.20.0",
|
|
44
44
|
"ajv-formats": "^3.0.1"
|
|
45
45
|
},
|