@compassdigital/sdk.typescript 4.699.0 → 4.701.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.
Files changed (50) hide show
  1. package/lib/index.d.ts +15 -1
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +18 -0
  4. package/lib/index.js.map +1 -1
  5. package/lib/interface/announcement.d.ts +7 -1
  6. package/lib/interface/announcement.d.ts.map +1 -1
  7. package/lib/interface/announcement.js +7 -0
  8. package/lib/interface/announcement.js.map +1 -1
  9. package/lib/interface/calendar.d.ts +6 -1
  10. package/lib/interface/calendar.d.ts.map +1 -1
  11. package/lib/interface/calendar.js +6 -0
  12. package/lib/interface/calendar.js.map +1 -1
  13. package/lib/interface/datalake.d.ts +24 -0
  14. package/lib/interface/datalake.d.ts.map +1 -1
  15. package/lib/interface/location.d.ts +22 -3
  16. package/lib/interface/location.d.ts.map +1 -1
  17. package/lib/interface/location.js +20 -0
  18. package/lib/interface/location.js.map +1 -1
  19. package/lib/interface/menu.d.ts +6 -1
  20. package/lib/interface/menu.d.ts.map +1 -1
  21. package/lib/interface/menu.js +6 -0
  22. package/lib/interface/menu.js.map +1 -1
  23. package/lib/interface/promo.d.ts +13 -2
  24. package/lib/interface/promo.d.ts.map +1 -1
  25. package/lib/interface/promo.js +12 -0
  26. package/lib/interface/promo.js.map +1 -1
  27. package/lib/interface/shoppingcart.d.ts +5 -1
  28. package/lib/interface/shoppingcart.d.ts.map +1 -1
  29. package/lib/interface/shoppingcart.js +5 -0
  30. package/lib/interface/shoppingcart.js.map +1 -1
  31. package/lib/interface/task.d.ts +11 -1
  32. package/lib/interface/task.d.ts.map +1 -1
  33. package/lib/interface/task.js +11 -0
  34. package/lib/interface/task.js.map +1 -1
  35. package/lib/interface/tax.d.ts +5 -1
  36. package/lib/interface/tax.d.ts.map +1 -1
  37. package/lib/interface/tax.js +5 -0
  38. package/lib/interface/tax.js.map +1 -1
  39. package/package.json +3 -3
  40. package/src/index.ts +44 -0
  41. package/src/interface/announcement.ts +7 -1
  42. package/src/interface/calendar.ts +6 -1
  43. package/src/interface/datalake.ts +36 -0
  44. package/src/interface/location.ts +22 -10
  45. package/src/interface/menu.ts +7 -1
  46. package/src/interface/promo.ts +13 -2
  47. package/src/interface/shoppingcart.ts +5 -1
  48. package/src/interface/task.ts +11 -9
  49. package/src/interface/tax.ts +5 -1
  50. package/test/client.test.ts +6 -2
@@ -58,7 +58,14 @@ export interface Promotion {
58
58
  meta?: PromoMeta;
59
59
  }
60
60
 
61
- export type Status = 'active' | 'scheduled' | 'paused' | 'expired' | 'archived';
61
+ export const Status = {
62
+ ACTIVE: 'active',
63
+ SCHEDULED: 'scheduled',
64
+ PAUSED: 'paused',
65
+ EXPIRED: 'expired',
66
+ ARCHIVED: 'archived',
67
+ } as const;
68
+ export type Status = (typeof Status)[keyof typeof Status];
62
69
 
63
70
  export interface DatetimeObject {
64
71
  year: number;
@@ -485,7 +492,11 @@ export interface Price {
485
492
 
486
493
  export type MonetaryValue = number;
487
494
 
488
- export type AmountOffExclusion = 'discount' | 'promo';
495
+ export const AmountOffExclusion = {
496
+ DISCOUNT: 'discount',
497
+ PROMO: 'promo',
498
+ } as const;
499
+ export type AmountOffExclusion = (typeof AmountOffExclusion)[keyof typeof AmountOffExclusion];
489
500
 
490
501
  export type IntegerValue = number;
491
502
 
@@ -572,7 +572,11 @@ export interface FPValidationData {
572
572
  [index: string]: any;
573
573
  }
574
574
 
575
- export type AmountOffExclusion = 'discount' | 'promo';
575
+ export const AmountOffExclusion = {
576
+ DISCOUNT: 'discount',
577
+ PROMO: 'promo',
578
+ } as const;
579
+ export type AmountOffExclusion = (typeof AmountOffExclusion)[keyof typeof AmountOffExclusion];
576
580
 
577
581
  export interface PromoOrder {
578
582
  items_applied_discount_amount?: number;
@@ -143,15 +143,17 @@ export interface OrderIssue {
143
143
  [index: string]: any;
144
144
  }
145
145
 
146
- export type TaskStatus =
147
- | 'new'
148
- | 'in_progress'
149
- | 'ready'
150
- | 'out_for_delivery'
151
- | 'delivered'
152
- | 'order_is_ready'
153
- | 'accepted'
154
- | 'cancelled';
146
+ export const TaskStatus = {
147
+ NEW: 'new',
148
+ IN_PROGRESS: 'in_progress',
149
+ READY: 'ready',
150
+ OUT_FOR_DELIVERY: 'out_for_delivery',
151
+ DELIVERED: 'delivered',
152
+ ORDER_IS_READY: 'order_is_ready',
153
+ ACCEPTED: 'accepted',
154
+ CANCELLED: 'cancelled',
155
+ } as const;
156
+ export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
155
157
 
156
158
  // POST /task - Create new Task
157
159
 
@@ -3,7 +3,11 @@
3
3
 
4
4
  import { RequestQuery, BaseRequest } from './util';
5
5
 
6
- export type TransactionType = 'pickup' | 'delivery';
6
+ export const TransactionType = {
7
+ PICKUP: 'pickup',
8
+ DELIVERY: 'delivery',
9
+ } as const;
10
+ export type TransactionType = (typeof TransactionType)[keyof typeof TransactionType];
7
11
 
8
12
  export interface TaxLocationData {
9
13
  // unique location identifier
@@ -152,10 +152,14 @@ describe('ServiceClient', () => {
152
152
  });
153
153
 
154
154
  test('client gives up after retry limit', async () => {
155
+ jest.useFakeTimers();
155
156
  const intercept = jest.fn(interceptor(500));
156
157
  const api = new ServiceClient({ stage: 'dev', intercept });
157
- const promise = api.get_task('', { retry: 5 });
158
- await expect(promise).rejects.toBeInstanceOf(ServiceError);
158
+ const assertion = expect(api.get_task('', { retry: 5 })).rejects.toBeInstanceOf(
159
+ ServiceError,
160
+ );
161
+ await jest.runAllTimersAsync();
162
+ await assertion;
159
163
  expect(intercept.mock.calls.length).toEqual(6);
160
164
  });
161
165