@learncard/types 5.23.1 → 5.23.2
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/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/obv3.d.ts +2 -0
- package/dist/obv3.d.ts.map +1 -1
- package/dist/skillIcons.d.ts +18 -0
- package/dist/skillIcons.d.ts.map +1 -0
- package/dist/types.cjs.development.cjs +18 -0
- package/dist/types.cjs.development.cjs.map +3 -3
- package/dist/types.cjs.production.min.cjs +6 -6
- package/dist/types.cjs.production.min.cjs.map +4 -4
- package/dist/types.esm.js +19 -0
- package/dist/types.esm.js.map +4 -4
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/obv3.ts +1 -0
- package/src/skillIcons.ts +31 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/obv3.ts
CHANGED
|
@@ -234,6 +234,7 @@ export const AchievementSubjectValidator = z
|
|
|
234
234
|
export type AchievementSubject = z.infer<typeof AchievementSubjectValidator>;
|
|
235
235
|
|
|
236
236
|
export const UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
237
|
+
awardedDate: z.string().optional(),
|
|
237
238
|
name: z.string().optional(),
|
|
238
239
|
description: z.string().optional(),
|
|
239
240
|
image: ImageValidator.optional(),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Per-request limits for AI skill icon generation (`ai.generateSkillIcons`).
|
|
5
|
+
*
|
|
6
|
+
* Clients split large skill frameworks into batches that fit within these limits, and the
|
|
7
|
+
* server rejects anything larger. The limits exist because:
|
|
8
|
+
* - `ai.generateSkillIcons` is sent as a GET with every name in the URL, and API Gateway
|
|
9
|
+
* returns HTTP 431 once the request line passes ~10KB (browsers add headers on top).
|
|
10
|
+
* - Generation takes ~80ms per name, and the server enforces a 25s model timeout.
|
|
11
|
+
*/
|
|
12
|
+
export const SKILL_ICON_MAX_NAMES_PER_REQUEST = 100;
|
|
13
|
+
export const SKILL_ICON_MAX_CHARACTERS_PER_REQUEST = 2500;
|
|
14
|
+
|
|
15
|
+
export const SkillIconNamesValidator = z
|
|
16
|
+
.array(z.string().nonempty())
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(SKILL_ICON_MAX_NAMES_PER_REQUEST, {
|
|
19
|
+
message: `A maximum of ${SKILL_ICON_MAX_NAMES_PER_REQUEST} skill names can be sent per request`,
|
|
20
|
+
})
|
|
21
|
+
.refine(
|
|
22
|
+
names =>
|
|
23
|
+
names.reduce((total, name) => total + name.length, 0) <=
|
|
24
|
+
SKILL_ICON_MAX_CHARACTERS_PER_REQUEST,
|
|
25
|
+
{
|
|
26
|
+
message: `Skill names may total at most ${SKILL_ICON_MAX_CHARACTERS_PER_REQUEST} characters per request`,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const GenerateSkillIconsInputValidator = z.object({ names: SkillIconNamesValidator });
|
|
31
|
+
export type GenerateSkillIconsInput = z.infer<typeof GenerateSkillIconsInputValidator>;
|