@purveyors/sdk 0.0.0 → 0.1.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.
@@ -0,0 +1,1295 @@
1
+ import * as openapi_fetch from 'openapi-fetch';
2
+ import { ClientOptions } from 'openapi-fetch';
3
+
4
+ /**
5
+ * This file was auto-generated by openapi-typescript.
6
+ * Do not make direct changes to the file.
7
+ */
8
+
9
+ interface paths {
10
+ "/health": {
11
+ parameters: {
12
+ query?: never;
13
+ header?: never;
14
+ path?: never;
15
+ cookie?: never;
16
+ };
17
+ /** Liveness and service identity */
18
+ get: {
19
+ parameters: {
20
+ query?: never;
21
+ header?: never;
22
+ path?: never;
23
+ cookie?: never;
24
+ };
25
+ requestBody?: never;
26
+ responses: {
27
+ /** @description Service is healthy */
28
+ 200: {
29
+ headers: {
30
+ [name: string]: unknown;
31
+ };
32
+ content: {
33
+ "application/json": components["schemas"]["HealthResponse"];
34
+ };
35
+ };
36
+ };
37
+ };
38
+ put?: never;
39
+ post?: never;
40
+ delete?: never;
41
+ options?: never;
42
+ head?: never;
43
+ patch?: never;
44
+ trace?: never;
45
+ };
46
+ "/": {
47
+ parameters: {
48
+ query?: never;
49
+ header?: never;
50
+ path?: never;
51
+ cookie?: never;
52
+ };
53
+ /** Service discovery document */
54
+ get: {
55
+ parameters: {
56
+ query?: never;
57
+ header?: never;
58
+ path?: never;
59
+ cookie?: never;
60
+ };
61
+ requestBody?: never;
62
+ responses: {
63
+ /** @description Discovery document with pointers to docs and the spec */
64
+ 200: {
65
+ headers: {
66
+ [name: string]: unknown;
67
+ };
68
+ content: {
69
+ "application/json": components["schemas"]["DiscoveryResponse"];
70
+ };
71
+ };
72
+ };
73
+ };
74
+ put?: never;
75
+ post?: never;
76
+ delete?: never;
77
+ options?: never;
78
+ head?: never;
79
+ patch?: never;
80
+ trace?: never;
81
+ };
82
+ "/v1/me": {
83
+ parameters: {
84
+ query?: never;
85
+ header?: never;
86
+ path?: never;
87
+ cookie?: never;
88
+ };
89
+ /** Resolved principal and entitlements for the caller */
90
+ get: {
91
+ parameters: {
92
+ query?: never;
93
+ header?: never;
94
+ path?: never;
95
+ cookie?: never;
96
+ };
97
+ requestBody?: never;
98
+ responses: {
99
+ /** @description The caller's principal (anonymous if unauthenticated) */
100
+ 200: {
101
+ headers: {
102
+ [name: string]: unknown;
103
+ };
104
+ content: {
105
+ "application/json": components["schemas"]["MeResponse"];
106
+ };
107
+ };
108
+ };
109
+ };
110
+ put?: never;
111
+ post?: never;
112
+ delete?: never;
113
+ options?: never;
114
+ head?: never;
115
+ patch?: never;
116
+ trace?: never;
117
+ };
118
+ "/v1/catalog/access": {
119
+ parameters: {
120
+ query?: never;
121
+ header?: never;
122
+ path?: never;
123
+ cookie?: never;
124
+ };
125
+ /** Catalog capabilities and visibility for the caller */
126
+ get: {
127
+ parameters: {
128
+ query?: never;
129
+ header?: never;
130
+ path?: never;
131
+ cookie?: never;
132
+ };
133
+ requestBody?: never;
134
+ responses: {
135
+ /** @description Resolved catalog access policy for the caller's principal */
136
+ 200: {
137
+ headers: {
138
+ [name: string]: unknown;
139
+ };
140
+ content: {
141
+ "application/json": components["schemas"]["CatalogAccessResponse"];
142
+ };
143
+ };
144
+ };
145
+ };
146
+ put?: never;
147
+ post?: never;
148
+ delete?: never;
149
+ options?: never;
150
+ head?: never;
151
+ patch?: never;
152
+ trace?: never;
153
+ };
154
+ "/v1/catalog": {
155
+ parameters: {
156
+ query?: never;
157
+ header?: never;
158
+ path?: never;
159
+ cookie?: never;
160
+ };
161
+ /**
162
+ * List public catalog coffees
163
+ * @description Public catalog listing. Excludes wholesale-restricted rows and returns only public fields. API-key callers are capped to their plan's per-call row limit.
164
+ */
165
+ get: {
166
+ parameters: {
167
+ query?: {
168
+ page?: number;
169
+ limit?: number;
170
+ stocked?: "true" | "false" | "all";
171
+ sort?: string;
172
+ order?: "asc" | "desc";
173
+ };
174
+ header?: never;
175
+ path?: never;
176
+ cookie?: never;
177
+ };
178
+ requestBody?: never;
179
+ responses: {
180
+ /** @description A page of public catalog rows with pagination + meta */
181
+ 200: {
182
+ headers: {
183
+ [name: string]: unknown;
184
+ };
185
+ content: {
186
+ "application/json": components["schemas"]["CatalogListResponse"];
187
+ };
188
+ };
189
+ };
190
+ };
191
+ put?: never;
192
+ post?: never;
193
+ delete?: never;
194
+ options?: never;
195
+ head?: never;
196
+ patch?: never;
197
+ trace?: never;
198
+ };
199
+ "/v1/catalog/proof-coverage": {
200
+ parameters: {
201
+ query?: never;
202
+ header?: never;
203
+ path?: never;
204
+ cookie?: never;
205
+ };
206
+ /**
207
+ * Aggregate proof-coverage over the public catalog
208
+ * @description Aggregate-only proof coverage (no row-level evidence) computed over the stocked public catalog.
209
+ */
210
+ get: {
211
+ parameters: {
212
+ query?: never;
213
+ header?: never;
214
+ path?: never;
215
+ cookie?: never;
216
+ };
217
+ requestBody?: never;
218
+ responses: {
219
+ /** @description Proof-coverage summary with per-family buckets and gaps */
220
+ 200: {
221
+ headers: {
222
+ [name: string]: unknown;
223
+ };
224
+ content: {
225
+ "application/json": components["schemas"]["CatalogProofCoverageResponse"];
226
+ };
227
+ };
228
+ };
229
+ };
230
+ put?: never;
231
+ post?: never;
232
+ delete?: never;
233
+ options?: never;
234
+ head?: never;
235
+ patch?: never;
236
+ trace?: never;
237
+ };
238
+ "/v1/price-index": {
239
+ parameters: {
240
+ query?: never;
241
+ header?: never;
242
+ path?: never;
243
+ cookie?: never;
244
+ };
245
+ /**
246
+ * Parchment Price Index (aggregate snapshots)
247
+ * @description Aggregate-only price index over price_index_snapshots. Requires an API key with Parchment Intelligence (ppiAccess).
248
+ */
249
+ get: {
250
+ parameters: {
251
+ query?: {
252
+ page?: number;
253
+ limit?: number;
254
+ origin?: string;
255
+ process?: string;
256
+ grade?: string;
257
+ from?: string;
258
+ to?: string;
259
+ wholesale?: "true" | "false";
260
+ };
261
+ header?: never;
262
+ path?: never;
263
+ cookie?: never;
264
+ };
265
+ requestBody?: never;
266
+ responses: {
267
+ /** @description A page of aggregate price-index snapshots */
268
+ 200: {
269
+ headers: {
270
+ [name: string]: unknown;
271
+ };
272
+ content: {
273
+ "application/json": components["schemas"]["PriceIndexResponse"];
274
+ };
275
+ };
276
+ /** @description Authentication required */
277
+ 401: {
278
+ headers: {
279
+ [name: string]: unknown;
280
+ };
281
+ content: {
282
+ "application/json": components["schemas"]["ErrorResponse"];
283
+ };
284
+ };
285
+ /** @description Insufficient entitlement (plan or role) */
286
+ 403: {
287
+ headers: {
288
+ [name: string]: unknown;
289
+ };
290
+ content: {
291
+ "application/json": components["schemas"]["ErrorResponse"];
292
+ };
293
+ };
294
+ };
295
+ };
296
+ put?: never;
297
+ post?: never;
298
+ delete?: never;
299
+ options?: never;
300
+ head?: never;
301
+ patch?: never;
302
+ trace?: never;
303
+ };
304
+ "/v1/catalog/{id}/similar": {
305
+ parameters: {
306
+ query?: never;
307
+ header?: never;
308
+ path?: never;
309
+ cookie?: never;
310
+ };
311
+ /**
312
+ * Find catalog coffees similar to a target coffee
313
+ * @description Vector-similarity matches for a target catalog coffee, with deterministic identity gating, supplier-diversity re-ranking, and a canonical/similar split. Requires the bean-matching capability (a member session or a paid API plan).
314
+ */
315
+ get: {
316
+ parameters: {
317
+ query?: {
318
+ threshold?: string;
319
+ limit?: number;
320
+ stocked_only?: "true" | "false";
321
+ mode?: "all" | "likely_same" | "similar_profile";
322
+ };
323
+ header?: never;
324
+ path: {
325
+ id: string;
326
+ };
327
+ cookie?: never;
328
+ };
329
+ requestBody?: never;
330
+ responses: {
331
+ /** @description Target coffee with grouped similarity matches */
332
+ 200: {
333
+ headers: {
334
+ [name: string]: unknown;
335
+ };
336
+ content: {
337
+ "application/json": components["schemas"]["CatalogSimilarityResponse"];
338
+ };
339
+ };
340
+ /** @description Invalid path id or query parameter */
341
+ 400: {
342
+ headers: {
343
+ [name: string]: unknown;
344
+ };
345
+ content: {
346
+ "application/json": components["schemas"]["ErrorResponse"];
347
+ };
348
+ };
349
+ /** @description Authentication required */
350
+ 401: {
351
+ headers: {
352
+ [name: string]: unknown;
353
+ };
354
+ content: {
355
+ "application/json": components["schemas"]["ErrorResponse"];
356
+ };
357
+ };
358
+ /** @description Insufficient entitlement (plan or role) */
359
+ 403: {
360
+ headers: {
361
+ [name: string]: unknown;
362
+ };
363
+ content: {
364
+ "application/json": components["schemas"]["ErrorResponse"];
365
+ };
366
+ };
367
+ /** @description Catalog coffee not found */
368
+ 404: {
369
+ headers: {
370
+ [name: string]: unknown;
371
+ };
372
+ content: {
373
+ "application/json": components["schemas"]["ErrorResponse"];
374
+ };
375
+ };
376
+ };
377
+ };
378
+ put?: never;
379
+ post?: never;
380
+ delete?: never;
381
+ options?: never;
382
+ head?: never;
383
+ patch?: never;
384
+ trace?: never;
385
+ };
386
+ "/v1/procurement/briefs": {
387
+ parameters: {
388
+ query?: never;
389
+ header?: never;
390
+ path?: never;
391
+ cookie?: never;
392
+ };
393
+ /**
394
+ * List saved sourcing briefs
395
+ * @description List the authenticated principal's active sourcing briefs. Requires a member session or a paid (member+) API plan; API keys also need the catalog:read scope.
396
+ */
397
+ get: {
398
+ parameters: {
399
+ query?: never;
400
+ header?: never;
401
+ path?: never;
402
+ cookie?: never;
403
+ };
404
+ requestBody?: never;
405
+ responses: {
406
+ /** @description The principal's active sourcing briefs */
407
+ 200: {
408
+ headers: {
409
+ [name: string]: unknown;
410
+ };
411
+ content: {
412
+ "application/json": components["schemas"]["SourcingBriefsListResponse"];
413
+ };
414
+ };
415
+ /** @description Authentication required */
416
+ 401: {
417
+ headers: {
418
+ [name: string]: unknown;
419
+ };
420
+ content: {
421
+ "application/json": components["schemas"]["ErrorResponse"];
422
+ };
423
+ };
424
+ /** @description Insufficient entitlement (plan or role) */
425
+ 403: {
426
+ headers: {
427
+ [name: string]: unknown;
428
+ };
429
+ content: {
430
+ "application/json": components["schemas"]["ErrorResponse"];
431
+ };
432
+ };
433
+ };
434
+ };
435
+ put?: never;
436
+ /**
437
+ * Create a sourcing brief
438
+ * @description Create a saved sourcing brief for the authenticated principal. Requires a member session or a paid (member+) API plan; API keys also need the catalog:read scope.
439
+ */
440
+ post: {
441
+ parameters: {
442
+ query?: never;
443
+ header?: never;
444
+ path?: never;
445
+ cookie?: never;
446
+ };
447
+ requestBody?: {
448
+ content: {
449
+ "application/json": components["schemas"]["SourcingBriefCreateRequest"];
450
+ };
451
+ };
452
+ responses: {
453
+ /** @description The created sourcing brief */
454
+ 201: {
455
+ headers: {
456
+ [name: string]: unknown;
457
+ };
458
+ content: {
459
+ "application/json": components["schemas"]["SourcingBriefResponse"];
460
+ };
461
+ };
462
+ /** @description Invalid request body or unsupported criteria */
463
+ 400: {
464
+ headers: {
465
+ [name: string]: unknown;
466
+ };
467
+ content: {
468
+ "application/json": components["schemas"]["ErrorResponse"];
469
+ };
470
+ };
471
+ /** @description Authentication required */
472
+ 401: {
473
+ headers: {
474
+ [name: string]: unknown;
475
+ };
476
+ content: {
477
+ "application/json": components["schemas"]["ErrorResponse"];
478
+ };
479
+ };
480
+ /** @description Insufficient entitlement (plan or role) */
481
+ 403: {
482
+ headers: {
483
+ [name: string]: unknown;
484
+ };
485
+ content: {
486
+ "application/json": components["schemas"]["ErrorResponse"];
487
+ };
488
+ };
489
+ };
490
+ };
491
+ delete?: never;
492
+ options?: never;
493
+ head?: never;
494
+ patch?: never;
495
+ trace?: never;
496
+ };
497
+ "/v1/procurement/briefs/{id}": {
498
+ parameters: {
499
+ query?: never;
500
+ header?: never;
501
+ path?: never;
502
+ cookie?: never;
503
+ };
504
+ /**
505
+ * Get a sourcing brief
506
+ * @description Fetch one of the authenticated principal's sourcing briefs by id. Requires a member session or a paid (member+) API plan; API keys also need the catalog:read scope.
507
+ */
508
+ get: {
509
+ parameters: {
510
+ query?: never;
511
+ header?: never;
512
+ path: {
513
+ id: string;
514
+ };
515
+ cookie?: never;
516
+ };
517
+ requestBody?: never;
518
+ responses: {
519
+ /** @description The requested sourcing brief */
520
+ 200: {
521
+ headers: {
522
+ [name: string]: unknown;
523
+ };
524
+ content: {
525
+ "application/json": components["schemas"]["SourcingBriefResponse"];
526
+ };
527
+ };
528
+ /** @description Authentication required */
529
+ 401: {
530
+ headers: {
531
+ [name: string]: unknown;
532
+ };
533
+ content: {
534
+ "application/json": components["schemas"]["ErrorResponse"];
535
+ };
536
+ };
537
+ /** @description Insufficient entitlement (plan or role) */
538
+ 403: {
539
+ headers: {
540
+ [name: string]: unknown;
541
+ };
542
+ content: {
543
+ "application/json": components["schemas"]["ErrorResponse"];
544
+ };
545
+ };
546
+ /** @description No such brief for this principal */
547
+ 404: {
548
+ headers: {
549
+ [name: string]: unknown;
550
+ };
551
+ content: {
552
+ "application/json": components["schemas"]["ErrorResponse"];
553
+ };
554
+ };
555
+ };
556
+ };
557
+ put?: never;
558
+ post?: never;
559
+ delete?: never;
560
+ options?: never;
561
+ head?: never;
562
+ patch?: never;
563
+ trace?: never;
564
+ };
565
+ "/v1/procurement/briefs/{id}/matches": {
566
+ parameters: {
567
+ query?: never;
568
+ header?: never;
569
+ path?: never;
570
+ cookie?: never;
571
+ };
572
+ /**
573
+ * Run a sourcing brief against the catalog
574
+ * @description Return the catalog coffees that satisfy a saved brief's criteria, each annotated with the deterministic reasons it matched. Requires a member session or a paid (member+) API plan; API keys also need the catalog:read scope.
575
+ */
576
+ get: {
577
+ parameters: {
578
+ query?: {
579
+ page?: number;
580
+ limit?: number;
581
+ };
582
+ header?: never;
583
+ path: {
584
+ id: string;
585
+ };
586
+ cookie?: never;
587
+ };
588
+ requestBody?: never;
589
+ responses: {
590
+ /** @description A page of catalog matches for the brief */
591
+ 200: {
592
+ headers: {
593
+ [name: string]: unknown;
594
+ };
595
+ content: {
596
+ "application/json": components["schemas"]["SourcingBriefMatchesResponse"];
597
+ };
598
+ };
599
+ /** @description Invalid pagination parameter */
600
+ 400: {
601
+ headers: {
602
+ [name: string]: unknown;
603
+ };
604
+ content: {
605
+ "application/json": components["schemas"]["ErrorResponse"];
606
+ };
607
+ };
608
+ /** @description Authentication required */
609
+ 401: {
610
+ headers: {
611
+ [name: string]: unknown;
612
+ };
613
+ content: {
614
+ "application/json": components["schemas"]["ErrorResponse"];
615
+ };
616
+ };
617
+ /** @description Insufficient entitlement (plan or role) */
618
+ 403: {
619
+ headers: {
620
+ [name: string]: unknown;
621
+ };
622
+ content: {
623
+ "application/json": components["schemas"]["ErrorResponse"];
624
+ };
625
+ };
626
+ /** @description No such brief for this principal */
627
+ 404: {
628
+ headers: {
629
+ [name: string]: unknown;
630
+ };
631
+ content: {
632
+ "application/json": components["schemas"]["ErrorResponse"];
633
+ };
634
+ };
635
+ };
636
+ };
637
+ put?: never;
638
+ post?: never;
639
+ delete?: never;
640
+ options?: never;
641
+ head?: never;
642
+ patch?: never;
643
+ trace?: never;
644
+ };
645
+ }
646
+ interface components {
647
+ schemas: {
648
+ HealthResponse: {
649
+ /** @enum {string} */
650
+ status: "ok";
651
+ /** @enum {string} */
652
+ service: "parchment-api";
653
+ version: string;
654
+ /** Format: date-time */
655
+ timestamp: string;
656
+ };
657
+ DiscoveryResponse: {
658
+ /** @enum {string} */
659
+ product: "Parchment";
660
+ namespace: string;
661
+ health: string;
662
+ docs: string;
663
+ openapi: string;
664
+ };
665
+ MeResponse: {
666
+ authenticated: boolean;
667
+ /** @enum {string} */
668
+ authKind: "anonymous" | "session" | "api-key";
669
+ userId: string | null;
670
+ appRoles: string[];
671
+ primaryAppRole: string | null;
672
+ /** @enum {string|null} */
673
+ apiPlan: "viewer" | "member" | "enterprise" | null;
674
+ ppiAccess: boolean;
675
+ apiScopes: string[];
676
+ };
677
+ CatalogAccessResponse: {
678
+ visibility: {
679
+ isPrivilegedSession: boolean;
680
+ publicOnly: boolean;
681
+ showWholesale: boolean;
682
+ wholesaleOnly: boolean;
683
+ };
684
+ capabilities: {
685
+ canViewPublicCatalog: boolean;
686
+ canViewFullCatalog: boolean;
687
+ canViewWholesale: boolean;
688
+ canUseBasicFilters: boolean;
689
+ canUseAdvancedFilters: boolean;
690
+ canUseProcessFacets: boolean;
691
+ canUsePriceScoreRanges: boolean;
692
+ canUseAdvancedSorts: boolean;
693
+ canViewPremiumFilterMetadata: boolean;
694
+ canUseSemanticSearch: boolean;
695
+ canUseBeanMatching: boolean;
696
+ canUseSavedSearches: boolean;
697
+ canExport: boolean;
698
+ };
699
+ };
700
+ CatalogItem: {
701
+ id: number;
702
+ name?: string | null;
703
+ source?: string | null;
704
+ continent?: string | null;
705
+ country?: string | null;
706
+ region?: string | null;
707
+ processing?: string | null;
708
+ cultivar_detail?: string | null;
709
+ type?: string | null;
710
+ grade?: string | null;
711
+ appearance?: string | null;
712
+ score_value?: number | null;
713
+ cost_lb?: number | null;
714
+ price_per_lb?: number | null;
715
+ arrival_date?: string | null;
716
+ stocked_date?: string | null;
717
+ stocked?: boolean | null;
718
+ };
719
+ CatalogListResponse: {
720
+ data: components["schemas"]["CatalogItem"][];
721
+ pagination: {
722
+ page: number;
723
+ limit: number;
724
+ total: number;
725
+ totalPages: number;
726
+ hasNext: boolean;
727
+ hasPrev: boolean;
728
+ };
729
+ meta: {
730
+ /** @enum {string} */
731
+ resource: "catalog";
732
+ /** @enum {string} */
733
+ namespace: "/v1/catalog";
734
+ /** @enum {string} */
735
+ version: "v1";
736
+ auth: {
737
+ /** @enum {string} */
738
+ kind: "anonymous" | "session" | "api-key";
739
+ /** @enum {string|null} */
740
+ role: "viewer" | "member" | "admin" | null;
741
+ /** @enum {string|null} */
742
+ apiPlan: "viewer" | "member" | "enterprise" | null;
743
+ };
744
+ access: {
745
+ publicOnly: boolean;
746
+ rowLimit: number | null;
747
+ limited: boolean;
748
+ totalAvailable: number;
749
+ };
750
+ };
751
+ };
752
+ CatalogProofCoverageResponse: {
753
+ meta: {
754
+ /** @enum {string} */
755
+ resource: "catalog-proof-coverage";
756
+ /** @enum {string} */
757
+ namespace: "/v1/catalog/proof-coverage";
758
+ /** @enum {string} */
759
+ version: "v1";
760
+ auth: {
761
+ /** @enum {string} */
762
+ kind: "anonymous" | "session" | "api-key";
763
+ /** @enum {string|null} */
764
+ role: "viewer" | "member" | "admin" | null;
765
+ /** @enum {string|null} */
766
+ apiPlan: "viewer" | "member" | "enterprise" | null;
767
+ };
768
+ access: {
769
+ publicOnly: boolean;
770
+ sampled: number;
771
+ totalAvailable: number;
772
+ };
773
+ };
774
+ coverage: {
775
+ overall: {
776
+ label: string;
777
+ count: number;
778
+ share: number;
779
+ }[];
780
+ families: {
781
+ [key: string]: {
782
+ label: string;
783
+ count: number;
784
+ share: number;
785
+ }[];
786
+ };
787
+ signals: {
788
+ [key: string]: number;
789
+ };
790
+ top_gaps: {
791
+ family: string;
792
+ label: string;
793
+ count: number;
794
+ share: number;
795
+ }[];
796
+ limitations: string[];
797
+ };
798
+ };
799
+ PriceIndexItem: {
800
+ date: string;
801
+ origin: string;
802
+ process: string | null;
803
+ grade: string | null;
804
+ wholesale: boolean;
805
+ price: {
806
+ min: number | null;
807
+ max: number | null;
808
+ avg: number | null;
809
+ median: number | null;
810
+ p25: number | null;
811
+ p75: number | null;
812
+ stdev: number | null;
813
+ };
814
+ sample: {
815
+ suppliers: number;
816
+ listings: number;
817
+ aggregationTier: number | null;
818
+ };
819
+ provenance: {
820
+ synthetic: boolean;
821
+ };
822
+ };
823
+ PriceIndexResponse: {
824
+ data: components["schemas"]["PriceIndexItem"][];
825
+ pagination: {
826
+ page: number;
827
+ limit: number;
828
+ total: number;
829
+ totalPages: number;
830
+ hasNext: boolean;
831
+ hasPrev: boolean;
832
+ };
833
+ meta: {
834
+ /** @enum {string} */
835
+ resource: "price-index";
836
+ /** @enum {string} */
837
+ namespace: "/v1/price-index";
838
+ /** @enum {string} */
839
+ version: "v1";
840
+ auth: {
841
+ /** @enum {string} */
842
+ kind: "api-key";
843
+ /** @enum {string|null} */
844
+ apiPlan: "viewer" | "member" | "enterprise" | null;
845
+ /** @enum {boolean} */
846
+ ppiAccess: true;
847
+ };
848
+ filters: {
849
+ origin: string | null;
850
+ process: string | null;
851
+ grade: string | null;
852
+ from: string | null;
853
+ to: string | null;
854
+ wholesale: boolean | null;
855
+ };
856
+ access: {
857
+ rowLimit: number | null;
858
+ limited: boolean;
859
+ totalAvailable: number;
860
+ };
861
+ source: {
862
+ /** @enum {string} */
863
+ table: "price_index_snapshots";
864
+ /** @enum {boolean} */
865
+ aggregateOnly: true;
866
+ };
867
+ };
868
+ };
869
+ ErrorResponse: {
870
+ error: {
871
+ code: string;
872
+ message: string;
873
+ };
874
+ };
875
+ CatalogSimilarityTarget: {
876
+ id: number;
877
+ name: string;
878
+ source: string | null;
879
+ origin: string | null;
880
+ country: string | null;
881
+ continent: string | null;
882
+ processing: string | null;
883
+ processing_base_method: string | null;
884
+ fermentation_type: string | null;
885
+ drying_method: string | null;
886
+ stocked: boolean | null;
887
+ arrival_date: string | null;
888
+ stocked_date: string | null;
889
+ price_per_lb: number | null;
890
+ price_tiers?: unknown;
891
+ cost_lb: number | null;
892
+ pricing: {
893
+ price_per_lb: number | null;
894
+ price_tiers?: unknown;
895
+ cost_lb: number | null;
896
+ /** @enum {number} */
897
+ baseline_quantity_lbs: 1;
898
+ baseline_price_per_lb: number | null;
899
+ /** @enum {string|null} */
900
+ baseline_source: "price_per_lb" | "price_tiers" | "cost_lb" | null;
901
+ };
902
+ proof: {
903
+ /** @enum {string} */
904
+ version: "proof-summary-v1";
905
+ overall: {
906
+ /** @enum {string} */
907
+ label: "strong" | "partial" | "limited" | "not_available";
908
+ families_with_signals: number;
909
+ };
910
+ families: {
911
+ process: {
912
+ label: string;
913
+ confidence: number | null;
914
+ signals: string[];
915
+ message: string;
916
+ };
917
+ provenance: {
918
+ label: string;
919
+ confidence: number | null;
920
+ signals: string[];
921
+ message: string;
922
+ };
923
+ freshness: {
924
+ label: string;
925
+ confidence: number | null;
926
+ signals: string[];
927
+ message: string;
928
+ };
929
+ pricing: {
930
+ label: string;
931
+ confidence: number | null;
932
+ signals: string[];
933
+ message: string;
934
+ };
935
+ };
936
+ limitations: string[];
937
+ };
938
+ };
939
+ CatalogSimilarityMatch: {
940
+ coffee: {
941
+ id: number;
942
+ name: string;
943
+ source: string | null;
944
+ origin: string | null;
945
+ country: string | null;
946
+ continent: string | null;
947
+ processing: string | null;
948
+ processing_base_method: string | null;
949
+ fermentation_type: string | null;
950
+ drying_method: string | null;
951
+ stocked: boolean | null;
952
+ arrival_date: string | null;
953
+ stocked_date: string | null;
954
+ proof: {
955
+ /** @enum {string} */
956
+ version: "proof-summary-v1";
957
+ overall: {
958
+ /** @enum {string} */
959
+ label: "strong" | "partial" | "limited" | "not_available";
960
+ families_with_signals: number;
961
+ };
962
+ families: {
963
+ process: {
964
+ label: string;
965
+ confidence: number | null;
966
+ signals: string[];
967
+ message: string;
968
+ };
969
+ provenance: {
970
+ label: string;
971
+ confidence: number | null;
972
+ signals: string[];
973
+ message: string;
974
+ };
975
+ freshness: {
976
+ label: string;
977
+ confidence: number | null;
978
+ signals: string[];
979
+ message: string;
980
+ };
981
+ pricing: {
982
+ label: string;
983
+ confidence: number | null;
984
+ signals: string[];
985
+ message: string;
986
+ };
987
+ };
988
+ limitations: string[];
989
+ };
990
+ };
991
+ pricing: {
992
+ price_per_lb: number | null;
993
+ price_tiers?: unknown;
994
+ cost_lb: number | null;
995
+ /** @enum {number} */
996
+ baseline_quantity_lbs: 1;
997
+ baseline_price_per_lb: number | null;
998
+ /** @enum {string|null} */
999
+ baseline_source: "price_per_lb" | "price_tiers" | "cost_lb" | null;
1000
+ };
1001
+ price_delta_1lb: {
1002
+ amount: number | null;
1003
+ percent: number | null;
1004
+ /** @enum {string} */
1005
+ currency: "USD";
1006
+ };
1007
+ score: {
1008
+ average: number;
1009
+ dimensions: {
1010
+ origin: number | null;
1011
+ processing: number | null;
1012
+ tasting: number | null;
1013
+ };
1014
+ chunk_matches: number;
1015
+ };
1016
+ match: {
1017
+ /** @enum {string} */
1018
+ category: "likely_same" | "similar_profile";
1019
+ classification: {
1020
+ /** @enum {string} */
1021
+ kind: "canonical_candidate" | "similar_recommendation";
1022
+ /** @enum {string} */
1023
+ identity_eligibility: "eligible" | "blocked" | "insufficient_evidence";
1024
+ /** @enum {string} */
1025
+ confidence: "high_beta" | "medium_beta" | "low_beta";
1026
+ blockers: {
1027
+ code: string;
1028
+ /** @enum {string} */
1029
+ severity: "hard" | "soft";
1030
+ target_value: string | null;
1031
+ candidate_value: string | null;
1032
+ }[];
1033
+ evidence: string[];
1034
+ };
1035
+ /** @enum {string} */
1036
+ confidence: "high_beta" | "medium_beta" | "low_beta";
1037
+ /** @enum {boolean} */
1038
+ beta: true;
1039
+ language: string;
1040
+ same_supplier: boolean;
1041
+ };
1042
+ explanation: {
1043
+ summary: string;
1044
+ signals: string[];
1045
+ };
1046
+ compatibility: {
1047
+ cost_lb: number | null;
1048
+ };
1049
+ };
1050
+ CatalogSimilarityResponse: {
1051
+ data: {
1052
+ target: components["schemas"]["CatalogSimilarityTarget"];
1053
+ groups: {
1054
+ canonical_candidates: components["schemas"]["CatalogSimilarityMatch"][];
1055
+ similar_recommendations: components["schemas"]["CatalogSimilarityMatch"][];
1056
+ };
1057
+ matches: components["schemas"]["CatalogSimilarityMatch"][];
1058
+ };
1059
+ meta: {
1060
+ /** @enum {string} */
1061
+ resource: "catalog-similarity";
1062
+ /** @enum {string} */
1063
+ namespace: "/v1/catalog/{id}/similar";
1064
+ /** @enum {string} */
1065
+ version: "v1";
1066
+ /** @enum {string} */
1067
+ status: "beta";
1068
+ auth: {
1069
+ /** @enum {string} */
1070
+ kind: "session" | "api-key";
1071
+ /** @enum {string|null} */
1072
+ role: "viewer" | "member" | "admin" | null;
1073
+ /** @enum {string|null} */
1074
+ apiPlan: "viewer" | "member" | "enterprise" | null;
1075
+ };
1076
+ access: {
1077
+ /** @enum {string} */
1078
+ requiredCapability: "canUseBeanMatching";
1079
+ /** @enum {boolean} */
1080
+ canUseBeanMatching: true;
1081
+ };
1082
+ query: {
1083
+ threshold: number;
1084
+ limit: number;
1085
+ stockedOnly: boolean;
1086
+ /** @enum {string} */
1087
+ mode: "all" | "likely_same" | "similar_profile";
1088
+ };
1089
+ copy: {
1090
+ confidence: string;
1091
+ };
1092
+ /** @enum {string} */
1093
+ classification_version: "canonical-match-v1";
1094
+ /** @enum {string} */
1095
+ query_strategy: "bounded-vector-candidates-v1" | "canonical-vector-aggregated-v2" | "legacy-vector-aggregated-v1";
1096
+ };
1097
+ };
1098
+ SourcingBriefCriteria: {
1099
+ /** @enum {number} */
1100
+ version?: 1;
1101
+ country?: string;
1102
+ region?: string;
1103
+ processing?: string;
1104
+ processing_base_method?: string;
1105
+ max_price_per_lb?: number;
1106
+ stocked_only?: boolean;
1107
+ wholesale_only?: boolean;
1108
+ stocked_days?: number;
1109
+ };
1110
+ SourcingBriefResource: {
1111
+ id: string;
1112
+ name: string;
1113
+ criteria: components["schemas"]["SourcingBriefCriteria"] & Record<string, never>;
1114
+ /** @enum {string} */
1115
+ cadence: "manual";
1116
+ isActive: boolean;
1117
+ lastRunAt: string | null;
1118
+ createdAt: string;
1119
+ updatedAt: string;
1120
+ };
1121
+ SourcingBriefsListResponse: {
1122
+ data: components["schemas"]["SourcingBriefResource"][];
1123
+ meta: {
1124
+ /** @enum {string} */
1125
+ resource: "procurement-briefs";
1126
+ /** @enum {string} */
1127
+ namespace: "/v1/procurement/briefs";
1128
+ /** @enum {string} */
1129
+ version: "v1";
1130
+ auth: {
1131
+ /** @enum {string} */
1132
+ kind: "session" | "api-key";
1133
+ /** @enum {string|null} */
1134
+ role: "admin" | "member" | "viewer" | null;
1135
+ /** @enum {string|null} */
1136
+ apiPlan: "viewer" | "member" | "enterprise" | null;
1137
+ };
1138
+ };
1139
+ };
1140
+ SourcingBriefResponse: {
1141
+ data: components["schemas"]["SourcingBriefResource"];
1142
+ meta: {
1143
+ /** @enum {string} */
1144
+ resource: "procurement-brief";
1145
+ /** @enum {string} */
1146
+ namespace: "/v1/procurement/briefs" | "/v1/procurement/briefs/:id";
1147
+ /** @enum {string} */
1148
+ version: "v1";
1149
+ auth: {
1150
+ /** @enum {string} */
1151
+ kind: "session" | "api-key";
1152
+ /** @enum {string|null} */
1153
+ role: "admin" | "member" | "viewer" | null;
1154
+ /** @enum {string|null} */
1155
+ apiPlan: "viewer" | "member" | "enterprise" | null;
1156
+ };
1157
+ };
1158
+ };
1159
+ SourcingBriefCreateRequest: {
1160
+ /** @description Human label, 1-120 chars. */
1161
+ name: string;
1162
+ criteria: components["schemas"]["SourcingBriefCriteria"] & unknown;
1163
+ /** @enum {string} */
1164
+ cadence?: "manual";
1165
+ };
1166
+ SourcingBriefMatch: {
1167
+ id: number;
1168
+ name?: string | null;
1169
+ source?: string | null;
1170
+ continent?: string | null;
1171
+ country?: string | null;
1172
+ region?: string | null;
1173
+ processing?: string | null;
1174
+ processing_base_method?: string | null;
1175
+ fermentation_type?: string | null;
1176
+ drying_method?: string | null;
1177
+ cultivar_detail?: string | null;
1178
+ type?: string | null;
1179
+ grade?: string | null;
1180
+ appearance?: string | null;
1181
+ score_value?: number | null;
1182
+ purveyor_score?: number | null;
1183
+ cost_lb?: number | null;
1184
+ price_per_lb?: number | null;
1185
+ price_tiers?: unknown;
1186
+ arrival_date?: string | null;
1187
+ stocked_date?: string | null;
1188
+ stocked?: boolean | null;
1189
+ wholesale?: boolean | null;
1190
+ public_coffee?: boolean | null;
1191
+ matchReasons: string[];
1192
+ };
1193
+ SourcingBriefMatchesResponse: {
1194
+ data: components["schemas"]["SourcingBriefMatch"][];
1195
+ pagination: {
1196
+ page: number;
1197
+ limit: number;
1198
+ total: number;
1199
+ totalPages: number;
1200
+ hasNext: boolean;
1201
+ hasPrev: boolean;
1202
+ };
1203
+ meta: {
1204
+ /** @enum {string} */
1205
+ resource: "procurement-brief-matches";
1206
+ /** @enum {string} */
1207
+ namespace: "/v1/procurement/briefs/:id/matches";
1208
+ /** @enum {string} */
1209
+ version: "v1";
1210
+ generatedAt: string;
1211
+ auth: {
1212
+ /** @enum {string} */
1213
+ kind: "session" | "api-key";
1214
+ /** @enum {string|null} */
1215
+ role: "admin" | "member" | "viewer" | null;
1216
+ /** @enum {string|null} */
1217
+ apiPlan: "viewer" | "member" | "enterprise" | null;
1218
+ };
1219
+ brief: components["schemas"]["SourcingBriefResource"];
1220
+ criteria: components["schemas"]["SourcingBriefCriteria"] & Record<string, never>;
1221
+ limitations: string[];
1222
+ };
1223
+ };
1224
+ };
1225
+ responses: never;
1226
+ parameters: never;
1227
+ requestBodies: never;
1228
+ headers: never;
1229
+ pathItems: never;
1230
+ }
1231
+
1232
+ interface ParchmentClientOptions {
1233
+ /** Base URL of the Parchment API, e.g. https://api.purveyors.io */
1234
+ baseUrl: string;
1235
+ /**
1236
+ * Optional bearer token (a Supabase JWT or, later, an API key). Sent as
1237
+ * `Authorization: Bearer <token>`. Auth is resolved server-side against the
1238
+ * unified principal model; the SDK only forwards the credential.
1239
+ */
1240
+ token?: string;
1241
+ /** Override the fetch implementation (useful for tests or custom runtimes). */
1242
+ fetch?: ClientOptions["fetch"];
1243
+ }
1244
+ /**
1245
+ * Create a typed Parchment API client.
1246
+ *
1247
+ * The generated core (openapi-fetch over the generated `paths` types) is the
1248
+ * contract truth; the small named helpers below are the hand-maintained
1249
+ * ergonomic layer and grow as endpoints land.
1250
+ */
1251
+ declare function createParchmentClient(options: ParchmentClientOptions): {
1252
+ /** The underlying typed openapi-fetch client for direct path access. */
1253
+ raw: openapi_fetch.Client<paths, `${string}/${string}`>;
1254
+ /** Liveness and service identity. */
1255
+ health: () => Promise<openapi_fetch.FetchResponse<{
1256
+ parameters: {
1257
+ query?: never;
1258
+ header?: never;
1259
+ path?: never;
1260
+ cookie?: never;
1261
+ };
1262
+ requestBody?: never;
1263
+ responses: {
1264
+ 200: {
1265
+ headers: {
1266
+ [name: string]: unknown;
1267
+ };
1268
+ content: {
1269
+ "application/json": components["schemas"]["HealthResponse"];
1270
+ };
1271
+ };
1272
+ };
1273
+ }, openapi_fetch.FetchOptions<{
1274
+ parameters: {
1275
+ query?: never;
1276
+ header?: never;
1277
+ path?: never;
1278
+ cookie?: never;
1279
+ };
1280
+ requestBody?: never;
1281
+ responses: {
1282
+ 200: {
1283
+ headers: {
1284
+ [name: string]: unknown;
1285
+ };
1286
+ content: {
1287
+ "application/json": components["schemas"]["HealthResponse"];
1288
+ };
1289
+ };
1290
+ };
1291
+ }> | undefined, `${string}/${string}`>>;
1292
+ };
1293
+ type ParchmentClient = ReturnType<typeof createParchmentClient>;
1294
+
1295
+ export { type ParchmentClient, type ParchmentClientOptions, type components, createParchmentClient, type paths };
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ // src/client.ts
2
+ import createClient from "openapi-fetch";
3
+ function createParchmentClient(options) {
4
+ const { baseUrl, token, fetch: fetchImpl } = options;
5
+ const client = createClient({
6
+ baseUrl,
7
+ fetch: fetchImpl,
8
+ headers: token ? { Authorization: `Bearer ${token}` } : void 0
9
+ });
10
+ return {
11
+ /** The underlying typed openapi-fetch client for direct path access. */
12
+ raw: client,
13
+ /** Liveness and service identity. */
14
+ health: () => client.GET("/health")
15
+ };
16
+ }
17
+ export {
18
+ createParchmentClient
19
+ };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts"],"sourcesContent":["import createClient, { type ClientOptions } from \"openapi-fetch\";\nimport type { paths } from \"./schema\";\n\nexport interface ParchmentClientOptions {\n /** Base URL of the Parchment API, e.g. https://api.purveyors.io */\n baseUrl: string;\n /**\n * Optional bearer token (a Supabase JWT or, later, an API key). Sent as\n * `Authorization: Bearer <token>`. Auth is resolved server-side against the\n * unified principal model; the SDK only forwards the credential.\n */\n token?: string;\n /** Override the fetch implementation (useful for tests or custom runtimes). */\n fetch?: ClientOptions[\"fetch\"];\n}\n\n/**\n * Create a typed Parchment API client.\n *\n * The generated core (openapi-fetch over the generated `paths` types) is the\n * contract truth; the small named helpers below are the hand-maintained\n * ergonomic layer and grow as endpoints land.\n */\nexport function createParchmentClient(options: ParchmentClientOptions) {\n const { baseUrl, token, fetch: fetchImpl } = options;\n\n const client = createClient<paths>({\n baseUrl,\n fetch: fetchImpl,\n headers: token ? { Authorization: `Bearer ${token}` } : undefined,\n });\n\n return {\n /** The underlying typed openapi-fetch client for direct path access. */\n raw: client,\n /** Liveness and service identity. */\n health: () => client.GET(\"/health\"),\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AAuB1C,SAAS,sBAAsB,SAAiC;AACrE,QAAM,EAAE,SAAS,OAAO,OAAO,UAAU,IAAI;AAE7C,QAAM,SAAS,aAAoB;AAAA,IACjC;AAAA,IACA,OAAO;AAAA,IACP,SAAS,QAAQ,EAAE,eAAe,UAAU,KAAK,GAAG,IAAI;AAAA,EAC1D,CAAC;AAED,SAAO;AAAA;AAAA,IAEL,KAAK;AAAA;AAAA,IAEL,QAAQ,MAAM,OAAO,IAAI,SAAS;AAAA,EACpC;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purveyors/sdk",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "description": "Typed client for the Purveyors Parchment API, generated from its OpenAPI spec.",
5
5
  "license": "MIT",
6
6
  "type": "module",