@purveyors/sdk 0.25.0 → 0.27.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/index.d.ts +736 -25
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -192,6 +192,500 @@ interface paths {
|
|
|
192
192
|
patch?: never;
|
|
193
193
|
trace?: never;
|
|
194
194
|
};
|
|
195
|
+
"/v1/checkout-admissions": {
|
|
196
|
+
parameters: {
|
|
197
|
+
query?: never;
|
|
198
|
+
header?: never;
|
|
199
|
+
path?: never;
|
|
200
|
+
cookie?: never;
|
|
201
|
+
};
|
|
202
|
+
get?: never;
|
|
203
|
+
put?: never;
|
|
204
|
+
/**
|
|
205
|
+
* Acquire a durable Stripe Checkout admission
|
|
206
|
+
* @description Session-only dark-launch boundary. Acquire before creating Stripe state; replay the same request id after an ambiguous client failure and use admissionId as the Stripe idempotency key.
|
|
207
|
+
*/
|
|
208
|
+
post: {
|
|
209
|
+
parameters: {
|
|
210
|
+
query?: never;
|
|
211
|
+
header?: never;
|
|
212
|
+
path?: never;
|
|
213
|
+
cookie?: never;
|
|
214
|
+
};
|
|
215
|
+
requestBody: {
|
|
216
|
+
content: {
|
|
217
|
+
"application/json": {
|
|
218
|
+
/** Format: uuid */
|
|
219
|
+
requestId: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
responses: {
|
|
224
|
+
/** @description Durable owner-bound Checkout admission */
|
|
225
|
+
200: {
|
|
226
|
+
headers: {
|
|
227
|
+
[name: string]: unknown;
|
|
228
|
+
};
|
|
229
|
+
content: {
|
|
230
|
+
"application/json": components["schemas"]["CheckoutAdmission"];
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
/** @description Malformed request */
|
|
234
|
+
400: {
|
|
235
|
+
headers: {
|
|
236
|
+
[name: string]: unknown;
|
|
237
|
+
};
|
|
238
|
+
content: {
|
|
239
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
/** @description A valid Supabase user session is required */
|
|
243
|
+
401: {
|
|
244
|
+
headers: {
|
|
245
|
+
[name: string]: unknown;
|
|
246
|
+
};
|
|
247
|
+
content: {
|
|
248
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
/** @description Checkout is fenced by account deletion */
|
|
252
|
+
409: {
|
|
253
|
+
headers: {
|
|
254
|
+
[name: string]: unknown;
|
|
255
|
+
};
|
|
256
|
+
content: {
|
|
257
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
/** @description The owner mutation throttle was exceeded */
|
|
261
|
+
429: {
|
|
262
|
+
headers: {
|
|
263
|
+
[name: string]: unknown;
|
|
264
|
+
};
|
|
265
|
+
content: {
|
|
266
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
/** @description Checkout admission storage is unavailable */
|
|
270
|
+
503: {
|
|
271
|
+
headers: {
|
|
272
|
+
[name: string]: unknown;
|
|
273
|
+
};
|
|
274
|
+
content: {
|
|
275
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
delete?: never;
|
|
281
|
+
options?: never;
|
|
282
|
+
head?: never;
|
|
283
|
+
patch?: never;
|
|
284
|
+
trace?: never;
|
|
285
|
+
};
|
|
286
|
+
"/v1/checkout-admissions/{admissionId}/publish": {
|
|
287
|
+
parameters: {
|
|
288
|
+
query?: never;
|
|
289
|
+
header?: never;
|
|
290
|
+
path?: never;
|
|
291
|
+
cookie?: never;
|
|
292
|
+
};
|
|
293
|
+
get?: never;
|
|
294
|
+
put?: never;
|
|
295
|
+
/**
|
|
296
|
+
* Publish the Stripe session created for an admission
|
|
297
|
+
* @description Dark-launch trusted coffee BFF boundary. Requires the owner session plus provider credential so an owner cannot attach an arbitrary Stripe Checkout Session to the admission ledger. Publication is idempotent for the same admission and Stripe session.
|
|
298
|
+
*/
|
|
299
|
+
post: {
|
|
300
|
+
parameters: {
|
|
301
|
+
query?: never;
|
|
302
|
+
header: {
|
|
303
|
+
"x-account-deletion-provider-credential": string;
|
|
304
|
+
};
|
|
305
|
+
path: {
|
|
306
|
+
admissionId: string;
|
|
307
|
+
};
|
|
308
|
+
cookie?: never;
|
|
309
|
+
};
|
|
310
|
+
requestBody: {
|
|
311
|
+
content: {
|
|
312
|
+
"application/json": {
|
|
313
|
+
stripeSessionId: string;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
responses: {
|
|
318
|
+
/** @description Published Checkout admission */
|
|
319
|
+
200: {
|
|
320
|
+
headers: {
|
|
321
|
+
[name: string]: unknown;
|
|
322
|
+
};
|
|
323
|
+
content: {
|
|
324
|
+
"application/json": components["schemas"]["CheckoutAdmission"];
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
/** @description Malformed request */
|
|
328
|
+
400: {
|
|
329
|
+
headers: {
|
|
330
|
+
[name: string]: unknown;
|
|
331
|
+
};
|
|
332
|
+
content: {
|
|
333
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
/** @description A valid Supabase user session is required */
|
|
337
|
+
401: {
|
|
338
|
+
headers: {
|
|
339
|
+
[name: string]: unknown;
|
|
340
|
+
};
|
|
341
|
+
content: {
|
|
342
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
/** @description Trusted provider authorization is required */
|
|
346
|
+
403: {
|
|
347
|
+
headers: {
|
|
348
|
+
[name: string]: unknown;
|
|
349
|
+
};
|
|
350
|
+
content: {
|
|
351
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
/** @description Admission not found */
|
|
355
|
+
404: {
|
|
356
|
+
headers: {
|
|
357
|
+
[name: string]: unknown;
|
|
358
|
+
};
|
|
359
|
+
content: {
|
|
360
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
/** @description Checkout is fenced by account deletion */
|
|
364
|
+
409: {
|
|
365
|
+
headers: {
|
|
366
|
+
[name: string]: unknown;
|
|
367
|
+
};
|
|
368
|
+
content: {
|
|
369
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
/** @description The owner mutation throttle was exceeded */
|
|
373
|
+
429: {
|
|
374
|
+
headers: {
|
|
375
|
+
[name: string]: unknown;
|
|
376
|
+
};
|
|
377
|
+
content: {
|
|
378
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
/** @description Checkout admission storage is unavailable */
|
|
382
|
+
503: {
|
|
383
|
+
headers: {
|
|
384
|
+
[name: string]: unknown;
|
|
385
|
+
};
|
|
386
|
+
content: {
|
|
387
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
delete?: never;
|
|
393
|
+
options?: never;
|
|
394
|
+
head?: never;
|
|
395
|
+
patch?: never;
|
|
396
|
+
trace?: never;
|
|
397
|
+
};
|
|
398
|
+
"/v1/checkout-admissions/{admissionId}/abandon": {
|
|
399
|
+
parameters: {
|
|
400
|
+
query?: never;
|
|
401
|
+
header?: never;
|
|
402
|
+
path?: never;
|
|
403
|
+
cookie?: never;
|
|
404
|
+
};
|
|
405
|
+
get?: never;
|
|
406
|
+
put?: never;
|
|
407
|
+
/**
|
|
408
|
+
* Resolve a Checkout admission with definite no-session evidence
|
|
409
|
+
* @description Dark-launch trusted coffee BFF boundary. Requires the owner session plus provider credential. Call only after Stripe authoritatively proves no Checkout Session exists for the admission idempotency key; an ordinary user session cannot erase creating-state ambiguity.
|
|
410
|
+
*/
|
|
411
|
+
post: {
|
|
412
|
+
parameters: {
|
|
413
|
+
query?: never;
|
|
414
|
+
header: {
|
|
415
|
+
"x-account-deletion-provider-credential": string;
|
|
416
|
+
};
|
|
417
|
+
path: {
|
|
418
|
+
admissionId: string;
|
|
419
|
+
};
|
|
420
|
+
cookie?: never;
|
|
421
|
+
};
|
|
422
|
+
requestBody: {
|
|
423
|
+
content: {
|
|
424
|
+
"application/json": {
|
|
425
|
+
/** @enum {string} */
|
|
426
|
+
evidence: "stripe_creation_definitively_absent";
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
responses: {
|
|
431
|
+
/** @description Closed Checkout admission */
|
|
432
|
+
200: {
|
|
433
|
+
headers: {
|
|
434
|
+
[name: string]: unknown;
|
|
435
|
+
};
|
|
436
|
+
content: {
|
|
437
|
+
"application/json": components["schemas"]["CheckoutAdmission"];
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
/** @description Malformed request or evidence */
|
|
441
|
+
400: {
|
|
442
|
+
headers: {
|
|
443
|
+
[name: string]: unknown;
|
|
444
|
+
};
|
|
445
|
+
content: {
|
|
446
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
/** @description A valid Supabase user session is required */
|
|
450
|
+
401: {
|
|
451
|
+
headers: {
|
|
452
|
+
[name: string]: unknown;
|
|
453
|
+
};
|
|
454
|
+
content: {
|
|
455
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
456
|
+
};
|
|
457
|
+
};
|
|
458
|
+
/** @description Trusted provider authorization is required */
|
|
459
|
+
403: {
|
|
460
|
+
headers: {
|
|
461
|
+
[name: string]: unknown;
|
|
462
|
+
};
|
|
463
|
+
content: {
|
|
464
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
/** @description Creating admission not found */
|
|
468
|
+
404: {
|
|
469
|
+
headers: {
|
|
470
|
+
[name: string]: unknown;
|
|
471
|
+
};
|
|
472
|
+
content: {
|
|
473
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/** @description The owner mutation throttle was exceeded */
|
|
477
|
+
429: {
|
|
478
|
+
headers: {
|
|
479
|
+
[name: string]: unknown;
|
|
480
|
+
};
|
|
481
|
+
content: {
|
|
482
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
/** @description Checkout admission storage is unavailable */
|
|
486
|
+
503: {
|
|
487
|
+
headers: {
|
|
488
|
+
[name: string]: unknown;
|
|
489
|
+
};
|
|
490
|
+
content: {
|
|
491
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
492
|
+
};
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
delete?: never;
|
|
497
|
+
options?: never;
|
|
498
|
+
head?: never;
|
|
499
|
+
patch?: never;
|
|
500
|
+
trace?: never;
|
|
501
|
+
};
|
|
502
|
+
"/v1/checkout-admissions/provider-eligibility": {
|
|
503
|
+
parameters: {
|
|
504
|
+
query?: never;
|
|
505
|
+
header?: never;
|
|
506
|
+
path?: never;
|
|
507
|
+
cookie?: never;
|
|
508
|
+
};
|
|
509
|
+
get?: never;
|
|
510
|
+
put?: never;
|
|
511
|
+
/**
|
|
512
|
+
* Check whether provider writes remain eligible
|
|
513
|
+
* @description Dark-launch internal webhook boundary. Requires the shared provider-finalization credential and returns false for missing, closed, cross-owner, or deletion-fenced admissions.
|
|
514
|
+
*/
|
|
515
|
+
post: {
|
|
516
|
+
parameters: {
|
|
517
|
+
query?: never;
|
|
518
|
+
header: {
|
|
519
|
+
"x-account-deletion-provider-credential": string;
|
|
520
|
+
};
|
|
521
|
+
path?: never;
|
|
522
|
+
cookie?: never;
|
|
523
|
+
};
|
|
524
|
+
requestBody: {
|
|
525
|
+
content: {
|
|
526
|
+
"application/json": {
|
|
527
|
+
/** Format: uuid */
|
|
528
|
+
ownerId: string;
|
|
529
|
+
/** Format: uuid */
|
|
530
|
+
admissionId: string;
|
|
531
|
+
stripeSessionId: string;
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
};
|
|
535
|
+
responses: {
|
|
536
|
+
/** @description Provider write eligibility */
|
|
537
|
+
200: {
|
|
538
|
+
headers: {
|
|
539
|
+
[name: string]: unknown;
|
|
540
|
+
};
|
|
541
|
+
content: {
|
|
542
|
+
"application/json": {
|
|
543
|
+
eligible: boolean;
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
/** @description Malformed request */
|
|
548
|
+
400: {
|
|
549
|
+
headers: {
|
|
550
|
+
[name: string]: unknown;
|
|
551
|
+
};
|
|
552
|
+
content: {
|
|
553
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
/** @description Trusted provider authorization is required */
|
|
557
|
+
403: {
|
|
558
|
+
headers: {
|
|
559
|
+
[name: string]: unknown;
|
|
560
|
+
};
|
|
561
|
+
content: {
|
|
562
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
/** @description Eligibility storage is unavailable */
|
|
566
|
+
503: {
|
|
567
|
+
headers: {
|
|
568
|
+
[name: string]: unknown;
|
|
569
|
+
};
|
|
570
|
+
content: {
|
|
571
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
delete?: never;
|
|
577
|
+
options?: never;
|
|
578
|
+
head?: never;
|
|
579
|
+
patch?: never;
|
|
580
|
+
trace?: never;
|
|
581
|
+
};
|
|
582
|
+
"/v1/checkout-admissions/provider-terminalization": {
|
|
583
|
+
parameters: {
|
|
584
|
+
query?: never;
|
|
585
|
+
header?: never;
|
|
586
|
+
path?: never;
|
|
587
|
+
cookie?: never;
|
|
588
|
+
};
|
|
589
|
+
get?: never;
|
|
590
|
+
put?: never;
|
|
591
|
+
/**
|
|
592
|
+
* Close a provider-terminal Checkout admission
|
|
593
|
+
* @description Dark-launch trusted webhook boundary for an expired Checkout Session. Completed or paid sessions remain published until account deletion verifies their authoritative Stripe billing state.
|
|
594
|
+
*/
|
|
595
|
+
post: {
|
|
596
|
+
parameters: {
|
|
597
|
+
query?: never;
|
|
598
|
+
header: {
|
|
599
|
+
"x-account-deletion-provider-credential": string;
|
|
600
|
+
};
|
|
601
|
+
path?: never;
|
|
602
|
+
cookie?: never;
|
|
603
|
+
};
|
|
604
|
+
requestBody: {
|
|
605
|
+
content: {
|
|
606
|
+
"application/json": {
|
|
607
|
+
/** Format: uuid */
|
|
608
|
+
ownerId: string;
|
|
609
|
+
/** Format: uuid */
|
|
610
|
+
admissionId: string;
|
|
611
|
+
stripeSessionId: string;
|
|
612
|
+
/** @enum {string} */
|
|
613
|
+
terminalStatus: "expired";
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
responses: {
|
|
618
|
+
/** @description Closed provider-terminal Checkout admission */
|
|
619
|
+
200: {
|
|
620
|
+
headers: {
|
|
621
|
+
[name: string]: unknown;
|
|
622
|
+
};
|
|
623
|
+
content: {
|
|
624
|
+
"application/json": components["schemas"]["CheckoutAdmission"];
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
/** @description Malformed request */
|
|
628
|
+
400: {
|
|
629
|
+
headers: {
|
|
630
|
+
[name: string]: unknown;
|
|
631
|
+
};
|
|
632
|
+
content: {
|
|
633
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
/** @description Trusted provider authorization is required */
|
|
637
|
+
403: {
|
|
638
|
+
headers: {
|
|
639
|
+
[name: string]: unknown;
|
|
640
|
+
};
|
|
641
|
+
content: {
|
|
642
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
/** @description Published admission not found */
|
|
646
|
+
404: {
|
|
647
|
+
headers: {
|
|
648
|
+
[name: string]: unknown;
|
|
649
|
+
};
|
|
650
|
+
content: {
|
|
651
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
/** @description Account deletion owns Checkout reconciliation */
|
|
655
|
+
409: {
|
|
656
|
+
headers: {
|
|
657
|
+
[name: string]: unknown;
|
|
658
|
+
};
|
|
659
|
+
content: {
|
|
660
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
/** @description The owner mutation throttle was exceeded */
|
|
664
|
+
429: {
|
|
665
|
+
headers: {
|
|
666
|
+
[name: string]: unknown;
|
|
667
|
+
};
|
|
668
|
+
content: {
|
|
669
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
/** @description Checkout admission storage is unavailable */
|
|
673
|
+
503: {
|
|
674
|
+
headers: {
|
|
675
|
+
[name: string]: unknown;
|
|
676
|
+
};
|
|
677
|
+
content: {
|
|
678
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
delete?: never;
|
|
684
|
+
options?: never;
|
|
685
|
+
head?: never;
|
|
686
|
+
patch?: never;
|
|
687
|
+
trace?: never;
|
|
688
|
+
};
|
|
195
689
|
"/v1/account-deletion/provider-finalization": {
|
|
196
690
|
parameters: {
|
|
197
691
|
query?: never;
|
|
@@ -5188,7 +5682,7 @@ interface components {
|
|
|
5188
5682
|
/** Format: uuid */
|
|
5189
5683
|
operationId: string;
|
|
5190
5684
|
/** @enum {string} */
|
|
5191
|
-
status: "awaiting_provider_finalization" | "ready" | "processing" | "retryable" | "completed";
|
|
5685
|
+
status: "fencing_checkout" | "awaiting_provider_finalization" | "ready" | "processing" | "retryable" | "completed";
|
|
5192
5686
|
};
|
|
5193
5687
|
ErrorResponse: {
|
|
5194
5688
|
error: {
|
|
@@ -5196,6 +5690,13 @@ interface components {
|
|
|
5196
5690
|
message: string;
|
|
5197
5691
|
};
|
|
5198
5692
|
};
|
|
5693
|
+
CheckoutAdmission: {
|
|
5694
|
+
/** Format: uuid */
|
|
5695
|
+
admissionId: string;
|
|
5696
|
+
/** @enum {string} */
|
|
5697
|
+
status: "creating" | "published" | "closed";
|
|
5698
|
+
stripeSessionId: string | null;
|
|
5699
|
+
};
|
|
5199
5700
|
ApiKeyRecord: {
|
|
5200
5701
|
/** Format: uuid */
|
|
5201
5702
|
id: string;
|
|
@@ -6794,7 +7295,9 @@ interface components {
|
|
|
6794
7295
|
id: number;
|
|
6795
7296
|
rank: number | null;
|
|
6796
7297
|
notes: string | null;
|
|
6797
|
-
cupping_notes: string |
|
|
7298
|
+
cupping_notes: string | number | boolean | unknown[] | {
|
|
7299
|
+
[key: string]: unknown;
|
|
7300
|
+
} | null;
|
|
6798
7301
|
purchase_date: string | null;
|
|
6799
7302
|
purchased_qty_lbs: number | null;
|
|
6800
7303
|
bean_cost: number | null;
|
|
@@ -6970,6 +7473,14 @@ interface components {
|
|
|
6970
7473
|
/** @description Tax and shipping cost. */
|
|
6971
7474
|
taxShip?: number;
|
|
6972
7475
|
notes?: string;
|
|
7476
|
+
/** @description Owner-assigned integer ranking for this inventory lot (PostgreSQL integer range). */
|
|
7477
|
+
rank?: number | null;
|
|
7478
|
+
/** @description Explicit stock-state override. When omitted, stock is derived from purchased quantity. */
|
|
7479
|
+
stocked?: boolean;
|
|
7480
|
+
/** @description Owner cupping data stored as JSON. */
|
|
7481
|
+
cuppingNotes?: string | number | boolean | unknown[] | {
|
|
7482
|
+
[key: string]: unknown;
|
|
7483
|
+
} | null;
|
|
6973
7484
|
/** @description Existing coffee_catalog.id this inventory lot is bought from. */
|
|
6974
7485
|
catalogId: number;
|
|
6975
7486
|
/** @enum {string} */
|
|
@@ -6992,10 +7503,16 @@ interface components {
|
|
|
6992
7503
|
InventoryCreateRequest: components["schemas"]["CatalogInventoryCreateRequest"] | components["schemas"]["ManualInventoryCreateRequest"];
|
|
6993
7504
|
InventoryUpdateRequest: {
|
|
6994
7505
|
qty?: number;
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
7506
|
+
purchaseDate?: string;
|
|
7507
|
+
cost?: number | null;
|
|
7508
|
+
taxShip?: number | null;
|
|
7509
|
+
notes?: string | null;
|
|
6998
7510
|
stocked?: boolean;
|
|
7511
|
+
/** @description Owner-assigned integer ranking for this inventory lot (PostgreSQL integer range). */
|
|
7512
|
+
rank?: number | null;
|
|
7513
|
+
cuppingNotes?: string | number | boolean | unknown[] | {
|
|
7514
|
+
[key: string]: unknown;
|
|
7515
|
+
} | null;
|
|
6999
7516
|
};
|
|
7000
7517
|
InventoryDeleteResponse: {
|
|
7001
7518
|
data: {
|
|
@@ -7827,6 +8344,14 @@ type OwnerApiUsage = components["schemas"]["OwnerApiUsageResponse"];
|
|
|
7827
8344
|
type MarketReadPreferenceRequest = NonNullable<paths["/v1/email-subscriptions/market-read"]["put"]["requestBody"]>["content"]["application/json"];
|
|
7828
8345
|
/** Durable state returned by an account-deletion request. */
|
|
7829
8346
|
type AccountDeletionOperation = components["schemas"]["AccountDeletionOperation"];
|
|
8347
|
+
/** Idempotency input for acquiring a durable Stripe Checkout admission. */
|
|
8348
|
+
type CheckoutAdmissionAcquireRequest = NonNullable<paths["/v1/checkout-admissions"]["post"]["requestBody"]>["content"]["application/json"];
|
|
8349
|
+
/** Stripe publication input for an acquired Checkout admission. */
|
|
8350
|
+
type CheckoutAdmissionPublishRequest = NonNullable<paths["/v1/checkout-admissions/{admissionId}/publish"]["post"]["requestBody"]>["content"]["application/json"];
|
|
8351
|
+
/** Trusted provider header required when publishing a Checkout admission. */
|
|
8352
|
+
type CheckoutAdmissionPublishHeaders = NonNullable<paths["/v1/checkout-admissions/{admissionId}/publish"]["post"]["parameters"]["header"]>;
|
|
8353
|
+
/** Durable state returned by Checkout admission mutations. */
|
|
8354
|
+
type CheckoutAdmission = components["schemas"]["CheckoutAdmission"];
|
|
7830
8355
|
type CliAuthRequestCreate = NonNullable<paths["/v1/cli-auth/requests"]["post"]["requestBody"]>["content"]["application/json"];
|
|
7831
8356
|
type CliAuthInspectRequest = NonNullable<paths["/v1/cli-auth/inspect"]["post"]["requestBody"]>["content"]["application/json"];
|
|
7832
8357
|
type CliAuthApproveRequest = NonNullable<paths["/v1/cli-auth/approve"]["post"]["requestBody"]>["content"]["application/json"];
|
|
@@ -7924,7 +8449,12 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
7924
8449
|
parameters: {
|
|
7925
8450
|
query?: never;
|
|
7926
8451
|
header?: never;
|
|
7927
|
-
path
|
|
8452
|
+
path? /**
|
|
8453
|
+
* Replace the Artisan import data on one of the caller's existing roasts,
|
|
8454
|
+
* re-deriving its curve, events, and computed metrics while preserving the
|
|
8455
|
+
* roast's identity. Pass `ifMatch` (the roast's `last_updated`) to enable
|
|
8456
|
+
* optimistic concurrency (409 on mismatch).
|
|
8457
|
+
*/: never;
|
|
7928
8458
|
cookie?: never;
|
|
7929
8459
|
};
|
|
7930
8460
|
requestBody?: never;
|
|
@@ -7982,7 +8512,12 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
7982
8512
|
parameters: {
|
|
7983
8513
|
query?: never;
|
|
7984
8514
|
header?: never;
|
|
7985
|
-
path
|
|
8515
|
+
path? /**
|
|
8516
|
+
* Replace the Artisan import data on one of the caller's existing roasts,
|
|
8517
|
+
* re-deriving its curve, events, and computed metrics while preserving the
|
|
8518
|
+
* roast's identity. Pass `ifMatch` (the roast's `last_updated`) to enable
|
|
8519
|
+
* optimistic concurrency (409 on mismatch).
|
|
8520
|
+
*/: never;
|
|
7986
8521
|
cookie?: never;
|
|
7987
8522
|
};
|
|
7988
8523
|
requestBody?: never;
|
|
@@ -8075,11 +8610,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
8075
8610
|
[name: string]: unknown;
|
|
8076
8611
|
};
|
|
8077
8612
|
content: {
|
|
8078
|
-
"application/json": components["schemas"]
|
|
8079
|
-
* Idempotently request deletion for the authenticated session owner.
|
|
8080
|
-
* Provider finalization is intentionally available only through `raw`
|
|
8081
|
-
* because it also requires a trusted BFF server credential.
|
|
8082
|
-
*/["ErrorResponse"];
|
|
8613
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
8083
8614
|
};
|
|
8084
8615
|
};
|
|
8085
8616
|
403: {
|
|
@@ -8230,10 +8761,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
8230
8761
|
[name: string]: unknown;
|
|
8231
8762
|
};
|
|
8232
8763
|
content: {
|
|
8233
|
-
"application/json": components["schemas"]
|
|
8234
|
-
* Delete one of the caller's own inventory rows. Returns 409 if dependent
|
|
8235
|
-
* roast profiles or sales exist (no force-cascade).
|
|
8236
|
-
*/["ErrorResponse"];
|
|
8764
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
8237
8765
|
};
|
|
8238
8766
|
};
|
|
8239
8767
|
503: {
|
|
@@ -8451,11 +8979,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
8451
8979
|
[name: string]: unknown;
|
|
8452
8980
|
};
|
|
8453
8981
|
content: {
|
|
8454
|
-
"application/json": components["schemas"]
|
|
8455
|
-
* Update one of the caller's own sales. The sales table carries no
|
|
8456
|
-
* `last_updated` column, so no If-Match optimistic concurrency is
|
|
8457
|
-
* offered.
|
|
8458
|
-
*/["ErrorResponse"];
|
|
8982
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
8459
8983
|
};
|
|
8460
8984
|
};
|
|
8461
8985
|
503: {
|
|
@@ -8586,6 +9110,178 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
8586
9110
|
};
|
|
8587
9111
|
}> | undefined, `${string}/${string}`>>;
|
|
8588
9112
|
};
|
|
9113
|
+
checkoutAdmissions: {
|
|
9114
|
+
/** Acquire or replay an owner-bound admission before creating Stripe state. */
|
|
9115
|
+
acquire: (body: CheckoutAdmissionAcquireRequest) => Promise<openapi_fetch.FetchResponse<{
|
|
9116
|
+
parameters: {
|
|
9117
|
+
query?: never;
|
|
9118
|
+
header?: never;
|
|
9119
|
+
path?: never;
|
|
9120
|
+
cookie?: never;
|
|
9121
|
+
};
|
|
9122
|
+
requestBody: {
|
|
9123
|
+
content: {
|
|
9124
|
+
"application/json": {
|
|
9125
|
+
requestId: string;
|
|
9126
|
+
};
|
|
9127
|
+
};
|
|
9128
|
+
};
|
|
9129
|
+
responses: {
|
|
9130
|
+
200: {
|
|
9131
|
+
headers: {
|
|
9132
|
+
[name: string]: unknown;
|
|
9133
|
+
};
|
|
9134
|
+
content: {
|
|
9135
|
+
"application/json":
|
|
9136
|
+
/** Query parameters for {@link ParchmentClient.roasts.get}. */
|
|
9137
|
+
components["schemas"]["CheckoutAdmission"];
|
|
9138
|
+
};
|
|
9139
|
+
};
|
|
9140
|
+
400: {
|
|
9141
|
+
headers: {
|
|
9142
|
+
[name: string]: unknown;
|
|
9143
|
+
};
|
|
9144
|
+
content: {
|
|
9145
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9146
|
+
};
|
|
9147
|
+
};
|
|
9148
|
+
401: {
|
|
9149
|
+
headers: {
|
|
9150
|
+
[name: string]: unknown;
|
|
9151
|
+
};
|
|
9152
|
+
content: {
|
|
9153
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9154
|
+
};
|
|
9155
|
+
};
|
|
9156
|
+
409: {
|
|
9157
|
+
headers: {
|
|
9158
|
+
[name: string]: unknown;
|
|
9159
|
+
};
|
|
9160
|
+
content: {
|
|
9161
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9162
|
+
};
|
|
9163
|
+
};
|
|
9164
|
+
429: {
|
|
9165
|
+
headers: {
|
|
9166
|
+
[name: string]: unknown;
|
|
9167
|
+
};
|
|
9168
|
+
content: {
|
|
9169
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9170
|
+
};
|
|
9171
|
+
};
|
|
9172
|
+
503: {
|
|
9173
|
+
headers: {
|
|
9174
|
+
[name: string]: unknown;
|
|
9175
|
+
};
|
|
9176
|
+
content: {
|
|
9177
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9178
|
+
};
|
|
9179
|
+
};
|
|
9180
|
+
};
|
|
9181
|
+
}, {
|
|
9182
|
+
body: {
|
|
9183
|
+
requestId: string;
|
|
9184
|
+
};
|
|
9185
|
+
}, `${string}/${string}`>>;
|
|
9186
|
+
/** Publish a provider-verified Stripe Checkout Session for an admission. */
|
|
9187
|
+
publish: (admissionId: string, body: CheckoutAdmissionPublishRequest, headers: CheckoutAdmissionPublishHeaders) => Promise<openapi_fetch.FetchResponse<{
|
|
9188
|
+
parameters: {
|
|
9189
|
+
query?: never;
|
|
9190
|
+
header: {
|
|
9191
|
+
"x-account-deletion-provider-credential": string;
|
|
9192
|
+
};
|
|
9193
|
+
path: {
|
|
9194
|
+
admissionId: string;
|
|
9195
|
+
};
|
|
9196
|
+
cookie?: never;
|
|
9197
|
+
};
|
|
9198
|
+
requestBody: {
|
|
9199
|
+
content: {
|
|
9200
|
+
"application/json": {
|
|
9201
|
+
stripeSessionId: string;
|
|
9202
|
+
};
|
|
9203
|
+
};
|
|
9204
|
+
};
|
|
9205
|
+
responses: {
|
|
9206
|
+
200: {
|
|
9207
|
+
headers: {
|
|
9208
|
+
[name: string]: unknown;
|
|
9209
|
+
};
|
|
9210
|
+
content: {
|
|
9211
|
+
"application/json": components["schemas"]["CheckoutAdmission"];
|
|
9212
|
+
};
|
|
9213
|
+
};
|
|
9214
|
+
400: {
|
|
9215
|
+
headers: {
|
|
9216
|
+
[name: string]: unknown;
|
|
9217
|
+
};
|
|
9218
|
+
content: {
|
|
9219
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9220
|
+
};
|
|
9221
|
+
};
|
|
9222
|
+
401: {
|
|
9223
|
+
headers: {
|
|
9224
|
+
[name: string]: unknown;
|
|
9225
|
+
};
|
|
9226
|
+
content: {
|
|
9227
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9228
|
+
};
|
|
9229
|
+
};
|
|
9230
|
+
403: {
|
|
9231
|
+
headers: {
|
|
9232
|
+
[name: string]: unknown;
|
|
9233
|
+
};
|
|
9234
|
+
content: {
|
|
9235
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9236
|
+
};
|
|
9237
|
+
};
|
|
9238
|
+
404: {
|
|
9239
|
+
headers: {
|
|
9240
|
+
[name: string]: unknown;
|
|
9241
|
+
};
|
|
9242
|
+
content: {
|
|
9243
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9244
|
+
};
|
|
9245
|
+
};
|
|
9246
|
+
409: {
|
|
9247
|
+
headers: {
|
|
9248
|
+
[name: string]: unknown;
|
|
9249
|
+
};
|
|
9250
|
+
content: {
|
|
9251
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9252
|
+
};
|
|
9253
|
+
};
|
|
9254
|
+
429: {
|
|
9255
|
+
headers: {
|
|
9256
|
+
[name: string]: unknown;
|
|
9257
|
+
};
|
|
9258
|
+
content: {
|
|
9259
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9260
|
+
};
|
|
9261
|
+
};
|
|
9262
|
+
503: {
|
|
9263
|
+
headers: {
|
|
9264
|
+
[name: string]: unknown;
|
|
9265
|
+
};
|
|
9266
|
+
content: {
|
|
9267
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9268
|
+
};
|
|
9269
|
+
};
|
|
9270
|
+
};
|
|
9271
|
+
}, {
|
|
9272
|
+
params: {
|
|
9273
|
+
path: {
|
|
9274
|
+
admissionId: string;
|
|
9275
|
+
};
|
|
9276
|
+
header: {
|
|
9277
|
+
"x-account-deletion-provider-credential": string;
|
|
9278
|
+
};
|
|
9279
|
+
};
|
|
9280
|
+
body: {
|
|
9281
|
+
stripeSessionId: string;
|
|
9282
|
+
};
|
|
9283
|
+
}, `${string}/${string}`>>;
|
|
9284
|
+
};
|
|
8589
9285
|
cliAuth: {
|
|
8590
9286
|
/** Create a signed, short-lived login request bound to a PKCE challenge. */
|
|
8591
9287
|
create: (body: CliAuthRequestCreate) => Promise<openapi_fetch.FetchResponse<{
|
|
@@ -10696,6 +11392,11 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
10696
11392
|
cost?: number;
|
|
10697
11393
|
taxShip?: number;
|
|
10698
11394
|
notes?: string;
|
|
11395
|
+
rank?: number | null;
|
|
11396
|
+
stocked?: boolean;
|
|
11397
|
+
cuppingNotes?: string | number | boolean | unknown[] | {
|
|
11398
|
+
[key: string]: unknown;
|
|
11399
|
+
} | null;
|
|
10699
11400
|
catalogId: number;
|
|
10700
11401
|
manualCoffee?: never;
|
|
10701
11402
|
} | {
|
|
@@ -10796,6 +11497,11 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
10796
11497
|
cost?: number;
|
|
10797
11498
|
taxShip?: number;
|
|
10798
11499
|
notes?: string;
|
|
11500
|
+
rank?: number | null;
|
|
11501
|
+
stocked?: boolean;
|
|
11502
|
+
cuppingNotes?: string | number | boolean | unknown[] | {
|
|
11503
|
+
[key: string]: unknown;
|
|
11504
|
+
} | null;
|
|
10799
11505
|
catalogId: number;
|
|
10800
11506
|
manualCoffee?: never;
|
|
10801
11507
|
} | {
|
|
@@ -11256,10 +11962,15 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
11256
11962
|
};
|
|
11257
11963
|
body: {
|
|
11258
11964
|
qty?: number;
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11965
|
+
purchaseDate?: string;
|
|
11966
|
+
cost?: number | null;
|
|
11967
|
+
taxShip?: number | null;
|
|
11968
|
+
notes?: string | null;
|
|
11262
11969
|
stocked?: boolean;
|
|
11970
|
+
rank?: number | null;
|
|
11971
|
+
cuppingNotes?: string | number | boolean | unknown[] | {
|
|
11972
|
+
[key: string]: unknown;
|
|
11973
|
+
} | null;
|
|
11263
11974
|
};
|
|
11264
11975
|
}, `${string}/${string}`>>;
|
|
11265
11976
|
/**
|
|
@@ -12809,4 +13520,4 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
12809
13520
|
};
|
|
12810
13521
|
type ParchmentClient = ReturnType<typeof createParchmentClient>;
|
|
12811
13522
|
|
|
12812
|
-
export { type AccountDeletionOperation, type BriefMatchesQuery, type CatalogItem, type CatalogListQuery, type CatalogProofSummary, type CatalogSimilarQuery, type InventoryCreateRequest, type InventoryUpdateRequest, type MarketSignalsQuery, type MetadataIndexQuery, type OwnerApiUsage, type OwnerApiUsageQuery, type ParchmentClient, type ParchmentClientOptions, type PriceIndexQuery, type PriceIndexStatsQuery, type ProfitItem, type ProfitListQuery, type RoastChartDataQuery, type SalesCreateRequest, type SalesListQuery, type SalesUpdateRequest, type SourcingBriefCreateRequest, type TrackedLotMutation, type TrackedLotSummary, type TrackedLotsListQuery, type components, createParchmentClient, type paths };
|
|
13523
|
+
export { type AccountDeletionOperation, type BriefMatchesQuery, type CatalogItem, type CatalogListQuery, type CatalogProofSummary, type CatalogSimilarQuery, type CheckoutAdmission, type CheckoutAdmissionAcquireRequest, type CheckoutAdmissionPublishRequest, type InventoryCreateRequest, type InventoryUpdateRequest, type MarketSignalsQuery, type MetadataIndexQuery, type OwnerApiUsage, type OwnerApiUsageQuery, type ParchmentClient, type ParchmentClientOptions, type PriceIndexQuery, type PriceIndexStatsQuery, type ProfitItem, type ProfitListQuery, type RoastChartDataQuery, type SalesCreateRequest, type SalesListQuery, type SalesUpdateRequest, type SourcingBriefCreateRequest, type TrackedLotMutation, type TrackedLotSummary, type TrackedLotsListQuery, type components, createParchmentClient, type paths };
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,15 @@ function createParchmentClient(options) {
|
|
|
57
57
|
*/
|
|
58
58
|
request: () => client.POST("/v1/account-deletion")
|
|
59
59
|
},
|
|
60
|
+
checkoutAdmissions: {
|
|
61
|
+
/** Acquire or replay an owner-bound admission before creating Stripe state. */
|
|
62
|
+
acquire: (body) => client.POST("/v1/checkout-admissions", { body }),
|
|
63
|
+
/** Publish a provider-verified Stripe Checkout Session for an admission. */
|
|
64
|
+
publish: (admissionId, body, headers) => client.POST("/v1/checkout-admissions/{admissionId}/publish", {
|
|
65
|
+
params: { path: { admissionId }, header: headers },
|
|
66
|
+
body
|
|
67
|
+
})
|
|
68
|
+
},
|
|
60
69
|
cliAuth: {
|
|
61
70
|
/** Create a signed, short-lived login request bound to a PKCE challenge. */
|
|
62
71
|
create: (body) => client.POST("/v1/cli-auth/requests", { body }),
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["import createClient, { type ClientOptions } from \"openapi-fetch\";\nimport type { components, 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/** Query parameters for {@link ParchmentClient.catalog.list}. */\nexport type CatalogListQuery = NonNullable<\n paths[\"/v1/catalog\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** A catalog row returned by the canonical listing resource. */\nexport type CatalogItem = components[\"schemas\"][\"CatalogItem\"];\n/** API-owned row-level trust summary returned when `include=proof`. */\nexport type CatalogProofSummary = components[\"schemas\"][\"CatalogProofSummary\"];\n/** Query parameters for {@link ParchmentClient.catalog.facets}. */\nexport type CatalogFacetsQuery = NonNullable<\n paths[\"/v1/catalog/facets\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/**\n * Optional headers for {@link ParchmentClient.catalog.list}, notably the\n * RFC 7240 `Prefer: handling=lenient|strict` override (PADR-0013 §7). Sending\n * `handling=lenient` opts a strict caller (API key or bearer-session JWT) back\n * into strip-with-notice degradation instead of a 401/403 hard-deny.\n */\nexport type CatalogListHeaders = NonNullable<\n paths[\"/v1/catalog\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for {@link ParchmentClient.catalog.facets}; see {@link CatalogListHeaders}. */\nexport type CatalogFacetsHeaders = NonNullable<\n paths[\"/v1/catalog/facets\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.originPriceStats}. */\nexport type CatalogOriginPriceStatsQuery = NonNullable<\n paths[\"/v1/catalog/origin-price-stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.stats}. */\nexport type CatalogStatsQuery = NonNullable<\n paths[\"/v1/catalog/stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.rank}. */\nexport type CatalogRankQuery = NonNullable<\n paths[\"/v1/catalog/rank\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.rankPremium}. */\nexport type CatalogRankPremiumQuery = NonNullable<\n paths[\"/v1/catalog/rank-premium\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.suppliers}. */\nexport type CatalogSuppliersQuery = NonNullable<\n paths[\"/v1/catalog/suppliers\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.supplierDetail}. */\nexport type CatalogSupplierDetailQuery = NonNullable<\n paths[\"/v1/catalog/suppliers/detail\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.supplierRank}. */\nexport type CatalogSupplierRankQuery = NonNullable<\n paths[\"/v1/catalog/suppliers/rank\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Optional headers for ranking endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogRankHeaders = NonNullable<\n paths[\"/v1/catalog/rank\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for premium ranking endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogRankPremiumHeaders = NonNullable<\n paths[\"/v1/catalog/rank-premium\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for supplier aggregate endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogSupplierHeaders = NonNullable<\n paths[\"/v1/catalog/suppliers\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.similar}. */\nexport type CatalogSimilarQuery = NonNullable<\n paths[\"/v1/catalog/{id}/similar\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.list}. */\nexport type PriceIndexQuery = NonNullable<\n paths[\"/v1/price-index\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.history}. */\nexport type PriceIndexHistoryQuery = NonNullable<\n paths[\"/v1/price-index/history\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.market.signals}. */\nexport type MarketSignalsQuery = NonNullable<\n paths[\"/v1/market/signals\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.stats}. */\nexport type PriceIndexStatsQuery = NonNullable<\n paths[\"/v1/price-index/stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.market.metadataIndex}. */\nexport type MetadataIndexQuery = NonNullable<\n paths[\"/v1/market/metadata-index\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.procurement.briefs.matches}. */\nexport type BriefMatchesQuery = NonNullable<\n paths[\"/v1/procurement/briefs/{id}/matches\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.procurement.briefs.create}. */\nexport type SourcingBriefCreateRequest =\n components[\"schemas\"][\"SourcingBriefCreateRequest\"];\n/** Query parameters for {@link ParchmentClient.portfolio.trackedLots.list}. */\nexport type TrackedLotsListQuery = NonNullable<\n paths[\"/v1/portfolio/tracked-lots\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** A tracked catalog lot enriched with current catalog and price state. */\nexport type TrackedLotSummary = components[\"schemas\"][\"TrackedLotSummary\"];\n/** State returned by tracked-lot PUT and DELETE mutations. */\nexport type TrackedLotMutation =\n components[\"schemas\"][\"TrackedLotMutationResponse\"];\n/** Query parameters for {@link ParchmentClient.inventory.list}. */\nexport type InventoryListQuery = NonNullable<\n paths[\"/v1/inventory\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.inventory.create}. */\nexport type InventoryCreateRequest = NonNullable<\n paths[\"/v1/inventory\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\ntype CatalogInventoryCreateRequest =\n components[\"schemas\"][\"CatalogInventoryCreateRequest\"];\ntype ManualInventoryCreateRequest =\n components[\"schemas\"][\"ManualInventoryCreateRequest\"];\n/** Request body for {@link ParchmentClient.inventory.createManualBatch}. */\nexport type ManualInventoryBatchCreateRequest = NonNullable<\n paths[\"/v1/inventory/manual-batches\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for reserving durable server-owned manual-batch intent. */\nexport type ManualInventoryBatchReserveRequest = NonNullable<\n paths[\"/v1/inventory/manual-batches/reservations\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.inventory.update}. */\nexport type InventoryUpdateRequest = NonNullable<\n paths[\"/v1/inventory/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.roasts.list}. */\nexport type RoastListQuery = NonNullable<\n paths[\"/v1/roasts\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.roasts.get}. */\nexport type RoastGetQuery = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.roasts.chartData}. */\nexport type RoastChartDataQuery = NonNullable<\n paths[\"/v1/roasts/{id}/chart-data\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.roasts.classify}. */\nexport type RoastClassificationRequest = NonNullable<\n paths[\"/v1/roasts/classify\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.create}. */\nexport type RoastCreateRequest = NonNullable<\n paths[\"/v1/roasts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.update}. */\nexport type RoastUpdateRequest = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.import}. */\nexport type RoastImportRequest = NonNullable<\n paths[\"/v1/roasts/imports\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.replaceArtisanImport}. */\nexport type RoastArtisanImportReplaceRequest = NonNullable<\n paths[\"/v1/roasts/{id}/artisan-import\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.sales.list}. */\nexport type SalesListQuery = NonNullable<\n paths[\"/v1/sales\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.profit.list}. */\nexport type ProfitListQuery = NonNullable<\n paths[\"/v1/profit\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** One owner inventory lot's canonical cost, revenue, and roast summary. */\nexport type ProfitItem = components[\"schemas\"][\"ProfitItem\"];\n/** Request body for {@link ParchmentClient.sales.create}. */\nexport type SalesCreateRequest = NonNullable<\n paths[\"/v1/sales\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.sales.update}. */\nexport type SalesUpdateRequest = NonNullable<\n paths[\"/v1/sales/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.tasting.get}. */\nexport type TastingGetQuery = NonNullable<\n paths[\"/v1/tasting/{catalogId}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.tasting.rate}. */\nexport type TastingRateRequest = NonNullable<\n paths[\"/v1/tasting/inventory/{inventoryId}\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.apiKeys.create}. */\nexport type ApiKeyCreateRequest = NonNullable<\n paths[\"/v1/api-keys\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for the session owner's API-key traffic analytics. */\nexport type OwnerApiUsageQuery = NonNullable<\n paths[\"/v1/api-usage\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Bounded owner API-key traffic analytics (not session or billing usage). */\nexport type OwnerApiUsage = components[\"schemas\"][\"OwnerApiUsageResponse\"];\n/** Request body for {@link ParchmentClient.emailSubscriptions.setMarketRead}. */\nexport type MarketReadPreferenceRequest = NonNullable<\n paths[\"/v1/email-subscriptions/market-read\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Account-owned Market Read email preference. */\nexport type EmailSubscriptionPreference =\n components[\"schemas\"][\"EmailSubscriptionPreference\"];\n/** Durable state returned by an account-deletion request. */\nexport type AccountDeletionOperation =\n components[\"schemas\"][\"AccountDeletionOperation\"];\nexport type CliAuthRequestCreate = NonNullable<\n paths[\"/v1/cli-auth/requests\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\nexport type CliAuthInspectRequest = NonNullable<\n paths[\"/v1/cli-auth/inspect\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\nexport type CliAuthApproveRequest = NonNullable<\n paths[\"/v1/cli-auth/approve\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\nexport type CliAuthExchangeRequest = NonNullable<\n paths[\"/v1/cli-auth/token\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\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 named helpers below are the hand-maintained ergonomic\n * layer and grow as endpoints land. `raw` always exposes the underlying typed\n * client for direct path access to anything not yet wrapped.\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 const postInventory = (\n body: InventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/inventory\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n });\n\n function createInventory(\n body: ManualInventoryCreateRequest,\n options: { idempotencyKey: string },\n ): ReturnType<typeof postInventory>;\n function createInventory(\n body: CatalogInventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ): ReturnType<typeof postInventory>;\n function createInventory(\n body: InventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ): ReturnType<typeof postInventory> {\n return postInventory(body, options);\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 /** Resolved principal and entitlements for the caller. */\n me: () => client.GET(\"/v1/me\"),\n apiKeys: {\n /** List API keys owned by the authenticated session user. */\n list: () => client.GET(\"/v1/api-keys\"),\n /** Create an API key. The raw secret is returned only once. */\n create: (body: ApiKeyCreateRequest) =>\n client.POST(\"/v1/api-keys\", { body }),\n /** Revoke an API key owned by the authenticated session user. */\n revoke: (id: string) =>\n client.DELETE(\"/v1/api-keys/{id}\", {\n params: { path: { id } },\n }),\n /** Rotate an API key and return the replacement secret once. */\n rotate: (id: string) =>\n client.POST(\"/v1/api-keys/{id}/rotate\", {\n params: { path: { id } },\n }),\n },\n apiUsage: {\n /**\n * Read bounded API-key traffic analytics for the authenticated session\n * owner. Headline monthly/hourly counts are exact; daily/per-key series\n * carry explicit truncation metadata.\n */\n get: (query?: OwnerApiUsageQuery) =>\n client.GET(\"/v1/api-usage\", { params: { query } }),\n },\n emailSubscriptions: {\n /** Get the authenticated session user's Market Read preference. */\n get: () => client.GET(\"/v1/email-subscriptions\"),\n /** Idempotently set the authenticated session user's Market Read preference. */\n setMarketRead: (body: MarketReadPreferenceRequest) =>\n client.PUT(\"/v1/email-subscriptions/market-read\", { body }),\n },\n accountDeletion: {\n /**\n * Idempotently request deletion for the authenticated session owner.\n * Provider finalization is intentionally available only through `raw`\n * because it also requires a trusted BFF server credential.\n */\n request: () => client.POST(\"/v1/account-deletion\"),\n },\n cliAuth: {\n /** Create a signed, short-lived login request bound to a PKCE challenge. */\n create: (body: CliAuthRequestCreate) =>\n client.POST(\"/v1/cli-auth/requests\", { body }),\n /** Inspect a signed request before displaying the web consent screen. */\n inspect: (body: CliAuthInspectRequest) =>\n client.POST(\"/v1/cli-auth/inspect\", { body }),\n /** Approve a request using the client's authenticated user session. */\n approve: (body: CliAuthApproveRequest) =>\n client.POST(\"/v1/cli-auth/approve\", { body }),\n /** Exchange an approved request and verifier for the one-time raw key. */\n exchange: (body: CliAuthExchangeRequest) =>\n client.POST(\"/v1/cli-auth/token\", { body }),\n },\n catalog: {\n /** Catalog capabilities and visibility for the caller. */\n access: () => client.GET(\"/v1/catalog/access\"),\n /**\n * List public catalog coffees (paginated). Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogListHeaders}).\n */\n list: (query?: CatalogListQuery, headers?: CatalogListHeaders) =>\n client.GET(\"/v1/catalog\", { params: { query, header: headers } }),\n /**\n * Catalog filter metadata and counted facets. Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogFacetsHeaders}).\n */\n facets: (query?: CatalogFacetsQuery, headers?: CatalogFacetsHeaders) =>\n client.GET(\"/v1/catalog/facets\", {\n params: { query, header: headers },\n }),\n /** Live catalog price context by origin. */\n originPriceStats: (query?: CatalogOriginPriceStatsQuery) =>\n client.GET(\"/v1/catalog/origin-price-stats\", { params: { query } }),\n /** Aggregate stats over the caller-visible catalog. */\n stats: (query?: CatalogStatsQuery) =>\n client.GET(\"/v1/catalog/stats\", { params: { query } }),\n /** Rank caller-visible catalog coffees by deterministic objectives. */\n rank: (query?: CatalogRankQuery, headers?: CatalogRankHeaders) =>\n client.GET(\"/v1/catalog/rank\", {\n params: { query, header: headers },\n }),\n /** Rank premium catalog candidates by Purveyor Score. */\n rankPremium: (\n query?: CatalogRankPremiumQuery,\n headers?: CatalogRankPremiumHeaders,\n ) =>\n client.GET(\"/v1/catalog/rank-premium\", {\n params: { query, header: headers },\n }),\n /** List supplier aggregates over caller-visible catalog coffees. */\n suppliers: (\n query?: CatalogSuppliersQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers\", {\n params: { query, header: headers },\n }),\n /** Return aggregate detail for a supplier query. */\n supplierDetail: (\n query: CatalogSupplierDetailQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/detail\", {\n params: { query, header: headers },\n }),\n /** Rank suppliers by catalog score and availability. */\n supplierRank: (\n query?: CatalogSupplierRankQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/rank\", {\n params: { query, header: headers },\n }),\n /** Aggregate proof-coverage over the public catalog. */\n proofCoverage: () => client.GET(\"/v1/catalog/proof-coverage\"),\n /** Find catalog coffees similar to a target coffee. */\n similar: (id: string, query?: CatalogSimilarQuery) =>\n client.GET(\"/v1/catalog/{id}/similar\", {\n params: { path: { id }, query },\n }),\n },\n priceIndex: {\n /** Parchment Price Index (aggregate snapshots). */\n list: (query?: PriceIndexQuery) =>\n client.GET(\"/v1/price-index\", { params: { query } }),\n /** Tier-one price-index chart history. */\n history: (query?: PriceIndexHistoryQuery) =>\n client.GET(\"/v1/price-index/history\", { params: { query } }),\n /** Price movement significance stats (precomputed). */\n stats: (query?: PriceIndexStatsQuery) =>\n client.GET(\"/v1/price-index/stats\", { params: { query } }),\n },\n market: {\n /** Actionable market value signals. */\n signals: (query?: MarketSignalsQuery) =>\n client.GET(\"/v1/market/signals\", { params: { query } }),\n /** Metadata-trend index (process/disclosure/Purveyor Score over time). */\n metadataIndex: (query?: MetadataIndexQuery) =>\n client.GET(\"/v1/market/metadata-index\", { params: { query } }),\n },\n procurement: {\n briefs: {\n /** List the caller's saved sourcing briefs. */\n list: () => client.GET(\"/v1/procurement/briefs\"),\n /** Create a saved sourcing brief. */\n create: (body: SourcingBriefCreateRequest) =>\n client.POST(\"/v1/procurement/briefs\", { body }),\n /** Fetch one of the caller's sourcing briefs by id. */\n get: (id: string) =>\n client.GET(\"/v1/procurement/briefs/{id}\", {\n params: { path: { id } },\n }),\n /** Run a saved brief against the catalog (paginated matches). */\n matches: (id: string, query?: BriefMatchesQuery) =>\n client.GET(\"/v1/procurement/briefs/{id}/matches\", {\n params: { path: { id }, query },\n }),\n },\n },\n portfolio: {\n trackedLots: {\n /**\n * List the caller's complete tracked catalog-id set and bounded recent\n * summaries enriched with live catalog state.\n */\n list: (query?: TrackedLotsListQuery) =>\n client.GET(\"/v1/portfolio/tracked-lots\", {\n params: { query },\n }),\n /** Idempotently set a visible catalog lot to tracked. */\n track: (catalogId: number) =>\n client.PUT(\"/v1/portfolio/tracked-lots/{catalogId}\", {\n params: { path: { catalogId } },\n }),\n /** Idempotently set an owner catalog lot to untracked. */\n untrack: (catalogId: number) =>\n client.DELETE(\"/v1/portfolio/tracked-lots/{catalogId}\", {\n params: { path: { catalogId } },\n }),\n },\n },\n inventory: {\n /** List the caller's own green-coffee inventory (owner-scoped). */\n list: (query?: InventoryListQuery) =>\n client.GET(\"/v1/inventory\", { params: { query } }),\n /**\n * Create an owner inventory lot. Requires a session or an owner-bound API\n * key carrying the exact `inventory:write` scope. Manual coffee creates\n * require `idempotencyKey`; catalog-backed creates accept it optionally.\n * The same key and payload replay the original result.\n */\n create: createInventory,\n /**\n * Atomically create owner-private manual inventory lots. The required\n * idempotency UUID is the stable batch identity and can be reconciled\n * with `getManualBatch` after an uncertain response.\n */\n createManualBatch: (\n body: ManualInventoryBatchCreateRequest,\n options: { idempotencyKey: string },\n ) =>\n client.POST(\"/v1/inventory/manual-batches\", {\n params: {\n header: { \"idempotency-key\": options.idempotencyKey },\n },\n body,\n }),\n /** Return the durable terminal result for a manual inventory batch. */\n getManualBatch: (batchId: string) =>\n client.GET(\"/v1/inventory/manual-batches/{batchId}\", {\n params: { path: { batchId } },\n }),\n /**\n * Durably reserve a complete manual-batch request. Once accepted, clients\n * only need to persist the batch UUID.\n */\n reserveManualBatch: (body: ManualInventoryBatchReserveRequest) =>\n client.POST(\"/v1/inventory/manual-batches/reservations\", { body }),\n /** Commit a reserved batch by UUID with no request body. */\n commitManualBatch: (batchId: string) =>\n client.POST(\"/v1/inventory/manual-batches/{batchId}/commit\", {\n params: { path: { batchId } },\n }),\n /**\n * Get unknown, accepted, in-progress, completed, or terminal-rejected\n * state. Unknown is explicitly nonterminal, including missing or\n * cross-tenant UUIDs, so clients retain the UUID and retry.\n */\n getManualBatchStatus: (batchId: string) =>\n client.GET(\"/v1/inventory/manual-batches/{batchId}/status\", {\n params: { path: { batchId } },\n }),\n /**\n * Update one of the caller's own inventory rows. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: InventoryUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/inventory/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Delete one of the caller's own inventory rows. Returns 409 if dependent\n * roast profiles or sales exist (no force-cascade).\n */\n delete: (id: number) =>\n client.DELETE(\"/v1/inventory/{id}\", { params: { path: { id } } }),\n },\n roasts: {\n /** Match Artisan roast metadata to one of the supplied inventory rows. */\n classify: (body: RoastClassificationRequest) =>\n client.POST(\"/v1/roasts/classify\", { body }),\n /** List the caller's own roast profiles (owner-scoped). */\n list: (query?: RoastListQuery) =>\n client.GET(\"/v1/roasts\", { params: { query } }),\n /**\n * Fetch one of the caller's roast profiles by id, optionally with its\n * temperature curve (`includeTemps`) and event markers (`includeEvents`).\n */\n get: (id: string, query?: RoastGetQuery) =>\n client.GET(\"/v1/roasts/{id}\", { params: { path: { id }, query } }),\n /** Fetch an owner roast's adaptively sampled chart curve and metadata. */\n chartData: (id: string, query?: RoastChartDataQuery) =>\n client.GET(\"/v1/roasts/{id}/chart-data\", {\n params: { path: { id }, query },\n }),\n /**\n * Create an owner roast profile, optionally with nested temperature/event\n * rows. Requires a session or an owner-bound API key carrying the exact\n * `roast:write` scope. Pass `idempotencyKey` to make retries safe.\n */\n create: (\n body: RoastCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own roast profiles. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: RoastUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/roasts/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /** Delete one of the caller's own roast profiles. */\n delete: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}\", { params: { path: { id } } }),\n /**\n * Create a roast profile from an Artisan `.alog` file against one of the\n * caller's green-coffee lots, persisting the imported curve, events, and\n * an artisan_import_log entry atomically. Requires a session or an\n * owner-bound API key carrying the exact `roast:write` scope. Pass\n * `idempotencyKey` to make retries safe.\n */\n import: (\n body: RoastImportRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts/imports\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Replace the Artisan import data on one of the caller's existing roasts,\n * re-deriving its curve, events, and computed metrics while preserving the\n * roast's identity. Pass `ifMatch` (the roast's `last_updated`) to enable\n * optimistic concurrency (409 on mismatch).\n */\n replaceArtisanImport: (\n id: number,\n body: RoastArtisanImportReplaceRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PUT(\"/v1/roasts/{id}/artisan-import\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Clear import-derived curve, events, metrics, and provenance data from\n * one of the caller's existing roasts without deleting the roast profile.\n */\n clearArtisanImport: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}/artisan-import\", {\n params: { path: { id } },\n }),\n },\n sales: {\n /** List the caller's own sales (owner-scoped). */\n list: (query?: SalesListQuery) =>\n client.GET(\"/v1/sales\", { params: { query } }),\n /**\n * Record a sale against one of the caller's own green-coffee inventory\n * lots. Requires a session or an owner-bound API key carrying the exact\n * `sales:write` scope. Pass `idempotencyKey` to make retries safe: the\n * same key replays the original result, and a concurrent duplicate gets\n * 409 while the first is in flight.\n */\n create: (\n body: SalesCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/sales\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own sales. The sales table carries no\n * `last_updated` column, so no If-Match optimistic concurrency is\n * offered.\n */\n update: (id: number, body: SalesUpdateRequest) =>\n client.PATCH(\"/v1/sales/{id}\", {\n params: { path: { id } },\n body,\n }),\n /** Delete one of the caller's own sales. */\n delete: (id: number) =>\n client.DELETE(\"/v1/sales/{id}\", { params: { path: { id } } }),\n },\n profit: {\n /**\n * List the caller's owner-scoped profit summaries. API keys require\n * inventory:read, roast:read, and sales:read. Use pagination.total to\n * exhaust the complete owner result set.\n */\n list: (query?: ProfitListQuery) =>\n client.GET(\"/v1/profit\", { params: { query } }),\n },\n tasting: {\n /** Fetch supplier notes plus the caller's own latest tasting notes. */\n get: (catalogId: string, query?: TastingGetQuery) =>\n client.GET(\"/v1/tasting/{catalogId}\", {\n params: { path: { catalogId }, query },\n }),\n /** Replace the caller's rating for one owned inventory lot. */\n rate: (inventoryId: number, body: TastingRateRequest) =>\n client.PUT(\"/v1/tasting/inventory/{inventoryId}\", {\n params: { path: { inventoryId } },\n body,\n }),\n },\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AAoP1C,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,QAAM,gBAAgB,CACpB,MACAA,aAEA,OAAO,KAAK,iBAAiB;AAAA,IAC3B;AAAA,IACA,QAAQA,UAAS,iBACb,EAAE,QAAQ,EAAE,mBAAmBA,SAAQ,eAAe,EAAE,IACxD;AAAA,EACN,CAAC;AAUH,WAAS,gBACP,MACAA,UACkC;AAClC,WAAO,cAAc,MAAMA,QAAO;AAAA,EACpC;AAEA,SAAO;AAAA;AAAA,IAEL,KAAK;AAAA;AAAA,IAEL,QAAQ,MAAM,OAAO,IAAI,SAAS;AAAA;AAAA,IAElC,IAAI,MAAM,OAAO,IAAI,QAAQ;AAAA,IAC7B,SAAS;AAAA;AAAA,MAEP,MAAM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AAA;AAAA,MAMN,MAAM,CAAC,UACL,OAAO,IAAI,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAAA,IAClD;AAAA,IACA,SAAS;AAAA;AAAA,MAEP,KAAK,CAAC,WAAmB,UACvB,OAAO,IAAI,2BAA2B;AAAA,QACpC,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM;AAAA,MACvC,CAAC;AAAA;AAAA,MAEH,MAAM,CAAC,aAAqB,SAC1B,OAAO,IAAI,uCAAuC;AAAA,QAChD,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,IACL;AAAA,EACF;AACF;","names":["options"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["import createClient, { type ClientOptions } from \"openapi-fetch\";\nimport type { components, 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/** Query parameters for {@link ParchmentClient.catalog.list}. */\nexport type CatalogListQuery = NonNullable<\n paths[\"/v1/catalog\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** A catalog row returned by the canonical listing resource. */\nexport type CatalogItem = components[\"schemas\"][\"CatalogItem\"];\n/** API-owned row-level trust summary returned when `include=proof`. */\nexport type CatalogProofSummary = components[\"schemas\"][\"CatalogProofSummary\"];\n/** Query parameters for {@link ParchmentClient.catalog.facets}. */\nexport type CatalogFacetsQuery = NonNullable<\n paths[\"/v1/catalog/facets\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/**\n * Optional headers for {@link ParchmentClient.catalog.list}, notably the\n * RFC 7240 `Prefer: handling=lenient|strict` override (PADR-0013 §7). Sending\n * `handling=lenient` opts a strict caller (API key or bearer-session JWT) back\n * into strip-with-notice degradation instead of a 401/403 hard-deny.\n */\nexport type CatalogListHeaders = NonNullable<\n paths[\"/v1/catalog\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for {@link ParchmentClient.catalog.facets}; see {@link CatalogListHeaders}. */\nexport type CatalogFacetsHeaders = NonNullable<\n paths[\"/v1/catalog/facets\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.originPriceStats}. */\nexport type CatalogOriginPriceStatsQuery = NonNullable<\n paths[\"/v1/catalog/origin-price-stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.stats}. */\nexport type CatalogStatsQuery = NonNullable<\n paths[\"/v1/catalog/stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.rank}. */\nexport type CatalogRankQuery = NonNullable<\n paths[\"/v1/catalog/rank\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.rankPremium}. */\nexport type CatalogRankPremiumQuery = NonNullable<\n paths[\"/v1/catalog/rank-premium\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.suppliers}. */\nexport type CatalogSuppliersQuery = NonNullable<\n paths[\"/v1/catalog/suppliers\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.supplierDetail}. */\nexport type CatalogSupplierDetailQuery = NonNullable<\n paths[\"/v1/catalog/suppliers/detail\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.supplierRank}. */\nexport type CatalogSupplierRankQuery = NonNullable<\n paths[\"/v1/catalog/suppliers/rank\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Optional headers for ranking endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogRankHeaders = NonNullable<\n paths[\"/v1/catalog/rank\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for premium ranking endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogRankPremiumHeaders = NonNullable<\n paths[\"/v1/catalog/rank-premium\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for supplier aggregate endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogSupplierHeaders = NonNullable<\n paths[\"/v1/catalog/suppliers\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.similar}. */\nexport type CatalogSimilarQuery = NonNullable<\n paths[\"/v1/catalog/{id}/similar\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.list}. */\nexport type PriceIndexQuery = NonNullable<\n paths[\"/v1/price-index\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.history}. */\nexport type PriceIndexHistoryQuery = NonNullable<\n paths[\"/v1/price-index/history\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.market.signals}. */\nexport type MarketSignalsQuery = NonNullable<\n paths[\"/v1/market/signals\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.stats}. */\nexport type PriceIndexStatsQuery = NonNullable<\n paths[\"/v1/price-index/stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.market.metadataIndex}. */\nexport type MetadataIndexQuery = NonNullable<\n paths[\"/v1/market/metadata-index\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.procurement.briefs.matches}. */\nexport type BriefMatchesQuery = NonNullable<\n paths[\"/v1/procurement/briefs/{id}/matches\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.procurement.briefs.create}. */\nexport type SourcingBriefCreateRequest =\n components[\"schemas\"][\"SourcingBriefCreateRequest\"];\n/** Query parameters for {@link ParchmentClient.portfolio.trackedLots.list}. */\nexport type TrackedLotsListQuery = NonNullable<\n paths[\"/v1/portfolio/tracked-lots\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** A tracked catalog lot enriched with current catalog and price state. */\nexport type TrackedLotSummary = components[\"schemas\"][\"TrackedLotSummary\"];\n/** State returned by tracked-lot PUT and DELETE mutations. */\nexport type TrackedLotMutation =\n components[\"schemas\"][\"TrackedLotMutationResponse\"];\n/** Query parameters for {@link ParchmentClient.inventory.list}. */\nexport type InventoryListQuery = NonNullable<\n paths[\"/v1/inventory\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.inventory.create}. */\nexport type InventoryCreateRequest = NonNullable<\n paths[\"/v1/inventory\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\ntype CatalogInventoryCreateRequest =\n components[\"schemas\"][\"CatalogInventoryCreateRequest\"];\ntype ManualInventoryCreateRequest =\n components[\"schemas\"][\"ManualInventoryCreateRequest\"];\n/** Request body for {@link ParchmentClient.inventory.createManualBatch}. */\nexport type ManualInventoryBatchCreateRequest = NonNullable<\n paths[\"/v1/inventory/manual-batches\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for reserving durable server-owned manual-batch intent. */\nexport type ManualInventoryBatchReserveRequest = NonNullable<\n paths[\"/v1/inventory/manual-batches/reservations\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.inventory.update}. */\nexport type InventoryUpdateRequest = NonNullable<\n paths[\"/v1/inventory/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.roasts.list}. */\nexport type RoastListQuery = NonNullable<\n paths[\"/v1/roasts\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.roasts.get}. */\nexport type RoastGetQuery = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.roasts.chartData}. */\nexport type RoastChartDataQuery = NonNullable<\n paths[\"/v1/roasts/{id}/chart-data\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.roasts.classify}. */\nexport type RoastClassificationRequest = NonNullable<\n paths[\"/v1/roasts/classify\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.create}. */\nexport type RoastCreateRequest = NonNullable<\n paths[\"/v1/roasts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.update}. */\nexport type RoastUpdateRequest = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.import}. */\nexport type RoastImportRequest = NonNullable<\n paths[\"/v1/roasts/imports\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.replaceArtisanImport}. */\nexport type RoastArtisanImportReplaceRequest = NonNullable<\n paths[\"/v1/roasts/{id}/artisan-import\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.sales.list}. */\nexport type SalesListQuery = NonNullable<\n paths[\"/v1/sales\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.profit.list}. */\nexport type ProfitListQuery = NonNullable<\n paths[\"/v1/profit\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** One owner inventory lot's canonical cost, revenue, and roast summary. */\nexport type ProfitItem = components[\"schemas\"][\"ProfitItem\"];\n/** Request body for {@link ParchmentClient.sales.create}. */\nexport type SalesCreateRequest = NonNullable<\n paths[\"/v1/sales\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.sales.update}. */\nexport type SalesUpdateRequest = NonNullable<\n paths[\"/v1/sales/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.tasting.get}. */\nexport type TastingGetQuery = NonNullable<\n paths[\"/v1/tasting/{catalogId}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.tasting.rate}. */\nexport type TastingRateRequest = NonNullable<\n paths[\"/v1/tasting/inventory/{inventoryId}\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.apiKeys.create}. */\nexport type ApiKeyCreateRequest = NonNullable<\n paths[\"/v1/api-keys\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for the session owner's API-key traffic analytics. */\nexport type OwnerApiUsageQuery = NonNullable<\n paths[\"/v1/api-usage\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Bounded owner API-key traffic analytics (not session or billing usage). */\nexport type OwnerApiUsage = components[\"schemas\"][\"OwnerApiUsageResponse\"];\n/** Request body for {@link ParchmentClient.emailSubscriptions.setMarketRead}. */\nexport type MarketReadPreferenceRequest = NonNullable<\n paths[\"/v1/email-subscriptions/market-read\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Account-owned Market Read email preference. */\nexport type EmailSubscriptionPreference =\n components[\"schemas\"][\"EmailSubscriptionPreference\"];\n/** Durable state returned by an account-deletion request. */\nexport type AccountDeletionOperation =\n components[\"schemas\"][\"AccountDeletionOperation\"];\n/** Idempotency input for acquiring a durable Stripe Checkout admission. */\nexport type CheckoutAdmissionAcquireRequest = NonNullable<\n paths[\"/v1/checkout-admissions\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Stripe publication input for an acquired Checkout admission. */\nexport type CheckoutAdmissionPublishRequest = NonNullable<\n paths[\"/v1/checkout-admissions/{admissionId}/publish\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Trusted provider header required when publishing a Checkout admission. */\nexport type CheckoutAdmissionPublishHeaders = NonNullable<\n paths[\"/v1/checkout-admissions/{admissionId}/publish\"][\"post\"][\"parameters\"][\"header\"]\n>;\n/** Durable state returned by Checkout admission mutations. */\nexport type CheckoutAdmission = components[\"schemas\"][\"CheckoutAdmission\"];\nexport type CliAuthRequestCreate = NonNullable<\n paths[\"/v1/cli-auth/requests\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\nexport type CliAuthInspectRequest = NonNullable<\n paths[\"/v1/cli-auth/inspect\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\nexport type CliAuthApproveRequest = NonNullable<\n paths[\"/v1/cli-auth/approve\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\nexport type CliAuthExchangeRequest = NonNullable<\n paths[\"/v1/cli-auth/token\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\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 named helpers below are the hand-maintained ergonomic\n * layer and grow as endpoints land. `raw` always exposes the underlying typed\n * client for direct path access to anything not yet wrapped.\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 const postInventory = (\n body: InventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/inventory\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n });\n\n function createInventory(\n body: ManualInventoryCreateRequest,\n options: { idempotencyKey: string },\n ): ReturnType<typeof postInventory>;\n function createInventory(\n body: CatalogInventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ): ReturnType<typeof postInventory>;\n function createInventory(\n body: InventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ): ReturnType<typeof postInventory> {\n return postInventory(body, options);\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 /** Resolved principal and entitlements for the caller. */\n me: () => client.GET(\"/v1/me\"),\n apiKeys: {\n /** List API keys owned by the authenticated session user. */\n list: () => client.GET(\"/v1/api-keys\"),\n /** Create an API key. The raw secret is returned only once. */\n create: (body: ApiKeyCreateRequest) =>\n client.POST(\"/v1/api-keys\", { body }),\n /** Revoke an API key owned by the authenticated session user. */\n revoke: (id: string) =>\n client.DELETE(\"/v1/api-keys/{id}\", {\n params: { path: { id } },\n }),\n /** Rotate an API key and return the replacement secret once. */\n rotate: (id: string) =>\n client.POST(\"/v1/api-keys/{id}/rotate\", {\n params: { path: { id } },\n }),\n },\n apiUsage: {\n /**\n * Read bounded API-key traffic analytics for the authenticated session\n * owner. Headline monthly/hourly counts are exact; daily/per-key series\n * carry explicit truncation metadata.\n */\n get: (query?: OwnerApiUsageQuery) =>\n client.GET(\"/v1/api-usage\", { params: { query } }),\n },\n emailSubscriptions: {\n /** Get the authenticated session user's Market Read preference. */\n get: () => client.GET(\"/v1/email-subscriptions\"),\n /** Idempotently set the authenticated session user's Market Read preference. */\n setMarketRead: (body: MarketReadPreferenceRequest) =>\n client.PUT(\"/v1/email-subscriptions/market-read\", { body }),\n },\n accountDeletion: {\n /**\n * Idempotently request deletion for the authenticated session owner.\n * Provider finalization is intentionally available only through `raw`\n * because it also requires a trusted BFF server credential.\n */\n request: () => client.POST(\"/v1/account-deletion\"),\n },\n checkoutAdmissions: {\n /** Acquire or replay an owner-bound admission before creating Stripe state. */\n acquire: (body: CheckoutAdmissionAcquireRequest) =>\n client.POST(\"/v1/checkout-admissions\", { body }),\n /** Publish a provider-verified Stripe Checkout Session for an admission. */\n publish: (\n admissionId: string,\n body: CheckoutAdmissionPublishRequest,\n headers: CheckoutAdmissionPublishHeaders,\n ) =>\n client.POST(\"/v1/checkout-admissions/{admissionId}/publish\", {\n params: { path: { admissionId }, header: headers },\n body,\n }),\n },\n cliAuth: {\n /** Create a signed, short-lived login request bound to a PKCE challenge. */\n create: (body: CliAuthRequestCreate) =>\n client.POST(\"/v1/cli-auth/requests\", { body }),\n /** Inspect a signed request before displaying the web consent screen. */\n inspect: (body: CliAuthInspectRequest) =>\n client.POST(\"/v1/cli-auth/inspect\", { body }),\n /** Approve a request using the client's authenticated user session. */\n approve: (body: CliAuthApproveRequest) =>\n client.POST(\"/v1/cli-auth/approve\", { body }),\n /** Exchange an approved request and verifier for the one-time raw key. */\n exchange: (body: CliAuthExchangeRequest) =>\n client.POST(\"/v1/cli-auth/token\", { body }),\n },\n catalog: {\n /** Catalog capabilities and visibility for the caller. */\n access: () => client.GET(\"/v1/catalog/access\"),\n /**\n * List public catalog coffees (paginated). Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogListHeaders}).\n */\n list: (query?: CatalogListQuery, headers?: CatalogListHeaders) =>\n client.GET(\"/v1/catalog\", { params: { query, header: headers } }),\n /**\n * Catalog filter metadata and counted facets. Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogFacetsHeaders}).\n */\n facets: (query?: CatalogFacetsQuery, headers?: CatalogFacetsHeaders) =>\n client.GET(\"/v1/catalog/facets\", {\n params: { query, header: headers },\n }),\n /** Live catalog price context by origin. */\n originPriceStats: (query?: CatalogOriginPriceStatsQuery) =>\n client.GET(\"/v1/catalog/origin-price-stats\", { params: { query } }),\n /** Aggregate stats over the caller-visible catalog. */\n stats: (query?: CatalogStatsQuery) =>\n client.GET(\"/v1/catalog/stats\", { params: { query } }),\n /** Rank caller-visible catalog coffees by deterministic objectives. */\n rank: (query?: CatalogRankQuery, headers?: CatalogRankHeaders) =>\n client.GET(\"/v1/catalog/rank\", {\n params: { query, header: headers },\n }),\n /** Rank premium catalog candidates by Purveyor Score. */\n rankPremium: (\n query?: CatalogRankPremiumQuery,\n headers?: CatalogRankPremiumHeaders,\n ) =>\n client.GET(\"/v1/catalog/rank-premium\", {\n params: { query, header: headers },\n }),\n /** List supplier aggregates over caller-visible catalog coffees. */\n suppliers: (\n query?: CatalogSuppliersQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers\", {\n params: { query, header: headers },\n }),\n /** Return aggregate detail for a supplier query. */\n supplierDetail: (\n query: CatalogSupplierDetailQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/detail\", {\n params: { query, header: headers },\n }),\n /** Rank suppliers by catalog score and availability. */\n supplierRank: (\n query?: CatalogSupplierRankQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/rank\", {\n params: { query, header: headers },\n }),\n /** Aggregate proof-coverage over the public catalog. */\n proofCoverage: () => client.GET(\"/v1/catalog/proof-coverage\"),\n /** Find catalog coffees similar to a target coffee. */\n similar: (id: string, query?: CatalogSimilarQuery) =>\n client.GET(\"/v1/catalog/{id}/similar\", {\n params: { path: { id }, query },\n }),\n },\n priceIndex: {\n /** Parchment Price Index (aggregate snapshots). */\n list: (query?: PriceIndexQuery) =>\n client.GET(\"/v1/price-index\", { params: { query } }),\n /** Tier-one price-index chart history. */\n history: (query?: PriceIndexHistoryQuery) =>\n client.GET(\"/v1/price-index/history\", { params: { query } }),\n /** Price movement significance stats (precomputed). */\n stats: (query?: PriceIndexStatsQuery) =>\n client.GET(\"/v1/price-index/stats\", { params: { query } }),\n },\n market: {\n /** Actionable market value signals. */\n signals: (query?: MarketSignalsQuery) =>\n client.GET(\"/v1/market/signals\", { params: { query } }),\n /** Metadata-trend index (process/disclosure/Purveyor Score over time). */\n metadataIndex: (query?: MetadataIndexQuery) =>\n client.GET(\"/v1/market/metadata-index\", { params: { query } }),\n },\n procurement: {\n briefs: {\n /** List the caller's saved sourcing briefs. */\n list: () => client.GET(\"/v1/procurement/briefs\"),\n /** Create a saved sourcing brief. */\n create: (body: SourcingBriefCreateRequest) =>\n client.POST(\"/v1/procurement/briefs\", { body }),\n /** Fetch one of the caller's sourcing briefs by id. */\n get: (id: string) =>\n client.GET(\"/v1/procurement/briefs/{id}\", {\n params: { path: { id } },\n }),\n /** Run a saved brief against the catalog (paginated matches). */\n matches: (id: string, query?: BriefMatchesQuery) =>\n client.GET(\"/v1/procurement/briefs/{id}/matches\", {\n params: { path: { id }, query },\n }),\n },\n },\n portfolio: {\n trackedLots: {\n /**\n * List the caller's complete tracked catalog-id set and bounded recent\n * summaries enriched with live catalog state.\n */\n list: (query?: TrackedLotsListQuery) =>\n client.GET(\"/v1/portfolio/tracked-lots\", {\n params: { query },\n }),\n /** Idempotently set a visible catalog lot to tracked. */\n track: (catalogId: number) =>\n client.PUT(\"/v1/portfolio/tracked-lots/{catalogId}\", {\n params: { path: { catalogId } },\n }),\n /** Idempotently set an owner catalog lot to untracked. */\n untrack: (catalogId: number) =>\n client.DELETE(\"/v1/portfolio/tracked-lots/{catalogId}\", {\n params: { path: { catalogId } },\n }),\n },\n },\n inventory: {\n /** List the caller's own green-coffee inventory (owner-scoped). */\n list: (query?: InventoryListQuery) =>\n client.GET(\"/v1/inventory\", { params: { query } }),\n /**\n * Create an owner inventory lot. Requires a session or an owner-bound API\n * key carrying the exact `inventory:write` scope. Manual coffee creates\n * require `idempotencyKey`; catalog-backed creates accept it optionally.\n * The same key and payload replay the original result.\n */\n create: createInventory,\n /**\n * Atomically create owner-private manual inventory lots. The required\n * idempotency UUID is the stable batch identity and can be reconciled\n * with `getManualBatch` after an uncertain response.\n */\n createManualBatch: (\n body: ManualInventoryBatchCreateRequest,\n options: { idempotencyKey: string },\n ) =>\n client.POST(\"/v1/inventory/manual-batches\", {\n params: {\n header: { \"idempotency-key\": options.idempotencyKey },\n },\n body,\n }),\n /** Return the durable terminal result for a manual inventory batch. */\n getManualBatch: (batchId: string) =>\n client.GET(\"/v1/inventory/manual-batches/{batchId}\", {\n params: { path: { batchId } },\n }),\n /**\n * Durably reserve a complete manual-batch request. Once accepted, clients\n * only need to persist the batch UUID.\n */\n reserveManualBatch: (body: ManualInventoryBatchReserveRequest) =>\n client.POST(\"/v1/inventory/manual-batches/reservations\", { body }),\n /** Commit a reserved batch by UUID with no request body. */\n commitManualBatch: (batchId: string) =>\n client.POST(\"/v1/inventory/manual-batches/{batchId}/commit\", {\n params: { path: { batchId } },\n }),\n /**\n * Get unknown, accepted, in-progress, completed, or terminal-rejected\n * state. Unknown is explicitly nonterminal, including missing or\n * cross-tenant UUIDs, so clients retain the UUID and retry.\n */\n getManualBatchStatus: (batchId: string) =>\n client.GET(\"/v1/inventory/manual-batches/{batchId}/status\", {\n params: { path: { batchId } },\n }),\n /**\n * Update one of the caller's own inventory rows. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: InventoryUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/inventory/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Delete one of the caller's own inventory rows. Returns 409 if dependent\n * roast profiles or sales exist (no force-cascade).\n */\n delete: (id: number) =>\n client.DELETE(\"/v1/inventory/{id}\", { params: { path: { id } } }),\n },\n roasts: {\n /** Match Artisan roast metadata to one of the supplied inventory rows. */\n classify: (body: RoastClassificationRequest) =>\n client.POST(\"/v1/roasts/classify\", { body }),\n /** List the caller's own roast profiles (owner-scoped). */\n list: (query?: RoastListQuery) =>\n client.GET(\"/v1/roasts\", { params: { query } }),\n /**\n * Fetch one of the caller's roast profiles by id, optionally with its\n * temperature curve (`includeTemps`) and event markers (`includeEvents`).\n */\n get: (id: string, query?: RoastGetQuery) =>\n client.GET(\"/v1/roasts/{id}\", { params: { path: { id }, query } }),\n /** Fetch an owner roast's adaptively sampled chart curve and metadata. */\n chartData: (id: string, query?: RoastChartDataQuery) =>\n client.GET(\"/v1/roasts/{id}/chart-data\", {\n params: { path: { id }, query },\n }),\n /**\n * Create an owner roast profile, optionally with nested temperature/event\n * rows. Requires a session or an owner-bound API key carrying the exact\n * `roast:write` scope. Pass `idempotencyKey` to make retries safe.\n */\n create: (\n body: RoastCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own roast profiles. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: RoastUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/roasts/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /** Delete one of the caller's own roast profiles. */\n delete: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}\", { params: { path: { id } } }),\n /**\n * Create a roast profile from an Artisan `.alog` file against one of the\n * caller's green-coffee lots, persisting the imported curve, events, and\n * an artisan_import_log entry atomically. Requires a session or an\n * owner-bound API key carrying the exact `roast:write` scope. Pass\n * `idempotencyKey` to make retries safe.\n */\n import: (\n body: RoastImportRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts/imports\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Replace the Artisan import data on one of the caller's existing roasts,\n * re-deriving its curve, events, and computed metrics while preserving the\n * roast's identity. Pass `ifMatch` (the roast's `last_updated`) to enable\n * optimistic concurrency (409 on mismatch).\n */\n replaceArtisanImport: (\n id: number,\n body: RoastArtisanImportReplaceRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PUT(\"/v1/roasts/{id}/artisan-import\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Clear import-derived curve, events, metrics, and provenance data from\n * one of the caller's existing roasts without deleting the roast profile.\n */\n clearArtisanImport: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}/artisan-import\", {\n params: { path: { id } },\n }),\n },\n sales: {\n /** List the caller's own sales (owner-scoped). */\n list: (query?: SalesListQuery) =>\n client.GET(\"/v1/sales\", { params: { query } }),\n /**\n * Record a sale against one of the caller's own green-coffee inventory\n * lots. Requires a session or an owner-bound API key carrying the exact\n * `sales:write` scope. Pass `idempotencyKey` to make retries safe: the\n * same key replays the original result, and a concurrent duplicate gets\n * 409 while the first is in flight.\n */\n create: (\n body: SalesCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/sales\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own sales. The sales table carries no\n * `last_updated` column, so no If-Match optimistic concurrency is\n * offered.\n */\n update: (id: number, body: SalesUpdateRequest) =>\n client.PATCH(\"/v1/sales/{id}\", {\n params: { path: { id } },\n body,\n }),\n /** Delete one of the caller's own sales. */\n delete: (id: number) =>\n client.DELETE(\"/v1/sales/{id}\", { params: { path: { id } } }),\n },\n profit: {\n /**\n * List the caller's owner-scoped profit summaries. API keys require\n * inventory:read, roast:read, and sales:read. Use pagination.total to\n * exhaust the complete owner result set.\n */\n list: (query?: ProfitListQuery) =>\n client.GET(\"/v1/profit\", { params: { query } }),\n },\n tasting: {\n /** Fetch supplier notes plus the caller's own latest tasting notes. */\n get: (catalogId: string, query?: TastingGetQuery) =>\n client.GET(\"/v1/tasting/{catalogId}\", {\n params: { path: { catalogId }, query },\n }),\n /** Replace the caller's rating for one owned inventory lot. */\n rate: (inventoryId: number, body: TastingRateRequest) =>\n client.PUT(\"/v1/tasting/inventory/{inventoryId}\", {\n params: { path: { inventoryId } },\n body,\n }),\n },\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"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