@nakafa/aksara-contracts 0.48.9 → 0.49.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 (49) hide show
  1. package/README.md +9 -0
  2. package/dist/assessment/choice.d.ts +154 -0
  3. package/dist/assessment/choice.js +87 -0
  4. package/dist/assessment/document.d.ts +219 -0
  5. package/dist/assessment/document.js +162 -0
  6. package/dist/assessment/entry.d.ts +50 -0
  7. package/dist/assessment/entry.js +48 -0
  8. package/dist/assessment/explanation.d.ts +19 -0
  9. package/dist/assessment/explanation.js +18 -0
  10. package/dist/assessment/figure.d.ts +1938 -0
  11. package/dist/assessment/figure.js +236 -0
  12. package/dist/assessment/fit.d.ts +21 -0
  13. package/dist/assessment/fit.js +42 -0
  14. package/dist/assessment/graphic.d.ts +95 -0
  15. package/dist/assessment/graphic.js +106 -0
  16. package/dist/assessment/hash.d.ts +1444 -0
  17. package/dist/assessment/hash.js +66 -0
  18. package/dist/assessment/identity.d.ts +37 -0
  19. package/dist/assessment/identity.js +50 -0
  20. package/dist/assessment/inline.d.ts +124 -0
  21. package/dist/assessment/inline.js +92 -0
  22. package/dist/assessment/interaction.d.ts +219 -0
  23. package/dist/assessment/interaction.js +38 -0
  24. package/dist/assessment/item.d.ts +759 -0
  25. package/dist/assessment/item.js +98 -0
  26. package/dist/assessment/key.d.ts +195 -0
  27. package/dist/assessment/key.js +136 -0
  28. package/dist/assessment/paper.d.ts +799 -0
  29. package/dist/assessment/paper.js +69 -0
  30. package/dist/assessment/part.d.ts +47 -0
  31. package/dist/assessment/part.js +32 -0
  32. package/dist/assessment/profile.d.ts +153 -0
  33. package/dist/assessment/profile.js +160 -0
  34. package/dist/assessment/record.d.ts +18 -0
  35. package/dist/assessment/record.js +27 -0
  36. package/dist/assessment/scalar.d.ts +18 -0
  37. package/dist/assessment/scalar.js +18 -0
  38. package/dist/assessment/scoring.d.ts +157 -0
  39. package/dist/assessment/scoring.js +150 -0
  40. package/dist/assessment/stimulus.d.ts +48 -0
  41. package/dist/assessment/stimulus.js +42 -0
  42. package/dist/assessment/structure.d.ts +13 -0
  43. package/dist/assessment/structure.js +29 -0
  44. package/dist/assessment/tools.d.ts +17 -0
  45. package/dist/assessment/tools.js +39 -0
  46. package/dist/projection/verify.d.ts +23 -23
  47. package/dist/runtime/verify.d.ts +46 -46
  48. package/dist/transport/request.d.ts +138 -138
  49. package/package.json +69 -1
@@ -0,0 +1,50 @@
1
+ import { Schema } from "effect";
2
+ /**
3
+ * A short typed answer. `expectedLength` is a hint for the width of the field.
4
+ * Maps to `qti-text-entry-interaction` (`expected-length`).
5
+ */
6
+ export declare const TextEntryInteractionSchema: Schema.Struct<{
7
+ readonly id: Schema.String;
8
+ readonly label: Schema.Trimmed;
9
+ readonly expectedLength: Schema.optionalKey<Schema.Int>;
10
+ readonly kind: Schema.Literal<"textEntry">;
11
+ }>;
12
+ /**
13
+ * A typed number. `acceptsFractions` says whether `3/4` may be typed beside
14
+ * `0.75`, and `unit` is the text shown beside the field, so the learner types
15
+ * the number only. The value and its tolerance are in the key. Maps to
16
+ * `qti-text-entry-interaction` with a float response.
17
+ */
18
+ export declare const NumericEntryInteractionSchema: Schema.Struct<{
19
+ readonly id: Schema.String;
20
+ readonly label: Schema.Trimmed;
21
+ readonly acceptsFractions: Schema.Boolean;
22
+ readonly kind: Schema.Literal<"numericEntry">;
23
+ readonly unit: Schema.optionalKey<Schema.Trimmed>;
24
+ }>;
25
+ /**
26
+ * An expression typed as LaTeX. The expression to match is in the key, and the
27
+ * interaction holds no policy. A proof is the same canonical form under
28
+ * `isSame`, or `isEqual` returning true for expressions without free
29
+ * variables. Any other true about expressions with free variables is a sample,
30
+ * not a proof. What a sample does is a rule of the exam, not of the item: the
31
+ * exam profile says it in `sampledMath`. QTI has no interaction for a typed
32
+ * expression, so it maps to `qti-portable-custom-interaction`, the way QTI adds
33
+ * a kind of its own.
34
+ */
35
+ export declare const MathEntryInteractionSchema: Schema.Struct<{
36
+ readonly id: Schema.String;
37
+ readonly label: Schema.Trimmed;
38
+ readonly kind: Schema.Literal<"mathEntry">;
39
+ }>;
40
+ /**
41
+ * A long answer that a rubric scores. `expectedLines` is a hint for the height
42
+ * of the field. Maps to `qti-extended-text-interaction` (`expected-lines`);
43
+ * QTI leaves the scoring of this interaction outside its scope.
44
+ */
45
+ export declare const ExtendedTextInteractionSchema: Schema.Struct<{
46
+ readonly id: Schema.String;
47
+ readonly label: Schema.Trimmed;
48
+ readonly expectedLines: Schema.optionalKey<Schema.Int>;
49
+ readonly kind: Schema.Literal<"extendedText">;
50
+ }>;
@@ -0,0 +1,48 @@
1
+ import { Schema } from "effect";
2
+ import { InteractionFields } from "#contracts/assessment/part";
3
+ import { PlainTextSchema, PositiveIntSchema, } from "#contracts/assessment/scalar";
4
+ /**
5
+ * A short typed answer. `expectedLength` is a hint for the width of the field.
6
+ * Maps to `qti-text-entry-interaction` (`expected-length`).
7
+ */
8
+ export const TextEntryInteractionSchema = Schema.Struct({
9
+ ...InteractionFields,
10
+ expectedLength: Schema.optionalKey(PositiveIntSchema),
11
+ kind: Schema.Literal("textEntry"),
12
+ });
13
+ /**
14
+ * A typed number. `acceptsFractions` says whether `3/4` may be typed beside
15
+ * `0.75`, and `unit` is the text shown beside the field, so the learner types
16
+ * the number only. The value and its tolerance are in the key. Maps to
17
+ * `qti-text-entry-interaction` with a float response.
18
+ */
19
+ export const NumericEntryInteractionSchema = Schema.Struct({
20
+ ...InteractionFields,
21
+ acceptsFractions: Schema.Boolean,
22
+ kind: Schema.Literal("numericEntry"),
23
+ unit: Schema.optionalKey(PlainTextSchema),
24
+ });
25
+ /**
26
+ * An expression typed as LaTeX. The expression to match is in the key, and the
27
+ * interaction holds no policy. A proof is the same canonical form under
28
+ * `isSame`, or `isEqual` returning true for expressions without free
29
+ * variables. Any other true about expressions with free variables is a sample,
30
+ * not a proof. What a sample does is a rule of the exam, not of the item: the
31
+ * exam profile says it in `sampledMath`. QTI has no interaction for a typed
32
+ * expression, so it maps to `qti-portable-custom-interaction`, the way QTI adds
33
+ * a kind of its own.
34
+ */
35
+ export const MathEntryInteractionSchema = Schema.Struct({
36
+ ...InteractionFields,
37
+ kind: Schema.Literal("mathEntry"),
38
+ });
39
+ /**
40
+ * A long answer that a rubric scores. `expectedLines` is a hint for the height
41
+ * of the field. Maps to `qti-extended-text-interaction` (`expected-lines`);
42
+ * QTI leaves the scoring of this interaction outside its scope.
43
+ */
44
+ export const ExtendedTextInteractionSchema = Schema.Struct({
45
+ ...InteractionFields,
46
+ expectedLines: Schema.optionalKey(PositiveIntSchema),
47
+ kind: Schema.Literal("extendedText"),
48
+ });
@@ -0,0 +1,19 @@
1
+ import { Schema } from "effect";
2
+ /**
3
+ * The explanation of one item version: its own schema and its own artifact, as
4
+ * the answer key is. A paper bundle carries prompts and stimuli only, never a
5
+ * key and never an explanation, so an explanation reaches a learner after
6
+ * release, under the release policy that Nakafa applies, from this record. The
7
+ * document places no interaction. `version` is the hash of the item version it
8
+ * explains, which also fixes the delivery language it is written in. An item
9
+ * version holds no explanation, and a version without one has no record. Its
10
+ * size is limited by `assessment/record`.
11
+ */
12
+ export declare const ItemExplanationSchema: Schema.Struct<{
13
+ readonly document: Schema.decodeTo<Schema.Struct<{
14
+ readonly content: Schema.NonEmptyArray<Schema.Codec<import("#contracts/assessment/document").BlockNode, import("#contracts/assessment/document").BlockNode, never, never>>;
15
+ readonly type: Schema.Literal<"doc">;
16
+ }>, Schema.Unknown, never, never>;
17
+ readonly version: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
18
+ }>;
19
+ export type ItemExplanation = typeof ItemExplanationSchema.Type;
@@ -0,0 +1,18 @@
1
+ import { Schema } from "effect";
2
+ import { ContentDocumentSchema } from "#contracts/assessment/document";
3
+ import { isWithinRecordLimit } from "#contracts/assessment/record";
4
+ import { Sha256HashSchema } from "#contracts/ids";
5
+ /**
6
+ * The explanation of one item version: its own schema and its own artifact, as
7
+ * the answer key is. A paper bundle carries prompts and stimuli only, never a
8
+ * key and never an explanation, so an explanation reaches a learner after
9
+ * release, under the release policy that Nakafa applies, from this record. The
10
+ * document places no interaction. `version` is the hash of the item version it
11
+ * explains, which also fixes the delivery language it is written in. An item
12
+ * version holds no explanation, and a version without one has no record. Its
13
+ * size is limited by `assessment/record`.
14
+ */
15
+ export const ItemExplanationSchema = Schema.Struct({
16
+ document: ContentDocumentSchema,
17
+ version: Sha256HashSchema,
18
+ }).check(isWithinRecordLimit);