@purveyors/sdk 0.1.0 → 0.2.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 CHANGED
@@ -1241,12 +1241,23 @@ interface ParchmentClientOptions {
1241
1241
  /** Override the fetch implementation (useful for tests or custom runtimes). */
1242
1242
  fetch?: ClientOptions["fetch"];
1243
1243
  }
1244
+ /** Query parameters for {@link ParchmentClient.catalog.list}. */
1245
+ type CatalogListQuery = NonNullable<paths["/v1/catalog"]["get"]["parameters"]["query"]>;
1246
+ /** Query parameters for {@link ParchmentClient.catalog.similar}. */
1247
+ type CatalogSimilarQuery = NonNullable<paths["/v1/catalog/{id}/similar"]["get"]["parameters"]["query"]>;
1248
+ /** Query parameters for {@link ParchmentClient.priceIndex.list}. */
1249
+ type PriceIndexQuery = NonNullable<paths["/v1/price-index"]["get"]["parameters"]["query"]>;
1250
+ /** Query parameters for {@link ParchmentClient.procurement.briefs.matches}. */
1251
+ type BriefMatchesQuery = NonNullable<paths["/v1/procurement/briefs/{id}/matches"]["get"]["parameters"]["query"]>;
1252
+ /** Request body for {@link ParchmentClient.procurement.briefs.create}. */
1253
+ type SourcingBriefCreateRequest = components["schemas"]["SourcingBriefCreateRequest"];
1244
1254
  /**
1245
1255
  * Create a typed Parchment API client.
1246
1256
  *
1247
1257
  * The generated core (openapi-fetch over the generated `paths` types) is the
1248
- * contract truth; the small named helpers below are the hand-maintained
1249
- * ergonomic layer and grow as endpoints land.
1258
+ * contract truth; the named helpers below are the hand-maintained ergonomic
1259
+ * layer and grow as endpoints land. `raw` always exposes the underlying typed
1260
+ * client for direct path access to anything not yet wrapped.
1250
1261
  */
1251
1262
  declare function createParchmentClient(options: ParchmentClientOptions): {
1252
1263
  /** The underlying typed openapi-fetch client for direct path access. */
@@ -1289,7 +1300,537 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
1289
1300
  };
1290
1301
  };
1291
1302
  }> | undefined, `${string}/${string}`>>;
1303
+ /** Resolved principal and entitlements for the caller. */
1304
+ me: () => Promise<openapi_fetch.FetchResponse<{
1305
+ parameters: {
1306
+ query?: never;
1307
+ header?: never;
1308
+ path?: never;
1309
+ cookie?: never;
1310
+ };
1311
+ requestBody?: never;
1312
+ responses: {
1313
+ 200: {
1314
+ headers: {
1315
+ [name: string]: unknown;
1316
+ };
1317
+ content: {
1318
+ "application/json": components["schemas"]["MeResponse"];
1319
+ };
1320
+ };
1321
+ };
1322
+ }, openapi_fetch.FetchOptions<{
1323
+ parameters: {
1324
+ query?: never;
1325
+ header?: never;
1326
+ path?: never;
1327
+ cookie?: never;
1328
+ };
1329
+ requestBody?: never;
1330
+ responses: {
1331
+ 200: {
1332
+ headers: {
1333
+ [name: string]: unknown;
1334
+ };
1335
+ content: {
1336
+ "application/json": components["schemas"]["MeResponse"];
1337
+ };
1338
+ };
1339
+ };
1340
+ }> | undefined, `${string}/${string}`>>;
1341
+ catalog: {
1342
+ /** Catalog capabilities and visibility for the caller. */
1343
+ access: () => Promise<openapi_fetch.FetchResponse<{
1344
+ parameters: {
1345
+ query?: never;
1346
+ header?: never;
1347
+ path?: never;
1348
+ cookie?: never;
1349
+ };
1350
+ requestBody?: never;
1351
+ responses: {
1352
+ 200: {
1353
+ headers: {
1354
+ [name: string]: unknown;
1355
+ };
1356
+ content: {
1357
+ "application/json": components["schemas"]["CatalogAccessResponse"];
1358
+ };
1359
+ };
1360
+ };
1361
+ }, openapi_fetch.FetchOptions<{
1362
+ parameters: {
1363
+ query?: never;
1364
+ header?: never;
1365
+ path?: never;
1366
+ cookie?: never;
1367
+ };
1368
+ requestBody?: never;
1369
+ responses: {
1370
+ 200: {
1371
+ headers: {
1372
+ [name: string]: unknown;
1373
+ };
1374
+ content: {
1375
+ "application/json": components["schemas"]["CatalogAccessResponse"];
1376
+ };
1377
+ };
1378
+ };
1379
+ }> | undefined, `${string}/${string}`>>;
1380
+ /** List public catalog coffees (paginated). */
1381
+ list: (query?: CatalogListQuery) => Promise<openapi_fetch.FetchResponse<{
1382
+ parameters: {
1383
+ query?: {
1384
+ page?: number;
1385
+ limit?: number;
1386
+ stocked?: "true" | "false" | "all";
1387
+ sort?: string;
1388
+ order?: "asc" | "desc";
1389
+ };
1390
+ header?: never;
1391
+ path?: never;
1392
+ cookie?: never;
1393
+ };
1394
+ requestBody?: never;
1395
+ responses: {
1396
+ 200: {
1397
+ headers: {
1398
+ [name: string]: unknown;
1399
+ };
1400
+ content: {
1401
+ "application/json": components["schemas"]["CatalogListResponse"];
1402
+ };
1403
+ };
1404
+ };
1405
+ }, {
1406
+ params: {
1407
+ query: {
1408
+ page?: number;
1409
+ limit?: number;
1410
+ stocked?: "true" | "false" | "all";
1411
+ sort?: string;
1412
+ order?: "asc" | "desc";
1413
+ } | undefined;
1414
+ };
1415
+ }, `${string}/${string}`>>;
1416
+ /** Aggregate proof-coverage over the public catalog. */
1417
+ proofCoverage: () => Promise<openapi_fetch.FetchResponse<{
1418
+ parameters: {
1419
+ query?: never;
1420
+ header?: never;
1421
+ path?: never;
1422
+ cookie?: never;
1423
+ };
1424
+ requestBody?: never;
1425
+ responses: {
1426
+ 200: {
1427
+ headers: {
1428
+ [name: string]: unknown;
1429
+ };
1430
+ content: {
1431
+ "application/json": components["schemas"]["CatalogProofCoverageResponse"];
1432
+ };
1433
+ };
1434
+ };
1435
+ }, openapi_fetch.FetchOptions<{
1436
+ parameters: {
1437
+ query?: never;
1438
+ header?: never;
1439
+ path?: never;
1440
+ cookie?: never;
1441
+ };
1442
+ requestBody?: never;
1443
+ responses: {
1444
+ 200: {
1445
+ headers: {
1446
+ [name: string]: unknown;
1447
+ };
1448
+ content: {
1449
+ "application/json": components["schemas"]["CatalogProofCoverageResponse"];
1450
+ };
1451
+ };
1452
+ };
1453
+ }> | undefined, `${string}/${string}`>>;
1454
+ /** Find catalog coffees similar to a target coffee. */
1455
+ similar: (id: string, query?: CatalogSimilarQuery) => Promise<openapi_fetch.FetchResponse<{
1456
+ parameters: {
1457
+ query?: {
1458
+ threshold?: string;
1459
+ limit?: number;
1460
+ stocked_only?: "true" | "false";
1461
+ mode?: "all" | "likely_same" | "similar_profile";
1462
+ };
1463
+ header?: never;
1464
+ path: {
1465
+ id: string;
1466
+ };
1467
+ cookie?: never;
1468
+ };
1469
+ requestBody?: never;
1470
+ responses: {
1471
+ 200: {
1472
+ headers: {
1473
+ [name: string]: unknown;
1474
+ };
1475
+ content: {
1476
+ "application/json": components["schemas"]["CatalogSimilarityResponse"];
1477
+ };
1478
+ };
1479
+ 400: {
1480
+ headers: {
1481
+ [name: string]: unknown;
1482
+ };
1483
+ content: {
1484
+ "application/json": components["schemas"]["ErrorResponse"];
1485
+ };
1486
+ };
1487
+ 401: {
1488
+ headers: {
1489
+ [name: string]: unknown;
1490
+ };
1491
+ content: {
1492
+ "application/json": components["schemas"]["ErrorResponse"];
1493
+ };
1494
+ };
1495
+ 403: {
1496
+ headers: {
1497
+ [name: string]: unknown;
1498
+ };
1499
+ content: {
1500
+ "application/json": components["schemas"]["ErrorResponse"];
1501
+ };
1502
+ };
1503
+ 404: {
1504
+ headers: {
1505
+ [name: string]: unknown;
1506
+ };
1507
+ content: {
1508
+ "application/json": components["schemas"]["ErrorResponse"];
1509
+ };
1510
+ };
1511
+ };
1512
+ }, {
1513
+ params: {
1514
+ path: {
1515
+ id: string;
1516
+ };
1517
+ query: {
1518
+ threshold?: string;
1519
+ limit?: number;
1520
+ stocked_only?: "true" | "false";
1521
+ mode?: "all" | "likely_same" | "similar_profile";
1522
+ } | undefined;
1523
+ };
1524
+ }, `${string}/${string}`>>;
1525
+ };
1526
+ priceIndex: {
1527
+ /** Parchment Price Index (aggregate snapshots). */
1528
+ list: (query?: PriceIndexQuery) => Promise<openapi_fetch.FetchResponse<{
1529
+ parameters: {
1530
+ query?: {
1531
+ page?: number;
1532
+ limit?: number;
1533
+ origin?: string;
1534
+ process?: string;
1535
+ grade?: string;
1536
+ from?: string;
1537
+ to?: string;
1538
+ wholesale?: "true" | "false";
1539
+ };
1540
+ header?: never;
1541
+ path?: never;
1542
+ cookie?: never;
1543
+ };
1544
+ requestBody?: never;
1545
+ responses: {
1546
+ 200: {
1547
+ headers: {
1548
+ [name: string]: unknown;
1549
+ };
1550
+ content: {
1551
+ "application/json": components["schemas"]["PriceIndexResponse"];
1552
+ };
1553
+ };
1554
+ 401: {
1555
+ headers: {
1556
+ [name: string]: unknown;
1557
+ };
1558
+ content: {
1559
+ "application/json": components["schemas"]["ErrorResponse"];
1560
+ };
1561
+ };
1562
+ 403: {
1563
+ headers: {
1564
+ [name: string]: unknown;
1565
+ };
1566
+ content: {
1567
+ "application/json": components["schemas"]["ErrorResponse"];
1568
+ };
1569
+ };
1570
+ };
1571
+ }, {
1572
+ params: {
1573
+ query: {
1574
+ page?: number;
1575
+ limit?: number;
1576
+ origin?: string;
1577
+ process?: string;
1578
+ grade?: string;
1579
+ from?: string;
1580
+ to?: string;
1581
+ wholesale?: "true" | "false";
1582
+ } | undefined;
1583
+ };
1584
+ }, `${string}/${string}`>>;
1585
+ };
1586
+ procurement: {
1587
+ briefs: {
1588
+ /** List the caller's saved sourcing briefs. */
1589
+ list: () => Promise<openapi_fetch.FetchResponse<{
1590
+ parameters: {
1591
+ query?: never;
1592
+ header?: never;
1593
+ path?: never;
1594
+ cookie?: never;
1595
+ };
1596
+ requestBody?: never;
1597
+ responses: {
1598
+ 200: {
1599
+ headers: {
1600
+ [name: string]: unknown;
1601
+ };
1602
+ content: {
1603
+ "application/json": components["schemas"]["SourcingBriefsListResponse"];
1604
+ };
1605
+ };
1606
+ 401: {
1607
+ headers: {
1608
+ [name: string]: unknown;
1609
+ };
1610
+ content: {
1611
+ "application/json": components["schemas"]["ErrorResponse"];
1612
+ };
1613
+ };
1614
+ 403: {
1615
+ headers: {
1616
+ [name: string]: unknown;
1617
+ };
1618
+ content: {
1619
+ "application/json": components["schemas"]["ErrorResponse"];
1620
+ };
1621
+ };
1622
+ };
1623
+ }, openapi_fetch.FetchOptions<{
1624
+ parameters: {
1625
+ query?: never;
1626
+ header?: never;
1627
+ path?: never;
1628
+ cookie?: never;
1629
+ };
1630
+ requestBody?: never;
1631
+ responses: {
1632
+ 200: {
1633
+ headers: {
1634
+ [name: string]: unknown;
1635
+ };
1636
+ content: {
1637
+ "application/json": components["schemas"]["SourcingBriefsListResponse"];
1638
+ };
1639
+ };
1640
+ 401: {
1641
+ headers: {
1642
+ [name: string]: unknown;
1643
+ };
1644
+ content: {
1645
+ "application/json": components["schemas"]["ErrorResponse"];
1646
+ };
1647
+ };
1648
+ 403: {
1649
+ headers: {
1650
+ [name: string]: unknown;
1651
+ };
1652
+ content: {
1653
+ "application/json": components["schemas"]["ErrorResponse"];
1654
+ };
1655
+ };
1656
+ };
1657
+ }> | undefined, `${string}/${string}`>>;
1658
+ /** Create a saved sourcing brief. */
1659
+ create: (body: SourcingBriefCreateRequest) => Promise<openapi_fetch.FetchResponse<{
1660
+ parameters: {
1661
+ query?: never;
1662
+ header?: never;
1663
+ path?: never;
1664
+ cookie?: never;
1665
+ };
1666
+ requestBody?: {
1667
+ content: {
1668
+ "application/json": components["schemas"]["SourcingBriefCreateRequest"];
1669
+ };
1670
+ };
1671
+ responses: {
1672
+ 201: {
1673
+ headers: {
1674
+ [name: string]: unknown;
1675
+ };
1676
+ content: {
1677
+ "application/json": components["schemas"]["SourcingBriefResponse"];
1678
+ };
1679
+ };
1680
+ 400: {
1681
+ headers: {
1682
+ [name: string]: unknown;
1683
+ };
1684
+ content: {
1685
+ "application/json": components["schemas"]["ErrorResponse"];
1686
+ };
1687
+ };
1688
+ 401: {
1689
+ headers: {
1690
+ [name: string]: unknown;
1691
+ };
1692
+ content: {
1693
+ "application/json": components["schemas"]["ErrorResponse"];
1694
+ };
1695
+ };
1696
+ 403: {
1697
+ headers: {
1698
+ [name: string]: unknown;
1699
+ };
1700
+ content: {
1701
+ "application/json": components["schemas"]["ErrorResponse"];
1702
+ };
1703
+ };
1704
+ };
1705
+ }, {
1706
+ body: {
1707
+ name: string;
1708
+ criteria: components["schemas"]["SourcingBriefCriteria"] & unknown;
1709
+ cadence?: "manual";
1710
+ };
1711
+ }, `${string}/${string}`>>;
1712
+ /** Fetch one of the caller's sourcing briefs by id. */
1713
+ get: (id: string) => Promise<openapi_fetch.FetchResponse<{
1714
+ parameters: {
1715
+ query?: never;
1716
+ header?: never;
1717
+ path: {
1718
+ id: string;
1719
+ };
1720
+ cookie?: never;
1721
+ };
1722
+ requestBody?: never;
1723
+ responses: {
1724
+ 200: {
1725
+ headers: {
1726
+ [name: string]: unknown;
1727
+ };
1728
+ content: {
1729
+ "application/json": components["schemas"]["SourcingBriefResponse"];
1730
+ };
1731
+ };
1732
+ 401: {
1733
+ headers: {
1734
+ [name: string]: unknown;
1735
+ };
1736
+ content: {
1737
+ "application/json": components["schemas"]["ErrorResponse"];
1738
+ };
1739
+ };
1740
+ 403: {
1741
+ headers: {
1742
+ [name: string]: unknown;
1743
+ };
1744
+ content: {
1745
+ "application/json": components["schemas"]["ErrorResponse"];
1746
+ };
1747
+ };
1748
+ 404: {
1749
+ headers: {
1750
+ [name: string]: unknown;
1751
+ };
1752
+ content: {
1753
+ "application/json": components["schemas"]["ErrorResponse"];
1754
+ };
1755
+ };
1756
+ };
1757
+ }, {
1758
+ params: {
1759
+ path: {
1760
+ id: string;
1761
+ };
1762
+ };
1763
+ }, `${string}/${string}`>>;
1764
+ /** Run a saved brief against the catalog (paginated matches). */
1765
+ matches: (id: string, query?: BriefMatchesQuery) => Promise<openapi_fetch.FetchResponse<{
1766
+ parameters: {
1767
+ query?: {
1768
+ page?: number;
1769
+ limit?: number;
1770
+ };
1771
+ header?: never;
1772
+ path: {
1773
+ id: string;
1774
+ };
1775
+ cookie?: never;
1776
+ };
1777
+ requestBody?: never;
1778
+ responses: {
1779
+ 200: {
1780
+ headers: {
1781
+ [name: string]: unknown;
1782
+ };
1783
+ content: {
1784
+ "application/json": components["schemas"]["SourcingBriefMatchesResponse"];
1785
+ };
1786
+ };
1787
+ 400: {
1788
+ headers: {
1789
+ [name: string]: unknown;
1790
+ };
1791
+ content: {
1792
+ "application/json": components["schemas"]["ErrorResponse"];
1793
+ };
1794
+ };
1795
+ 401: {
1796
+ headers: {
1797
+ [name: string]: unknown;
1798
+ };
1799
+ content: {
1800
+ "application/json": components["schemas"]["ErrorResponse"];
1801
+ };
1802
+ };
1803
+ 403: {
1804
+ headers: {
1805
+ [name: string]: unknown;
1806
+ };
1807
+ content: {
1808
+ "application/json": components["schemas"]["ErrorResponse"];
1809
+ };
1810
+ };
1811
+ 404: {
1812
+ headers: {
1813
+ [name: string]: unknown;
1814
+ };
1815
+ content: {
1816
+ "application/json": components["schemas"]["ErrorResponse"];
1817
+ };
1818
+ };
1819
+ };
1820
+ }, {
1821
+ params: {
1822
+ path: {
1823
+ id: string;
1824
+ };
1825
+ query: {
1826
+ page?: number;
1827
+ limit?: number;
1828
+ } | undefined;
1829
+ };
1830
+ }, `${string}/${string}`>>;
1831
+ };
1832
+ };
1292
1833
  };
1293
1834
  type ParchmentClient = ReturnType<typeof createParchmentClient>;
1294
1835
 
1295
- export { type ParchmentClient, type ParchmentClientOptions, type components, createParchmentClient, type paths };
1836
+ export { type BriefMatchesQuery, type CatalogListQuery, type CatalogSimilarQuery, type ParchmentClient, type ParchmentClientOptions, type PriceIndexQuery, type SourcingBriefCreateRequest, type components, createParchmentClient, type paths };
package/dist/index.js CHANGED
@@ -11,7 +11,41 @@ function createParchmentClient(options) {
11
11
  /** The underlying typed openapi-fetch client for direct path access. */
12
12
  raw: client,
13
13
  /** Liveness and service identity. */
14
- health: () => client.GET("/health")
14
+ health: () => client.GET("/health"),
15
+ /** Resolved principal and entitlements for the caller. */
16
+ me: () => client.GET("/v1/me"),
17
+ catalog: {
18
+ /** Catalog capabilities and visibility for the caller. */
19
+ access: () => client.GET("/v1/catalog/access"),
20
+ /** List public catalog coffees (paginated). */
21
+ list: (query) => client.GET("/v1/catalog", { params: { query } }),
22
+ /** Aggregate proof-coverage over the public catalog. */
23
+ proofCoverage: () => client.GET("/v1/catalog/proof-coverage"),
24
+ /** Find catalog coffees similar to a target coffee. */
25
+ similar: (id, query) => client.GET("/v1/catalog/{id}/similar", {
26
+ params: { path: { id }, query }
27
+ })
28
+ },
29
+ priceIndex: {
30
+ /** Parchment Price Index (aggregate snapshots). */
31
+ list: (query) => client.GET("/v1/price-index", { params: { query } })
32
+ },
33
+ procurement: {
34
+ briefs: {
35
+ /** List the caller's saved sourcing briefs. */
36
+ list: () => client.GET("/v1/procurement/briefs"),
37
+ /** Create a saved sourcing brief. */
38
+ create: (body) => client.POST("/v1/procurement/briefs", { body }),
39
+ /** Fetch one of the caller's sourcing briefs by id. */
40
+ get: (id) => client.GET("/v1/procurement/briefs/{id}", {
41
+ params: { path: { id } }
42
+ }),
43
+ /** Run a saved brief against the catalog (paginated matches). */
44
+ matches: (id, query) => client.GET("/v1/procurement/briefs/{id}/matches", {
45
+ params: { path: { id }, query }
46
+ })
47
+ }
48
+ }
15
49
  };
16
50
  }
17
51
  export {
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 { paths } from \"./schema\";\n\nexport interface ParchmentClientOptions {\n /** Base URL of the Parchment API, e.g. https://api.purveyors.io */\n baseUrl: string;\n /**\n * Optional bearer token (a Supabase JWT or, later, an API key). Sent as\n * `Authorization: Bearer <token>`. Auth is resolved server-side against the\n * unified principal model; the SDK only forwards the credential.\n */\n token?: string;\n /** Override the fetch implementation (useful for tests or custom runtimes). */\n fetch?: ClientOptions[\"fetch\"];\n}\n\n/**\n * Create a typed Parchment API client.\n *\n * The generated core (openapi-fetch over the generated `paths` types) is the\n * contract truth; the small named helpers below are the hand-maintained\n * ergonomic layer and grow as endpoints land.\n */\nexport function createParchmentClient(options: ParchmentClientOptions) {\n const { baseUrl, token, fetch: fetchImpl } = options;\n\n const client = createClient<paths>({\n baseUrl,\n fetch: fetchImpl,\n headers: token ? { Authorization: `Bearer ${token}` } : undefined,\n });\n\n return {\n /** The underlying typed openapi-fetch client for direct path access. */\n raw: client,\n /** Liveness and service identity. */\n health: () => client.GET(\"/health\"),\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AAuB1C,SAAS,sBAAsB,SAAiC;AACrE,QAAM,EAAE,SAAS,OAAO,OAAO,UAAU,IAAI;AAE7C,QAAM,SAAS,aAAoB;AAAA,IACjC;AAAA,IACA,OAAO;AAAA,IACP,SAAS,QAAQ,EAAE,eAAe,UAAU,KAAK,GAAG,IAAI;AAAA,EAC1D,CAAC;AAED,SAAO;AAAA;AAAA,IAEL,KAAK;AAAA;AAAA,IAEL,QAAQ,MAAM,OAAO,IAAI,SAAS;AAAA,EACpC;AACF;","names":[]}
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.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\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 catalog: {\n /** Catalog capabilities and visibility for the caller. */\n access: () => client.GET(\"/v1/catalog/access\"),\n /** List public catalog coffees (paginated). */\n list: (query?: CatalogListQuery) =>\n client.GET(\"/v1/catalog\", { params: { query } }),\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 };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AA4C1C,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,QAAQ,MAAM,OAAO,IAAI,oBAAoB;AAAA;AAAA,MAE7C,MAAM,CAAC,UACL,OAAO,IAAI,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAAA;AAAA,MAEjD,eAAe,MAAM,OAAO,IAAI,4BAA4B;AAAA;AAAA,MAE5D,SAAS,CAAC,IAAY,UACpB,OAAO,IAAI,4BAA4B;AAAA,QACrC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM;AAAA,MAChC,CAAC;AAAA,IACL;AAAA,IACA,YAAY;AAAA;AAAA,MAEV,MAAM,CAAC,UACL,OAAO,IAAI,mBAAmB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAAA,IACvD;AAAA,IACA,aAAa;AAAA,MACX,QAAQ;AAAA;AAAA,QAEN,MAAM,MAAM,OAAO,IAAI,wBAAwB;AAAA;AAAA,QAE/C,QAAQ,CAAC,SACP,OAAO,KAAK,0BAA0B,EAAE,KAAK,CAAC;AAAA;AAAA,QAEhD,KAAK,CAAC,OACJ,OAAO,IAAI,+BAA+B;AAAA,UACxC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;AAAA,QACzB,CAAC;AAAA;AAAA,QAEH,SAAS,CAAC,IAAY,UACpB,OAAO,IAAI,uCAAuC;AAAA,UAChD,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM;AAAA,QAChC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purveyors/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Typed client for the Purveyors Parchment API, generated from its OpenAPI spec.",
5
5
  "license": "MIT",
6
6
  "type": "module",