@nakafa/aksara-contracts 0.27.0 → 0.30.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
@@ -1,17 +1,19 @@
1
1
  # @nakafa/aksara-contracts
2
2
 
3
3
  This package defines exact runtime contracts for the Aksara compiler and
4
- publisher. Nakafa runtime adoption is a separate cutover gated by a proven
5
- immutable release archive and compatible renderer support.
4
+ publisher. Nakafa runtime adoption is a separate cutover gated by a proven npm
5
+ package, its immutable release archive, and compatible renderer support.
6
6
 
7
7
  This package contains schemas, branded identifiers, canonical wire encodings,
8
8
  and Web Crypto signature verification. It contains no corpus, renderer
9
9
  implementation, signing key, deployment credential, or browser-side MDX
10
10
  runtime.
11
11
 
12
- Consumers install the exact attested GitHub Release archive recorded in their
13
- pnpm lockfile. Content requiring a newer contract may be activated only after a
14
- compatible Nakafa renderer is live.
12
+ Consumers install the exact `@nakafa/aksara-contracts` version from npm and
13
+ commit its pnpm lockfile integrity. npm provenance and the matching immutable
14
+ GitHub Release bind those package bytes to the reviewed Aksara source. Content
15
+ requiring a newer contract may be activated only after a compatible Nakafa
16
+ renderer is live.
15
17
 
16
18
  Node-only writer and incremental digest exports remain isolated behind package
17
19
  conditions. Default-runtime exports used by Convex are audited to reject
@@ -59,13 +61,15 @@ verification authenticates the same frozen release and artifact without
59
61
  claiming that its consumer can execute the artifact. This directional
60
62
  execution check lets an additive live renderer serve an older release only when
61
63
  it still publishes the selected domain and supports every required component
62
- version. It never authorizes publication: new releases, activation, and
63
- recovery preflight remain bound to the exact complete live renderer. The
64
- renderer is not a third signed value. Current production trusts authenticated
64
+ version. A renderer-changing release remains bound to the exact complete live
65
+ manifest. A scoped content-only release may retain the active frozen manifest
66
+ only when activation proves the live renderer still publishes every frozen
67
+ domain and supports every frozen component version. The renderer is not a
68
+ third signed value. Current production trusts authenticated
65
69
  Convex state for route/head membership, delivery class, and the active pointer;
66
70
  a release result digest is not a per-row inclusion proof. This boundary is
67
71
  recorded explicitly in
68
- [ADR 0002](https://github.com/nakafaai/aksara/blob/main/docs/adr/0002-release-state.md).
72
+ [ADR 0002](https://github.com/nakafaai/aksara/blob/main/docs/adr/release.md).
69
73
 
70
74
  The package source is publicly readable for supply-chain review. All use and
71
75
  redistribution remain subject to the included Nakafa Source Available License
@@ -115,27 +115,13 @@ export declare const PreviewArtifactSchema: Schema.Struct<{
115
115
  readonly response: Schema.Union<readonly [Schema.Struct<{
116
116
  readonly categories: Schema.$Array<Schema.Struct<{
117
117
  readonly categoryKey: Schema.String;
118
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
119
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
120
- readonly kind: Schema.Literal<"math">;
121
- readonly math: Schema.String;
122
- }>, Schema.Struct<{
123
- readonly kind: Schema.Literal<"text">;
124
- readonly text: Schema.String;
125
- }>]>>;
118
+ readonly label: Schema.String;
126
119
  readonly order: Schema.Int;
127
120
  }>>;
128
121
  readonly kind: Schema.Literal<"category">;
129
122
  readonly statements: Schema.$Array<Schema.Struct<{
130
123
  readonly correctCategoryKey: Schema.String;
131
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
132
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
133
- readonly kind: Schema.Literal<"math">;
134
- readonly math: Schema.String;
135
- }>, Schema.Struct<{
136
- readonly kind: Schema.Literal<"text">;
137
- readonly text: Schema.String;
138
- }>]>>;
124
+ readonly label: Schema.String;
139
125
  readonly order: Schema.Int;
140
126
  readonly statementKey: Schema.String;
141
127
  }>>;
@@ -143,14 +129,7 @@ export declare const PreviewArtifactSchema: Schema.Struct<{
143
129
  readonly kind: Schema.Literal<"multiple-choice">;
144
130
  readonly options: Schema.$Array<Schema.Struct<{
145
131
  readonly isCorrect: Schema.Boolean;
146
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
147
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
148
- readonly kind: Schema.Literal<"math">;
149
- readonly math: Schema.String;
150
- }>, Schema.Struct<{
151
- readonly kind: Schema.Literal<"text">;
152
- readonly text: Schema.String;
153
- }>]>>;
132
+ readonly label: Schema.String;
154
133
  readonly optionKey: Schema.String;
155
134
  readonly order: Schema.Int;
156
135
  }>>;
@@ -158,14 +137,7 @@ export declare const PreviewArtifactSchema: Schema.Struct<{
158
137
  readonly kind: Schema.Literal<"single-choice">;
159
138
  readonly options: Schema.$Array<Schema.Struct<{
160
139
  readonly isCorrect: Schema.Boolean;
161
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
162
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
163
- readonly kind: Schema.Literal<"math">;
164
- readonly math: Schema.String;
165
- }>, Schema.Struct<{
166
- readonly kind: Schema.Literal<"text">;
167
- readonly text: Schema.String;
168
- }>]>>;
140
+ readonly label: Schema.String;
169
141
  readonly optionKey: Schema.String;
170
142
  readonly order: Schema.Int;
171
143
  }>>;
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { Sha256HashSchema } from "#contracts/ids";
3
- import { CurrentContentProjectionSchema } from "#contracts/projection/spec";
3
+ import { ContentProjectionSchema } from "#contracts/projection/spec";
4
4
  export const LOCAL_PREVIEW_ARTIFACT_PREFIX = "/v1/artifacts/";
5
5
  /** Builds the one content-addressed path owned by the preview protocol. */
6
6
  export function localPreviewArtifactPath(artifactHash) {
@@ -14,7 +14,7 @@ function hasCoherentArtifactPath(input) {
14
14
  export const PreviewArtifactSchema = Schema.Struct({
15
15
  artifactHash: Sha256HashSchema,
16
16
  artifactPath: Schema.Trimmed.check(Schema.isNonEmpty()),
17
- projection: CurrentContentProjectionSchema,
17
+ projection: ContentProjectionSchema,
18
18
  }).pipe(Schema.check(Schema.makeFilter(hasCoherentArtifactPath, {
19
19
  message: "Expected the artifact path to match its signed hash.",
20
20
  })));
@@ -819,27 +819,13 @@ export declare const PreviewReadySchema: Schema.Struct<{
819
819
  readonly response: Schema.Union<readonly [Schema.Struct<{
820
820
  readonly categories: Schema.$Array<Schema.Struct<{
821
821
  readonly categoryKey: Schema.String;
822
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
823
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
824
- readonly kind: Schema.Literal<"math">;
825
- readonly math: Schema.String;
826
- }>, Schema.Struct<{
827
- readonly kind: Schema.Literal<"text">;
828
- readonly text: Schema.String;
829
- }>]>>;
822
+ readonly label: Schema.String;
830
823
  readonly order: Schema.Int;
831
824
  }>>;
832
825
  readonly kind: Schema.Literal<"category">;
833
826
  readonly statements: Schema.$Array<Schema.Struct<{
834
827
  readonly correctCategoryKey: Schema.String;
835
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
836
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
837
- readonly kind: Schema.Literal<"math">;
838
- readonly math: Schema.String;
839
- }>, Schema.Struct<{
840
- readonly kind: Schema.Literal<"text">;
841
- readonly text: Schema.String;
842
- }>]>>;
828
+ readonly label: Schema.String;
843
829
  readonly order: Schema.Int;
844
830
  readonly statementKey: Schema.String;
845
831
  }>>;
@@ -847,14 +833,7 @@ export declare const PreviewReadySchema: Schema.Struct<{
847
833
  readonly kind: Schema.Literal<"multiple-choice">;
848
834
  readonly options: Schema.$Array<Schema.Struct<{
849
835
  readonly isCorrect: Schema.Boolean;
850
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
851
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
852
- readonly kind: Schema.Literal<"math">;
853
- readonly math: Schema.String;
854
- }>, Schema.Struct<{
855
- readonly kind: Schema.Literal<"text">;
856
- readonly text: Schema.String;
857
- }>]>>;
836
+ readonly label: Schema.String;
858
837
  readonly optionKey: Schema.String;
859
838
  readonly order: Schema.Int;
860
839
  }>>;
@@ -862,14 +841,7 @@ export declare const PreviewReadySchema: Schema.Struct<{
862
841
  readonly kind: Schema.Literal<"single-choice">;
863
842
  readonly options: Schema.$Array<Schema.Struct<{
864
843
  readonly isCorrect: Schema.Boolean;
865
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
866
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
867
- readonly kind: Schema.Literal<"math">;
868
- readonly math: Schema.String;
869
- }>, Schema.Struct<{
870
- readonly kind: Schema.Literal<"text">;
871
- readonly text: Schema.String;
872
- }>]>>;
844
+ readonly label: Schema.String;
873
845
  readonly optionKey: Schema.String;
874
846
  readonly order: Schema.Int;
875
847
  }>>;
@@ -2067,27 +2039,13 @@ export declare const LocalPreviewManifestSchema: Schema.Union<readonly [Schema.S
2067
2039
  readonly response: Schema.Union<readonly [Schema.Struct<{
2068
2040
  readonly categories: Schema.$Array<Schema.Struct<{
2069
2041
  readonly categoryKey: Schema.String;
2070
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
2071
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
2072
- readonly kind: Schema.Literal<"math">;
2073
- readonly math: Schema.String;
2074
- }>, Schema.Struct<{
2075
- readonly kind: Schema.Literal<"text">;
2076
- readonly text: Schema.String;
2077
- }>]>>;
2042
+ readonly label: Schema.String;
2078
2043
  readonly order: Schema.Int;
2079
2044
  }>>;
2080
2045
  readonly kind: Schema.Literal<"category">;
2081
2046
  readonly statements: Schema.$Array<Schema.Struct<{
2082
2047
  readonly correctCategoryKey: Schema.String;
2083
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
2084
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
2085
- readonly kind: Schema.Literal<"math">;
2086
- readonly math: Schema.String;
2087
- }>, Schema.Struct<{
2088
- readonly kind: Schema.Literal<"text">;
2089
- readonly text: Schema.String;
2090
- }>]>>;
2048
+ readonly label: Schema.String;
2091
2049
  readonly order: Schema.Int;
2092
2050
  readonly statementKey: Schema.String;
2093
2051
  }>>;
@@ -2095,14 +2053,7 @@ export declare const LocalPreviewManifestSchema: Schema.Union<readonly [Schema.S
2095
2053
  readonly kind: Schema.Literal<"multiple-choice">;
2096
2054
  readonly options: Schema.$Array<Schema.Struct<{
2097
2055
  readonly isCorrect: Schema.Boolean;
2098
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
2099
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
2100
- readonly kind: Schema.Literal<"math">;
2101
- readonly math: Schema.String;
2102
- }>, Schema.Struct<{
2103
- readonly kind: Schema.Literal<"text">;
2104
- readonly text: Schema.String;
2105
- }>]>>;
2056
+ readonly label: Schema.String;
2106
2057
  readonly optionKey: Schema.String;
2107
2058
  readonly order: Schema.Int;
2108
2059
  }>>;
@@ -2110,14 +2061,7 @@ export declare const LocalPreviewManifestSchema: Schema.Union<readonly [Schema.S
2110
2061
  readonly kind: Schema.Literal<"single-choice">;
2111
2062
  readonly options: Schema.$Array<Schema.Struct<{
2112
2063
  readonly isCorrect: Schema.Boolean;
2113
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
2114
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
2115
- readonly kind: Schema.Literal<"math">;
2116
- readonly math: Schema.String;
2117
- }>, Schema.Struct<{
2118
- readonly kind: Schema.Literal<"text">;
2119
- readonly text: Schema.String;
2120
- }>]>>;
2064
+ readonly label: Schema.String;
2121
2065
  readonly optionKey: Schema.String;
2122
2066
  readonly order: Schema.Int;
2123
2067
  }>>;
@@ -135,21 +135,7 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
135
135
  readonly kind: "single-choice";
136
136
  readonly options: readonly {
137
137
  readonly isCorrect: boolean;
138
- readonly label: readonly [{
139
- readonly display: "block" | "inline";
140
- readonly kind: "math";
141
- readonly math: string;
142
- } | {
143
- readonly kind: "text";
144
- readonly text: string;
145
- }, ...({
146
- readonly display: "block" | "inline";
147
- readonly kind: "math";
148
- readonly math: string;
149
- } | {
150
- readonly kind: "text";
151
- readonly text: string;
152
- })[]];
138
+ readonly label: string;
153
139
  readonly optionKey: string;
154
140
  readonly order: number;
155
141
  }[];
@@ -157,62 +143,20 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
157
143
  readonly kind: "multiple-choice";
158
144
  readonly options: readonly {
159
145
  readonly isCorrect: boolean;
160
- readonly label: readonly [{
161
- readonly display: "block" | "inline";
162
- readonly kind: "math";
163
- readonly math: string;
164
- } | {
165
- readonly kind: "text";
166
- readonly text: string;
167
- }, ...({
168
- readonly display: "block" | "inline";
169
- readonly kind: "math";
170
- readonly math: string;
171
- } | {
172
- readonly kind: "text";
173
- readonly text: string;
174
- })[]];
146
+ readonly label: string;
175
147
  readonly optionKey: string;
176
148
  readonly order: number;
177
149
  }[];
178
150
  } | {
179
151
  readonly categories: readonly {
180
152
  readonly categoryKey: string;
181
- readonly label: readonly [{
182
- readonly display: "block" | "inline";
183
- readonly kind: "math";
184
- readonly math: string;
185
- } | {
186
- readonly kind: "text";
187
- readonly text: string;
188
- }, ...({
189
- readonly display: "block" | "inline";
190
- readonly kind: "math";
191
- readonly math: string;
192
- } | {
193
- readonly kind: "text";
194
- readonly text: string;
195
- })[]];
153
+ readonly label: string;
196
154
  readonly order: number;
197
155
  }[];
198
156
  readonly kind: "category";
199
157
  readonly statements: readonly {
200
158
  readonly correctCategoryKey: string;
201
- readonly label: readonly [{
202
- readonly display: "block" | "inline";
203
- readonly kind: "math";
204
- readonly math: string;
205
- } | {
206
- readonly kind: "text";
207
- readonly text: string;
208
- }, ...({
209
- readonly display: "block" | "inline";
210
- readonly kind: "math";
211
- readonly math: string;
212
- } | {
213
- readonly kind: "text";
214
- readonly text: string;
215
- })[]];
159
+ readonly label: string;
216
160
  readonly order: number;
217
161
  readonly statementKey: string;
218
162
  }[];
@@ -240,20 +184,6 @@ export declare const digestProjections: <E, R>(releaseId: string & import("effec
240
184
  readonly title: string;
241
185
  };
242
186
  readonly stimulusKey?: string;
243
- } | {
244
- readonly appLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraAppLocale">;
245
- readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
246
- readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
247
- readonly pageKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPageKey">;
248
- readonly publicPath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraPublicPath">;
249
- readonly kind: "public-page";
250
- readonly metadata: {
251
- readonly description: string;
252
- readonly lastModified: string;
253
- readonly title: string;
254
- };
255
- readonly sitemap: true;
256
- readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
257
187
  }, E, R>) => Effect.Effect<{
258
188
  count: number;
259
189
  digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
@@ -38,55 +38,6 @@ export declare const PublicPageProjectionSchema: Schema.Struct<{
38
38
  readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
39
39
  }>;
40
40
  export type PublicPageProjection = typeof PublicPageProjectionSchema.Type;
41
- /** Exact predecessor Page bytes required for rollback and stored-state reads. */
42
- export declare const HistoricalPublicPageProjectionSchema: Schema.Struct<{
43
- readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
44
- readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
45
- readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
46
- readonly pageKey: Schema.brand<Schema.String, "@NakafaAI/AksaraPageKey">;
47
- readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
48
- readonly kind: Schema.Literal<"public-page">;
49
- readonly metadata: Schema.Struct<{
50
- readonly description: Schema.Trimmed;
51
- readonly lastModified: Schema.String;
52
- readonly title: Schema.Trimmed;
53
- }>;
54
- readonly sitemap: Schema.Literal<true>;
55
- readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
56
- }>;
57
- export type HistoricalPublicPageProjection = typeof HistoricalPublicPageProjectionSchema.Type;
58
- /** Current Page values plus exact predecessor bytes needed for safe rollout. */
59
- export declare const ReadablePublicPageProjectionSchema: Schema.Union<readonly [Schema.Struct<{
60
- readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
61
- readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
62
- readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
63
- readonly pageKey: Schema.brand<Schema.String, "@NakafaAI/AksaraPageKey">;
64
- readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
65
- readonly kind: Schema.Literal<"public-page">;
66
- readonly metadata: Schema.Struct<{
67
- readonly dateModified: Schema.optionalKey<Schema.String>;
68
- readonly datePublished: Schema.String;
69
- readonly description: Schema.Trimmed;
70
- readonly title: Schema.Trimmed;
71
- }>;
72
- readonly sitemap: Schema.Literal<true>;
73
- readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
74
- }>, Schema.Struct<{
75
- readonly appLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">;
76
- readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
77
- readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
78
- readonly pageKey: Schema.brand<Schema.String, "@NakafaAI/AksaraPageKey">;
79
- readonly publicPath: Schema.brand<Schema.String, "@NakafaAI/AksaraPublicPath">;
80
- readonly kind: Schema.Literal<"public-page">;
81
- readonly metadata: Schema.Struct<{
82
- readonly description: Schema.Trimmed;
83
- readonly lastModified: Schema.String;
84
- readonly title: Schema.Trimmed;
85
- }>;
86
- readonly sitemap: Schema.Literal<true>;
87
- readonly sourcePath: Schema.brand<Schema.String, "@NakafaAI/AksaraCorpusSourcePath">;
88
- }>]>;
89
- export type ReadablePublicPageProjection = typeof ReadablePublicPageProjectionSchema.Type;
90
41
  /** Combines one reviewed page route with its strict localized metadata. */
91
42
  export declare function makePublicPageProjection(input: {
92
43
  readonly metadata: PageMetadata;
@@ -109,4 +60,4 @@ export declare function makePublicPageProjection(input: {
109
60
  readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
110
61
  };
111
62
  /** Serializes one public page projection with stable signed field order. */
112
- export declare function canonicalizePublicPageProjection(projection: ReadablePublicPageProjection): string;
63
+ export declare function canonicalizePublicPageProjection(projection: PublicPageProjection): string;
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { DateOnlySchema, withPublicationDates } from "#contracts/date";
2
+ import { withPublicationDates } from "#contracts/date";
3
3
  import { ContentKeySchema, CorpusSourcePathSchema, PublicPathSchema, } from "#contracts/ids";
4
4
  import { AppLocaleSchema, ArtifactLocaleSchema } from "#contracts/locale";
5
5
  import { isLowerKebab } from "#contracts/text/syntax";
@@ -10,12 +10,6 @@ export const PageMetadataSchema = withPublicationDates({
10
10
  description: Schema.Trimmed.check(Schema.isNonEmpty()),
11
11
  title: Schema.Trimmed.check(Schema.isNonEmpty()),
12
12
  });
13
- /** Immutable metadata retained only for authenticated historical Page reads. */
14
- const HistoricalPageMetadataSchema = Schema.Struct({
15
- description: Schema.Trimmed.check(Schema.isNonEmpty()),
16
- lastModified: DateOnlySchema,
17
- title: Schema.Trimmed.check(Schema.isNonEmpty()),
18
- });
19
13
  const PublicPageRouteFields = {
20
14
  appLocale: AppLocaleSchema,
21
15
  artifactLocale: ArtifactLocaleSchema,
@@ -49,23 +43,6 @@ export const PublicPageProjectionSchema = Schema.Struct({
49
43
  })), Schema.check(Schema.makeFilter(hasCoherentPageRoute, {
50
44
  message: "Expected the public page content key to match its page key.",
51
45
  })));
52
- /** Exact predecessor Page bytes required for rollback and stored-state reads. */
53
- export const HistoricalPublicPageProjectionSchema = Schema.Struct({
54
- ...PublicPageRouteFields,
55
- kind: Schema.Literal("public-page"),
56
- metadata: HistoricalPageMetadataSchema,
57
- sitemap: Schema.Literal(true),
58
- sourcePath: CorpusSourcePathSchema,
59
- }).pipe(Schema.check(Schema.makeFilter(hasCoherentPageLocales, {
60
- message: "Expected historical page route and artifact locales to match.",
61
- })), Schema.check(Schema.makeFilter(hasCoherentPageRoute, {
62
- message: "Expected the historical page content key to match its page key.",
63
- })));
64
- /** Current Page values plus exact predecessor bytes needed for safe rollout. */
65
- export const ReadablePublicPageProjectionSchema = Schema.Union([
66
- PublicPageProjectionSchema,
67
- HistoricalPublicPageProjectionSchema,
68
- ]);
69
46
  /** Combines one reviewed page route with its strict localized metadata. */
70
47
  export function makePublicPageProjection(input) {
71
48
  return PublicPageProjectionSchema.make({
@@ -78,20 +55,14 @@ export function makePublicPageProjection(input) {
78
55
  }
79
56
  /** Serializes one public page projection with stable signed field order. */
80
57
  export function canonicalizePublicPageProjection(projection) {
81
- const metadata = "lastModified" in projection.metadata
82
- ? {
83
- description: projection.metadata.description,
84
- lastModified: projection.metadata.lastModified,
85
- title: projection.metadata.title,
86
- }
87
- : {
88
- ...(projection.metadata.dateModified === undefined
89
- ? {}
90
- : { dateModified: projection.metadata.dateModified }),
91
- datePublished: projection.metadata.datePublished,
92
- description: projection.metadata.description,
93
- title: projection.metadata.title,
94
- };
58
+ const metadata = {
59
+ ...(projection.metadata.dateModified === undefined
60
+ ? {}
61
+ : { dateModified: projection.metadata.dateModified }),
62
+ datePublished: projection.metadata.datePublished,
63
+ description: projection.metadata.description,
64
+ title: projection.metadata.title,
65
+ };
95
66
  return JSON.stringify({
96
67
  appLocale: projection.appLocale,
97
68
  artifactLocale: projection.artifactLocale,