@purveyors/sdk 0.15.0 → 0.17.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 +823 -81
- package/dist/index.js +25 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -268,6 +268,84 @@ interface paths {
|
|
|
268
268
|
patch?: never;
|
|
269
269
|
trace?: never;
|
|
270
270
|
};
|
|
271
|
+
"/v1/api-usage": {
|
|
272
|
+
parameters: {
|
|
273
|
+
query?: never;
|
|
274
|
+
header?: never;
|
|
275
|
+
path?: never;
|
|
276
|
+
cookie?: never;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Read the session owner's API-key traffic analytics
|
|
280
|
+
* @description Returns bounded API-key traffic summaries, a UTC daily series, recent per-key requests, and canonical per-key plan request limits. This key-centric compatibility resource excludes session traffic and is not account billing usage. Query validation runs before endpoint authorization, so malformed queries return the documented 400 envelope even for unauthenticated callers.
|
|
281
|
+
*/
|
|
282
|
+
get: {
|
|
283
|
+
parameters: {
|
|
284
|
+
query?: {
|
|
285
|
+
days?: number;
|
|
286
|
+
recentPerKey?: number;
|
|
287
|
+
};
|
|
288
|
+
header?: never;
|
|
289
|
+
path?: never;
|
|
290
|
+
cookie?: never;
|
|
291
|
+
};
|
|
292
|
+
requestBody?: never;
|
|
293
|
+
responses: {
|
|
294
|
+
/** @description Bounded owner API-key traffic analytics */
|
|
295
|
+
200: {
|
|
296
|
+
headers: {
|
|
297
|
+
[name: string]: unknown;
|
|
298
|
+
};
|
|
299
|
+
content: {
|
|
300
|
+
"application/json": components["schemas"]["OwnerApiUsageResponse"];
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
/** @description Invalid analytics window */
|
|
304
|
+
400: {
|
|
305
|
+
headers: {
|
|
306
|
+
[name: string]: unknown;
|
|
307
|
+
};
|
|
308
|
+
content: {
|
|
309
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
/** @description Authentication required */
|
|
313
|
+
401: {
|
|
314
|
+
headers: {
|
|
315
|
+
[name: string]: unknown;
|
|
316
|
+
};
|
|
317
|
+
content: {
|
|
318
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
/** @description Insufficient entitlement (plan or role) */
|
|
322
|
+
403: {
|
|
323
|
+
headers: {
|
|
324
|
+
[name: string]: unknown;
|
|
325
|
+
};
|
|
326
|
+
content: {
|
|
327
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
/** @description API usage storage is unavailable */
|
|
331
|
+
503: {
|
|
332
|
+
headers: {
|
|
333
|
+
[name: string]: unknown;
|
|
334
|
+
};
|
|
335
|
+
content: {
|
|
336
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
put?: never;
|
|
342
|
+
post?: never;
|
|
343
|
+
delete?: never;
|
|
344
|
+
options?: never;
|
|
345
|
+
head?: never;
|
|
346
|
+
patch?: never;
|
|
347
|
+
trace?: never;
|
|
348
|
+
};
|
|
271
349
|
"/v1/api-keys/{id}": {
|
|
272
350
|
parameters: {
|
|
273
351
|
query?: never;
|
|
@@ -434,6 +512,151 @@ interface paths {
|
|
|
434
512
|
patch?: never;
|
|
435
513
|
trace?: never;
|
|
436
514
|
};
|
|
515
|
+
"/v1/email-subscriptions": {
|
|
516
|
+
parameters: {
|
|
517
|
+
query?: never;
|
|
518
|
+
header?: never;
|
|
519
|
+
path?: never;
|
|
520
|
+
cookie?: never;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Get the session user's Market Read email preference
|
|
524
|
+
* @description Returns an unsubscribed default when the account has no stored preference. This endpoint accepts session principals only.
|
|
525
|
+
*/
|
|
526
|
+
get: {
|
|
527
|
+
parameters: {
|
|
528
|
+
query?: never;
|
|
529
|
+
header?: never;
|
|
530
|
+
path?: never;
|
|
531
|
+
cookie?: never;
|
|
532
|
+
};
|
|
533
|
+
requestBody?: never;
|
|
534
|
+
responses: {
|
|
535
|
+
/** @description The account's Market Read email preference */
|
|
536
|
+
200: {
|
|
537
|
+
headers: {
|
|
538
|
+
[name: string]: unknown;
|
|
539
|
+
};
|
|
540
|
+
content: {
|
|
541
|
+
"application/json": components["schemas"]["EmailSubscriptionResponse"];
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
/** @description Authentication required */
|
|
545
|
+
401: {
|
|
546
|
+
headers: {
|
|
547
|
+
[name: string]: unknown;
|
|
548
|
+
};
|
|
549
|
+
content: {
|
|
550
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
/** @description Insufficient entitlement (plan or role) */
|
|
554
|
+
403: {
|
|
555
|
+
headers: {
|
|
556
|
+
[name: string]: unknown;
|
|
557
|
+
};
|
|
558
|
+
content: {
|
|
559
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
560
|
+
};
|
|
561
|
+
};
|
|
562
|
+
/** @description Email preference storage is unavailable */
|
|
563
|
+
503: {
|
|
564
|
+
headers: {
|
|
565
|
+
[name: string]: unknown;
|
|
566
|
+
};
|
|
567
|
+
content: {
|
|
568
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
put?: never;
|
|
574
|
+
post?: never;
|
|
575
|
+
delete?: never;
|
|
576
|
+
options?: never;
|
|
577
|
+
head?: never;
|
|
578
|
+
patch?: never;
|
|
579
|
+
trace?: never;
|
|
580
|
+
};
|
|
581
|
+
"/v1/email-subscriptions/market-read": {
|
|
582
|
+
parameters: {
|
|
583
|
+
query?: never;
|
|
584
|
+
header?: never;
|
|
585
|
+
path?: never;
|
|
586
|
+
cookie?: never;
|
|
587
|
+
};
|
|
588
|
+
get?: never;
|
|
589
|
+
/**
|
|
590
|
+
* Set the session user's Market Read email preference
|
|
591
|
+
* @description Idempotently subscribes or unsubscribes the account. Delivery-provider state is outside this preference contract. This endpoint accepts session principals only.
|
|
592
|
+
*/
|
|
593
|
+
put: {
|
|
594
|
+
parameters: {
|
|
595
|
+
query?: never;
|
|
596
|
+
header?: never;
|
|
597
|
+
path?: never;
|
|
598
|
+
cookie?: never;
|
|
599
|
+
};
|
|
600
|
+
requestBody: {
|
|
601
|
+
content: {
|
|
602
|
+
"application/json": components["schemas"]["MarketReadPreferenceInput"];
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
responses: {
|
|
606
|
+
/** @description The resulting Market Read email preference */
|
|
607
|
+
200: {
|
|
608
|
+
headers: {
|
|
609
|
+
[name: string]: unknown;
|
|
610
|
+
};
|
|
611
|
+
content: {
|
|
612
|
+
"application/json": components["schemas"]["EmailSubscriptionResponse"];
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
/** @description Invalid preference input */
|
|
616
|
+
400: {
|
|
617
|
+
headers: {
|
|
618
|
+
[name: string]: unknown;
|
|
619
|
+
};
|
|
620
|
+
content: {
|
|
621
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
622
|
+
};
|
|
623
|
+
};
|
|
624
|
+
/** @description Authentication required */
|
|
625
|
+
401: {
|
|
626
|
+
headers: {
|
|
627
|
+
[name: string]: unknown;
|
|
628
|
+
};
|
|
629
|
+
content: {
|
|
630
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
/** @description Insufficient entitlement (plan or role) */
|
|
634
|
+
403: {
|
|
635
|
+
headers: {
|
|
636
|
+
[name: string]: unknown;
|
|
637
|
+
};
|
|
638
|
+
content: {
|
|
639
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
/** @description Email preference storage is unavailable */
|
|
643
|
+
503: {
|
|
644
|
+
headers: {
|
|
645
|
+
[name: string]: unknown;
|
|
646
|
+
};
|
|
647
|
+
content: {
|
|
648
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
};
|
|
652
|
+
};
|
|
653
|
+
post?: never;
|
|
654
|
+
delete?: never;
|
|
655
|
+
options?: never;
|
|
656
|
+
head?: never;
|
|
657
|
+
patch?: never;
|
|
658
|
+
trace?: never;
|
|
659
|
+
};
|
|
437
660
|
"/v1/cli-auth/requests": {
|
|
438
661
|
parameters: {
|
|
439
662
|
query?: never;
|
|
@@ -1599,6 +1822,7 @@ interface paths {
|
|
|
1599
1822
|
from?: string;
|
|
1600
1823
|
to?: string;
|
|
1601
1824
|
wholesale?: "true" | "false";
|
|
1825
|
+
aggregationTier?: number;
|
|
1602
1826
|
order?: "asc" | "desc";
|
|
1603
1827
|
};
|
|
1604
1828
|
header?: never;
|
|
@@ -1616,6 +1840,15 @@ interface paths {
|
|
|
1616
1840
|
"application/json": components["schemas"]["PriceIndexResponse"];
|
|
1617
1841
|
};
|
|
1618
1842
|
};
|
|
1843
|
+
/** @description Invalid price-index query */
|
|
1844
|
+
400: {
|
|
1845
|
+
headers: {
|
|
1846
|
+
[name: string]: unknown;
|
|
1847
|
+
};
|
|
1848
|
+
content: {
|
|
1849
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
1850
|
+
};
|
|
1851
|
+
};
|
|
1619
1852
|
/** @description Authentication required */
|
|
1620
1853
|
401: {
|
|
1621
1854
|
headers: {
|
|
@@ -2504,7 +2737,7 @@ interface paths {
|
|
|
2504
2737
|
put?: never;
|
|
2505
2738
|
/**
|
|
2506
2739
|
* Create an owner inventory item
|
|
2507
|
-
* @description Create a green-coffee inventory lot owned by the authenticated principal. Requires an authenticated session, or an owner-bound API key carrying the exact inventory:write scope.
|
|
2740
|
+
* @description Create a green-coffee inventory lot owned by the authenticated principal. Supply either an existing catalogId or a manualCoffee object. Manual coffees require Idempotency-Key and are stored as real owner-private coffee_catalog rows (public_coffee=false) linked atomically to the new inventory row. Requires an authenticated session, or an owner-bound API key carrying the exact inventory:write scope.
|
|
2508
2741
|
*/
|
|
2509
2742
|
post: {
|
|
2510
2743
|
parameters: {
|
|
@@ -4153,6 +4386,91 @@ interface components {
|
|
|
4153
4386
|
message: string;
|
|
4154
4387
|
};
|
|
4155
4388
|
};
|
|
4389
|
+
OwnerApiUsageDailySummary: {
|
|
4390
|
+
/** Format: date */
|
|
4391
|
+
date: string;
|
|
4392
|
+
totalRequests: number;
|
|
4393
|
+
successRequests: number;
|
|
4394
|
+
errorRequests: number;
|
|
4395
|
+
pendingRequests: number;
|
|
4396
|
+
averageResponseTimeMs: number;
|
|
4397
|
+
};
|
|
4398
|
+
OwnerApiUsageRecord: {
|
|
4399
|
+
endpoint: string;
|
|
4400
|
+
/** Format: date-time */
|
|
4401
|
+
timestamp: string | null;
|
|
4402
|
+
statusCode: number | null;
|
|
4403
|
+
responseTimeMs: number | null;
|
|
4404
|
+
};
|
|
4405
|
+
OwnerApiKeyTrafficSummary: {
|
|
4406
|
+
/** Format: uuid */
|
|
4407
|
+
id: string;
|
|
4408
|
+
name: string;
|
|
4409
|
+
/** Format: date-time */
|
|
4410
|
+
createdAt: string | null;
|
|
4411
|
+
/** Format: date-time */
|
|
4412
|
+
lastUsedAt: string | null;
|
|
4413
|
+
isActive: boolean;
|
|
4414
|
+
scopes: string[];
|
|
4415
|
+
/** @description Exact current UTC calendar-month requests for this API key, inclusive of pending reservations. */
|
|
4416
|
+
monthlyRequests: number;
|
|
4417
|
+
windowRequests: number;
|
|
4418
|
+
successRequests: number;
|
|
4419
|
+
errorRequests: number;
|
|
4420
|
+
pendingRequests: number;
|
|
4421
|
+
averageResponseTimeMs: number;
|
|
4422
|
+
/** @description True when the bounded global series reached its record limit, so this key's window summary must be treated as a lower bound. */
|
|
4423
|
+
windowTruncated: boolean;
|
|
4424
|
+
recent: components["schemas"]["OwnerApiUsageRecord"][];
|
|
4425
|
+
};
|
|
4426
|
+
OwnerApiUsageResponse: {
|
|
4427
|
+
/**
|
|
4428
|
+
* @description This resource reports only traffic metered through the owner's API keys; it excludes session traffic and is not billing/account usage.
|
|
4429
|
+
* @enum {string}
|
|
4430
|
+
*/
|
|
4431
|
+
kind: "owner_api_key_traffic";
|
|
4432
|
+
/** Format: date-time */
|
|
4433
|
+
generatedAt: string;
|
|
4434
|
+
window: {
|
|
4435
|
+
/** Format: date-time */
|
|
4436
|
+
from: string;
|
|
4437
|
+
/** Format: date-time */
|
|
4438
|
+
to: string;
|
|
4439
|
+
days: number;
|
|
4440
|
+
recordsReturned: number;
|
|
4441
|
+
/** @enum {number} */
|
|
4442
|
+
recordLimit: 20000;
|
|
4443
|
+
truncated: boolean;
|
|
4444
|
+
/**
|
|
4445
|
+
* @description Coverage of the daily and per-key window series. Monthly/hourly summary counts remain exact database counts.
|
|
4446
|
+
* @enum {string}
|
|
4447
|
+
*/
|
|
4448
|
+
seriesCoverage: "complete" | "truncated";
|
|
4449
|
+
};
|
|
4450
|
+
plan: {
|
|
4451
|
+
/** @enum {string} */
|
|
4452
|
+
id: "viewer" | "member" | "enterprise";
|
|
4453
|
+
monthlyRequestLimitPerKey: number;
|
|
4454
|
+
/** @enum {string} */
|
|
4455
|
+
limitScope: "api_key";
|
|
4456
|
+
unlimited: boolean;
|
|
4457
|
+
};
|
|
4458
|
+
summary: {
|
|
4459
|
+
/** @description Exact aggregate owner API-key traffic for the current UTC calendar month. This is not compared with the per-key request limit. */
|
|
4460
|
+
monthlyRequests: number;
|
|
4461
|
+
hourlyRequests: number;
|
|
4462
|
+
totalKeys: number;
|
|
4463
|
+
activeKeys: number;
|
|
4464
|
+
};
|
|
4465
|
+
daily: components["schemas"]["OwnerApiUsageDailySummary"][];
|
|
4466
|
+
keys: components["schemas"]["OwnerApiKeyTrafficSummary"][];
|
|
4467
|
+
bounds: {
|
|
4468
|
+
/** @enum {number} */
|
|
4469
|
+
keyLimit: 100;
|
|
4470
|
+
keysTruncated: boolean;
|
|
4471
|
+
recentPerKey: number;
|
|
4472
|
+
};
|
|
4473
|
+
};
|
|
4156
4474
|
ApiKeyCreateResponse: {
|
|
4157
4475
|
/** @description Raw API key. Returned only once; store the secret client-side. */
|
|
4158
4476
|
apiKey: string;
|
|
@@ -4161,6 +4479,35 @@ interface components {
|
|
|
4161
4479
|
ApiKeyMutationResponse: {
|
|
4162
4480
|
key: components["schemas"]["ApiKeyRecord"];
|
|
4163
4481
|
};
|
|
4482
|
+
EmailSubscriptionPreference: {
|
|
4483
|
+
/** @enum {string} */
|
|
4484
|
+
publication: "market_read";
|
|
4485
|
+
/** @enum {string} */
|
|
4486
|
+
status: "subscribed" | "unsubscribed";
|
|
4487
|
+
subscribed: boolean;
|
|
4488
|
+
/** @enum {string|null} */
|
|
4489
|
+
consentSource: "account_settings" | "signup" | null;
|
|
4490
|
+
/** Format: date-time */
|
|
4491
|
+
consentedAt: string | null;
|
|
4492
|
+
/** Format: date-time */
|
|
4493
|
+
unsubscribedAt: string | null;
|
|
4494
|
+
/** Format: date-time */
|
|
4495
|
+
createdAt: string | null;
|
|
4496
|
+
/** Format: date-time */
|
|
4497
|
+
updatedAt: string | null;
|
|
4498
|
+
};
|
|
4499
|
+
EmailSubscriptionResponse: {
|
|
4500
|
+
data: components["schemas"]["EmailSubscriptionPreference"];
|
|
4501
|
+
};
|
|
4502
|
+
MarketReadPreferenceInput: {
|
|
4503
|
+
/** @enum {boolean} */
|
|
4504
|
+
subscribed: true;
|
|
4505
|
+
/** @enum {string} */
|
|
4506
|
+
consentSource: "account_settings" | "signup";
|
|
4507
|
+
} | {
|
|
4508
|
+
/** @enum {boolean} */
|
|
4509
|
+
subscribed: false;
|
|
4510
|
+
};
|
|
4164
4511
|
CatalogAccessResponse: {
|
|
4165
4512
|
visibility: {
|
|
4166
4513
|
isPrivilegedSession: boolean;
|
|
@@ -4877,6 +5224,7 @@ interface components {
|
|
|
4877
5224
|
from: string | null;
|
|
4878
5225
|
to: string | null;
|
|
4879
5226
|
wholesale: boolean | null;
|
|
5227
|
+
aggregationTier: number | null;
|
|
4880
5228
|
/** @enum {string} */
|
|
4881
5229
|
order: "asc" | "desc";
|
|
4882
5230
|
};
|
|
@@ -5578,21 +5926,62 @@ interface components {
|
|
|
5578
5926
|
};
|
|
5579
5927
|
};
|
|
5580
5928
|
};
|
|
5581
|
-
|
|
5582
|
-
/** @description coffee_catalog.id this inventory lot is bought from. */
|
|
5583
|
-
catalogId: number;
|
|
5929
|
+
CatalogInventoryCreateRequest: {
|
|
5584
5930
|
/** @description Purchased quantity in pounds. */
|
|
5585
5931
|
qty: number;
|
|
5586
5932
|
/** @description Purchase date (YYYY-MM-DD); defaults to today (UTC). */
|
|
5587
5933
|
purchaseDate?: string;
|
|
5588
|
-
/** @description
|
|
5934
|
+
/** @description Total bean cost for this inventory lot. */
|
|
5589
5935
|
cost?: number;
|
|
5590
5936
|
/** @description Tax and shipping cost. */
|
|
5591
5937
|
taxShip?: number;
|
|
5592
5938
|
notes?: string;
|
|
5939
|
+
/** @description Existing coffee_catalog.id this inventory lot is bought from. */
|
|
5940
|
+
catalogId: number;
|
|
5941
|
+
/** @enum {string} */
|
|
5942
|
+
manualCoffee?: never;
|
|
5593
5943
|
};
|
|
5594
|
-
|
|
5595
|
-
|
|
5944
|
+
/** @description Owner-private catalog coffee to create atomically with the inventory lot. The API always stores public_coffee=false and binds coffee_user to the authenticated owner. */
|
|
5945
|
+
ManualCoffeeCreate: {
|
|
5946
|
+
name: string;
|
|
5947
|
+
country?: string;
|
|
5948
|
+
region?: string;
|
|
5949
|
+
processing?: string;
|
|
5950
|
+
dryingMethod?: string;
|
|
5951
|
+
roastRecommendations?: string;
|
|
5952
|
+
lotSize?: string;
|
|
5953
|
+
bagSize?: string;
|
|
5954
|
+
packaging?: string;
|
|
5955
|
+
cultivarDetail?: string;
|
|
5956
|
+
grade?: string;
|
|
5957
|
+
appearance?: string;
|
|
5958
|
+
shortDescription?: string;
|
|
5959
|
+
farmNotes?: string;
|
|
5960
|
+
type?: string;
|
|
5961
|
+
longDescription?: string;
|
|
5962
|
+
costPerLb?: number;
|
|
5963
|
+
source?: string;
|
|
5964
|
+
supplierCuppingNotes?: string;
|
|
5965
|
+
arrivalDate?: string;
|
|
5966
|
+
scoreValue?: number;
|
|
5967
|
+
};
|
|
5968
|
+
ManualInventoryCreateRequest: {
|
|
5969
|
+
/** @description Purchased quantity in pounds. */
|
|
5970
|
+
qty: number;
|
|
5971
|
+
/** @description Purchase date (YYYY-MM-DD); defaults to today (UTC). */
|
|
5972
|
+
purchaseDate?: string;
|
|
5973
|
+
/** @description Total bean cost for this inventory lot. */
|
|
5974
|
+
cost?: number;
|
|
5975
|
+
/** @description Tax and shipping cost. */
|
|
5976
|
+
taxShip?: number;
|
|
5977
|
+
notes?: string;
|
|
5978
|
+
/** @enum {string} */
|
|
5979
|
+
catalogId?: never;
|
|
5980
|
+
manualCoffee: components["schemas"]["ManualCoffeeCreate"];
|
|
5981
|
+
};
|
|
5982
|
+
InventoryCreateRequest: components["schemas"]["CatalogInventoryCreateRequest"] | components["schemas"]["ManualInventoryCreateRequest"];
|
|
5983
|
+
InventoryUpdateRequest: {
|
|
5984
|
+
qty?: number;
|
|
5596
5985
|
cost?: number;
|
|
5597
5986
|
taxShip?: number;
|
|
5598
5987
|
notes?: string;
|
|
@@ -6256,6 +6645,8 @@ type TrackedLotMutation = components["schemas"]["TrackedLotMutationResponse"];
|
|
|
6256
6645
|
type InventoryListQuery = NonNullable<paths["/v1/inventory"]["get"]["parameters"]["query"]>;
|
|
6257
6646
|
/** Request body for {@link ParchmentClient.inventory.create}. */
|
|
6258
6647
|
type InventoryCreateRequest = NonNullable<paths["/v1/inventory"]["post"]["requestBody"]>["content"]["application/json"];
|
|
6648
|
+
type CatalogInventoryCreateRequest = components["schemas"]["CatalogInventoryCreateRequest"];
|
|
6649
|
+
type ManualInventoryCreateRequest = components["schemas"]["ManualInventoryCreateRequest"];
|
|
6259
6650
|
/** Request body for {@link ParchmentClient.inventory.update}. */
|
|
6260
6651
|
type InventoryUpdateRequest = NonNullable<paths["/v1/inventory/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
|
|
6261
6652
|
/** Query parameters for {@link ParchmentClient.roasts.list}. */
|
|
@@ -6284,6 +6675,12 @@ type TastingGetQuery = NonNullable<paths["/v1/tasting/{catalogId}"]["get"]["para
|
|
|
6284
6675
|
type TastingRateRequest = NonNullable<paths["/v1/tasting/inventory/{inventoryId}"]["put"]["requestBody"]>["content"]["application/json"];
|
|
6285
6676
|
/** Request body for {@link ParchmentClient.apiKeys.create}. */
|
|
6286
6677
|
type ApiKeyCreateRequest = NonNullable<paths["/v1/api-keys"]["post"]["requestBody"]>["content"]["application/json"];
|
|
6678
|
+
/** Query parameters for the session owner's API-key traffic analytics. */
|
|
6679
|
+
type OwnerApiUsageQuery = NonNullable<paths["/v1/api-usage"]["get"]["parameters"]["query"]>;
|
|
6680
|
+
/** Bounded owner API-key traffic analytics (not session or billing usage). */
|
|
6681
|
+
type OwnerApiUsage = components["schemas"]["OwnerApiUsageResponse"];
|
|
6682
|
+
/** Request body for {@link ParchmentClient.emailSubscriptions.setMarketRead}. */
|
|
6683
|
+
type MarketReadPreferenceRequest = NonNullable<paths["/v1/email-subscriptions/market-read"]["put"]["requestBody"]>["content"]["application/json"];
|
|
6287
6684
|
type CliAuthRequestCreate = NonNullable<paths["/v1/cli-auth/requests"]["post"]["requestBody"]>["content"]["application/json"];
|
|
6288
6685
|
type CliAuthInspectRequest = NonNullable<paths["/v1/cli-auth/inspect"]["post"]["requestBody"]>["content"]["application/json"];
|
|
6289
6686
|
type CliAuthApproveRequest = NonNullable<paths["/v1/cli-auth/approve"]["post"]["requestBody"]>["content"]["application/json"];
|
|
@@ -6599,7 +6996,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
6599
6996
|
[name: string]: unknown;
|
|
6600
6997
|
};
|
|
6601
6998
|
content: {
|
|
6602
|
-
"application/json": components["schemas"]["ErrorResponse"];
|
|
6999
|
+
"application/json": components["schemas"] /** Create a signed, short-lived login request bound to a PKCE challenge. */["ErrorResponse"];
|
|
6603
7000
|
};
|
|
6604
7001
|
};
|
|
6605
7002
|
403: {
|
|
@@ -6703,6 +7100,228 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
6703
7100
|
};
|
|
6704
7101
|
}, `${string}/${string}`>>;
|
|
6705
7102
|
};
|
|
7103
|
+
apiUsage: {
|
|
7104
|
+
/**
|
|
7105
|
+
* Read bounded API-key traffic analytics for the authenticated session
|
|
7106
|
+
* owner. Headline monthly/hourly counts are exact; daily/per-key series
|
|
7107
|
+
* carry explicit truncation metadata.
|
|
7108
|
+
*/
|
|
7109
|
+
get: (query?: OwnerApiUsageQuery) => Promise<openapi_fetch.FetchResponse<{
|
|
7110
|
+
parameters: {
|
|
7111
|
+
query?: {
|
|
7112
|
+
days?: number;
|
|
7113
|
+
recentPerKey?: number;
|
|
7114
|
+
};
|
|
7115
|
+
header?: never;
|
|
7116
|
+
path?: never;
|
|
7117
|
+
cookie?: never;
|
|
7118
|
+
};
|
|
7119
|
+
requestBody?: never;
|
|
7120
|
+
responses: {
|
|
7121
|
+
200: {
|
|
7122
|
+
headers: {
|
|
7123
|
+
[name: string]: unknown;
|
|
7124
|
+
};
|
|
7125
|
+
content: {
|
|
7126
|
+
"application/json": components["schemas"]["OwnerApiUsageResponse"];
|
|
7127
|
+
};
|
|
7128
|
+
};
|
|
7129
|
+
400: {
|
|
7130
|
+
headers: {
|
|
7131
|
+
[name: string]: unknown;
|
|
7132
|
+
};
|
|
7133
|
+
content: {
|
|
7134
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7135
|
+
};
|
|
7136
|
+
};
|
|
7137
|
+
401: {
|
|
7138
|
+
headers: {
|
|
7139
|
+
[name: string]: unknown;
|
|
7140
|
+
};
|
|
7141
|
+
content: {
|
|
7142
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7143
|
+
};
|
|
7144
|
+
};
|
|
7145
|
+
403: {
|
|
7146
|
+
headers: {
|
|
7147
|
+
[name: string]: unknown;
|
|
7148
|
+
};
|
|
7149
|
+
content: {
|
|
7150
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7151
|
+
};
|
|
7152
|
+
};
|
|
7153
|
+
503: {
|
|
7154
|
+
headers: {
|
|
7155
|
+
[name: string]: unknown;
|
|
7156
|
+
};
|
|
7157
|
+
content: {
|
|
7158
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7159
|
+
};
|
|
7160
|
+
};
|
|
7161
|
+
};
|
|
7162
|
+
}, {
|
|
7163
|
+
params: {
|
|
7164
|
+
query: {
|
|
7165
|
+
days?: number;
|
|
7166
|
+
recentPerKey?: number;
|
|
7167
|
+
} | undefined;
|
|
7168
|
+
};
|
|
7169
|
+
}, `${string}/${string}`>>;
|
|
7170
|
+
};
|
|
7171
|
+
emailSubscriptions: {
|
|
7172
|
+
/** Get the authenticated session user's Market Read preference. */
|
|
7173
|
+
get: () => Promise<openapi_fetch.FetchResponse<{
|
|
7174
|
+
parameters: {
|
|
7175
|
+
query?: never;
|
|
7176
|
+
header?: never;
|
|
7177
|
+
path?: never;
|
|
7178
|
+
cookie?: never;
|
|
7179
|
+
};
|
|
7180
|
+
requestBody?: never;
|
|
7181
|
+
responses: {
|
|
7182
|
+
200: {
|
|
7183
|
+
headers: {
|
|
7184
|
+
[name: string]: unknown;
|
|
7185
|
+
};
|
|
7186
|
+
content: {
|
|
7187
|
+
"application/json": components["schemas"]["EmailSubscriptionResponse"];
|
|
7188
|
+
};
|
|
7189
|
+
};
|
|
7190
|
+
401: {
|
|
7191
|
+
headers: {
|
|
7192
|
+
[name: string]: unknown;
|
|
7193
|
+
};
|
|
7194
|
+
content: {
|
|
7195
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7196
|
+
};
|
|
7197
|
+
};
|
|
7198
|
+
403: {
|
|
7199
|
+
headers: {
|
|
7200
|
+
[name: string]: unknown;
|
|
7201
|
+
};
|
|
7202
|
+
content: {
|
|
7203
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7204
|
+
};
|
|
7205
|
+
};
|
|
7206
|
+
503: {
|
|
7207
|
+
headers: {
|
|
7208
|
+
[name: string]: unknown;
|
|
7209
|
+
};
|
|
7210
|
+
content: {
|
|
7211
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7212
|
+
};
|
|
7213
|
+
};
|
|
7214
|
+
};
|
|
7215
|
+
}, openapi_fetch.FetchOptions<{
|
|
7216
|
+
parameters: {
|
|
7217
|
+
query?: never;
|
|
7218
|
+
header?: never;
|
|
7219
|
+
path?: never;
|
|
7220
|
+
cookie?: never;
|
|
7221
|
+
};
|
|
7222
|
+
requestBody?: never;
|
|
7223
|
+
responses: {
|
|
7224
|
+
200: {
|
|
7225
|
+
headers: {
|
|
7226
|
+
[name: string]: unknown;
|
|
7227
|
+
};
|
|
7228
|
+
content: {
|
|
7229
|
+
"application/json": components["schemas"]["EmailSubscriptionResponse"];
|
|
7230
|
+
};
|
|
7231
|
+
};
|
|
7232
|
+
401: {
|
|
7233
|
+
headers: {
|
|
7234
|
+
[name: string]: unknown;
|
|
7235
|
+
};
|
|
7236
|
+
content: {
|
|
7237
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7238
|
+
};
|
|
7239
|
+
};
|
|
7240
|
+
403: {
|
|
7241
|
+
headers: {
|
|
7242
|
+
[name: string]: unknown;
|
|
7243
|
+
};
|
|
7244
|
+
content: {
|
|
7245
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7246
|
+
};
|
|
7247
|
+
};
|
|
7248
|
+
503: {
|
|
7249
|
+
headers: {
|
|
7250
|
+
[name: string]: unknown;
|
|
7251
|
+
};
|
|
7252
|
+
content: {
|
|
7253
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7254
|
+
};
|
|
7255
|
+
};
|
|
7256
|
+
};
|
|
7257
|
+
}> | undefined, `${string}/${string}`>>;
|
|
7258
|
+
/** Idempotently set the authenticated session user's Market Read preference. */
|
|
7259
|
+
setMarketRead: (body: MarketReadPreferenceRequest) => Promise<openapi_fetch.FetchResponse<{
|
|
7260
|
+
parameters: {
|
|
7261
|
+
query?: never;
|
|
7262
|
+
header?: never;
|
|
7263
|
+
path?: never;
|
|
7264
|
+
cookie?: never;
|
|
7265
|
+
};
|
|
7266
|
+
requestBody: {
|
|
7267
|
+
content: {
|
|
7268
|
+
"application/json": components["schemas"]["MarketReadPreferenceInput"];
|
|
7269
|
+
};
|
|
7270
|
+
};
|
|
7271
|
+
responses: {
|
|
7272
|
+
200: {
|
|
7273
|
+
headers: {
|
|
7274
|
+
[name: string]: unknown;
|
|
7275
|
+
};
|
|
7276
|
+
content: {
|
|
7277
|
+
"application/json": components["schemas"]["EmailSubscriptionResponse"];
|
|
7278
|
+
};
|
|
7279
|
+
};
|
|
7280
|
+
400: {
|
|
7281
|
+
headers: {
|
|
7282
|
+
[name: string]: unknown;
|
|
7283
|
+
};
|
|
7284
|
+
content: {
|
|
7285
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7286
|
+
};
|
|
7287
|
+
};
|
|
7288
|
+
401: {
|
|
7289
|
+
headers: {
|
|
7290
|
+
[name: string]: unknown;
|
|
7291
|
+
};
|
|
7292
|
+
content: {
|
|
7293
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7294
|
+
};
|
|
7295
|
+
};
|
|
7296
|
+
403: {
|
|
7297
|
+
headers: {
|
|
7298
|
+
[name: string]: unknown;
|
|
7299
|
+
};
|
|
7300
|
+
content: {
|
|
7301
|
+
"application/json": components["schemas"] /**
|
|
7302
|
+
* Update one of the caller's own roast profiles. Pass `ifMatch` (the
|
|
7303
|
+
* row's `last_updated`) to enable optimistic concurrency (409 on mismatch).
|
|
7304
|
+
*/["ErrorResponse"];
|
|
7305
|
+
};
|
|
7306
|
+
};
|
|
7307
|
+
503: {
|
|
7308
|
+
headers: {
|
|
7309
|
+
[name: string]: unknown;
|
|
7310
|
+
};
|
|
7311
|
+
content: {
|
|
7312
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
7313
|
+
};
|
|
7314
|
+
};
|
|
7315
|
+
};
|
|
7316
|
+
}, {
|
|
7317
|
+
body: {
|
|
7318
|
+
subscribed: true;
|
|
7319
|
+
consentSource: "account_settings" | "signup";
|
|
7320
|
+
} | {
|
|
7321
|
+
subscribed: false;
|
|
7322
|
+
};
|
|
7323
|
+
}, `${string}/${string}`>>;
|
|
7324
|
+
};
|
|
6706
7325
|
cliAuth: {
|
|
6707
7326
|
/** Create a signed, short-lived login request bound to a PKCE challenge. */
|
|
6708
7327
|
create: (body: CliAuthRequestCreate) => Promise<openapi_fetch.FetchResponse<{
|
|
@@ -6780,7 +7399,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
6780
7399
|
query?: never;
|
|
6781
7400
|
header?: never;
|
|
6782
7401
|
path?: never;
|
|
6783
|
-
cookie
|
|
7402
|
+
cookie? /** Replace the caller's rating for one owned inventory lot. */: never;
|
|
6784
7403
|
};
|
|
6785
7404
|
requestBody: {
|
|
6786
7405
|
content: {
|
|
@@ -7905,6 +8524,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
7905
8524
|
from?: string;
|
|
7906
8525
|
to?: string;
|
|
7907
8526
|
wholesale?: "true" | "false";
|
|
8527
|
+
aggregationTier?: number;
|
|
7908
8528
|
order?: "asc" | "desc";
|
|
7909
8529
|
};
|
|
7910
8530
|
header?: never;
|
|
@@ -7921,6 +8541,14 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
7921
8541
|
"application/json": components["schemas"]["PriceIndexResponse"];
|
|
7922
8542
|
};
|
|
7923
8543
|
};
|
|
8544
|
+
400: {
|
|
8545
|
+
headers: {
|
|
8546
|
+
[name: string]: unknown;
|
|
8547
|
+
};
|
|
8548
|
+
content: {
|
|
8549
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
8550
|
+
};
|
|
8551
|
+
};
|
|
7924
8552
|
401: {
|
|
7925
8553
|
headers: {
|
|
7926
8554
|
[name: string]: unknown;
|
|
@@ -7949,6 +8577,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
7949
8577
|
from?: string;
|
|
7950
8578
|
to?: string;
|
|
7951
8579
|
wholesale?: "true" | "false";
|
|
8580
|
+
aggregationTier?: number;
|
|
7952
8581
|
order?: "asc" | "desc";
|
|
7953
8582
|
} | undefined;
|
|
7954
8583
|
};
|
|
@@ -8657,99 +9286,212 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
8657
9286
|
}, `${string}/${string}`>>;
|
|
8658
9287
|
/**
|
|
8659
9288
|
* Create an owner inventory lot. Requires a session or an owner-bound API
|
|
8660
|
-
* key carrying the exact `inventory:write` scope.
|
|
8661
|
-
*
|
|
8662
|
-
*
|
|
9289
|
+
* key carrying the exact `inventory:write` scope. Manual coffee creates
|
|
9290
|
+
* require `idempotencyKey`; catalog-backed creates accept it optionally.
|
|
9291
|
+
* The same key and payload replay the original result.
|
|
8663
9292
|
*/
|
|
8664
|
-
create:
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
};
|
|
8675
|
-
requestBody?: {
|
|
8676
|
-
content: {
|
|
8677
|
-
"application/json": components["schemas"]["InventoryCreateRequest"];
|
|
8678
|
-
};
|
|
8679
|
-
};
|
|
8680
|
-
responses: {
|
|
8681
|
-
201: {
|
|
8682
|
-
headers: {
|
|
8683
|
-
[name: string]: unknown;
|
|
9293
|
+
create: {
|
|
9294
|
+
(body: ManualInventoryCreateRequest, options: {
|
|
9295
|
+
idempotencyKey: string;
|
|
9296
|
+
}): ReturnType<(body: InventoryCreateRequest, options?: {
|
|
9297
|
+
idempotencyKey?: string;
|
|
9298
|
+
}) => Promise<openapi_fetch.FetchResponse<{
|
|
9299
|
+
parameters: {
|
|
9300
|
+
query?: never;
|
|
9301
|
+
header?: {
|
|
9302
|
+
"idempotency-key"?: string;
|
|
8684
9303
|
};
|
|
9304
|
+
path?: never;
|
|
9305
|
+
cookie?: never;
|
|
9306
|
+
};
|
|
9307
|
+
requestBody?: {
|
|
8685
9308
|
content: {
|
|
8686
|
-
"application/json": components["schemas"]["
|
|
9309
|
+
"application/json": components["schemas"]["InventoryCreateRequest"];
|
|
8687
9310
|
};
|
|
8688
9311
|
};
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
9312
|
+
responses: {
|
|
9313
|
+
201: {
|
|
9314
|
+
headers: {
|
|
9315
|
+
[name: string]: unknown;
|
|
9316
|
+
};
|
|
9317
|
+
content: {
|
|
9318
|
+
"application/json": components["schemas"]["InventoryItemResponse"];
|
|
9319
|
+
};
|
|
8692
9320
|
};
|
|
8693
|
-
|
|
8694
|
-
|
|
9321
|
+
400: {
|
|
9322
|
+
headers: {
|
|
9323
|
+
[name: string]: unknown;
|
|
9324
|
+
};
|
|
9325
|
+
content: {
|
|
9326
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9327
|
+
};
|
|
8695
9328
|
};
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
9329
|
+
401: {
|
|
9330
|
+
headers: {
|
|
9331
|
+
[name: string]: unknown;
|
|
9332
|
+
};
|
|
9333
|
+
content: {
|
|
9334
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9335
|
+
};
|
|
8700
9336
|
};
|
|
8701
|
-
|
|
8702
|
-
|
|
9337
|
+
403: {
|
|
9338
|
+
headers: {
|
|
9339
|
+
[name: string]: unknown;
|
|
9340
|
+
};
|
|
9341
|
+
content: {
|
|
9342
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9343
|
+
};
|
|
8703
9344
|
};
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
9345
|
+
409: {
|
|
9346
|
+
headers: {
|
|
9347
|
+
[name: string]: unknown;
|
|
9348
|
+
};
|
|
9349
|
+
content: {
|
|
9350
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9351
|
+
};
|
|
8708
9352
|
};
|
|
8709
|
-
|
|
8710
|
-
|
|
9353
|
+
429: {
|
|
9354
|
+
headers: {
|
|
9355
|
+
[name: string]: unknown;
|
|
9356
|
+
};
|
|
9357
|
+
content: {
|
|
9358
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9359
|
+
};
|
|
9360
|
+
};
|
|
9361
|
+
503: {
|
|
9362
|
+
headers: {
|
|
9363
|
+
[name: string]: unknown;
|
|
9364
|
+
};
|
|
9365
|
+
content: {
|
|
9366
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9367
|
+
};
|
|
8711
9368
|
};
|
|
8712
9369
|
};
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
9370
|
+
}, {
|
|
9371
|
+
body: {
|
|
9372
|
+
qty: number;
|
|
9373
|
+
purchaseDate?: string;
|
|
9374
|
+
cost?: number;
|
|
9375
|
+
taxShip?: number;
|
|
9376
|
+
notes?: string;
|
|
9377
|
+
catalogId: number;
|
|
9378
|
+
manualCoffee?: never;
|
|
9379
|
+
} | {
|
|
9380
|
+
qty: number;
|
|
9381
|
+
purchaseDate?: string;
|
|
9382
|
+
cost?: number;
|
|
9383
|
+
taxShip?: number;
|
|
9384
|
+
notes?: string;
|
|
9385
|
+
catalogId?: never;
|
|
9386
|
+
manualCoffee: components["schemas"]["ManualCoffeeCreate"];
|
|
9387
|
+
};
|
|
9388
|
+
params: {
|
|
9389
|
+
header: {
|
|
9390
|
+
"idempotency-key": string;
|
|
8716
9391
|
};
|
|
8717
|
-
|
|
8718
|
-
|
|
9392
|
+
} | undefined;
|
|
9393
|
+
}, `${string}/${string}`>>>;
|
|
9394
|
+
(body: CatalogInventoryCreateRequest, options?: {
|
|
9395
|
+
idempotencyKey?: string;
|
|
9396
|
+
}): ReturnType<(body: InventoryCreateRequest, options?: {
|
|
9397
|
+
idempotencyKey?: string;
|
|
9398
|
+
}) => Promise<openapi_fetch.FetchResponse<{
|
|
9399
|
+
parameters: {
|
|
9400
|
+
query?: never;
|
|
9401
|
+
header?: {
|
|
9402
|
+
"idempotency-key"?: string;
|
|
8719
9403
|
};
|
|
9404
|
+
path?: never;
|
|
9405
|
+
cookie?: never;
|
|
8720
9406
|
};
|
|
8721
|
-
|
|
8722
|
-
headers: {
|
|
8723
|
-
[name: string]: unknown;
|
|
8724
|
-
};
|
|
9407
|
+
requestBody?: {
|
|
8725
9408
|
content: {
|
|
8726
|
-
"application/json": components["schemas"]["
|
|
9409
|
+
"application/json": components["schemas"]["InventoryCreateRequest"];
|
|
8727
9410
|
};
|
|
8728
9411
|
};
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
9412
|
+
responses: {
|
|
9413
|
+
201: {
|
|
9414
|
+
headers: {
|
|
9415
|
+
[name: string]: unknown;
|
|
9416
|
+
};
|
|
9417
|
+
content: {
|
|
9418
|
+
"application/json": components["schemas"]["InventoryItemResponse"];
|
|
9419
|
+
};
|
|
8732
9420
|
};
|
|
8733
|
-
|
|
8734
|
-
|
|
9421
|
+
400: {
|
|
9422
|
+
headers: {
|
|
9423
|
+
[name: string]: unknown;
|
|
9424
|
+
};
|
|
9425
|
+
content: {
|
|
9426
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9427
|
+
};
|
|
9428
|
+
};
|
|
9429
|
+
401: {
|
|
9430
|
+
headers: {
|
|
9431
|
+
[name: string]: unknown;
|
|
9432
|
+
};
|
|
9433
|
+
content: {
|
|
9434
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9435
|
+
};
|
|
9436
|
+
};
|
|
9437
|
+
403: {
|
|
9438
|
+
headers: {
|
|
9439
|
+
[name: string]: unknown;
|
|
9440
|
+
};
|
|
9441
|
+
content: {
|
|
9442
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9443
|
+
};
|
|
9444
|
+
};
|
|
9445
|
+
409: {
|
|
9446
|
+
headers: {
|
|
9447
|
+
[name: string]: unknown;
|
|
9448
|
+
};
|
|
9449
|
+
content: {
|
|
9450
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9451
|
+
};
|
|
9452
|
+
};
|
|
9453
|
+
429: {
|
|
9454
|
+
headers: {
|
|
9455
|
+
[name: string]: unknown;
|
|
9456
|
+
};
|
|
9457
|
+
content: {
|
|
9458
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9459
|
+
};
|
|
9460
|
+
};
|
|
9461
|
+
503: {
|
|
9462
|
+
headers: {
|
|
9463
|
+
[name: string]: unknown;
|
|
9464
|
+
};
|
|
9465
|
+
content: {
|
|
9466
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
9467
|
+
};
|
|
8735
9468
|
};
|
|
8736
9469
|
};
|
|
8737
|
-
}
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
9470
|
+
}, {
|
|
9471
|
+
body: {
|
|
9472
|
+
qty: number;
|
|
9473
|
+
purchaseDate?: string;
|
|
9474
|
+
cost?: number;
|
|
9475
|
+
taxShip?: number;
|
|
9476
|
+
notes?: string;
|
|
9477
|
+
catalogId: number;
|
|
9478
|
+
manualCoffee?: never;
|
|
9479
|
+
} | {
|
|
9480
|
+
qty: number;
|
|
9481
|
+
purchaseDate?: string;
|
|
9482
|
+
cost?: number;
|
|
9483
|
+
taxShip?: number;
|
|
9484
|
+
notes?: string;
|
|
9485
|
+
catalogId?: never;
|
|
9486
|
+
manualCoffee: components["schemas"]["ManualCoffeeCreate"];
|
|
8750
9487
|
};
|
|
8751
|
-
|
|
8752
|
-
|
|
9488
|
+
params: {
|
|
9489
|
+
header: {
|
|
9490
|
+
"idempotency-key": string;
|
|
9491
|
+
};
|
|
9492
|
+
} | undefined;
|
|
9493
|
+
}, `${string}/${string}`>>>;
|
|
9494
|
+
};
|
|
8753
9495
|
/**
|
|
8754
9496
|
* Update one of the caller's own inventory rows. Pass `ifMatch` (the
|
|
8755
9497
|
* row's `last_updated`) to enable optimistic concurrency (409 on mismatch).
|
|
@@ -10277,4 +11019,4 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
|
|
|
10277
11019
|
};
|
|
10278
11020
|
type ParchmentClient = ReturnType<typeof createParchmentClient>;
|
|
10279
11021
|
|
|
10280
|
-
export { type BriefMatchesQuery, type CatalogItem, type CatalogListQuery, type CatalogProofSummary, type CatalogSimilarQuery, type InventoryCreateRequest, type InventoryUpdateRequest, type MarketSignalsQuery, type MetadataIndexQuery, type ParchmentClient, type ParchmentClientOptions, type PriceIndexQuery, type PriceIndexStatsQuery, type SalesCreateRequest, type SalesListQuery, type SalesUpdateRequest, type SourcingBriefCreateRequest, type TrackedLotMutation, type TrackedLotSummary, type TrackedLotsListQuery, type components, createParchmentClient, type paths };
|
|
11022
|
+
export { 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 SalesCreateRequest, type SalesListQuery, type SalesUpdateRequest, type SourcingBriefCreateRequest, type TrackedLotMutation, type TrackedLotSummary, type TrackedLotsListQuery, type components, createParchmentClient, type paths };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,13 @@ function createParchmentClient(options) {
|
|
|
7
7
|
fetch: fetchImpl,
|
|
8
8
|
headers: token ? { Authorization: `Bearer ${token}` } : void 0
|
|
9
9
|
});
|
|
10
|
+
const postInventory = (body, options2) => client.POST("/v1/inventory", {
|
|
11
|
+
body,
|
|
12
|
+
params: options2?.idempotencyKey ? { header: { "idempotency-key": options2.idempotencyKey } } : void 0
|
|
13
|
+
});
|
|
14
|
+
function createInventory(body, options2) {
|
|
15
|
+
return postInventory(body, options2);
|
|
16
|
+
}
|
|
10
17
|
return {
|
|
11
18
|
/** The underlying typed openapi-fetch client for direct path access. */
|
|
12
19
|
raw: client,
|
|
@@ -28,6 +35,20 @@ function createParchmentClient(options) {
|
|
|
28
35
|
params: { path: { id } }
|
|
29
36
|
})
|
|
30
37
|
},
|
|
38
|
+
apiUsage: {
|
|
39
|
+
/**
|
|
40
|
+
* Read bounded API-key traffic analytics for the authenticated session
|
|
41
|
+
* owner. Headline monthly/hourly counts are exact; daily/per-key series
|
|
42
|
+
* carry explicit truncation metadata.
|
|
43
|
+
*/
|
|
44
|
+
get: (query) => client.GET("/v1/api-usage", { params: { query } })
|
|
45
|
+
},
|
|
46
|
+
emailSubscriptions: {
|
|
47
|
+
/** Get the authenticated session user's Market Read preference. */
|
|
48
|
+
get: () => client.GET("/v1/email-subscriptions"),
|
|
49
|
+
/** Idempotently set the authenticated session user's Market Read preference. */
|
|
50
|
+
setMarketRead: (body) => client.PUT("/v1/email-subscriptions/market-read", { body })
|
|
51
|
+
},
|
|
31
52
|
cliAuth: {
|
|
32
53
|
/** Create a signed, short-lived login request bound to a PKCE challenge. */
|
|
33
54
|
create: (body) => client.POST("/v1/cli-auth/requests", { body }),
|
|
@@ -136,14 +157,11 @@ function createParchmentClient(options) {
|
|
|
136
157
|
list: (query) => client.GET("/v1/inventory", { params: { query } }),
|
|
137
158
|
/**
|
|
138
159
|
* Create an owner inventory lot. Requires a session or an owner-bound API
|
|
139
|
-
* key carrying the exact `inventory:write` scope.
|
|
140
|
-
*
|
|
141
|
-
*
|
|
160
|
+
* key carrying the exact `inventory:write` scope. Manual coffee creates
|
|
161
|
+
* require `idempotencyKey`; catalog-backed creates accept it optionally.
|
|
162
|
+
* The same key and payload replay the original result.
|
|
142
163
|
*/
|
|
143
|
-
create:
|
|
144
|
-
body,
|
|
145
|
-
params: options2?.idempotencyKey ? { header: { "idempotency-key": options2.idempotencyKey } } : void 0
|
|
146
|
-
}),
|
|
164
|
+
create: createInventory,
|
|
147
165
|
/**
|
|
148
166
|
* Update one of the caller's own inventory rows. Pass `ifMatch` (the
|
|
149
167
|
* row's `last_updated`) to enable optimistic concurrency (409 on mismatch).
|
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.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\"];\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/** 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/** 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\"];\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 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 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 /** 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. Pass `idempotencyKey`\n * to make retries safe: the same key replays the original result, and a\n * concurrent duplicate gets 409 while the first is in flight.\n */\n create: (\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 * 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 /**\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 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;AA0M1C,SAAS,sBAAsB,SAAiC;AACrE,QAAM,EAAE,SAAS,OAAO,OAAO,UAAU,IAAI;AAE7C,QAAM,SAAS,aAAoB;AAAA,IACjC;AAAA,IACA,OAAO;AAAA,IACP,SAAS,QAAQ,EAAE,eAAe,UAAU,KAAK,GAAG,IAAI;AAAA,EAC1D,CAAC;AAED,SAAO;AAAA;AAAA,IAEL,KAAK;AAAA;AAAA,IAEL,QAAQ,MAAM,OAAO,IAAI,SAAS;AAAA;AAAA,IAElC,IAAI,MAAM,OAAO,IAAI,QAAQ;AAAA,IAC7B,SAAS;AAAA;AAA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AA,IAChE;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.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.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/** 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/** 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\"];\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 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 /** 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 * 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 /**\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 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;AA2N1C,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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