@purveyors/sdk 0.5.0 → 0.6.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
@@ -2601,7 +2601,77 @@ interface paths {
2601
2601
  };
2602
2602
  };
2603
2603
  post?: never;
2604
- delete?: never;
2604
+ /**
2605
+ * Clear a roast's Artisan import
2606
+ * @description Remove import-derived temperature samples, event markers, and artisan_import_log rows from one of the caller's existing roasts without deleting the roast profile. Import-derived profile metrics are reset to manual/null values. Requires an authenticated session, or an owner-bound API key carrying the exact roast:write scope.
2607
+ */
2608
+ delete: {
2609
+ parameters: {
2610
+ query?: never;
2611
+ header?: never;
2612
+ path: {
2613
+ id: number;
2614
+ };
2615
+ cookie?: never;
2616
+ };
2617
+ requestBody?: never;
2618
+ responses: {
2619
+ /** @description The cleared roast id plus deleted row counts */
2620
+ 200: {
2621
+ headers: {
2622
+ [name: string]: unknown;
2623
+ };
2624
+ content: {
2625
+ "application/json": components["schemas"]["RoastArtisanImportClearResponse"];
2626
+ };
2627
+ };
2628
+ /** @description Authentication required */
2629
+ 401: {
2630
+ headers: {
2631
+ [name: string]: unknown;
2632
+ };
2633
+ content: {
2634
+ "application/json": components["schemas"]["ErrorResponse"];
2635
+ };
2636
+ };
2637
+ /** @description Insufficient entitlement (plan or role) */
2638
+ 403: {
2639
+ headers: {
2640
+ [name: string]: unknown;
2641
+ };
2642
+ content: {
2643
+ "application/json": components["schemas"]["ErrorResponse"];
2644
+ };
2645
+ };
2646
+ /** @description No such roast profile owned by the caller */
2647
+ 404: {
2648
+ headers: {
2649
+ [name: string]: unknown;
2650
+ };
2651
+ content: {
2652
+ "application/json": components["schemas"]["ErrorResponse"];
2653
+ };
2654
+ };
2655
+ /** @description Per-user mutation throttle exceeded; retry after a short wait */
2656
+ 429: {
2657
+ headers: {
2658
+ [name: string]: unknown;
2659
+ };
2660
+ content: {
2661
+ "application/json": components["schemas"]["ErrorResponse"];
2662
+ };
2663
+ };
2664
+ /** @description Roast writes are not enabled in this environment */
2665
+ 503: {
2666
+ headers: {
2667
+ [name: string]: unknown;
2668
+ };
2669
+ content: {
2670
+ "application/json": components["schemas"]["ErrorResponse"];
2671
+ };
2672
+ };
2673
+ };
2674
+ };
2605
2675
  options?: never;
2606
2676
  head?: never;
2607
2677
  patch?: never;
@@ -2926,6 +2996,14 @@ interface components {
2926
2996
  limited: boolean;
2927
2997
  totalAvailable: number;
2928
2998
  };
2999
+ /** @description Freshness contract. `generatedAt` (ISO 8601) is the authoritative time this body was generated. `cacheStatus`/`ttlSeconds` are the resolved cache policy (ttl 0 for private/no-store); ttl is policy, not a promise — stale-while-revalidate may serve an older body, so trust `generatedAt` for actual age. */
3000
+ freshness: {
3001
+ /** Format: date-time */
3002
+ generatedAt: string;
3003
+ /** @enum {string} */
3004
+ cacheStatus: "public" | "private";
3005
+ ttlSeconds: number;
3006
+ };
2929
3007
  /** @description Present only when requested filters/sorts were stripped because the caller lacked the capability. The request still returns 200 with the entitled subset applied. */
2930
3008
  notices?: {
2931
3009
  status: 401 | 403;
@@ -3045,6 +3123,14 @@ interface components {
3045
3123
  stocked: boolean | null;
3046
3124
  premiumMetadata: boolean;
3047
3125
  };
3126
+ /** @description Freshness contract. `generatedAt` (ISO 8601) is the authoritative time this body was generated. `cacheStatus`/`ttlSeconds` are the resolved cache policy (ttl 0 for private/no-store); ttl is policy, not a promise — stale-while-revalidate may serve an older body, so trust `generatedAt` for actual age. */
3127
+ freshness: {
3128
+ /** Format: date-time */
3129
+ generatedAt: string;
3130
+ /** @enum {string} */
3131
+ cacheStatus: "public" | "private";
3132
+ ttlSeconds: number;
3133
+ };
3048
3134
  notices?: {
3049
3135
  status: 401 | 403;
3050
3136
  /** @enum {string} */
@@ -3088,6 +3174,14 @@ interface components {
3088
3174
  scope: "retail" | "wholesale" | "all";
3089
3175
  totalAvailable: number;
3090
3176
  };
3177
+ /** @description Freshness contract. `generatedAt` (ISO 8601) is the authoritative time this body was generated. `cacheStatus`/`ttlSeconds` are the resolved cache policy (ttl 0 for private/no-store); ttl is policy, not a promise — stale-while-revalidate may serve an older body, so trust `generatedAt` for actual age. */
3178
+ freshness: {
3179
+ /** Format: date-time */
3180
+ generatedAt: string;
3181
+ /** @enum {string} */
3182
+ cacheStatus: "public" | "private";
3183
+ ttlSeconds: number;
3184
+ };
3091
3185
  };
3092
3186
  };
3093
3187
  CatalogStatsResponse: {
@@ -3127,6 +3221,14 @@ interface components {
3127
3221
  stocked: boolean | null;
3128
3222
  totalAvailable: number;
3129
3223
  };
3224
+ /** @description Freshness contract. `generatedAt` (ISO 8601) is the authoritative time this body was generated. `cacheStatus`/`ttlSeconds` are the resolved cache policy (ttl 0 for private/no-store); ttl is policy, not a promise — stale-while-revalidate may serve an older body, so trust `generatedAt` for actual age. */
3225
+ freshness: {
3226
+ /** Format: date-time */
3227
+ generatedAt: string;
3228
+ /** @enum {string} */
3229
+ cacheStatus: "public" | "private";
3230
+ ttlSeconds: number;
3231
+ };
3130
3232
  };
3131
3233
  };
3132
3234
  CatalogRankedItem: {
@@ -3371,6 +3473,14 @@ interface components {
3371
3473
  sampled: number;
3372
3474
  totalAvailable: number;
3373
3475
  };
3476
+ /** @description Freshness contract. `generatedAt` (ISO 8601) is the authoritative time this body was generated. `cacheStatus`/`ttlSeconds` are the resolved cache policy (ttl 0 for private/no-store); ttl is policy, not a promise — stale-while-revalidate may serve an older body, so trust `generatedAt` for actual age. */
3477
+ freshness: {
3478
+ /** Format: date-time */
3479
+ generatedAt: string;
3480
+ /** @enum {string} */
3481
+ cacheStatus: "public" | "private";
3482
+ ttlSeconds: number;
3483
+ };
3374
3484
  };
3375
3485
  coverage: {
3376
3486
  overall: {
@@ -4185,6 +4295,34 @@ interface components {
4185
4295
  /** @description Reported source size in bytes for import-log metadata; defaults to the content length. */
4186
4296
  fileSize?: number;
4187
4297
  };
4298
+ RoastArtisanImportClearCounts: {
4299
+ artisan_import_log: number;
4300
+ roast_events: number;
4301
+ roast_temperatures: number;
4302
+ };
4303
+ RoastArtisanImportClearResponse: {
4304
+ data: {
4305
+ id: number;
4306
+ deletedCounts: components["schemas"]["RoastArtisanImportClearCounts"];
4307
+ batchName: string | null;
4308
+ };
4309
+ meta: {
4310
+ /** @enum {string} */
4311
+ resource: "roasts";
4312
+ /** @enum {string} */
4313
+ namespace: "/v1/roasts";
4314
+ /** @enum {string} */
4315
+ version: "v1";
4316
+ auth: {
4317
+ /** @enum {string} */
4318
+ kind: "session" | "api-key";
4319
+ /** @enum {string|null} */
4320
+ role: "admin" | "member" | "viewer" | null;
4321
+ /** @enum {string|null} */
4322
+ apiPlan: "viewer" | "member" | "enterprise" | null;
4323
+ };
4324
+ };
4325
+ };
4188
4326
  RoastListResource: {
4189
4327
  roast_id: number;
4190
4328
  batch_name: string | null;
@@ -7060,6 +7198,77 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
7060
7198
  fileSize?: number;
7061
7199
  };
7062
7200
  }, `${string}/${string}`>>;
7201
+ /**
7202
+ * Clear import-derived curve, events, metrics, and provenance data from
7203
+ * one of the caller's existing roasts without deleting the roast profile.
7204
+ */
7205
+ clearArtisanImport: (id: number) => Promise<openapi_fetch.FetchResponse<{
7206
+ parameters: {
7207
+ query?: never;
7208
+ header?: never;
7209
+ path: {
7210
+ id: number;
7211
+ };
7212
+ cookie?: never;
7213
+ };
7214
+ requestBody?: never;
7215
+ responses: {
7216
+ 200: {
7217
+ headers: {
7218
+ [name: string]: unknown;
7219
+ };
7220
+ content: {
7221
+ "application/json": components["schemas"]["RoastArtisanImportClearResponse"];
7222
+ };
7223
+ };
7224
+ 401: {
7225
+ headers: {
7226
+ [name: string]: unknown;
7227
+ };
7228
+ content: {
7229
+ "application/json": components["schemas"]["ErrorResponse"];
7230
+ };
7231
+ };
7232
+ 403: {
7233
+ headers: {
7234
+ [name: string]: unknown;
7235
+ };
7236
+ content: {
7237
+ "application/json": components["schemas"]["ErrorResponse"];
7238
+ };
7239
+ };
7240
+ 404: {
7241
+ headers: {
7242
+ [name: string]: unknown;
7243
+ };
7244
+ content: {
7245
+ "application/json": components["schemas"]["ErrorResponse"];
7246
+ };
7247
+ };
7248
+ 429: {
7249
+ headers: {
7250
+ [name: string]: unknown;
7251
+ };
7252
+ content: {
7253
+ "application/json": components["schemas"]["ErrorResponse"];
7254
+ };
7255
+ };
7256
+ 503: {
7257
+ headers: {
7258
+ [name: string]: unknown;
7259
+ };
7260
+ content: {
7261
+ "application/json": components["schemas"]["ErrorResponse"];
7262
+ };
7263
+ };
7264
+ };
7265
+ }, {
7266
+ params: {
7267
+ path: {
7268
+ id: number;
7269
+ };
7270
+ };
7271
+ }, `${string}/${string}`>>;
7063
7272
  };
7064
7273
  sales: {
7065
7274
  /** List the caller's own sales (owner-scoped). */
package/dist/index.js CHANGED
@@ -177,6 +177,13 @@ function createParchmentClient(options) {
177
177
  header: options2?.ifMatch ? { "if-match": options2.ifMatch } : void 0
178
178
  },
179
179
  body
180
+ }),
181
+ /**
182
+ * Clear import-derived curve, events, metrics, and provenance data from
183
+ * one of the caller's existing roasts without deleting the roast profile.
184
+ */
185
+ clearArtisanImport: (id) => client.DELETE("/v1/roasts/{id}/artisan-import", {
186
+ params: { path: { id } }
180
187
  })
181
188
  },
182
189
  sales: {
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 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;AAAA;AAAA;AAAA;AAA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A;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.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,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AAA,MACvC,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.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Typed client for the Purveyors Parchment API, generated from its OpenAPI spec.",
5
5
  "license": "MIT",
6
6
  "type": "module",