@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
@@ -1,52 +1,20 @@
1
1
  import { Schema } from "effect";
2
- /** One semantic text or mathematics fragment in a response label. */
3
- export declare const QuestionResponseContentPartSchema: Schema.Union<readonly [Schema.Struct<{
4
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
5
- readonly kind: Schema.Literal<"math">;
6
- readonly math: Schema.String;
7
- }>, Schema.Struct<{
8
- readonly kind: Schema.Literal<"text">;
9
- readonly text: Schema.String;
10
- }>]>;
11
- export type QuestionResponseContentPart = typeof QuestionResponseContentPartSchema.Type;
12
- /** Ordered semantic content rendered without reparsing delimiter strings. */
13
- export declare const QuestionResponseContentSchema: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
14
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
15
- readonly kind: Schema.Literal<"math">;
16
- readonly math: Schema.String;
17
- }>, Schema.Struct<{
18
- readonly kind: Schema.Literal<"text">;
19
- readonly text: Schema.String;
20
- }>]>>;
21
- export type QuestionResponseContent = typeof QuestionResponseContentSchema.Type;
22
2
  /** Response formats supported by one assessment item. */
23
3
  export declare const QuestionResponseKindSchema: Schema.Literals<readonly ["category", "multiple-choice", "single-choice"]>;
24
4
  export type QuestionResponseKind = typeof QuestionResponseKindSchema.Type;
5
+ /** One non-empty Markdown label rendered by the product-owned content surface. */
6
+ export declare const QuestionResponseLabelSchema: Schema.String;
25
7
  /** Frozen locale-specific response used from publication through review. */
26
8
  export declare const QuestionResponseSchema: Schema.Union<readonly [Schema.Struct<{
27
9
  readonly categories: Schema.$Array<Schema.Struct<{
28
10
  readonly categoryKey: Schema.String;
29
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
30
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
31
- readonly kind: Schema.Literal<"math">;
32
- readonly math: Schema.String;
33
- }>, Schema.Struct<{
34
- readonly kind: Schema.Literal<"text">;
35
- readonly text: Schema.String;
36
- }>]>>;
11
+ readonly label: Schema.String;
37
12
  readonly order: Schema.Int;
38
13
  }>>;
39
14
  readonly kind: Schema.Literal<"category">;
40
15
  readonly statements: Schema.$Array<Schema.Struct<{
41
16
  readonly correctCategoryKey: Schema.String;
42
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
43
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
44
- readonly kind: Schema.Literal<"math">;
45
- readonly math: Schema.String;
46
- }>, Schema.Struct<{
47
- readonly kind: Schema.Literal<"text">;
48
- readonly text: Schema.String;
49
- }>]>>;
17
+ readonly label: Schema.String;
50
18
  readonly order: Schema.Int;
51
19
  readonly statementKey: Schema.String;
52
20
  }>>;
@@ -54,14 +22,7 @@ export declare const QuestionResponseSchema: Schema.Union<readonly [Schema.Struc
54
22
  readonly kind: Schema.Literal<"multiple-choice">;
55
23
  readonly options: Schema.$Array<Schema.Struct<{
56
24
  readonly isCorrect: Schema.Boolean;
57
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
58
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
59
- readonly kind: Schema.Literal<"math">;
60
- readonly math: Schema.String;
61
- }>, Schema.Struct<{
62
- readonly kind: Schema.Literal<"text">;
63
- readonly text: Schema.String;
64
- }>]>>;
25
+ readonly label: Schema.String;
65
26
  readonly optionKey: Schema.String;
66
27
  readonly order: Schema.Int;
67
28
  }>>;
@@ -69,31 +30,12 @@ export declare const QuestionResponseSchema: Schema.Union<readonly [Schema.Struc
69
30
  readonly kind: Schema.Literal<"single-choice">;
70
31
  readonly options: Schema.$Array<Schema.Struct<{
71
32
  readonly isCorrect: Schema.Boolean;
72
- readonly label: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
73
- readonly display: Schema.Literals<readonly ["block", "inline"]>;
74
- readonly kind: Schema.Literal<"math">;
75
- readonly math: Schema.String;
76
- }>, Schema.Struct<{
77
- readonly kind: Schema.Literal<"text">;
78
- readonly text: Schema.String;
79
- }>]>>;
33
+ readonly label: Schema.String;
80
34
  readonly optionKey: Schema.String;
81
35
  readonly order: Schema.Int;
82
36
  }>>;
83
37
  }>]>;
84
38
  export type QuestionResponse = typeof QuestionResponseSchema.Type;
85
- /** Returns response content in stable field order for signed canonicalizers. */
86
- export declare function canonicalQuestionResponseContent(content: QuestionResponseContent): ({
87
- kind: "text";
88
- text: string;
89
- display?: never;
90
- math?: never;
91
- } | {
92
- text?: never;
93
- display: "block" | "inline";
94
- kind: "math";
95
- math: string;
96
- })[];
97
39
  /** Returns locale-neutral response identity without localized label content. */
98
40
  export declare function canonicalQuestionResponseStructure(response: QuestionResponse): {
99
41
  categories: {
@@ -122,33 +64,13 @@ export declare function canonicalQuestionResponse(response: QuestionResponse): {
122
64
  options?: never;
123
65
  categories: {
124
66
  categoryKey: string;
125
- label: ({
126
- kind: "text";
127
- text: string;
128
- display?: never;
129
- math?: never;
130
- } | {
131
- text?: never;
132
- display: "block" | "inline";
133
- kind: "math";
134
- math: string;
135
- })[];
67
+ label: string;
136
68
  order: number;
137
69
  }[];
138
70
  kind: "category";
139
71
  statements: {
140
72
  correctCategoryKey: string;
141
- label: ({
142
- kind: "text";
143
- text: string;
144
- display?: never;
145
- math?: never;
146
- } | {
147
- text?: never;
148
- display: "block" | "inline";
149
- kind: "math";
150
- math: string;
151
- })[];
73
+ label: string;
152
74
  order: number;
153
75
  statementKey: string;
154
76
  }[];
@@ -158,17 +80,7 @@ export declare function canonicalQuestionResponse(response: QuestionResponse): {
158
80
  kind: "multiple-choice" | "single-choice";
159
81
  options: {
160
82
  isCorrect: boolean;
161
- label: ({
162
- kind: "text";
163
- text: string;
164
- display?: never;
165
- math?: never;
166
- } | {
167
- text?: never;
168
- display: "block" | "inline";
169
- kind: "math";
170
- math: string;
171
- })[];
83
+ label: string;
172
84
  optionKey: string;
173
85
  order: number;
174
86
  }[];
@@ -3,34 +3,17 @@ const OPTION_KEY_PATTERN = /^option-[1-9]\d*$/u;
3
3
  const CATEGORY_KEY_PATTERN = /^category-[1-9]\d*$/u;
4
4
  const STATEMENT_KEY_PATTERN = /^statement-[1-9]\d*$/u;
5
5
  const PositiveOrderSchema = Schema.Int.pipe(Schema.check(Schema.isGreaterThan(0)));
6
- const NonEmptyContentSchema = Schema.String.pipe(Schema.check(Schema.makeFilter((value) => value.length > 0, {
7
- message: "Response content parts must not be empty.",
8
- })));
9
- const QuestionResponseTextPartSchema = Schema.Struct({
10
- kind: Schema.Literal("text"),
11
- text: NonEmptyContentSchema,
12
- });
13
- const QuestionResponseMathPartSchema = Schema.Struct({
14
- display: Schema.Literals(["block", "inline"]),
15
- kind: Schema.Literal("math"),
16
- math: NonEmptyContentSchema,
17
- });
18
- /** One semantic text or mathematics fragment in a response label. */
19
- export const QuestionResponseContentPartSchema = Schema.Union([
20
- QuestionResponseMathPartSchema,
21
- QuestionResponseTextPartSchema,
22
- ]);
23
- /** Ordered semantic content rendered without reparsing delimiter strings. */
24
- export const QuestionResponseContentSchema = Schema.NonEmptyArray(QuestionResponseContentPartSchema);
25
6
  /** Response formats supported by one assessment item. */
26
7
  export const QuestionResponseKindSchema = Schema.Literals([
27
8
  "category",
28
9
  "multiple-choice",
29
10
  "single-choice",
30
11
  ]);
12
+ /** One non-empty Markdown label rendered by the product-owned content surface. */
13
+ export const QuestionResponseLabelSchema = Schema.String.check(Schema.isNonEmpty());
31
14
  const QuestionOptionSchema = Schema.Struct({
32
15
  isCorrect: Schema.Boolean,
33
- label: QuestionResponseContentSchema,
16
+ label: QuestionResponseLabelSchema,
34
17
  optionKey: Schema.String.pipe(Schema.check(Schema.isPattern(OPTION_KEY_PATTERN))),
35
18
  order: PositiveOrderSchema,
36
19
  });
@@ -57,12 +40,12 @@ const MultipleChoiceResponseSchema = Schema.Struct({
57
40
  })));
58
41
  const QuestionCategorySchema = Schema.Struct({
59
42
  categoryKey: Schema.String.pipe(Schema.check(Schema.isPattern(CATEGORY_KEY_PATTERN))),
60
- label: QuestionResponseContentSchema,
43
+ label: QuestionResponseLabelSchema,
61
44
  order: PositiveOrderSchema,
62
45
  });
63
46
  const QuestionCategoryStatementSchema = Schema.Struct({
64
47
  correctCategoryKey: Schema.String.pipe(Schema.check(Schema.isPattern(CATEGORY_KEY_PATTERN))),
65
- label: QuestionResponseContentSchema,
48
+ label: QuestionResponseLabelSchema,
66
49
  order: PositiveOrderSchema,
67
50
  statementKey: Schema.String.pipe(Schema.check(Schema.isPattern(STATEMENT_KEY_PATTERN))),
68
51
  });
@@ -89,12 +72,6 @@ export const QuestionResponseSchema = Schema.Union([
89
72
  MultipleChoiceResponseSchema,
90
73
  SingleChoiceResponseSchema,
91
74
  ]);
92
- /** Returns response content in stable field order for signed canonicalizers. */
93
- export function canonicalQuestionResponseContent(content) {
94
- return content.map((part) => part.kind === "text"
95
- ? { kind: part.kind, text: part.text }
96
- : { display: part.display, kind: part.kind, math: part.math });
97
- }
98
75
  /** Returns locale-neutral response identity without localized label content. */
99
76
  export function canonicalQuestionResponseStructure(response) {
100
77
  if (response.kind === "category") {
@@ -126,13 +103,13 @@ export function canonicalQuestionResponse(response) {
126
103
  return {
127
104
  categories: response.categories.map(({ categoryKey, label, order }) => ({
128
105
  categoryKey,
129
- label: canonicalQuestionResponseContent(label),
106
+ label,
130
107
  order,
131
108
  })),
132
109
  kind: response.kind,
133
110
  statements: response.statements.map(({ correctCategoryKey, label, order, statementKey }) => ({
134
111
  correctCategoryKey,
135
- label: canonicalQuestionResponseContent(label),
112
+ label,
136
113
  order,
137
114
  statementKey,
138
115
  })),
@@ -142,7 +119,7 @@ export function canonicalQuestionResponse(response) {
142
119
  kind: response.kind,
143
120
  options: response.options.map(({ isCorrect, label, optionKey, order }) => ({
144
121
  isCorrect,
145
- label: canonicalQuestionResponseContent(label),
122
+ label,
146
123
  optionKey,
147
124
  order,
148
125
  })),
@@ -2,6 +2,9 @@ import { Effect, Schema } from "effect";
2
2
  import type { Sha256Hash } from "#contracts/ids";
3
3
  import type { ContentSnapshotManifest } from "#contracts/release/snapshot/data";
4
4
  import { type PublicationScope } from "#contracts/release/snapshot/scope";
5
+ /** Renderer proof required immediately before one candidate activation. */
6
+ export declare const RendererPreflightSchema: Schema.Literals<readonly ["compatible", "exact"]>;
7
+ export type RendererPreflight = typeof RendererPreflightSchema.Type;
5
8
  /** Locale policy shared by one release and its structured snapshots. */
6
9
  export declare const ReleasePolicySchema: Schema.Struct<{
7
10
  readonly activeAppLocales: Schema.NonEmptyArray<Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraAppLocale">>;
@@ -7,6 +7,8 @@ const ClosureFieldSchema = Schema.Literals([
7
7
  "manifest",
8
8
  "scope",
9
9
  ]);
10
+ /** Renderer proof required immediately before one candidate activation. */
11
+ export const RendererPreflightSchema = Schema.Literals(["compatible", "exact"]);
10
12
  /** Locale policy shared by one release and its structured snapshots. */
11
13
  export const ReleasePolicySchema = Schema.Struct({
12
14
  activeAppLocales: ActiveAppLocaleListSchema,