@pagefront/lint-commerce 0.9.0 → 0.10.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 CHANGED
@@ -26,9 +26,11 @@ lint with their own catalogue, dispatched by sheet type.
26
26
 
27
27
  ## Catalogue
28
28
 
29
- Catalogue 0.14.0, targeting format 0.9: 55 product rules (`PDP-E-001` to
30
- `PDP-E-015`, `PDP-W-001` to `PDP-W-039`, `PDP-I-001`) and 7 organization
31
- rules (`ORG-E-001`, `ORG-W-001` to `ORG-W-006`), each defined in
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
32
34
  [`rules.md`](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/rules.md)
33
35
  with its target, check, message and remediation. Every report carries the
34
36
  `catalogue_version` it was produced with.
@@ -120,6 +122,27 @@ prices, bounds and base prices no longer accept a negative amount.
120
122
  - `PDP-W-039` — size advice carries a `description` and no
121
123
  `sizeAdjustment` beside a sizing dimension
122
124
 
125
+ Added in 0.10.0 (catalogue 0.15.0), with commerce release 0.3.0 and the
126
+ [versioning scheme](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/releases.md)
127
+ that replaces format versions:
128
+
129
+ - Sheets carry `release` in place of `format_version`, and `$schema` names
130
+ the sheet-spec version (`product/v0.9.0.json`, `organization/v0.3.0.json`).
131
+ Sheets carrying `format_version` are the legacy draft line and keep
132
+ validating against the bundled legacy schemas.
133
+ - `PDP-E-002` becomes "Release / schema mismatch": `$schema` must name the
134
+ sheet-spec version the release manifest maps the declared `release` to.
135
+ On legacy sheets it compares `format_version` with `$schema`, as before.
136
+ `ORG-E-003` is the same check for Organization Sheets.
137
+ - `PDP-E-016` and `ORG-E-002` — a sheet carries both `format_version` and
138
+ `release`
139
+ - **Breaking:** the report carries `release` (the value the sheet declares;
140
+ a legacy sheet's `format_version` value) and `sheet_spec_version` (parsed
141
+ from `$schema`) in place of `spec_version`. Requires
142
+ `@pagefront/lint-core` 0.2.0.
143
+ - New exports: `detectSheetLine`, `RELEASE_MANIFEST`, `KNOWN_RELEASES`,
144
+ `sheetSpecVersionFor`.
145
+
123
146
  ## API
124
147
 
125
148
  The public surface — everything importable from the package root, and
@@ -133,9 +156,11 @@ internal):
133
156
  Commerce Organization Sheets to the organization ones (see
134
157
  `detectSheetType`). Returns
135
158
  `{ layer: 1, schemaErrors: SchemaError[] }` or
136
- `{ layer: 2, report: Report }`. The bundled schemas are the current
137
- format version; a document declaring another `format_version` fails
138
- Layer 1 by design. Layer 1 runs validators compiled ahead of time at
159
+ `{ layer: 2, report: Report }`. Two lines are validated: a sheet
160
+ carrying `release` against the current sheet-spec schema for its type,
161
+ and a legacy sheet carrying `format_version` against the frozen legacy
162
+ schema (format 0.9). A sheet carrying both fields fails Layer 1.
163
+ Layer 1 runs validators compiled ahead of time at
139
164
  package build, so the pipeline needs no runtime code generation and
140
165
  runs under Cloudflare Workers and strict Content Security Policies.
141
166
  - `lintSheet(sheet: Sheet, options?: LintOptions): Report` — Layer 2
@@ -211,6 +236,12 @@ await writeFile("report.html", renderHtml(report));
211
236
 
212
237
  ## Versioning
213
238
 
239
+ This package has its own semver, separate from the rule catalogue's
240
+ (`catalogue_version` in every report) and from the commerce release and
241
+ sheet-spec versions a sheet declares (`release` and `sheet_spec_version`
242
+ in every report). The scheme is in
243
+ [`releases.md`](https://github.com/themachineweb/pagefront/blob/main/commerce/spec/releases.md).
244
+
214
245
  Pre-1.0: minor versions may break the API. The surface listed above is
215
246
  what versioning tracks — imports that reach past it (`dist/` paths,
216
247
  rule modules) are internal and may change without notice in any
package/dist/catalogue.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { KNOWN_RELEASES } from "./releases.js";
1
2
  import { pdpE001 } from "./rules/pdp-e-001.js";
2
3
  import { pdpE002 } from "./rules/pdp-e-002.js";
3
4
  import { pdpE003 } from "./rules/pdp-e-003.js";
@@ -13,6 +14,7 @@ import { pdpE012 } from "./rules/pdp-e-012.js";
13
14
  import { pdpE013 } from "./rules/pdp-e-013.js";
14
15
  import { pdpE014 } from "./rules/pdp-e-014.js";
15
16
  import { pdpE015 } from "./rules/pdp-e-015.js";
17
+ import { pdpE016 } from "./rules/pdp-e-016.js";
16
18
  import { pdpW001 } from "./rules/pdp-w-001.js";
17
19
  import { pdpW002 } from "./rules/pdp-w-002.js";
18
20
  import { pdpW003 } from "./rules/pdp-w-003.js";
@@ -62,7 +64,7 @@ import { pdpI001 } from "./rules/pdp-i-001.js";
62
64
  */
63
65
  export const commerceCatalogue = {
64
66
  vertical: "commerce",
65
- formatVersion: "0.9",
66
- catalogueVersion: "0.14.0",
67
- rules: [pdpE001, pdpE002, pdpE003, pdpE004, pdpE005, pdpE006, pdpE007, pdpE008, pdpE009, pdpE010, pdpE011, pdpE012, pdpE013, pdpE014, pdpE015, 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],
67
+ 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],
68
70
  };
package/dist/index.d.ts CHANGED
@@ -7,8 +7,10 @@
7
7
  * `validateOrganizationSheet` (Layer 1 for the Commerce Organization
8
8
  * Sheet; no organization catalogue exists yet), the commerce
9
9
  * catalogue object, and the types those signatures mention.
10
- * `product-schema.ts`, `organization-schema.ts`, and the individual
11
- * rule modules are internal.
10
+ * `product-schema.ts`, `organization-schema.ts`, `legacy-schemas.ts`
11
+ * and the individual rule modules are internal. The release manifest
12
+ * (`RELEASE_MANIFEST`, `sheetSpecVersionFor`) is exported so callers
13
+ * can resolve a release to its sheet-spec versions.
12
14
  */
13
15
  export { lintSheet } from "./lint-sheet.js";
14
16
  export { validateAndLint } from "./validate-and-lint.js";
@@ -17,6 +19,7 @@ export { validateOrganizationSheet } from "./validate-organization.js";
17
19
  export type { ValidateOrganizationResult } from "./validate-organization.js";
18
20
  export { commerceCatalogue } from "./catalogue.js";
19
21
  export { organizationCatalogue } from "./organization-catalogue.js";
20
- export { detectSheetType } from "./sheet-type.js";
21
- export type { SheetType } from "./sheet-type.js";
22
+ export { detectSheetType, detectSheetLine } from "./sheet-type.js";
23
+ export type { SheetType, SheetLine } from "./sheet-type.js";
24
+ export { RELEASE_MANIFEST, KNOWN_RELEASES, sheetSpecVersionFor } from "./releases.js";
22
25
  export type { Report, Finding, Summary, Severity, LintOptions, Sheet, } from "@pagefront/lint-core";
package/dist/index.js CHANGED
@@ -7,12 +7,15 @@
7
7
  * `validateOrganizationSheet` (Layer 1 for the Commerce Organization
8
8
  * Sheet; no organization catalogue exists yet), the commerce
9
9
  * catalogue object, and the types those signatures mention.
10
- * `product-schema.ts`, `organization-schema.ts`, and the individual
11
- * rule modules are internal.
10
+ * `product-schema.ts`, `organization-schema.ts`, `legacy-schemas.ts`
11
+ * and the individual rule modules are internal. The release manifest
12
+ * (`RELEASE_MANIFEST`, `sheetSpecVersionFor`) is exported so callers
13
+ * can resolve a release to its sheet-spec versions.
12
14
  */
13
15
  export { lintSheet } from "./lint-sheet.js";
14
16
  export { validateAndLint } from "./validate-and-lint.js";
15
17
  export { validateOrganizationSheet } from "./validate-organization.js";
16
18
  export { commerceCatalogue } from "./catalogue.js";
17
19
  export { organizationCatalogue } from "./organization-catalogue.js";
18
- export { detectSheetType } from "./sheet-type.js";
20
+ export { detectSheetType, detectSheetLine } from "./sheet-type.js";
21
+ export { RELEASE_MANIFEST, KNOWN_RELEASES, sheetSpecVersionFor } from "./releases.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The legacy draft line's JSON Schemas (commerce/spec/legacy/*.v0.9.json),
3
+ * bundled verbatim so sheets carrying `format_version` keep validating
4
+ * against the schemas their `$schema` URLs name. The files are frozen:
5
+ * the schema drift test (test/schema.test.mjs) fails if a bundled copy
6
+ * and its source diverge.
7
+ */
8
+ export declare const LEGACY_PRODUCT_SCHEMA: Record<string, unknown>;
9
+ export declare const LEGACY_ORGANIZATION_SCHEMA: Record<string, unknown>;