@purveyors/sdk 0.6.0 → 0.7.1

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 CHANGED
@@ -1271,6 +1271,205 @@ interface paths {
1271
1271
  patch?: never;
1272
1272
  trace?: never;
1273
1273
  };
1274
+ "/v1/market/signals": {
1275
+ parameters: {
1276
+ query?: never;
1277
+ header?: never;
1278
+ path?: never;
1279
+ cookie?: never;
1280
+ };
1281
+ /**
1282
+ * Market value signals (actionable buy signals)
1283
+ * @description Daily actionable value signals over market_signals. The unfiltered summary slice is public; item rows and filtered queries require Parchment Intelligence (ppiAccess).
1284
+ */
1285
+ get: {
1286
+ parameters: {
1287
+ query?: {
1288
+ page?: number;
1289
+ limit?: number;
1290
+ summary?: "true" | "false";
1291
+ type?: string | string[];
1292
+ origin?: string;
1293
+ process?: string;
1294
+ market?: "retail" | "wholesale" | "all";
1295
+ min_discount_pct?: number | null;
1296
+ min_score?: number | null;
1297
+ window?: "7d" | "30d";
1298
+ };
1299
+ header?: never;
1300
+ path?: never;
1301
+ cookie?: never;
1302
+ };
1303
+ requestBody?: never;
1304
+ responses: {
1305
+ /** @description A page of market value signals (or a public summary) */
1306
+ 200: {
1307
+ headers: {
1308
+ [name: string]: unknown;
1309
+ };
1310
+ content: {
1311
+ "application/json": components["schemas"]["MarketSignalsResponse"];
1312
+ };
1313
+ };
1314
+ /** @description Authentication required */
1315
+ 401: {
1316
+ headers: {
1317
+ [name: string]: unknown;
1318
+ };
1319
+ content: {
1320
+ "application/json": components["schemas"]["ErrorResponse"];
1321
+ };
1322
+ };
1323
+ /** @description Insufficient entitlement (plan or role) */
1324
+ 403: {
1325
+ headers: {
1326
+ [name: string]: unknown;
1327
+ };
1328
+ content: {
1329
+ "application/json": components["schemas"]["ErrorResponse"];
1330
+ };
1331
+ };
1332
+ };
1333
+ };
1334
+ put?: never;
1335
+ post?: never;
1336
+ delete?: never;
1337
+ options?: never;
1338
+ head?: never;
1339
+ patch?: never;
1340
+ trace?: never;
1341
+ };
1342
+ "/v1/price-index/stats": {
1343
+ parameters: {
1344
+ query?: never;
1345
+ header?: never;
1346
+ path?: never;
1347
+ cookie?: never;
1348
+ };
1349
+ /**
1350
+ * Price movement significance stats
1351
+ * @description Precomputed movement-significance stats over price_index_move_stats. The unfiltered retail slice is public; origin/process/wholesale filters require Parchment Intelligence (ppiAccess).
1352
+ */
1353
+ get: {
1354
+ parameters: {
1355
+ query?: {
1356
+ page?: number;
1357
+ limit?: number;
1358
+ origin?: string;
1359
+ process?: string;
1360
+ market?: "retail" | "wholesale" | "all";
1361
+ window?: "7d" | "30d";
1362
+ baseline_weeks?: number;
1363
+ };
1364
+ header?: never;
1365
+ path?: never;
1366
+ cookie?: never;
1367
+ };
1368
+ requestBody?: never;
1369
+ responses: {
1370
+ /** @description A page of price movement significance stats */
1371
+ 200: {
1372
+ headers: {
1373
+ [name: string]: unknown;
1374
+ };
1375
+ content: {
1376
+ "application/json": components["schemas"]["PriceIndexStatsResponse"];
1377
+ };
1378
+ };
1379
+ /** @description Authentication required */
1380
+ 401: {
1381
+ headers: {
1382
+ [name: string]: unknown;
1383
+ };
1384
+ content: {
1385
+ "application/json": components["schemas"]["ErrorResponse"];
1386
+ };
1387
+ };
1388
+ /** @description Insufficient entitlement (plan or role) */
1389
+ 403: {
1390
+ headers: {
1391
+ [name: string]: unknown;
1392
+ };
1393
+ content: {
1394
+ "application/json": components["schemas"]["ErrorResponse"];
1395
+ };
1396
+ };
1397
+ };
1398
+ };
1399
+ put?: never;
1400
+ post?: never;
1401
+ delete?: never;
1402
+ options?: never;
1403
+ head?: never;
1404
+ patch?: never;
1405
+ trace?: never;
1406
+ };
1407
+ "/v1/market/metadata-index": {
1408
+ parameters: {
1409
+ query?: never;
1410
+ header?: never;
1411
+ path?: never;
1412
+ cookie?: never;
1413
+ };
1414
+ /**
1415
+ * Metadata-trend index (process/disclosure/Purveyor Score over time)
1416
+ * @description Metadata-trend index over metadata_index_snapshots. The process/retail/month slice is public; other dimensions, origins, and grains require Parchment Intelligence (ppiAccess). Purveyor Score dimensions use coffee_catalog.purveyor_score and companion fields, never supplier-stated score_value.
1417
+ */
1418
+ get: {
1419
+ parameters: {
1420
+ query?: {
1421
+ page?: number;
1422
+ limit?: number;
1423
+ dimension?: "process" | "disclosure" | "purveyor_score" | "purveyor_score_confidence" | "purveyor_score_tier";
1424
+ origin?: string;
1425
+ market?: "retail" | "wholesale" | "all";
1426
+ grain?: "week" | "month";
1427
+ from?: string;
1428
+ to?: string;
1429
+ };
1430
+ header?: never;
1431
+ path?: never;
1432
+ cookie?: never;
1433
+ };
1434
+ requestBody?: never;
1435
+ responses: {
1436
+ /** @description A metadata-trend series */
1437
+ 200: {
1438
+ headers: {
1439
+ [name: string]: unknown;
1440
+ };
1441
+ content: {
1442
+ "application/json": components["schemas"]["MetadataIndexResponse"];
1443
+ };
1444
+ };
1445
+ /** @description Authentication required */
1446
+ 401: {
1447
+ headers: {
1448
+ [name: string]: unknown;
1449
+ };
1450
+ content: {
1451
+ "application/json": components["schemas"]["ErrorResponse"];
1452
+ };
1453
+ };
1454
+ /** @description Insufficient entitlement (plan or role) */
1455
+ 403: {
1456
+ headers: {
1457
+ [name: string]: unknown;
1458
+ };
1459
+ content: {
1460
+ "application/json": components["schemas"]["ErrorResponse"];
1461
+ };
1462
+ };
1463
+ };
1464
+ };
1465
+ put?: never;
1466
+ post?: never;
1467
+ delete?: never;
1468
+ options?: never;
1469
+ head?: never;
1470
+ patch?: never;
1471
+ trace?: never;
1472
+ };
1274
1473
  "/v1/catalog/{id}/similar": {
1275
1474
  parameters: {
1276
1475
  query?: never;
@@ -2848,6 +3047,7 @@ interface components {
2848
3047
  health: string;
2849
3048
  docs: string;
2850
3049
  openapi: string;
3050
+ llms: string;
2851
3051
  };
2852
3052
  MeResponse: {
2853
3053
  authenticated: boolean;
@@ -3577,6 +3777,280 @@ interface components {
3577
3777
  };
3578
3778
  };
3579
3779
  };
3780
+ MarketSignalEvidence: {
3781
+ segment: {
3782
+ origin: string | null;
3783
+ process: string;
3784
+ /** @enum {string} */
3785
+ market: "retail" | "wholesale";
3786
+ };
3787
+ segment_median: number | null;
3788
+ segment_p25: number | null;
3789
+ discount_vs_median_pct: number | null;
3790
+ price_percentile_in_segment: number | null;
3791
+ /** @enum {string|null} */
3792
+ own_trailing_window: "7d" | "30d" | null;
3793
+ own_trailing_median: number | null;
3794
+ drop_vs_own_median_pct: number | null;
3795
+ score_value: number | null;
3796
+ value_ratio: number | null;
3797
+ origin_market_value_ratio_mean: number | null;
3798
+ origin_market_value_ratio_stddev: number | null;
3799
+ value_z_score: number | null;
3800
+ as_of: string;
3801
+ };
3802
+ MarketSignalItem: {
3803
+ /** @enum {string} */
3804
+ signalType: "price_drop" | "below_market" | "value_quality";
3805
+ /** @enum {string} */
3806
+ signalWindow: "7d" | "30d" | "n/a";
3807
+ catalogId: number;
3808
+ source: string | null;
3809
+ origin: string | null;
3810
+ process: string;
3811
+ /** @enum {string} */
3812
+ market: "retail" | "wholesale";
3813
+ scoreValue: number | null;
3814
+ currentPriceLb: number;
3815
+ rankScore: number;
3816
+ /** @enum {string} */
3817
+ rankScoreInput: "drop_vs_own_median_pct" | "discount_vs_median_pct" | "value_z_score";
3818
+ rankSignalMagnitude: number;
3819
+ evidence: components["schemas"]["MarketSignalEvidence"];
3820
+ catalogUrl: string;
3821
+ };
3822
+ MarketSignalsResponse: {
3823
+ data: components["schemas"]["MarketSignalItem"][];
3824
+ pagination: {
3825
+ page: number;
3826
+ limit: number;
3827
+ total: number;
3828
+ totalPages: number;
3829
+ hasNext: boolean;
3830
+ hasPrev: boolean;
3831
+ };
3832
+ meta: {
3833
+ /** @enum {string} */
3834
+ resource: "market-signals";
3835
+ /** @enum {string} */
3836
+ namespace: "/v1/market/signals";
3837
+ /** @enum {string} */
3838
+ version: "v1";
3839
+ auth: {
3840
+ /** @enum {string} */
3841
+ kind: "anonymous" | "session" | "api-key";
3842
+ role: string | null;
3843
+ /** @enum {string|null} */
3844
+ apiPlan: "viewer" | "member" | "enterprise" | null;
3845
+ ppiAccess: boolean;
3846
+ };
3847
+ filters: {
3848
+ summary: boolean;
3849
+ types: ("price_drop" | "below_market" | "value_quality")[];
3850
+ origin: string | null;
3851
+ process: string | null;
3852
+ /** @enum {string} */
3853
+ market: "retail" | "wholesale" | "all";
3854
+ minDiscountPct: number | null;
3855
+ minScore: number | null;
3856
+ /** @enum {string} */
3857
+ window: "7d" | "30d";
3858
+ };
3859
+ access: {
3860
+ publicSlice: boolean;
3861
+ rowLimit: number | null;
3862
+ limited: boolean;
3863
+ totalAvailable: number;
3864
+ };
3865
+ asOf: string | null;
3866
+ computedAt: string | null;
3867
+ thresholds: {
3868
+ dropThresholdPct: number;
3869
+ valueZThreshold: number;
3870
+ benchmarkMinLots: number;
3871
+ benchmarkMinSuppliers: number;
3872
+ };
3873
+ summary: {
3874
+ total: number;
3875
+ byType: {
3876
+ price_drop: number;
3877
+ below_market: number;
3878
+ value_quality: number;
3879
+ };
3880
+ } | null;
3881
+ source: {
3882
+ /** @enum {string} */
3883
+ table: "market_signals";
3884
+ /** @enum {boolean} */
3885
+ aggregateOnly: true;
3886
+ };
3887
+ };
3888
+ };
3889
+ PriceMoveStatsItem: {
3890
+ segment: {
3891
+ origin: string | null;
3892
+ process: string | null;
3893
+ /** @enum {string} */
3894
+ market: "retail" | "wholesale" | "all";
3895
+ };
3896
+ /** @enum {string} */
3897
+ window: "7d" | "30d";
3898
+ latestMovePct: number | null;
3899
+ baselineMeanMovePct: number | null;
3900
+ baselineStddev: number | null;
3901
+ zScore: number | null;
3902
+ movePercentile: number | null;
3903
+ weeksSinceLargerMove: number | null;
3904
+ /** @enum {string|null} */
3905
+ classification: "quiet" | "normal" | "notable" | "exceptional" | null;
3906
+ matchedLotMovePct: number | null;
3907
+ matchedLotCount: number;
3908
+ /** @enum {string|null} */
3909
+ moveDriver: "repricing" | "mix_shift" | "mixed" | "insufficient_overlap" | null;
3910
+ sampleSize: number;
3911
+ supplierCount: number;
3912
+ availableBaselineWeeks: number;
3913
+ note: string | null;
3914
+ };
3915
+ PriceIndexStatsResponse: {
3916
+ data: components["schemas"]["PriceMoveStatsItem"][];
3917
+ pagination: {
3918
+ page: number;
3919
+ limit: number;
3920
+ total: number;
3921
+ totalPages: number;
3922
+ hasNext: boolean;
3923
+ hasPrev: boolean;
3924
+ };
3925
+ meta: {
3926
+ /** @enum {string} */
3927
+ resource: "price-index-stats";
3928
+ /** @enum {string} */
3929
+ namespace: "/v1/price-index/stats";
3930
+ /** @enum {string} */
3931
+ version: "v1";
3932
+ auth: {
3933
+ /** @enum {string} */
3934
+ kind: "anonymous" | "session" | "api-key";
3935
+ role: string | null;
3936
+ /** @enum {string|null} */
3937
+ apiPlan: "viewer" | "member" | "enterprise" | null;
3938
+ ppiAccess: boolean;
3939
+ };
3940
+ filters: {
3941
+ origin: string | null;
3942
+ process: string | null;
3943
+ /** @enum {string} */
3944
+ market: "retail" | "wholesale" | "all";
3945
+ /** @enum {string} */
3946
+ window: "7d" | "30d";
3947
+ baselineWeeks: number;
3948
+ };
3949
+ access: {
3950
+ publicSlice: boolean;
3951
+ rowLimit: number | null;
3952
+ limited: boolean;
3953
+ totalAvailable: number;
3954
+ };
3955
+ asOf: string | null;
3956
+ computedAt: string | null;
3957
+ thresholds: {
3958
+ baselineWeeks: number;
3959
+ minimumBaselineWeeks: number;
3960
+ quietPercentile: number;
3961
+ normalPercentile: number;
3962
+ notablePercentile: number;
3963
+ matchedLotMinimum: number;
3964
+ };
3965
+ source: {
3966
+ /** @enum {string} */
3967
+ table: "price_index_move_stats";
3968
+ /** @enum {boolean} */
3969
+ aggregateOnly: true;
3970
+ };
3971
+ };
3972
+ };
3973
+ MetadataSeriesItem: {
3974
+ period: string;
3975
+ lotCount: number;
3976
+ supplierCount: number;
3977
+ buckets: ({
3978
+ key: string;
3979
+ share: number | null;
3980
+ count: number;
3981
+ supplierCount: number;
3982
+ } | {
3983
+ /** @enum {string} */
3984
+ key: "p25" | "p50" | "p75";
3985
+ value: number | null;
3986
+ count: number;
3987
+ supplierCount: number;
3988
+ })[];
3989
+ };
3990
+ MetadataIndexResponse: {
3991
+ data: components["schemas"]["MetadataSeriesItem"][];
3992
+ pagination: {
3993
+ page: number;
3994
+ limit: number;
3995
+ total: number;
3996
+ totalPages: number;
3997
+ hasNext: boolean;
3998
+ hasPrev: boolean;
3999
+ };
4000
+ meta: {
4001
+ /** @enum {string} */
4002
+ resource: "market-metadata-index";
4003
+ /** @enum {string} */
4004
+ namespace: "/v1/market/metadata-index";
4005
+ /** @enum {string} */
4006
+ version: "v1";
4007
+ auth: {
4008
+ /** @enum {string} */
4009
+ kind: "anonymous" | "session" | "api-key";
4010
+ role: string | null;
4011
+ /** @enum {string|null} */
4012
+ apiPlan: "viewer" | "member" | "enterprise" | null;
4013
+ ppiAccess: boolean;
4014
+ };
4015
+ filters: {
4016
+ /** @enum {string} */
4017
+ dimension: "process" | "disclosure" | "purveyor_score" | "purveyor_score_confidence" | "purveyor_score_tier";
4018
+ origin: string | null;
4019
+ /** @enum {string} */
4020
+ market: "retail" | "wholesale" | "all";
4021
+ /** @enum {string} */
4022
+ grain: "week" | "month";
4023
+ from: string | null;
4024
+ to: string | null;
4025
+ };
4026
+ access: {
4027
+ publicSlice: boolean;
4028
+ rowLimit: number | null;
4029
+ limited: boolean;
4030
+ totalAvailable: number;
4031
+ };
4032
+ asOf: string | null;
4033
+ computedAt: string | null;
4034
+ thresholds: {
4035
+ originSuppressionMinLots: number;
4036
+ publicSlice: {
4037
+ /** @enum {string} */
4038
+ dimension: "process";
4039
+ origin: null;
4040
+ /** @enum {string} */
4041
+ market: "retail";
4042
+ /** @enum {string} */
4043
+ grain: "month";
4044
+ };
4045
+ };
4046
+ source: {
4047
+ /** @enum {string} */
4048
+ table: "metadata_index_snapshots";
4049
+ /** @enum {boolean} */
4050
+ aggregateOnly: true;
4051
+ };
4052
+ };
4053
+ };
3580
4054
  CatalogSimilarityTarget: {
3581
4055
  id: number;
3582
4056
  name: string;
@@ -4515,6 +4989,12 @@ type CatalogSupplierHeaders = NonNullable<paths["/v1/catalog/suppliers"]["get"][
4515
4989
  type CatalogSimilarQuery = NonNullable<paths["/v1/catalog/{id}/similar"]["get"]["parameters"]["query"]>;
4516
4990
  /** Query parameters for {@link ParchmentClient.priceIndex.list}. */
4517
4991
  type PriceIndexQuery = NonNullable<paths["/v1/price-index"]["get"]["parameters"]["query"]>;
4992
+ /** Query parameters for {@link ParchmentClient.market.signals}. */
4993
+ type MarketSignalsQuery = NonNullable<paths["/v1/market/signals"]["get"]["parameters"]["query"]>;
4994
+ /** Query parameters for {@link ParchmentClient.priceIndex.stats}. */
4995
+ type PriceIndexStatsQuery = NonNullable<paths["/v1/price-index/stats"]["get"]["parameters"]["query"]>;
4996
+ /** Query parameters for {@link ParchmentClient.market.metadataIndex}. */
4997
+ type MetadataIndexQuery = NonNullable<paths["/v1/market/metadata-index"]["get"]["parameters"]["query"]>;
4518
4998
  /** Query parameters for {@link ParchmentClient.procurement.briefs.matches}. */
4519
4999
  type BriefMatchesQuery = NonNullable<paths["/v1/procurement/briefs/{id}/matches"]["get"]["parameters"]["query"]>;
4520
5000
  /** Request body for {@link ParchmentClient.procurement.briefs.create}. */
@@ -4811,7 +5291,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
4811
5291
  [name: string]: unknown;
4812
5292
  };
4813
5293
  content: {
4814
- "application/json": components["schemas"]["ErrorResponse"];
5294
+ "application/json": components["schemas"] /** Rotate an API key and return the replacement secret once. */["ErrorResponse"];
4815
5295
  };
4816
5296
  };
4817
5297
  };
@@ -4930,12 +5410,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
4930
5410
  [name: string]: unknown;
4931
5411
  };
4932
5412
  content: {
4933
- "application/json":
4934
- /**
4935
- * Delete one of the caller's own inventory rows. Returns 409 if dependent
4936
- * roast profiles or sales exist (no force-cascade).
4937
- */
4938
- components["schemas"]["ErrorResponse"];
5413
+ "application/json": components["schemas"]["ErrorResponse"];
4939
5414
  };
4940
5415
  };
4941
5416
  404: {
@@ -5072,7 +5547,9 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
5072
5547
  pricePerLbMax?: number | null;
5073
5548
  processing_base_method?: string;
5074
5549
  fermentation_type?: string;
5075
- process_additive?: string;
5550
+ process_additive
5551
+ /** Fetch supplier notes plus the caller's own latest tasting notes. */
5552
+ ? /** Fetch supplier notes plus the caller's own latest tasting notes. */: string;
5076
5553
  has_additives?: "true" | "false";
5077
5554
  processing_disclosure_level?: string;
5078
5555
  processing_confidence_min?: number | null;
@@ -5902,6 +6379,184 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
5902
6379
  } | undefined;
5903
6380
  };
5904
6381
  }, `${string}/${string}`>>;
6382
+ /** Price movement significance stats (precomputed). */
6383
+ stats: (query?: PriceIndexStatsQuery) => Promise<openapi_fetch.FetchResponse<{
6384
+ parameters: {
6385
+ query?: {
6386
+ page?: number;
6387
+ limit?: number;
6388
+ origin?: string;
6389
+ process?: string;
6390
+ market?: "retail" | "wholesale" | "all";
6391
+ window?: "7d" | "30d";
6392
+ baseline_weeks?: number;
6393
+ };
6394
+ header?: never;
6395
+ path?: never;
6396
+ cookie?: never;
6397
+ };
6398
+ requestBody?: never;
6399
+ responses: {
6400
+ 200: {
6401
+ headers: {
6402
+ [name: string]: unknown;
6403
+ };
6404
+ content: {
6405
+ "application/json": components["schemas"]["PriceIndexStatsResponse"];
6406
+ };
6407
+ };
6408
+ 401: {
6409
+ headers: {
6410
+ [name: string]: unknown;
6411
+ };
6412
+ content: {
6413
+ "application/json": components["schemas"]["ErrorResponse"];
6414
+ };
6415
+ };
6416
+ 403: {
6417
+ headers: {
6418
+ [name: string]: unknown;
6419
+ };
6420
+ content: {
6421
+ "application/json": components["schemas"]["ErrorResponse"];
6422
+ };
6423
+ };
6424
+ };
6425
+ }, {
6426
+ params: {
6427
+ query: {
6428
+ page?: number;
6429
+ limit?: number;
6430
+ origin?: string;
6431
+ process?: string;
6432
+ market?: "retail" | "wholesale" | "all";
6433
+ window?: "7d" | "30d";
6434
+ baseline_weeks?: number;
6435
+ } | undefined;
6436
+ };
6437
+ }, `${string}/${string}`>>;
6438
+ };
6439
+ market: {
6440
+ /** Actionable market value signals. */
6441
+ signals: (query?: MarketSignalsQuery) => Promise<openapi_fetch.FetchResponse<{
6442
+ parameters: {
6443
+ query?: {
6444
+ page?: number;
6445
+ limit?: number;
6446
+ summary?: "true" | "false";
6447
+ type?: string | string[];
6448
+ origin?: string;
6449
+ process?: string;
6450
+ market?: "retail" | "wholesale" | "all";
6451
+ min_discount_pct?: number | null;
6452
+ min_score?: number | null;
6453
+ window?: "7d" | "30d";
6454
+ };
6455
+ header?: never;
6456
+ path?: never;
6457
+ cookie?: never;
6458
+ };
6459
+ requestBody?: never;
6460
+ responses: {
6461
+ 200: {
6462
+ headers: {
6463
+ [name: string]: unknown;
6464
+ };
6465
+ content: {
6466
+ "application/json": components["schemas"]["MarketSignalsResponse"];
6467
+ };
6468
+ };
6469
+ 401: {
6470
+ headers: {
6471
+ [name: string]: unknown;
6472
+ };
6473
+ content: {
6474
+ "application/json": components["schemas"]["ErrorResponse"];
6475
+ };
6476
+ };
6477
+ 403: {
6478
+ headers: {
6479
+ [name: string]: unknown;
6480
+ };
6481
+ content: {
6482
+ "application/json": components["schemas"]["ErrorResponse"];
6483
+ };
6484
+ };
6485
+ };
6486
+ }, {
6487
+ params: {
6488
+ query: {
6489
+ page?: number;
6490
+ limit?: number;
6491
+ summary?: "true" | "false";
6492
+ type?: string | string[];
6493
+ origin?: string;
6494
+ process?: string;
6495
+ market?: "retail" | "wholesale" | "all";
6496
+ min_discount_pct?: number | null;
6497
+ min_score?: number | null;
6498
+ window?: "7d" | "30d";
6499
+ } | undefined;
6500
+ };
6501
+ }, `${string}/${string}`>>;
6502
+ /** Metadata-trend index (process/disclosure/Purveyor Score over time). */
6503
+ metadataIndex: (query?: MetadataIndexQuery) => Promise<openapi_fetch.FetchResponse<{
6504
+ parameters: {
6505
+ query?: {
6506
+ page?: number;
6507
+ limit?: number;
6508
+ dimension?: "process" | "disclosure" | "purveyor_score" | "purveyor_score_confidence" | "purveyor_score_tier";
6509
+ origin?: string;
6510
+ market?: "retail" | "wholesale" | "all";
6511
+ grain?: "week" | "month";
6512
+ from?: string;
6513
+ to?: string;
6514
+ };
6515
+ header?: never;
6516
+ path?: never;
6517
+ cookie?: never;
6518
+ };
6519
+ requestBody?: never;
6520
+ responses: {
6521
+ 200: {
6522
+ headers: {
6523
+ [name: string]: unknown;
6524
+ };
6525
+ content: {
6526
+ "application/json": components["schemas"]["MetadataIndexResponse"];
6527
+ };
6528
+ };
6529
+ 401: {
6530
+ headers: {
6531
+ [name: string]: unknown;
6532
+ };
6533
+ content: {
6534
+ "application/json": components["schemas"]["ErrorResponse"];
6535
+ };
6536
+ };
6537
+ 403: {
6538
+ headers: {
6539
+ [name: string]: unknown;
6540
+ };
6541
+ content: {
6542
+ "application/json": components["schemas"]["ErrorResponse"];
6543
+ };
6544
+ };
6545
+ };
6546
+ }, {
6547
+ params: {
6548
+ query: {
6549
+ page?: number;
6550
+ limit?: number;
6551
+ dimension?: "process" | "disclosure" | "purveyor_score" | "purveyor_score_confidence" | "purveyor_score_tier";
6552
+ origin?: string;
6553
+ market?: "retail" | "wholesale" | "all";
6554
+ grain?: "week" | "month";
6555
+ from?: string;
6556
+ to?: string;
6557
+ } | undefined;
6558
+ };
6559
+ }, `${string}/${string}`>>;
5905
6560
  };
5906
6561
  procurement: {
5907
6562
  briefs: {
@@ -7404,4 +8059,4 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
7404
8059
  };
7405
8060
  type ParchmentClient = ReturnType<typeof createParchmentClient>;
7406
8061
 
7407
- export { type BriefMatchesQuery, type CatalogListQuery, type CatalogSimilarQuery, type InventoryCreateRequest, type InventoryUpdateRequest, type ParchmentClient, type ParchmentClientOptions, type PriceIndexQuery, type SourcingBriefCreateRequest, type components, createParchmentClient, type paths };
8062
+ export { type BriefMatchesQuery, type CatalogListQuery, type CatalogSimilarQuery, type InventoryCreateRequest, type InventoryUpdateRequest, type MarketSignalsQuery, type MetadataIndexQuery, type ParchmentClient, type ParchmentClientOptions, type PriceIndexQuery, type PriceIndexStatsQuery, type SourcingBriefCreateRequest, type components, createParchmentClient, type paths };
package/dist/index.js CHANGED
@@ -76,7 +76,15 @@ function createParchmentClient(options) {
76
76
  },
77
77
  priceIndex: {
78
78
  /** Parchment Price Index (aggregate snapshots). */
79
- list: (query) => client.GET("/v1/price-index", { params: { query } })
79
+ list: (query) => client.GET("/v1/price-index", { params: { query } }),
80
+ /** Price movement significance stats (precomputed). */
81
+ stats: (query) => client.GET("/v1/price-index/stats", { params: { query } })
82
+ },
83
+ market: {
84
+ /** Actionable market value signals. */
85
+ signals: (query) => client.GET("/v1/market/signals", { params: { query } }),
86
+ /** Metadata-trend index (process/disclosure/Purveyor Score over time). */
87
+ metadataIndex: (query) => client.GET("/v1/market/metadata-index", { params: { query } })
80
88
  },
81
89
  procurement: {
82
90
  briefs: {
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/** 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.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.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.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.tasting.get}. */\nexport type TastingGetQuery = NonNullable<\n paths[\"/v1/tasting/{catalogId}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.apiKeys.create}. */\nexport type ApiKeyCreateRequest = NonNullable<\n paths[\"/v1/api-keys\"][\"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 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 },\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 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 /** 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 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 },\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AAqJ1C,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;AAAA,MAEP,MAAM,MAAM,OAAO,IAAI,cAAc;AAAA;AAAA,MAErC,QAAQ,CAAC,SACP,OAAO,KAAK,gBAAgB,EAAE,KAAK,CAAC;AAAA;AAAA,MAEtC,QAAQ,CAAC,OACP,OAAO,OAAO,qBAAqB;AAAA,QACjC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;AAAA,MACzB,CAAC;AAAA;AAAA,MAEH,QAAQ,CAAC,OACP,OAAO,KAAK,4BAA4B;AAAA,QACtC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;AAAA,MACzB,CAAC;AAAA,IACL;AAAA,IACA,SAAS;AAAA;AAAA,MAEP,QAAQ,MAAM,OAAO,IAAI,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA,MAK7C,MAAM,CAAC,OAA0B,YAC/B,OAAO,IAAI,eAAe,EAAE,QAAQ,EAAE,OAAO,QAAQ,QAAQ,EAAE,CAAC;AAAA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AA;AAAA;AAAA;AAAA,MAKH,oBAAoB,CAAC,OACnB,OAAO,OAAO,kCAAkC;AAAA,QAC9C,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;AAAA,MACzB,CAAC;AAAA,IACL;AAAA,IACA,OAAO;AAAA;AAAA,MAEL,MAAM,CAAC,UACL,OAAO,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAAA,IACjD;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,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/** 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.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.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.tasting.get}. */\nexport type TastingGetQuery = NonNullable<\n paths[\"/v1/tasting/{catalogId}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.apiKeys.create}. */\nexport type ApiKeyCreateRequest = NonNullable<\n paths[\"/v1/api-keys\"][\"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 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 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 /** 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 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 },\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AAiK1C,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;AAAA,MAEP,MAAM,MAAM,OAAO,IAAI,cAAc;AAAA;AAAA,MAErC,QAAQ,CAAC,SACP,OAAO,KAAK,gBAAgB,EAAE,KAAK,CAAC;AAAA;AAAA,MAEtC,QAAQ,CAAC,OACP,OAAO,OAAO,qBAAqB;AAAA,QACjC,QAAQ,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.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Typed client for the Purveyors Parchment API, generated from its OpenAPI spec.",
5
5
  "license": "MIT",
6
6
  "type": "module",