@nakafa/aksara-contracts 0.27.0 → 0.31.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 (44) hide show
  1. package/README.md +18 -10
  2. package/dist/math/base.d.ts +49 -0
  3. package/dist/math/base.js +103 -0
  4. package/dist/math/plane.d.ts +317 -0
  5. package/dist/math/plane.js +151 -0
  6. package/dist/math/space.d.ts +397 -0
  7. package/dist/math/space.js +129 -0
  8. package/dist/math/vector.d.ts +3 -0
  9. package/dist/math/vector.js +74 -0
  10. package/dist/math/visual.d.ts +984 -0
  11. package/dist/math/visual.js +15 -0
  12. package/dist/preview/artifact.d.ts +4 -32
  13. package/dist/preview/artifact.js +2 -2
  14. package/dist/preview/spec.d.ts +8 -64
  15. package/dist/projection/digest.d.ts +4 -74
  16. package/dist/projection/page.d.ts +1 -50
  17. package/dist/projection/page.js +9 -38
  18. package/dist/projection/question.d.ts +16 -184
  19. package/dist/projection/spec.d.ts +7 -253
  20. package/dist/projection/spec.js +2 -9
  21. package/dist/projection/verify.d.ts +4 -74
  22. package/dist/question/item.d.ts +24 -304
  23. package/dist/question/item.js +4 -4
  24. package/dist/question/response.d.ts +9 -97
  25. package/dist/question/response.js +8 -31
  26. package/dist/release/policy.d.ts +3 -0
  27. package/dist/release/policy.js +2 -0
  28. package/dist/release/rollback/spec.d.ts +36 -288
  29. package/dist/release/snapshot/data.d.ts +4 -32
  30. package/dist/release/snapshot/verify.d.ts +4 -60
  31. package/dist/renderer/compatibility.d.ts +49 -2
  32. package/dist/renderer/compatibility.js +49 -1
  33. package/dist/runtime/spec.d.ts +4 -46
  34. package/dist/runtime/verify.d.ts +0 -28
  35. package/dist/transport/batch.d.ts +8 -481
  36. package/dist/transport/batch.js +2 -14
  37. package/dist/transport/group.d.ts +50 -836
  38. package/dist/transport/group.js +1 -2
  39. package/dist/transport/request.d.ts +440 -2356
  40. package/dist/transport/response.d.ts +44 -436
  41. package/dist/transport/snapshot.d.ts +8 -64
  42. package/dist/tryout/content-hash.d.ts +4 -32
  43. package/dist/tryout/placement.d.ts +12 -96
  44. package/package.json +9 -1
@@ -0,0 +1,15 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { decodeContract } from "#contracts/decode";
3
+ import { PlaneMathVisualSchema } from "#contracts/math/plane";
4
+ import { SpaceMathVisualSchema } from "#contracts/math/space";
5
+ /** Pure mathematical scene data shared by Aksara authoring and Nakafa. */
6
+ export const MathVisualSchema = Schema.Union([
7
+ PlaneMathVisualSchema,
8
+ SpaceMathVisualSchema,
9
+ ]);
10
+ /** Strictly decodes one untrusted mathematical scene into its stable contract. */
11
+ export const decodeMathVisual = Effect.fn("AksaraContracts.decodeMathVisual")((input) => decodeContract(MathVisualSchema, "MathVisual", input));
12
+ /** Returns every rich-label key in authored anchor order. */
13
+ export function mathVisualLabelKeys(visual) {
14
+ return (visual.labels ?? []).map(({ key }) => key);
15
+ }
@@ -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,