@pfdev/api-types 3.0.17 → 3.0.18

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 (2) hide show
  1. package/package.json +2 -2
  2. package/v3.ts +97 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pfdev/api-types",
3
- "version": "3.0.17",
3
+ "version": "3.0.18",
4
4
  "description": "TypeScript types for PF API V3",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -9,7 +9,7 @@
9
9
  "v3.ts"
10
10
  ],
11
11
  "scripts": {
12
- "watch": "chokidar '../pfapi-fs/src/routes/v3/*/schemas.ts' -c 'npm run generate'",
12
+ "watch": "chokidar '../pfapi-fs/src/routes/v3/**/schemas.ts' -c 'npm run generate'",
13
13
  "verify": "tsc --noEmit v3.ts",
14
14
  "generate": "bash generate-types.sh",
15
15
  "preversion": "npm run generate && git add v3.ts",
package/v3.ts CHANGED
@@ -506,6 +506,84 @@ export const SetDetailParamSchema = Type.Object({
506
506
 
507
507
  export type SetDetailParam = Static<typeof SetDetailParamSchema>;
508
508
 
509
+ // ============= LISTS =============
510
+
511
+
512
+ export const ListTypeSchema = Type.Union(
513
+ [Type.Literal('static'), Type.Literal('dynamic'), Type.Literal('binder')],
514
+ { description: 'static = duplicates allowed, dynamic = one entry per card variant, binder = slot-based layout' }
515
+ );
516
+
517
+ export type ListType = Static<typeof ListTypeSchema>;
518
+
519
+ export const ListSchema = Type.Object(
520
+ {
521
+ uuid: Type.String({ format: 'uuid' }),
522
+ name: Type.String(),
523
+ description: Type.Union([Type.String(), Type.Null()]),
524
+ icon: Type.Union([Type.String(), Type.Null()]),
525
+ color: Type.Union([Type.String(), Type.Null()]),
526
+ is_private: Type.Boolean(),
527
+ type: Type.Union([ListTypeSchema, Type.Null()]),
528
+ binder_config: Type.Union([Type.Number(), Type.Null()], {
529
+ description: 'Binder layout preset. Only set for binders.'
530
+ }),
531
+ card_count: Type.Integer({ description: 'Total entries, including duplicates' }),
532
+ unique_count: Type.Integer({ description: 'Distinct cardids' }),
533
+ total_value: Type.Number({ description: 'Sum of current USD prices of every entry' })
534
+ },
535
+ { title: 'List' }
536
+ );
537
+
538
+ export type List = Static<typeof ListSchema>;
539
+
540
+ export const ListsResponseSchema = Type.Array(ListSchema, {
541
+ title: 'ListsResponse',
542
+ description: 'All lists and binders owned by the authenticated user, oldest first.'
543
+ });
544
+
545
+ export const ListParamSchema = Type.Object({
546
+ uuid: Type.String({ format: 'uuid', description: 'UUID of the list' })
547
+ });
548
+
549
+ export type ListParam = Static<typeof ListParamSchema>;
550
+
551
+ const NameSchema = Type.String({ minLength: 1, maxLength: 100 });
552
+ const DescriptionSchema = Type.String({ maxLength: 1000 });
553
+
554
+ export const ListCreateRequestSchema = Type.Object(
555
+ {
556
+ name: NameSchema,
557
+ description: Type.Optional(DescriptionSchema),
558
+ icon: Type.String({ minLength: 1 }),
559
+ color: Type.String({ minLength: 1 }),
560
+ is_private: Type.Optional(Type.Boolean({ default: false })),
561
+ type: Type.Optional(ListTypeSchema),
562
+ binder_config: Type.Optional(Type.Number({ description: 'Required when type is binder; rejected otherwise' }))
563
+ },
564
+ { title: 'ListCreateRequest', additionalProperties: false }
565
+ );
566
+
567
+ export type ListCreateRequest = Static<typeof ListCreateRequestSchema>;
568
+
569
+ export const ListPatchRequestSchema = Type.Object(
570
+ {
571
+ name: Type.Optional(NameSchema),
572
+ description: Type.Optional(DescriptionSchema),
573
+ icon: Type.Optional(Type.String({ minLength: 1 })),
574
+ color: Type.Optional(Type.String({ minLength: 1 })),
575
+ is_private: Type.Optional(Type.Boolean())
576
+ },
577
+ {
578
+ title: 'ListPatchRequest',
579
+ description: 'Fields omitted from the body are left unchanged. type and binder_config cannot be changed.',
580
+ additionalProperties: false,
581
+ minProperties: 1
582
+ }
583
+ );
584
+
585
+ export type ListPatchRequest = Static<typeof ListPatchRequestSchema>;
586
+
509
587
  // ============= USERS =============
510
588
 
511
589
 
@@ -765,3 +843,22 @@ export const VisionResponseSchema = Type.Object(
765
843
  );
766
844
 
767
845
  export type VisionResponse = Static<typeof VisionResponseSchema>;
846
+
847
+ // ============= CLERK =============
848
+
849
+
850
+ export const WebhookAckSchema = Type.Object(
851
+ {
852
+ received: Type.Boolean()
853
+ },
854
+ { title: 'WebhookAck' }
855
+ );
856
+
857
+ export type WebhookAck = Static<typeof WebhookAckSchema>;
858
+
859
+ export const WebhookErrorSchema = Type.Object({
860
+ error: Type.String(),
861
+ message: Type.String()
862
+ });
863
+
864
+ export type WebhookError = Static<typeof WebhookErrorSchema>;