@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/types",
3
- "version": "5.23.1",
3
+ "version": "5.23.2",
4
4
  "description": "Shared types for learn card",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/src/index.ts CHANGED
@@ -18,3 +18,4 @@ export * from './bitstring-status-list';
18
18
  export * from './inAppMessages';
19
19
  export * from './credential-refresh';
20
20
  export * from './share-links';
21
+ export * from './skillIcons';
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>;