@purveyors/sdk 0.12.0 → 0.13.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
@@ -201,7 +201,7 @@ interface paths {
201
201
  content: {
202
202
  "application/json": {
203
203
  name: string;
204
- scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "portfolio:read" | "inventory:write" | "roast:write" | "sales:write" | "tasting:write")[];
204
+ scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "portfolio:read" | "inventory:write" | "roast:write" | "sales:write" | "tasting:write" | "portfolio:write")[];
205
205
  };
206
206
  };
207
207
  };
@@ -2260,6 +2260,180 @@ interface paths {
2260
2260
  patch?: never;
2261
2261
  trace?: never;
2262
2262
  };
2263
+ "/v1/portfolio/tracked-lots/{catalogId}": {
2264
+ parameters: {
2265
+ query?: never;
2266
+ header?: never;
2267
+ path?: never;
2268
+ cookie?: never;
2269
+ };
2270
+ get?: never;
2271
+ /**
2272
+ * Track a catalog lot
2273
+ * @description Idempotently set a visible catalog lot to tracked for the authenticated owner, capturing its current display price on the first successful PUT. Session eligibility matches portfolio reads; owner-bound API keys additionally require the exact portfolio:write scope.
2274
+ */
2275
+ put: {
2276
+ parameters: {
2277
+ query?: never;
2278
+ header?: never;
2279
+ path: {
2280
+ catalogId: number;
2281
+ };
2282
+ cookie?: never;
2283
+ };
2284
+ requestBody?: never;
2285
+ responses: {
2286
+ /** @description The tracked state after the mutation */
2287
+ 200: {
2288
+ headers: {
2289
+ [name: string]: unknown;
2290
+ };
2291
+ content: {
2292
+ "application/json": components["schemas"]["TrackedLotMutationResponse"];
2293
+ };
2294
+ };
2295
+ /** @description Invalid path or query parameter */
2296
+ 400: {
2297
+ headers: {
2298
+ [name: string]: unknown;
2299
+ };
2300
+ content: {
2301
+ "application/json": components["schemas"]["ErrorResponse"];
2302
+ };
2303
+ };
2304
+ /** @description Authentication required */
2305
+ 401: {
2306
+ headers: {
2307
+ [name: string]: unknown;
2308
+ };
2309
+ content: {
2310
+ "application/json": components["schemas"]["ErrorResponse"];
2311
+ };
2312
+ };
2313
+ /** @description Insufficient entitlement (plan or role) */
2314
+ 403: {
2315
+ headers: {
2316
+ [name: string]: unknown;
2317
+ };
2318
+ content: {
2319
+ "application/json": components["schemas"]["ErrorResponse"];
2320
+ };
2321
+ };
2322
+ /** @description Catalog lot does not exist or is not visible to the authenticated principal */
2323
+ 404: {
2324
+ headers: {
2325
+ [name: string]: unknown;
2326
+ };
2327
+ content: {
2328
+ "application/json": components["schemas"]["ErrorResponse"];
2329
+ };
2330
+ };
2331
+ /** @description Tracked state changed between the idempotent upsert and owner-scoped readback; retry the PUT */
2332
+ 409: {
2333
+ headers: {
2334
+ [name: string]: unknown;
2335
+ };
2336
+ content: {
2337
+ "application/json": components["schemas"]["ErrorResponse"];
2338
+ };
2339
+ };
2340
+ /** @description Per-user mutation throttle exceeded */
2341
+ 429: {
2342
+ headers: {
2343
+ [name: string]: unknown;
2344
+ };
2345
+ content: {
2346
+ "application/json": components["schemas"]["ErrorResponse"];
2347
+ };
2348
+ };
2349
+ /** @description Portfolio writes are disabled */
2350
+ 503: {
2351
+ headers: {
2352
+ [name: string]: unknown;
2353
+ };
2354
+ content: {
2355
+ "application/json": components["schemas"]["ErrorResponse"];
2356
+ };
2357
+ };
2358
+ };
2359
+ };
2360
+ post?: never;
2361
+ /**
2362
+ * Untrack a catalog lot
2363
+ * @description Idempotently set a catalog lot to untracked for the authenticated owner. Repeated DELETE requests return the same untracked state even when the catalog lot is absent or no longer visible.
2364
+ */
2365
+ delete: {
2366
+ parameters: {
2367
+ query?: never;
2368
+ header?: never;
2369
+ path: {
2370
+ catalogId: number;
2371
+ };
2372
+ cookie?: never;
2373
+ };
2374
+ requestBody?: never;
2375
+ responses: {
2376
+ /** @description The untracked state after the mutation */
2377
+ 200: {
2378
+ headers: {
2379
+ [name: string]: unknown;
2380
+ };
2381
+ content: {
2382
+ "application/json": components["schemas"]["TrackedLotMutationResponse"];
2383
+ };
2384
+ };
2385
+ /** @description Invalid path or query parameter */
2386
+ 400: {
2387
+ headers: {
2388
+ [name: string]: unknown;
2389
+ };
2390
+ content: {
2391
+ "application/json": components["schemas"]["ErrorResponse"];
2392
+ };
2393
+ };
2394
+ /** @description Authentication required */
2395
+ 401: {
2396
+ headers: {
2397
+ [name: string]: unknown;
2398
+ };
2399
+ content: {
2400
+ "application/json": components["schemas"]["ErrorResponse"];
2401
+ };
2402
+ };
2403
+ /** @description Insufficient entitlement (plan or role) */
2404
+ 403: {
2405
+ headers: {
2406
+ [name: string]: unknown;
2407
+ };
2408
+ content: {
2409
+ "application/json": components["schemas"]["ErrorResponse"];
2410
+ };
2411
+ };
2412
+ /** @description Per-user mutation throttle exceeded */
2413
+ 429: {
2414
+ headers: {
2415
+ [name: string]: unknown;
2416
+ };
2417
+ content: {
2418
+ "application/json": components["schemas"]["ErrorResponse"];
2419
+ };
2420
+ };
2421
+ /** @description Portfolio writes are disabled */
2422
+ 503: {
2423
+ headers: {
2424
+ [name: string]: unknown;
2425
+ };
2426
+ content: {
2427
+ "application/json": components["schemas"]["ErrorResponse"];
2428
+ };
2429
+ };
2430
+ };
2431
+ };
2432
+ options?: never;
2433
+ head?: never;
2434
+ patch?: never;
2435
+ trace?: never;
2436
+ };
2263
2437
  "/v1/inventory": {
2264
2438
  parameters: {
2265
2439
  query?: never;
@@ -5307,6 +5481,31 @@ interface components {
5307
5481
  };
5308
5482
  };
5309
5483
  };
5484
+ TrackedLotMutationResponse: {
5485
+ data: {
5486
+ catalogId: number;
5487
+ tracked: boolean;
5488
+ trackedAt: string | null;
5489
+ priceAtTracking: number | null;
5490
+ };
5491
+ meta: {
5492
+ /** @enum {string} */
5493
+ resource: "tracked-lots";
5494
+ /** @enum {string} */
5495
+ namespace: "/v1/portfolio/tracked-lots";
5496
+ /** @enum {string} */
5497
+ version: "v1";
5498
+ auth: {
5499
+ /** @enum {string} */
5500
+ kind: "session" | "api-key";
5501
+ /** @enum {string|null} */
5502
+ role: "admin" | "member" | "viewer" | null;
5503
+ /** @enum {string|null} */
5504
+ apiPlan: "viewer" | "member" | "enterprise" | null;
5505
+ ppiAccess: boolean;
5506
+ };
5507
+ };
5508
+ };
5310
5509
  InventoryCatalog: {
5311
5510
  id: number;
5312
5511
  name: string | null;
@@ -6048,6 +6247,8 @@ type SourcingBriefCreateRequest = components["schemas"]["SourcingBriefCreateRequ
6048
6247
  type TrackedLotsListQuery = NonNullable<paths["/v1/portfolio/tracked-lots"]["get"]["parameters"]["query"]>;
6049
6248
  /** A tracked catalog lot enriched with current catalog and price state. */
6050
6249
  type TrackedLotSummary = components["schemas"]["TrackedLotSummary"];
6250
+ /** State returned by tracked-lot PUT and DELETE mutations. */
6251
+ type TrackedLotMutation = components["schemas"]["TrackedLotMutationResponse"];
6051
6252
  /** Query parameters for {@link ParchmentClient.inventory.list}. */
6052
6253
  type InventoryListQuery = NonNullable<paths["/v1/inventory"]["get"]["parameters"]["query"]>;
6053
6254
  /** Request body for {@link ParchmentClient.inventory.create}. */
@@ -6302,7 +6503,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
6302
6503
  content: {
6303
6504
  "application/json": {
6304
6505
  name: string;
6305
- scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "portfolio:read" | "inventory:write" | "roast:write" | "sales:write" | "tasting:write")[];
6506
+ scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "portfolio:read" | "inventory:write" | "roast:write" | "sales:write" | "tasting:write" | "portfolio:write")[];
6306
6507
  };
6307
6508
  };
6308
6509
  };
@@ -6359,7 +6560,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
6359
6560
  }, {
6360
6561
  body: {
6361
6562
  name: string;
6362
- scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "portfolio:read" | "inventory:write" | "roast:write" | "sales:write" | "tasting:write")[];
6563
+ scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "portfolio:read" | "inventory:write" | "roast:write" | "sales:write" | "tasting:write" | "portfolio:write")[];
6363
6564
  };
6364
6565
  }, `${string}/${string}`>>;
6365
6566
  /** Revoke an API key owned by the authenticated session user. */
@@ -8230,6 +8431,158 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
8230
8431
  } | undefined;
8231
8432
  };
8232
8433
  }, `${string}/${string}`>>;
8434
+ /** Idempotently set a visible catalog lot to tracked. */
8435
+ track: (catalogId: number) => Promise<openapi_fetch.FetchResponse<{
8436
+ parameters: {
8437
+ query?: never;
8438
+ header?: never;
8439
+ path: {
8440
+ catalogId: number;
8441
+ };
8442
+ cookie?: never;
8443
+ };
8444
+ requestBody?: never;
8445
+ responses: {
8446
+ 200: {
8447
+ headers: {
8448
+ [name: string]: unknown;
8449
+ };
8450
+ content: {
8451
+ "application/json": components["schemas"]["TrackedLotMutationResponse"];
8452
+ };
8453
+ };
8454
+ 400: {
8455
+ headers: {
8456
+ [name: string]: unknown;
8457
+ };
8458
+ content: {
8459
+ "application/json": components["schemas"]["ErrorResponse"];
8460
+ };
8461
+ };
8462
+ 401: {
8463
+ headers: {
8464
+ [name: string]: unknown;
8465
+ };
8466
+ content: {
8467
+ "application/json": components["schemas"]["ErrorResponse"];
8468
+ };
8469
+ };
8470
+ 403: {
8471
+ headers: {
8472
+ [name: string]: unknown;
8473
+ };
8474
+ content: {
8475
+ "application/json": components["schemas"]["ErrorResponse"];
8476
+ };
8477
+ };
8478
+ 404: {
8479
+ headers: {
8480
+ [name: string]: unknown;
8481
+ };
8482
+ content: {
8483
+ "application/json": components["schemas"]["ErrorResponse"];
8484
+ };
8485
+ };
8486
+ 409: {
8487
+ headers: {
8488
+ [name: string]: unknown;
8489
+ };
8490
+ content: {
8491
+ "application/json": components["schemas"]["ErrorResponse"];
8492
+ };
8493
+ };
8494
+ 429: {
8495
+ headers: {
8496
+ [name: string]: unknown;
8497
+ };
8498
+ content: {
8499
+ "application/json": components["schemas"]["ErrorResponse"];
8500
+ };
8501
+ };
8502
+ 503: {
8503
+ headers: {
8504
+ [name: string]: unknown;
8505
+ };
8506
+ content: {
8507
+ "application/json": components["schemas"]["ErrorResponse"];
8508
+ };
8509
+ };
8510
+ };
8511
+ }, {
8512
+ params: {
8513
+ path: {
8514
+ catalogId: number;
8515
+ };
8516
+ };
8517
+ }, `${string}/${string}`>>;
8518
+ /** Idempotently set an owner catalog lot to untracked. */
8519
+ untrack: (catalogId: number) => Promise<openapi_fetch.FetchResponse<{
8520
+ parameters: {
8521
+ query?: never;
8522
+ header?: never;
8523
+ path: {
8524
+ catalogId: number;
8525
+ };
8526
+ cookie?: never;
8527
+ };
8528
+ requestBody?: never;
8529
+ responses: {
8530
+ 200: {
8531
+ headers: {
8532
+ [name: string]: unknown;
8533
+ };
8534
+ content: {
8535
+ "application/json": components["schemas"]["TrackedLotMutationResponse"];
8536
+ };
8537
+ };
8538
+ 400: {
8539
+ headers: {
8540
+ [name: string]: unknown;
8541
+ };
8542
+ content: {
8543
+ "application/json": components["schemas"]["ErrorResponse"];
8544
+ };
8545
+ };
8546
+ 401: {
8547
+ headers: {
8548
+ [name: string]: unknown;
8549
+ };
8550
+ content: {
8551
+ "application/json": components["schemas"]["ErrorResponse"];
8552
+ };
8553
+ };
8554
+ 403: {
8555
+ headers: {
8556
+ [name: string]: unknown;
8557
+ };
8558
+ content: {
8559
+ "application/json": components["schemas"]["ErrorResponse"];
8560
+ };
8561
+ };
8562
+ 429: {
8563
+ headers: {
8564
+ [name: string]: unknown;
8565
+ };
8566
+ content: {
8567
+ "application/json": components["schemas"]["ErrorResponse"];
8568
+ };
8569
+ };
8570
+ 503: {
8571
+ headers: {
8572
+ [name: string]: unknown;
8573
+ };
8574
+ content: {
8575
+ "application/json": components["schemas"]["ErrorResponse"];
8576
+ };
8577
+ };
8578
+ };
8579
+ }, {
8580
+ params: {
8581
+ path: {
8582
+ catalogId: number;
8583
+ };
8584
+ };
8585
+ }, `${string}/${string}`>>;
8233
8586
  };
8234
8587
  };
8235
8588
  inventory: {
@@ -9919,4 +10272,4 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
9919
10272
  };
9920
10273
  type ParchmentClient = ReturnType<typeof createParchmentClient>;
9921
10274
 
9922
- 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 TrackedLotSummary, type TrackedLotsListQuery, type components, createParchmentClient, type paths };
10275
+ 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 };
package/dist/index.js CHANGED
@@ -120,6 +120,14 @@ function createParchmentClient(options) {
120
120
  */
121
121
  list: (query) => client.GET("/v1/portfolio/tracked-lots", {
122
122
  params: { query }
123
+ }),
124
+ /** Idempotently set a visible catalog lot to tracked. */
125
+ track: (catalogId) => client.PUT("/v1/portfolio/tracked-lots/{catalogId}", {
126
+ params: { path: { catalogId } }
127
+ }),
128
+ /** Idempotently set an owner catalog lot to untracked. */
129
+ untrack: (catalogId) => client.DELETE("/v1/portfolio/tracked-lots/{catalogId}", {
130
+ params: { path: { catalogId } }
123
131
  })
124
132
  }
125
133
  },
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/** 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 },\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;AAuM1C,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,CAAC,SACP,OAAO,KAAK,yBAAyB,EAAE,KAAK,CAAC;AAAA;AAAA,MAE/C,SAAS,CAAC,SACR,OAAO,KAAK,wBAAwB,EAAE,KAAK,CAAC;AAAA;AAAA,MAE9C,SAAS,CAAC,SACR,OAAO,KAAK,wBAAwB,EAAE,KAAK,CAAC;AAAA;AAAA,MAE9C,UAAU,CAAC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Q,EAAE,mBAAmBA,SAAQ,eAAe,EAAE,IACxD;AAAA,MACN,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMH,QAAQ,CAAC,IAAY,SACnB,OAAO,MAAM,kBAAkB;AAAA,QAC7B,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;AAAA,QACvB;AAAA,MACF,CAAC;AAAA;AAAA,MAEH,QAAQ,CAAC,OACP,OAAO,OAAO,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;AAAA,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\"];\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,kBA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AA,QACA,QAAQA,UAAS,iBACb,EAAE,QAAQ,EAAE,mBAAmBA,SAAQ,eAAe,EAAE,IACxD;AAAA,MACN,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMH,QAAQ,CAAC,IAAY,SACnB,OAAO,MAAM,kBAAkB;AAAA,QAC7B,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE;AAAA,QACvB;AAAA,MACF,CAAC;AAAA;AAAA,MAEH,QAAQ,CAAC,OACP,OAAO,OAAO,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;AAAA,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purveyors/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Typed client for the Purveyors Parchment API, generated from its OpenAPI spec.",
5
5
  "license": "MIT",
6
6
  "type": "module",