@pagefront/lint-commerce 0.11.0 → 0.12.1

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 +41 -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 +108 -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
package/README.md CHANGED
@@ -26,11 +26,11 @@ lint with their own catalogue, dispatched by sheet type.
26
26
 
27
27
  ## Catalogue
28
28
 
29
- Catalogue 0.15.0, supporting commerce release 0.3.0 (Product Sheet spec
30
- 0.9.0, Organization Sheet spec 0.3.0) and the legacy draft line (format
31
- 0.9): 56 product rules (`PDP-E-001` to `PDP-E-016`, `PDP-W-001` to
32
- `PDP-W-039`, `PDP-I-001`) and 9 organization rules (`ORG-E-001` to
33
- `ORG-E-003`, `ORG-W-001` to `ORG-W-006`), each defined in
29
+ Catalogue 0.16.1, supporting commerce releases 0.4.0 (Product Sheet spec
30
+ 0.10.0, Organization Sheet spec 0.4.0) and 0.3.0, and the legacy draft line
31
+ (format 0.9): 58 product rules (`PDP-E-001` to `PDP-E-018`, `PDP-W-001` to
32
+ `PDP-W-039`, `PDP-I-001`) and 10 organization rules (`ORG-E-001` to
33
+ `ORG-E-004`, `ORG-W-001` to `ORG-W-006`), each defined in
34
34
  [`rules.md`](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/rules.md)
35
35
  with its target, check, message and remediation. Every report carries the
36
36
  `catalogue_version` it was produced with.
@@ -155,6 +155,34 @@ Changed in 0.11.0 (catalogue 0.15.0, unchanged):
155
155
  it now fails Layer 1 against the schema it names.
156
156
  - New exports: `CURRENT_RELEASE`, `schemaUrlFor`, `BUNDLED_SCHEMA_IDS`.
157
157
 
158
+ Added in 0.12.0 (catalogue 0.16.0), with commerce release 0.4.0. Requires
159
+ `@pagefront/lint-core` 0.3.0.
160
+
161
+ - **A sheet is judged by the release it declares.** Layer 1 validates it
162
+ against the schema its `release` bundles for its type (release 0.4.0:
163
+ `product/v0.10.0.json`, `organization/v0.4.0.json`, which require
164
+ `$schema`; release 0.3.0: the 0.3.0 schemas). Legacy sheets keep
165
+ resolving through `$schema`.
166
+ - **Rules are gated by release.** Every rule has an `appliesFrom` release
167
+ and the engine skips it on a sheet declaring a lower one. All earlier
168
+ rules apply from 0.3.0 and to legacy sheets.
169
+ - `PDP-E-002` and `ORG-E-003` compare a present `$schema` with the URL of
170
+ the schema the release bundles, and are quiet when `$schema` is absent.
171
+ - `PDP-E-017` (applies from release 0.4.0) — an exclusion, or an
172
+ adjustment's `when`, names a dimension the configurator does not declare
173
+ or an option the dimension does not list. Values are compared strictly:
174
+ `1` is not `"1"`.
175
+ - `PDP-E-018` and `ORG-E-004` — the sheet declares a `release` the release
176
+ manifest does not list. At Layer 1 this is a single error at `/release`.
177
+
178
+ Changed in 0.12.1 (catalogue 0.16.1):
179
+
180
+ - `PDP-E-017` adds a type hint. When a reference matches no option but a
181
+ declared option has the same text under another JSON type, the message
182
+ names both types, and the finding's `values` carry `reference_type`,
183
+ `declared_option` and `declared_type`. Comparison is unchanged and the
184
+ finding stays an error.
185
+
158
186
  ## API
159
187
 
160
188
  The public surface — everything importable from the package root, and
@@ -163,16 +191,16 @@ internal):
163
191
 
164
192
  - `validateAndLint(input: unknown, options?: LintOptions)` — the CLI's
165
193
  own pipeline as a function: Layer 1 against the published schema the
166
- document's `$schema` names, then Layer 2 against its page type's
167
- catalogue (see `detectSheetType`). Returns
194
+ document's declared release bundles for its page type, then Layer 2
195
+ against that page type's catalogue (see `detectSheetType`), with the
196
+ rules that apply from that release. Returns
168
197
  `{ layer: 1, schemaErrors: SchemaError[] }` or
169
198
  `{ layer: 2, report: Report }`. The package bundles every published
170
- schema, on both lines: the sheet-spec versions of each release and the
171
- legacy format 0.9 schemas. A `$schema` naming a version the package
172
- does not bundle fails Layer 1 with a single error at `/$schema`
173
- (keyword `$schema`); the document is not validated against another
174
- version. A document with no `$schema` is validated against the schema
175
- its `release` or `format_version` leads to.
199
+ schema, on both lines. A `release` the manifest does not list fails
200
+ Layer 1 with a single error at `/release` (keyword `release`). A
201
+ `$schema` that disagrees with the release is a Layer 2 finding. Legacy
202
+ sheets (`format_version`) are validated against the schema their
203
+ `$schema` names, or the legacy schema when it is absent.
176
204
  Layer 1 runs validators compiled ahead of time at
177
205
  package build, so the pipeline needs no runtime code generation and
178
206
  runs under Cloudflare Workers and strict Content Security Policies.
package/dist/catalogue.js CHANGED
@@ -15,6 +15,8 @@ import { pdpE013 } from "./rules/pdp-e-013.js";
15
15
  import { pdpE014 } from "./rules/pdp-e-014.js";
16
16
  import { pdpE015 } from "./rules/pdp-e-015.js";
17
17
  import { pdpE016 } from "./rules/pdp-e-016.js";
18
+ import { pdpE017 } from "./rules/pdp-e-017.js";
19
+ import { pdpE018 } from "./rules/pdp-e-018.js";
18
20
  import { pdpW001 } from "./rules/pdp-w-001.js";
19
21
  import { pdpW002 } from "./rules/pdp-w-002.js";
20
22
  import { pdpW003 } from "./rules/pdp-w-003.js";
@@ -65,6 +67,6 @@ import { pdpI001 } from "./rules/pdp-i-001.js";
65
67
  export const commerceCatalogue = {
66
68
  vertical: "commerce",
67
69
  releases: KNOWN_RELEASES,
68
- catalogueVersion: "0.15.0",
69
- rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, pdpW001, pdpW002, pdpW003, pdpW004, pdpW005, pdpW006, pdpW007, pdpW008, pdpW009, pdpW010, pdpW011, pdpW012, pdpW013, pdpW014, pdpW015, pdpW016, pdpW017, pdpW018, pdpW019, pdpW020, pdpW021, pdpW022, pdpW023, pdpW024, pdpW025, pdpW026, pdpW027, pdpW028, pdpW029, pdpW030, pdpW031, pdpW032, pdpW033, pdpW034, pdpW035, pdpW036, pdpW037, pdpW038, pdpW039, pdpI001],
70
+ catalogueVersion: "0.16.1",
71
+ rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, pdpE016, pdpE017, pdpE018, pdpW001, pdpW002, pdpW003, pdpW004, pdpW005, pdpW006, pdpW007, pdpW008, pdpW009, pdpW010, pdpW011, pdpW012, pdpW013, pdpW014, pdpW015, pdpW016, pdpW017, pdpW018, pdpW019, pdpW020, pdpW021, pdpW022, pdpW023, pdpW024, pdpW025, pdpW026, pdpW027, pdpW028, pdpW029, pdpW030, pdpW031, pdpW032, pdpW033, pdpW034, pdpW035, pdpW036, pdpW037, pdpW038, pdpW039, pdpI001],
70
72
  };
@@ -10,6 +10,14 @@ export declare const RELEASE_MANIFEST: {
10
10
  readonly product: "0.9.0";
11
11
  readonly organization: "0.3.0";
12
12
  };
13
+ }, {
14
+ readonly release: "0.4.0";
15
+ readonly date: "2026-10-02";
16
+ readonly vocabulary: "0.4.0";
17
+ readonly sheets: {
18
+ readonly product: "0.10.0";
19
+ readonly organization: "0.4.0";
20
+ };
13
21
  }];
14
22
  readonly legacy: {
15
23
  readonly envelope_field: "format_version";
@@ -12,6 +12,15 @@ export const RELEASE_MANIFEST = {
12
12
  "product": "0.9.0",
13
13
  "organization": "0.3.0"
14
14
  }
15
+ },
16
+ {
17
+ "release": "0.4.0",
18
+ "date": "2026-10-02",
19
+ "vocabulary": "0.4.0",
20
+ "sheets": {
21
+ "product": "0.10.0",
22
+ "organization": "0.4.0"
23
+ }
15
24
  }
16
25
  ],
17
26
  "legacy": {
@@ -1,7 +1,9 @@
1
1
  // Generated by scripts/bundle-schemas.mjs; do not edit, do not commit.
2
2
  export const SCHEMA_IDS = [
3
3
  "https://themachineweb.org/pagefront/spec/commerce/organization/v0.3.0.json",
4
+ "https://themachineweb.org/pagefront/spec/commerce/organization/v0.4.0.json",
4
5
  "https://themachineweb.org/pagefront/spec/commerce/organization/v0.9.json",
6
+ "https://themachineweb.org/pagefront/spec/commerce/product/v0.10.0.json",
5
7
  "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.0.json",
6
8
  "https://themachineweb.org/pagefront/spec/commerce/product/v0.9.json"
7
9
  ];