@shoplygg/node 0.11.5 → 0.12.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.
@@ -2524,6 +2524,7 @@ export type ProductsListItem = {
2524
2524
  maxQuantity: number;
2525
2525
  stock: number;
2526
2526
  keyCount: number;
2527
+ fileCount: number;
2527
2528
  deliveryMethods: string[];
2528
2529
  deliveryType: string;
2529
2530
  deliveryInstructions: string;
@@ -2732,6 +2733,7 @@ export type ProductsCreateResult = {
2732
2733
  maxQuantity: number;
2733
2734
  stock: number;
2734
2735
  keyCount: number;
2736
+ fileCount: number;
2735
2737
  deliveryMethods: string[];
2736
2738
  deliveryType: string;
2737
2739
  deliveryInstructions: string;
@@ -2802,6 +2804,7 @@ export type ProductsShowResult = {
2802
2804
  maxQuantity: number;
2803
2805
  stock: number;
2804
2806
  keyCount: number;
2807
+ fileCount: number;
2805
2808
  deliveryMethods: string[];
2806
2809
  deliveryType: string;
2807
2810
  deliveryInstructions: string;
@@ -3012,6 +3015,7 @@ export type ProductsUpdateResult = {
3012
3015
  maxQuantity: number;
3013
3016
  stock: number;
3014
3017
  keyCount: number;
3018
+ fileCount: number;
3015
3019
  deliveryMethods: string[];
3016
3020
  deliveryType: string;
3017
3021
  deliveryInstructions: string;
@@ -3129,6 +3133,12 @@ export type StockListKeysItem = {
3129
3133
  export interface StockAddKeysParams {
3130
3134
  /** The keys, one an entry, each up to 500 characters with no line break in it. */
3131
3135
  keys: string[];
3136
+ /**
3137
+ * What to do with a key that would go to more than one buyer. `ask` refuses the request with `duplicate_keys`.
3138
+ *
3139
+ * Left out, it is "ask".
3140
+ */
3141
+ duplicates?: "ask" | "skip" | "keep";
3132
3142
  }
3133
3143
 
3134
3144
  /** What add license keys answers: `stock.addKeys`. */
@@ -3136,6 +3146,7 @@ export type StockAddKeysResult = {
3136
3146
  added: number;
3137
3147
  skipped: number;
3138
3148
  duplicates: number;
3149
+ leftOut: number;
3139
3150
  available: number;
3140
3151
  };
3141
3152
 
@@ -3145,6 +3156,14 @@ export interface StockReplaceKeysParams {
3145
3156
  keys: string[];
3146
3157
  /** How many unsold keys you last read. Sent, the change is refused with `stale_write` if that number has changed, so a key sold in the meantime is not put back. */
3147
3158
  expectedAvailable?: number;
3159
+ /** The `stock` a list of the variant's keys answered beside its first page, read with no search (in `meta`). Sent, the change is refused with `stale_write` if any of those keys was sold or removed, or another added, since: a sale and an addition together leave the count the same. */
3160
+ expectedStock?: string;
3161
+ /**
3162
+ * What to do with a key that would go to more than one buyer. `ask` refuses the request with `duplicate_keys`.
3163
+ *
3164
+ * Left out, it is "ask".
3165
+ */
3166
+ duplicates?: "ask" | "skip" | "keep";
3148
3167
  }
3149
3168
 
3150
3169
  /** What replace a variant's license keys answers: `stock.replaceKeys`. */
@@ -3182,6 +3201,17 @@ export type StockAddFileResult = unknown;
3182
3201
  /** What finish a file upload answers: `stock.finishFile`. */
3183
3202
  export type StockFinishFileResult = unknown;
3184
3203
 
3204
+ /** What start replacing a file takes: `stock.replaceFile`. */
3205
+ export interface StockReplaceFileParams {
3206
+ /** The new version's name, with its ending. Buyers download it under this name from then on. */
3207
+ name: string;
3208
+ /** Its size in bytes. */
3209
+ size: number;
3210
+ }
3211
+
3212
+ /** What start replacing a file answers: `stock.replaceFile`. */
3213
+ export type StockReplaceFileResult = unknown;
3214
+
3185
3215
  /** What delete a file answers: `stock.deleteFile`. */
3186
3216
  export type StockDeleteFileResult = unknown;
3187
3217
 
@@ -3618,6 +3648,8 @@ export interface UpsellsUpdateParams {
3618
3648
  * Left out, it is true.
3619
3649
  */
3620
3650
  enabled?: boolean;
3651
+ /** The `updatedAt` you last read. Sent, the change is refused with `stale_write` if the record has changed since. Left out, it is saved whatever happened in between. */
3652
+ expectedUpdatedAt?: string;
3621
3653
  }
3622
3654
 
3623
3655
  /** What update an upsell answers: `upsells.update`. */
@@ -3810,6 +3842,8 @@ export interface SubscriptionsUpdateSettingsParams {
3810
3842
  cardChangeOn?: boolean;
3811
3843
  /** How many times a declined card is tried, one a day while the grace days last, from 1 to 5. */
3812
3844
  chargeTries?: number;
3845
+ /** The settings' `version` you last read. Sent, the change is refused with `stale_write` if any of them has changed since. Left out, it is saved whatever happened in between. */
3846
+ expectedVersion?: string;
3813
3847
  }
3814
3848
 
3815
3849
  /** What change subscription settings answers: `subscriptions.updateSettings`. */
@@ -3855,6 +3889,8 @@ export interface SubscriptionsSavePlansParams {
3855
3889
  /** What it renews by. */
3856
3890
  unit: "day" | "week" | "month" | "year";
3857
3891
  }>;
3892
+ /** For a change to one option that is a plan already: that plan's `version` you last read. Sent, the change is refused with `stale_write` if the plan has changed since. Left out, it is saved whatever happened in between. */
3893
+ expectedVersion?: string;
3858
3894
  }
3859
3895
 
3860
3896
  /** What sell options as subscriptions answers: `subscriptions.savePlans`. */
@@ -4389,6 +4425,7 @@ export type OrdersShowResult = {
4389
4425
  available: boolean;
4390
4426
  why: string;
4391
4427
  };
4428
+ subscription: unknown;
4392
4429
  };
4393
4430
  productSlug: string;
4394
4431
  imageUrl: unknown;
@@ -4459,6 +4496,12 @@ export interface OrdersRefundParams {
4459
4496
  reason: "requested" | "duplicate" | "fraudulent" | "other";
4460
4497
  /** For `balance` only: how much to credit, from 0.01 up to what was paid, with at most 2 decimals. Left out, all of it. */
4461
4498
  amount?: number;
4499
+ /**
4500
+ * Also cancel the running subscription this order started or renews, now, once the refund has gone through. Needs the `subscriptions.write` permission as well, asked before anything is refunded. `subscriptionCancelled` in the answer says whether one was.
4501
+ *
4502
+ * Left out, it is false.
4503
+ */
4504
+ cancelSubscription?: boolean;
4462
4505
  }
4463
4506
 
4464
4507
  /** What refund an order answers: `orders.refund`. */
@@ -4466,6 +4509,7 @@ export type OrdersRefundResult = {
4466
4509
  id: string;
4467
4510
  status: string;
4468
4511
  destination: string;
4512
+ subscriptionCancelled: boolean;
4469
4513
  };
4470
4514
 
4471
4515
  /** What deliver an order again takes: `orders.redeliver`. */
@@ -5096,6 +5140,8 @@ export interface CouponCategoriesUpdateParams {
5096
5140
  name: string;
5097
5141
  /** A note for whoever manages the store. */
5098
5142
  description?: string;
5143
+ /** The `updatedAt` you last read. Sent, the change is refused with `stale_write` if the record has changed since. Left out, it is saved whatever happened in between. */
5144
+ expectedUpdatedAt?: string;
5099
5145
  }
5100
5146
 
5101
5147
  /** What update a coupon category answers: `couponCategories.update`. */
@@ -5179,6 +5225,8 @@ export interface CouponPopupUpdateParams {
5179
5225
  * Left out, it is "visit".
5180
5226
  */
5181
5227
  frequency?: "page" | "visit" | "browser";
5228
+ /** The `updatedAt` you last read. Sent, the change is refused with `stale_write` if the record has changed since. Left out, it is saved whatever happened in between. */
5229
+ expectedUpdatedAt?: string;
5182
5230
  }
5183
5231
 
5184
5232
  /** What update the coupon pop-up answers: `couponPopup.update`. */
@@ -5382,6 +5430,8 @@ export interface SalesUpdateParams {
5382
5430
  * Left out, it is true.
5383
5431
  */
5384
5432
  showBar?: boolean;
5433
+ /** The `updatedAt` you last read. Sent, the change is refused with `stale_write` if the record has changed since. Left out, it is saved whatever happened in between. */
5434
+ expectedUpdatedAt?: string;
5385
5435
  }
5386
5436
 
5387
5437
  /** What update a sale answers: `sales.update`. */
@@ -7810,12 +7860,15 @@ export type ResellerProductsListResult = {
7810
7860
  dailyCap: number;
7811
7861
  maxDiscount: unknown;
7812
7862
  enabled: boolean;
7863
+ held: boolean;
7813
7864
  }[];
7814
7865
 
7815
7866
  /** What sell products on the panel takes: `resellerProducts.save`. */
7816
7867
  export interface ResellerProductsSaveParams {
7817
7868
  /** One a product option: `variantId`; `price`, its Reseller Price, above 0 and up to 1,000,000; `minQty`, the fewest bought at once, 1 to 1,000 (1 when left out); `dailyCap`, the most one reseller may buy of it in a day, or null for no cap; `maxDiscount`, the most off it in percent, or null for no limit (left out, as it was); `enabled`, whether it is on sale (true when left out). */
7818
7869
  rows: Record<string, unknown>[];
7870
+ /** The `version` of the panel's products you last read. Sent, the change is refused with `stale_write` if a row has changed since. Left out, it is saved whatever happened in between. */
7871
+ expectedVersion?: string;
7819
7872
  }
7820
7873
 
7821
7874
  /** What sell products on the panel answers: `resellerProducts.save`. */
@@ -7832,6 +7885,7 @@ export type ResellerProductsSaveResult = {
7832
7885
  dailyCap: number;
7833
7886
  maxDiscount: unknown;
7834
7887
  enabled: boolean;
7888
+ held: boolean;
7835
7889
  }[];
7836
7890
 
7837
7891
  /** What list what the panel can sell answers: `resellerProducts.pickable`. */
@@ -7857,7 +7911,7 @@ export interface ResellerProductsBadgesParams {
7857
7911
 
7858
7912
  /** What set a product's status and labels on the panel answers: `resellerProducts.badges`. */
7859
7913
  export type ResellerProductsBadgesResult = {
7860
- "7502259b-6fc7-41f3-9052-c8675b99433a": {
7914
+ "212a0544-bad6-44f0-b3f1-bc71394a59e2": {
7861
7915
  label: string;
7862
7916
  color: string;
7863
7917
  kind: string;
@@ -7898,6 +7952,8 @@ export interface ResellerTiersUpdateParams {
7898
7952
  name: string;
7899
7953
  /** What it takes off every Reseller Price, in percent: 0.01 to 99.99. */
7900
7954
  discount: number;
7955
+ /** The tier's `version` you last read. Sent, the change is refused with `stale_write` if it has changed since. Left out, it is saved whatever happened in between. */
7956
+ expectedVersion?: string;
7901
7957
  }
7902
7958
 
7903
7959
  /** What update a tier answers: `resellerTiers.update`. */
@@ -13073,7 +13129,7 @@ export interface ShoplyResourcesProducts {
13073
13129
  /**
13074
13130
  * **Update a product**
13075
13131
  *
13076
- * Saves the product whole, as its editor does: send every field as it should be. `variants` is the complete list. An entry with an `id` changes that variant, an entry without one is added, and a variant left out is removed with its unsold stock. A variant buyers have received license keys from cannot be removed.
13132
+ * Saves the product whole, as its editor does: send every field as it should be. `variants` is the complete list. An entry with an `id` changes that variant, an entry without one is added, and a variant left out is removed with its unsold stock, which needs the `stock.write` permission as well where it holds unsold keys or files. Buyers keep what they paid for: the keys delivered to them stay with their orders, and the files they bought stay on their orders to download.
13077
13133
  *
13078
13134
  * Read the product first and send it back changed. The fields that say "stay as they are" are the only ones that may be left out.
13079
13135
  *
@@ -13085,7 +13141,7 @@ export interface ShoplyResourcesProducts {
13085
13141
  /**
13086
13142
  * **Delete a product**
13087
13143
  *
13088
- * Removes the product with its variants, pictures and unsold stock. Refused for a product buyers have received license keys from, since those keys are part of their orders: set its visibility to `private` instead.
13144
+ * Removes the product with its variants, pictures and unsold stock, which needs the `stock.write` permission as well where it holds unsold keys or files. Buyers keep what they paid for: the keys delivered to them stay with their orders, and the files they bought stay on their orders to download.
13089
13145
  *
13090
13146
  * Needs the `products.write` permission (Change Products).
13091
13147
  *
@@ -13125,7 +13181,7 @@ export interface ShoplyResourcesProducts {
13125
13181
  /**
13126
13182
  * **Delete many products**
13127
13183
  *
13128
- * Deletes each product as deleting one does. A product buyers have received license keys from is kept, and the answer names the ones that stayed.
13184
+ * Deletes each product as deleting one does, and none of them without the `stock.write` permission where any holds unsold keys or files. `kept` in the answer is always empty: nothing is kept since November 24, 2026.
13129
13185
  *
13130
13186
  * Needs the `products.write` permission (Change Products).
13131
13187
  *
@@ -13183,7 +13239,7 @@ export interface ShoplyResourcesStock {
13183
13239
  *
13184
13240
  * Adds license keys to a variant's stock, up to 5,000 in one request. A variant and a store each hold as many unsold keys as the store's plan does.
13185
13241
  *
13186
- * A key sent twice is stocked twice, which is how one key is sold to several buyers. `duplicates` in the answer counts the ones that matched stock the variant already had, so sending the same batch a second time by mistake shows.
13242
+ * A key that would go to more than one buyer is a duplicate: one the variant delivered before, one it has in stock, or one sent twice in the same request. A request with any is refused with `duplicate_keys`, which counts each kind (`sold`, `inStock`, `repeated`), and nothing is added, unless `duplicates` says what to do. `skip` adds the rest and leaves them out; `keep` stocks every one, which is how one key is sold to several buyers. In the answer, `duplicates` counts the ones stocked and `leftOut` the ones left out.
13187
13243
  *
13188
13244
  * Needs the `stock.write` permission (Change Stock).
13189
13245
  *
@@ -13195,6 +13251,8 @@ export interface ShoplyResourcesStock {
13195
13251
  *
13196
13252
  * Makes the variant's unsold stock exactly the keys sent. Keys already delivered are not touched: they are order history, not stock. Up to 5,000 keys, and only for a variant with no more than that in stock: one with more is refused with `validation_error`, and its keys are added and deleted instead.
13197
13253
  *
13254
+ * A key the variant delivered before, or one sent twice, would go to more than one buyer, and is refused with `duplicate_keys` as Add license keys refuses it, unless `duplicates` says `skip` or `keep`. A key that is in the stock being replaced is not one.
13255
+ *
13198
13256
  * Needs the `stock.write` permission (Change Stock).
13199
13257
  *
13200
13258
  * @see https://docs.shoply.gg/api-reference/stock/replace-a-variants-license-keys
@@ -13245,17 +13303,29 @@ export interface ShoplyResourcesStock {
13245
13303
  /**
13246
13304
  * **Finish a file upload**
13247
13305
  *
13248
- * The last step of adding a file: says the file has been sent. Shoply checks it arrived and is the size that was said, and from then on buyers of the variant receive it.
13306
+ * The last step of adding a file: says the file has been sent. Shoply checks it arrived and is the size that was said, and from then on buyers of the variant receive it. For a new version started with "Start replacing a file", the answer is the file it replaced, under that file's own `id`, now with the new version's name and size.
13249
13307
  *
13250
13308
  * Needs the `stock.write` permission (Change Stock).
13251
13309
  *
13252
13310
  * @see https://docs.shoply.gg/api-reference/stock/finish-a-file-upload
13253
13311
  */
13254
13312
  finishFile(variantId: string, fileId: string, options?: RequestOptions): Promise<StockFinishFileResult>;
13313
+ /**
13314
+ * **Start replacing a file**
13315
+ *
13316
+ * The first of three steps to put a new version of a file in its place, the same three as adding one: this one says what the new version is and answers a signed address to send it to, then send it there with a `PUT`, then call "Finish a file upload" with the `id` this step answered.
13317
+ *
13318
+ * Once it is finished, everybody who bought the file downloads the new version, buyers of past orders too. The file keeps its own `id`, and every download link already sent goes on working. Until then they download the old one, so an upload that fails or is never finished changes nothing. It takes the old file's place rather than one more, so it counts against the variant's and the store's files as the old one did, and against the store's storage by the difference in size.
13319
+ *
13320
+ * Needs the `stock.write` permission (Change Stock).
13321
+ *
13322
+ * @see https://docs.shoply.gg/api-reference/stock/start-replacing-a-file
13323
+ */
13324
+ replaceFile(variantId: string, fileId: string, params: StockReplaceFileParams, options?: RequestOptions): Promise<StockReplaceFileResult>;
13255
13325
  /**
13256
13326
  * **Delete a file**
13257
13327
  *
13258
- * Removes a file from the variant. Buyers who already have a link to it can no longer download it.
13328
+ * Takes a file off the variant: buyers from now on are not sent it. Buyers who already paid for it keep downloading it, and it still counts against the store's file storage while they do. To give everybody a new version instead, use "Start replacing a file".
13259
13329
  *
13260
13330
  * Needs the `stock.write` permission (Change Stock).
13261
13331
  *
@@ -13613,6 +13683,8 @@ export interface ShoplyResourcesOrders {
13613
13683
  *
13614
13684
  * Send an `Idempotency-Key` with this request. The order is marked refunded only once the payment provider has said the money is on its way, or the buyer has been credited.
13615
13685
  *
13686
+ * A refund does not end a subscription the order started or renews: it carries on and renews as before, unless `cancelSubscription` says to cancel it too. Which subscription that is, while it is running, is `refund.subscription` on the order.
13687
+ *
13616
13688
  * Needs the `orders.refund` permission (Refund Orders).
13617
13689
  *
13618
13690
  * @see https://docs.shoply.gg/api-reference/orders/refund-an-order
@@ -78,6 +78,7 @@ export const OPERATIONS = [
78
78
  {"id":"stock.listFiles","name":"stock.listFiles","method":"GET","path":"/stores/{storeId}/variants/{variantId}/files","params":["variantId"],"query":[],"body":false,"upload":null,"file":false,"paged":false,"customer":false,"signedIn":true,"idempotent":false},
79
79
  {"id":"stock.addFile","name":"stock.addFile","method":"POST","path":"/stores/{storeId}/variants/{variantId}/files","params":["variantId"],"query":[],"body":true,"upload":null,"file":false,"paged":false,"customer":false,"signedIn":true,"idempotent":true},
80
80
  {"id":"stock.finishFile","name":"stock.finishFile","method":"POST","path":"/stores/{storeId}/variants/{variantId}/files/{fileId}/complete","params":["variantId","fileId"],"query":[],"body":false,"upload":null,"file":false,"paged":false,"customer":false,"signedIn":true,"idempotent":true},
81
+ {"id":"stock.replaceFile","name":"stock.replaceFile","method":"POST","path":"/stores/{storeId}/variants/{variantId}/files/{fileId}/replace","params":["variantId","fileId"],"query":[],"body":true,"upload":null,"file":false,"paged":false,"customer":false,"signedIn":true,"idempotent":true},
81
82
  {"id":"stock.deleteFile","name":"stock.deleteFile","method":"DELETE","path":"/stores/{storeId}/variants/{variantId}/files/{fileId}","params":["variantId","fileId"],"query":[],"body":false,"upload":null,"file":false,"paged":false,"customer":false,"signedIn":true,"idempotent":true},
82
83
  {"id":"categories.list","name":"categories.list","method":"GET","path":"/stores/{storeId}/categories","params":[],"query":["visibility"],"body":false,"upload":null,"file":false,"paged":false,"customer":false,"signedIn":true,"idempotent":false},
83
84
  {"id":"categories.create","name":"categories.create","method":"POST","path":"/stores/{storeId}/categories","params":[],"query":[],"body":true,"upload":null,"file":false,"paged":false,"customer":false,"signedIn":true,"idempotent":true},
package/index.js CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  import { EVENTS, OPERATIONS } from "./generated/operations.js";
16
16
 
17
- export const VERSION = "0.11.5";
17
+ export const VERSION = "0.12.0";
18
18
 
19
19
  const API = "https://api.shoply.gg/v1";
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoplygg/node",
3
- "version": "0.11.5",
3
+ "version": "0.12.0",
4
4
  "description": "Shoply's API from your own server: every route as a typed method, safe retries, pages, checking webhooks, and OAuth for apps.",
5
5
  "keywords": ["shoply", "api", "sdk", "ecommerce", "webhooks", "digital-goods"],
6
6
  "homepage": "https://docs.shoply.gg/api-reference/node",