@medusajs/types 1.11.6 → 1.11.7-next-20231120154105

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.
@@ -26,25 +26,35 @@ export type Writable<T> = {
26
26
  *
27
27
  * An object that is used to configure how an entity is retrieved from the database. It accepts as a typed parameter an `Entity` class,
28
28
  * which provides correct typing of field names in its properties.
29
- *
30
- * @prop select - An array of strings, each being attribute names of the entity to retrieve in the result.
31
- * @prop skip - A number indicating the number of records to skip before retrieving the results.
32
- * @prop take - A number indicating the number of records to return in the result.
33
- * @prop relations - An array of strings, each being relation names of the entity to retrieve in the result.
34
- * @prop order -
35
- * An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`
36
- * to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
37
- * @prop withDeleted - A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the
38
- * `SoftDeletableEntity` class.
39
29
  */
40
30
  export interface FindConfig<Entity> {
31
+ /**
32
+ * An array of strings, each being attribute names of the entity to retrieve in the result.
33
+ */
41
34
  select?: (keyof Entity | string)[];
35
+ /**
36
+ * A number indicating the number of records to skip before retrieving the results.
37
+ */
42
38
  skip?: number;
39
+ /**
40
+ * A number indicating the number of records to return in the result.
41
+ */
43
42
  take?: number;
43
+ /**
44
+ * An array of strings, each being relation names of the entity to retrieve in the result.
45
+ */
44
46
  relations?: string[];
47
+ /**
48
+ * An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`
49
+ * to sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.
50
+ */
45
51
  order?: {
46
52
  [K: string]: "ASC" | "DESC";
47
53
  };
54
+ /**
55
+ * A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the
56
+ * `SoftDeletableEntity` class.
57
+ */
48
58
  withDeleted?: boolean;
49
59
  }
50
60
  export type ExtendedFindConfig<TEntity> = (Omit<FindOneOptions<TEntity>, "where" | "relations" | "select"> | Omit<FindManyOptions<TEntity>, "where" | "relations" | "select">) & {
@@ -4,12 +4,15 @@ export { FilterQuery } from "./utils";
4
4
  * @interface
5
5
  *
6
6
  * An object used to allow specifying flexible queries with and/or conditions.
7
- *
8
- * @prop $and - An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
9
- * @prop $or - An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
10
7
  */
11
8
  export interface BaseFilterable<T> {
9
+ /**
10
+ * An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.
11
+ */
12
12
  $and?: (T | BaseFilterable<T>)[];
13
+ /**
14
+ * An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
15
+ */
13
16
  $or?: (T | BaseFilterable<T>)[];
14
17
  }
15
18
  export interface OptionsQuery<T, P extends string = never> {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgCA,uDAAoC;AACpC,2CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmCA,uDAAoC;AACpC,2CAAwB"}
@@ -43,20 +43,22 @@ export interface TreeRepositoryService<T = any> extends BaseRepositoryService<T>
43
43
  * @interface
44
44
  *
45
45
  * An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
46
- *
47
- * @prop returnLinkableKeys - An array of strings, each being the ID attribute names of the entity's relations.
48
46
  */
49
47
  export type SoftDeleteReturn<TReturnableLinkableKeys = string> = {
48
+ /**
49
+ * An array of strings, each being the ID attribute names of the entity's relations.
50
+ */
50
51
  returnLinkableKeys?: TReturnableLinkableKeys[];
51
52
  };
52
53
  /**
53
54
  * @interface
54
55
  *
55
56
  * An object that is used to specify an entity's related entities that should be restored when the main entity is restored.
56
- *
57
- * @prop returnLinkableKeys - An array of strings, each being the ID attribute names of the entity's relations.
58
57
  */
59
58
  export type RestoreReturn<TReturnableLinkableKeys = string> = {
59
+ /**
60
+ * An array of strings, each being the ID attribute names of the entity's relations.
61
+ */
60
62
  returnLinkableKeys?: TReturnableLinkableKeys[];
61
63
  };
62
64
  export {};
@@ -195,77 +195,290 @@ export type InventoryLevelDTO = {
195
195
  updated_at: string | Date;
196
196
  deleted_at: string | Date | null;
197
197
  };
198
+ /**
199
+ * @interface
200
+ *
201
+ * The filters to apply on retrieved reservation items.
202
+ */
198
203
  export type FilterableReservationItemProps = {
204
+ /**
205
+ * The IDs to filter reservation items by.
206
+ */
199
207
  id?: string | string[];
208
+ /**
209
+ * @ignore
210
+ *
211
+ * @privateRemark
212
+ * This property is not used.
213
+ */
200
214
  type?: string | string[];
215
+ /**
216
+ * Filter reservation items by the ID of their associated line item.
217
+ */
201
218
  line_item_id?: string | string[];
219
+ /**
220
+ * Filter reservation items by the ID of their associated inventory item.
221
+ */
202
222
  inventory_item_id?: string | string[];
223
+ /**
224
+ * Filter reservation items by the ID of their associated location.
225
+ */
203
226
  location_id?: string | string[];
227
+ /**
228
+ * Description filters to apply on the reservation items' `description` attribute.
229
+ */
204
230
  description?: string | StringComparisonOperator;
231
+ /**
232
+ * The "created by" values to filter reservation items by.
233
+ */
205
234
  created_by?: string | string[];
235
+ /**
236
+ * Filters to apply on the reservation items' `quantity` attribute.
237
+ */
206
238
  quantity?: number | NumericalComparisonOperator;
207
239
  };
240
+ /**
241
+ * @interface
242
+ *
243
+ * The filters to apply on retrieved inventory items.
244
+ */
208
245
  export type FilterableInventoryItemProps = {
246
+ /**
247
+ * The IDs to filter inventory items by.
248
+ */
209
249
  id?: string | string[];
250
+ /**
251
+ * Filter inventory items by the ID of their associated location.
252
+ */
210
253
  location_id?: string | string[];
254
+ /**
255
+ * Search term to search inventory items' attributes.
256
+ */
211
257
  q?: string;
258
+ /**
259
+ * The SKUs to filter inventory items by.
260
+ */
212
261
  sku?: string | string[] | StringComparisonOperator;
262
+ /**
263
+ * The origin country to filter inventory items by.
264
+ */
213
265
  origin_country?: string | string[];
266
+ /**
267
+ * The HS Codes to filter inventory items by.
268
+ */
214
269
  hs_code?: string | string[] | StringComparisonOperator;
270
+ /**
271
+ * Filter inventory items by whether they require shipping.
272
+ */
215
273
  requires_shipping?: boolean;
216
274
  };
275
+ /**
276
+ * @interface
277
+ *
278
+ * The details of the inventory item to be created.
279
+ */
217
280
  export type CreateInventoryItemInput = {
281
+ /**
282
+ * The SKU of the inventory item.
283
+ */
218
284
  sku?: string | null;
285
+ /**
286
+ * The origin country of the inventory item.
287
+ */
219
288
  origin_country?: string | null;
289
+ /**
290
+ * The MID code of the inventory item.
291
+ */
220
292
  mid_code?: string | null;
293
+ /**
294
+ * The material of the inventory item.
295
+ */
221
296
  material?: string | null;
297
+ /**
298
+ * The weight of the inventory item.
299
+ */
222
300
  weight?: number | null;
301
+ /**
302
+ * The length of the inventory item.
303
+ */
223
304
  length?: number | null;
305
+ /**
306
+ * The height of the inventory item.
307
+ */
224
308
  height?: number | null;
309
+ /**
310
+ * The width of the inventory item.
311
+ */
225
312
  width?: number | null;
313
+ /**
314
+ * The title of the inventory item.
315
+ */
226
316
  title?: string | null;
317
+ /**
318
+ * The description of the inventory item.
319
+ */
227
320
  description?: string | null;
321
+ /**
322
+ * The thumbnail of the inventory item.
323
+ */
228
324
  thumbnail?: string | null;
325
+ /**
326
+ * Holds custom data in key-value pairs.
327
+ */
229
328
  metadata?: Record<string, unknown> | null;
329
+ /**
330
+ * The HS code of the inventory item.
331
+ */
230
332
  hs_code?: string | null;
333
+ /**
334
+ * Whether the inventory item requires shipping.
335
+ */
231
336
  requires_shipping?: boolean;
232
337
  };
338
+ /**
339
+ * @interface
340
+ *
341
+ * The details of the reservation item to be created.
342
+ */
233
343
  export type CreateReservationItemInput = {
344
+ /**
345
+ * The ID of the associated line item.
346
+ */
234
347
  line_item_id?: string;
348
+ /**
349
+ * The ID of the associated inventory item.
350
+ */
235
351
  inventory_item_id: string;
352
+ /**
353
+ * The ID of the associated location.
354
+ */
236
355
  location_id: string;
356
+ /**
357
+ * The reserved quantity.
358
+ */
237
359
  quantity: number;
360
+ /**
361
+ * The description of the reservation.
362
+ */
238
363
  description?: string;
364
+ /**
365
+ * The user or system that created the reservation. Can be any form of identification string.
366
+ */
239
367
  created_by?: string;
368
+ /**
369
+ * An ID associated with an external third-party system that the reservation item is connected to.
370
+ */
240
371
  external_id?: string;
372
+ /**
373
+ * Holds custom data in key-value pairs.
374
+ */
241
375
  metadata?: Record<string, unknown> | null;
242
376
  };
377
+ /**
378
+ * @interface
379
+ *
380
+ * The filters to apply on retrieved inventory levels.
381
+ */
243
382
  export type FilterableInventoryLevelProps = {
383
+ /**
384
+ * Filter inventory levels by the ID of their associated inventory item.
385
+ */
244
386
  inventory_item_id?: string | string[];
387
+ /**
388
+ * Filter inventory levels by the ID of their associated inventory location.
389
+ */
245
390
  location_id?: string | string[];
391
+ /**
392
+ * Filters to apply on inventory levels' `stocked_quantity` attribute.
393
+ */
246
394
  stocked_quantity?: number | NumericalComparisonOperator;
395
+ /**
396
+ * Filters to apply on inventory levels' `reserved_quantity` attribute.
397
+ */
247
398
  reserved_quantity?: number | NumericalComparisonOperator;
399
+ /**
400
+ * Filters to apply on inventory levels' `incoming_quantity` attribute.
401
+ */
248
402
  incoming_quantity?: number | NumericalComparisonOperator;
249
403
  };
404
+ /**
405
+ * @interface
406
+ *
407
+ * The details of the inventory level to be created.
408
+ */
250
409
  export type CreateInventoryLevelInput = {
410
+ /**
411
+ * The ID of the associated inventory item.
412
+ */
251
413
  inventory_item_id: string;
414
+ /**
415
+ * The ID of the associated location.
416
+ */
252
417
  location_id: string;
418
+ /**
419
+ * The stocked quantity of the associated inventory item in the associated location.
420
+ */
253
421
  stocked_quantity: number;
422
+ /**
423
+ * The reserved quantity of the associated inventory item in the associated location.
424
+ */
254
425
  reserved_quantity?: number;
426
+ /**
427
+ * The incoming quantity of the associated inventory item in the associated location.
428
+ */
255
429
  incoming_quantity?: number;
256
430
  };
431
+ /**
432
+ * @interface
433
+ *
434
+ * The attributes to update in an inventory level.
435
+ */
257
436
  export type UpdateInventoryLevelInput = {
437
+ /**
438
+ * The stocked quantity of the associated inventory item in the associated location.
439
+ */
258
440
  stocked_quantity?: number;
441
+ /**
442
+ * The incoming quantity of the associated inventory item in the associated location.
443
+ */
259
444
  incoming_quantity?: number;
260
445
  };
446
+ /**
447
+ * @interface
448
+ *
449
+ * The attributes to update in an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.
450
+ */
261
451
  export type BulkUpdateInventoryLevelInput = {
452
+ /**
453
+ * The ID of the associated inventory level.
454
+ */
262
455
  inventory_item_id: string;
456
+ /**
457
+ * The ID of the associated location.
458
+ */
263
459
  location_id: string;
264
460
  } & UpdateInventoryLevelInput;
461
+ /**
462
+ * @interface
463
+ *
464
+ * The attributes to update in a reservation item.
465
+ */
265
466
  export type UpdateReservationItemInput = {
467
+ /**
468
+ * The reserved quantity.
469
+ */
266
470
  quantity?: number;
471
+ /**
472
+ * The ID of the associated location.
473
+ */
267
474
  location_id?: string;
475
+ /**
476
+ * The description of the reservation item.
477
+ */
268
478
  description?: string;
479
+ /**
480
+ * Holds custom data in key-value pairs.
481
+ */
269
482
  metadata?: Record<string, unknown> | null;
270
483
  };
271
484
  export type ReserveQuantityContext = {