@betterstore/sdk 0.3.92 → 0.3.94

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.94
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fixes
8
+
9
+ ## 0.3.93
10
+
11
+ ### Patch Changes
12
+
13
+ - bug fixes
14
+
3
15
  ## 0.3.92
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;
@@ -126,6 +157,8 @@ type ProductBillingInterval = "DAY" | "WEEK" | "MONTH" | "YEAR";
126
157
  type ProductBillingType = "ONE_TIME" | "SUBSCRIPTION";
127
158
  interface Product {
128
159
  id: string;
160
+ createdAt: Date;
161
+ updatedAt: Date;
129
162
  title: string;
130
163
  description?: string;
131
164
  images: string[];
@@ -157,16 +190,14 @@ interface Product {
157
190
  interface ProductWithoutVariants extends Omit<Product, "productVariants"> {
158
191
  }
159
192
  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;
193
+ collectionId?: StringArrayQueryType;
194
+ collectionSeoHandle?: StringArrayQueryType;
195
+ tags?: StringArrayQueryType;
196
+ createdAt?: DateQueryType;
197
+ updatedAt?: DateQueryType;
169
198
  };
199
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable" | "stockCommited" | "priceInCents";
200
+ type ListProductsParams = GetListParams<ListProductsSortBy, ListProductsQuery>;
170
201
  type RetrieveProductParams = {
171
202
  seoHandle: string;
172
203
  } | {
@@ -187,11 +218,7 @@ interface CollectionWithProducts extends Collection {
187
218
  }
188
219
  type ListCollectionsQuery = undefined;
189
220
  type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
190
- type ListCollectionsParams = {
191
- sortBy?: ListCollectionsSortBy;
192
- sortOrder?: "asc" | "desc";
193
- query?: ListCollectionsQuery;
194
- };
221
+ type ListCollectionsParams = GetListParams<ListCollectionsSortBy, ListCollectionsQuery>;
195
222
  type RetrieveCollectionParams = {
196
223
  seoHandle: string;
197
224
  } | {
@@ -264,25 +291,26 @@ interface Discount {
264
291
  organizationId: string;
265
292
  }
266
293
  type ListDiscountsQuery = {
267
- type?: Discount["type"];
268
- valueType?: Discount["valueType"];
269
- method?: Discount["method"];
270
- status?: Discount["status"];
271
- minimumRequirementsType?: Discount["minimumRequirementsType"];
272
- minimumRequirementsScope?: Discount["minimumRequirementsScope"];
273
- discountScope?: Discount["discountScope"];
274
- allowedCombinations?: Discount["allowedCombinations"];
275
- allowedProductIDs?: Discount["allowedProductIDs"];
276
- allowedCollectionIDs?: Discount["allowedCollectionIDs"];
277
- requiredProductIDs?: Discount["requiredProductIDs"];
278
- requiredCollectionIDs?: Discount["requiredCollectionIDs"];
279
- };
280
- type ListDiscountsSortBy = "createdAt" | "updatedAt";
281
- type ListDiscountsParams = {
282
- sortBy?: ListDiscountsSortBy;
283
- sortOrder?: "asc" | "desc";
284
- query?: ListDiscountsQuery;
294
+ type?: EnumQueryType<Discount["type"]>;
295
+ valueType?: EnumQueryType<Discount["valueType"]>;
296
+ method?: EnumQueryType<Discount["method"]>;
297
+ status?: EnumQueryType<Discount["status"]>;
298
+ minimumRequirementsType?: EnumQueryType<Discount["minimumRequirementsType"]>;
299
+ minimumRequirementsScope?: EnumQueryType<Discount["minimumRequirementsScope"]>;
300
+ discountScope?: EnumQueryType<Discount["discountScope"]>;
301
+ subscriptionDiscountDurationType?: EnumQueryType<Discount["subscriptionDiscountDurationType"]>;
302
+ allowedCombinations?: StringArrayQueryType<Discount["allowedCombinations"]>;
303
+ allowedProductIDs?: StringArrayQueryType<Discount["allowedProductIDs"]>;
304
+ allowedCollectionIDs?: StringArrayQueryType<Discount["allowedCollectionIDs"]>;
305
+ requiredProductIDs?: StringArrayQueryType<Discount["requiredProductIDs"]>;
306
+ requiredCollectionIDs?: StringArrayQueryType<Discount["requiredCollectionIDs"]>;
307
+ startsAt?: DateQueryType;
308
+ expiresAt?: OptionalDateQueryType;
309
+ createdAt?: DateQueryType;
310
+ updatedAt?: DateQueryType;
285
311
  };
312
+ type ListDiscountsSortBy = "createdAt" | "updatedAt" | "expiresAt" | "startsAt";
313
+ type ListDiscountsParams = GetListParams<ListDiscountsSortBy, ListDiscountsQuery>;
286
314
  type RetrieveDiscountParams = {
287
315
  id: string;
288
316
  } | {
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;
@@ -126,6 +157,8 @@ type ProductBillingInterval = "DAY" | "WEEK" | "MONTH" | "YEAR";
126
157
  type ProductBillingType = "ONE_TIME" | "SUBSCRIPTION";
127
158
  interface Product {
128
159
  id: string;
160
+ createdAt: Date;
161
+ updatedAt: Date;
129
162
  title: string;
130
163
  description?: string;
131
164
  images: string[];
@@ -157,16 +190,14 @@ interface Product {
157
190
  interface ProductWithoutVariants extends Omit<Product, "productVariants"> {
158
191
  }
159
192
  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;
193
+ collectionId?: StringArrayQueryType;
194
+ collectionSeoHandle?: StringArrayQueryType;
195
+ tags?: StringArrayQueryType;
196
+ createdAt?: DateQueryType;
197
+ updatedAt?: DateQueryType;
169
198
  };
199
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable" | "stockCommited" | "priceInCents";
200
+ type ListProductsParams = GetListParams<ListProductsSortBy, ListProductsQuery>;
170
201
  type RetrieveProductParams = {
171
202
  seoHandle: string;
172
203
  } | {
@@ -187,11 +218,7 @@ interface CollectionWithProducts extends Collection {
187
218
  }
188
219
  type ListCollectionsQuery = undefined;
189
220
  type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
190
- type ListCollectionsParams = {
191
- sortBy?: ListCollectionsSortBy;
192
- sortOrder?: "asc" | "desc";
193
- query?: ListCollectionsQuery;
194
- };
221
+ type ListCollectionsParams = GetListParams<ListCollectionsSortBy, ListCollectionsQuery>;
195
222
  type RetrieveCollectionParams = {
196
223
  seoHandle: string;
197
224
  } | {
@@ -264,25 +291,26 @@ interface Discount {
264
291
  organizationId: string;
265
292
  }
266
293
  type ListDiscountsQuery = {
267
- type?: Discount["type"];
268
- valueType?: Discount["valueType"];
269
- method?: Discount["method"];
270
- status?: Discount["status"];
271
- minimumRequirementsType?: Discount["minimumRequirementsType"];
272
- minimumRequirementsScope?: Discount["minimumRequirementsScope"];
273
- discountScope?: Discount["discountScope"];
274
- allowedCombinations?: Discount["allowedCombinations"];
275
- allowedProductIDs?: Discount["allowedProductIDs"];
276
- allowedCollectionIDs?: Discount["allowedCollectionIDs"];
277
- requiredProductIDs?: Discount["requiredProductIDs"];
278
- requiredCollectionIDs?: Discount["requiredCollectionIDs"];
279
- };
280
- type ListDiscountsSortBy = "createdAt" | "updatedAt";
281
- type ListDiscountsParams = {
282
- sortBy?: ListDiscountsSortBy;
283
- sortOrder?: "asc" | "desc";
284
- query?: ListDiscountsQuery;
294
+ type?: EnumQueryType<Discount["type"]>;
295
+ valueType?: EnumQueryType<Discount["valueType"]>;
296
+ method?: EnumQueryType<Discount["method"]>;
297
+ status?: EnumQueryType<Discount["status"]>;
298
+ minimumRequirementsType?: EnumQueryType<Discount["minimumRequirementsType"]>;
299
+ minimumRequirementsScope?: EnumQueryType<Discount["minimumRequirementsScope"]>;
300
+ discountScope?: EnumQueryType<Discount["discountScope"]>;
301
+ subscriptionDiscountDurationType?: EnumQueryType<Discount["subscriptionDiscountDurationType"]>;
302
+ allowedCombinations?: StringArrayQueryType<Discount["allowedCombinations"]>;
303
+ allowedProductIDs?: StringArrayQueryType<Discount["allowedProductIDs"]>;
304
+ allowedCollectionIDs?: StringArrayQueryType<Discount["allowedCollectionIDs"]>;
305
+ requiredProductIDs?: StringArrayQueryType<Discount["requiredProductIDs"]>;
306
+ requiredCollectionIDs?: StringArrayQueryType<Discount["requiredCollectionIDs"]>;
307
+ startsAt?: DateQueryType;
308
+ expiresAt?: OptionalDateQueryType;
309
+ createdAt?: DateQueryType;
310
+ updatedAt?: DateQueryType;
285
311
  };
312
+ type ListDiscountsSortBy = "createdAt" | "updatedAt" | "expiresAt" | "startsAt";
313
+ type ListDiscountsParams = GetListParams<ListDiscountsSortBy, ListDiscountsQuery>;
286
314
  type RetrieveDiscountParams = {
287
315
  id: string;
288
316
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.92",
3
+ "version": "0.3.94",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {