@betterstore/sdk 0.3.91 → 0.3.93

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.93
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fixes
8
+
9
+ ## 0.3.92
10
+
11
+ ### Patch Changes
12
+
13
+ - bug fixes
14
+
3
15
  ## 0.3.91
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -93,6 +93,37 @@ type RecursiveRecord = {
93
93
  [key: string]: any;
94
94
  };
95
95
 
96
+ type SortOrder = "asc" | "desc";
97
+ type GetListParams<A, B> = {
98
+ sortBy?: A;
99
+ sortOrder?: SortOrder;
100
+ query?: B;
101
+ };
102
+ type EnumQueryType<T> = {
103
+ in?: T[];
104
+ notIn?: T[];
105
+ not?: T;
106
+ };
107
+ type StringArrayQueryType<T = string> = {
108
+ has?: T[];
109
+ hasEvery?: T[];
110
+ hasSome?: T[];
111
+ equals?: T[];
112
+ isEmpty?: boolean;
113
+ };
114
+ type DateQueryType = {
115
+ in?: Date[];
116
+ notIn?: Date[];
117
+ not?: Date;
118
+ gt?: Date;
119
+ gte?: Date;
120
+ lt?: Date;
121
+ lte?: Date;
122
+ };
123
+ type OptionalDateQueryType = DateQueryType & {
124
+ isSet: boolean;
125
+ };
126
+
96
127
  interface VariantOption {
97
128
  name: string;
98
129
  value: string;
@@ -157,16 +188,12 @@ interface Product {
157
188
  interface ProductWithoutVariants extends Omit<Product, "productVariants"> {
158
189
  }
159
190
  type ListProductsQuery = {
160
- collectionId: string;
161
- } | {
162
- collectionSeoHandle: string;
163
- };
164
- type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable";
165
- type ListProductsParams = {
166
- sortBy?: ListProductsSortBy;
167
- sortOrder?: "asc" | "desc";
168
- query?: ListProductsQuery;
191
+ collectionId?: StringArrayQueryType;
192
+ collectionSeoHandle?: StringArrayQueryType;
193
+ tags?: StringArrayQueryType;
169
194
  };
195
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable" | "stockCommited" | "priceInCents";
196
+ type ListProductsParams = GetListParams<ListProductsSortBy, ListProductsQuery>;
170
197
  type RetrieveProductParams = {
171
198
  seoHandle: string;
172
199
  } | {
@@ -187,11 +214,7 @@ interface CollectionWithProducts extends Collection {
187
214
  }
188
215
  type ListCollectionsQuery = undefined;
189
216
  type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
190
- type ListCollectionsParams = {
191
- sortBy?: ListCollectionsSortBy;
192
- sortOrder?: "asc" | "desc";
193
- query?: ListCollectionsQuery;
194
- };
217
+ type ListCollectionsParams = GetListParams<ListCollectionsSortBy, ListCollectionsQuery>;
195
218
  type RetrieveCollectionParams = {
196
219
  seoHandle: string;
197
220
  } | {
@@ -264,17 +287,26 @@ interface Discount {
264
287
  organizationId: string;
265
288
  }
266
289
  type ListDiscountsQuery = {
267
- type?: Discount["type"];
268
- valueType?: Discount["valueType"];
269
- method?: Discount["method"];
270
- status?: Discount["status"];
271
- };
272
- type ListDiscountsSortBy = "createdAt" | "updatedAt";
273
- type ListDiscountsParams = {
274
- sortBy?: ListDiscountsSortBy;
275
- sortOrder?: "asc" | "desc";
276
- query?: ListDiscountsQuery;
290
+ type?: EnumQueryType<Discount["type"]>;
291
+ valueType?: EnumQueryType<Discount["valueType"]>;
292
+ method?: EnumQueryType<Discount["method"]>;
293
+ status?: EnumQueryType<Discount["status"]>;
294
+ minimumRequirementsType?: EnumQueryType<Discount["minimumRequirementsType"]>;
295
+ minimumRequirementsScope?: EnumQueryType<Discount["minimumRequirementsScope"]>;
296
+ discountScope?: EnumQueryType<Discount["discountScope"]>;
297
+ subscriptionDiscountDurationType?: EnumQueryType<Discount["subscriptionDiscountDurationType"]>;
298
+ allowedCombinations?: StringArrayQueryType<Discount["allowedCombinations"]>;
299
+ allowedProductIDs?: StringArrayQueryType<Discount["allowedProductIDs"]>;
300
+ allowedCollectionIDs?: StringArrayQueryType<Discount["allowedCollectionIDs"]>;
301
+ requiredProductIDs?: StringArrayQueryType<Discount["requiredProductIDs"]>;
302
+ requiredCollectionIDs?: StringArrayQueryType<Discount["requiredCollectionIDs"]>;
303
+ startsAt?: DateQueryType;
304
+ expiresAt?: OptionalDateQueryType;
305
+ createdAt?: DateQueryType;
306
+ updatedAt?: DateQueryType;
277
307
  };
308
+ type ListDiscountsSortBy = "createdAt" | "updatedAt" | "expiresAt" | "startsAt";
309
+ type ListDiscountsParams = GetListParams<ListDiscountsSortBy, ListDiscountsQuery>;
278
310
  type RetrieveDiscountParams = {
279
311
  id: string;
280
312
  } | {
package/dist/index.d.ts CHANGED
@@ -93,6 +93,37 @@ type RecursiveRecord = {
93
93
  [key: string]: any;
94
94
  };
95
95
 
96
+ type SortOrder = "asc" | "desc";
97
+ type GetListParams<A, B> = {
98
+ sortBy?: A;
99
+ sortOrder?: SortOrder;
100
+ query?: B;
101
+ };
102
+ type EnumQueryType<T> = {
103
+ in?: T[];
104
+ notIn?: T[];
105
+ not?: T;
106
+ };
107
+ type StringArrayQueryType<T = string> = {
108
+ has?: T[];
109
+ hasEvery?: T[];
110
+ hasSome?: T[];
111
+ equals?: T[];
112
+ isEmpty?: boolean;
113
+ };
114
+ type DateQueryType = {
115
+ in?: Date[];
116
+ notIn?: Date[];
117
+ not?: Date;
118
+ gt?: Date;
119
+ gte?: Date;
120
+ lt?: Date;
121
+ lte?: Date;
122
+ };
123
+ type OptionalDateQueryType = DateQueryType & {
124
+ isSet: boolean;
125
+ };
126
+
96
127
  interface VariantOption {
97
128
  name: string;
98
129
  value: string;
@@ -157,16 +188,12 @@ interface Product {
157
188
  interface ProductWithoutVariants extends Omit<Product, "productVariants"> {
158
189
  }
159
190
  type ListProductsQuery = {
160
- collectionId: string;
161
- } | {
162
- collectionSeoHandle: string;
163
- };
164
- type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable";
165
- type ListProductsParams = {
166
- sortBy?: ListProductsSortBy;
167
- sortOrder?: "asc" | "desc";
168
- query?: ListProductsQuery;
191
+ collectionId?: StringArrayQueryType;
192
+ collectionSeoHandle?: StringArrayQueryType;
193
+ tags?: StringArrayQueryType;
169
194
  };
195
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable" | "stockCommited" | "priceInCents";
196
+ type ListProductsParams = GetListParams<ListProductsSortBy, ListProductsQuery>;
170
197
  type RetrieveProductParams = {
171
198
  seoHandle: string;
172
199
  } | {
@@ -187,11 +214,7 @@ interface CollectionWithProducts extends Collection {
187
214
  }
188
215
  type ListCollectionsQuery = undefined;
189
216
  type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
190
- type ListCollectionsParams = {
191
- sortBy?: ListCollectionsSortBy;
192
- sortOrder?: "asc" | "desc";
193
- query?: ListCollectionsQuery;
194
- };
217
+ type ListCollectionsParams = GetListParams<ListCollectionsSortBy, ListCollectionsQuery>;
195
218
  type RetrieveCollectionParams = {
196
219
  seoHandle: string;
197
220
  } | {
@@ -264,17 +287,26 @@ interface Discount {
264
287
  organizationId: string;
265
288
  }
266
289
  type ListDiscountsQuery = {
267
- type?: Discount["type"];
268
- valueType?: Discount["valueType"];
269
- method?: Discount["method"];
270
- status?: Discount["status"];
271
- };
272
- type ListDiscountsSortBy = "createdAt" | "updatedAt";
273
- type ListDiscountsParams = {
274
- sortBy?: ListDiscountsSortBy;
275
- sortOrder?: "asc" | "desc";
276
- query?: ListDiscountsQuery;
290
+ type?: EnumQueryType<Discount["type"]>;
291
+ valueType?: EnumQueryType<Discount["valueType"]>;
292
+ method?: EnumQueryType<Discount["method"]>;
293
+ status?: EnumQueryType<Discount["status"]>;
294
+ minimumRequirementsType?: EnumQueryType<Discount["minimumRequirementsType"]>;
295
+ minimumRequirementsScope?: EnumQueryType<Discount["minimumRequirementsScope"]>;
296
+ discountScope?: EnumQueryType<Discount["discountScope"]>;
297
+ subscriptionDiscountDurationType?: EnumQueryType<Discount["subscriptionDiscountDurationType"]>;
298
+ allowedCombinations?: StringArrayQueryType<Discount["allowedCombinations"]>;
299
+ allowedProductIDs?: StringArrayQueryType<Discount["allowedProductIDs"]>;
300
+ allowedCollectionIDs?: StringArrayQueryType<Discount["allowedCollectionIDs"]>;
301
+ requiredProductIDs?: StringArrayQueryType<Discount["requiredProductIDs"]>;
302
+ requiredCollectionIDs?: StringArrayQueryType<Discount["requiredCollectionIDs"]>;
303
+ startsAt?: DateQueryType;
304
+ expiresAt?: OptionalDateQueryType;
305
+ createdAt?: DateQueryType;
306
+ updatedAt?: DateQueryType;
277
307
  };
308
+ type ListDiscountsSortBy = "createdAt" | "updatedAt" | "expiresAt" | "startsAt";
309
+ type ListDiscountsParams = GetListParams<ListDiscountsSortBy, ListDiscountsQuery>;
278
310
  type RetrieveDiscountParams = {
279
311
  id: string;
280
312
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.91",
3
+ "version": "0.3.93",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {