@shoklan/pustaka-contracts 0.0.0-stage → 0.1.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 +6 -2
- package/dist/contracts.d.ts +269 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +169 -0
- package/dist/contracts.js.map +1 -0
- package/dist/corpus.d.ts +48 -0
- package/dist/corpus.d.ts.map +1 -0
- package/dist/corpus.js +26 -0
- package/dist/corpus.js.map +1 -0
- package/dist/crypto.d.ts +148 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +470 -0
- package/dist/crypto.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/renderer.d.ts +54 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +101 -0
- package/dist/renderer.js.map +1 -0
- package/dist/tree.d.ts +77 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +208 -0
- package/dist/tree.js.map +1 -0
- package/package.json +65 -4
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @shoklan/pustaka-contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Runtime schemas, canonical `content-tree` serialization, renderer manifest contracts, corpus types, and domain-separated Ed25519 signature verification shared between **Pustaka** and **SME Clone** (modeled on `@nakafa/aksara-contracts`).
|
|
4
|
+
|
|
5
|
+
## Consumption Standard
|
|
6
|
+
|
|
7
|
+
Consumers install the exact `@shoklan/pustaka-contracts` version from npm and commit its `bun.lock` integrity hash. The package ships compiled ESM (`dist/*.js`) and TypeScript declarations (`dist/*.d.ts`) only, published via `.github/workflows/contracts.yml` with npm provenance and a matching GitHub Release.
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type RendererDomain, RendererDomainSchema } from "./renderer.js";
|
|
3
|
+
import { type ContentTreeChild, type ContentTreeElement, type ContentTreeElementName, type ContentTreeIntrinsicTag, type ContentTreeProps, type ContentTreeValue, CONTENT_TREE_INTRINSIC_TAGS, ContentTreeChildZodSchema, ContentTreeElementNameZodSchema, ContentTreeElementSchema, ContentTreeElementZodSchema, ContentTreePropsZodSchema, ContentTreeSchema, ContentTreeValueZodSchema, ContentTreeZodSchema, canonicalizeContentTree, contentTreeComponentNames, ELEMENT_KEY, FRAGMENT_NAME, isComponentElementName, isContentTreeElement, isContentTreeIntrinsicTag, isValidContentTreeElementName } from "./tree.js";
|
|
4
|
+
export { type ContentTreeChild, type ContentTreeElement, type ContentTreeElementName, type ContentTreeIntrinsicTag, type ContentTreeProps, type ContentTreeValue, CONTENT_TREE_INTRINSIC_TAGS, ContentTreeChildZodSchema, ContentTreeElementNameZodSchema, ContentTreeElementSchema, ContentTreeElementZodSchema, ContentTreePropsZodSchema, ContentTreeSchema, ContentTreeValueZodSchema, ContentTreeZodSchema, canonicalizeContentTree, contentTreeComponentNames, ELEMENT_KEY, FRAGMENT_NAME, isComponentElementName, isContentTreeElement, isContentTreeIntrinsicTag, isValidContentTreeElementName, type RendererDomain, RendererDomainSchema, };
|
|
5
|
+
/** Compiler protocol version matching Aksara content-tree generation (ADR 0001 Decision 37). */
|
|
6
|
+
export declare const AKSARA_COMPILER_VERSION: "0.2.0";
|
|
7
|
+
/** Official MDX compiler version used to produce function-body artifacts before evaluation. */
|
|
8
|
+
export declare const MDX_COMPILER_VERSION: "3.1.1";
|
|
9
|
+
/** Evidence-led UTF-8 byte ceilings matching @nakafa/aksara-contracts/limits (ADR 0001). */
|
|
10
|
+
export declare const MAX_RAW_MDX_BYTES = 131072;
|
|
11
|
+
export declare const MAX_CONTENT_TREE_BYTES = 393216;
|
|
12
|
+
export declare const MAX_PLAIN_TEXT_BYTES = 131072;
|
|
13
|
+
export declare const MAX_CANONICAL_PAYLOAD_BYTES = 458752;
|
|
14
|
+
export declare const MAX_SIGNED_ARTIFACT_BYTES = 491520;
|
|
15
|
+
export declare const LocaleSchema: z.ZodEnum<{
|
|
16
|
+
en: "en";
|
|
17
|
+
}>;
|
|
18
|
+
export type Locale = z.infer<typeof LocaleSchema>;
|
|
19
|
+
export declare const ContentKeySchema: z.ZodString;
|
|
20
|
+
export type ContentKey = z.infer<typeof ContentKeySchema>;
|
|
21
|
+
export declare const ReleaseIdSchema: z.ZodString;
|
|
22
|
+
export type ReleaseId = z.infer<typeof ReleaseIdSchema>;
|
|
23
|
+
export declare const Sha256HashSchema: z.ZodString;
|
|
24
|
+
export type Sha256Hash = z.infer<typeof Sha256HashSchema>;
|
|
25
|
+
export declare const GitCommitShaSchema: z.ZodString;
|
|
26
|
+
export type GitCommitSha = z.infer<typeof GitCommitShaSchema>;
|
|
27
|
+
export declare const ArtifactFormatSchema: z.ZodLiteral<"content-tree">;
|
|
28
|
+
export type ArtifactFormat = z.infer<typeof ArtifactFormatSchema>;
|
|
29
|
+
/**
|
|
30
|
+
* Signed artifact payload contract (Aksara content-tree standard, ADR 0001 Decision 37).
|
|
31
|
+
* Strictly zero-legacy: holds the publish-time evaluated `contentTree` data fragment,
|
|
32
|
+
* raw source provenance (`rawMdx`, `sourceHash`), `plainText`, and compiler provenance.
|
|
33
|
+
* Never ships runtime-executable `compiledCode` to the web application.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ArtifactPayloadSchema: z.ZodObject<{
|
|
36
|
+
contentKey: z.ZodString;
|
|
37
|
+
locale: z.ZodEnum<{
|
|
38
|
+
en: "en";
|
|
39
|
+
}>;
|
|
40
|
+
contentTree: z.ZodType<{
|
|
41
|
+
readonly $node: "element";
|
|
42
|
+
readonly children: readonly ContentTreeChild[];
|
|
43
|
+
readonly name: ContentTreeElementName;
|
|
44
|
+
readonly props: {
|
|
45
|
+
readonly [key: string]: ContentTreeValue;
|
|
46
|
+
};
|
|
47
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
48
|
+
readonly $node: "element";
|
|
49
|
+
readonly children: readonly ContentTreeChild[];
|
|
50
|
+
readonly name: ContentTreeElementName;
|
|
51
|
+
readonly props: {
|
|
52
|
+
readonly [key: string]: ContentTreeValue;
|
|
53
|
+
};
|
|
54
|
+
}, unknown>>;
|
|
55
|
+
format: z.ZodLiteral<"content-tree">;
|
|
56
|
+
plainText: z.ZodString;
|
|
57
|
+
rawMdx: z.ZodString;
|
|
58
|
+
sourceHash: z.ZodString;
|
|
59
|
+
compilerVersion: z.ZodLiteral<"0.2.0">;
|
|
60
|
+
mdxCompilerVersion: z.ZodLiteral<"3.1.1">;
|
|
61
|
+
compilerConfigHash: z.ZodString;
|
|
62
|
+
artifactHash: z.ZodString;
|
|
63
|
+
rendererDomain: z.ZodEnum<{
|
|
64
|
+
materials: "materials";
|
|
65
|
+
exercises: "exercises";
|
|
66
|
+
}>;
|
|
67
|
+
requiredComponents: z.ZodArray<z.ZodString>;
|
|
68
|
+
compiledAt: z.ZodNumber;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export type ArtifactPayload = z.infer<typeof ArtifactPayloadSchema>;
|
|
71
|
+
/**
|
|
72
|
+
* Immutable signed artifact envelope authenticated with domain-separated Ed25519.
|
|
73
|
+
*/
|
|
74
|
+
export declare const SignedArtifactSchema: z.ZodObject<{
|
|
75
|
+
artifactHash: z.ZodString;
|
|
76
|
+
keyId: z.ZodString;
|
|
77
|
+
payload: z.ZodObject<{
|
|
78
|
+
contentKey: z.ZodString;
|
|
79
|
+
locale: z.ZodEnum<{
|
|
80
|
+
en: "en";
|
|
81
|
+
}>;
|
|
82
|
+
contentTree: z.ZodType<{
|
|
83
|
+
readonly $node: "element";
|
|
84
|
+
readonly children: readonly ContentTreeChild[];
|
|
85
|
+
readonly name: ContentTreeElementName;
|
|
86
|
+
readonly props: {
|
|
87
|
+
readonly [key: string]: ContentTreeValue;
|
|
88
|
+
};
|
|
89
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
90
|
+
readonly $node: "element";
|
|
91
|
+
readonly children: readonly ContentTreeChild[];
|
|
92
|
+
readonly name: ContentTreeElementName;
|
|
93
|
+
readonly props: {
|
|
94
|
+
readonly [key: string]: ContentTreeValue;
|
|
95
|
+
};
|
|
96
|
+
}, unknown>>;
|
|
97
|
+
format: z.ZodLiteral<"content-tree">;
|
|
98
|
+
plainText: z.ZodString;
|
|
99
|
+
rawMdx: z.ZodString;
|
|
100
|
+
sourceHash: z.ZodString;
|
|
101
|
+
compilerVersion: z.ZodLiteral<"0.2.0">;
|
|
102
|
+
mdxCompilerVersion: z.ZodLiteral<"3.1.1">;
|
|
103
|
+
compilerConfigHash: z.ZodString;
|
|
104
|
+
artifactHash: z.ZodString;
|
|
105
|
+
rendererDomain: z.ZodEnum<{
|
|
106
|
+
materials: "materials";
|
|
107
|
+
exercises: "exercises";
|
|
108
|
+
}>;
|
|
109
|
+
requiredComponents: z.ZodArray<z.ZodString>;
|
|
110
|
+
compiledAt: z.ZodNumber;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
signature: z.ZodString;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
export type SignedArtifact = z.infer<typeof SignedArtifactSchema>;
|
|
115
|
+
export declare const ContentHeadingSchema: z.ZodObject<{
|
|
116
|
+
depth: z.ZodNumber;
|
|
117
|
+
text: z.ZodString;
|
|
118
|
+
slug: z.ZodString;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
export type ContentHeading = z.infer<typeof ContentHeadingSchema>;
|
|
121
|
+
export declare const ExerciseChoiceSchema: z.ZodObject<{
|
|
122
|
+
optionKey: z.ZodString;
|
|
123
|
+
label: z.ZodString;
|
|
124
|
+
isCorrect: z.ZodBoolean;
|
|
125
|
+
order: z.ZodNumber;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type ExerciseChoice = z.infer<typeof ExerciseChoiceSchema>;
|
|
128
|
+
export declare const CatalogItemKindSchema: z.ZodEnum<{
|
|
129
|
+
notes: "notes";
|
|
130
|
+
"notes-group": "notes-group";
|
|
131
|
+
"topic-group": "topic-group";
|
|
132
|
+
"exercise-group": "exercise-group";
|
|
133
|
+
"single-exercise": "single-exercise";
|
|
134
|
+
"exercise-list": "exercise-list";
|
|
135
|
+
}>;
|
|
136
|
+
export type CatalogItemKind = z.infer<typeof CatalogItemKindSchema>;
|
|
137
|
+
export declare const CatalogItemModeSchema: z.ZodEnum<{
|
|
138
|
+
notes: "notes";
|
|
139
|
+
"try-out": "try-out";
|
|
140
|
+
}>;
|
|
141
|
+
export type CatalogItemMode = z.infer<typeof CatalogItemModeSchema>;
|
|
142
|
+
/** Denormalized catalog row for instant, zero-computation runtime reads. */
|
|
143
|
+
export declare const CatalogItemSchema: z.ZodObject<{
|
|
144
|
+
contentKey: z.ZodString;
|
|
145
|
+
publicPath: z.ZodString;
|
|
146
|
+
locale: z.ZodEnum<{
|
|
147
|
+
en: "en";
|
|
148
|
+
}>;
|
|
149
|
+
kind: z.ZodEnum<{
|
|
150
|
+
notes: "notes";
|
|
151
|
+
"notes-group": "notes-group";
|
|
152
|
+
"topic-group": "topic-group";
|
|
153
|
+
"exercise-group": "exercise-group";
|
|
154
|
+
"single-exercise": "single-exercise";
|
|
155
|
+
"exercise-list": "exercise-list";
|
|
156
|
+
}>;
|
|
157
|
+
curriculum: z.ZodString;
|
|
158
|
+
subject: z.ZodString;
|
|
159
|
+
examBoard: z.ZodString;
|
|
160
|
+
mode: z.ZodEnum<{
|
|
161
|
+
notes: "notes";
|
|
162
|
+
"try-out": "try-out";
|
|
163
|
+
}>;
|
|
164
|
+
title: z.ZodString;
|
|
165
|
+
description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
chapterTitle: z.ZodOptional<z.ZodString>;
|
|
167
|
+
headings: z.ZodArray<z.ZodObject<{
|
|
168
|
+
depth: z.ZodNumber;
|
|
169
|
+
text: z.ZodString;
|
|
170
|
+
slug: z.ZodString;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
artifactHash: z.ZodString;
|
|
173
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
174
|
+
optionKey: z.ZodString;
|
|
175
|
+
label: z.ZodString;
|
|
176
|
+
isCorrect: z.ZodBoolean;
|
|
177
|
+
order: z.ZodNumber;
|
|
178
|
+
}, z.core.$strip>>>;
|
|
179
|
+
questionCount: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
order: z.ZodNumber;
|
|
181
|
+
parentPath: z.ZodOptional<z.ZodString>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type CatalogItem = z.infer<typeof CatalogItemSchema>;
|
|
184
|
+
export declare const ReleaseStatusSchema: z.ZodUnion<readonly [z.ZodLiteral<"staged">, z.ZodLiteral<"verifying">, z.ZodLiteral<"verified">, z.ZodLiteral<"active">, z.ZodLiteral<"rolled_back">, z.ZodLiteral<"archived">, z.ZodLiteral<"aborting">, z.ZodLiteral<"aborted">]>;
|
|
185
|
+
export type ReleaseStatus = z.infer<typeof ReleaseStatusSchema>;
|
|
186
|
+
export declare const ReleaseManifestSchema: z.ZodObject<{
|
|
187
|
+
releaseId: z.ZodString;
|
|
188
|
+
manifestHash: z.ZodString;
|
|
189
|
+
baseReleaseId: z.ZodNullable<z.ZodString>;
|
|
190
|
+
sourceRevision: z.ZodString;
|
|
191
|
+
status: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"staged">, z.ZodLiteral<"verifying">, z.ZodLiteral<"verified">, z.ZodLiteral<"active">, z.ZodLiteral<"rolled_back">, z.ZodLiteral<"archived">, z.ZodLiteral<"aborting">, z.ZodLiteral<"aborted">]>>;
|
|
192
|
+
sequence: z.ZodNumber;
|
|
193
|
+
itemCount: z.ZodNumber;
|
|
194
|
+
locales: z.ZodArray<z.ZodEnum<{
|
|
195
|
+
en: "en";
|
|
196
|
+
}>>;
|
|
197
|
+
rendererManifestHash: z.ZodString;
|
|
198
|
+
createdAt: z.ZodNumber;
|
|
199
|
+
verifiedAt: z.ZodOptional<z.ZodNumber>;
|
|
200
|
+
activatedAt: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
}, z.core.$strict>;
|
|
202
|
+
export type ReleaseManifest = z.infer<typeof ReleaseManifestSchema>;
|
|
203
|
+
export declare const SignedContentReleaseSchema: z.ZodObject<{
|
|
204
|
+
keyId: z.ZodString;
|
|
205
|
+
manifest: z.ZodObject<{
|
|
206
|
+
releaseId: z.ZodString;
|
|
207
|
+
manifestHash: z.ZodString;
|
|
208
|
+
baseReleaseId: z.ZodNullable<z.ZodString>;
|
|
209
|
+
sourceRevision: z.ZodString;
|
|
210
|
+
status: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"staged">, z.ZodLiteral<"verifying">, z.ZodLiteral<"verified">, z.ZodLiteral<"active">, z.ZodLiteral<"rolled_back">, z.ZodLiteral<"archived">, z.ZodLiteral<"aborting">, z.ZodLiteral<"aborted">]>>;
|
|
211
|
+
sequence: z.ZodNumber;
|
|
212
|
+
itemCount: z.ZodNumber;
|
|
213
|
+
locales: z.ZodArray<z.ZodEnum<{
|
|
214
|
+
en: "en";
|
|
215
|
+
}>>;
|
|
216
|
+
rendererManifestHash: z.ZodString;
|
|
217
|
+
createdAt: z.ZodNumber;
|
|
218
|
+
verifiedAt: z.ZodOptional<z.ZodNumber>;
|
|
219
|
+
activatedAt: z.ZodOptional<z.ZodNumber>;
|
|
220
|
+
}, z.core.$strict>;
|
|
221
|
+
manifestHash: z.ZodString;
|
|
222
|
+
signature: z.ZodString;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
export type SignedContentRelease = z.infer<typeof SignedContentReleaseSchema>;
|
|
225
|
+
export declare const ContentHeadSlotSchema: z.ZodLiteral<"live">;
|
|
226
|
+
export type ContentHeadSlot = z.infer<typeof ContentHeadSlotSchema>;
|
|
227
|
+
export declare const ContentHeadSchema: z.ZodObject<{
|
|
228
|
+
slot: z.ZodLiteral<"live">;
|
|
229
|
+
activeReleaseId: z.ZodString;
|
|
230
|
+
previousReleaseId: z.ZodNullable<z.ZodString>;
|
|
231
|
+
candidateReleaseId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
232
|
+
recoveryReleaseId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
233
|
+
sequence: z.ZodNumber;
|
|
234
|
+
updatedAt: z.ZodNumber;
|
|
235
|
+
}, z.core.$strip>;
|
|
236
|
+
export type ContentHead = z.infer<typeof ContentHeadSchema>;
|
|
237
|
+
/**
|
|
238
|
+
* Generates a valid Release ID adhering to ReleaseIdSchema (`rel_[a-zA-Z0-9_-]{16,32}`).
|
|
239
|
+
*/
|
|
240
|
+
export declare function generateReleaseId(): string;
|
|
241
|
+
export declare const ContentCacheScopeSchema: z.ZodEnum<{
|
|
242
|
+
notes: "notes";
|
|
243
|
+
"try-out": "try-out";
|
|
244
|
+
all: "all";
|
|
245
|
+
material: "material";
|
|
246
|
+
}>;
|
|
247
|
+
export type ContentCacheScope = z.infer<typeof ContentCacheScopeSchema>;
|
|
248
|
+
export declare const ContentCacheRequestSchema: z.ZodObject<{
|
|
249
|
+
scope: z.ZodEnum<{
|
|
250
|
+
notes: "notes";
|
|
251
|
+
"try-out": "try-out";
|
|
252
|
+
all: "all";
|
|
253
|
+
material: "material";
|
|
254
|
+
}>;
|
|
255
|
+
releaseId: z.ZodString;
|
|
256
|
+
}, z.core.$strict>;
|
|
257
|
+
export type ContentCacheRequest = z.infer<typeof ContentCacheRequestSchema>;
|
|
258
|
+
export declare const ContentCacheReceiptSchema: z.ZodObject<{
|
|
259
|
+
scope: z.ZodEnum<{
|
|
260
|
+
notes: "notes";
|
|
261
|
+
"try-out": "try-out";
|
|
262
|
+
all: "all";
|
|
263
|
+
material: "material";
|
|
264
|
+
}>;
|
|
265
|
+
releaseId: z.ZodString;
|
|
266
|
+
revalidated: z.ZodLiteral<true>;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
export type ContentCacheReceipt = z.infer<typeof ContentCacheReceiptSchema>;
|
|
269
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,KAAK,cAAc,EACnB,oBAAoB,GACrB,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,uBAAuB,EAAG,OAAgB,CAAC;AAExD,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,EAAG,OAAgB,CAAC;AAErD,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,SAAU,CAAC;AACzC,eAAO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AAiB;;;;;;;;iBAQ5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAED,eAAO,MAAM,uBAAuB;;;;;EAKlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,yBAAyB;;;;;;;;kBAK3B,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,yBAAyB;;;;;;;;;kBAM3B,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { RendererDomainSchema, } from "./renderer.js";
|
|
4
|
+
import { CONTENT_TREE_INTRINSIC_TAGS, ContentTreeChildZodSchema, ContentTreeElementNameZodSchema, ContentTreeElementSchema, ContentTreeElementZodSchema, ContentTreePropsZodSchema, ContentTreeSchema, ContentTreeValueZodSchema, ContentTreeZodSchema, canonicalizeContentTree, contentTreeComponentNames, ELEMENT_KEY, FRAGMENT_NAME, isComponentElementName, isContentTreeElement, isContentTreeIntrinsicTag, isValidContentTreeElementName, } from "./tree.js";
|
|
5
|
+
export { CONTENT_TREE_INTRINSIC_TAGS, ContentTreeChildZodSchema, ContentTreeElementNameZodSchema, ContentTreeElementSchema, ContentTreeElementZodSchema, ContentTreePropsZodSchema, ContentTreeSchema, ContentTreeValueZodSchema, ContentTreeZodSchema, canonicalizeContentTree, contentTreeComponentNames, ELEMENT_KEY, FRAGMENT_NAME, isComponentElementName, isContentTreeElement, isContentTreeIntrinsicTag, isValidContentTreeElementName, RendererDomainSchema, };
|
|
6
|
+
/** Compiler protocol version matching Aksara content-tree generation (ADR 0001 Decision 37). */
|
|
7
|
+
export const AKSARA_COMPILER_VERSION = "0.2.0";
|
|
8
|
+
/** Official MDX compiler version used to produce function-body artifacts before evaluation. */
|
|
9
|
+
export const MDX_COMPILER_VERSION = "3.1.1";
|
|
10
|
+
/** Evidence-led UTF-8 byte ceilings matching @nakafa/aksara-contracts/limits (ADR 0001). */
|
|
11
|
+
export const MAX_RAW_MDX_BYTES = 131_072; // 128 KiB
|
|
12
|
+
export const MAX_CONTENT_TREE_BYTES = 393_216; // 384 KiB
|
|
13
|
+
export const MAX_PLAIN_TEXT_BYTES = 131_072; // 128 KiB
|
|
14
|
+
export const MAX_CANONICAL_PAYLOAD_BYTES = 458_752; // 448 KiB
|
|
15
|
+
export const MAX_SIGNED_ARTIFACT_BYTES = 491_520; // 480 KiB
|
|
16
|
+
export const LocaleSchema = z.enum(["en"]);
|
|
17
|
+
export const ContentKeySchema = z.string().min(5).max(250);
|
|
18
|
+
export const ReleaseIdSchema = z.string().regex(/^rel_[a-zA-Z0-9_-]{16,32}$/);
|
|
19
|
+
export const Sha256HashSchema = z.string().regex(/^[a-f0-9]{64}$/);
|
|
20
|
+
export const GitCommitShaSchema = z
|
|
21
|
+
.string()
|
|
22
|
+
.regex(/^([a-f0-9]{40}|working-tree)$/);
|
|
23
|
+
export const ArtifactFormatSchema = z.literal("content-tree");
|
|
24
|
+
/**
|
|
25
|
+
* Signed artifact payload contract (Aksara content-tree standard, ADR 0001 Decision 37).
|
|
26
|
+
* Strictly zero-legacy: holds the publish-time evaluated `contentTree` data fragment,
|
|
27
|
+
* raw source provenance (`rawMdx`, `sourceHash`), `plainText`, and compiler provenance.
|
|
28
|
+
* Never ships runtime-executable `compiledCode` to the web application.
|
|
29
|
+
*/
|
|
30
|
+
export const ArtifactPayloadSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
contentKey: ContentKeySchema,
|
|
33
|
+
locale: LocaleSchema,
|
|
34
|
+
contentTree: ContentTreeZodSchema,
|
|
35
|
+
format: ArtifactFormatSchema,
|
|
36
|
+
plainText: z.string(),
|
|
37
|
+
rawMdx: z.string(),
|
|
38
|
+
sourceHash: Sha256HashSchema,
|
|
39
|
+
compilerVersion: z.literal(AKSARA_COMPILER_VERSION),
|
|
40
|
+
mdxCompilerVersion: z.literal(MDX_COMPILER_VERSION),
|
|
41
|
+
compilerConfigHash: Sha256HashSchema,
|
|
42
|
+
artifactHash: Sha256HashSchema,
|
|
43
|
+
rendererDomain: RendererDomainSchema,
|
|
44
|
+
requiredComponents: z.array(z.string()),
|
|
45
|
+
compiledAt: z.number().int().nonnegative(),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
48
|
+
/**
|
|
49
|
+
* Immutable signed artifact envelope authenticated with domain-separated Ed25519.
|
|
50
|
+
*/
|
|
51
|
+
export const SignedArtifactSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
artifactHash: Sha256HashSchema,
|
|
54
|
+
keyId: z.string().min(1).max(128),
|
|
55
|
+
payload: ArtifactPayloadSchema,
|
|
56
|
+
signature: z.string().min(1),
|
|
57
|
+
})
|
|
58
|
+
.strict();
|
|
59
|
+
export const ContentHeadingSchema = z.object({
|
|
60
|
+
depth: z.number().int().min(1).max(6),
|
|
61
|
+
text: z.string(),
|
|
62
|
+
slug: z.string(),
|
|
63
|
+
});
|
|
64
|
+
export const ExerciseChoiceSchema = z.object({
|
|
65
|
+
optionKey: z.string(), // "A", "B", "C", "D", "E"
|
|
66
|
+
label: z.string(),
|
|
67
|
+
isCorrect: z.boolean(),
|
|
68
|
+
order: z.number(),
|
|
69
|
+
});
|
|
70
|
+
export const CatalogItemKindSchema = z.enum([
|
|
71
|
+
"notes",
|
|
72
|
+
"notes-group",
|
|
73
|
+
"topic-group",
|
|
74
|
+
"exercise-group",
|
|
75
|
+
"single-exercise",
|
|
76
|
+
"exercise-list",
|
|
77
|
+
]);
|
|
78
|
+
export const CatalogItemModeSchema = z.enum(["notes", "try-out"]);
|
|
79
|
+
/** Denormalized catalog row for instant, zero-computation runtime reads. */
|
|
80
|
+
export const CatalogItemSchema = z.object({
|
|
81
|
+
contentKey: ContentKeySchema,
|
|
82
|
+
publicPath: z.string(),
|
|
83
|
+
locale: LocaleSchema,
|
|
84
|
+
kind: CatalogItemKindSchema,
|
|
85
|
+
curriculum: z.string(),
|
|
86
|
+
subject: z.string(),
|
|
87
|
+
examBoard: z.string(),
|
|
88
|
+
mode: CatalogItemModeSchema,
|
|
89
|
+
title: z.string(),
|
|
90
|
+
description: z.string().optional(),
|
|
91
|
+
chapterTitle: z.string().optional(),
|
|
92
|
+
headings: z.array(ContentHeadingSchema),
|
|
93
|
+
artifactHash: Sha256HashSchema,
|
|
94
|
+
choices: z.array(ExerciseChoiceSchema).optional(),
|
|
95
|
+
questionCount: z.number().int().nonnegative().optional(),
|
|
96
|
+
order: z.number(),
|
|
97
|
+
parentPath: z.string().optional(),
|
|
98
|
+
});
|
|
99
|
+
export const ReleaseStatusSchema = z.union([
|
|
100
|
+
z.literal("staged"),
|
|
101
|
+
z.literal("verifying"),
|
|
102
|
+
z.literal("verified"),
|
|
103
|
+
z.literal("active"),
|
|
104
|
+
z.literal("rolled_back"),
|
|
105
|
+
z.literal("archived"),
|
|
106
|
+
z.literal("aborting"),
|
|
107
|
+
z.literal("aborted"),
|
|
108
|
+
]);
|
|
109
|
+
export const ReleaseManifestSchema = z
|
|
110
|
+
.object({
|
|
111
|
+
releaseId: ReleaseIdSchema,
|
|
112
|
+
manifestHash: Sha256HashSchema,
|
|
113
|
+
baseReleaseId: ReleaseIdSchema.nullable(),
|
|
114
|
+
sourceRevision: GitCommitShaSchema,
|
|
115
|
+
status: ReleaseStatusSchema.default("staged"),
|
|
116
|
+
sequence: z.number().int().nonnegative(),
|
|
117
|
+
itemCount: z.number().int().nonnegative(),
|
|
118
|
+
locales: z.array(LocaleSchema).min(1),
|
|
119
|
+
rendererManifestHash: Sha256HashSchema,
|
|
120
|
+
createdAt: z.number().int().nonnegative(),
|
|
121
|
+
verifiedAt: z.number().int().nonnegative().optional(),
|
|
122
|
+
activatedAt: z.number().int().nonnegative().optional(),
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
export const SignedContentReleaseSchema = z
|
|
126
|
+
.object({
|
|
127
|
+
keyId: z.string().min(1).max(128),
|
|
128
|
+
manifest: ReleaseManifestSchema,
|
|
129
|
+
manifestHash: Sha256HashSchema,
|
|
130
|
+
signature: z.string().min(1),
|
|
131
|
+
})
|
|
132
|
+
.strict();
|
|
133
|
+
export const ContentHeadSlotSchema = z.literal("live");
|
|
134
|
+
export const ContentHeadSchema = z.object({
|
|
135
|
+
slot: ContentHeadSlotSchema,
|
|
136
|
+
activeReleaseId: ReleaseIdSchema,
|
|
137
|
+
previousReleaseId: ReleaseIdSchema.nullable(),
|
|
138
|
+
candidateReleaseId: ReleaseIdSchema.nullable().optional(),
|
|
139
|
+
recoveryReleaseId: ReleaseIdSchema.nullable().optional(),
|
|
140
|
+
sequence: z.number().int().nonnegative(),
|
|
141
|
+
updatedAt: z.number(),
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* Generates a valid Release ID adhering to ReleaseIdSchema (`rel_[a-zA-Z0-9_-]{16,32}`).
|
|
145
|
+
*/
|
|
146
|
+
export function generateReleaseId() {
|
|
147
|
+
const rand = randomBytes(18).toString("base64url");
|
|
148
|
+
return `rel_${rand}`;
|
|
149
|
+
}
|
|
150
|
+
export const ContentCacheScopeSchema = z.enum([
|
|
151
|
+
"all",
|
|
152
|
+
"material",
|
|
153
|
+
"notes",
|
|
154
|
+
"try-out",
|
|
155
|
+
]);
|
|
156
|
+
export const ContentCacheRequestSchema = z
|
|
157
|
+
.object({
|
|
158
|
+
scope: ContentCacheScopeSchema,
|
|
159
|
+
releaseId: ReleaseIdSchema,
|
|
160
|
+
})
|
|
161
|
+
.strict();
|
|
162
|
+
export const ContentCacheReceiptSchema = z
|
|
163
|
+
.object({
|
|
164
|
+
scope: ContentCacheScopeSchema,
|
|
165
|
+
releaseId: ReleaseIdSchema,
|
|
166
|
+
revalidated: z.literal(true),
|
|
167
|
+
})
|
|
168
|
+
.strict();
|
|
169
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAOL,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAOL,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAE7B,oBAAoB,GACrB,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAgB,CAAC;AAExD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAgB,CAAC;AAErD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,CAAC,UAAU;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,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,EAAE,uBAAuB;IAC9B,SAAS,EAAE,eAAe;IAC1B,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC7B,CAAC;KACD,MAAM,EAAE,CAAC"}
|
package/dist/corpus.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Choice entry authored in corpus `choices.ts` files. */
|
|
3
|
+
export declare const AuthoredChoiceSchema: z.ZodObject<{
|
|
4
|
+
label: z.ZodString;
|
|
5
|
+
value: z.ZodBoolean;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type AuthoredChoice = z.infer<typeof AuthoredChoiceSchema>;
|
|
8
|
+
/** Localized multiple-choice definitions authored in corpus `choices.ts` files. */
|
|
9
|
+
export declare const ExercisesChoicesSchema: z.ZodObject<{
|
|
10
|
+
en: z.ZodArray<z.ZodObject<{
|
|
11
|
+
label: z.ZodString;
|
|
12
|
+
value: z.ZodBoolean;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
id: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
label: z.ZodString;
|
|
16
|
+
value: z.ZodBoolean;
|
|
17
|
+
}, z.core.$strip>>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ExercisesChoices = z.infer<typeof ExercisesChoicesSchema>;
|
|
20
|
+
/** Individual topic/set item inside a chapter's `_data/en-material.ts`. */
|
|
21
|
+
export declare const MaterialItemSchema: z.ZodObject<{
|
|
22
|
+
title: z.ZodString;
|
|
23
|
+
href: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type MaterialItem = z.infer<typeof MaterialItemSchema>;
|
|
26
|
+
/** Chapter/group entry inside `_data/en-material.ts`. */
|
|
27
|
+
export declare const MaterialGroupSchema: z.ZodObject<{
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
description: z.ZodOptional<z.ZodString>;
|
|
30
|
+
href: z.ZodString;
|
|
31
|
+
items: z.ZodArray<z.ZodObject<{
|
|
32
|
+
title: z.ZodString;
|
|
33
|
+
href: z.ZodString;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type MaterialGroup = z.infer<typeof MaterialGroupSchema>;
|
|
37
|
+
/** Ordered material list authored in `_data/en-material.ts`. */
|
|
38
|
+
export declare const MaterialListSchema: z.ZodArray<z.ZodObject<{
|
|
39
|
+
title: z.ZodString;
|
|
40
|
+
description: z.ZodOptional<z.ZodString>;
|
|
41
|
+
href: z.ZodString;
|
|
42
|
+
items: z.ZodArray<z.ZodObject<{
|
|
43
|
+
title: z.ZodString;
|
|
44
|
+
href: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
export type MaterialList = z.infer<typeof MaterialListSchema>;
|
|
48
|
+
//# sourceMappingURL=corpus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus.d.ts","sourceRoot":"","sources":["../src/corpus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0DAA0D;AAC1D,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,mFAAmF;AACnF,eAAO,MAAM,sBAAsB;;;;;;;;;iBAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,yDAAyD;AACzD,eAAO,MAAM,mBAAmB;;;;;;;;iBAK9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,gEAAgE;AAChE,eAAO,MAAM,kBAAkB;;;;;;;;kBAA+B,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/dist/corpus.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Choice entry authored in corpus `choices.ts` files. */
|
|
3
|
+
export const AuthoredChoiceSchema = z.object({
|
|
4
|
+
label: z.string().min(1),
|
|
5
|
+
value: z.boolean(),
|
|
6
|
+
});
|
|
7
|
+
/** Localized multiple-choice definitions authored in corpus `choices.ts` files. */
|
|
8
|
+
export const ExercisesChoicesSchema = z.object({
|
|
9
|
+
en: z.array(AuthoredChoiceSchema).min(1),
|
|
10
|
+
id: z.array(AuthoredChoiceSchema).optional(),
|
|
11
|
+
});
|
|
12
|
+
/** Individual topic/set item inside a chapter's `_data/en-material.ts`. */
|
|
13
|
+
export const MaterialItemSchema = z.object({
|
|
14
|
+
title: z.string().min(1),
|
|
15
|
+
href: z.string().min(1),
|
|
16
|
+
});
|
|
17
|
+
/** Chapter/group entry inside `_data/en-material.ts`. */
|
|
18
|
+
export const MaterialGroupSchema = z.object({
|
|
19
|
+
title: z.string().min(1),
|
|
20
|
+
description: z.string().optional(),
|
|
21
|
+
href: z.string().min(1),
|
|
22
|
+
items: z.array(MaterialItemSchema),
|
|
23
|
+
});
|
|
24
|
+
/** Ordered material list authored in `_data/en-material.ts`. */
|
|
25
|
+
export const MaterialListSchema = z.array(MaterialGroupSchema);
|
|
26
|
+
//# sourceMappingURL=corpus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus.js","sourceRoot":"","sources":["../src/corpus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0DAA0D;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