@purveyors/sdk 0.7.1 → 0.8.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" | "inventory:write" | "roast:write")[];
204
+ scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "inventory:write" | "roast:write" | "sales:write")[];
205
205
  };
206
206
  };
207
207
  };
@@ -2942,13 +2942,274 @@ interface paths {
2942
2942
  };
2943
2943
  };
2944
2944
  put?: never;
2945
- post?: never;
2945
+ /**
2946
+ * Record an owner sale
2947
+ * @description Record a sale against one of the caller's own green-coffee inventory lots. Requires an authenticated session, or an owner-bound API key carrying the exact sales:write scope.
2948
+ */
2949
+ post: {
2950
+ parameters: {
2951
+ query?: never;
2952
+ header?: {
2953
+ "idempotency-key"?: string;
2954
+ };
2955
+ path?: never;
2956
+ cookie?: never;
2957
+ };
2958
+ requestBody?: {
2959
+ content: {
2960
+ "application/json": components["schemas"]["SalesCreateRequest"];
2961
+ };
2962
+ };
2963
+ responses: {
2964
+ /** @description The created sale */
2965
+ 201: {
2966
+ headers: {
2967
+ [name: string]: unknown;
2968
+ };
2969
+ content: {
2970
+ "application/json": components["schemas"]["SaleItemResponse"];
2971
+ };
2972
+ };
2973
+ /** @description Invalid query parameter */
2974
+ 400: {
2975
+ headers: {
2976
+ [name: string]: unknown;
2977
+ };
2978
+ content: {
2979
+ "application/json": components["schemas"]["ErrorResponse"];
2980
+ };
2981
+ };
2982
+ /** @description Authentication required */
2983
+ 401: {
2984
+ headers: {
2985
+ [name: string]: unknown;
2986
+ };
2987
+ content: {
2988
+ "application/json": components["schemas"]["ErrorResponse"];
2989
+ };
2990
+ };
2991
+ /** @description Insufficient entitlement (plan or role) */
2992
+ 403: {
2993
+ headers: {
2994
+ [name: string]: unknown;
2995
+ };
2996
+ content: {
2997
+ "application/json": components["schemas"]["ErrorResponse"];
2998
+ };
2999
+ };
3000
+ /** @description Write conflict: a request with this Idempotency-Key is already in flight */
3001
+ 409: {
3002
+ headers: {
3003
+ [name: string]: unknown;
3004
+ };
3005
+ content: {
3006
+ "application/json": components["schemas"]["ErrorResponse"];
3007
+ };
3008
+ };
3009
+ /** @description Per-user mutation throttle exceeded; retry after a short wait */
3010
+ 429: {
3011
+ headers: {
3012
+ [name: string]: unknown;
3013
+ };
3014
+ content: {
3015
+ "application/json": components["schemas"]["ErrorResponse"];
3016
+ };
3017
+ };
3018
+ /** @description Sales writes are not enabled in this environment */
3019
+ 503: {
3020
+ headers: {
3021
+ [name: string]: unknown;
3022
+ };
3023
+ content: {
3024
+ "application/json": components["schemas"]["ErrorResponse"];
3025
+ };
3026
+ };
3027
+ };
3028
+ };
2946
3029
  delete?: never;
2947
3030
  options?: never;
2948
3031
  head?: never;
2949
3032
  patch?: never;
2950
3033
  trace?: never;
2951
3034
  };
3035
+ "/v1/sales/{id}": {
3036
+ parameters: {
3037
+ query?: never;
3038
+ header?: never;
3039
+ path?: never;
3040
+ cookie?: never;
3041
+ };
3042
+ get?: never;
3043
+ put?: never;
3044
+ post?: never;
3045
+ /**
3046
+ * Delete an owner sale
3047
+ * @description Delete one of the caller's own sales. Requires an authenticated session, or an owner-bound API key carrying the exact sales:write scope.
3048
+ */
3049
+ delete: {
3050
+ parameters: {
3051
+ query?: never;
3052
+ header?: never;
3053
+ path: {
3054
+ id: number;
3055
+ };
3056
+ cookie?: never;
3057
+ };
3058
+ requestBody?: never;
3059
+ responses: {
3060
+ /** @description The sale was deleted */
3061
+ 200: {
3062
+ headers: {
3063
+ [name: string]: unknown;
3064
+ };
3065
+ content: {
3066
+ "application/json": components["schemas"]["SaleDeleteResponse"];
3067
+ };
3068
+ };
3069
+ /** @description Invalid query parameter */
3070
+ 400: {
3071
+ headers: {
3072
+ [name: string]: unknown;
3073
+ };
3074
+ content: {
3075
+ "application/json": components["schemas"]["ErrorResponse"];
3076
+ };
3077
+ };
3078
+ /** @description Authentication required */
3079
+ 401: {
3080
+ headers: {
3081
+ [name: string]: unknown;
3082
+ };
3083
+ content: {
3084
+ "application/json": components["schemas"]["ErrorResponse"];
3085
+ };
3086
+ };
3087
+ /** @description Insufficient entitlement (plan or role) */
3088
+ 403: {
3089
+ headers: {
3090
+ [name: string]: unknown;
3091
+ };
3092
+ content: {
3093
+ "application/json": components["schemas"]["ErrorResponse"];
3094
+ };
3095
+ };
3096
+ /** @description No such sale owned by the caller */
3097
+ 404: {
3098
+ headers: {
3099
+ [name: string]: unknown;
3100
+ };
3101
+ content: {
3102
+ "application/json": components["schemas"]["ErrorResponse"];
3103
+ };
3104
+ };
3105
+ /** @description Per-user mutation throttle exceeded; retry after a short wait */
3106
+ 429: {
3107
+ headers: {
3108
+ [name: string]: unknown;
3109
+ };
3110
+ content: {
3111
+ "application/json": components["schemas"]["ErrorResponse"];
3112
+ };
3113
+ };
3114
+ /** @description Sales writes are not enabled in this environment */
3115
+ 503: {
3116
+ headers: {
3117
+ [name: string]: unknown;
3118
+ };
3119
+ content: {
3120
+ "application/json": components["schemas"]["ErrorResponse"];
3121
+ };
3122
+ };
3123
+ };
3124
+ };
3125
+ options?: never;
3126
+ head?: never;
3127
+ /**
3128
+ * Update an owner sale
3129
+ * @description Update fields on one of the caller's own sales. The sales table carries no last_updated column, so no If-Match optimistic concurrency is offered. Requires an authenticated session, or an owner-bound API key carrying the exact sales:write scope.
3130
+ */
3131
+ patch: {
3132
+ parameters: {
3133
+ query?: never;
3134
+ header?: never;
3135
+ path: {
3136
+ id: number;
3137
+ };
3138
+ cookie?: never;
3139
+ };
3140
+ requestBody?: {
3141
+ content: {
3142
+ "application/json": components["schemas"]["SalesUpdateRequest"];
3143
+ };
3144
+ };
3145
+ responses: {
3146
+ /** @description The updated sale */
3147
+ 200: {
3148
+ headers: {
3149
+ [name: string]: unknown;
3150
+ };
3151
+ content: {
3152
+ "application/json": components["schemas"]["SaleItemResponse"];
3153
+ };
3154
+ };
3155
+ /** @description Invalid query parameter */
3156
+ 400: {
3157
+ headers: {
3158
+ [name: string]: unknown;
3159
+ };
3160
+ content: {
3161
+ "application/json": components["schemas"]["ErrorResponse"];
3162
+ };
3163
+ };
3164
+ /** @description Authentication required */
3165
+ 401: {
3166
+ headers: {
3167
+ [name: string]: unknown;
3168
+ };
3169
+ content: {
3170
+ "application/json": components["schemas"]["ErrorResponse"];
3171
+ };
3172
+ };
3173
+ /** @description Insufficient entitlement (plan or role) */
3174
+ 403: {
3175
+ headers: {
3176
+ [name: string]: unknown;
3177
+ };
3178
+ content: {
3179
+ "application/json": components["schemas"]["ErrorResponse"];
3180
+ };
3181
+ };
3182
+ /** @description No such sale owned by the caller */
3183
+ 404: {
3184
+ headers: {
3185
+ [name: string]: unknown;
3186
+ };
3187
+ content: {
3188
+ "application/json": components["schemas"]["ErrorResponse"];
3189
+ };
3190
+ };
3191
+ /** @description Per-user mutation throttle exceeded; retry after a short wait */
3192
+ 429: {
3193
+ headers: {
3194
+ [name: string]: unknown;
3195
+ };
3196
+ content: {
3197
+ "application/json": components["schemas"]["ErrorResponse"];
3198
+ };
3199
+ };
3200
+ /** @description Sales writes are not enabled in this environment */
3201
+ 503: {
3202
+ headers: {
3203
+ [name: string]: unknown;
3204
+ };
3205
+ content: {
3206
+ "application/json": components["schemas"]["ErrorResponse"];
3207
+ };
3208
+ };
3209
+ };
3210
+ };
3211
+ trace?: never;
3212
+ };
2952
3213
  "/v1/tasting/{catalogId}": {
2953
3214
  parameters: {
2954
3215
  query?: never;
@@ -4867,8 +5128,71 @@ interface components {
4867
5128
  coffee_name: string | null;
4868
5129
  wholesale: boolean;
4869
5130
  };
4870
- SalesListResponse: {
4871
- data: components["schemas"]["SaleResource"][];
5131
+ SalesListResponse: {
5132
+ data: components["schemas"]["SaleResource"][];
5133
+ meta: {
5134
+ /** @enum {string} */
5135
+ resource: "sales";
5136
+ /** @enum {string} */
5137
+ namespace: "/v1/sales";
5138
+ /** @enum {string} */
5139
+ version: "v1";
5140
+ auth: {
5141
+ /** @enum {string} */
5142
+ kind: "session" | "api-key";
5143
+ /** @enum {string|null} */
5144
+ role: "admin" | "member" | "viewer" | null;
5145
+ /** @enum {string|null} */
5146
+ apiPlan: "viewer" | "member" | "enterprise" | null;
5147
+ };
5148
+ };
5149
+ };
5150
+ SaleItemResponse: {
5151
+ data: components["schemas"]["SaleResource"];
5152
+ meta: {
5153
+ /** @enum {string} */
5154
+ resource: "sales";
5155
+ /** @enum {string} */
5156
+ namespace: "/v1/sales";
5157
+ /** @enum {string} */
5158
+ version: "v1";
5159
+ auth: {
5160
+ /** @enum {string} */
5161
+ kind: "session" | "api-key";
5162
+ /** @enum {string|null} */
5163
+ role: "admin" | "member" | "viewer" | null;
5164
+ /** @enum {string|null} */
5165
+ apiPlan: "viewer" | "member" | "enterprise" | null;
5166
+ };
5167
+ };
5168
+ };
5169
+ SalesCreateRequest: {
5170
+ /** @description green_coffee_inv.id of the caller's own inventory lot this sale draws from. */
5171
+ greenCoffeeInvId: number;
5172
+ /** @description Ounces sold (positive). */
5173
+ ozSold: number;
5174
+ /** @description Sale price (non-negative). */
5175
+ price: number;
5176
+ /** @description Buyer name (optional). */
5177
+ buyer?: string;
5178
+ /** @description Batch label for the sale (optional). */
5179
+ batchName?: string;
5180
+ /** @description Sale date (YYYY-MM-DD); defaults to today (UTC). */
5181
+ sellDate?: string;
5182
+ };
5183
+ SalesUpdateRequest: {
5184
+ ozSold?: number;
5185
+ price?: number;
5186
+ buyer?: string;
5187
+ batchName?: string;
5188
+ sellDate?: string;
5189
+ };
5190
+ SaleDeleteResponse: {
5191
+ data: {
5192
+ id: number;
5193
+ /** @enum {boolean} */
5194
+ deleted: true;
5195
+ };
4872
5196
  meta: {
4873
5197
  /** @enum {string} */
4874
5198
  resource: "sales";
@@ -5019,6 +5343,10 @@ type RoastImportRequest = NonNullable<paths["/v1/roasts/imports"]["post"]["reque
5019
5343
  type RoastArtisanImportReplaceRequest = NonNullable<paths["/v1/roasts/{id}/artisan-import"]["put"]["requestBody"]>["content"]["application/json"];
5020
5344
  /** Query parameters for {@link ParchmentClient.sales.list}. */
5021
5345
  type SalesListQuery = NonNullable<paths["/v1/sales"]["get"]["parameters"]["query"]>;
5346
+ /** Request body for {@link ParchmentClient.sales.create}. */
5347
+ type SalesCreateRequest = NonNullable<paths["/v1/sales"]["post"]["requestBody"]>["content"]["application/json"];
5348
+ /** Request body for {@link ParchmentClient.sales.update}. */
5349
+ type SalesUpdateRequest = NonNullable<paths["/v1/sales/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
5022
5350
  /** Query parameters for {@link ParchmentClient.tasting.get}. */
5023
5351
  type TastingGetQuery = NonNullable<paths["/v1/tasting/{catalogId}"]["get"]["parameters"]["query"]>;
5024
5352
  /** Request body for {@link ParchmentClient.apiKeys.create}. */
@@ -5241,7 +5569,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
5241
5569
  content: {
5242
5570
  "application/json": {
5243
5571
  name: string;
5244
- scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "inventory:write" | "roast:write")[];
5572
+ scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "inventory:write" | "roast:write" | "sales:write")[];
5245
5573
  };
5246
5574
  };
5247
5575
  };
@@ -5291,14 +5619,14 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
5291
5619
  [name: string]: unknown;
5292
5620
  };
5293
5621
  content: {
5294
- "application/json": components["schemas"] /** Rotate an API key and return the replacement secret once. */["ErrorResponse"];
5622
+ "application/json": components["schemas"]["ErrorResponse"];
5295
5623
  };
5296
5624
  };
5297
5625
  };
5298
5626
  }, {
5299
5627
  body: {
5300
5628
  name: string;
5301
- scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "inventory:write" | "roast:write")[];
5629
+ scopes?: ("catalog:read" | "inventory:read" | "roast:read" | "sales:read" | "tasting:read" | "inventory:write" | "roast:write" | "sales:write")[];
5302
5630
  };
5303
5631
  }, `${string}/${string}`>>;
5304
5632
  /** Revoke an API key owned by the authenticated session user. */
@@ -5334,7 +5662,7 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
5334
5662
  [name: string]: unknown;
5335
5663
  };
5336
5664
  content: {
5337
- "application/json": components["schemas"]["ErrorResponse"];
5665
+ "application/json": components["schemas"] /** Rank caller-visible catalog coffees by deterministic objectives. */["ErrorResponse"];
5338
5666
  };
5339
5667
  };
5340
5668
  403: {
@@ -5544,12 +5872,13 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
5544
5872
  scoreValueMin?: number | null;
5545
5873
  scoreValueMax?: number | null;
5546
5874
  pricePerLbMin?: number | null;
5547
- pricePerLbMax?: number | null;
5875
+ pricePerLbMax? /**
5876
+ * Clear import-derived curve, events, metrics, and provenance data from
5877
+ * one of the caller's existing roasts without deleting the roast profile.
5878
+ */: number | null;
5548
5879
  processing_base_method?: string;
5549
5880
  fermentation_type?: string;
5550
- process_additive
5551
- /** Fetch supplier notes plus the caller's own latest tasting notes. */
5552
- ? /** Fetch supplier notes plus the caller's own latest tasting notes. */: string;
5881
+ process_additive?: string;
5553
5882
  has_additives?: "true" | "false";
5554
5883
  processing_disclosure_level?: string;
5555
5884
  processing_confidence_min?: number | null;
@@ -5558,7 +5887,21 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
5558
5887
  Prefer?: string;
5559
5888
  };
5560
5889
  path?: never;
5561
- cookie?: never;
5890
+ cookie
5891
+ /**
5892
+ * Record a sale against one of the caller's own green-coffee inventory
5893
+ * lots. Requires a session or an owner-bound API key carrying the exact
5894
+ * `sales:write` scope. Pass `idempotencyKey` to make retries safe: the
5895
+ * same key replays the original result, and a concurrent duplicate gets
5896
+ * 409 while the first is in flight.
5897
+ */
5898
+ ? /**
5899
+ * Record a sale against one of the caller's own green-coffee inventory
5900
+ * lots. Requires a session or an owner-bound API key carrying the exact
5901
+ * `sales:write` scope. Pass `idempotencyKey` to make retries safe: the
5902
+ * same key replays the original result, and a concurrent duplicate gets
5903
+ * 409 while the first is in flight.
5904
+ */: never;
5562
5905
  };
5563
5906
  requestBody?: never;
5564
5907
  responses: {
@@ -7988,6 +8331,269 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
7988
8331
  } | undefined;
7989
8332
  };
7990
8333
  }, `${string}/${string}`>>;
8334
+ /**
8335
+ * Record a sale against one of the caller's own green-coffee inventory
8336
+ * lots. Requires a session or an owner-bound API key carrying the exact
8337
+ * `sales:write` scope. Pass `idempotencyKey` to make retries safe: the
8338
+ * same key replays the original result, and a concurrent duplicate gets
8339
+ * 409 while the first is in flight.
8340
+ */
8341
+ create: (body: SalesCreateRequest, options?: {
8342
+ idempotencyKey?: string;
8343
+ }) => Promise<openapi_fetch.FetchResponse<{
8344
+ parameters: {
8345
+ query?: never;
8346
+ header?: {
8347
+ "idempotency-key"?: string;
8348
+ };
8349
+ path?: never;
8350
+ cookie?: never;
8351
+ };
8352
+ requestBody?: {
8353
+ content: {
8354
+ "application/json": components["schemas"]["SalesCreateRequest"];
8355
+ };
8356
+ };
8357
+ responses: {
8358
+ 201: {
8359
+ headers: {
8360
+ [name: string]: unknown;
8361
+ };
8362
+ content: {
8363
+ "application/json": components["schemas"]["SaleItemResponse"];
8364
+ };
8365
+ };
8366
+ 400: {
8367
+ headers: {
8368
+ [name: string]: unknown;
8369
+ };
8370
+ content: {
8371
+ "application/json": components["schemas"]["ErrorResponse"];
8372
+ };
8373
+ };
8374
+ 401: {
8375
+ headers: {
8376
+ [name: string]: unknown;
8377
+ };
8378
+ content: {
8379
+ "application/json": components["schemas"]["ErrorResponse"];
8380
+ };
8381
+ };
8382
+ 403: {
8383
+ headers: {
8384
+ [name: string]: unknown;
8385
+ };
8386
+ content: {
8387
+ "application/json": components["schemas"]["ErrorResponse"];
8388
+ };
8389
+ };
8390
+ 409: {
8391
+ headers: {
8392
+ [name: string]: unknown;
8393
+ };
8394
+ content: {
8395
+ "application/json": components["schemas"]["ErrorResponse"];
8396
+ };
8397
+ };
8398
+ 429: {
8399
+ headers: {
8400
+ [name: string]: unknown;
8401
+ };
8402
+ content: {
8403
+ "application/json": components["schemas"]["ErrorResponse"];
8404
+ };
8405
+ };
8406
+ 503: {
8407
+ headers: {
8408
+ [name: string]: unknown;
8409
+ };
8410
+ content: {
8411
+ "application/json": components["schemas"]["ErrorResponse"];
8412
+ };
8413
+ };
8414
+ };
8415
+ }, {
8416
+ body: {
8417
+ greenCoffeeInvId: number;
8418
+ ozSold: number;
8419
+ price: number;
8420
+ buyer?: string;
8421
+ batchName?: string;
8422
+ sellDate?: string;
8423
+ };
8424
+ params: {
8425
+ header: {
8426
+ "idempotency-key": string;
8427
+ };
8428
+ } | undefined;
8429
+ }, `${string}/${string}`>>;
8430
+ /**
8431
+ * Update one of the caller's own sales. The sales table carries no
8432
+ * `last_updated` column, so no If-Match optimistic concurrency is
8433
+ * offered.
8434
+ */
8435
+ update: (id: number, body: SalesUpdateRequest) => Promise<openapi_fetch.FetchResponse<{
8436
+ parameters: {
8437
+ query?: never;
8438
+ header?: never;
8439
+ path: {
8440
+ id: number;
8441
+ };
8442
+ cookie?: never;
8443
+ };
8444
+ requestBody?: {
8445
+ content: {
8446
+ "application/json": components["schemas"]["SalesUpdateRequest"];
8447
+ };
8448
+ };
8449
+ responses: {
8450
+ 200: {
8451
+ headers: {
8452
+ [name: string]: unknown;
8453
+ };
8454
+ content: {
8455
+ "application/json": components["schemas"]["SaleItemResponse"];
8456
+ };
8457
+ };
8458
+ 400: {
8459
+ headers: {
8460
+ [name: string]: unknown;
8461
+ };
8462
+ content: {
8463
+ "application/json": components["schemas"]["ErrorResponse"];
8464
+ };
8465
+ };
8466
+ 401: {
8467
+ headers: {
8468
+ [name: string]: unknown;
8469
+ };
8470
+ content: {
8471
+ "application/json": components["schemas"]["ErrorResponse"];
8472
+ };
8473
+ };
8474
+ 403: {
8475
+ headers: {
8476
+ [name: string]: unknown;
8477
+ };
8478
+ content: {
8479
+ "application/json": components["schemas"]["ErrorResponse"];
8480
+ };
8481
+ };
8482
+ 404: {
8483
+ headers: {
8484
+ [name: string]: unknown;
8485
+ };
8486
+ content: {
8487
+ "application/json": components["schemas"]["ErrorResponse"];
8488
+ };
8489
+ };
8490
+ 429: {
8491
+ headers: {
8492
+ [name: string]: unknown;
8493
+ };
8494
+ content: {
8495
+ "application/json": components["schemas"]["ErrorResponse"];
8496
+ };
8497
+ };
8498
+ 503: {
8499
+ headers: {
8500
+ [name: string]: unknown;
8501
+ };
8502
+ content: {
8503
+ "application/json": components["schemas"]["ErrorResponse"];
8504
+ };
8505
+ };
8506
+ };
8507
+ }, {
8508
+ params: {
8509
+ path: {
8510
+ id: number;
8511
+ };
8512
+ };
8513
+ body: {
8514
+ ozSold?: number;
8515
+ price?: number;
8516
+ buyer?: string;
8517
+ batchName?: string;
8518
+ sellDate?: string;
8519
+ };
8520
+ }, `${string}/${string}`>>;
8521
+ /** Delete one of the caller's own sales. */
8522
+ delete: (id: number) => Promise<openapi_fetch.FetchResponse<{
8523
+ parameters: {
8524
+ query?: never;
8525
+ header?: never;
8526
+ path: {
8527
+ id: number;
8528
+ };
8529
+ cookie?: never;
8530
+ };
8531
+ requestBody?: never;
8532
+ responses: {
8533
+ 200: {
8534
+ headers: {
8535
+ [name: string]: unknown;
8536
+ };
8537
+ content: {
8538
+ "application/json": components["schemas"]["SaleDeleteResponse"];
8539
+ };
8540
+ };
8541
+ 400: {
8542
+ headers: {
8543
+ [name: string]: unknown;
8544
+ };
8545
+ content: {
8546
+ "application/json": components["schemas"]["ErrorResponse"];
8547
+ };
8548
+ };
8549
+ 401: {
8550
+ headers: {
8551
+ [name: string]: unknown;
8552
+ };
8553
+ content: {
8554
+ "application/json": components["schemas"]["ErrorResponse"];
8555
+ };
8556
+ };
8557
+ 403: {
8558
+ headers: {
8559
+ [name: string]: unknown;
8560
+ };
8561
+ content: {
8562
+ "application/json": components["schemas"]["ErrorResponse"];
8563
+ };
8564
+ };
8565
+ 404: {
8566
+ headers: {
8567
+ [name: string]: unknown;
8568
+ };
8569
+ content: {
8570
+ "application/json": components["schemas"]["ErrorResponse"];
8571
+ };
8572
+ };
8573
+ 429: {
8574
+ headers: {
8575
+ [name: string]: unknown;
8576
+ };
8577
+ content: {
8578
+ "application/json": components["schemas"]["ErrorResponse"];
8579
+ };
8580
+ };
8581
+ 503: {
8582
+ headers: {
8583
+ [name: string]: unknown;
8584
+ };
8585
+ content: {
8586
+ "application/json": components["schemas"]["ErrorResponse"];
8587
+ };
8588
+ };
8589
+ };
8590
+ }, {
8591
+ params: {
8592
+ path: {
8593
+ id: number;
8594
+ };
8595
+ };
8596
+ }, `${string}/${string}`>>;
7991
8597
  };
7992
8598
  tasting: {
7993
8599
  /** Fetch supplier notes plus the caller's own latest tasting notes. */
@@ -8059,4 +8665,4 @@ declare function createParchmentClient(options: ParchmentClientOptions): {
8059
8665
  };
8060
8666
  type ParchmentClient = ReturnType<typeof createParchmentClient>;
8061
8667
 
8062
- export { type BriefMatchesQuery, type CatalogListQuery, type CatalogSimilarQuery, type InventoryCreateRequest, type InventoryUpdateRequest, type MarketSignalsQuery, type MetadataIndexQuery, type ParchmentClient, type ParchmentClientOptions, type PriceIndexQuery, type PriceIndexStatsQuery, type SourcingBriefCreateRequest, type components, createParchmentClient, type paths };
8668
+ export { type BriefMatchesQuery, type CatalogListQuery, 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 components, createParchmentClient, type paths };
package/dist/index.js CHANGED
@@ -196,7 +196,29 @@ function createParchmentClient(options) {
196
196
  },
197
197
  sales: {
198
198
  /** List the caller's own sales (owner-scoped). */
199
- list: (query) => client.GET("/v1/sales", { params: { query } })
199
+ list: (query) => client.GET("/v1/sales", { params: { query } }),
200
+ /**
201
+ * Record a sale against one of the caller's own green-coffee inventory
202
+ * lots. Requires a session or an owner-bound API key carrying the exact
203
+ * `sales:write` scope. Pass `idempotencyKey` to make retries safe: the
204
+ * same key replays the original result, and a concurrent duplicate gets
205
+ * 409 while the first is in flight.
206
+ */
207
+ create: (body, options2) => client.POST("/v1/sales", {
208
+ body,
209
+ params: options2?.idempotencyKey ? { header: { "idempotency-key": options2.idempotencyKey } } : void 0
210
+ }),
211
+ /**
212
+ * Update one of the caller's own sales. The sales table carries no
213
+ * `last_updated` column, so no If-Match optimistic concurrency is
214
+ * offered.
215
+ */
216
+ update: (id, body) => client.PATCH("/v1/sales/{id}", {
217
+ params: { path: { id } },
218
+ body
219
+ }),
220
+ /** Delete one of the caller's own sales. */
221
+ delete: (id) => client.DELETE("/v1/sales/{id}", { params: { path: { id } } })
200
222
  },
201
223
  tasting: {
202
224
  /** Fetch supplier notes plus the caller's own latest tasting notes. */
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.market.signals}. */\nexport type MarketSignalsQuery = NonNullable<\n paths[\"/v1/market/signals\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.stats}. */\nexport type PriceIndexStatsQuery = NonNullable<\n paths[\"/v1/price-index/stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.market.metadataIndex}. */\nexport type MetadataIndexQuery = NonNullable<\n paths[\"/v1/market/metadata-index\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.procurement.briefs.matches}. */\nexport type BriefMatchesQuery = NonNullable<\n paths[\"/v1/procurement/briefs/{id}/matches\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.procurement.briefs.create}. */\nexport type SourcingBriefCreateRequest =\n components[\"schemas\"][\"SourcingBriefCreateRequest\"];\n/** Query parameters for {@link ParchmentClient.inventory.list}. */\nexport type InventoryListQuery = NonNullable<\n paths[\"/v1/inventory\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.inventory.create}. */\nexport type InventoryCreateRequest = NonNullable<\n paths[\"/v1/inventory\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.inventory.update}. */\nexport type InventoryUpdateRequest = NonNullable<\n paths[\"/v1/inventory/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.roasts.list}. */\nexport type RoastListQuery = NonNullable<\n paths[\"/v1/roasts\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.roasts.get}. */\nexport type RoastGetQuery = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.roasts.create}. */\nexport type RoastCreateRequest = NonNullable<\n paths[\"/v1/roasts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.update}. */\nexport type RoastUpdateRequest = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.import}. */\nexport type RoastImportRequest = NonNullable<\n paths[\"/v1/roasts/imports\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.replaceArtisanImport}. */\nexport type RoastArtisanImportReplaceRequest = NonNullable<\n paths[\"/v1/roasts/{id}/artisan-import\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.sales.list}. */\nexport type SalesListQuery = NonNullable<\n paths[\"/v1/sales\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.tasting.get}. */\nexport type TastingGetQuery = NonNullable<\n paths[\"/v1/tasting/{catalogId}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.apiKeys.create}. */\nexport type ApiKeyCreateRequest = NonNullable<\n paths[\"/v1/api-keys\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/**\n * Create a typed Parchment API client.\n *\n * The generated core (openapi-fetch over the generated `paths` types) is the\n * contract truth; the named helpers below are the hand-maintained ergonomic\n * layer and grow as endpoints land. `raw` always exposes the underlying typed\n * client for direct path access to anything not yet wrapped.\n */\nexport function createParchmentClient(options: ParchmentClientOptions) {\n const { baseUrl, token, fetch: fetchImpl } = options;\n\n const client = createClient<paths>({\n baseUrl,\n fetch: fetchImpl,\n headers: token ? { Authorization: `Bearer ${token}` } : undefined,\n });\n\n return {\n /** The underlying typed openapi-fetch client for direct path access. */\n raw: client,\n /** Liveness and service identity. */\n health: () => client.GET(\"/health\"),\n /** Resolved principal and entitlements for the caller. */\n me: () => client.GET(\"/v1/me\"),\n apiKeys: {\n /** List API keys owned by the authenticated session user. */\n list: () => client.GET(\"/v1/api-keys\"),\n /** Create an API key. The raw secret is returned only once. */\n create: (body: ApiKeyCreateRequest) =>\n client.POST(\"/v1/api-keys\", { body }),\n /** Revoke an API key owned by the authenticated session user. */\n revoke: (id: string) =>\n client.DELETE(\"/v1/api-keys/{id}\", {\n params: { path: { id } },\n }),\n /** Rotate an API key and return the replacement secret once. */\n rotate: (id: string) =>\n client.POST(\"/v1/api-keys/{id}/rotate\", {\n params: { path: { id } },\n }),\n },\n catalog: {\n /** Catalog capabilities and visibility for the caller. */\n access: () => client.GET(\"/v1/catalog/access\"),\n /**\n * List public catalog coffees (paginated). Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogListHeaders}).\n */\n list: (query?: CatalogListQuery, headers?: CatalogListHeaders) =>\n client.GET(\"/v1/catalog\", { params: { query, header: headers } }),\n /**\n * Catalog filter metadata and counted facets. Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogFacetsHeaders}).\n */\n facets: (query?: CatalogFacetsQuery, headers?: CatalogFacetsHeaders) =>\n client.GET(\"/v1/catalog/facets\", {\n params: { query, header: headers },\n }),\n /** Live catalog price context by origin. */\n originPriceStats: (query?: CatalogOriginPriceStatsQuery) =>\n client.GET(\"/v1/catalog/origin-price-stats\", { params: { query } }),\n /** Aggregate stats over the caller-visible catalog. */\n stats: (query?: CatalogStatsQuery) =>\n client.GET(\"/v1/catalog/stats\", { params: { query } }),\n /** Rank caller-visible catalog coffees by deterministic objectives. */\n rank: (query?: CatalogRankQuery, headers?: CatalogRankHeaders) =>\n client.GET(\"/v1/catalog/rank\", {\n params: { query, header: headers },\n }),\n /** Rank premium catalog candidates by Purveyor Score. */\n rankPremium: (\n query?: CatalogRankPremiumQuery,\n headers?: CatalogRankPremiumHeaders,\n ) =>\n client.GET(\"/v1/catalog/rank-premium\", {\n params: { query, header: headers },\n }),\n /** List supplier aggregates over caller-visible catalog coffees. */\n suppliers: (\n query?: CatalogSuppliersQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers\", {\n params: { query, header: headers },\n }),\n /** Return aggregate detail for a supplier query. */\n supplierDetail: (\n query: CatalogSupplierDetailQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/detail\", {\n params: { query, header: headers },\n }),\n /** Rank suppliers by catalog score and availability. */\n supplierRank: (\n query?: CatalogSupplierRankQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/rank\", {\n params: { query, header: headers },\n }),\n /** Aggregate proof-coverage over the public catalog. */\n proofCoverage: () => client.GET(\"/v1/catalog/proof-coverage\"),\n /** Find catalog coffees similar to a target coffee. */\n similar: (id: string, query?: CatalogSimilarQuery) =>\n client.GET(\"/v1/catalog/{id}/similar\", {\n params: { path: { id }, query },\n }),\n },\n priceIndex: {\n /** Parchment Price Index (aggregate snapshots). */\n list: (query?: PriceIndexQuery) =>\n client.GET(\"/v1/price-index\", { params: { query } }),\n /** Price movement significance stats (precomputed). */\n stats: (query?: PriceIndexStatsQuery) =>\n client.GET(\"/v1/price-index/stats\", { params: { query } }),\n },\n market: {\n /** Actionable market value signals. */\n signals: (query?: MarketSignalsQuery) =>\n client.GET(\"/v1/market/signals\", { params: { query } }),\n /** Metadata-trend index (process/disclosure/Purveyor Score over time). */\n metadataIndex: (query?: MetadataIndexQuery) =>\n client.GET(\"/v1/market/metadata-index\", { params: { query } }),\n },\n procurement: {\n briefs: {\n /** List the caller's saved sourcing briefs. */\n list: () => client.GET(\"/v1/procurement/briefs\"),\n /** Create a saved sourcing brief. */\n create: (body: SourcingBriefCreateRequest) =>\n client.POST(\"/v1/procurement/briefs\", { body }),\n /** Fetch one of the caller's sourcing briefs by id. */\n get: (id: string) =>\n client.GET(\"/v1/procurement/briefs/{id}\", {\n params: { path: { id } },\n }),\n /** Run a saved brief against the catalog (paginated matches). */\n matches: (id: string, query?: BriefMatchesQuery) =>\n client.GET(\"/v1/procurement/briefs/{id}/matches\", {\n params: { path: { id }, query },\n }),\n },\n },\n inventory: {\n /** List the caller's own green-coffee inventory (owner-scoped). */\n list: (query?: InventoryListQuery) =>\n client.GET(\"/v1/inventory\", { params: { query } }),\n /**\n * Create an owner inventory lot. Requires a session or an owner-bound API\n * key carrying the exact `inventory:write` scope. Pass `idempotencyKey`\n * to make retries safe: the same key replays the original result, and a\n * concurrent duplicate gets 409 while the first is in flight.\n */\n create: (\n body: InventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/inventory\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own inventory rows. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: InventoryUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/inventory/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Delete one of the caller's own inventory rows. Returns 409 if dependent\n * roast profiles or sales exist (no force-cascade).\n */\n delete: (id: number) =>\n client.DELETE(\"/v1/inventory/{id}\", { params: { path: { id } } }),\n },\n roasts: {\n /** List the caller's own roast profiles (owner-scoped). */\n list: (query?: RoastListQuery) =>\n client.GET(\"/v1/roasts\", { params: { query } }),\n /**\n * Fetch one of the caller's roast profiles by id, optionally with its\n * temperature curve (`includeTemps`) and event markers (`includeEvents`).\n */\n get: (id: string, query?: RoastGetQuery) =>\n client.GET(\"/v1/roasts/{id}\", { params: { path: { id }, query } }),\n /**\n * Create an owner roast profile, optionally with nested temperature/event\n * rows. Requires a session or an owner-bound API key carrying the exact\n * `roast:write` scope. Pass `idempotencyKey` to make retries safe.\n */\n create: (\n body: RoastCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own roast profiles. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: RoastUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/roasts/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /** Delete one of the caller's own roast profiles. */\n delete: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}\", { params: { path: { id } } }),\n /**\n * Create a roast profile from an Artisan `.alog` file against one of the\n * caller's green-coffee lots, persisting the imported curve, events, and\n * an artisan_import_log entry atomically. Requires a session or an\n * owner-bound API key carrying the exact `roast:write` scope. Pass\n * `idempotencyKey` to make retries safe.\n */\n import: (\n body: RoastImportRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts/imports\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Replace the Artisan import data on one of the caller's existing roasts,\n * re-deriving its curve, events, and computed metrics while preserving the\n * roast's identity. Pass `ifMatch` (the roast's `last_updated`) to enable\n * optimistic concurrency (409 on mismatch).\n */\n replaceArtisanImport: (\n id: number,\n body: RoastArtisanImportReplaceRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PUT(\"/v1/roasts/{id}/artisan-import\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Clear import-derived curve, events, metrics, and provenance data from\n * one of the caller's existing roasts without deleting the roast profile.\n */\n clearArtisanImport: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}/artisan-import\", {\n params: { path: { id } },\n }),\n },\n sales: {\n /** List the caller's own sales (owner-scoped). */\n list: (query?: SalesListQuery) =>\n client.GET(\"/v1/sales\", { params: { query } }),\n },\n tasting: {\n /** Fetch supplier notes plus the caller's own latest tasting notes. */\n get: (catalogId: string, query?: TastingGetQuery) =>\n client.GET(\"/v1/tasting/{catalogId}\", {\n params: { path: { catalogId }, query },\n }),\n },\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AAiK1C,SAAS,sBAAsB,SAAiC;AACrE,QAAM,EAAE,SAAS,OAAO,OAAO,UAAU,IAAI;AAE7C,QAAM,SAAS,aAAoB;AAAA,IACjC;AAAA,IACA,OAAO;AAAA,IACP,SAAS,QAAQ,EAAE,eAAe,UAAU,KAAK,GAAG,IAAI;AAAA,EAC1D,CAAC;AAED,SAAO;AAAA;AAAA,IAEL,KAAK;AAAA;AAAA,IAEL,QAAQ,MAAM,OAAO,IAAI,SAAS;AAAA;AAAA,IAElC,IAAI,MAAM,OAAO,IAAI,QAAQ;AAAA,IAC7B,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OAAO,IAAI,2BAA2B;AAAA,QACpC,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM;AAAA,MACvC,CAAC;AAAA,IACL;AAAA,EACF;AACF;","names":["options"]}
1
+ {"version":3,"sources":["../src/client.ts"],"sourcesContent":["import createClient, { type ClientOptions } from \"openapi-fetch\";\nimport type { components, paths } from \"./schema\";\n\nexport interface ParchmentClientOptions {\n /** Base URL of the Parchment API, e.g. https://api.purveyors.io */\n baseUrl: string;\n /**\n * Optional bearer token (a Supabase JWT or, later, an API key). Sent as\n * `Authorization: Bearer <token>`. Auth is resolved server-side against the\n * unified principal model; the SDK only forwards the credential.\n */\n token?: string;\n /** Override the fetch implementation (useful for tests or custom runtimes). */\n fetch?: ClientOptions[\"fetch\"];\n}\n\n/** Query parameters for {@link ParchmentClient.catalog.list}. */\nexport type CatalogListQuery = NonNullable<\n paths[\"/v1/catalog\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.facets}. */\nexport type CatalogFacetsQuery = NonNullable<\n paths[\"/v1/catalog/facets\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/**\n * Optional headers for {@link ParchmentClient.catalog.list}, notably the\n * RFC 7240 `Prefer: handling=lenient|strict` override (PADR-0013 §7). Sending\n * `handling=lenient` opts a strict caller (API key or bearer-session JWT) back\n * into strip-with-notice degradation instead of a 401/403 hard-deny.\n */\nexport type CatalogListHeaders = NonNullable<\n paths[\"/v1/catalog\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for {@link ParchmentClient.catalog.facets}; see {@link CatalogListHeaders}. */\nexport type CatalogFacetsHeaders = NonNullable<\n paths[\"/v1/catalog/facets\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.originPriceStats}. */\nexport type CatalogOriginPriceStatsQuery = NonNullable<\n paths[\"/v1/catalog/origin-price-stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.stats}. */\nexport type CatalogStatsQuery = NonNullable<\n paths[\"/v1/catalog/stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.rank}. */\nexport type CatalogRankQuery = NonNullable<\n paths[\"/v1/catalog/rank\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.rankPremium}. */\nexport type CatalogRankPremiumQuery = NonNullable<\n paths[\"/v1/catalog/rank-premium\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.suppliers}. */\nexport type CatalogSuppliersQuery = NonNullable<\n paths[\"/v1/catalog/suppliers\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.supplierDetail}. */\nexport type CatalogSupplierDetailQuery = NonNullable<\n paths[\"/v1/catalog/suppliers/detail\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.supplierRank}. */\nexport type CatalogSupplierRankQuery = NonNullable<\n paths[\"/v1/catalog/suppliers/rank\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Optional headers for ranking endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogRankHeaders = NonNullable<\n paths[\"/v1/catalog/rank\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for premium ranking endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogRankPremiumHeaders = NonNullable<\n paths[\"/v1/catalog/rank-premium\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Optional headers for supplier aggregate endpoints; see {@link CatalogListHeaders}. */\nexport type CatalogSupplierHeaders = NonNullable<\n paths[\"/v1/catalog/suppliers\"][\"get\"][\"parameters\"][\"header\"]\n>;\n/** Query parameters for {@link ParchmentClient.catalog.similar}. */\nexport type CatalogSimilarQuery = NonNullable<\n paths[\"/v1/catalog/{id}/similar\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.list}. */\nexport type PriceIndexQuery = NonNullable<\n paths[\"/v1/price-index\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.market.signals}. */\nexport type MarketSignalsQuery = NonNullable<\n paths[\"/v1/market/signals\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.priceIndex.stats}. */\nexport type PriceIndexStatsQuery = NonNullable<\n paths[\"/v1/price-index/stats\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.market.metadataIndex}. */\nexport type MetadataIndexQuery = NonNullable<\n paths[\"/v1/market/metadata-index\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.procurement.briefs.matches}. */\nexport type BriefMatchesQuery = NonNullable<\n paths[\"/v1/procurement/briefs/{id}/matches\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.procurement.briefs.create}. */\nexport type SourcingBriefCreateRequest =\n components[\"schemas\"][\"SourcingBriefCreateRequest\"];\n/** Query parameters for {@link ParchmentClient.inventory.list}. */\nexport type InventoryListQuery = NonNullable<\n paths[\"/v1/inventory\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.inventory.create}. */\nexport type InventoryCreateRequest = NonNullable<\n paths[\"/v1/inventory\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.inventory.update}. */\nexport type InventoryUpdateRequest = NonNullable<\n paths[\"/v1/inventory/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.roasts.list}. */\nexport type RoastListQuery = NonNullable<\n paths[\"/v1/roasts\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Query parameters for {@link ParchmentClient.roasts.get}. */\nexport type RoastGetQuery = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** Request body for {@link ParchmentClient.roasts.create}. */\nexport type RoastCreateRequest = NonNullable<\n paths[\"/v1/roasts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.update}. */\nexport type RoastUpdateRequest = NonNullable<\n paths[\"/v1/roasts/{id}\"][\"patch\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.import}. */\nexport type RoastImportRequest = NonNullable<\n paths[\"/v1/roasts/imports\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Request body for {@link ParchmentClient.roasts.replaceArtisanImport}. */\nexport type RoastArtisanImportReplaceRequest = NonNullable<\n paths[\"/v1/roasts/{id}/artisan-import\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n/** Query parameters for {@link ParchmentClient.sales.list}. */\nexport type SalesListQuery = NonNullable<\n paths[\"/v1/sales\"][\"get\"][\"parameters\"][\"query\"]\n>;\n/** 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.apiKeys.create}. */\nexport type ApiKeyCreateRequest = NonNullable<\n paths[\"/v1/api-keys\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\n/**\n * Create a typed Parchment API client.\n *\n * The generated core (openapi-fetch over the generated `paths` types) is the\n * contract truth; the named helpers below are the hand-maintained ergonomic\n * layer and grow as endpoints land. `raw` always exposes the underlying typed\n * client for direct path access to anything not yet wrapped.\n */\nexport function createParchmentClient(options: ParchmentClientOptions) {\n const { baseUrl, token, fetch: fetchImpl } = options;\n\n const client = createClient<paths>({\n baseUrl,\n fetch: fetchImpl,\n headers: token ? { Authorization: `Bearer ${token}` } : undefined,\n });\n\n return {\n /** The underlying typed openapi-fetch client for direct path access. */\n raw: client,\n /** Liveness and service identity. */\n health: () => client.GET(\"/health\"),\n /** Resolved principal and entitlements for the caller. */\n me: () => client.GET(\"/v1/me\"),\n apiKeys: {\n /** List API keys owned by the authenticated session user. */\n list: () => client.GET(\"/v1/api-keys\"),\n /** Create an API key. The raw secret is returned only once. */\n create: (body: ApiKeyCreateRequest) =>\n client.POST(\"/v1/api-keys\", { body }),\n /** Revoke an API key owned by the authenticated session user. */\n revoke: (id: string) =>\n client.DELETE(\"/v1/api-keys/{id}\", {\n params: { path: { id } },\n }),\n /** Rotate an API key and return the replacement secret once. */\n rotate: (id: string) =>\n client.POST(\"/v1/api-keys/{id}/rotate\", {\n params: { path: { id } },\n }),\n },\n catalog: {\n /** Catalog capabilities and visibility for the caller. */\n access: () => client.GET(\"/v1/catalog/access\"),\n /**\n * List public catalog coffees (paginated). Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogListHeaders}).\n */\n list: (query?: CatalogListQuery, headers?: CatalogListHeaders) =>\n client.GET(\"/v1/catalog\", { params: { query, header: headers } }),\n /**\n * Catalog filter metadata and counted facets. Pass `headers` to send the\n * `Prefer: handling=lenient|strict` override (see {@link CatalogFacetsHeaders}).\n */\n facets: (query?: CatalogFacetsQuery, headers?: CatalogFacetsHeaders) =>\n client.GET(\"/v1/catalog/facets\", {\n params: { query, header: headers },\n }),\n /** Live catalog price context by origin. */\n originPriceStats: (query?: CatalogOriginPriceStatsQuery) =>\n client.GET(\"/v1/catalog/origin-price-stats\", { params: { query } }),\n /** Aggregate stats over the caller-visible catalog. */\n stats: (query?: CatalogStatsQuery) =>\n client.GET(\"/v1/catalog/stats\", { params: { query } }),\n /** Rank caller-visible catalog coffees by deterministic objectives. */\n rank: (query?: CatalogRankQuery, headers?: CatalogRankHeaders) =>\n client.GET(\"/v1/catalog/rank\", {\n params: { query, header: headers },\n }),\n /** Rank premium catalog candidates by Purveyor Score. */\n rankPremium: (\n query?: CatalogRankPremiumQuery,\n headers?: CatalogRankPremiumHeaders,\n ) =>\n client.GET(\"/v1/catalog/rank-premium\", {\n params: { query, header: headers },\n }),\n /** List supplier aggregates over caller-visible catalog coffees. */\n suppliers: (\n query?: CatalogSuppliersQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers\", {\n params: { query, header: headers },\n }),\n /** Return aggregate detail for a supplier query. */\n supplierDetail: (\n query: CatalogSupplierDetailQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/detail\", {\n params: { query, header: headers },\n }),\n /** Rank suppliers by catalog score and availability. */\n supplierRank: (\n query?: CatalogSupplierRankQuery,\n headers?: CatalogSupplierHeaders,\n ) =>\n client.GET(\"/v1/catalog/suppliers/rank\", {\n params: { query, header: headers },\n }),\n /** Aggregate proof-coverage over the public catalog. */\n proofCoverage: () => client.GET(\"/v1/catalog/proof-coverage\"),\n /** Find catalog coffees similar to a target coffee. */\n similar: (id: string, query?: CatalogSimilarQuery) =>\n client.GET(\"/v1/catalog/{id}/similar\", {\n params: { path: { id }, query },\n }),\n },\n priceIndex: {\n /** Parchment Price Index (aggregate snapshots). */\n list: (query?: PriceIndexQuery) =>\n client.GET(\"/v1/price-index\", { params: { query } }),\n /** Price movement significance stats (precomputed). */\n stats: (query?: PriceIndexStatsQuery) =>\n client.GET(\"/v1/price-index/stats\", { params: { query } }),\n },\n market: {\n /** Actionable market value signals. */\n signals: (query?: MarketSignalsQuery) =>\n client.GET(\"/v1/market/signals\", { params: { query } }),\n /** Metadata-trend index (process/disclosure/Purveyor Score over time). */\n metadataIndex: (query?: MetadataIndexQuery) =>\n client.GET(\"/v1/market/metadata-index\", { params: { query } }),\n },\n procurement: {\n briefs: {\n /** List the caller's saved sourcing briefs. */\n list: () => client.GET(\"/v1/procurement/briefs\"),\n /** Create a saved sourcing brief. */\n create: (body: SourcingBriefCreateRequest) =>\n client.POST(\"/v1/procurement/briefs\", { body }),\n /** Fetch one of the caller's sourcing briefs by id. */\n get: (id: string) =>\n client.GET(\"/v1/procurement/briefs/{id}\", {\n params: { path: { id } },\n }),\n /** Run a saved brief against the catalog (paginated matches). */\n matches: (id: string, query?: BriefMatchesQuery) =>\n client.GET(\"/v1/procurement/briefs/{id}/matches\", {\n params: { path: { id }, query },\n }),\n },\n },\n inventory: {\n /** List the caller's own green-coffee inventory (owner-scoped). */\n list: (query?: InventoryListQuery) =>\n client.GET(\"/v1/inventory\", { params: { query } }),\n /**\n * Create an owner inventory lot. Requires a session or an owner-bound API\n * key carrying the exact `inventory:write` scope. Pass `idempotencyKey`\n * to make retries safe: the same key replays the original result, and a\n * concurrent duplicate gets 409 while the first is in flight.\n */\n create: (\n body: InventoryCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/inventory\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own inventory rows. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: InventoryUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/inventory/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Delete one of the caller's own inventory rows. Returns 409 if dependent\n * roast profiles or sales exist (no force-cascade).\n */\n delete: (id: number) =>\n client.DELETE(\"/v1/inventory/{id}\", { params: { path: { id } } }),\n },\n roasts: {\n /** List the caller's own roast profiles (owner-scoped). */\n list: (query?: RoastListQuery) =>\n client.GET(\"/v1/roasts\", { params: { query } }),\n /**\n * Fetch one of the caller's roast profiles by id, optionally with its\n * temperature curve (`includeTemps`) and event markers (`includeEvents`).\n */\n get: (id: string, query?: RoastGetQuery) =>\n client.GET(\"/v1/roasts/{id}\", { params: { path: { id }, query } }),\n /**\n * Create an owner roast profile, optionally with nested temperature/event\n * rows. Requires a session or an owner-bound API key carrying the exact\n * `roast:write` scope. Pass `idempotencyKey` to make retries safe.\n */\n create: (\n body: RoastCreateRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Update one of the caller's own roast profiles. Pass `ifMatch` (the\n * row's `last_updated`) to enable optimistic concurrency (409 on mismatch).\n */\n update: (\n id: number,\n body: RoastUpdateRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PATCH(\"/v1/roasts/{id}\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /** Delete one of the caller's own roast profiles. */\n delete: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}\", { params: { path: { id } } }),\n /**\n * Create a roast profile from an Artisan `.alog` file against one of the\n * caller's green-coffee lots, persisting the imported curve, events, and\n * an artisan_import_log entry atomically. Requires a session or an\n * owner-bound API key carrying the exact `roast:write` scope. Pass\n * `idempotencyKey` to make retries safe.\n */\n import: (\n body: RoastImportRequest,\n options?: { idempotencyKey?: string },\n ) =>\n client.POST(\"/v1/roasts/imports\", {\n body,\n params: options?.idempotencyKey\n ? { header: { \"idempotency-key\": options.idempotencyKey } }\n : undefined,\n }),\n /**\n * Replace the Artisan import data on one of the caller's existing roasts,\n * re-deriving its curve, events, and computed metrics while preserving the\n * roast's identity. Pass `ifMatch` (the roast's `last_updated`) to enable\n * optimistic concurrency (409 on mismatch).\n */\n replaceArtisanImport: (\n id: number,\n body: RoastArtisanImportReplaceRequest,\n options?: { ifMatch?: string },\n ) =>\n client.PUT(\"/v1/roasts/{id}/artisan-import\", {\n params: {\n path: { id },\n header: options?.ifMatch\n ? { \"if-match\": options.ifMatch }\n : undefined,\n },\n body,\n }),\n /**\n * Clear import-derived curve, events, metrics, and provenance data from\n * one of the caller's existing roasts without deleting the roast profile.\n */\n clearArtisanImport: (id: number) =>\n client.DELETE(\"/v1/roasts/{id}/artisan-import\", {\n params: { path: { id } },\n }),\n },\n sales: {\n /** List the caller's own sales (owner-scoped). */\n list: (query?: SalesListQuery) =>\n client.GET(\"/v1/sales\", { params: { query } }),\n /**\n * 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 },\n };\n}\n\nexport type ParchmentClient = ReturnType<typeof createParchmentClient>;\n"],"mappings":";AAAA,OAAO,kBAA0C;AAyK1C,SAAS,sBAAsB,SAAiC;AACrE,QAAM,EAAE,SAAS,OAAO,OAAO,UAAU,IAAI;AAE7C,QAAM,SAAS,aAAoB;AAAA,IACjC;AAAA,IACA,O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AAM,EAAE,GAAG,EAAE;AAAA,MACzB,CAAC;AAAA,IACL;AAAA,IACA,OAAO;AAAA;AAAA,MAEL,MAAM,CAAC,UACL,OAAO,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQ/C,QAAQ,CACN,MACAA,aAEA,OAAO,KAAK,aAAa;AAAA,QACvB;AAAA,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,IACL;AAAA,EACF;AACF;","names":["options"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purveyors/sdk",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Typed client for the Purveyors Parchment API, generated from its OpenAPI spec.",
5
5
  "license": "MIT",
6
6
  "type": "module",