@examplary/schemas 1.7.0 → 1.10.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/dist/common/scalar.d.ts +3 -0
- package/dist/common/scalar.js +10 -0
- package/dist/index.d.ts +6 -8
- package/dist/index.js +5 -5
- package/dist/question/index.d.ts +4 -0
- package/dist/question/index.js +18 -0
- package/dist/question/legacy-question-scoring-criteria.d.ts +9 -0
- package/dist/question/legacy-question-scoring-criteria.js +10 -0
- package/dist/question/question-scoring.d.ts +55 -0
- package/dist/question/question-scoring.js +29 -0
- package/dist/question/question.d.ts +42 -0
- package/dist/question/question.js +26 -0
- package/{src/index.ts → dist/question-type/index.d.ts} +6 -5
- package/dist/question-type/index.js +23 -0
- package/dist/{question-type-generation-options.d.ts → question-type/question-type-generation-options.d.ts} +1 -1
- package/dist/{question-type-generation-options.js → question-type/question-type-generation-options.js} +1 -0
- package/dist/{question-type-grading-options.d.ts → question-type/question-type-grading-options.d.ts} +1 -1
- package/dist/{question-type-grading-options.js → question-type/question-type-grading-options.js} +1 -0
- package/dist/{question-type-qti3.d.ts → question-type/question-type-qti3.d.ts} +2 -0
- package/dist/{question-type-qti3.js → question-type/question-type-qti3.js} +1 -0
- package/dist/question-type/question-type-scanning-options.d.ts +5 -0
- package/dist/question-type/question-type-scanning-options.js +13 -0
- package/dist/{question-type-setting.js → question-type/question-type-setting.js} +1 -1
- package/dist/{question-type.d.ts → question-type/question-type.d.ts} +7 -3
- package/dist/{question-type.js → question-type/question-type.js} +5 -2
- package/dist/schemas/question-scoring.json +197 -0
- package/dist/schemas/question-type.json +138 -81
- package/dist/schemas/question.json +364 -0
- package/package.json +11 -5
- package/.env +0 -1
- package/.serverless/cloudformation-template-update-stack.json +0 -175
- package/.serverless/meta.json +0 -274
- package/.serverless/serverless-state.json +0 -402
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-deploy.log +0 -43
- package/scripts/build.ts +0 -16
- package/serverless.yml +0 -25
- package/src/question-type-components.ts +0 -36
- package/src/question-type-generation-options.ts +0 -21
- package/src/question-type-grading-options.ts +0 -21
- package/src/question-type-qti3.ts +0 -53
- package/src/question-type-setting.ts +0 -70
- package/src/question-type.ts +0 -119
- package/src/translatable.ts +0 -17
- /package/dist/{translatable.d.ts → common/translatable.d.ts} +0 -0
- /package/dist/{translatable.js → common/translatable.js} +0 -0
- /package/dist/{question-type-components.d.ts → question-type/question-type-components.d.ts} +0 -0
- /package/dist/{question-type-components.js → question-type/question-type-components.js} +0 -0
- /package/dist/{question-type-setting.d.ts → question-type/question-type-setting.d.ts} +0 -0
package/.turbo/turbo-deploy.log
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Initializing
|
|
3
|
-
Initializing
|
|
4
|
-
Resolving variables
|
|
5
|
-
Authenticating
|
|
6
|
-
Resolving variables
|
|
7
|
-
Checking AWS credentials
|
|
8
|
-
Resolving variables
|
|
9
|
-
Loading service details
|
|
10
|
-
Deploying "schemas" to stage "production" (eu-central-1)
|
|
11
|
-
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
|
|
12
|
-
Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
|
|
13
|
-
This API will be removed in the next major release.
|
|
14
|
-
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
|
|
15
|
-
Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
|
|
16
|
-
This API will be removed in the next major release.
|
|
17
|
-
Packaging
|
|
18
|
-
Packaging
|
|
19
|
-
Retrieving AWS CloudFormation stack
|
|
20
|
-
Uploading
|
|
21
|
-
Uploading (0/0)
|
|
22
|
-
Uploading CloudFormation file to S3
|
|
23
|
-
Uploading State file to S3
|
|
24
|
-
Updating AWS CloudFormation stack
|
|
25
|
-
Fetching service information
|
|
26
|
-
Updating
|
|
27
|
-
Uploading directory 'dist/schemas' to bucket 'schemas-production-schemasbucketbe9e7d9f-q1aisqmk2pik'
|
|
28
|
-
Uploading directory 'dist/schemas' to bucket 'schemas-production-schemasbucketbe9e7d9f-q1aisqmk2pik'
|
|
29
|
-
Skipped uploading 1 unchanged files
|
|
30
|
-
Removing old service artifacts from S3
|
|
31
|
-
✔ Service deployed to stack schemas-production (12s)
|
|
32
|
-
Stack Outputs:
|
|
33
|
-
schemasBucketName814EA6EC: schemas-production-schemasbucketbe9e7d9f-q1aisqmk2pik
|
|
34
|
-
schemasCloudFrontCName05CBFC31: djykovp21c0ec.cloudfront.net
|
|
35
|
-
schemasDistributionIdF843C7D9: E1Z7GHEM2TF0UN
|
|
36
|
-
schemasDomainC1437202: schemas.examplary.ai
|
|
37
|
-
ServerlessDeploymentBucketName: serverless-framework-deployments-eu-central-1-fe769196-9095
|
|
38
|
-
|
|
39
|
-
schemas:
|
|
40
|
-
url: https://schemas.examplary.ai
|
|
41
|
-
cname: djykovp21c0ec.cloudfront.net
|
|
42
|
-
|
|
43
|
-
Finalizing
|
package/scripts/build.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
-
|
|
3
|
-
import * as z from "zod";
|
|
4
|
-
|
|
5
|
-
import { QuestionTypeSchema } from "../src";
|
|
6
|
-
|
|
7
|
-
(async () => {
|
|
8
|
-
await mkdir("./dist/schemas", { recursive: true });
|
|
9
|
-
await writeFile(
|
|
10
|
-
"./dist/schemas/question-type.json",
|
|
11
|
-
JSON.stringify(z.toJSONSchema(QuestionTypeSchema), null, 2),
|
|
12
|
-
"utf-8",
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
console.log("Schema built successfully!");
|
|
16
|
-
})();
|
package/serverless.yml
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
service: schemas
|
|
2
|
-
|
|
3
|
-
params:
|
|
4
|
-
default:
|
|
5
|
-
domain: schemas-${sls:stage}.examplary.ai
|
|
6
|
-
certificateArn: arn:aws:acm:us-east-1:864899853846:certificate/98929ce6-38a5-41ec-ac3c-6abd2f46087f
|
|
7
|
-
production:
|
|
8
|
-
domain: schemas.examplary.ai
|
|
9
|
-
certificateArn: arn:aws:acm:us-east-1:864899853846:certificate/98929ce6-38a5-41ec-ac3c-6abd2f46087f
|
|
10
|
-
|
|
11
|
-
provider:
|
|
12
|
-
name: aws
|
|
13
|
-
region: eu-central-1
|
|
14
|
-
stage: ${opt:stage, 'dev'}
|
|
15
|
-
deploymentMethod: direct
|
|
16
|
-
|
|
17
|
-
plugins:
|
|
18
|
-
- serverless-lift
|
|
19
|
-
|
|
20
|
-
constructs:
|
|
21
|
-
schemas:
|
|
22
|
-
type: static-website
|
|
23
|
-
path: dist/schemas
|
|
24
|
-
domain: ${param:domain}
|
|
25
|
-
certificate: ${param:certificateArn}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
// Path or URL reference type
|
|
4
|
-
export const PathOrUrlReference = z
|
|
5
|
-
.string()
|
|
6
|
-
.regex(
|
|
7
|
-
/^(https?:\/\/|\.)([a-zA-Z0-9._~:/?#@!$&'()*+,;=%-]+)$/,
|
|
8
|
-
"Valid path or URL format",
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
// Component reference type
|
|
12
|
-
export const ComponentReference = PathOrUrlReference.describe(
|
|
13
|
-
"Reference to a component, typically a file path or URL",
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
// Components configuration
|
|
17
|
-
export const QuestionTypeComponents = z
|
|
18
|
-
.object({
|
|
19
|
-
assessment: ComponentReference.optional().describe(
|
|
20
|
-
"Path to the assessment component (question content)",
|
|
21
|
-
),
|
|
22
|
-
print: ComponentReference.optional().describe(
|
|
23
|
-
"Path to the print component (for printing the question)",
|
|
24
|
-
),
|
|
25
|
-
"settings-area": ComponentReference.optional().describe(
|
|
26
|
-
"Path to the settings area component (for configuring question settings)",
|
|
27
|
-
),
|
|
28
|
-
results: ComponentReference.optional().describe(
|
|
29
|
-
"Path to the results component (for displaying answers)",
|
|
30
|
-
),
|
|
31
|
-
})
|
|
32
|
-
.strict()
|
|
33
|
-
.describe("Paths to the components used by this question type");
|
|
34
|
-
|
|
35
|
-
export type ComponentReferenceType = z.infer<typeof ComponentReference>;
|
|
36
|
-
export type ComponentsType = z.infer<typeof QuestionTypeComponents>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const QuestionTypeGenerationOptions = z
|
|
4
|
-
.object({
|
|
5
|
-
enabled: z
|
|
6
|
-
.boolean()
|
|
7
|
-
.describe(
|
|
8
|
-
"Whether this question type can be automatically generated using AI (default to false)",
|
|
9
|
-
),
|
|
10
|
-
instructions: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(
|
|
14
|
-
"Optional instructions to guide AI in generating this question type",
|
|
15
|
-
),
|
|
16
|
-
})
|
|
17
|
-
.describe("Options for AI question generation");
|
|
18
|
-
|
|
19
|
-
export type QuestionTypeGenerationOptionsType = z.infer<
|
|
20
|
-
typeof QuestionTypeGenerationOptions
|
|
21
|
-
>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const QuestionTypeGradingOptions = z
|
|
4
|
-
.object({
|
|
5
|
-
enabled: z
|
|
6
|
-
.boolean()
|
|
7
|
-
.describe(
|
|
8
|
-
"Whether this question type can be automatically graded using AI (default to false)",
|
|
9
|
-
),
|
|
10
|
-
instructions: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(
|
|
14
|
-
"Optional instructions to guide AI in grading this question type",
|
|
15
|
-
),
|
|
16
|
-
})
|
|
17
|
-
.describe("Options for AI question grading");
|
|
18
|
-
|
|
19
|
-
export type QuestionTypeGradingOptionsType = z.infer<
|
|
20
|
-
typeof QuestionTypeGradingOptions
|
|
21
|
-
>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A value that can either be a literal or a JSONata expression string.
|
|
5
|
-
* JSONata expressions are evaluated at transform time against the question context.
|
|
6
|
-
*/
|
|
7
|
-
const JsonataExpr = z
|
|
8
|
-
.union([z.string(), z.number(), z.boolean(), z.array(z.any()), z.object({})])
|
|
9
|
-
.describe("Literal or JSONata expression string starting with '='");
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Supported QTI 3.0 interaction types
|
|
13
|
-
*/
|
|
14
|
-
export const QtiInteractionType = z.enum([
|
|
15
|
-
"AssociateInteraction",
|
|
16
|
-
"ChoiceInteraction",
|
|
17
|
-
"DrawingInteraction",
|
|
18
|
-
"EndAttemptInteraction",
|
|
19
|
-
"ExtendedTextInteraction",
|
|
20
|
-
"GapMatchInteraction",
|
|
21
|
-
"GraphicAssociateInteraction",
|
|
22
|
-
"GraphicGapMatchInteraction",
|
|
23
|
-
"GraphicOrderInteraction",
|
|
24
|
-
"HotspotInteraction",
|
|
25
|
-
"HottextInteraction",
|
|
26
|
-
"InlineChoiceInteraction",
|
|
27
|
-
"MatchInteraction",
|
|
28
|
-
"MediaInteraction",
|
|
29
|
-
"OrderInteraction",
|
|
30
|
-
"PositionObjectInteraction",
|
|
31
|
-
"SelectPointInteraction",
|
|
32
|
-
"SliderInteraction",
|
|
33
|
-
"TextEntryInteraction",
|
|
34
|
-
"UploadInteraction",
|
|
35
|
-
]);
|
|
36
|
-
|
|
37
|
-
export type QtiInteractionType = z.infer<typeof QtiInteractionType>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Complete QTI mapping configuration for a question type
|
|
41
|
-
*/
|
|
42
|
-
export const Qti3Mapping = z
|
|
43
|
-
.object({
|
|
44
|
-
interaction: z.object({
|
|
45
|
-
type: QtiInteractionType.describe("The QTI interaction type to generate"),
|
|
46
|
-
options: z.record(z.string(), JsonataExpr).optional(),
|
|
47
|
-
}),
|
|
48
|
-
})
|
|
49
|
-
.describe(
|
|
50
|
-
"QTI 3.0 mapping configuration for transforming questions to QTI format",
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
export type Qti3Mapping = z.infer<typeof Qti3Mapping>;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
import { Translatable } from "./translatable";
|
|
4
|
-
|
|
5
|
-
// Setting option for enum type settings
|
|
6
|
-
export const QuestionTypeSettingOption = z
|
|
7
|
-
.object({
|
|
8
|
-
value: z.string().describe("Option value"),
|
|
9
|
-
label: Translatable.describe("Option label"),
|
|
10
|
-
})
|
|
11
|
-
.strict()
|
|
12
|
-
.describe("Setting option");
|
|
13
|
-
|
|
14
|
-
// Setting configuration
|
|
15
|
-
export const QuestionTypeSetting = z
|
|
16
|
-
.object({
|
|
17
|
-
id: z.string().describe("Unique identifier for the setting"),
|
|
18
|
-
name: Translatable.describe("Display name for the setting"),
|
|
19
|
-
helpText: Translatable.optional().describe("Help text for the setting"),
|
|
20
|
-
description: z
|
|
21
|
-
.string()
|
|
22
|
-
.optional()
|
|
23
|
-
.describe(
|
|
24
|
-
"Description to help AI agents auto-generate question settings",
|
|
25
|
-
),
|
|
26
|
-
type: z
|
|
27
|
-
.enum([
|
|
28
|
-
"enum",
|
|
29
|
-
"string",
|
|
30
|
-
"string-array",
|
|
31
|
-
"number",
|
|
32
|
-
"boolean",
|
|
33
|
-
"custom",
|
|
34
|
-
"scoring-criteria",
|
|
35
|
-
"tags",
|
|
36
|
-
"question-type",
|
|
37
|
-
])
|
|
38
|
-
.describe("Type of the setting"),
|
|
39
|
-
index: z.number().optional(),
|
|
40
|
-
hidden: z
|
|
41
|
-
.boolean()
|
|
42
|
-
.optional()
|
|
43
|
-
.describe("Whether the setting is hidden from the user"),
|
|
44
|
-
default: z.any().optional().describe("Default value for the setting"),
|
|
45
|
-
required: z
|
|
46
|
-
.boolean()
|
|
47
|
-
.optional()
|
|
48
|
-
.describe("Whether this setting is required"),
|
|
49
|
-
options: z
|
|
50
|
-
.array(QuestionTypeSettingOption)
|
|
51
|
-
.optional()
|
|
52
|
-
.describe("Available options for enum type settings"),
|
|
53
|
-
placeholder: Translatable.optional().describe(
|
|
54
|
-
"Placeholder text for the setting",
|
|
55
|
-
),
|
|
56
|
-
step: z.number().optional().describe("Step value for number type settings"),
|
|
57
|
-
min: z
|
|
58
|
-
.number()
|
|
59
|
-
.optional()
|
|
60
|
-
.describe("Minimum value for number type settings"),
|
|
61
|
-
max: z
|
|
62
|
-
.number()
|
|
63
|
-
.optional()
|
|
64
|
-
.describe("Maximum value for number type settings"),
|
|
65
|
-
})
|
|
66
|
-
.strict()
|
|
67
|
-
.describe("Setting configuration");
|
|
68
|
-
|
|
69
|
-
export type SettingType = z.infer<typeof QuestionTypeSetting>;
|
|
70
|
-
export type SettingOptionType = z.infer<typeof QuestionTypeSettingOption>;
|
package/src/question-type.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
PathOrUrlReference,
|
|
5
|
-
QuestionTypeComponents,
|
|
6
|
-
} from "./question-type-components";
|
|
7
|
-
import { QuestionTypeGenerationOptions } from "./question-type-generation-options";
|
|
8
|
-
import { QuestionTypeGradingOptions } from "./question-type-grading-options";
|
|
9
|
-
import { Qti3Mapping } from "./question-type-qti3";
|
|
10
|
-
import { QuestionTypeSetting } from "./question-type-setting";
|
|
11
|
-
import { Translatable } from "./translatable";
|
|
12
|
-
|
|
13
|
-
export const QuestionTypeSchema = z
|
|
14
|
-
.object({
|
|
15
|
-
$schema: z.string().optional(),
|
|
16
|
-
id: z
|
|
17
|
-
.string()
|
|
18
|
-
.regex(
|
|
19
|
-
/^([a-z][a-z0-9-]*)(\.[a-z][a-z0-9-]*)+$/,
|
|
20
|
-
"Valid question type ID format",
|
|
21
|
-
)
|
|
22
|
-
.describe(
|
|
23
|
-
"Unique identifier for the question type (e.g. 'my-org.color-picker')",
|
|
24
|
-
),
|
|
25
|
-
name: Translatable.describe(
|
|
26
|
-
"Display name for the question type, can be a simple string or translation object",
|
|
27
|
-
),
|
|
28
|
-
description: Translatable.describe(
|
|
29
|
-
"Description of the question type, can be a simple string or translation object",
|
|
30
|
-
),
|
|
31
|
-
icon: PathOrUrlReference.optional().describe(
|
|
32
|
-
"Path to the icon for this question type",
|
|
33
|
-
),
|
|
34
|
-
shortcut: z
|
|
35
|
-
.string()
|
|
36
|
-
.max(1)
|
|
37
|
-
.optional()
|
|
38
|
-
.describe("Keyboard shortcut for quick access to this question type"),
|
|
39
|
-
generation: QuestionTypeGenerationOptions.optional(),
|
|
40
|
-
grading: QuestionTypeGradingOptions.optional(),
|
|
41
|
-
timeEstimateMinutes: z
|
|
42
|
-
.number()
|
|
43
|
-
.min(1)
|
|
44
|
-
.optional()
|
|
45
|
-
.describe("Estimated time in minutes to complete this question type"),
|
|
46
|
-
isAi: z
|
|
47
|
-
.boolean()
|
|
48
|
-
.optional()
|
|
49
|
-
.describe("Whether this question type uses AI functionality"),
|
|
50
|
-
backgroundColor: z
|
|
51
|
-
.string()
|
|
52
|
-
.optional()
|
|
53
|
-
.describe("Background color for the question type"),
|
|
54
|
-
enforcePosition: z
|
|
55
|
-
.enum(["start", "end"])
|
|
56
|
-
.optional()
|
|
57
|
-
.describe("Position enforcement for this question type"),
|
|
58
|
-
enforceTitle: Translatable.optional().describe(
|
|
59
|
-
"Enforced title for this question type",
|
|
60
|
-
),
|
|
61
|
-
hideSettings: z
|
|
62
|
-
.boolean()
|
|
63
|
-
.optional()
|
|
64
|
-
.describe("Whether to hide settings for this question type"),
|
|
65
|
-
isPreviewRefreshable: z
|
|
66
|
-
.boolean()
|
|
67
|
-
.optional()
|
|
68
|
-
.describe("Whether the preview can be refreshed for this question type"),
|
|
69
|
-
hasSimpleScoring: z
|
|
70
|
-
.boolean()
|
|
71
|
-
.optional()
|
|
72
|
-
.describe("Whether this question type has simple scoring"),
|
|
73
|
-
titlePlaceholder: Translatable.optional().describe(
|
|
74
|
-
"Placeholder text for the title field",
|
|
75
|
-
),
|
|
76
|
-
descriptionPlaceholder: Translatable.optional().describe(
|
|
77
|
-
"Placeholder text for the description field",
|
|
78
|
-
),
|
|
79
|
-
untitledPlaceholder: Translatable.optional().describe(
|
|
80
|
-
"Placeholder text for untitled questions",
|
|
81
|
-
),
|
|
82
|
-
components: QuestionTypeComponents.optional().describe(
|
|
83
|
-
"Paths to the components used by this question type",
|
|
84
|
-
),
|
|
85
|
-
settings: z
|
|
86
|
-
.array(QuestionTypeSetting)
|
|
87
|
-
.optional()
|
|
88
|
-
.describe("Configuration settings for the question type"),
|
|
89
|
-
public: z
|
|
90
|
-
.boolean()
|
|
91
|
-
.optional()
|
|
92
|
-
.describe(
|
|
93
|
-
"Whether this question type is public and can be used by all users",
|
|
94
|
-
),
|
|
95
|
-
translations: z
|
|
96
|
-
.record(z.string(), Translatable)
|
|
97
|
-
.optional()
|
|
98
|
-
.describe("Custom translations for this question type"),
|
|
99
|
-
export: z
|
|
100
|
-
.object({
|
|
101
|
-
qti3: Qti3Mapping.optional().describe(
|
|
102
|
-
"QTI 3.0 mapping configuration for transforming questions to QTI format",
|
|
103
|
-
),
|
|
104
|
-
})
|
|
105
|
-
.optional()
|
|
106
|
-
.describe("Export configuration for various formats"),
|
|
107
|
-
stylesheet: z.url().optional(),
|
|
108
|
-
index: z.number().optional(),
|
|
109
|
-
metadata: z
|
|
110
|
-
.record(z.string(), z.any())
|
|
111
|
-
.optional()
|
|
112
|
-
.describe(
|
|
113
|
-
"Optional metadata for the question type, only used by external applications",
|
|
114
|
-
),
|
|
115
|
-
})
|
|
116
|
-
.strict()
|
|
117
|
-
.describe("Schema for defining question types in the Examplary system");
|
|
118
|
-
|
|
119
|
-
export type QuestionType = z.infer<typeof QuestionTypeSchema>;
|
package/src/translatable.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
// Translatable type - can be a simple string or translation object
|
|
4
|
-
export const Translatable = z.union([
|
|
5
|
-
z.string().describe("Simple string value"),
|
|
6
|
-
z
|
|
7
|
-
.record(
|
|
8
|
-
z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/, "Language code format"),
|
|
9
|
-
z.string(),
|
|
10
|
-
)
|
|
11
|
-
.refine(
|
|
12
|
-
(obj) => Object.keys(obj).length >= 1,
|
|
13
|
-
"Translation object must have at least one property",
|
|
14
|
-
)
|
|
15
|
-
.describe("Translation object with language codes as keys"),
|
|
16
|
-
]);
|
|
17
|
-
export type TranslatableType = z.infer<typeof Translatable>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|