@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.
Files changed (88) hide show
  1. package/README.md +33 -13
  2. package/dist/catalogue.js +4 -2
  3. package/dist/generated/release-manifest.d.ts +8 -0
  4. package/dist/generated/release-manifest.js +9 -0
  5. package/dist/generated/schema-ids.js +2 -0
  6. package/dist/generated/schemas.js +2450 -7
  7. package/dist/organization-catalogue.js +3 -2
  8. package/dist/rules/org-e-001.js +2 -0
  9. package/dist/rules/org-e-002.js +2 -0
  10. package/dist/rules/org-e-003.js +2 -0
  11. package/dist/rules/org-e-004.d.ts +11 -0
  12. package/dist/rules/org-e-004.js +18 -0
  13. package/dist/rules/org-w-001.js +2 -0
  14. package/dist/rules/org-w-002.js +2 -0
  15. package/dist/rules/org-w-003.js +2 -0
  16. package/dist/rules/org-w-004.js +2 -0
  17. package/dist/rules/org-w-005.js +2 -0
  18. package/dist/rules/org-w-006.js +2 -0
  19. package/dist/rules/pdp-e-001.js +2 -0
  20. package/dist/rules/pdp-e-002.js +2 -0
  21. package/dist/rules/pdp-e-003.js +2 -0
  22. package/dist/rules/pdp-e-004.js +2 -0
  23. package/dist/rules/pdp-e-005.js +2 -0
  24. package/dist/rules/pdp-e-006.js +2 -0
  25. package/dist/rules/pdp-e-007.js +2 -0
  26. package/dist/rules/pdp-e-008.js +2 -0
  27. package/dist/rules/pdp-e-009.js +2 -0
  28. package/dist/rules/pdp-e-010.js +2 -0
  29. package/dist/rules/pdp-e-011.js +2 -0
  30. package/dist/rules/pdp-e-012.js +2 -0
  31. package/dist/rules/pdp-e-013.js +2 -0
  32. package/dist/rules/pdp-e-014.js +2 -0
  33. package/dist/rules/pdp-e-015.js +2 -0
  34. package/dist/rules/pdp-e-016.js +2 -0
  35. package/dist/rules/pdp-e-017.d.ts +2 -0
  36. package/dist/rules/pdp-e-017.js +80 -0
  37. package/dist/rules/pdp-e-018.d.ts +11 -0
  38. package/dist/rules/pdp-e-018.js +18 -0
  39. package/dist/rules/pdp-i-001.js +2 -0
  40. package/dist/rules/pdp-w-001.js +2 -0
  41. package/dist/rules/pdp-w-002.js +2 -0
  42. package/dist/rules/pdp-w-003.js +2 -0
  43. package/dist/rules/pdp-w-004.js +2 -0
  44. package/dist/rules/pdp-w-005.js +2 -0
  45. package/dist/rules/pdp-w-006.js +2 -0
  46. package/dist/rules/pdp-w-007.js +2 -0
  47. package/dist/rules/pdp-w-008.js +2 -0
  48. package/dist/rules/pdp-w-009.js +2 -0
  49. package/dist/rules/pdp-w-010.js +2 -0
  50. package/dist/rules/pdp-w-011.js +2 -0
  51. package/dist/rules/pdp-w-012.js +2 -0
  52. package/dist/rules/pdp-w-013.js +2 -0
  53. package/dist/rules/pdp-w-014.js +2 -0
  54. package/dist/rules/pdp-w-015.js +2 -0
  55. package/dist/rules/pdp-w-016.js +2 -0
  56. package/dist/rules/pdp-w-017.js +2 -0
  57. package/dist/rules/pdp-w-018.js +2 -0
  58. package/dist/rules/pdp-w-019.js +2 -0
  59. package/dist/rules/pdp-w-020.js +2 -0
  60. package/dist/rules/pdp-w-021.js +2 -0
  61. package/dist/rules/pdp-w-022.js +2 -0
  62. package/dist/rules/pdp-w-023.js +2 -0
  63. package/dist/rules/pdp-w-024.js +2 -0
  64. package/dist/rules/pdp-w-025.js +2 -0
  65. package/dist/rules/pdp-w-026.js +2 -0
  66. package/dist/rules/pdp-w-027.js +2 -0
  67. package/dist/rules/pdp-w-028.js +2 -0
  68. package/dist/rules/pdp-w-029.js +2 -0
  69. package/dist/rules/pdp-w-030.js +2 -0
  70. package/dist/rules/pdp-w-031.js +2 -0
  71. package/dist/rules/pdp-w-032.js +2 -0
  72. package/dist/rules/pdp-w-033.js +2 -0
  73. package/dist/rules/pdp-w-034.js +2 -0
  74. package/dist/rules/pdp-w-035.js +2 -0
  75. package/dist/rules/pdp-w-036.js +2 -0
  76. package/dist/rules/pdp-w-037.js +2 -0
  77. package/dist/rules/pdp-w-038.js +2 -0
  78. package/dist/rules/pdp-w-039.js +2 -0
  79. package/dist/rules/release-schema.d.ts +18 -7
  80. package/dist/rules/release-schema.js +55 -15
  81. package/dist/schema-registry.d.ts +27 -14
  82. package/dist/schema-registry.js +29 -12
  83. package/dist/schema-validators.js +12 -4
  84. package/dist/validate-and-lint.d.ts +13 -9
  85. package/dist/validate-and-lint.js +23 -10
  86. package/dist/version.d.ts +1 -1
  87. package/dist/version.js +1 -1
  88. 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 its
29
- * `$schema` names, or, when it declares none, the schema its own
30
- * statements lead to (see schema-registry.ts). Returns the errors, empty
31
- * when the document is valid. A `$schema` naming no bundled schema is a
32
- * Layer 1 failure of its own, reported at `/$schema` with the keyword
33
- * `$schema`: the document is not validated against some other version.
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 document is validated against the one its
47
- * `$schema` names. A `$schema` naming a version this package does not
48
- * bundle fails Layer 1 with a single error saying so.
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 its
10
- * `$schema` names, or, when it declares none, the schema its own
11
- * statements lead to (see schema-registry.ts). Returns the errors, empty
12
- * when the document is valid. A `$schema` naming no bundled schema is a
13
- * Layer 1 failure of its own, reported at `/$schema` with the keyword
14
- * `$schema`: the document is not validated against some other version.
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 document is validated against the one its
48
- * `$schema` names. A `$schema` naming a version this package does not
49
- * bundle fails Layer 1 with a single error saying so.
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
@@ -5,4 +5,4 @@
5
5
  * (test/linter-version.test.mjs) fails when they diverge. Regenerate
6
6
  * on version bump.
7
7
  */
8
- export declare const PACKAGE_VERSION = "0.11.0";
8
+ export declare const PACKAGE_VERSION = "0.12.0";
package/dist/version.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * (test/linter-version.test.mjs) fails when they diverge. Regenerate
6
6
  * on version bump.
7
7
  */
8
- export const PACKAGE_VERSION = "0.11.0";
8
+ export const PACKAGE_VERSION = "0.12.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagefront/lint-commerce",
3
- "version": "0.11.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.2.0",
42
+ "@pagefront/lint-core": "^0.3.0",
43
43
  "ajv": "^8.20.0",
44
44
  "ajv-formats": "^3.0.1"
45
45
  },